@stacksjs/stx 0.2.889 → 0.2.890

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 (177) hide show
  1. package/dist/{chunk-1n33yrar.js → chunk-062qfv99.js} +2 -2
  2. package/dist/{chunk-2a5g80mq.js → chunk-0jdz31q1.js} +3 -3
  3. package/dist/{chunk-mhxg6j6s.js → chunk-0jkj8thz.js} +1 -1
  4. package/dist/chunk-0q0nbq50.js +2 -0
  5. package/dist/{chunk-kj43fbzm.js → chunk-0wp23n1d.js} +1 -1
  6. package/dist/{chunk-cz1sdes5.js → chunk-115bb91s.js} +2 -2
  7. package/dist/{chunk-w82nk19t.js → chunk-12cjs6vs.js} +1 -1
  8. package/dist/chunk-1a7a8cjs.js +2 -0
  9. package/dist/{chunk-700m927w.js → chunk-1bft48gk.js} +2 -2
  10. package/dist/{chunk-6pz5gq6v.js → chunk-1jtsr42q.js} +20 -20
  11. package/dist/chunk-1ph2yhfn.js +3 -0
  12. package/dist/{chunk-f3cyghnb.js → chunk-1t15z230.js} +4 -4
  13. package/dist/{chunk-7212fwzz.js → chunk-1w0bqqh5.js} +2 -2
  14. package/dist/{chunk-s0mf56y1.js → chunk-2xnbdqy4.js} +4 -4
  15. package/dist/{chunk-2gn2nc2j.js → chunk-35j7gaj5.js} +1 -1
  16. package/dist/chunk-3b3mkgpj.js +3 -0
  17. package/dist/{chunk-snv80b1b.js → chunk-3bsz7zj3.js} +2 -2
  18. package/dist/chunk-3yvmaphj.js +2 -0
  19. package/dist/{chunk-njpva3zq.js → chunk-40k0r6z9.js} +1 -1
  20. package/dist/{chunk-eyx92t9n.js → chunk-41z7f41b.js} +2 -2
  21. package/dist/chunk-44teqn0b.js +2 -0
  22. package/dist/{chunk-b15c4g3e.js → chunk-49xwf7dk.js} +6 -6
  23. package/dist/chunk-4d85str1.js +2 -0
  24. package/dist/{chunk-7hpca9c7.js → chunk-4eescf3s.js} +4 -4
  25. package/dist/chunk-4xbtxeak.js +2 -0
  26. package/dist/{chunk-0ncafcs2.js → chunk-67j2m620.js} +3 -3
  27. package/dist/{chunk-5ssv10ep.js → chunk-690518hw.js} +1 -1
  28. package/dist/chunk-6s3jwysv.js +2 -0
  29. package/dist/{chunk-mt8edb75.js → chunk-6svc4kb8.js} +57 -57
  30. package/dist/{chunk-5kqezrjt.js → chunk-80ky40mm.js} +1 -1
  31. package/dist/chunk-850tye3c.js +2 -0
  32. package/dist/{chunk-eceeqy74.js → chunk-8ccgty8s.js} +2 -2
  33. package/dist/{chunk-1gyxxfdf.js → chunk-8f8qgjjr.js} +1 -1
  34. package/dist/{chunk-87g5xmmr.js → chunk-9344rq4r.js} +14 -14
  35. package/dist/chunk-94j4p584.js +2 -0
  36. package/dist/{chunk-446tb2th.js → chunk-97snfzsy.js} +49 -49
  37. package/dist/chunk-9a9cec4x.js +2 -0
  38. package/dist/{chunk-pctf14yw.js → chunk-9rjgq8k4.js} +1 -1
  39. package/dist/{chunk-q9tc9rdv.js → chunk-a0aqs5a8.js} +2 -2
  40. package/dist/{chunk-cgfjrgfw.js → chunk-a3zrwky3.js} +11 -11
  41. package/dist/{chunk-6gtecbe7.js → chunk-a7bqrjm5.js} +2 -2
  42. package/dist/{chunk-vc432a0w.js → chunk-adsqckg4.js} +9 -9
  43. package/dist/{chunk-51720m79.js → chunk-aj5tsksz.js} +9 -9
  44. package/dist/chunk-amb7e0fp.js +2 -0
  45. package/dist/chunk-arr79m90.js +2 -0
  46. package/dist/{chunk-9d91h636.js → chunk-b0hj8eg2.js} +2 -2
  47. package/dist/chunk-bm0mzk3b.js +2 -0
  48. package/dist/{chunk-ymqm898x.js → chunk-bvqgq18r.js} +2 -2
  49. package/dist/{chunk-m95sygv4.js → chunk-c25q87ys.js} +1 -1
  50. package/dist/{chunk-mgh5rst1.js → chunk-cphc60zw.js} +2 -2
  51. package/dist/{chunk-ranjkpc8.js → chunk-e16ef18k.js} +1 -1
  52. package/dist/chunk-e28czxw3.js +2 -0
  53. package/dist/{chunk-g6ap4085.js → chunk-e8szp5wa.js} +1 -1
  54. package/dist/chunk-eq86wzhr.js +1314 -0
  55. package/dist/chunk-essd43ad.js +2 -0
  56. package/dist/chunk-fsk3rk2x.js +2 -0
  57. package/dist/{chunk-s93yh7ed.js → chunk-g3vce7ka.js} +2 -2
  58. package/dist/{chunk-zwwhpxp7.js → chunk-g5nfqzfh.js} +2 -2
  59. package/dist/chunk-gfea8a9y.js +2 -0
  60. package/dist/chunk-hda7t8g6.js +2 -0
  61. package/dist/{chunk-dymck524.js → chunk-hyyh7qxw.js} +5 -5
  62. package/dist/chunk-j6fs31va.js +2 -0
  63. package/dist/chunk-j9kejcrx.js +2 -0
  64. package/dist/chunk-j9vfv53x.js +20 -0
  65. package/dist/chunk-jhbz5w30.js +2 -0
  66. package/dist/chunk-jvnsz2x9.js +2 -0
  67. package/dist/{chunk-bwx6w87c.js → chunk-k8bk685s.js} +1 -1
  68. package/dist/chunk-kexqmwx8.js +2 -0
  69. package/dist/{chunk-bqtj62ys.js → chunk-kg7vby72.js} +7 -7
  70. package/dist/{chunk-mjp1z9kz.js → chunk-khm56bfm.js} +1 -1
  71. package/dist/chunk-kpjq135z.js +2 -0
  72. package/dist/chunk-kqsm7gf1.js +2 -0
  73. package/dist/{chunk-mctzpw0w.js → chunk-kr2400c3.js} +4 -4
  74. package/dist/{chunk-b6bf0t02.js → chunk-mhrnjaka.js} +4 -4
  75. package/dist/chunk-mtfymhy1.js +2 -0
  76. package/dist/{chunk-eqffvse2.js → chunk-n6q1d66k.js} +1 -1
  77. package/dist/{chunk-3hsv6ejp.js → chunk-neg6ckjg.js} +7 -7
  78. package/dist/{chunk-hm9d40yf.js → chunk-nhv81gp2.js} +2 -2
  79. package/dist/{chunk-kbbbpae2.js → chunk-nq60tjkz.js} +2 -2
  80. package/dist/{chunk-kx09v9ya.js → chunk-nzpb263k.js} +9 -9
  81. package/dist/{chunk-6kyqejnq.js → chunk-p0bjbtdx.js} +20 -20
  82. package/dist/{chunk-967ydrq4.js → chunk-p3hbsrk9.js} +2 -2
  83. package/dist/chunk-p82fzxdg.js +2 -0
  84. package/dist/{chunk-pz554g43.js → chunk-pvm48tse.js} +3 -3
  85. package/dist/{chunk-zek9t5za.js → chunk-pwpge9bj.js} +2 -2
  86. package/dist/{chunk-58qzyyyv.js → chunk-qnf7w4xw.js} +1 -1
  87. package/dist/chunk-qsv84cwm.js +2 -0
  88. package/dist/chunk-r7m60q1m.js +2 -0
  89. package/dist/chunk-r98pye4h.js +2 -0
  90. package/dist/{chunk-6pdy7ajr.js → chunk-rd663v1m.js} +1 -1
  91. package/dist/{chunk-55tc5w32.js → chunk-sh7a0g09.js} +2 -2
  92. package/dist/chunk-sztr4d5g.js +2 -0
  93. package/dist/{chunk-95sd8h5g.js → chunk-t3zmfh8w.js} +3 -3
  94. package/dist/chunk-t4gcsbna.js +2 -0
  95. package/dist/chunk-tspqdt8e.js +2 -0
  96. package/dist/{chunk-sjjw6y49.js → chunk-v1mwwben.js} +4 -4
  97. package/dist/chunk-v6gkjg5f.js +3 -0
  98. package/dist/{chunk-48rwqchc.js → chunk-v90nz5xm.js} +9 -9
  99. package/dist/chunk-vfcbz0an.js +3 -0
  100. package/dist/{chunk-hgf7bc50.js → chunk-vkfw9k1n.js} +6 -6
  101. package/dist/{chunk-4kmg6g5n.js → chunk-vxbvrbqs.js} +9 -9
  102. package/dist/chunk-wedwczed.js +2 -0
  103. package/dist/chunk-wg6fmren.js +4 -0
  104. package/dist/{chunk-mw7hacm3.js → chunk-whcrca58.js} +21 -21
  105. package/dist/chunk-wmvvrsn0.js +2 -0
  106. package/dist/chunk-wnrh62by.js +2 -0
  107. package/dist/{chunk-nkyff7v6.js → chunk-wy6vjz1e.js} +17 -17
  108. package/dist/{chunk-brzjass3.js → chunk-xc5esqcb.js} +2 -2
  109. package/dist/{chunk-nbdscgvj.js → chunk-xeyq6d0t.js} +6 -6
  110. package/dist/{chunk-3dqfjpz4.js → chunk-xmg6bmh6.js} +29 -29
  111. package/dist/chunk-xwrjre34.js +2 -0
  112. package/dist/{chunk-p8shtje2.js → chunk-yesh4dfe.js} +45 -45
  113. package/dist/chunk-ymc1wgb3.js +2 -0
  114. package/dist/{chunk-6c1vm6bs.js → chunk-zkwkhesc.js} +2 -2
  115. package/dist/{chunk-me4yq8c2.js → chunk-zpqjsnz9.js} +2 -2
  116. package/dist/{chunk-hpzje67q.js → chunk-zwqkbk2m.js} +2 -2
  117. package/dist/chunk-zxjdfgdx.js +3 -0
  118. package/dist/cli.js +28 -28
  119. package/dist/component-contract.d.ts +1 -0
  120. package/dist/component-contract.js +6 -4
  121. package/dist/component-library.js +207 -58
  122. package/dist/composition-api.d.ts +7 -1
  123. package/dist/craft-entry.js +1 -1
  124. package/dist/craft.js +1 -1
  125. package/dist/emits-declaration.d.ts +9 -0
  126. package/dist/emits-declaration.js +64 -0
  127. package/dist/props-declaration.d.ts +2 -0
  128. package/dist/props-declaration.js +25 -0
  129. package/dist/pwa.js +3 -3
  130. package/dist/ssg.js +28 -28
  131. package/package.json +5 -5
  132. package/dist/chunk-0g9cceht.js +0 -2
  133. package/dist/chunk-0rpj5t80.js +0 -2
  134. package/dist/chunk-2ba4zfa0.js +0 -2
  135. package/dist/chunk-2wkpksg1.js +0 -2
  136. package/dist/chunk-3yjyjq0m.js +0 -2
  137. package/dist/chunk-444haxxa.js +0 -2
  138. package/dist/chunk-4rvfeee5.js +0 -2
  139. package/dist/chunk-5aa83bpm.js +0 -2
  140. package/dist/chunk-67rppc5v.js +0 -2
  141. package/dist/chunk-77c89d23.js +0 -2
  142. package/dist/chunk-79vbkez0.js +0 -2
  143. package/dist/chunk-8354mzpd.js +0 -2
  144. package/dist/chunk-8ygf6jnt.js +0 -2
  145. package/dist/chunk-94mpe1ny.js +0 -3
  146. package/dist/chunk-9n5h4sqc.js +0 -3
  147. package/dist/chunk-9ztn7w4y.js +0 -2
  148. package/dist/chunk-ankap9pc.js +0 -2
  149. package/dist/chunk-asnd03sr.js +0 -2
  150. package/dist/chunk-b0b5yr97.js +0 -2
  151. package/dist/chunk-b0e7dgv8.js +0 -3
  152. package/dist/chunk-b7jj45bz.js +0 -2
  153. package/dist/chunk-dzqfv801.js +0 -3
  154. package/dist/chunk-ery4tty7.js +0 -20
  155. package/dist/chunk-evwrxsxd.js +0 -3
  156. package/dist/chunk-fdqdz018.js +0 -2
  157. package/dist/chunk-gz9pknbw.js +0 -1204
  158. package/dist/chunk-hjb4c8g2.js +0 -2
  159. package/dist/chunk-jhbj9ja2.js +0 -2
  160. package/dist/chunk-k9abxnpa.js +0 -2
  161. package/dist/chunk-mvavjydq.js +0 -2
  162. package/dist/chunk-qqng9545.js +0 -2
  163. package/dist/chunk-rjm515e2.js +0 -2
  164. package/dist/chunk-rye4b2x3.js +0 -2
  165. package/dist/chunk-ryj8139z.js +0 -2
  166. package/dist/chunk-s9b809n2.js +0 -2
  167. package/dist/chunk-sb67wg5x.js +0 -2
  168. package/dist/chunk-sqwx2g02.js +0 -2
  169. package/dist/chunk-tpyekw0q.js +0 -2
  170. package/dist/chunk-v2627s75.js +0 -2
  171. package/dist/chunk-v98n53nk.js +0 -2
  172. package/dist/chunk-w34vvhm7.js +0 -2
  173. package/dist/chunk-wbmx0rge.js +0 -2
  174. package/dist/chunk-yjwa7ktk.js +0 -2
  175. package/dist/chunk-z47p2gx8.js +0 -2
  176. package/dist/chunk-z6kw6sct.js +0 -4
  177. package/dist/chunk-zhywjwdr.js +0 -2
@@ -1,11 +1,11 @@
1
1
  // @bun
2
- import{Hl,Vl}from"./chunk-mgh5rst1.js";import{J,Pr,Js,Ys,Ti,Ri,Zs,Ie,We,Se,re,Nr,Mr,he,oe,F,gt,Dr,Oi,Br,Je,s,g,Y,Pn}from"./chunk-gz9pknbw.js";import{m,M,ht,p}from"./chunk-3dqfjpz4.js";import{r}from"./chunk-b0e7dgv8.js";import{ge}from"./chunk-5kqezrjt.js";import{wr}from"./chunk-snv80b1b.js";import{b}from"./chunk-94mpe1ny.js";import{t}from"./chunk-3hsv6ejp.js";import{createHash as At}from"crypto";import K from"fs";import V from"path";import Le from"fs";function Ae(e,i,n){let o=Buffer.alloc(n),a=Le.readSync(e,o,0,n,i);return o.subarray(0,a)}function ze(e){if(e.length<25)return!1;let i=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(i(0,4)!=="RIFF"||i(8,12)!=="WEBP")return!1;let n=i(12,16);if(n==="VP8X")return(e[20]&16)!==0;if(n==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Ue(e){let i;try{i=Le.openSync(e,"r");let n=Ae(i,0,33);if(n.length>=3&&n[0]===255&&n[1]===216&&n[2]===255)return"none";if(n.length>=26&&n[0]===137&&n.toString("latin1",1,4)==="PNG"){let o=n[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ae(i,a,8);if(l.length<8)return"unknown";let u=l.toString("latin1",4,8);if(u==="tRNS")return"possible";if(u==="IDAT"||u==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(n.length>=25&&n.toString("latin1",0,4)==="RIFF"&&n.toString("latin1",8,12)==="WEBP"){if(ze(n))return"possible";let o=n.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(i!==void 0)Le.closeSync(i)}}import rn from"fs";import Fe from"os";import{fileURLToPath as bt}from"url";var Ee=Symbol("stx.image-worker.unavailable");function sn(e=typeof Fe.availableParallelism==="function"?Fe.availableParallelism():Fe.cpus().length){return Math.max(1,Math.min(2,e-1))}var _e=0,vt=[];async function on(){if(_e<sn()){_e++;return}await new Promise((e)=>vt.push(e)),_e++}function an(){_e--,vt.shift()?.()}var cn="@stacksjs/stx/builtins/image-warmup-worker";function ln(e=process.cwd()){let i=import.meta.url.endsWith(".ts")?"ts":"js";try{let n=new URL(`./image-warmup-worker.${i}`,import.meta.url);if(n.protocol==="file:"&&rn.existsSync(bt(n)))return bt(n)}catch{}return wr(cn,e)}var xt=!1;function ue(e){if(!xt)xt=!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 Ee}function Pe(e){return e instanceof Error?e.message:String(e)}async function He(e,i){let n;try{n=(await import("worker_threads")).Worker}catch(a){return ue(`could not load node:worker_threads: ${Pe(a)}`)}if(typeof n!=="function")return ue("node:worker_threads has no Worker in this runtime");let o=ln();if(!o)return ue("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await on();try{return await new Promise((a,c)=>{let l;try{l=new n(o)}catch(h){a(ue(`could not start ${o}: ${Pe(h)}`));return}let u=!1,f=!1,w=(h)=>{if(f)return;f=!0,h(),l.terminate()};l.on("message",(h)=>{if(h.type==="ready"){u=!0,l.postMessage({task:e,args:i});return}if(h.type==="result"){w(()=>a(h.value));return}let y=Error(h.error?.message??"image worker failed");if(h.error?.name)y.name=h.error.name;if(h.error?.stack)y.stack=h.error.stack;w(()=>c(y))}),l.on("error",(h)=>{w(()=>u?c(h instanceof Error?h:Error(Pe(h)||"image worker crashed")):a(ue(`the worker failed before it was ready: ${Pe(h)}`)))}),l.on("exit",(h)=>{w(()=>u?c(Error("image worker exited before it finished")):a(ue(`the worker exited with code ${h} before it was ready`)))})})}finally{an()}}var un=new Set([".avif",".jpeg",".jpg",".png",".webp"]),fn=[320,640,960,1280,1920],xe="/_stx/images",dn=`stx:${xe}:alpha-1`,gn=`stx:${xe}:opaque-1`,pn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Ne;function mn(e,i){let n=V.dirname(Bun.resolveSync(e,i));while(n!==V.dirname(n)){let o=V.join(n,"package.json");if(K.existsSync(o)){let a=JSON.parse(K.readFileSync(o,"utf8"));if(a.name===e)return a.version}n=V.dirname(n)}return}function wt(){if(Ne!==void 0)return Ne;let e;try{e=V.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Ne=pn.map((i)=>{let n;try{n=e?mn(i,e):void 0}catch{}return`${i.replace("@stacksjs/","")}@${n??"unknown"}`}).join("+"),Ne}var $t=Symbol.for("stx.image-delivery");function ve(){let e=globalThis;return e[$t]??={catalog:new Map,transparent:new Set},e[$t]}var St=new Set;function hn(e){return`/${e.split(V.sep).map(encodeURIComponent).join("/")}`}function yn(e){let i=V.extname(e),n=e.slice(0,-i.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=At("sha256").update(e).digest("hex").slice(0,8);return`${n||"image"}-${o}`}function Ct(e,i=`stx:${xe}`){let n=(o)=>`${xe}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:i,async stat(o){let a=V.join(e,o);try{let c=await K.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:n(o)}:null}catch{return null}},async write(o,a){let c=V.join(e,o);await K.promises.mkdir(V.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await K.promises.writeFile(l,a),await K.promises.rename(l,c),{bytes:a.byteLength,path:c,url:n(o)}},url:n}}async function It(e,i=e){let n=await K.promises.readdir(i,{withFileTypes:!0});n.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of n){let c=V.join(i,a.name);if(a.isDirectory()){o.push(...await It(e,c));continue}if(!a.isFile()||!un.has(V.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:V.relative(e,c)})}return o}function Rt(e,i){return e.map((n)=>({key:hn(n.relativePath),input:n.absolutePath,name:yn(n.relativePath),...bn(n.absolutePath)?{options:{storage:i}}:{}}))}function bn(e){return Ue(e)==="possible"}function xn(e){for(let i=3;i<e.length;i+=4)if(e[i]!==255)return!0;return!1}async function vn(e){let i=Object.entries(e).filter(([,c])=>c.fallback.format==="png"),n=new Set,o=8;if(i.length===0)return n;let{decode:a}=await import("ts-images");for(let c=0;c<i.length;c+=8)await Promise.all(i.slice(c,c+8).map(async([l,u])=>{let f=u.variants.filter((w)=>w.format==="png").sort((w,h)=>w.width-h.width)[0];try{let w=await a(new Uint8Array(await K.promises.readFile(f?.path??u.fallback.path)));if(xn(w.data))n.add(l)}catch{n.add(l)}}));return n}function wn(e,i){let n=[];for(let o of i){let a=e[o],c=a?.variants.filter((u)=>u.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((u)=>{let f;try{return f=K.openSync(u.path,"r"),!ze(Ae(f,0,32))}catch{return!0}finally{if(f!==void 0)K.closeSync(f)}}))continue;if(a.variants=a.variants.filter((u)=>u.format!=="webp"),delete a.sources.webp,n.push(o),!St.has(o))St.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 n}async function $n(e){let i=[],n=8;if(e.length===0)return i;let{generateThumbHash:o}=await import("ts-images");for(let a=0;a<e.length;a+=8){let c=e.slice(a,a+8),l=await Promise.all(c.map(async(u)=>{try{return await o(u.absolutePath),u}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${u.relativePath}`),null}}));i.push(...l.filter((u)=>u!==null))}return i}function qe(e){return V.join(e,"undecodable.json")}function Sn(e){try{let i=K.readFileSync(qe(e),"utf-8"),n=JSON.parse(i);return n&&typeof n==="object"?n:{}}catch{return{}}}function Cn(e,i){try{K.mkdirSync(V.dirname(qe(e)),{recursive:!0}),K.writeFileSync(qe(e),JSON.stringify(i))}catch{}}function kt(e){try{let i=K.statSync(e);return{mtimeMs:i.mtimeMs,size:i.size}}catch{return}}function Pt(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let i=e.split(/[?#]/,1)[0];if(!i)return;try{return`/${i.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function si(e){let i=Pt(e);return i?ve().catalog.get(i):void 0}function oi(e){let i=Pt(e);return i?ve().transparent.has(i):!1}function ii(e){let i=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),n=i(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:i(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<n).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function cy(e){let i=si(e);if(!i)return;return{src:i.fallback.url,srcset:i.sources[i.fallback.format]||"",sources:ii(i).map(({format:n,srcset:o})=>({type:`image/${n}`,srcset:o})),width:i.source.width,height:i.source.height,placeholder:oi(e)?void 0:i.placeholder?.dataUrl}}function Ts(){let e=ve();e.catalog=new Map,e.transparent=new Set}function Rn(e){let i=ve();i.catalog=new Map(e.entries),i.transparent=new Set(e.transparent)}async function ly(e,i,n={}){if(!e||!K.existsSync(e))return Ts(),{count:0,fingerprint:""};if(n.offThread){let d=await He("delivery",{publicDir:e,outputDir:i});if(d!==Ee)return Rn(d.state),d.result}let o=await It(e);if(o.length===0)return Ts(),{count:0,fingerprint:""};let a=Sn(i),c=o.filter((d)=>{let v=a[d.relativePath];if(!v)return!0;let k=kt(d.absolutePath);return!k||k.mtimeMs!==v.mtimeMs||k.size!==v.size});if(c.length===0)return Ts(),{count:0,fingerprint:""};let l=Ct(V.join(i,"_stx","images"),`${dn}:${wt()}`),u={outDir:V.join(i,"_stx","images"),storage:Ct(V.join(i,"_stx","images"),`${gn}:${wt()}`),baseUrl:xe,widths:fn,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},{createImageDeliveryCatalog:f}=await import("ts-images/delivery"),w=c,h;try{h=await f({...u,entries:Rt(c,l)})}catch(d){if(w=await $n(c),w.length===c.length)throw d;let v=new Set(w.map((A)=>A.relativePath)),k=!1;for(let A of c){if(v.has(A.relativePath))continue;let R=kt(A.absolutePath);if(!R)continue;a[A.relativePath]=R,k=!0}if(k)Cn(i,a);if(w.length===0)return Ts(),{count:0,fingerprint:""};h=await f({...u,entries:Rt(w,l)})}let y=await vn(h.entries),C=wn(h.entries,y),S=ve();S.catalog=new Map(Object.entries(h.entries)),S.transparent=y;let x=y.size===0&&C.length===0?h.fingerprint:At("sha256").update(h.fingerprint).update(JSON.stringify({transparent:[...y].sort(),droppedWebp:C.sort()})).digest("hex");return{count:w.length,fingerprint:x}}class _t{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let i of e.aliases)this.builtins.set(i.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,i,n,o){let a=Ti(e,o);if(a!==void 0)return a;for(let c of Ri(e,i,n,o))if(await s(c))return c;return null}}var fe=new _t;var ne="\x00stx-boolean-attribute";function Xe(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var kn=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 Ze(e){let i=e.toLowerCase();return i.startsWith("aria-")||i.startsWith("data-")||kn.has(i)}function se(e,i){let n=[];for(let[o,a]of Object.entries(e.static)){if(i.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)n.push(g(c));continue}if(a===ne){n.push(g(c));continue}n.push(`${g(c)}="${Pn(c,Xe(String(a)))}"`)}return n}function ie(e,i){let n=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(i.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){n.push(g(c));continue}if(typeof a==="object")continue;n.push(`${g(c)}="${Pn(c,Xe(String(a)))}"`)}return n}function An(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 Ve={name:"StxLink",aliases:["stx-link"],render(e,i,n){let o=An(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",u=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,f=[];if(o.reactive)f.push(`:href="${r(o.value)}"`);else f.push(`href="${r(Nr(o.value,"navigable"))}"`);if(a)f.push(`class="${r(a)}"`);if(f.push("data-stx-link"),f.push(`data-stx-active-class="${r(c)}"`),f.push(`data-stx-exact-active-class="${r(l)}"`),u)f.push("data-stx-prefetch");let w=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(w)f.push(`data-stx-active-match="${r(w)}"`);let h=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return f.push(...se(e,h)),f.push(...ie(e,h)),`<a ${f.join(" ")}>${i}</a>`}};var In=new Map;function Ge(e){if(!e)return;let i=e.split("?")[0].split("#")[0];return In.get(i)}var _n={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Ke=[320,640,768,1024,1280,1536,1920];function H(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let n=e.static[i];if(typeof n==="string")return n;return}function Oe(e,i,n=!1){let o=e.serverDynamic[i];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[i];if(a!==void 0)return a!=="false"&&a!==!1;return n}function Ye(e){if(e.includes("(")||e.includes(","))return e;let i=e.trim().split(/\s+/),n=[];for(let o of i)if(o.includes(":")){let[a,c]=o.split(":"),l=_n[a];if(l)n.push(`(max-width: ${l}px) ${c}`);else{let u=Number.parseInt(a);if(!Number.isNaN(u))n.push(`(max-width: ${u}px) ${c}`)}}else n.push(o);return n.join(", ")}function Qe(e,i,n,o){return i.map((a)=>`${we(e,a,void 0,n,o)} ${a}w`).join(", ")}function En(e,i,n,o,a){return i.map((c)=>{let l=n?n*c:void 0;return`${we(e,l,void 0,o,a)} ${c}x`}).join(", ")}function we(e,i,n,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(i)c.push(`w_${i}`);if(n)c.push(`h_${n}`);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(i)c.set("w",String(i));if(n)c.set("h",String(n));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(i)c.set("width",String(i));if(n)c.set("height",String(n));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function Nn(e){return`var s=this.style;${e.map((i)=>`s.${i}=''`).join(";")}`}function On(e,i,n="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${i}"><rect width="100%" height="100%" fill="${n}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var et={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,i,n){let o=H(e,"src")||"",a=si(o),c=H(e,"alt")||"",l=H(e,"width")||(a?String(a.source.width):void 0),u=H(e,"height")||(a?String(a.source.height):void 0),f=H(e,"sizes"),w=H(e,"srcset"),h=H(e,"densities"),y=H(e,"format"),C=oi(o)||Ge(o)?.transparent===!0,S=H(e,"placeholder")||(a&&!C?"thumbhash":void 0),x=H(e,"placeholderColor")||"#e5e7eb",d=H(e,"provider"),v=H(e,"class")||H(e,"className")||"",k=H(e,"style")||"",A=H(e,"objectFit")||H(e,"fit"),R=H(e,"objectPosition")||H(e,"position"),E=H(e,"quality"),G=Oe(e,"lazy",!0),z=Oe(e,"preload",!1),B=Oe(e,"priority",!1),L=H(e,"loading"),N=H(e,"decoding")||"async",q=!!a||Oe(e,"picture",!1)||!!y,I=l?Number.parseInt(l):void 0,_=u?Number.parseInt(u):void 0,T=w||"",U="";if(a)T=a.sources[a.fallback.format]||"",U=f?Ye(f):"100vw";else if(!T&&f&&d&&d!=="local"&&d!=="static")T=Qe(o,Ke,d,y),U=Ye(f);else if(!T&&h){let Z=h.split(/\s+/).map((P)=>Number.parseFloat(P.replace("x","")));T=En(o,Z,I,d,y)}else if(f)U=Ye(f);let D=[];if(k)D.push(k);if(A)D.push(`object-fit:${A}`);if(R)D.push(`object-position:${R}`);if(I&&_)D.push(`aspect-ratio:${I}/${_}`);let te=[],ae=S==="blur"||S==="color"||S==="thumbhash";if(ae&&!C){let Z=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:x}:Ge(o);if(Z&&S==="color")D.push(`background-color:${Z.color}`),te.push("backgroundColor");else if(Z)D.push(`background-color:${Z.color}`),D.push(`background-image:url(${Z.dataUrl})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),te.push("backgroundColor","backgroundImage");else{let P=On(I||16,_||9,x);D.push(`background-image:url(${P})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),te.push("backgroundImage")}}else if(!ae&&S&&S!=="empty"&&S!=="none")D.push(`background-image:url(${r(S)})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),te.push("backgroundImage");let j=a?.fallback.url||we(o,I,_,d,y),X=[];if(X.push(`src="${r(Nr(j,"fetched"))}"`),X.push(`alt="${r(c)}"`),l)X.push(`width="${r(l)}"`);if(u)X.push(`height="${r(u)}"`);let Re=L||(B||z?"eager":G?"lazy":"");if(Re)X.push(`loading="${r(Re)}"`);if(B)X.push('fetchpriority="high"');if(X.push(`decoding="${r(N)}"`),v)X.push(`class="${r(v)}"`);if(D.length>0)X.push(`style="${r(D.join(";"))}"`);if(T)X.push(`srcset="${r(Nr(T,"fetched"))}"`);if(U)X.push(`sizes="${r(U)}"`);let be=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(te.length>0){let Z=typeof e.static.onload==="string"?e.static.onload:"",P=Nn(te)+(Z?`;${Z}`:"");X.push(`onload="${r(P)}"`),be.add("onload")}X.push(...se(e,be)),X.push(...ie(e,be));let le=`<img ${X.join(" ")} />`,Q="";if(z){let P=y==="webp"?"image/webp":y==="avif"?"image/avif":"";Q=`<link rel="preload" as="image" href="${r(j)}"${P?` type="${P}"`:""}${T?` imagesrcset="${r(T)}"`:""}${U?` imagesizes="${r(U)}"`:""} />
2
+ import{Hl,Vl}from"./chunk-cphc60zw.js";import{J,Ir,Js,Ys,Ti,Ri,Zs,Oe,qe,ke,se,Mr,Dr,he,oe,F,mt,Lr,Oi,Fr,Ye,s,g,Y,On}from"./chunk-eq86wzhr.js";import{m,M,yt,p}from"./chunk-xmg6bmh6.js";import{r}from"./chunk-vfcbz0an.js";import{ge}from"./chunk-80ky40mm.js";import{vr}from"./chunk-3bsz7zj3.js";import{w}from"./chunk-v6gkjg5f.js";import{t}from"./chunk-neg6ckjg.js";import{createHash as At}from"crypto";import K from"fs";import V from"path";import Le from"fs";function Ae(e,i,n){let o=Buffer.alloc(n),a=Le.readSync(e,o,0,n,i);return o.subarray(0,a)}function ze(e){if(e.length<25)return!1;let i=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(i(0,4)!=="RIFF"||i(8,12)!=="WEBP")return!1;let n=i(12,16);if(n==="VP8X")return(e[20]&16)!==0;if(n==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Ue(e){let i;try{i=Le.openSync(e,"r");let n=Ae(i,0,33);if(n.length>=3&&n[0]===255&&n[1]===216&&n[2]===255)return"none";if(n.length>=26&&n[0]===137&&n.toString("latin1",1,4)==="PNG"){let o=n[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ae(i,a,8);if(l.length<8)return"unknown";let u=l.toString("latin1",4,8);if(u==="tRNS")return"possible";if(u==="IDAT"||u==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(n.length>=25&&n.toString("latin1",0,4)==="RIFF"&&n.toString("latin1",8,12)==="WEBP"){if(ze(n))return"possible";let o=n.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(i!==void 0)Le.closeSync(i)}}import rn from"fs";import Fe from"os";import{fileURLToPath as bt}from"url";var _e=Symbol("stx.image-worker.unavailable");function sn(e=typeof Fe.availableParallelism==="function"?Fe.availableParallelism():Fe.cpus().length){return Math.max(1,Math.min(2,e-1))}var Pe=0,vt=[];async function on(){if(Pe<sn()){Pe++;return}await new Promise((e)=>vt.push(e)),Pe++}function an(){Pe--,vt.shift()?.()}var cn="@stacksjs/stx/builtins/image-warmup-worker";function ln(e=process.cwd()){let i=import.meta.url.endsWith(".ts")?"ts":"js";try{let n=new URL(`./image-warmup-worker.${i}`,import.meta.url);if(n.protocol==="file:"&&rn.existsSync(bt(n)))return bt(n)}catch{}return vr(cn,e)}var xt=!1;function ue(e){if(!xt)xt=!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 _e}function Ie(e){return e instanceof Error?e.message:String(e)}async function We(e,i){let n;try{n=(await import("worker_threads")).Worker}catch(a){return ue(`could not load node:worker_threads: ${Ie(a)}`)}if(typeof n!=="function")return ue("node:worker_threads has no Worker in this runtime");let o=ln();if(!o)return ue("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await on();try{return await new Promise((a,c)=>{let l;try{l=new n(o)}catch(h){a(ue(`could not start ${o}: ${Ie(h)}`));return}let u=!1,f=!1,v=(h)=>{if(f)return;f=!0,h(),l.terminate()};l.on("message",(h)=>{if(h.type==="ready"){u=!0,l.postMessage({task:e,args:i});return}if(h.type==="result"){v(()=>a(h.value));return}let y=Error(h.error?.message??"image worker failed");if(h.error?.name)y.name=h.error.name;if(h.error?.stack)y.stack=h.error.stack;v(()=>c(y))}),l.on("error",(h)=>{v(()=>u?c(h instanceof Error?h:Error(Ie(h)||"image worker crashed")):a(ue(`the worker failed before it was ready: ${Ie(h)}`)))}),l.on("exit",(h)=>{v(()=>u?c(Error("image worker exited before it finished")):a(ue(`the worker exited with code ${h} before it was ready`)))})})}finally{an()}}var un=new Set([".avif",".jpeg",".jpg",".png",".webp"]),fn=[320,640,960,1280,1920],xe="/_stx/images",dn=`stx:${xe}:alpha-1`,gn=`stx:${xe}:opaque-1`,pn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Ee;function mn(e,i){let n=V.dirname(Bun.resolveSync(e,i));while(n!==V.dirname(n)){let o=V.join(n,"package.json");if(K.existsSync(o)){let a=JSON.parse(K.readFileSync(o,"utf8"));if(a.name===e)return a.version}n=V.dirname(n)}return}function wt(){if(Ee!==void 0)return Ee;let e;try{e=V.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Ee=pn.map((i)=>{let n;try{n=e?mn(i,e):void 0}catch{}return`${i.replace("@stacksjs/","")}@${n??"unknown"}`}).join("+"),Ee}var $t=Symbol.for("stx.image-delivery");function ve(){let e=globalThis;return e[$t]??={catalog:new Map,transparent:new Set},e[$t]}var St=new Set;function hn(e){return`/${e.split(V.sep).map(encodeURIComponent).join("/")}`}function yn(e){let i=V.extname(e),n=e.slice(0,-i.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=At("sha256").update(e).digest("hex").slice(0,8);return`${n||"image"}-${o}`}function Ct(e,i=`stx:${xe}`){let n=(o)=>`${xe}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:i,async stat(o){let a=V.join(e,o);try{let c=await K.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:n(o)}:null}catch{return null}},async write(o,a){let c=V.join(e,o);await K.promises.mkdir(V.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await K.promises.writeFile(l,a),await K.promises.rename(l,c),{bytes:a.byteLength,path:c,url:n(o)}},url:n}}async function It(e,i=e){let n=await K.promises.readdir(i,{withFileTypes:!0});n.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of n){let c=V.join(i,a.name);if(a.isDirectory()){o.push(...await It(e,c));continue}if(!a.isFile()||!un.has(V.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:V.relative(e,c)})}return o}function Rt(e,i){return e.map((n)=>({key:hn(n.relativePath),input:n.absolutePath,name:yn(n.relativePath),...bn(n.absolutePath)?{options:{storage:i}}:{}}))}function bn(e){return Ue(e)==="possible"}function xn(e){for(let i=3;i<e.length;i+=4)if(e[i]!==255)return!0;return!1}async function vn(e){let i=Object.entries(e).filter(([,c])=>c.fallback.format==="png"),n=new Set,o=8;if(i.length===0)return n;let{decode:a}=await import("ts-images");for(let c=0;c<i.length;c+=8)await Promise.all(i.slice(c,c+8).map(async([l,u])=>{let f=u.variants.filter((v)=>v.format==="png").sort((v,h)=>v.width-h.width)[0];try{let v=await a(new Uint8Array(await K.promises.readFile(f?.path??u.fallback.path)));if(xn(v.data))n.add(l)}catch{n.add(l)}}));return n}function wn(e,i){let n=[];for(let o of i){let a=e[o],c=a?.variants.filter((u)=>u.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((u)=>{let f;try{return f=K.openSync(u.path,"r"),!ze(Ae(f,0,32))}catch{return!0}finally{if(f!==void 0)K.closeSync(f)}}))continue;if(a.variants=a.variants.filter((u)=>u.format!=="webp"),delete a.sources.webp,n.push(o),!St.has(o))St.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 n}async function $n(e){let i=[],n=8;if(e.length===0)return i;let{generateThumbHash:o}=await import("ts-images");for(let a=0;a<e.length;a+=8){let c=e.slice(a,a+8),l=await Promise.all(c.map(async(u)=>{try{return await o(u.absolutePath),u}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${u.relativePath}`),null}}));i.push(...l.filter((u)=>u!==null))}return i}function He(e){return V.join(e,"undecodable.json")}function Sn(e){try{let i=K.readFileSync(He(e),"utf-8"),n=JSON.parse(i);return n&&typeof n==="object"?n:{}}catch{return{}}}function Cn(e,i){try{K.mkdirSync(V.dirname(He(e)),{recursive:!0}),K.writeFileSync(He(e),JSON.stringify(i))}catch{}}function kt(e){try{let i=K.statSync(e);return{mtimeMs:i.mtimeMs,size:i.size}}catch{return}}function Pt(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let i=e.split(/[?#]/,1)[0];if(!i)return;try{return`/${i.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function si(e){let i=Pt(e);return i?ve().catalog.get(i):void 0}function oi(e){let i=Pt(e);return i?ve().transparent.has(i):!1}function ii(e){let i=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),n=i(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:i(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<n).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function cy(e){let i=si(e);if(!i)return;return{src:i.fallback.url,srcset:i.sources[i.fallback.format]||"",sources:ii(i).map(({format:n,srcset:o})=>({type:`image/${n}`,srcset:o})),width:i.source.width,height:i.source.height,placeholder:oi(e)?void 0:i.placeholder?.dataUrl}}function Ts(){let e=ve();e.catalog=new Map,e.transparent=new Set}function Rn(e){let i=ve();i.catalog=new Map(e.entries),i.transparent=new Set(e.transparent)}async function ly(e,i,n={}){if(!e||!K.existsSync(e))return Ts(),{count:0,fingerprint:""};if(n.offThread){let d=await We("delivery",{publicDir:e,outputDir:i});if(d!==_e)return Rn(d.state),d.result}let o=await It(e);if(o.length===0)return Ts(),{count:0,fingerprint:""};let a=Sn(i),c=o.filter((d)=>{let x=a[d.relativePath];if(!x)return!0;let k=kt(d.absolutePath);return!k||k.mtimeMs!==x.mtimeMs||k.size!==x.size});if(c.length===0)return Ts(),{count:0,fingerprint:""};let l=Ct(V.join(i,"_stx","images"),`${dn}:${wt()}`),u={outDir:V.join(i,"_stx","images"),storage:Ct(V.join(i,"_stx","images"),`${gn}:${wt()}`),baseUrl:xe,widths:fn,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},{createImageDeliveryCatalog:f}=await import("ts-images/delivery"),v=c,h;try{h=await f({...u,entries:Rt(c,l)})}catch(d){if(v=await $n(c),v.length===c.length)throw d;let x=new Set(v.map((A)=>A.relativePath)),k=!1;for(let A of c){if(x.has(A.relativePath))continue;let R=kt(A.absolutePath);if(!R)continue;a[A.relativePath]=R,k=!0}if(k)Cn(i,a);if(v.length===0)return Ts(),{count:0,fingerprint:""};h=await f({...u,entries:Rt(v,l)})}let y=await vn(h.entries),C=wn(h.entries,y),S=ve();S.catalog=new Map(Object.entries(h.entries)),S.transparent=y;let b=y.size===0&&C.length===0?h.fingerprint:At("sha256").update(h.fingerprint).update(JSON.stringify({transparent:[...y].sort(),droppedWebp:C.sort()})).digest("hex");return{count:v.length,fingerprint:b}}class _t{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let i of e.aliases)this.builtins.set(i.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,i,n,o){let a=Ti(e,o);if(a!==void 0)return a;for(let c of Ri(e,i,n,o))if(await s(c))return c;return null}}var fe=new _t;var ne="\x00stx-boolean-attribute";function Xe(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var kn=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 Ze(e){let i=e.toLowerCase();return i.startsWith("aria-")||i.startsWith("data-")||kn.has(i)}function re(e,i){let n=[];for(let[o,a]of Object.entries(e.static)){if(i.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)n.push(g(c));continue}if(a===ne){n.push(g(c));continue}n.push(`${g(c)}="${On(c,Xe(String(a)))}"`)}return n}function ie(e,i){let n=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(i.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){n.push(g(c));continue}if(typeof a==="object")continue;n.push(`${g(c)}="${On(c,Xe(String(a)))}"`)}return n}function An(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 Ve={name:"StxLink",aliases:["stx-link"],render(e,i,n){let o=An(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",u=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,f=[];if(o.reactive)f.push(`:href="${r(o.value)}"`);else f.push(`href="${r(Mr(o.value,"navigable"))}"`);if(a)f.push(`class="${r(a)}"`);if(f.push("data-stx-link"),f.push(`data-stx-active-class="${r(c)}"`),f.push(`data-stx-exact-active-class="${r(l)}"`),u)f.push("data-stx-prefetch");let v=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(v)f.push(`data-stx-active-match="${r(v)}"`);let h=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return f.push(...re(e,h)),f.push(...ie(e,h)),`<a ${f.join(" ")}>${i}</a>`}};var In=new Map;function Ge(e){if(!e)return;let i=e.split("?")[0].split("#")[0];return In.get(i)}var Pn={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Ke=[320,640,768,1024,1280,1536,1920];function H(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let n=e.static[i];if(typeof n==="string")return n;return}function Ne(e,i,n=!1){let o=e.serverDynamic[i];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[i];if(a!==void 0)return a!=="false"&&a!==!1;return n}function Je(e){if(e.includes("(")||e.includes(","))return e;let i=e.trim().split(/\s+/),n=[];for(let o of i)if(o.includes(":")){let[a,c]=o.split(":"),l=Pn[a];if(l)n.push(`(max-width: ${l}px) ${c}`);else{let u=Number.parseInt(a);if(!Number.isNaN(u))n.push(`(max-width: ${u}px) ${c}`)}}else n.push(o);return n.join(", ")}function Qe(e,i,n,o){return i.map((a)=>`${we(e,a,void 0,n,o)} ${a}w`).join(", ")}function _n(e,i,n,o,a){return i.map((c)=>{let l=n?n*c:void 0;return`${we(e,l,void 0,o,a)} ${c}x`}).join(", ")}function we(e,i,n,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(i)c.push(`w_${i}`);if(n)c.push(`h_${n}`);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(i)c.set("w",String(i));if(n)c.set("h",String(n));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(i)c.set("width",String(i));if(n)c.set("height",String(n));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function En(e){return`var s=this.style;${e.map((i)=>`s.${i}=''`).join(";")}`}function Nn(e,i,n="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${i}"><rect width="100%" height="100%" fill="${n}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var et={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,i,n){let o=H(e,"src")||"",a=si(o),c=H(e,"alt")||"",l=H(e,"width")||(a?String(a.source.width):void 0),u=H(e,"height")||(a?String(a.source.height):void 0),f=H(e,"sizes"),v=H(e,"srcset"),h=H(e,"densities"),y=H(e,"format"),C=oi(o)||Ge(o)?.transparent===!0,S=H(e,"placeholder")||(a&&!C?"thumbhash":void 0),b=H(e,"placeholderColor")||"#e5e7eb",d=H(e,"provider"),x=H(e,"class")||H(e,"className")||"",k=H(e,"style")||"",A=H(e,"objectFit")||H(e,"fit"),R=H(e,"objectPosition")||H(e,"position"),E=H(e,"quality"),G=Ne(e,"lazy",!0),z=Ne(e,"preload",!1),B=Ne(e,"priority",!1),L=H(e,"loading"),N=H(e,"decoding")||"async",q=!!a||Ne(e,"picture",!1)||!!y,I=l?Number.parseInt(l):void 0,_=u?Number.parseInt(u):void 0,T=v||"",U="";if(a)T=a.sources[a.fallback.format]||"",U=f?Je(f):"100vw";else if(!T&&f&&d&&d!=="local"&&d!=="static")T=Qe(o,Ke,d,y),U=Je(f);else if(!T&&h){let Z=h.split(/\s+/).map((P)=>Number.parseFloat(P.replace("x","")));T=_n(o,Z,I,d,y)}else if(f)U=Je(f);let D=[];if(k)D.push(k);if(A)D.push(`object-fit:${A}`);if(R)D.push(`object-position:${R}`);if(I&&_)D.push(`aspect-ratio:${I}/${_}`);let te=[],ae=S==="blur"||S==="color"||S==="thumbhash";if(ae&&!C){let Z=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:b}:Ge(o);if(Z&&S==="color")D.push(`background-color:${Z.color}`),te.push("backgroundColor");else if(Z)D.push(`background-color:${Z.color}`),D.push(`background-image:url(${Z.dataUrl})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),te.push("backgroundColor","backgroundImage");else{let P=Nn(I||16,_||9,b);D.push(`background-image:url(${P})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),te.push("backgroundImage")}}else if(!ae&&S&&S!=="empty"&&S!=="none")D.push(`background-image:url(${r(S)})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),te.push("backgroundImage");let j=a?.fallback.url||we(o,I,_,d,y),X=[];if(X.push(`src="${r(Mr(j,"fetched"))}"`),X.push(`alt="${r(c)}"`),l)X.push(`width="${r(l)}"`);if(u)X.push(`height="${r(u)}"`);let Ce=L||(B||z?"eager":G?"lazy":"");if(Ce)X.push(`loading="${r(Ce)}"`);if(B)X.push('fetchpriority="high"');if(X.push(`decoding="${r(N)}"`),x)X.push(`class="${r(x)}"`);if(D.length>0)X.push(`style="${r(D.join(";"))}"`);if(T)X.push(`srcset="${r(Mr(T,"fetched"))}"`);if(U)X.push(`sizes="${r(U)}"`);let be=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(te.length>0){let Z=typeof e.static.onload==="string"?e.static.onload:"",P=En(te)+(Z?`;${Z}`:"");X.push(`onload="${r(P)}"`),be.add("onload")}X.push(...re(e,be)),X.push(...ie(e,be));let le=`<img ${X.join(" ")} />`,Q="";if(z){let P=y==="webp"?"image/webp":y==="avif"?"image/avif":"";Q=`<link rel="preload" as="image" href="${r(j)}"${P?` type="${P}"`:""}${T?` imagesrcset="${r(T)}"`:""}${U?` imagesizes="${r(U)}"`:""} />
3
3
  `}if(q){let Z=[];if(a)for(let P of ii(a))Z.push(`<source type="image/${P.format}" srcset="${r(P.srcset)}"${U?` sizes="${r(U)}"`:""} />`);if(!a&&(y==="avif"||y==="auto")){let P=we(o,I,_,d,"avif"),O=T?Qe(o,Ke,d,"avif"):`${P}`;Z.push(`<source type="image/avif" srcset="${r(O)}"${U?` sizes="${r(U)}"`:""} />`)}if(!a&&(y==="webp"||y==="auto")){let P=we(o,I,_,d,"webp"),O=T?Qe(o,Ke,d,"webp"):`${P}`;Z.push(`<source type="image/webp" srcset="${r(O)}"${U?` sizes="${r(U)}"`:""} />`)}return`${Q}<picture>
4
4
  ${Z.join(`
5
5
  `)}
6
6
  ${le}
7
- </picture>`}return`${Q}${le}`}};var Et="/images/safe-image-default.svg";function de(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let n=e.static[i];if(typeof n==="string")return n;return}var Bn=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${Et}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,tt={name:"SafeImage",aliases:["safe-image","safe-img"],render(e,i,n){let o=de(e,"src")||"",a=de(e,"alt")||"",c=de(e,"fallback")||Et,l=de(e,"class")||de(e,"className")||"",u=de(e,"fallbackClassName")||"",f=[];if(f.push(`src="${r(o)}"`),f.push(`alt="${r(a)}"`),l)f.push(`class="${r(l)}"`);if(f.push(`data-fallback="${r(c)}"`),u)f.push(`data-fallback-class="${r(u)}"`);f.push('onerror="window.__stxSafeImageHandler(this)"');let w=new Set(["src","alt","fallback","class","className","fallbackClassName"]);f.push(...se(e,w)),f.push(...ie(e,w));let h=`<img ${f.join(" ")} />`,y=n.context;if(!y.__safeImageHandlerEmitted)return y.__safeImageHandlerEmitted=!0,`${Bn}${h}`;return h}};function nt(e){return e.replace(/[;{}()]/g,"").replace(/url/gi,"")}function $e(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let n=e.static[i];if(typeof n==="string")return n;return}function Be(e,i,n){let o=$e(e,i);if(o!==void 0){let a=Number.parseInt(o,10);if(!Number.isNaN(a))return a}return n}var rt={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render(e,i,n){let o=nt($e(e,"color")||"#6366f1"),a=nt($e(e,"initialColor")||$e(e,"initial-color")||""),c=nt($e(e,"height")||"3px"),l=Be(e,"duration",2000),u=Be(e,"throttle",200),f=Be(e,"zIndex",999999)||Be(e,"z-index",999999),w=a?`linear-gradient(to right, ${a}, ${o})`:o;return`
8
- <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${c};background:${w};z-index:${f};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
7
+ </picture>`}return`${Q}${le}`}};var Et="/images/safe-image-default.svg";function de(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let n=e.static[i];if(typeof n==="string")return n;return}var Bn=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${Et}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,tt={name:"SafeImage",aliases:["safe-image","safe-img"],render(e,i,n){let o=de(e,"src")||"",a=de(e,"alt")||"",c=de(e,"fallback")||Et,l=de(e,"class")||de(e,"className")||"",u=de(e,"fallbackClassName")||"",f=[];if(f.push(`src="${r(o)}"`),f.push(`alt="${r(a)}"`),l)f.push(`class="${r(l)}"`);if(f.push(`data-fallback="${r(c)}"`),u)f.push(`data-fallback-class="${r(u)}"`);f.push('onerror="window.__stxSafeImageHandler(this)"');let v=new Set(["src","alt","fallback","class","className","fallbackClassName"]);f.push(...re(e,v)),f.push(...ie(e,v));let h=`<img ${f.join(" ")} />`,y=n.context;if(!y.__safeImageHandlerEmitted)return y.__safeImageHandlerEmitted=!0,`${Bn}${h}`;return h}};function nt(e){return e.replace(/[;{}()]/g,"").replace(/url/gi,"")}function $e(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let n=e.static[i];if(typeof n==="string")return n;return}function Be(e,i,n){let o=$e(e,i);if(o!==void 0){let a=Number.parseInt(o,10);if(!Number.isNaN(a))return a}return n}var rt={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render(e,i,n){let o=nt($e(e,"color")||"#6366f1"),a=nt($e(e,"initialColor")||$e(e,"initial-color")||""),c=nt($e(e,"height")||"3px"),l=Be(e,"duration",2000),u=Be(e,"throttle",200),f=Be(e,"zIndex",999999)||Be(e,"z-index",999999),v=a?`linear-gradient(to right, ${a}, ${o})`:o;return`
8
+ <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${c};background:${v};z-index:${f};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
9
9
  <div style="position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,0.4) 50%,transparent 100%);animation:stx-shimmer 1.5s infinite"></div>
10
10
  </div>
11
11
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
@@ -28,7 +28,7 @@ ${le}
28
28
  @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
29
29
  .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
30
30
  .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
31
- </style>`}};function pe(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let n=e.static[i];if(typeof n==="string")return n;return}var Tt={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},ot={name:"StxDrawer",aliases:["stx-drawer"],render(e,i,n){let o=pe(e,"id");if(!o)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let a=r(o),c=pe(e,"side")||"right",l=pe(e,"size")||"md",u=pe(e,"closeOnBackdrop")!=="false",f=pe(e,"closeOnEscape")!=="false",w=pe(e,"overlay")!=="false",h=Tt[l]||Tt.md,y=c==="left",C=y?"left:0":"right:0",S=y?"translateX(-100%)":"translateX(100%)",x=y?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${a}" class="stx-drawer-backdrop" data-stx-drawer="${a}" data-close-backdrop="${u}" data-close-escape="${f}" style="display:none;position:fixed;inset:0;z-index:99999;${w?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
31
+ </style>`}};function pe(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let n=e.static[i];if(typeof n==="string")return n;return}var Tt={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},ot={name:"StxDrawer",aliases:["stx-drawer"],render(e,i,n){let o=pe(e,"id");if(!o)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let a=r(o),c=pe(e,"side")||"right",l=pe(e,"size")||"md",u=pe(e,"closeOnBackdrop")!=="false",f=pe(e,"closeOnEscape")!=="false",v=pe(e,"overlay")!=="false",h=Tt[l]||Tt.md,y=c==="left",C=y?"left:0":"right:0",S=y?"translateX(-100%)":"translateX(100%)",b=y?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${a}" class="stx-drawer-backdrop" data-stx-drawer="${a}" data-close-backdrop="${u}" data-close-escape="${f}" style="display:none;position:fixed;inset:0;z-index:99999;${v?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
32
32
  <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${C};width:${h};max-width:100vw;transform:${S};transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);background:var(--stx-drawer-bg,#fff);color:var(--stx-drawer-text,#1f2937);box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow-y:auto;pointer-events:auto">
33
33
  <div style="padding:1.5rem">${i}</div>
34
34
  </div>
@@ -37,6 +37,6 @@ ${le}
37
37
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
38
38
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
39
39
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
40
- </style>`}};import{existsSync as Dn,readFileSync as jn}from"fs";var De=new Map,Dt=new Set;function Mn(e){if(Dt.has(e))return;Dt.add(e),console.warn(`[stx] icon collection "${e}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${e}\`.`)}function Ln(e){let i=process.cwd();for(let n of[`${i}/node_modules/@iconify-json/${e}/icons.json`,`${i}/pantry/@iconify-json/${e}/icons.json`,`${i}/node_modules/@iconify/json/json/${e}.json`,`${i}/pantry/@iconify/json/json/${e}.json`])if(Dn(n))return n;for(let n of[`@iconify-json/${e}/icons.json`,`@iconify/json/json/${e}.json`])try{return b.resolve(n)}catch{}return null}function zn(e){if(De.has(e))return De.get(e);let i=Ln(e);if(!i)return Mn(e),null;try{let n=JSON.parse(jn(i,"utf8"));return De.set(e,n),n}catch{return null}}function Un(e,i,n,o){let a=[];if(i.rotate)a.push(`rotate(${i.rotate*90} ${n/2} ${o/2})`);if(i.hFlip)a.push(`translate(${n} 0) scale(-1 1)`);if(i.vFlip)a.push(`translate(0 ${o}) scale(1 -1)`);return a.length?`<g transform="${a.join(" ")}">${e}</g>`:e}function Fn(e,i){let n=i,o=e.icons[n],a={hFlip:!1,vFlip:!1,rotate:0};for(let u=0;!o&&u<8;u++){let f=e.aliases?.[n];if(!f)return null;if(f.hFlip)a.hFlip=!a.hFlip;if(f.vFlip)a.vFlip=!a.vFlip;if(f.rotate)a.rotate=((a.rotate+f.rotate)%4+4)%4;n=f.parent,o=e.icons[n]}if(!o)return null;let c=o.width??e.width??24,l=o.height??e.height??24;return{body:Un(o.body,a,c,l),width:c,height:l}}function me(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);if(e.static[i]!==void 0)return String(e.static[i]);if(e.clientReactive[i]!==void 0)return e.clientReactive[i];return}var at={name:"Icon",aliases:["icon","stx-icon"],render(e,i,n){let o=me(e,"name")??me(e,"icon");if(!o)return"<!-- Icon: missing name/icon prop -->";let a="lucide",c=o;if(o.includes(":")){let v=o.split(":");a=v[0],c=v[1]}let l=r(me(e,"size")||"24"),u=r(me(e,"color")||"currentColor"),f=r(me(e,"class")||""),w=r(me(e,"style")||""),h=De.get(a)??zn(a);if(!h)return`<!-- Icon: collection "${a}" not loaded -->`;let y=Fn(h,c);if(!y)return`<!-- Icon: "${c}" not found in ${a} -->`;let C=`0 0 ${y.width} ${y.height}`,S=y.body;if(u!=="currentColor")S=S.replace(/currentColor/g,u);let x=f?` class="${f}"`:"",d=w?` style="${w}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${l}" height="${l}" viewBox="${C}" fill="none"${x}${d}>${S}</svg>`}};function jt(e,...i){for(let n of i){if(e.serverDynamic[n]!==void 0)return String(e.serverDynamic[n]);let o=e.static[n];if(typeof o==="string")return o}return}function Mt(e,i){let n=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${i}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),o=e.match(n);if(!o)return{region:null,rest:e};return{region:o[2],rest:e.replace(o[0],"")}}var ct={name:"Suspense",aliases:["suspense"],render(e,i,n){let o=Mt(i,"fallback"),a=o.rest,c=Mt(a,"error"),l=c.rest,u=o.region??jt(e,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',f=c.region??jt(e,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${u}</div><div data-stx-suspense-error hidden>${f}</div><div data-stx-suspense-content hidden>${l}</div></div>`}};function je(e,...i){for(let n of i){if(e.serverDynamic[n]!==void 0)return String(e.serverDynamic[n]);let o=e.static[n];if(typeof o==="string")return o}return}var lt={name:"TransitionGroup",aliases:["transition-group"],render(e,i,n){let o=(je(e,"name")||"v").replace(/["'<>]/g,""),a=(je(e,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",c=je(e,"class"),l=je(e,"id"),u=[`data-stx-transition-group="${o}"`,c?`class="${c}"`:"",l?`id="${l}"`:""].filter(Boolean).join(" ");return`<${a} ${u}>${i}</${a}>`}};function Lt(e=fe){e.registerBuiltin(Ve),e.registerBuiltin(et),e.registerBuiltin(tt),e.registerBuiltin(rt),e.registerBuiltin(st),e.registerBuiltin(it),e.registerBuiltin(ot),e.registerBuiltin(at),e.registerBuiltin(ct),e.registerBuiltin(lt)}var zt=new Map;function Wn(e){let i=zt.get(e.source);if(!i)i=new RegExp(`(${e.source})(?![\\w.:-])`,"y"),zt.set(e.source,i);return i}var Ut=new WeakMap;function Ft(e){let i=Ut.get(e);if(!i)i=new Set([...e].map((o)=>o.toLowerCase())),Ut.set(e,i);let n=i;return(o)=>!/[a-z]/.test(o)&&n.has(o.toLowerCase())}function Hn(e,i){let n="";for(let o=i;o<e.length;o++){let a=e[o];if(n){if(a==="\\")o++;else if(a===n)n=""}else if(a==='"'||a==="'")n=a;else if(a===">")return o}return e.length}function Wt(e,i,n){let o=[],a=0,c=typeof n==="function"?n:n?(l)=>n.has(l.toLowerCase()):void 0;while(a<e.length){let l=e.indexOf("<",a);if(l===-1)break;let u=Wn(i);u.lastIndex=l+1;let f=u.exec(e);if(!f){a=l+1;continue}let w=f[1];if(c&&c(w)){let v=l+1+w.length;while(v<e.length&&e[v]!==">")v++;a=v+1;continue}let h=l+1+w.length,y=null,C=h,S=-1,x=!1;while(h<e.length){let v=e[h];if(y){if(v==="\\"&&h+1<e.length){h+=2;continue}if(v===y)y=null;h++;continue}if(v==='"'||v==="'"){y=v,h++;continue}if(v==="/"&&h+1<e.length&&e[h+1]===">"){S=h+2,x=!0;break}if(v===">"){S=h+1;break}h++}if(S===-1){a=l+1;continue}let d=e.slice(C,x?S-2:S-1).trim();if(x)o.push({fullMatch:e.slice(l,S),tagName:w,attributes:d,content:"",startIndex:l,endIndex:S,isSelfClosing:!0}),a=S;else{let v=`<${w}`,k=`</${w}>`,A=1,R=S,E=-1;while(A>0&&R<e.length){let B=e.indexOf(v,R),L=e.indexOf(k,R);if(L===-1)break;if(B!==-1&&B<L){let N=e[B+v.length];if(N===" "||N===">"||N==="/"||N===`
41
- `||N==="\t"){let q=Hn(e,B+v.length);if(e[q-1]!=="/")A++;R=q+1}else R=B+v.length}else{if(A--,A===0){E=L;break}R=L+k.length}}if(E===-1){a=S;continue}let G=e.slice(S,E),z=E+k.length;o.push({fullMatch:e.slice(l,z),tagName:w,attributes:d,content:G,startIndex:l,endIndex:z,isSelfClosing:!1}),a=z}}return o}function ut(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function Ht(e,i){try{let n=Buffer.from(e,"base64").toString("utf8");return JSON.parse(n)}catch{}try{let n=e.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(n)}catch(n){if(i?.debug)console.error("Error decoding __stx_ prop:",n);return e}}function Me(e,i){let n=0,o="",a=i;while(a<e.length){let c=e[a];if(o){if(c==="\\")a++;else if(c===o)o=""}else if(c==='"'||c==="'"||c==="`")o=c;else if(c==="{")n++;else if(c==="}"){if(n--,n===0)return e.slice(i,a+1)}a++}return e.slice(i)}function qt(e){let i=e.trim();if(!i.startsWith("{")||!i.endsWith("}"))return null;if(Me(i,0).length!==i.length)return null;return i.slice(1,-1).trim()}function Xt(e){let i=[],n=0,o=e.length;while(n<o){while(n<o&&/\s/.test(e[n]))n++;if(n>=o)break;let a="";while(n<o&&!/[\s=]/.test(e[n]))a+=e[n],n++;if(!a)break;while(n<o&&/\s/.test(e[n]))n++;if(n<o&&e[n]==="="){n++;while(n<o&&/\s/.test(e[n]))n++;let c="";if(n<o&&(e[n]==='"'||e[n]==="'")){let l=e[n];n++;while(n<o&&e[n]!==l){if(e[n]==="\\"&&n+1<o)n++,c+=e[n];else c+=e[n];n++}if(n<o)n++}else if(e[n]==="{")c=Me(e,n),n+=c.length;else while(n<o&&!/\s/.test(e[n]))c+=e[n],n++;i.push({name:a,value:c})}else i.push({name:a,value:!0})}return i}var qn=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),Xn=new Set([":for","x-for","v-for","@for"]),Zt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Zn(e){return ft(e).map((i)=>[i.start,i.end])}function ft(e){let i=[],n=new Map;for(let o of Ie(e)){let a=o.name.toLowerCase();if(o.closing){let w=n.get(a)?.pop();if(w)w.end=o.end;continue}let l=/(?::for|x-for|v-for|@for)\s*=/.test(o.attributes)?Xt(o.attributes).find((w)=>Xn.has(w.name)):void 0,u=typeof l?.value==="string"?l.value:null,f=u!==null?{start:o.start,end:o.end,names:oe(u),tag:a}:null;if(f)i.push(f);if(!o.selfClosing&&!Zt.has(a)){let w=n.get(a);if(!w)w=[],n.set(a,w);w.push(f)}}return i}var Vn=/(?:^|\s)((?:[\w-]+:)*-?space-[xy]-(?!reverse(?:\s|$))[\w./[\]-]+)(?=\s|$)/;function Vt(e){let i=new Map,n=[];for(let o of Ie(e)){let a=o.name.toLowerCase();if(o.closing){for(let l=n.length-1;l>=0;l--)if(n[l].name===a){n.length=l;break}continue}let c=n.at(-1);if(c){if(c.utility&&c.children>0)i.set(o.start,c.utility);if(!/(?:^|\s)hidden(?=[\s=]|$)/.test(o.attributes))c.children++}if(!o.selfClosing&&!Zt.has(a)){let l=/(?:^|\s)class\s*=\s*(["'])([\s\S]*?)\1/.exec(o.attributes)?.[2];n.push({name:a,utility:l?Vn.exec(l)?.[1]??null:null,children:0})}}return i}function Gt(e){if(typeof e==="string")return e;if(Array.isArray(e))return e.filter(Boolean).map((i)=>Gt(i)).join(" ");if(e&&typeof e==="object")return Object.entries(e).filter(([,i])=>i).map(([i])=>i).join(" ");return e?String(e):""}function Oc(e,i){if(!/:[\w-]+=/.test(e))return e;let n=e,o=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,a=[],c;while((c=o.exec(e))!==null)a.push([c.index,c.index+c[0].length]);a.push(...Zn(e));let l=new Set([...gt(i),...Array.isArray(i.__stx_client_declared_names)?i.__stx_client_declared_names:[]]);function u(y){return a.some(([C,S])=>y>=C&&y<S)}let f=[],w=new Map,h=256;for(let y of Ie(n)){if(y.closing||u(y.start))continue;let C=y.attributes.trimEnd();if(!C||!C.includes(":"))continue;let S=/(?:^|\s)data-native(?:\s|=|$)/i.test(C.replace(/"[^"]*"|'[^']*'/g,"")),x=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,d,v=C,k=!1;while((d=x.exec(C))!==null){if(Mr(C,d.index,!0)?.kind==="attribute")continue;let A=d[1],R=d[2];if(Hl(A))continue;if(F(R,l))continue;if(R.includes("()")&&!R.includes(".get(")||R.includes("$store")||R.includes("$ref"))continue;try{let E=Object.keys(i),G=Object.values(i),z=R.match(/^([a-zA-Z_$][\w$]*)/);if(z&&!E.includes(z[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(z[1]))continue;let B=JSON.stringify([E,R]),L=w.get(B);if(!L){if(L=Function(...E,`return (${R})`),w.size>=h)w.clear();w.set(B,L)}let N=L(...G);if(A==="class"){let q=Y(Gt(N));if(q){let I=v.match(/\sclass="([^"]*)"/);if(I)v=v.replace(I[0],()=>` class="${I[1]} ${q}"`);else v=v.replace(d[0],()=>` class="${q}"`)}else v=v.replace(d[0],"");k=!0;continue}if(qn.has(A)){if(N)v=v.replace(d[0],` ${A}`);else v=v.replace(d[0],"");k=!0;continue}if(N===null||N===void 0||N===!1)v=v.replace(d[0],"");else{let q=S&&typeof N==="object"?JSON.stringify(N):String(N),I=Pn(A,q);v=v.replace(d[0],()=>` ${A}="${I}"`)}k=!0}catch(E){if(E instanceof he)throw E;continue}}if(k){let A=y.selfClosing?" /":"",E=`<${y.name}${v}${A}>`;f.push({start:y.start,end:y.end,replacement:E})}}if(f.length>0){let y=Array(f.length*2+1),C=0;for(let S=0;S<f.length;S++){let{start:x,end:d,replacement:v}=f[S];y[S*2]=n.slice(C,x),y[S*2+1]=v,C=d}y[f.length*2]=n.slice(C),n=y.join("")}return n}import Kt from"fs";import Jt from"path";var Yt=!1;function Gn(e,i,n,o=!1,a=new Set){let c={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},l=new Set(Array.isArray(i.__stx_client_signal_names)?i.__stx_client_signal_names:[]),u=(C)=>{if(l.size===0)return!1;let S=t(C),x=S.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(x&&l.has(x))return!0;for(let d of l){let v=d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${v}\\s*\\(`).test(S))return!0}return!1},f=new Set(Vl),w=(C)=>{if(!C.includes("-")||C.startsWith("@")||C.startsWith(":")||C.startsWith("x-")||C.startsWith("__"))return C;if(C.startsWith("aria-")||C.startsWith("data-"))return C;return C.replace(/-([a-z0-9])/g,(S,x)=>x.toUpperCase())},h=(C,S)=>{let x=w(C);if(c.static[x]=S,x!==C)c.staticNames[x]=C},y={...e};for(let[C,S]of Object.entries(e)){let x=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(C);if(!x)continue;delete y[C];let d=x[1]||"modelValue";if(y[`:${d}`]=S,y[`@update:${d}`]=`${S} = $event`,x[2]){let v=x[2].slice(1).split(".").map((k)=>`${k}: true`).join(", ");y[`:${x[1]?`${d}Modifiers`:"modelModifiers"}`]=`{ ${v} }`}}for(let[C,S]of Object.entries(y)){let x=C.startsWith("x-")&&!f.has(C)&&!C.startsWith("x-bind:")&&!C.startsWith("x-on:")?`:${C.slice(2)}`:C;if(x.startsWith("@")){c.events[x]=S;continue}if(x.startsWith("__stx_")){let d=w(x.slice(6));c.serverDynamic[d]=Ht(S,n);continue}if(x.startsWith(":")){let d=w(x.slice(1)),v=S===ne?d:S;if(d==="if"||d==="for"||d==="show"){c.clientReactive[d]=v;continue}if(o){c.clientReactive[d]=v;continue}if(F(v,a)){c.clientReactive[d]=v;continue}if(u(v)){c.clientReactive[d]=v;continue}try{if(!m(v)){if(n.debug)console.error(`Unsafe expression in :${d} binding: ${v}`);c.clientReactive[d]=v;continue}let k=Object.keys(i),A=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]),R=new Set(Array.isArray(i.__stx_client_declared_names)?i.__stx_client_declared_names:[]);if(ht(v).some((B)=>!A.has(B)&&!k.includes(B)&&(!(B in globalThis)||R.has(B)))){c.clientReactive[d]=v;continue}let z=p(v,k)(...Object.values(i));if(c.serverDynamic[d]=z,d!==x.slice(1)&&c.serverDynamicNames)c.serverDynamicNames[d]=x.slice(1)}catch{c.clientReactive[d]=v}continue}if(typeof S==="string"&&S.includes("{{")&&S.includes("}}")){let d=Qn(S,a);if(d!==null){c.clientReactive[w(x)]=d;continue}let v=S.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(v)try{let k=v[1];if(m(k)){let R=p(k,Object.keys(i))(...Object.values(i));h(x,R!=null?String(R):"")}else{if(n.debug)console.error(`Unsafe expression in ${x}: ${k}`);h(x,S)}}catch(k){if(n.debug)console.error(`Error evaluating expression for ${x}:`,k);h(x,S)}else{let k=S,A=/\{\{\s*([\s\S]+?)\s*\}\}/g,R;while((R=A.exec(S))!==null)try{let E=R[1];if(!m(E)){if(n.debug)console.error(`Unsafe expression in ${x}: ${E}`);continue}let z=p(E,Object.keys(i))(...Object.values(i));k=k.replace(R[0],String(z??""))}catch(E){if(n.debug)console.error(`Error evaluating expression in ${x}:`,E)}h(x,k)}continue}h(x,S===ne?"true":ut(S))}return c}var dt=new Set;function uy(){dt.clear()}function Kn(e){let i=/^\s*(?:<!--[\s\S]*?-->\s*)*<(?:div|span)\b((?:[^>"']|"[^"]*"|'[^']*')*)>/.exec(e);return!!i&&/\sdata-stx-component-wrapper(?=[\s=]|$)/.test(i[1])&&!/\sstx-hydrate(?=[\s=]|$)/.test(i[1])}function Jn(e,i,n){let o=`${n}\x00${e}\x00${i}`;if(dt.has(o))return;dt.add(o);let a=/space-x-/.test(i)?"flex":"flex flex-col",c=i.replace(/space-[xy]-/,"gap-");console.warn(`[stx] <${e}> in ${n} is a later child of a "${i}" stack, so it gets no spacing: the utility puts its margin on the component's scope wrapper, which generates no box. Use "${a} ${c}" on the parent instead -- gap reaches through the wrapper.`)}var pt=new Set;function dy(){pt.clear()}function Yn(e,i){let n=`${i}\x00${e}`;if(pt.has(n))return;pt.add(n),console.warn(`[stx] <${e}> in ${i} is inside a <template :for>, so its props and slot expressions will not see the loop variables and render empty. Put the directive on the element the loop repeats instead -- <tr :for="..."> or <span :for="..." class="contents"> -- which binds correctly.`)}function Qn(e,i){if(i.size===0)return null;let n=/\{\{\s*([\s\S]+?)\s*\}\}/g,o=[...e.matchAll(n)];if(!o.some((u)=>F(u[1],i)))return null;let a=e.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(a&&o.length===1)return a[1];let c="",l=0;for(let u of o)c+=e.slice(l,u.index).replace(/[`\\$]/g,(f)=>`\\${f}`),c+=`\${${u[1]}}`,l=u.index+u[0].length;return c+=e.slice(l).replace(/[`\\$]/g,(u)=>`\\${u}`),`\`${c}\``}var er=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function tr(e,i,n){if(!e.includes("@"))return e;if(!er.some(([a,c])=>a.test(e)&&e.includes(c)))return e;try{return ge(e,i,n)}catch{return e}}function ye(e){let i={},n=0,o=e.length;while(n<o){while(n<o&&/\s/.test(e[n]))n++;if(n>=o)break;let a="";while(n<o&&!/[\s=]/.test(e[n]))a+=e[n],n++;if(!a)break;while(n<o&&/\s/.test(e[n]))n++;if(n<o&&e[n]==="="){n++;while(n<o&&/\s/.test(e[n]))n++;let c="";if(n<o&&(e[n]==='"'||e[n]==="'")){let l=e[n];n++;while(n<o){let u=e[n];if(u==="\\"&&n+1<o){n++,c+=e[n],n++;continue}if(u===l){n++;break}c+=u,n++}}else if(e[n]==="{"){c=Me(e,n),n+=c.length;let l=qt(c);if(l!==null){i[`:${a}`]=l;continue}}else while(n<o&&!/\s/.test(e[n]))c+=e[n],n++;i[a]=c}else i[a]=ne}return i}function Qt(e){return Object.entries(e).map(([i,n])=>n===ne?i:`${i}="${nr(n)}"`).join(" ")}function nr(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function rr(e){let i=new Set,n=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,o;while((o=n.exec(e))!==null){let a=o[1];if(fe.isBuiltin(a))i.add(a)}return[...i].sort()}async function ug(e,i,n,o,a){if(!/import\s/.test(e))return e;if(!i.__importedComponents)i.__importedComponents=new Map;let c=i.__importedComponents,l=Jt.dirname(n),u=[],f=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let y of e.matchAll(f)){let[C,S,x]=y,d=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,v=x,k,A=[];while((k=d.exec(x))!==null){let[R,E,G,z]=k,B=null,L=null;if(z.startsWith(".")||z.startsWith("/")){let I=Jt.resolve(l,z);if(I.endsWith(".stx"))L=I;else{let _=`${I}.stx`;try{if(Kt.statSync(_).isFile())L=_}catch{try{if(Kt.statSync(I).isDirectory())B=I}catch{}}}}else B=Js(z,l);if(!B&&!L)continue;let N=!1,q=(I,_)=>{c.set(I,_),c.set(I.toLowerCase(),_);let T=I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();c.set(T,_),a.add(_)};if(G&&L)q(G,L),N=!0;else if(E){let I=E.slice(1,-1).split(",").map((T)=>T.trim()).filter(Boolean).map((T)=>{let U=T.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(U)return{source:U[1],local:U[2]};return{source:T,local:T}}),_=B?Pr(B):null;for(let{source:T,local:U}of I){let D=null;if(L)D=L;else if(_)D=_.get(T)??_.get(T.toLowerCase())??_.get(T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)q(U,D),N=!0}}if(N)A.push({start:k.index,end:k.index+R.length})}if(A.length===0)continue;for(let R=A.length-1;R>=0;R--)v=v.slice(0,A[R].start)+v.slice(A[R].end);u.push({start:y.index,end:y.index+C.length,value:`<script${S}>${v}</script>`})}if(u.length===0)return e;let w=[],h=0;for(let y of u)w.push(e.slice(h,y.start),y.value),h=y.end;return w.push(e.slice(h)),w.join("")}async function sr(e,i,n,o,a){let c=e;if(!i.__importedComponents)i.__importedComponents=new Map;let l=i.__importedComponents,u=/@import\s*\(\s*([^)]+)\s*\)/g,f;while((f=u.exec(c))!==null){let[w,h]=f,y=h.split(",").map((C)=>C.trim().replace(/^['"]|['"]$/g,"")).filter((C)=>C.length>0);for(let C of y){let S=C.split("/"),d=S[S.length-1].replace(/\.stx$/,""),v=d.includes("-")?d.split("-").map((R)=>R.charAt(0).toUpperCase()+R.slice(1)).join(""):d.charAt(0).toUpperCase()+d.slice(1),k=null,A=Ys(C,n,o);for(let R of A)try{if(await Bun.file(R).exists()){k=R;break}}catch{}if(k){l.set(v,k),l.set(d,k),l.set(d.toLowerCase(),k);let R=v.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(l.set(R,k),a.add(k),o.debug)console.log(`Imported component: ${v} -> ${k}`)}else if(o.debug)console.warn(`Could not resolve imported component: ${C}`)}c=c.replace(w,""),u.lastIndex=0}return c}async function ir(e,i,n,o,a){let c=e,l=o.componentsDir||"components";if(!i.__processedComponents)i.__processedComponents=new Set;let u=i.__processedComponents,f=/@component\s*\(/g,w;while((w=f.exec(c))!==null){let h=w.index,y=h+w[0].length-1,C=1,S=y+1;while(S<c.length&&C>0){if(c[S]==="(")C++;else if(c[S]===")"){if(C--,C===0)break}S++}if(C!==0)break;let x=c.substring(y+1,S),d=S+1,v=x.match(/^\s*['"]([^'"]+)['"]/);if(!v){f.lastIndex=d;continue}let k=v[1],A,R=x.slice(v[0].length),E=R.match(/^\s*,\s*/);if(E)A=R.slice(E[0].length).trim();let G={};if(A)try{G=M(A,i)}catch(I){let _=I instanceof Error?I.message:String(I);c=c.replace(c.substring(h,d),`[Error parsing component props: ${_}]`);continue}let z="",B=d,N=c.substring(d).match(/^([\s\S]*?)@endcomponent/);if(N)z=N[1].trim(),B=d+N[0].length;let q=await Je(k,G,z,l,i,n,o,u,a);c=c.substring(0,h)+q+c.substring(B),f.lastIndex=0}return c}async function or(e,i,n,o,a){if(!e)return e;let c=e,l=o.componentsDir||"components";if(!i.__processedComponents)i.__processedComponents=new Set;let u=i.__processedComponents,f=lr(c);if(f.size>0){let d=Array.isArray(i.__stx_client_declared_names)?i.__stx_client_declared_names:[];i.__stx_client_declared_names=[...new Set([...d,...f])]}let w=re(c);c=w.output;let h=gt(i);return c=await x(c,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),c=await x(c,/[A-Z][a-zA-Z0-9]*/,!0,Ft(Dr)),c=await x(c,/[a-z][a-z0-9]*/,!1,Dr),c=w.restore(c),c;async function x(d,v,k,A){if(!d)return d;let R=d,E=Wt(R,v,A),G=ft(R),z=!o._nativeHostAttrs&&/space-[xy]-/.test(R),B,L=new Map;for(let I=E.length-1;I>=0;I--){let _=E[I],T=k?J(_.tagName):_.tagName,U=ye(tr(_.attributes,i,n)),D=G.filter(({start:O,end:W})=>_.startIndex>=O&&_.startIndex<W);if(D.some((O)=>O.tag==="template"))Yn(_.tagName,n);let te=D.length>0,ae=new Set(h);for(let O of D)for(let W of O.names)ae.add(W);let j=Gn(U,i,o,te,ae);if(typeof j.clientReactive.for==="string")for(let O of oe(j.clientReactive.for))ae.add(O);let X=fe.getBuiltin(_.tagName),Re=X?await Br(_.tagName,l,i,n,{...o,_nativePrimitivesFallback:void 0}):!1,be=_.tagName==="Image"&&Zs([...Object.keys(j.static),...Object.keys(j.serverDynamic),...Object.keys(j.clientReactive)],Object.keys(j.events),{...j.static,...j.serverDynamic})&&(o._pluginComponentDirs??[]).some((O)=>Pr(O).has("Image"));if(X&&!Re&&!be){let O={context:i,filePath:n,options:o,dependencies:a},W=X.render(j,_.content,O);if(Object.keys(j.events).length>0){let ce=Qt(j.events);W=W.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${ce}`)}if(Object.keys(j.clientReactive).length>0)W=en(W,j.clientReactive);L.set(I,W);continue}if(!k&&_.tagName.includes("-")&&!await Br(T,l,i,n,o))continue;let le={};for(let[O,W]of Object.entries(j.static))le[O]=W;for(let[O,W]of Object.entries(j.serverDynamic))le[O]=W;let Q={declaredProps:new Set,consumedProps:new Set,reactiveProps:Object.keys(j.clientReactive),events:Object.keys(j.events)},Z=await Je(T,le,w.restore(_.content),l,i,n,o,u,a,[...ae],Q,_.tagName);if(z&&Kn(Z)){B??=Vt(R);let O=B.get(_.startIndex);if(O)Jn(_.tagName,O,n)}let P=Z;if(P=ar(P,j,Q.declaredProps,Q.consumedProps,o._nativeHostAttrs),o._nativeHostAttrs){let O=Q.reactiveProps.filter((ee)=>!Q.consumedProps.has(ee)&&!["if","for","show","key","ref"].includes(ee)).map(J),W=mt(P,!0);if(O.length&&W){if(!Object.hasOwn(ye(P.slice(W.insertPos,W.tagEnd)),"data-stx-native-host-root"))P=P.slice(0,W.insertPos)+' data-stx-native-host-root="true"'+P.slice(W.insertPos);let ee=Ce(P);P=P.slice(0,ee.insertPos)+` data-stx-native-forward="${O.join(" ")}"`+P.slice(ee.insertPos)}let ce=mt(P,!0);if(ce){let ee=ye(P.slice(ce.insertPos,ce.tagEnd)),ke=Ce(P),nn=ye(P.slice(ke.insertPos,ke.tagEnd));if(Object.hasOwn(ee,"data-stx-native-host-root")&&!Object.hasOwn(nn,"data-stx-native-host-owner"))P=P.slice(0,ke.insertPos)+" data-stx-native-host-owner"+P.slice(ke.insertPos)}}if(Object.keys(j.events).length>0){let O=Ce(P);if(O){let W=Qt(j.events),ce=Object.keys(j.events).map((ee)=>ee.replace(/^@/,"").split(".")[0]).join(" ");P=P.substring(0,O.insertPos)+` data-stx-parent-events="${ce}" ${W}`+P.substring(O.insertPos)}}if(Object.keys(j.clientReactive).length>0)P=en(P,j.clientReactive);L.set(I,P)}if(L.size===0)return R;let N="",q=0;for(let I=0;I<E.length;I++){let _=L.get(I);if(_===void 0)continue;N+=R.slice(q,E[I].startIndex),N+=_,q=E[I].endIndex}return N+=R.slice(q),N}}function en(e,i){let n=new Set(["if","for"]),o=new Set(["show"]),a=Object.entries(i).filter(([h])=>!n.has(h)),c=a.filter(([h])=>!o.has(h)).map(([h])=>J(h)).join(" "),l=e,u=a.length>0?Ce(l):null;if(u){let h=a.map(([C,S])=>`:${J(C)}="${S.replace(/"/g,"&quot;")}"`).join(" "),y=c?` data-stx-parent-bindings="${c}"`:"";l=l.substring(0,u.insertPos)+`${y} ${h}`+l.substring(u.insertPos)}let f=i.if;if(f)l=`<template :if="${f.replace(/"/g,"&quot;")}">${l}</template>`;let w=i.for;if(w){let h=i.key,y=h?` :key="${h.replace(/"/g,"&quot;")}"`:"";l=`<template :for="${w.replace(/"/g,"&quot;")}"${y}>${l}</template>`}return l}function ar(e,i,n=new Set,o=new Set,a=!1){let c=mt(e,a);if(!c)return e;let l=e.slice(c.insertPos,c.tagEnd),u=i.serverDynamic.class??i.static.class;if(a&&typeof u==="string"&&u&&!o.has("class")){let x=/(^|\s)class\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i,d=x.test(l)?l.replace(x,(v,k,A,R,E)=>`${k}class="${r(`${ut(A??R??E)} ${u}`)}"`):` class="${r(u)}"${l}`;e=e.slice(0,c.insertPos)+d+e.slice(c.tagEnd),c.tagEnd+=d.length-l.length,l=d}let f=a||/\bdata-native(?:\s|=)/i.test(l),w=f?o:n,h=new Set(Object.keys(ye(l))),y=new Set(["class","className"]);for(let x of Object.keys(i.static)){let d=i.staticNames[x]??x;if(h.has(d)||w.has(x)||!f&&!Ze(d))y.add(x)}for(let x of Object.keys(i.serverDynamic)){let d=i.serverDynamicNames?.[x]??x;if(h.has(d)||w.has(x)||!f&&!Ze(d))y.add(x)}let C=[];if(f){for(let[x,d]of Object.entries(i.static)){if(y.has(x)||d!==!0&&d!==ne)continue;y.add(x),C.push(`${r(i.staticNames?.[x]??x)}="true"`)}for(let[x,d]of Object.entries(i.serverDynamic)){if(y.has(x)||d!==!0)continue;y.add(x),C.push(`${r(i.serverDynamicNames?.[x]??x)}="true"`)}}let S=[...se(i,y),...ie(i,y),...C];if(f){for(let[x,d]of Object.entries(i.serverDynamic)){if(y.has(x)||d!==!1)continue;let v=i.serverDynamicNames?.[x]??x;S.push(`${r(v)}="false"`)}for(let[x,d]of Object.entries(i.serverDynamic)){if(y.has(x)||d===null||typeof d!=="object")continue;let v=JSON.stringify(d);if(v!==void 0){let k=i.serverDynamicNames?.[x]??x;S.push(`${r(k)}="${r(v)}"`)}}}if(S.length===0)return e;return`${e.slice(0,c.insertPos)} ${S.join(" ")}${e.slice(c.insertPos)}`}function Ce(e){let i=tn(e,0);if(i)return i;let n=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(e);if(n)return{insertPos:n.index+1+n[1].length,tagEnd:yt(e,n.index+1+n[1].length)};return null}function mt(e,i=!1){let n=Ce(e);if(!n)return null;let o=e.slice(n.insertPos,n.tagEnd),a=/\bdata-stx-component-wrapper(?:\s|=|>|$)/i.test(o)?tn(e,n.tagEnd+1):n;return a&&i?cr(e,a)??a:a}function cr(e,i){if(!e.includes("data-stx-native-host-root"))return null;let n=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),o=e.lastIndexOf("<",i.insertPos),a=0,c;while(o>=0&&o<e.length){if(e.startsWith("<!--",o)){let h=e.indexOf("-->",o+4);if(h<0)return null;o=e.indexOf("<",h+3);continue}let l=/^<(\/?)([a-z][\w-]*)\b/i.exec(e.slice(o));if(!l){o=e.indexOf("<",o+1);continue}let u=l[2].toLowerCase(),f=o+l[0].length,w=yt(e,f);if(l[1]){if(a--,c!==void 0&&a<c)c=void 0;if(a<=0)return null}else if(u==="script"||u==="style"){let h=new RegExp(`</${u}\\s*>`,"gi");if(h.lastIndex=w+1,!h.exec(e))return null;o=e.indexOf("<",h.lastIndex);continue}else{let h=ye(e.slice(f,w)),y=a>0&&(Object.hasOwn(h,"data-stx-component-wrapper")||Object.hasOwn(h,"data-stx-native-host-owner"));if(c===void 0&&!y&&Object.hasOwn(h,"data-stx-native-host-root"))return{insertPos:f,tagEnd:w};if(!n.has(u)&&e[w-1]!=="/"){if(a++,c===void 0&&y)c=a}else if(a===0)return null}o=e.indexOf("<",w+1)}return null}function tn(e,i){let n=i;while(n<e.length){let o=e.slice(n),a=o.match(/^\s+/);if(a){n+=a[0].length;continue}if(o.startsWith("<!--")){let u=e.indexOf("-->",n+4);if(u===-1)return null;n=u+3;continue}let c=o.match(/^<(script|style)\b[^>]*>/i);if(c){let u=`</${c[1].toLowerCase()}>`,f=e.toLowerCase().indexOf(u,n+c[0].length);if(f===-1)return null;n=f+u.length;continue}let l=o.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!l)return null;return{insertPos:n+1+l[1].length,tagEnd:yt(e,n+1+l[1].length)}}return null}function yt(e,i){let n="";for(let o=i;o<e.length;o++){let a=e[o];if(n){if(a==="\\")o++;else if(a===n)n=""}else if(a==='"'||a==="'")n=a;else if(a===">")return o}return e.length}function lr(e){let i=new Set;for(let n of e.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)){let o=n[1];if(!/\bclient\b/.test(o)||/\bserver\b/.test(o))continue;for(let a of Oi(n[2]))i.add(a);for(let a of n[2].matchAll(/^\s*import\s+(?:type\s+)?(?:([\w$]+)\s*,?\s*)?(?:\{([^}]*)\}|\*\s+as\s+([\w$]+))?\s*from\s/gm)){if(a[1])i.add(a[1]);if(a[3])i.add(a[3]);for(let c of(a[2]??"").split(",")){let l=c.replace(/^\s*type\s+/,"").split(/\s+as\s+/).pop().trim();if(/^[A-Za-z_$][\w$]*$/.test(l))i.add(l)}}}return i}async function $s(e,i,n,o,a){if(!Yt)Lt(fe),Yt=!0;let c=await ug(e,i,n,o,a);c=await sr(c,i,n,o,a),c=await ir(c,i,n,o,a);let l=[];for(let u=0;u<3;u++){let f=l.length,w=Se(c,We,(y,C)=>`\x00STX_COMPONENT_COMMENT_${f+C}\x00`,`STX_COMPONENT_COMMENT:${f}`);l.push(...w.tokens);let h=c;if(c=await or(w.output,i,n,o,a),c===h)break}if(l.length>0)c=c.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(u,f)=>l[Number(f)]??"");if(o.debug){let u=rr(c);if(u.length>0)console.warn(`[stx] ${n}: unresolved component tag(s) after render passes: ${u.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return c}
40
+ </style>`}};import{existsSync as Dn,readFileSync as jn}from"fs";var De=new Map,Dt=new Set;function Mn(e){if(Dt.has(e))return;Dt.add(e),console.warn(`[stx] icon collection "${e}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${e}\`.`)}function Ln(e){let i=process.cwd();for(let n of[`${i}/node_modules/@iconify-json/${e}/icons.json`,`${i}/pantry/@iconify-json/${e}/icons.json`,`${i}/node_modules/@iconify/json/json/${e}.json`,`${i}/pantry/@iconify/json/json/${e}.json`])if(Dn(n))return n;for(let n of[`@iconify-json/${e}/icons.json`,`@iconify/json/json/${e}.json`])try{return w.resolve(n)}catch{}return null}function zn(e){if(De.has(e))return De.get(e);let i=Ln(e);if(!i)return Mn(e),null;try{let n=JSON.parse(jn(i,"utf8"));return De.set(e,n),n}catch{return null}}function Un(e,i,n,o){let a=[];if(i.rotate)a.push(`rotate(${i.rotate*90} ${n/2} ${o/2})`);if(i.hFlip)a.push(`translate(${n} 0) scale(-1 1)`);if(i.vFlip)a.push(`translate(0 ${o}) scale(1 -1)`);return a.length?`<g transform="${a.join(" ")}">${e}</g>`:e}function Fn(e,i){let n=i,o=e.icons[n],a={hFlip:!1,vFlip:!1,rotate:0};for(let u=0;!o&&u<8;u++){let f=e.aliases?.[n];if(!f)return null;if(f.hFlip)a.hFlip=!a.hFlip;if(f.vFlip)a.vFlip=!a.vFlip;if(f.rotate)a.rotate=((a.rotate+f.rotate)%4+4)%4;n=f.parent,o=e.icons[n]}if(!o)return null;let c=o.width??e.width??24,l=o.height??e.height??24;return{body:Un(o.body,a,c,l),width:c,height:l}}function me(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);if(e.static[i]!==void 0)return String(e.static[i]);if(e.clientReactive[i]!==void 0)return e.clientReactive[i];return}var at={name:"Icon",aliases:["icon","stx-icon"],render(e,i,n){let o=me(e,"name")??me(e,"icon");if(!o)return"<!-- Icon: missing name/icon prop -->";let a="lucide",c=o;if(o.includes(":")){let x=o.split(":");a=x[0],c=x[1]}let l=r(me(e,"size")||"24"),u=r(me(e,"color")||"currentColor"),f=r(me(e,"class")||""),v=r(me(e,"style")||""),h=De.get(a)??zn(a);if(!h)return`<!-- Icon: collection "${a}" not loaded -->`;let y=Fn(h,c);if(!y)return`<!-- Icon: "${c}" not found in ${a} -->`;let C=`0 0 ${y.width} ${y.height}`,S=y.body;if(u!=="currentColor")S=S.replace(/currentColor/g,u);let b=f?` class="${f}"`:"",d=v?` style="${v}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${l}" height="${l}" viewBox="${C}" fill="none"${b}${d}>${S}</svg>`}};function jt(e,...i){for(let n of i){if(e.serverDynamic[n]!==void 0)return String(e.serverDynamic[n]);let o=e.static[n];if(typeof o==="string")return o}return}function Mt(e,i){let n=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${i}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),o=e.match(n);if(!o)return{region:null,rest:e};return{region:o[2],rest:e.replace(o[0],"")}}var ct={name:"Suspense",aliases:["suspense"],render(e,i,n){let o=Mt(i,"fallback"),a=o.rest,c=Mt(a,"error"),l=c.rest,u=o.region??jt(e,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',f=c.region??jt(e,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${u}</div><div data-stx-suspense-error hidden>${f}</div><div data-stx-suspense-content hidden>${l}</div></div>`}};function je(e,...i){for(let n of i){if(e.serverDynamic[n]!==void 0)return String(e.serverDynamic[n]);let o=e.static[n];if(typeof o==="string")return o}return}var lt={name:"TransitionGroup",aliases:["transition-group"],render(e,i,n){let o=(je(e,"name")||"v").replace(/["'<>]/g,""),a=(je(e,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",c=je(e,"class"),l=je(e,"id"),u=[`data-stx-transition-group="${o}"`,c?`class="${c}"`:"",l?`id="${l}"`:""].filter(Boolean).join(" ");return`<${a} ${u}>${i}</${a}>`}};function Lt(e=fe){e.registerBuiltin(Ve),e.registerBuiltin(et),e.registerBuiltin(tt),e.registerBuiltin(rt),e.registerBuiltin(st),e.registerBuiltin(it),e.registerBuiltin(ot),e.registerBuiltin(at),e.registerBuiltin(ct),e.registerBuiltin(lt)}var zt=new Map;function Wn(e){let i=zt.get(e.source);if(!i)i=new RegExp(`(${e.source})(?![\\w.:-])`,"y"),zt.set(e.source,i);return i}var Ut=new WeakMap;function Ft(e){let i=Ut.get(e);if(!i)i=new Set([...e].map((o)=>o.toLowerCase())),Ut.set(e,i);let n=i;return(o)=>!/[a-z]/.test(o)&&n.has(o.toLowerCase())}function Hn(e,i){let n="";for(let o=i;o<e.length;o++){let a=e[o];if(n){if(a==="\\")o++;else if(a===n)n=""}else if(a==='"'||a==="'")n=a;else if(a===">")return o}return e.length}function Wt(e,i,n){let o=[],a=0,c=typeof n==="function"?n:n?(l)=>n.has(l.toLowerCase()):void 0;while(a<e.length){let l=e.indexOf("<",a);if(l===-1)break;let u=Wn(i);u.lastIndex=l+1;let f=u.exec(e);if(!f){a=l+1;continue}let v=f[1];if(c&&c(v)){let x=l+1+v.length;while(x<e.length&&e[x]!==">")x++;a=x+1;continue}let h=l+1+v.length,y=null,C=h,S=-1,b=!1;while(h<e.length){let x=e[h];if(y){if(x==="\\"&&h+1<e.length){h+=2;continue}if(x===y)y=null;h++;continue}if(x==='"'||x==="'"){y=x,h++;continue}if(x==="/"&&h+1<e.length&&e[h+1]===">"){S=h+2,b=!0;break}if(x===">"){S=h+1;break}h++}if(S===-1){a=l+1;continue}let d=e.slice(C,b?S-2:S-1).trim();if(b)o.push({fullMatch:e.slice(l,S),tagName:v,attributes:d,content:"",startIndex:l,endIndex:S,isSelfClosing:!0}),a=S;else{let x=`<${v}`,k=`</${v}>`,A=1,R=S,E=-1;while(A>0&&R<e.length){let B=e.indexOf(x,R),L=e.indexOf(k,R);if(L===-1)break;if(B!==-1&&B<L){let N=e[B+x.length];if(N===" "||N===">"||N==="/"||N===`
41
+ `||N==="\t"){let q=Hn(e,B+x.length);if(e[q-1]!=="/")A++;R=q+1}else R=B+x.length}else{if(A--,A===0){E=L;break}R=L+k.length}}if(E===-1){a=S;continue}let G=e.slice(S,E),z=E+k.length;o.push({fullMatch:e.slice(l,z),tagName:v,attributes:d,content:G,startIndex:l,endIndex:z,isSelfClosing:!1}),a=z}}return o}function ut(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function Ht(e,i){try{let n=Buffer.from(e,"base64").toString("utf8");return JSON.parse(n)}catch{}try{let n=e.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(n)}catch(n){if(i?.debug)console.error("Error decoding __stx_ prop:",n);return e}}function Me(e,i){let n=0,o="",a=i;while(a<e.length){let c=e[a];if(o){if(c==="\\")a++;else if(c===o)o=""}else if(c==='"'||c==="'"||c==="`")o=c;else if(c==="{")n++;else if(c==="}"){if(n--,n===0)return e.slice(i,a+1)}a++}return e.slice(i)}function qt(e){let i=e.trim();if(!i.startsWith("{")||!i.endsWith("}"))return null;if(Me(i,0).length!==i.length)return null;return i.slice(1,-1).trim()}function Xt(e){let i=[],n=0,o=e.length;while(n<o){while(n<o&&/\s/.test(e[n]))n++;if(n>=o)break;let a="";while(n<o&&!/[\s=]/.test(e[n]))a+=e[n],n++;if(!a)break;while(n<o&&/\s/.test(e[n]))n++;if(n<o&&e[n]==="="){n++;while(n<o&&/\s/.test(e[n]))n++;let c="";if(n<o&&(e[n]==='"'||e[n]==="'")){let l=e[n];n++;while(n<o&&e[n]!==l){if(e[n]==="\\"&&n+1<o)n++,c+=e[n];else c+=e[n];n++}if(n<o)n++}else if(e[n]==="{")c=Me(e,n),n+=c.length;else while(n<o&&!/\s/.test(e[n]))c+=e[n],n++;i.push({name:a,value:c})}else i.push({name:a,value:!0})}return i}var qn=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),Xn=new Set([":for","x-for","v-for","@for"]),Zt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Zn(e){return ft(e).map((i)=>[i.start,i.end])}function ft(e){let i=[],n=new Map;for(let o of Oe(e)){let a=o.name.toLowerCase();if(o.closing){let v=n.get(a)?.pop();if(v)v.end=o.end;continue}let l=/(?::for|x-for|v-for|@for)\s*=/.test(o.attributes)?Xt(o.attributes).find((v)=>Xn.has(v.name)):void 0,u=typeof l?.value==="string"?l.value:null,f=u!==null?{start:o.start,end:o.end,names:oe(u),tag:a}:null;if(f)i.push(f);if(!o.selfClosing&&!Zt.has(a)){let v=n.get(a);if(!v)v=[],n.set(a,v);v.push(f)}}return i}var Vn=/(?:^|\s)((?:[\w-]+:)*-?space-[xy]-(?!reverse(?:\s|$))[\w./[\]-]+)(?=\s|$)/;function Vt(e){let i=new Map,n=[];for(let o of Oe(e)){let a=o.name.toLowerCase();if(o.closing){for(let l=n.length-1;l>=0;l--)if(n[l].name===a){n.length=l;break}continue}let c=n.at(-1);if(c){if(c.utility&&c.children>0)i.set(o.start,c.utility);if(!/(?:^|\s)hidden(?=[\s=]|$)/.test(o.attributes))c.children++}if(!o.selfClosing&&!Zt.has(a)){let l=/(?:^|\s)class\s*=\s*(["'])([\s\S]*?)\1/.exec(o.attributes)?.[2];n.push({name:a,utility:l?Vn.exec(l)?.[1]??null:null,children:0})}}return i}function Gt(e){if(typeof e==="string")return e;if(Array.isArray(e))return e.filter(Boolean).map((i)=>Gt(i)).join(" ");if(e&&typeof e==="object")return Object.entries(e).filter(([,i])=>i).map(([i])=>i).join(" ");return e?String(e):""}function Oc(e,i){if(!/:[\w-]+=/.test(e))return e;let n=e,o=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,a=[],c;while((c=o.exec(e))!==null)a.push([c.index,c.index+c[0].length]);a.push(...Zn(e));let l=new Set([...mt(i),...Array.isArray(i.__stx_client_declared_names)?i.__stx_client_declared_names:[]]);function u(y){return a.some(([C,S])=>y>=C&&y<S)}let f=[],v=new Map,h=256;for(let y of Oe(n)){if(y.closing||u(y.start))continue;let C=y.attributes.trimEnd();if(!C||!C.includes(":"))continue;let S=/(?:^|\s)data-native(?:\s|=|$)/i.test(C.replace(/"[^"]*"|'[^']*'/g,"")),b=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,d,x=C,k=!1;while((d=b.exec(C))!==null){if(Dr(C,d.index,!0)?.kind==="attribute")continue;let A=d[1],R=d[2];if(Hl(A))continue;if(F(R,l))continue;if(R.includes("()")&&!R.includes(".get(")||R.includes("$store")||R.includes("$ref"))continue;try{let E=Object.keys(i),G=Object.values(i),z=R.match(/^([a-zA-Z_$][\w$]*)/);if(z&&!E.includes(z[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(z[1]))continue;let B=JSON.stringify([E,R]),L=v.get(B);if(!L){if(L=Function(...E,`return (${R})`),v.size>=h)v.clear();v.set(B,L)}let N=L(...G);if(A==="class"){let q=Y(Gt(N));if(q){let I=x.match(/\sclass="([^"]*)"/);if(I)x=x.replace(I[0],()=>` class="${I[1]} ${q}"`);else x=x.replace(d[0],()=>` class="${q}"`)}else x=x.replace(d[0],"");k=!0;continue}if(qn.has(A)){if(N)x=x.replace(d[0],` ${A}`);else x=x.replace(d[0],"");k=!0;continue}if(N===null||N===void 0||N===!1)x=x.replace(d[0],"");else{let q=S&&typeof N==="object"?JSON.stringify(N):String(N),I=On(A,q);x=x.replace(d[0],()=>` ${A}="${I}"`)}k=!0}catch(E){if(E instanceof he)throw E;continue}}if(k){let A=y.selfClosing?" /":"",E=`<${y.name}${x}${A}>`;f.push({start:y.start,end:y.end,replacement:E})}}if(f.length>0){let y=Array(f.length*2+1),C=0;for(let S=0;S<f.length;S++){let{start:b,end:d,replacement:x}=f[S];y[S*2]=n.slice(C,b),y[S*2+1]=x,C=d}y[f.length*2]=n.slice(C),n=y.join("")}return n}import Kt from"fs";import Jt from"path";var Yt=!1;function Gn(e,i,n,o=!1,a=new Set){let c={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},l=new Set(Array.isArray(i.__stx_client_signal_names)?i.__stx_client_signal_names:[]),u=(C)=>{if(l.size===0)return!1;let S=t(C),b=S.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(b&&l.has(b))return!0;for(let d of l){let x=d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${x}\\s*\\(`).test(S))return!0}return!1},f=new Set(Vl),v=(C)=>{if(!C.includes("-")||C.startsWith("@")||C.startsWith(":")||C.startsWith("x-")||C.startsWith("__"))return C;if(C.startsWith("aria-")||C.startsWith("data-"))return C;return C.replace(/-([a-z0-9])/g,(S,b)=>b.toUpperCase())},h=(C,S)=>{let b=v(C);if(c.static[b]=S,b!==C)c.staticNames[b]=C},y={...e};for(let[C,S]of Object.entries(e)){let b=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(C);if(!b)continue;delete y[C];let d=b[1]||"modelValue";if(y[`:${d}`]=S,y[`@update:${d}`]=`${S} = $event`,b[2]){let x=b[2].slice(1).split(".").map((k)=>`${k}: true`).join(", ");y[`:${b[1]?`${d}Modifiers`:"modelModifiers"}`]=`{ ${x} }`}}for(let[C,S]of Object.entries(y)){let b=C.startsWith("x-")&&!f.has(C)&&!C.startsWith("x-bind:")&&!C.startsWith("x-on:")?`:${C.slice(2)}`:C;if(b.startsWith("@")){c.events[b]=S;continue}if(b.startsWith("__stx_")){let d=v(b.slice(6));c.serverDynamic[d]=Ht(S,n);continue}if(b.startsWith(":")){let d=v(b.slice(1)),x=S===ne?d:S;if(d==="if"||d==="for"||d==="show"){c.clientReactive[d]=x;continue}if(o){c.clientReactive[d]=x;continue}if(F(x,a)){c.clientReactive[d]=x;continue}if(u(x)){c.clientReactive[d]=x;continue}try{if(!m(x)){if(n.debug)console.error(`Unsafe expression in :${d} binding: ${x}`);c.clientReactive[d]=x;continue}let k=Object.keys(i),A=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]),R=new Set(Array.isArray(i.__stx_client_declared_names)?i.__stx_client_declared_names:[]);if(yt(x).some((B)=>!A.has(B)&&!k.includes(B)&&(!(B in globalThis)||R.has(B)))){c.clientReactive[d]=x;continue}let z=p(x,k)(...Object.values(i));if(c.serverDynamic[d]=z,d!==b.slice(1)&&c.serverDynamicNames)c.serverDynamicNames[d]=b.slice(1)}catch{c.clientReactive[d]=x}continue}if(typeof S==="string"&&S.includes("{{")&&S.includes("}}")){let d=Qn(S,a);if(d!==null){c.clientReactive[v(b)]=d;continue}let x=S.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(x)try{let k=x[1];if(m(k)){let R=p(k,Object.keys(i))(...Object.values(i));h(b,R!=null?String(R):"")}else{if(n.debug)console.error(`Unsafe expression in ${b}: ${k}`);h(b,S)}}catch(k){if(n.debug)console.error(`Error evaluating expression for ${b}:`,k);h(b,S)}else{let k=S,A=/\{\{\s*([\s\S]+?)\s*\}\}/g,R;while((R=A.exec(S))!==null)try{let E=R[1];if(!m(E)){if(n.debug)console.error(`Unsafe expression in ${b}: ${E}`);continue}let z=p(E,Object.keys(i))(...Object.values(i));k=k.replace(R[0],String(z??""))}catch(E){if(n.debug)console.error(`Error evaluating expression in ${b}:`,E)}h(b,k)}continue}h(b,S===ne?"true":ut(S))}return c}var dt=new Set;function uy(){dt.clear()}function Kn(e){let i=/^\s*(?:<!--[\s\S]*?-->\s*)*<(?:div|span)\b((?:[^>"']|"[^"]*"|'[^']*')*)>/.exec(e);return!!i&&/\sdata-stx-component-wrapper(?=[\s=]|$)/.test(i[1])&&!/\sstx-hydrate(?=[\s=]|$)/.test(i[1])}function Jn(e,i,n){let o=`${n}\x00${e}\x00${i}`;if(dt.has(o))return;dt.add(o);let a=/space-x-/.test(i)?"flex":"flex flex-col",c=i.replace(/space-[xy]-/,"gap-");console.warn(`[stx] <${e}> in ${n} is a later child of a "${i}" stack, so it gets no spacing: the utility puts its margin on the component's scope wrapper, which generates no box. Use "${a} ${c}" on the parent instead -- gap reaches through the wrapper.`)}var gt=new Set;function dy(){gt.clear()}function Yn(e,i){let n=`${i}\x00${e}`;if(gt.has(n))return;gt.add(n),console.warn(`[stx] <${e}> in ${i} is inside a <template :for>, so its props and slot expressions will not see the loop variables and render empty. Put the directive on the element the loop repeats instead -- <tr :for="..."> or <span :for="..." class="contents"> -- which binds correctly.`)}function Qn(e,i){if(i.size===0)return null;let n=/\{\{\s*([\s\S]+?)\s*\}\}/g,o=[...e.matchAll(n)];if(!o.some((u)=>F(u[1],i)))return null;let a=e.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(a&&o.length===1)return a[1];let c="",l=0;for(let u of o)c+=e.slice(l,u.index).replace(/[`\\$]/g,(f)=>`\\${f}`),c+=`\${${u[1]}}`,l=u.index+u[0].length;return c+=e.slice(l).replace(/[`\\$]/g,(u)=>`\\${u}`),`\`${c}\``}var er=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function tr(e,i,n){if(!e.includes("@"))return e;if(!er.some(([a,c])=>a.test(e)&&e.includes(c)))return e;try{return ge(e,i,n)}catch{return e}}function ye(e){let i={},n=0,o=e.length;while(n<o){while(n<o&&/\s/.test(e[n]))n++;if(n>=o)break;let a="";while(n<o&&!/[\s=]/.test(e[n]))a+=e[n],n++;if(!a)break;while(n<o&&/\s/.test(e[n]))n++;if(n<o&&e[n]==="="){n++;while(n<o&&/\s/.test(e[n]))n++;let c="";if(n<o&&(e[n]==='"'||e[n]==="'")){let l=e[n];n++;while(n<o){let u=e[n];if(u==="\\"&&n+1<o){n++,c+=e[n],n++;continue}if(u===l){n++;break}c+=u,n++}}else if(e[n]==="{"){c=Me(e,n),n+=c.length;let l=qt(c);if(l!==null){i[`:${a}`]=l;continue}}else while(n<o&&!/\s/.test(e[n]))c+=e[n],n++;i[a]=c}else i[a]=ne}return i}function Qt(e){return Object.entries(e).map(([i,n])=>n===ne?i:`${i}="${nr(n)}"`).join(" ")}function nr(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function rr(e){let i=new Set,n=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,o;while((o=n.exec(e))!==null){let a=o[1];if(fe.isBuiltin(a))i.add(a)}return[...i].sort()}async function ug(e,i,n,o,a){if(!/import\s/.test(e))return e;if(!i.__importedComponents)i.__importedComponents=new Map;let c=i.__importedComponents,l=Jt.dirname(n),u=[],f=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let y of e.matchAll(f)){let[C,S,b]=y,d=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,x=b,k,A=[];while((k=d.exec(b))!==null){let[R,E,G,z]=k,B=null,L=null;if(z.startsWith(".")||z.startsWith("/")){let I=Jt.resolve(l,z);if(I.endsWith(".stx"))L=I;else{let _=`${I}.stx`;try{if(Kt.statSync(_).isFile())L=_}catch{try{if(Kt.statSync(I).isDirectory())B=I}catch{}}}}else B=Js(z,l);if(!B&&!L)continue;let N=!1,q=(I,_)=>{c.set(I,_),c.set(I.toLowerCase(),_);let T=I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();c.set(T,_),a.add(_)};if(G&&L)q(G,L),N=!0;else if(E){let I=E.slice(1,-1).split(",").map((T)=>T.trim()).filter(Boolean).map((T)=>{let U=T.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(U)return{source:U[1],local:U[2]};return{source:T,local:T}}),_=B?Ir(B):null;for(let{source:T,local:U}of I){let D=null;if(L)D=L;else if(_)D=_.get(T)??_.get(T.toLowerCase())??_.get(T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)q(U,D),N=!0}}if(N)A.push({start:k.index,end:k.index+R.length})}if(A.length===0)continue;for(let R=A.length-1;R>=0;R--)x=x.slice(0,A[R].start)+x.slice(A[R].end);u.push({start:y.index,end:y.index+C.length,value:`<script${S}>${x}</script>`})}if(u.length===0)return e;let v=[],h=0;for(let y of u)v.push(e.slice(h,y.start),y.value),h=y.end;return v.push(e.slice(h)),v.join("")}async function sr(e,i,n,o,a){let c=e;if(!i.__importedComponents)i.__importedComponents=new Map;let l=i.__importedComponents,u=/@import\s*\(\s*([^)]+)\s*\)/g,f;while((f=u.exec(c))!==null){let[v,h]=f,y=h.split(",").map((C)=>C.trim().replace(/^['"]|['"]$/g,"")).filter((C)=>C.length>0);for(let C of y){let S=C.split("/"),d=S[S.length-1].replace(/\.stx$/,""),x=d.includes("-")?d.split("-").map((R)=>R.charAt(0).toUpperCase()+R.slice(1)).join(""):d.charAt(0).toUpperCase()+d.slice(1),k=null,A=Ys(C,n,o);for(let R of A)try{if(await Bun.file(R).exists()){k=R;break}}catch{}if(k){l.set(x,k),l.set(d,k),l.set(d.toLowerCase(),k);let R=x.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(l.set(R,k),a.add(k),o.debug)console.log(`Imported component: ${x} -> ${k}`)}else if(o.debug)console.warn(`Could not resolve imported component: ${C}`)}c=c.replace(v,""),u.lastIndex=0}return c}async function ir(e,i,n,o,a){let c=e,l=o.componentsDir||"components";if(!i.__processedComponents)i.__processedComponents=new Set;let u=i.__processedComponents,f=/@component\s*\(/g,v;while((v=f.exec(c))!==null){let h=v.index,y=h+v[0].length-1,C=1,S=y+1;while(S<c.length&&C>0){if(c[S]==="(")C++;else if(c[S]===")"){if(C--,C===0)break}S++}if(C!==0)break;let b=c.substring(y+1,S),d=S+1,x=b.match(/^\s*['"]([^'"]+)['"]/);if(!x){f.lastIndex=d;continue}let k=x[1],A,R=b.slice(x[0].length),E=R.match(/^\s*,\s*/);if(E)A=R.slice(E[0].length).trim();let G={};if(A)try{G=M(A,i)}catch(I){let _=I instanceof Error?I.message:String(I);c=c.replace(c.substring(h,d),`[Error parsing component props: ${_}]`);continue}let z="",B=d,N=c.substring(d).match(/^([\s\S]*?)@endcomponent/);if(N)z=N[1].trim(),B=d+N[0].length;let q=await Ye(k,G,z,l,i,n,o,u,a);c=c.substring(0,h)+q+c.substring(B),f.lastIndex=0}return c}async function or(e,i,n,o,a){if(!e)return e;let c=e,l=o.componentsDir||"components";if(!i.__processedComponents)i.__processedComponents=new Set;let u=i.__processedComponents,f=lr(c);if(f.size>0){let d=Array.isArray(i.__stx_client_declared_names)?i.__stx_client_declared_names:[];i.__stx_client_declared_names=[...new Set([...d,...f])]}let v=se(c);c=v.output;let h=mt(i);return c=await b(c,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),c=await b(c,/[A-Z][a-zA-Z0-9]*/,!0,Ft(Lr)),c=await b(c,/[a-z][a-z0-9]*/,!1,Lr),c=v.restore(c),c;async function b(d,x,k,A){if(!d)return d;let R=d,E=Wt(R,x,A),G=ft(R),z=!o._nativeHostAttrs&&/space-[xy]-/.test(R),B,L=new Map;for(let I=E.length-1;I>=0;I--){let _=E[I],T=k?J(_.tagName):_.tagName,U=ye(tr(_.attributes,i,n)),D=G.filter(({start:O,end:W})=>_.startIndex>=O&&_.startIndex<W);if(D.some((O)=>O.tag==="template"))Yn(_.tagName,n);let te=D.length>0,ae=new Set(h);for(let O of D)for(let W of O.names)ae.add(W);let j=Gn(U,i,o,te,ae);if(typeof j.clientReactive.for==="string")for(let O of oe(j.clientReactive.for))ae.add(O);let X=fe.getBuiltin(_.tagName),Ce=X?await Fr(_.tagName,l,i,n,{...o,_nativePrimitivesFallback:void 0}):!1,be=_.tagName==="Image"&&Zs([...Object.keys(j.static),...Object.keys(j.serverDynamic),...Object.keys(j.clientReactive)],Object.keys(j.events),{...j.static,...j.serverDynamic})&&(o._pluginComponentDirs??[]).some((O)=>Ir(O).has("Image"));if(X&&!Ce&&!be){let O={context:i,filePath:n,options:o,dependencies:a},W=X.render(j,_.content,O);if(Object.keys(j.events).length>0){let ce=Qt(j.events);W=W.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${ce}`)}if(Object.keys(j.clientReactive).length>0)W=en(W,j.clientReactive);L.set(I,W);continue}if(!k&&_.tagName.includes("-")&&!await Fr(T,l,i,n,o))continue;let le={};for(let[O,W]of Object.entries(j.static))le[O]=W;for(let[O,W]of Object.entries(j.serverDynamic))le[O]=W;let Q={declaredProps:new Set,consumedProps:new Set,reactiveProps:Object.keys(j.clientReactive),events:Object.keys(j.events)},Z=await Ye(T,le,v.restore(_.content),l,i,n,o,u,a,[...ae],Q,_.tagName);if(z&&Kn(Z)){B??=Vt(R);let O=B.get(_.startIndex);if(O)Jn(_.tagName,O,n)}let P=Z;if(P=ar(P,j,Q.declaredProps,Q.consumedProps,o._nativeHostAttrs),o._nativeHostAttrs){let O=Q.reactiveProps.filter((ee)=>!Q.consumedProps.has(ee)&&!["if","for","show","key","ref"].includes(ee)).map(J),W=pt(P,!0);if(O.length&&W){if(!Object.hasOwn(ye(P.slice(W.insertPos,W.tagEnd)),"data-stx-native-host-root"))P=P.slice(0,W.insertPos)+' data-stx-native-host-root="true"'+P.slice(W.insertPos);let ee=Se(P);P=P.slice(0,ee.insertPos)+` data-stx-native-forward="${O.join(" ")}"`+P.slice(ee.insertPos)}let ce=pt(P,!0);if(ce){let ee=ye(P.slice(ce.insertPos,ce.tagEnd)),Re=Se(P),nn=ye(P.slice(Re.insertPos,Re.tagEnd));if(Object.hasOwn(ee,"data-stx-native-host-root")&&!Object.hasOwn(nn,"data-stx-native-host-owner"))P=P.slice(0,Re.insertPos)+" data-stx-native-host-owner"+P.slice(Re.insertPos)}}if(Object.keys(j.events).length>0){let O=Se(P);if(O){let W=Qt(j.events),ce=Object.keys(j.events).map((ee)=>ee.replace(/^@/,"").split(".")[0]).join(" ");P=P.substring(0,O.insertPos)+` data-stx-parent-events="${ce}" ${W}`+P.substring(O.insertPos)}}if(Object.keys(j.clientReactive).length>0)P=en(P,j.clientReactive);L.set(I,P)}if(L.size===0)return R;let N="",q=0;for(let I=0;I<E.length;I++){let _=L.get(I);if(_===void 0)continue;N+=R.slice(q,E[I].startIndex),N+=_,q=E[I].endIndex}return N+=R.slice(q),N}}function en(e,i){let n=new Set(["if","for"]),o=new Set(["show"]),a=Object.entries(i).filter(([h])=>!n.has(h)),c=a.filter(([h])=>!o.has(h)).map(([h])=>J(h)).join(" "),l=e,u=a.length>0?Se(l):null;if(u){let h=a.map(([C,S])=>`:${J(C)}="${S.replace(/"/g,"&quot;")}"`).join(" "),y=c?` data-stx-parent-bindings="${c}"`:"";l=l.substring(0,u.insertPos)+`${y} ${h}`+l.substring(u.insertPos)}let f=i.if;if(f)l=`<template :if="${f.replace(/"/g,"&quot;")}">${l}</template>`;let v=i.for;if(v){let h=i.key,y=h?` :key="${h.replace(/"/g,"&quot;")}"`:"";l=`<template :for="${v.replace(/"/g,"&quot;")}"${y}>${l}</template>`}return l}function ar(e,i,n=new Set,o=new Set,a=!1){let c=pt(e,a);if(!c)return e;let l=e.slice(c.insertPos,c.tagEnd),u=i.serverDynamic.class??i.static.class;if(a&&typeof u==="string"&&u&&!o.has("class")){let b=/(^|\s)class\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i,d=b.test(l)?l.replace(b,(x,k,A,R,E)=>`${k}class="${r(`${ut(A??R??E)} ${u}`)}"`):` class="${r(u)}"${l}`;e=e.slice(0,c.insertPos)+d+e.slice(c.tagEnd),c.tagEnd+=d.length-l.length,l=d}let f=a||/\bdata-native(?:\s|=)/i.test(l),v=f?o:n,h=new Set(Object.keys(ye(l))),y=new Set(["class","className"]);for(let b of Object.keys(i.static)){let d=i.staticNames[b]??b;if(h.has(d)||v.has(b)||!f&&!Ze(d))y.add(b)}for(let b of Object.keys(i.serverDynamic)){let d=i.serverDynamicNames?.[b]??b;if(h.has(d)||v.has(b)||!f&&!Ze(d))y.add(b)}let C=[];if(f){for(let[b,d]of Object.entries(i.static)){if(y.has(b)||d!==!0&&d!==ne)continue;y.add(b),C.push(`${r(i.staticNames?.[b]??b)}="true"`)}for(let[b,d]of Object.entries(i.serverDynamic)){if(y.has(b)||d!==!0)continue;y.add(b),C.push(`${r(i.serverDynamicNames?.[b]??b)}="true"`)}}let S=[...re(i,y),...ie(i,y),...C];if(f){for(let[b,d]of Object.entries(i.serverDynamic)){if(y.has(b)||d!==!1)continue;let x=i.serverDynamicNames?.[b]??b;S.push(`${r(x)}="false"`)}for(let[b,d]of Object.entries(i.serverDynamic)){if(y.has(b)||d===null||typeof d!=="object")continue;let x=JSON.stringify(d);if(x!==void 0){let k=i.serverDynamicNames?.[b]??b;S.push(`${r(k)}="${r(x)}"`)}}}if(S.length===0)return e;return`${e.slice(0,c.insertPos)} ${S.join(" ")}${e.slice(c.insertPos)}`}function Se(e){let i=tn(e,0);if(i)return i;let n=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(e);if(n)return{insertPos:n.index+1+n[1].length,tagEnd:ht(e,n.index+1+n[1].length)};return null}function pt(e,i=!1){let n=Se(e);if(!n)return null;let o=e.slice(n.insertPos,n.tagEnd),a=/\bdata-stx-component-wrapper(?:\s|=|>|$)/i.test(o)?tn(e,n.tagEnd+1):n;return a&&i?cr(e,a)??a:a}function cr(e,i){if(!e.includes("data-stx-native-host-root"))return null;let n=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),o=e.lastIndexOf("<",i.insertPos),a=0,c;while(o>=0&&o<e.length){if(e.startsWith("<!--",o)){let h=e.indexOf("-->",o+4);if(h<0)return null;o=e.indexOf("<",h+3);continue}let l=/^<(\/?)([a-z][\w-]*)\b/i.exec(e.slice(o));if(!l){o=e.indexOf("<",o+1);continue}let u=l[2].toLowerCase(),f=o+l[0].length,v=ht(e,f);if(l[1]){if(a--,c!==void 0&&a<c)c=void 0;if(a<=0)return null}else if(u==="script"||u==="style"){let h=new RegExp(`</${u}\\s*>`,"gi");if(h.lastIndex=v+1,!h.exec(e))return null;o=e.indexOf("<",h.lastIndex);continue}else{let h=ye(e.slice(f,v)),y=a>0&&(Object.hasOwn(h,"data-stx-component-wrapper")||Object.hasOwn(h,"data-stx-native-host-owner"));if(c===void 0&&!y&&Object.hasOwn(h,"data-stx-native-host-root"))return{insertPos:f,tagEnd:v};if(!n.has(u)&&e[v-1]!=="/"){if(a++,c===void 0&&y)c=a}else if(a===0)return null}o=e.indexOf("<",v+1)}return null}function tn(e,i){let n=i;while(n<e.length){let o=e.slice(n),a=o.match(/^\s+/);if(a){n+=a[0].length;continue}if(o.startsWith("<!--")){let u=e.indexOf("-->",n+4);if(u===-1)return null;n=u+3;continue}let c=o.match(/^<(script|style)\b[^>]*>/i);if(c){let u=`</${c[1].toLowerCase()}>`,f=e.toLowerCase().indexOf(u,n+c[0].length);if(f===-1)return null;n=f+u.length;continue}let l=o.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!l)return null;return{insertPos:n+1+l[1].length,tagEnd:ht(e,n+1+l[1].length)}}return null}function ht(e,i){let n="";for(let o=i;o<e.length;o++){let a=e[o];if(n){if(a==="\\")o++;else if(a===n)n=""}else if(a==='"'||a==="'")n=a;else if(a===">")return o}return e.length}function lr(e){let i=new Set;for(let n of e.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)){let o=n[1];if(!/\bclient\b/.test(o)||/\bserver\b/.test(o))continue;for(let a of Oi(n[2]))i.add(a);for(let a of n[2].matchAll(/^\s*import\s+(?:type\s+)?(?:([\w$]+)\s*,?\s*)?(?:\{([^}]*)\}|\*\s+as\s+([\w$]+))?\s*from\s/gm)){if(a[1])i.add(a[1]);if(a[3])i.add(a[3]);for(let c of(a[2]??"").split(",")){let l=c.replace(/^\s*type\s+/,"").split(/\s+as\s+/).pop().trim();if(/^[A-Za-z_$][\w$]*$/.test(l))i.add(l)}}}return i}async function $s(e,i,n,o,a){if(!Yt)Lt(fe),Yt=!0;let c=await ug(e,i,n,o,a);c=await sr(c,i,n,o,a),c=await ir(c,i,n,o,a);let l=[];for(let u=0;u<3;u++){let f=l.length,v=ke(c,qe,(y,C)=>`\x00STX_COMPONENT_COMMENT_${f+C}\x00`,`STX_COMPONENT_COMMENT:${f}`);l.push(...v.tokens);let h=c;if(c=await or(v.output,i,n,o,a),c===h)break}if(l.length>0)c=c.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(u,f)=>l[Number(f)]??"");if(o.debug){let u=rr(c);if(u.length>0)console.warn(`[stx] ${n}: unresolved component tag(s) after render passes: ${u.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return c}
42
42
  export{si,oi,ii,cy,Ts,ly,Oc,uy,dy,ug,$s};
@@ -1,21 +1,21 @@
1
1
  // @bun
2
- import{wt,zl}from"./chunk-mgh5rst1.js";import{D}from"./chunk-vk2jy6mn.js";import{X,Xs,o,me,Q,w,rl,Kt,$n,Ge,Xe}from"./chunk-gz9pknbw.js";import{Sr}from"./chunk-bqtj62ys.js";import{W}from"./chunk-6gtecbe7.js";import{xn}from"./chunk-pctf14yw.js";var G=`(?:"[^"]*"|'[^']*'|[^>"'])*`,H=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,q=65536,J=4,N=new Map;function py(){N.clear()}function K(e){let c=[];for(let t of w(e,Q)){let n=t.token.match(/^<script\b([^>]*)>/i),s=t.token.match(/<\/script\s*>$/i);if(!n||!s)continue;let a=n[0].length,f=t.token.length-s[0].length;c.push(Object.freeze({fullMatch:t.token,attrs:n[1],body:t.token.slice(a,f),start:t.start,end:t.end}))}return c}function As(e,c={}){let t=e.length>=q,n=t?N.get(e):void 0;if(n===void 0){if(n=K(e),t)rl(N,J),N.set(e,n)}let s=c.skipAttrs;if(!s)return n.slice();let a=[];for(let f of n)if(s.lastIndex=0,!s.test(f.attrs))a.push(f);return a}function di(e){let c=e.trim(),t=c.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(t){let s=t[1].trim(),a=t[2].trim(),{itemVar:f,indexVar:i}=j(a);if(f)return{style:"as",iterable:s,itemVar:f,indexVar:i}}let n=c.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(n){let s=n[1].trim(),a=n[2].trim(),{itemVar:f,indexVar:i}=j(s);if(f)return{style:"in",iterable:a,itemVar:f,indexVar:i}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function j(e){let c=e.trim(),t=c.match(/^(\w+)\s*=>\s*(\w+)$/);if(t)return{itemVar:t[2],indexVar:t[1]};let n=c.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(n)return{itemVar:n[1],indexVar:n[2]||null};let s=c.match(/^(\w+)\s*,\s*(\w+)$/);if(s)return{itemVar:s[1],indexVar:s[2]};let a=c.match(/^(\w+)$/);if(a)return{itemVar:a[1],indexVar:null};return{itemVar:null,indexVar:null}}function Ps(e,c){return zl(e,c)}function Y(e){let c=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,t=0,n;while((n=c.exec(e))!==null){let s=n[1];if(s.startsWith("if"))t++;else if(s==="endif")t--;else if(t===0)return!0}return!1}function vr(e){let c=new Set,t=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,n=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel)\s*(?:<[^>]*>)?\s*\(/g,s;while((s=t.exec(e))!==null){let a=s[1],f;while((f=n.exec(a))!==null)c.add(f[1])}return c}function ee(e){if(!/[:@]for\s*=/.test(e)&&!/\bx-for\s*=/.test(e))return[];let c=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${G})>`,"iy"),t=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,n=w(e,(a,f)=>{c.lastIndex=f;let i=c.exec(a);if(!i||i.index!==f||!t.test(i[2]))return-1;return c.lastIndex}),s=[];for(let a of n){c.lastIndex=0;let f=c.exec(a.token);if(!f)continue;let i=f[2].match(t),p=di(i?.[1]??i?.[2]??""),m=[p.itemVar,p.indexVar].filter(Boolean);if(m.length===0)continue;let r=f[1],g=/\/\s*>$/.test(a.token)||M.has(r.toLowerCase())?a.end:P(e,a.start,r,a.end);if(g!==-1)s.push({start:a.start,end:g,vars:new Set(m)})}return s}var z=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);function te(e){return e.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function B(e,c,t,n){if(!e)return!1;let s=te(e),a=!1,f=!1,i=!1,p=/([a-zA-Z_$][\w$]*)/g,m;while((m=p.exec(s))!==null){let u=m[1];if(s.slice(0,m.index).trimEnd().endsWith("."))continue;if(z.has(u))continue;if(c.has(u)||n?.has(u))a=!0;else if(t&&u in t)f=!0}let r=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,l;while((l=r.exec(s))!==null){let u=l[1];if(s.slice(0,l.index).trimEnd().endsWith("."))continue;if(z.has(u)||t&&u in t)continue;i=!0}return(a||i)&&!f}function L(e,c,t){let n=t===void 0?` ${c}`:` ${c}="${t.replace(/"/g,"&quot;")}"`,s=e.trim(),a=s.match(H);if(a&&!ne(a[1])&&se(a[3],a[1])){let[,f,i,p]=a;return`<${f}${i}${n}>${p}</${f}>`}return`<template${n}>${s}</template>`}function ne(e){return/^[A-Z]/.test(e)}function se(e,c){let t=new RegExp(`<(/)?${c}(?=[\\s/>])`,"gi"),n=0,s;while((s=t.exec(e))!==null)if(s[1]){if(n--,n<0)return!1}else n++;return!0}function pi(e,c){let t=vr(e);function n(s){let a=s,f=ee(s),i=(l)=>{let g=new Set;for(let u of f)if(l>u.start&&l<u.end)for(let d of u.vars)g.add(d);return g},p=/@if\s*\(/g,m,r=[];while((m=p.exec(a))!==null){let l=m.index,g=l+m[0].length,u=1,d=g;while(d<a.length&&u>0){if(a[d]==="(")u++;else if(a[d]===")")u--;d++}if(u!==0)continue;let b=a.substring(g,d-1).trim(),S=d,E=1,y=S,x=/@(if\s*\(|endif)/g;x.lastIndex=S;let h;while((h=x.exec(a))!==null)if(h[1].startsWith("if"))E++;else if(h[1]==="endif"){if(E--,E===0){y=h.index+h[0].length;break}}if(E!==0)continue;let R=a.substring(S,y-6).trim(),A;if(Y(R)){let C=xn(a.substring(l,y));if(C.length===0)continue;let T=C[0].branches.filter((_)=>_.type!=="else"),k=i(l);if(!(T.length>0&&T.every((_)=>B(_.condition,t,c,k))))continue;A=C[0].branches.map((_)=>{let V=n(_.content);if(_.type==="elseif")return L(V,"@else-if",_.condition??"");if(_.type==="else")return L(V,"@else");return L(V,"@if",_.condition??"")}).join(`
3
- `)}else{if(!B(b,t,c,i(l)))continue;A=L(n(R),"@if",b)}r.push({start:l,end:y,replacement:A}),p.lastIndex=y}for(let l=r.length-1;l>=0;l--){let{start:g,end:u,replacement:d}=r[l];a=a.substring(0,g)+d+a.substring(u)}return a}return n(e)}function re(e){let c=e.trim();if(c==="")return;if(c==="true")return!0;if(c==="false")return!1;if(c==="null")return!1;if(c==="undefined")return!1;if(c==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(c)){let s=Number(c);return s!==0&&!Number.isNaN(s)}let t=c.match(/^'((?:\\.|[^'\\])*)'$/);if(t)return t[1].length>0;let n=c.match(/^"((?:\\.|[^"\\])*)"$/);if(n)return n[1].length>0;return}var M=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Z=/<(script|style)\b/iy,ie=/<\/script/gi,oe=/<\/style/gi;function P(e,c,t,n){if(M.has(t.toLowerCase()))return n;let s=t.toLowerCase(),a=e.length,f=1,i=n;while(i<a){let p=e.indexOf("<",i);if(p===-1)return-1;if(i=p,e.startsWith("<!--",i)){let g=e.indexOf("-->",i+4);if(g===-1)return-1;i=g+3;continue}Z.lastIndex=i;let m=Z.exec(e);if(m){let g=e.indexOf(">",i);if(g===-1)return-1;if(e[g-1]==="/"){i=g+1;continue}let u=m[1].toLowerCase()==="script"?ie:oe;u.lastIndex=i;let d=u.exec(e);if(d===null)return-1;let b=e.indexOf(">",d.index);if(b===-1)return-1;i=b+1;continue}if(e[i+1]==="/"){let g=/^<\/([a-z][\w-]*)\s*>/i.exec(e.slice(i,i+64));if(!g){i++;continue}if(g[1].toLowerCase()===s){if(f--,i+=g[0].length,f===0)return i;continue}i+=g[0].length;continue}let r=/^<([a-z][\w-]*)\b/i.exec(e.slice(i,i+64));if(!r){i++;continue}let l=e.indexOf(">",i);if(l===-1)return-1;if(r[1].toLowerCase()===s){let g=e.slice(i,l+1);if(!(/\/\s*>$/.test(g)||M.has(s)))f++}i=l+1}return-1}var ce=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function ae(e,c){let t=c,n=e.length;for(;;){while(t<n&&e[t]!=="<")t++;if(t>=n)return!1;if(e.startsWith("<!--",t)){let f=e.indexOf("-->",t+4);if(f===-1)return!1;t=f+3;continue}break}if(e[t+1]==="/")return!1;let s=e.indexOf(">",t);if(s===-1)return!1;let a=e.slice(t,s+1);return ce.test(a)}function fi(e){if(!e.includes(":if")&&!e.includes(":show")&&!e.includes("x-if")&&!e.includes("x-show")&&!e.includes("@if=")&&!e.includes("@show="))return e;let c=[],t=/<([a-zA-Z][\w-]*)/y,n=/\s/,s=new Set([":if",":show","x-if","x-show","@if","@show"]);w(e,(r,l)=>{t.lastIndex=l;let g=t.exec(r);if(!g||/^(?:script|style)$/i.test(g[1]))return-1;let u=t.lastIndex,d;while(u<r.length){let b=u;while(u<r.length&&n.test(r[u]))u++;let S=u;if(r[S]==="/"){S++;while(S<r.length&&n.test(r[S]))S++}if(r[S]===">"){if(d)c.push({start:l,end:S+1,tag:g[1],...d});return-1}if(u===b)return-1;let E=u;while(u<r.length&&!n.test(r[u])&&r[u]!=="="&&r[u]!==">")u++;if(u===E)return-1;let y=r.slice(E,u);if(y.startsWith("@")&&y.includes("("))return-1;let x=u,h=u;while(h<r.length&&n.test(r[h]))h++;if(r[h]!=="="){u=x;continue}h++;while(h<r.length&&n.test(r[h]))h++;let R=r[h];if(R==='"'||R==="'"){let A=r.indexOf(R,h+1);if(A===-1)return-1;if(!d&&R==='"'&&s.has(y))d={attrName:y,attrStart:b,attrEnd:A+1,value:r.slice(h+1,A)};u=A+1}else{u=h;while(u<r.length&&!n.test(r[u])&&r[u]!==">")u++}}return-1});let a=[],f=-1;for(let r of c){let{start:l,end:g,tag:u,attrName:d,value:b}=r;if(l<f)continue;let S=re(b);if(S===void 0)continue;let x=/\/\s*>$/.test(e.slice(l,g))||M.has(u.toLowerCase())?g:P(e,l,u,g);if(x===-1)continue;if((d===":if"||d==="x-if"||d==="@if")&&ae(e,x))continue;if(S===!0){let R=e.slice(l,r.attrStart)+e.slice(r.attrEnd,g);a.push({start:l,end:g,replacement:R});continue}a.push({start:l,end:x,replacement:""}),f=x}if(a.length===0)return e;a.sort((r,l)=>r.start-l.start);let i=[],p=-1;for(let r of a){if(r.start<p)continue;i.push(r),p=r.end}let m=e;for(let r=i.length-1;r>=0;r--){let{start:l,end:g,replacement:u}=i[r];m=m.substring(0,l)+u+m.substring(g)}return m}var F=[":for","@for","x-for"];function fg(e){let c=/(\s)((?::|@|x-|v-)[\w.:-]+)\s*=\s*"([^"]*\{\{[^"]*)"/g;return e.replace(c,(t,n,s,a)=>{let f=a.replace(/'((?:[^'\\]|\\.)*)'/g,(i,p)=>{if(!p.includes("{{"))return i;return`\`${p.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{\s*([^}]+?)\s*\}\}/g,(r,l)=>`\${${l}}`)}\``});return`${n}${s}="${f}"`})}function Is(e,c){if(!c||Object.keys(c).length===0)return e;if(!F.some((i)=>e.includes(`${i}=`)))return e;let t=vr(e);if(Array.isArray(c.__stx_client_signal_names)){for(let i of c.__stx_client_signal_names)if(typeof i==="string")t.add(i)}let n=e,s=[],a=/<([a-zA-Z][\w-]*)((?:[^>"']|"[^"]*"|'[^']*')*)>/g,f;while((f=a.exec(n))!==null){let[i,p,m]=f,r=f.index,l=r+i.length,g=F.map((A)=>({attr:A,m:new RegExp(`\\s${A}="([^"]*)"`).exec(m)})).find((A)=>A.m!==null);if(!g||!g.m)continue;let u=di(g.m[1]);if(!u.iterable||!u.itemVar)continue;let d=u.iterable.trim().split(/[.[(]/)[0].trim();if(!d||t.has(d)||!(d in c))continue;let b=P(n,r,p,l);if(b===-1)continue;let S=m.replace(new RegExp(`\\s${g.attr}="[^"]*"`),"").replace(/\s:key="[^"]*"/,"").replace(/\sx-cloak(?=\s|$)/,""),E=n.slice(l,b-`</${p}>`.length),y={...c,[u.itemVar]:void 0};if(u.indexVar)y[u.indexVar]=void 0;let x=Is(E,y),h=u.indexVar?`${u.iterable} as ${u.indexVar} => ${u.itemVar}`:`${u.iterable} as ${u.itemVar}`,R=p.toLowerCase()==="template"?x:`<${p}${S}>${x}</${p}>`;s.push({start:r,end:b,replacement:`@foreach(${h})${R}@endforeach`}),a.lastIndex=b}for(let i=s.length-1;i>=0;i--){let{start:p,end:m,replacement:r}=s[i];n=n.slice(0,p)+r+n.slice(m)}return n}function Os(e,c){let t=e,n=/@(for|foreach)\s*\(/g,s,a=[],f=[];while((s=n.exec(t))!==null){let i=s[1],p=s.index,m=p+s[0].length,r=1,l=m;while(l<t.length&&r>0){if(t[l]==="(")r++;else if(t[l]===")")r--;l++}if(r!==0)continue;let g=t.substring(m,l-1).trim(),u=l,d=di(g),b=i==="for"?"@endfor":"@endforeach",S=1,E=u,y=i==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${i}\\s*\\(|end${i})`,"g");y.lastIndex=u;let x;while((x=y.exec(t))!==null)if(x[1].startsWith(i))S++;else if(S--,S===0){E=x.index+x[0].length;break}if(S!==0)continue;let h=()=>{let v=[d.itemVar,d.indexVar].filter(Boolean);if(v.length)f.push({start:p,end:E,vars:v})};if(d.iterable){let v=d.iterable.trim();if(v.startsWith("[")||v.startsWith("{")||v.startsWith("'")||v.startsWith('"')||v.startsWith("`")||/^-?\d/.test(v)){h();continue}let I=v.split(/[.[(]/)[0].trim(),_=c?I in c:!1,V=f.some((O)=>p>O.start&&p<O.end&&O.vars.includes(I));if(I&&(_||V)){h();continue}}if(d.style==="as")g=d.indexVar?`(${d.itemVar}, ${d.indexVar}) in ${d.iterable}`:`${d.itemVar} in ${d.iterable}`;let R=t.substring(u,E-b.length).trim(),A=c?{...c}:{};if(d.itemVar)delete A[d.itemVar];if(d.indexVar)delete A[d.indexVar];let C=fg(Os(R,A)),T=C.match(H),k;if(T){let[,v,I,_]=T;k=`<${v}${I} @for="${g}">${_}</${v}>`}else k=`<template @for="${g}">${C}</template>`;a.push({start:p,end:E,replacement:k}),n.lastIndex=E}for(let i=a.length-1;i>=0;i--){let{start:p,end:m,replacement:r}=a[i];t=t.substring(0,p)+r+t.substring(m)}return t}function le(e){let c=new Set,t=[],n=0,s=0,a=e.length,f=(r)=>{let l=n+1;while(l<a){let g=e[l];if(g==="\\"){l+=2;continue}if(g===r)return l+1;l++}return a},i=()=>{let r=n+2;while(r<a&&e[r]!==`
2
+ import{xt,zl}from"./chunk-cphc60zw.js";import{D}from"./chunk-vk2jy6mn.js";import{X,Xs,o,me,Q,x,rl,Xt,An,Xe,Je}from"./chunk-eq86wzhr.js";import{kr}from"./chunk-kg7vby72.js";import{W}from"./chunk-a7bqrjm5.js";import{kn}from"./chunk-9rjgq8k4.js";var G=`(?:"[^"]*"|'[^']*'|[^>"'])*`,H=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,q=65536,J=4,N=new Map;function py(){N.clear()}function K(e){let c=[];for(let t of x(e,Q)){let n=t.token.match(/^<script\b([^>]*)>/i),s=t.token.match(/<\/script\s*>$/i);if(!n||!s)continue;let a=n[0].length,f=t.token.length-s[0].length;c.push(Object.freeze({fullMatch:t.token,attrs:n[1],body:t.token.slice(a,f),start:t.start,end:t.end}))}return c}function As(e,c={}){let t=e.length>=q,n=t?N.get(e):void 0;if(n===void 0){if(n=K(e),t)rl(N,J),N.set(e,n)}let s=c.skipAttrs;if(!s)return n.slice();let a=[];for(let f of n)if(s.lastIndex=0,!s.test(f.attrs))a.push(f);return a}function di(e){let c=e.trim(),t=c.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(t){let s=t[1].trim(),a=t[2].trim(),{itemVar:f,indexVar:i}=j(a);if(f)return{style:"as",iterable:s,itemVar:f,indexVar:i}}let n=c.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(n){let s=n[1].trim(),a=n[2].trim(),{itemVar:f,indexVar:i}=j(s);if(f)return{style:"in",iterable:a,itemVar:f,indexVar:i}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function j(e){let c=e.trim(),t=c.match(/^(\w+)\s*=>\s*(\w+)$/);if(t)return{itemVar:t[2],indexVar:t[1]};let n=c.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(n)return{itemVar:n[1],indexVar:n[2]||null};let s=c.match(/^(\w+)\s*,\s*(\w+)$/);if(s)return{itemVar:s[1],indexVar:s[2]};let a=c.match(/^(\w+)$/);if(a)return{itemVar:a[1],indexVar:null};return{itemVar:null,indexVar:null}}function Ps(e,c){return zl(e,c)}function Y(e){let c=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,t=0,n;while((n=c.exec(e))!==null){let s=n[1];if(s.startsWith("if"))t++;else if(s==="endif")t--;else if(t===0)return!0}return!1}function xr(e){let c=new Set,t=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,n=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel)\s*(?:<[^>]*>)?\s*\(/g,s;while((s=t.exec(e))!==null){let a=s[1],f;while((f=n.exec(a))!==null)c.add(f[1])}return c}function ee(e){if(!/[:@]for\s*=/.test(e)&&!/\bx-for\s*=/.test(e))return[];let c=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${G})>`,"iy"),t=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,n=x(e,(a,f)=>{c.lastIndex=f;let i=c.exec(a);if(!i||i.index!==f||!t.test(i[2]))return-1;return c.lastIndex}),s=[];for(let a of n){c.lastIndex=0;let f=c.exec(a.token);if(!f)continue;let i=f[2].match(t),p=di(i?.[1]??i?.[2]??""),m=[p.itemVar,p.indexVar].filter(Boolean);if(m.length===0)continue;let r=f[1],g=/\/\s*>$/.test(a.token)||M.has(r.toLowerCase())?a.end:P(e,a.start,r,a.end);if(g!==-1)s.push({start:a.start,end:g,vars:new Set(m)})}return s}var z=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);function te(e){return e.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function B(e,c,t,n){if(!e)return!1;let s=te(e),a=!1,f=!1,i=!1,p=/([a-zA-Z_$][\w$]*)/g,m;while((m=p.exec(s))!==null){let u=m[1];if(s.slice(0,m.index).trimEnd().endsWith("."))continue;if(z.has(u))continue;if(c.has(u)||n?.has(u))a=!0;else if(t&&u in t)f=!0}let r=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,l;while((l=r.exec(s))!==null){let u=l[1];if(s.slice(0,l.index).trimEnd().endsWith("."))continue;if(z.has(u)||t&&u in t)continue;i=!0}return(a||i)&&!f}function L(e,c,t){let n=t===void 0?` ${c}`:` ${c}="${t.replace(/"/g,"&quot;")}"`,s=e.trim(),a=s.match(H);if(a&&!ne(a[1])&&se(a[3],a[1])){let[,f,i,p]=a;return`<${f}${i}${n}>${p}</${f}>`}return`<template${n}>${s}</template>`}function ne(e){return/^[A-Z]/.test(e)}function se(e,c){let t=new RegExp(`<(/)?${c}(?=[\\s/>])`,"gi"),n=0,s;while((s=t.exec(e))!==null)if(s[1]){if(n--,n<0)return!1}else n++;return!0}function pi(e,c){let t=xr(e);function n(s){let a=s,f=ee(s),i=(l)=>{let g=new Set;for(let u of f)if(l>u.start&&l<u.end)for(let d of u.vars)g.add(d);return g},p=/@if\s*\(/g,m,r=[];while((m=p.exec(a))!==null){let l=m.index,g=l+m[0].length,u=1,d=g;while(d<a.length&&u>0){if(a[d]==="(")u++;else if(a[d]===")")u--;d++}if(u!==0)continue;let S=a.substring(g,d-1).trim(),w=d,E=1,y=w,b=/@(if\s*\(|endif)/g;b.lastIndex=w;let h;while((h=b.exec(a))!==null)if(h[1].startsWith("if"))E++;else if(h[1]==="endif"){if(E--,E===0){y=h.index+h[0].length;break}}if(E!==0)continue;let R=a.substring(w,y-6).trim(),A;if(Y(R)){let C=kn(a.substring(l,y));if(C.length===0)continue;let T=C[0].branches.filter((_)=>_.type!=="else"),k=i(l);if(!(T.length>0&&T.every((_)=>B(_.condition,t,c,k))))continue;A=C[0].branches.map((_)=>{let V=n(_.content);if(_.type==="elseif")return L(V,"@else-if",_.condition??"");if(_.type==="else")return L(V,"@else");return L(V,"@if",_.condition??"")}).join(`
3
+ `)}else{if(!B(S,t,c,i(l)))continue;A=L(n(R),"@if",S)}r.push({start:l,end:y,replacement:A}),p.lastIndex=y}for(let l=r.length-1;l>=0;l--){let{start:g,end:u,replacement:d}=r[l];a=a.substring(0,g)+d+a.substring(u)}return a}return n(e)}function re(e){let c=e.trim();if(c==="")return;if(c==="true")return!0;if(c==="false")return!1;if(c==="null")return!1;if(c==="undefined")return!1;if(c==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(c)){let s=Number(c);return s!==0&&!Number.isNaN(s)}let t=c.match(/^'((?:\\.|[^'\\])*)'$/);if(t)return t[1].length>0;let n=c.match(/^"((?:\\.|[^"\\])*)"$/);if(n)return n[1].length>0;return}var M=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Z=/<(script|style)\b/iy,ie=/<\/script/gi,oe=/<\/style/gi;function P(e,c,t,n){if(M.has(t.toLowerCase()))return n;let s=t.toLowerCase(),a=e.length,f=1,i=n;while(i<a){let p=e.indexOf("<",i);if(p===-1)return-1;if(i=p,e.startsWith("<!--",i)){let g=e.indexOf("-->",i+4);if(g===-1)return-1;i=g+3;continue}Z.lastIndex=i;let m=Z.exec(e);if(m){let g=e.indexOf(">",i);if(g===-1)return-1;if(e[g-1]==="/"){i=g+1;continue}let u=m[1].toLowerCase()==="script"?ie:oe;u.lastIndex=i;let d=u.exec(e);if(d===null)return-1;let S=e.indexOf(">",d.index);if(S===-1)return-1;i=S+1;continue}if(e[i+1]==="/"){let g=/^<\/([a-z][\w-]*)\s*>/i.exec(e.slice(i,i+64));if(!g){i++;continue}if(g[1].toLowerCase()===s){if(f--,i+=g[0].length,f===0)return i;continue}i+=g[0].length;continue}let r=/^<([a-z][\w-]*)\b/i.exec(e.slice(i,i+64));if(!r){i++;continue}let l=e.indexOf(">",i);if(l===-1)return-1;if(r[1].toLowerCase()===s){let g=e.slice(i,l+1);if(!(/\/\s*>$/.test(g)||M.has(s)))f++}i=l+1}return-1}var ce=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function ae(e,c){let t=c,n=e.length;for(;;){while(t<n&&e[t]!=="<")t++;if(t>=n)return!1;if(e.startsWith("<!--",t)){let f=e.indexOf("-->",t+4);if(f===-1)return!1;t=f+3;continue}break}if(e[t+1]==="/")return!1;let s=e.indexOf(">",t);if(s===-1)return!1;let a=e.slice(t,s+1);return ce.test(a)}function fi(e){if(!e.includes(":if")&&!e.includes(":show")&&!e.includes("x-if")&&!e.includes("x-show")&&!e.includes("@if=")&&!e.includes("@show="))return e;let c=[],t=/<([a-zA-Z][\w-]*)/y,n=/\s/,s=new Set([":if",":show","x-if","x-show","@if","@show"]);x(e,(r,l)=>{t.lastIndex=l;let g=t.exec(r);if(!g||/^(?:script|style)$/i.test(g[1]))return-1;let u=t.lastIndex,d;while(u<r.length){let S=u;while(u<r.length&&n.test(r[u]))u++;let w=u;if(r[w]==="/"){w++;while(w<r.length&&n.test(r[w]))w++}if(r[w]===">"){if(d)c.push({start:l,end:w+1,tag:g[1],...d});return-1}if(u===S)return-1;let E=u;while(u<r.length&&!n.test(r[u])&&r[u]!=="="&&r[u]!==">")u++;if(u===E)return-1;let y=r.slice(E,u);if(y.startsWith("@")&&y.includes("("))return-1;let b=u,h=u;while(h<r.length&&n.test(r[h]))h++;if(r[h]!=="="){u=b;continue}h++;while(h<r.length&&n.test(r[h]))h++;let R=r[h];if(R==='"'||R==="'"){let A=r.indexOf(R,h+1);if(A===-1)return-1;if(!d&&R==='"'&&s.has(y))d={attrName:y,attrStart:S,attrEnd:A+1,value:r.slice(h+1,A)};u=A+1}else{u=h;while(u<r.length&&!n.test(r[u])&&r[u]!==">")u++}}return-1});let a=[],f=-1;for(let r of c){let{start:l,end:g,tag:u,attrName:d,value:S}=r;if(l<f)continue;let w=re(S);if(w===void 0)continue;let b=/\/\s*>$/.test(e.slice(l,g))||M.has(u.toLowerCase())?g:P(e,l,u,g);if(b===-1)continue;if((d===":if"||d==="x-if"||d==="@if")&&ae(e,b))continue;if(w===!0){let R=e.slice(l,r.attrStart)+e.slice(r.attrEnd,g);a.push({start:l,end:g,replacement:R});continue}a.push({start:l,end:b,replacement:""}),f=b}if(a.length===0)return e;a.sort((r,l)=>r.start-l.start);let i=[],p=-1;for(let r of a){if(r.start<p)continue;i.push(r),p=r.end}let m=e;for(let r=i.length-1;r>=0;r--){let{start:l,end:g,replacement:u}=i[r];m=m.substring(0,l)+u+m.substring(g)}return m}var F=[":for","@for","x-for"];function fg(e){let c=/(\s)((?::|@|x-|v-)[\w.:-]+)\s*=\s*"([^"]*\{\{[^"]*)"/g;return e.replace(c,(t,n,s,a)=>{let f=a.replace(/'((?:[^'\\]|\\.)*)'/g,(i,p)=>{if(!p.includes("{{"))return i;return`\`${p.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{\s*([^}]+?)\s*\}\}/g,(r,l)=>`\${${l}}`)}\``});return`${n}${s}="${f}"`})}function Is(e,c){if(!c||Object.keys(c).length===0)return e;if(!F.some((i)=>e.includes(`${i}=`)))return e;let t=xr(e);if(Array.isArray(c.__stx_client_signal_names)){for(let i of c.__stx_client_signal_names)if(typeof i==="string")t.add(i)}let n=e,s=[],a=/<([a-zA-Z][\w-]*)((?:[^>"']|"[^"]*"|'[^']*')*)>/g,f;while((f=a.exec(n))!==null){let[i,p,m]=f,r=f.index,l=r+i.length,g=F.map((A)=>({attr:A,m:new RegExp(`\\s${A}="([^"]*)"`).exec(m)})).find((A)=>A.m!==null);if(!g||!g.m)continue;let u=di(g.m[1]);if(!u.iterable||!u.itemVar)continue;let d=u.iterable.trim().split(/[.[(]/)[0].trim();if(!d||t.has(d)||!(d in c))continue;let S=P(n,r,p,l);if(S===-1)continue;let w=m.replace(new RegExp(`\\s${g.attr}="[^"]*"`),"").replace(/\s:key="[^"]*"/,"").replace(/\sx-cloak(?=\s|$)/,""),E=n.slice(l,S-`</${p}>`.length),y={...c,[u.itemVar]:void 0};if(u.indexVar)y[u.indexVar]=void 0;let b=Is(E,y),h=u.indexVar?`${u.iterable} as ${u.indexVar} => ${u.itemVar}`:`${u.iterable} as ${u.itemVar}`,R=p.toLowerCase()==="template"?b:`<${p}${w}>${b}</${p}>`;s.push({start:r,end:S,replacement:`@foreach(${h})${R}@endforeach`}),a.lastIndex=S}for(let i=s.length-1;i>=0;i--){let{start:p,end:m,replacement:r}=s[i];n=n.slice(0,p)+r+n.slice(m)}return n}function Os(e,c){let t=e,n=/@(for|foreach)\s*\(/g,s,a=[],f=[];while((s=n.exec(t))!==null){let i=s[1],p=s.index,m=p+s[0].length,r=1,l=m;while(l<t.length&&r>0){if(t[l]==="(")r++;else if(t[l]===")")r--;l++}if(r!==0)continue;let g=t.substring(m,l-1).trim(),u=l,d=di(g),S=i==="for"?"@endfor":"@endforeach",w=1,E=u,y=i==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${i}\\s*\\(|end${i})`,"g");y.lastIndex=u;let b;while((b=y.exec(t))!==null)if(b[1].startsWith(i))w++;else if(w--,w===0){E=b.index+b[0].length;break}if(w!==0)continue;let h=()=>{let v=[d.itemVar,d.indexVar].filter(Boolean);if(v.length)f.push({start:p,end:E,vars:v})};if(d.iterable){let v=d.iterable.trim();if(v.startsWith("[")||v.startsWith("{")||v.startsWith("'")||v.startsWith('"')||v.startsWith("`")||/^-?\d/.test(v)){h();continue}let I=v.split(/[.[(]/)[0].trim(),_=c?I in c:!1,V=f.some((O)=>p>O.start&&p<O.end&&O.vars.includes(I));if(I&&(_||V)){h();continue}}if(d.style==="as")g=d.indexVar?`(${d.itemVar}, ${d.indexVar}) in ${d.iterable}`:`${d.itemVar} in ${d.iterable}`;let R=t.substring(u,E-S.length).trim(),A=c?{...c}:{};if(d.itemVar)delete A[d.itemVar];if(d.indexVar)delete A[d.indexVar];let C=fg(Os(R,A)),T=C.match(H),k;if(T){let[,v,I,_]=T;k=`<${v}${I} @for="${g}">${_}</${v}>`}else k=`<template @for="${g}">${C}</template>`;a.push({start:p,end:E,replacement:k}),n.lastIndex=E}for(let i=a.length-1;i>=0;i--){let{start:p,end:m,replacement:r}=a[i];t=t.substring(0,p)+r+t.substring(m)}return t}function le(e){let c=new Set,t=[],n=0,s=0,a=e.length,f=(r)=>{let l=n+1;while(l<a){let g=e[l];if(g==="\\"){l+=2;continue}if(g===r)return l+1;l++}return a},i=()=>{let r=n+2;while(r<a&&e[r]!==`
4
4
  `)r++;return r},p=()=>{let r=n+2;while(r<a-1){if(e[r]==="*"&&e[r+1]==="/")return r+2;r++}return a},m=(r)=>{let l=r,g=0;while(l<a){let u=e[l];if(u==="/"&&e[l+1]==="/"){let d=l+2;while(d<a&&e[d]!==`
5
- `)d++;l=d;continue}if(u==="/"&&e[l+1]==="*"){let d=l+2;while(d<a-1&&!(e[d]==="*"&&e[d+1]==="/"))d++;l=d+2;continue}if(u==='"'||u==="'"||u==="`"){let d=l+1;while(d<a){if(e[d]==="\\"){d+=2;continue}if(e[d]===u){d++;break}d++}l=d;continue}if(u==="("||u==="["||u==="{"){g++,l++;continue}if(u===")"||u==="]"||u==="}"){g--,l++;continue}if(u===";"&&g===0)return l+1;l++}return a};while(n<a){let r=e[n];if(r==="/"&&e[n+1]==="/"){let l=i();t.push(e.slice(n,l)),n=l;continue}if(r==="/"&&e[n+1]==="*"){let l=p();t.push(e.slice(n,l)),n=l;continue}if(r==='"'||r==="'"||r==="`"){let l=f(r);t.push(e.slice(n,l)),n=l;continue}if(r==="{"){s++,t.push(r),n++;continue}if(r==="}"){s--,t.push(r),n++;continue}if(s===0){let l=n>0?e[n-1]:"";if(l===""||/\s/.test(l)||l===";"||l==="}"||l==="{"){let u=e.slice(n).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(u){let d=u[2],b=m(n+u[0].length);if(c.has(d)){t.push(`/* stx: deduped const ${d} */`),n=b;continue}c.add(d),t.push(e.slice(n,b)),n=b;continue}}}t.push(r),n++}return t.join("")}var ue=new Set(["script","style","html","head","meta","link","title","!doctype"]);function fe(e){let c=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${G})>`,"iy"),t=null,n=null;return w(e,(s,a)=>{c.lastIndex=a;let f=c.exec(s);if(!f)return-1;let i=f[1].toLowerCase();if(i==="script"||i==="style")return-1;let p=a+f[0].length-1;if(i==="body"&&n===null)n=p;if(t===null&&!ue.has(i))t=p;return a+f[0].length}),n??t}function de(e,c,t,n){let s=[],a=` data-stx="${n}"`,f=0,i=!1,p=(m)=>{if(t!==null&&!i&&t>=f&&t<=m)s.push(e.slice(f,t),a,e.slice(t,m)),i=!0;else s.push(e.slice(f,m))};for(let m of c){if(m.start<f)continue;p(m.start),f=m.end}return p(e.length),s.join("")}async function Ns(e,c,t,n={}){let s=As(e,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),a=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|keptState|useCookie|useId|useModel|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,f=[],{hasUserImports:i,bundleClientScript:p}=await o("stx/client-script-bundler",()=>import("./chunk-rjm515e2.js"));for(let x of s){let h=x.body;if(Ge(x.attrs))h=Xe(h);if(n.forceClientSetup||a.test(h)){f.push({content:h,start:x.start,end:x.end});continue}if(!i(h))continue;try{let R=await p(Kt(h).code,c||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(a.test(R))f.push({content:h,start:x.start,end:x.end})}catch{}}if(f.length===0)return{output:e,setupCode:null};let m=`${c??""}\x00${f.map((x)=>x.content).join("\x00")}`,r=`__stx_setup_${Bun.hash(m).toString(36).slice(0,10)}`,l=[];for(let x=0;x<f.length;x++){let h=f[x].bundled??Kt(f[x].content).code;if(!f[x].bundled&&i(h))h=await p(h,c||"",{projectRoot:process.cwd()});h=Pt(h);let R=D(h);l.push(`// \u2500\u2500 merged signal script #${x+1} \u2500\u2500
5
+ `)d++;l=d;continue}if(u==="/"&&e[l+1]==="*"){let d=l+2;while(d<a-1&&!(e[d]==="*"&&e[d+1]==="/"))d++;l=d+2;continue}if(u==='"'||u==="'"||u==="`"){let d=l+1;while(d<a){if(e[d]==="\\"){d+=2;continue}if(e[d]===u){d++;break}d++}l=d;continue}if(u==="("||u==="["||u==="{"){g++,l++;continue}if(u===")"||u==="]"||u==="}"){g--,l++;continue}if(u===";"&&g===0)return l+1;l++}return a};while(n<a){let r=e[n];if(r==="/"&&e[n+1]==="/"){let l=i();t.push(e.slice(n,l)),n=l;continue}if(r==="/"&&e[n+1]==="*"){let l=p();t.push(e.slice(n,l)),n=l;continue}if(r==='"'||r==="'"||r==="`"){let l=f(r);t.push(e.slice(n,l)),n=l;continue}if(r==="{"){s++,t.push(r),n++;continue}if(r==="}"){s--,t.push(r),n++;continue}if(s===0){let l=n>0?e[n-1]:"";if(l===""||/\s/.test(l)||l===";"||l==="}"||l==="{"){let u=e.slice(n).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(u){let d=u[2],S=m(n+u[0].length);if(c.has(d)){t.push(`/* stx: deduped const ${d} */`),n=S;continue}c.add(d),t.push(e.slice(n,S)),n=S;continue}}}t.push(r),n++}return t.join("")}var ue=new Set(["script","style","html","head","meta","link","title","!doctype"]);function fe(e){let c=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${G})>`,"iy"),t=null,n=null;return x(e,(s,a)=>{c.lastIndex=a;let f=c.exec(s);if(!f)return-1;let i=f[1].toLowerCase();if(i==="script"||i==="style")return-1;let p=a+f[0].length-1;if(i==="body"&&n===null)n=p;if(t===null&&!ue.has(i))t=p;return a+f[0].length}),n??t}function de(e,c,t,n){let s=[],a=` data-stx="${n}"`,f=0,i=!1,p=(m)=>{if(t!==null&&!i&&t>=f&&t<=m)s.push(e.slice(f,t),a,e.slice(t,m)),i=!0;else s.push(e.slice(f,m))};for(let m of c){if(m.start<f)continue;p(m.start),f=m.end}return p(e.length),s.join("")}async function Ns(e,c,t,n={}){let s=As(e,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),a=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|keptState|useCookie|useId|useModel|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,f=[],{hasUserImports:i,bundleClientScript:p}=await o("stx/client-script-bundler",()=>import("./chunk-sztr4d5g.js"));for(let b of s){let h=b.body;if(Xe(b.attrs))h=Je(h);if(n.forceClientSetup||a.test(h)){f.push({content:h,start:b.start,end:b.end});continue}if(!i(h))continue;try{let R=await p(Xt(h).code,c||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(a.test(R))f.push({content:h,start:b.start,end:b.end})}catch{}}if(f.length===0)return{output:e,setupCode:null};let m=`${c??""}\x00${f.map((b)=>b.content).join("\x00")}`,r=`__stx_setup_${Bun.hash(m).toString(36).slice(0,10)}`,l=[];for(let b=0;b<f.length;b++){let h=f[b].bundled??Xt(f[b].content).code;if(!f[b].bundled&&i(h))h=await p(h,c||"",{projectRoot:process.cwd()});h=Ot(h);let R=D(h);l.push(`// \u2500\u2500 merged signal script #${b+1} \u2500\u2500
6
6
  ${R}`)}let g=l.join(`
7
7
 
8
- `);g=le(g);let d=X(g).split(",").map((x)=>x.trim()).filter(Boolean),b=$n(g,t),S=`
8
+ `);g=le(g);let d=X(g).split(",").map((b)=>b.trim()).filter(Boolean),S=An(g,t),w=`
9
9
  <script data-stx-scoped>
10
10
  function ${r}() {
11
- ${wt("const",d)}
12
- ${me(`${b}${g}`)}
11
+ ${xt("const",d)}
12
+ ${me(`${S}${g}`)}
13
13
  return ${Xs(g,d)};
14
14
  }
15
15
  window.__stx_latestSetup=${r};
16
16
  if(window.stx)window.stx._latestSetup=${r};
17
- </script>`,E=fe(e);return{output:de(e,f,E,r),setupCode:S}}async function gi(e,c,t,n){if(!Ps(e,t))return e;let s=e;if(c.skipSignalsRuntime)return s;let{output:a,setupCode:f}=await Ns(s,t,n);if(s=a,!f){let i=W(s);if(i&&!/data-stx/.test(i.attrs)&&!/data-stx-auto/.test(i.attrs)){let p=i.tag.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>");s=s.slice(0,i.index)+p+s.slice(i.index+i.tag.length)}}if(s=await Sr(s,c),f){let i=Nc(s,/<\/head>/i),p=i===-1?Nc(s,/<body[^>]*>/i):-1;if(i!==-1)s=`${s.slice(0,i)}${f}
17
+ </script>`,E=fe(e);return{output:de(e,f,E,r),setupCode:w}}async function gi(e,c,t,n){if(!Ps(e,t))return e;let s=e;if(c.skipSignalsRuntime)return s;let{output:a,setupCode:f}=await Ns(s,t,n);if(s=a,!f){let i=W(s);if(i&&!/data-stx/.test(i.attrs)&&!/data-stx-auto/.test(i.attrs)){let p=i.tag.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>");s=s.slice(0,i.index)+p+s.slice(i.index+i.tag.length)}}if(s=await kr(s,c),f){let i=Nc(s,/<\/head>/i),p=i===-1?Nc(s,/<body[^>]*>/i):-1;if(i!==-1)s=`${s.slice(0,i)}${f}
18
18
  ${s.slice(i)}`;else if(p!==-1){let m=/<body[^>]*>/i.exec(s.slice(p))[0],r=p+m.length;s=`${s.slice(0,r)}
19
19
  ${f}${s.slice(r)}`}else s=`${s}
20
- ${f}`}return s}function Nc(e,c){let t=/<(script|style)\b[\s\S]*?<\/\1>/gi,n=[],s;while((s=t.exec(e))!==null)n.push([s.index,s.index+s[0].length]);let a=new RegExp(c.source,c.flags.replace(/[gy]/g,"")),f=0;while(f<e.length){let i=a.exec(e.slice(f));if(!i)return-1;let p=f+i.index;if(!n.some(([r,l])=>p>=r&&p<l))return p;f=p+Math.max(i[0].length,1)}return-1}var U="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function gg(e){let c=[];for(let t of e.split(",")){let n=t.trim();if(!n||n.startsWith("type "))continue;let s=n.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(s&&s[1]!==s[2])c.push(`${s[2]} = ${s[1]}`)}if(c.length===0)return U;return`var ${c.join(", ")}; ${U}`}var ge=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function Pt(e){return e.replace(ge,(c,t)=>gg(t))}
21
- export{py,As,di,Ps,vr,pi,fi,fg,Is,Os,Ns,gi,Nc,gg,Pt};
20
+ ${f}`}return s}function Nc(e,c){let t=/<(script|style)\b[\s\S]*?<\/\1>/gi,n=[],s;while((s=t.exec(e))!==null)n.push([s.index,s.index+s[0].length]);let a=new RegExp(c.source,c.flags.replace(/[gy]/g,"")),f=0;while(f<e.length){let i=a.exec(e.slice(f));if(!i)return-1;let p=f+i.index;if(!n.some(([r,l])=>p>=r&&p<l))return p;f=p+Math.max(i[0].length,1)}return-1}var U="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function gg(e){let c=[];for(let t of e.split(",")){let n=t.trim();if(!n||n.startsWith("type "))continue;let s=n.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(s&&s[1]!==s[2])c.push(`${s[2]} = ${s[1]}`)}if(c.length===0)return U;return`var ${c.join(", ")}; ${U}`}var ge=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function Ot(e){return e.replace(ge,(c,t)=>gg(t))}
21
+ export{py,As,di,Ps,xr,pi,fi,fg,Is,Os,Ns,gi,Nc,gg,Ot};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Pe,lo,qg,Ry,Kg,Ay,In,g,Y,ae,On,Ne,Gg,Ui,Xg,Py,P,Wi,Jg,Iy,N,Oy}from"./chunk-eq86wzhr.js";import"./chunk-g3vce7ka.js";import"./chunk-41z7f41b.js";import"./chunk-xmg6bmh6.js";import"./chunk-vk2jy6mn.js";import"./chunk-3b3mkgpj.js";import"./chunk-0jdz31q1.js";import"./chunk-cphc60zw.js";export{Jg as applyFilters,Ay as clearCustomFilters,Gg as clientLoopScopes,lo as defaultFilters,On as escapeAttributeValue,g as escapeHtml,Y as escapeHtmlValue,ae as escapeInterpolatedHtmlValue,N as evaluateExpression,Pe as findMustacheEnd,Kg as getAllFilters,Xg as interpolateScriptAttributes,Ui as interpolateScriptExpressions,Py as interpolateScriptsInTemplate,P as processExpressions,Wi as processExpressionsChunked,qg as registerFilter,Ry as registerFilters,In as replaceInterpolations,Iy as resetRejectedExpressionWarnings,Oy as unescapeHtml,Ne as usesSignalsInScript};
@@ -0,0 +1,4 @@
1
+ // @bun
2
+ import a from"fs";function Rt(r){return o(r)}var g=1000,i=new Map;function nr(){i.clear()}function o(r){return[...r].sort().map((n)=>{try{let t=a.statSync(n);return`${n}:${t.size}:${t.mtimeMs}`}catch{return`${n}:missing`}}).join(`
3
+ `)}function un(r,n,t){let e=r.get(n);return e!==void 0&&e.signature===t?e.value:void 0}function ve(r,n,t,e){return r.set(n,{signature:t,value:e}),e}
4
+ export{Rt,nr,un,ve};