@stacksjs/stx 0.2.915 → 0.2.919
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.
- package/dist/app-shell.js +3 -2
- package/dist/{chunk-frpsrv1e.js → chunk-09xqy448.js} +2 -2
- package/dist/chunk-0ebaf0pr.js +2 -0
- package/dist/chunk-0jjq552g.js +2 -0
- package/dist/chunk-0wctbtad.js +7 -0
- package/dist/{chunk-r7y1196g.js → chunk-0xyfs691.js} +4 -4
- package/dist/{chunk-w98yt4d4.js → chunk-14df2jzs.js} +2 -2
- package/dist/chunk-15rc8t28.js +2 -0
- package/dist/chunk-1a2c4pv8.js +54 -0
- package/dist/{chunk-1jakr6f2.js → chunk-1baxccfq.js} +18 -18
- package/dist/{chunk-0vyytd9v.js → chunk-1bf0grbf.js} +3 -3
- package/dist/chunk-1jrhjn2b.js +2 -0
- package/dist/chunk-1svffhzq.js +2 -0
- package/dist/{chunk-1hx6dyy9.js → chunk-1ts1pg90.js} +2 -2
- package/dist/{chunk-88fx8xc1.js → chunk-1vsjmwr1.js} +2 -2
- package/dist/{chunk-cxsc37fg.js → chunk-2f46pcg0.js} +2 -2
- package/dist/{chunk-pcwq66w3.js → chunk-2jm7map2.js} +2 -2
- package/dist/chunk-2m4ydym0.js +33 -0
- package/dist/chunk-2mv29s6w.js +9 -0
- package/dist/{chunk-d1ka4dvr.js → chunk-2szhk8mh.js} +5 -5
- package/dist/{chunk-gg715pj6.js → chunk-2zb642qr.js} +6 -6
- package/dist/chunk-3aayrnbh.js +21 -0
- package/dist/chunk-3br07y64.js +20 -0
- package/dist/{chunk-2f5jjxcj.js → chunk-3efpqm1f.js} +2 -2
- package/dist/chunk-3ftrv1f7.js +182 -0
- package/dist/{chunk-barb4gka.js → chunk-3hfv217t.js} +6 -6
- package/dist/{chunk-eptzpvn0.js → chunk-3kpxkjgm.js} +3 -3
- package/dist/{chunk-4w8t0a9e.js → chunk-3tcy9r6r.js} +27 -27
- package/dist/{chunk-zv3rn0ch.js → chunk-40j2pmnb.js} +6 -6
- package/dist/chunk-426gq0g5.js +2 -0
- package/dist/chunk-4ge80k8j.js +2 -0
- package/dist/chunk-4vdfqr64.js +2 -0
- package/dist/chunk-4yz33vzb.js +2 -0
- package/dist/chunk-4zcswx6x.js +2 -0
- package/dist/{chunk-smnt37jq.js → chunk-50zzar2c.js} +3 -3
- package/dist/{chunk-vayzmvf5.js → chunk-514yg4dr.js} +6 -6
- package/dist/{chunk-vnk582z7.js → chunk-5fdc8pej.js} +102 -36
- package/dist/chunk-5ht628zp.js +2 -0
- package/dist/chunk-67zy5p7x.js +2 -0
- package/dist/chunk-6bm7t0hm.js +3 -0
- package/dist/{chunk-7qzanp9y.js → chunk-6n6kndk0.js} +1 -1
- package/dist/chunk-6x5a2w5a.js +3 -0
- package/dist/{chunk-xc5esqcb.js → chunk-6ybq9pfh.js} +2 -2
- package/dist/{chunk-23x3k751.js → chunk-7axtwg1f.js} +2 -2
- package/dist/chunk-8153bfpx.js +2 -0
- package/dist/{chunk-16sfjkc4.js → chunk-858p3hkz.js} +2 -2
- package/dist/chunk-86p0m920.js +2 -0
- package/dist/chunk-88texeh4.js +2 -0
- package/dist/chunk-8mye65n9.js +2 -0
- package/dist/chunk-8ycgk8w6.js +2 -0
- package/dist/{chunk-npj20tj9.js → chunk-9707zz6v.js} +2 -2
- package/dist/{chunk-pyyda92j.js → chunk-9gr7m3tb.js} +1 -1
- package/dist/{chunk-952dfmcb.js → chunk-9mack1g8.js} +3 -3
- package/dist/chunk-9xcsn4pb.js +2 -0
- package/dist/{chunk-3jc6yb02.js → chunk-9zwmfkfg.js} +9 -9
- package/dist/chunk-a5tg553d.js +2 -0
- package/dist/chunk-agxxqjjt.js +2 -0
- package/dist/{chunk-phzhmnnm.js → chunk-ayrd026n.js} +3 -3
- package/dist/chunk-b44pvac7.js +2 -0
- package/dist/chunk-b4yp16a2.js +2 -0
- package/dist/{chunk-95j8660f.js → chunk-cbqe84g3.js} +2 -2
- package/dist/{chunk-qsexsrw2.js → chunk-d4xjwebv.js} +5 -5
- package/dist/{chunk-pmn9kynz.js → chunk-d69k67bn.js} +11 -11
- package/dist/chunk-ex6dne7e.js +3 -0
- package/dist/chunk-fb63xppz.js +2 -0
- package/dist/chunk-ffqqkeye.js +2 -0
- package/dist/chunk-fjpt8arw.js +3 -0
- package/dist/{chunk-mgj074y2.js → chunk-fn0y9z1t.js} +5 -5
- package/dist/{chunk-ar6jeqmm.js → chunk-ft34x0h1.js} +4 -4
- package/dist/{chunk-7x3tt27s.js → chunk-fwxgzktt.js} +2 -2
- package/dist/chunk-g1v12bjm.js +2 -0
- package/dist/chunk-gg0kkn2e.js +2 -0
- package/dist/chunk-ggg8b8n1.js +2 -0
- package/dist/chunk-ggrcg7k7.js +2 -0
- package/dist/{chunk-11c7xg1z.js → chunk-gjyz5ma7.js} +1 -1
- package/dist/chunk-gmn9ba8f.js +3 -0
- package/dist/chunk-gqe574d9.js +2 -0
- package/dist/chunk-h4nqjks2.js +2 -0
- package/dist/chunk-hajamm16.js +2 -0
- package/dist/chunk-hg2n2264.js +2 -0
- package/dist/{chunk-6t8ce21j.js → chunk-hht7n4zd.js} +2 -2
- package/dist/chunk-hxabvt31.js +2 -0
- package/dist/chunk-j3sat6vn.js +2 -0
- package/dist/chunk-j9gbnqxq.js +2 -0
- package/dist/{chunk-1hbf5e1h.js → chunk-jgtn9t5n.js} +2 -2
- package/dist/chunk-jj2z4nxa.js +2 -0
- package/dist/{chunk-0jdz31q1.js → chunk-jjq7c8s2.js} +3 -3
- package/dist/chunk-k289127j.js +2 -0
- package/dist/{chunk-p3fepzt9.js → chunk-kk9h53xg.js} +3 -3
- package/dist/{chunk-xnp031ba.js → chunk-ktv65e3n.js} +7 -7
- package/dist/chunk-m1hfh2t4.js +2 -0
- package/dist/{chunk-9b2wdkbq.js → chunk-m390z8w8.js} +11 -11
- package/dist/chunk-m3qwqhxp.js +2 -0
- package/dist/{chunk-t85zac4y.js → chunk-m6hrb7rm.js} +58 -58
- package/dist/{chunk-7gwysmrs.js → chunk-m86sjbx7.js} +3 -3
- package/dist/chunk-m9smh7fs.js +2 -0
- package/dist/{chunk-1jvt9t3r.js → chunk-m9ta0640.js} +2 -2
- package/dist/chunk-mhnjtc42.js +2 -0
- package/dist/{chunk-hhspwfva.js → chunk-mn9t5fnv.js} +2 -2
- package/dist/{chunk-36cz2v8k.js → chunk-mnpfvxpa.js} +31 -31
- package/dist/{chunk-2vx2ben8.js → chunk-mr9pp5cf.js} +2 -2
- package/dist/{chunk-1jxkc6d0.js → chunk-mztjpp7m.js} +2 -2
- package/dist/chunk-n4bxb2hx.js +2 -0
- package/dist/chunk-n958bxm6.js +2 -0
- package/dist/{chunk-8wqhzzkn.js → chunk-neymp1bb.js} +3 -3
- package/dist/chunk-nkbnsbb0.js +3 -0
- package/dist/chunk-nkr1aa5z.js +2 -0
- package/dist/{chunk-nhyv3w4r.js → chunk-p0xqm2ne.js} +1 -1
- package/dist/chunk-p3vswt0f.js +2 -0
- package/dist/{chunk-z110bf2c.js → chunk-p3x7kwb5.js} +7 -7
- package/dist/chunk-p4twxjfs.js +6 -0
- package/dist/chunk-p8wnp4p1.js +2 -0
- package/dist/{chunk-bvqgq18r.js → chunk-p97h91zx.js} +2 -2
- package/dist/chunk-pjv4dskp.js +2 -0
- package/dist/{chunk-5jc9hmwg.js → chunk-pwg544dw.js} +2 -2
- package/dist/chunk-pxvp0cc9.js +3 -0
- package/dist/chunk-q3z252d9.js +2 -0
- package/dist/{chunk-q9gbdzw0.js → chunk-qda8tmk9.js} +2 -2
- package/dist/chunk-qfkak3jb.js +2 -0
- package/dist/chunk-qnytvyy0.js +2 -0
- package/dist/{chunk-fznjm7qt.js → chunk-qsnw0qyp.js} +2 -2
- package/dist/{chunk-ftvpz1j4.js → chunk-qtzfbv7e.js} +5 -5
- package/dist/{chunk-9xmx8hc7.js → chunk-qzqqzraq.js} +8 -8
- package/dist/{chunk-47z0m17p.js → chunk-rk16391e.js} +3 -3
- package/dist/chunk-rt7xy537.js +2 -0
- package/dist/chunk-rwjye578.js +2 -0
- package/dist/{chunk-cwcmmgvz.js → chunk-s1x2pc9b.js} +2 -2
- package/dist/{chunk-zbpvmgjn.js → chunk-sbr3wg75.js} +65 -65
- package/dist/chunk-sftznswb.js +2 -0
- package/dist/{chunk-cq4cwfqf.js → chunk-sxrcac01.js} +2 -2
- package/dist/{chunk-fzcqw147.js → chunk-tb4be5ct.js} +3 -3
- package/dist/{chunk-m8n14s3z.js → chunk-tnbzg7fd.js} +2 -2
- package/dist/{chunk-jr2r2nh5.js → chunk-txk2z7v0.js} +4 -4
- package/dist/chunk-tz5ktd6d.js +2 -0
- package/dist/{chunk-302nw40c.js → chunk-v060015m.js} +1 -1
- package/dist/chunk-v1a5h1tc.js +38 -0
- package/dist/{chunk-7anbc757.js → chunk-v1x96kjr.js} +8 -8
- package/dist/chunk-vb609vbj.js +1323 -0
- package/dist/chunk-vf7tpgqz.js +70 -0
- package/dist/chunk-vtcyber4.js +2 -0
- package/dist/chunk-vtj3dwhh.js +4 -0
- package/dist/{chunk-p9fyn5k4.js → chunk-whnzf9hn.js} +5 -5
- package/dist/chunk-wq2bpt0w.js +2 -0
- package/dist/{chunk-sdmq09jw.js → chunk-wv0wsavj.js} +2 -2
- package/dist/chunk-wv8zt78c.js +2 -0
- package/dist/{chunk-whc4jptx.js → chunk-wxqay5c2.js} +1 -1
- package/dist/{chunk-gfp39bzr.js → chunk-x40j67z1.js} +2 -2
- package/dist/chunk-xakqpa4z.js +3 -0
- package/dist/{chunk-dgt9kfkp.js → chunk-xap1f1bw.js} +2 -2
- package/dist/{chunk-zk5g49p5.js → chunk-xk7hdpq5.js} +3 -3
- package/dist/{chunk-zkwkhesc.js → chunk-xmy75h5v.js} +2 -2
- package/dist/{chunk-dp6r6gtb.js → chunk-xpsg91dh.js} +5 -5
- package/dist/{chunk-va4xam1q.js → chunk-xq5s4vc1.js} +1 -1
- package/dist/chunk-xy3ex6ht.js +2 -0
- package/dist/chunk-y899wtm8.js +2 -0
- package/dist/chunk-ye45znz5.js +2 -0
- package/dist/chunk-yegp50jb.js +2 -0
- package/dist/chunk-yq9aqpk8.js +2 -0
- package/dist/{chunk-5xbx0r3k.js → chunk-yvaqgdv1.js} +2 -2
- package/dist/{chunk-etmq1qny.js → chunk-yye2pec5.js} +14 -14
- package/dist/{chunk-47nzpbvm.js → chunk-yzqb7y45.js} +6 -6
- package/dist/{chunk-n0nf8n0h.js → chunk-z6nyyt3n.js} +6 -6
- package/dist/{chunk-fs43342z.js → chunk-zaj3nnvv.js} +2 -2
- package/dist/{chunk-2qk2ppgm.js → chunk-zb6my502.js} +1 -1
- package/dist/{chunk-ra2tzsvz.js → chunk-zrxvj3zf.js} +5 -5
- package/dist/chunk-zt45dqfx.js +2 -0
- package/dist/cli.js +38 -38
- package/dist/color-mode-boot.d.ts +1 -8
- package/dist/color-mode-boot.js +46 -2
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/dev-server/ts-css.d.ts +1 -1
- package/dist/dev-server/ts-css.js +2 -2
- package/dist/document-shell.d.ts +2 -0
- package/dist/document-shell.js +15 -3
- package/dist/document-tags.d.ts +2 -0
- package/dist/document-tags.js +9 -0
- package/dist/head-injection.d.ts +2 -0
- package/dist/head-injection.js +1 -0
- package/dist/head.d.ts +2 -0
- package/dist/head.js +2 -2
- package/dist/native/compiler/html-to-ir.d.ts +3 -1
- package/dist/native/compiler/html-to-ir.js +31 -0
- package/dist/native/compiler/ir.d.ts +1 -0
- package/dist/native/components/primitives.d.ts +1 -0
- package/dist/native/event-names.js +2 -0
- package/dist/native/runtime/browser-renderer.d.ts +1 -0
- package/dist/native/runtime/browser-renderer.js +23 -6
- package/dist/native/testing.d.ts +1 -0
- package/dist/native/testing.js +33 -0
- package/dist/page-head.js +1 -9
- package/dist/process.js +1 -1
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +13 -13
- package/dist/types/config-types.d.ts +2 -1
- package/dist/variable-extractor.js +6 -1
- package/package.json +5 -5
- package/dist/chunk-0adc8x2h.js +0 -9
- package/dist/chunk-1gj46s0g.js +0 -2
- package/dist/chunk-1mx3j280.js +0 -2
- package/dist/chunk-1p6gaaf3.js +0 -3
- package/dist/chunk-1rfzs48h.js +0 -2
- package/dist/chunk-20hy5p3p.js +0 -2
- package/dist/chunk-29v3b5ks.js +0 -2
- package/dist/chunk-2cay3heb.js +0 -2
- package/dist/chunk-33fnbw33.js +0 -2
- package/dist/chunk-357qjcj1.js +0 -3
- package/dist/chunk-38y11q8x.js +0 -2
- package/dist/chunk-3q80f7mt.js +0 -2
- package/dist/chunk-43kz6rx9.js +0 -2
- package/dist/chunk-490rrkrp.js +0 -2
- package/dist/chunk-49980am3.js +0 -2
- package/dist/chunk-4a9bqc8f.js +0 -33
- package/dist/chunk-4e18r89n.js +0 -3
- package/dist/chunk-4r0028av.js +0 -1323
- package/dist/chunk-4vz17ytv.js +0 -68
- package/dist/chunk-4w9pvpfd.js +0 -2
- package/dist/chunk-5afnyvw5.js +0 -2
- package/dist/chunk-5pb1x7x6.js +0 -2
- package/dist/chunk-6n50b07t.js +0 -2
- package/dist/chunk-76mn123c.js +0 -2
- package/dist/chunk-8egbh6z1.js +0 -2
- package/dist/chunk-8n9jd8cz.js +0 -2
- package/dist/chunk-8tfpv6zf.js +0 -6
- package/dist/chunk-94qc4zwb.js +0 -2
- package/dist/chunk-9928zdej.js +0 -3
- package/dist/chunk-9ay18k46.js +0 -2
- package/dist/chunk-9tv0tw7f.js +0 -3
- package/dist/chunk-a5h9bwrc.js +0 -2
- package/dist/chunk-am7xmh9p.js +0 -2
- package/dist/chunk-bdkst2wp.js +0 -2
- package/dist/chunk-bej9kz05.js +0 -2
- package/dist/chunk-ccgabq3a.js +0 -2
- package/dist/chunk-cv6d4zr5.js +0 -2
- package/dist/chunk-e5rag6rh.js +0 -3
- package/dist/chunk-eqdg72re.js +0 -2
- package/dist/chunk-fvr3h2fr.js +0 -7
- package/dist/chunk-g0hkknzm.js +0 -2
- package/dist/chunk-g44932zc.js +0 -2
- package/dist/chunk-g4w3wms2.js +0 -2
- package/dist/chunk-gmmqz698.js +0 -2
- package/dist/chunk-hxftzw0x.js +0 -2
- package/dist/chunk-j3d3q3g7.js +0 -2
- package/dist/chunk-jmggm1ep.js +0 -3
- package/dist/chunk-jz37h2z0.js +0 -4
- package/dist/chunk-k8s3hyh2.js +0 -2
- package/dist/chunk-m8mmasgc.js +0 -2
- package/dist/chunk-man5ap64.js +0 -54
- package/dist/chunk-mdgcjzcn.js +0 -38
- package/dist/chunk-mjny8x91.js +0 -2
- package/dist/chunk-mjr5fkc2.js +0 -2
- package/dist/chunk-n1y82svg.js +0 -2
- package/dist/chunk-na0e3s88.js +0 -2
- package/dist/chunk-new89wh2.js +0 -2
- package/dist/chunk-nrap20qt.js +0 -2
- package/dist/chunk-q85wy43m.js +0 -2
- package/dist/chunk-q9yahsww.js +0 -2
- package/dist/chunk-qdwtemy1.js +0 -2
- package/dist/chunk-qp0ndbk6.js +0 -2
- package/dist/chunk-r1fhahnn.js +0 -2
- package/dist/chunk-r4e17p2x.js +0 -2
- package/dist/chunk-rnsa5zz5.js +0 -2
- package/dist/chunk-rzsvxjse.js +0 -2
- package/dist/chunk-senrtnx2.js +0 -2
- package/dist/chunk-sw5g5mbd.js +0 -2
- package/dist/chunk-t63y6qd5.js +0 -2
- package/dist/chunk-v1wr2vdx.js +0 -2
- package/dist/chunk-v6gkjg5f.js +0 -3
- package/dist/chunk-vq7m7xcz.js +0 -182
- package/dist/chunk-wsfqb5jk.js +0 -2
- package/dist/chunk-wvc6eayq.js +0 -2
- package/dist/chunk-wz44vmgn.js +0 -21
- package/dist/chunk-x1kzqxj5.js +0 -2
- package/dist/chunk-xa98a901.js +0 -2
- package/dist/chunk-xj95sk0y.js +0 -2
- package/dist/chunk-xtf3sab5.js +0 -2
- package/dist/chunk-yga49yw3.js +0 -2
- package/dist/chunk-yn02d599.js +0 -2
- package/dist/chunk-z5nx021e.js +0 -20
- package/dist/chunk-z9wwa50p.js +0 -2
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Xl,Gl}from"./chunk-16sfjkc4.js";import{J,Nr,Zs,Qs,Ii,Ni,eo,Ne,Xe,ke,se,Lr,jr,he,oe,F,mt,Br,io,Hr,Qe,s,g,Y,Mn}from"./chunk-4r0028av.js";import{m,M,Ee,p}from"./chunk-4vz17ytv.js";import{r}from"./chunk-jmggm1ep.js";import{ge}from"./chunk-9tv0tw7f.js";import{Sr}from"./chunk-1hx6dyy9.js";import{w}from"./chunk-v6gkjg5f.js";import{t}from"./chunk-fvr3h2fr.js";import{createHash as At}from"crypto";import K from"fs";import G from"path";import ze from"fs";function Ae(e,i,n){let o=Buffer.alloc(n),a=ze.readSync(e,o,0,n,i);return o.subarray(0,a)}function Fe(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=ze.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(Fe(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)ze.closeSync(i)}}import sn from"fs";import We from"os";import{fileURLToPath as bt}from"url";var Ie=Symbol("stx.image-worker.unavailable");function on(e=typeof We.availableParallelism==="function"?We.availableParallelism():We.cpus().length){return Math.max(1,Math.min(2,e-1))}var Pe=0,vt=[];async function an(){if(Pe<on()){Pe++;return}await new Promise((e)=>vt.push(e)),Pe++}function cn(){Pe--,vt.shift()?.()}var ln="@stacksjs/stx/builtins/image-warmup-worker";function un(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:"&&sn.existsSync(bt(n)))return bt(n)}catch{}return Sr(ln,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 Ie}function _e(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: ${_e(a)}`)}if(typeof n!=="function")return ue("node:worker_threads has no Worker in this runtime");let o=un();if(!o)return ue("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await an();try{return await new Promise((a,c)=>{let l;try{l=new n(o)}catch(h){a(ue(`could not start ${o}: ${_e(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 d=Error(h.error?.message??"image worker failed");if(h.error?.name)d.name=h.error.name;if(h.error?.stack)d.stack=h.error.stack;v(()=>c(d))}),l.on("error",(h)=>{v(()=>u?c(h instanceof Error?h:Error(_e(h)||"image worker crashed")):a(ue(`the worker failed before it was ready: ${_e(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{cn()}}var fn=new Set([".avif",".jpeg",".jpg",".png",".webp"]),dn=[320,640,960,1280,1920],ve="/_stx/images",gn=`stx:${ve}:alpha-1`,pn=`stx:${ve}:opaque-1`,mn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Oe;function hn(e,i){let n=G.dirname(Bun.resolveSync(e,i));while(n!==G.dirname(n)){let o=G.join(n,"package.json");if(K.existsSync(o)){let a=JSON.parse(K.readFileSync(o,"utf8"));if(a.name===e)return a.version}n=G.dirname(n)}return}function wt(){if(Oe!==void 0)return Oe;let e;try{e=G.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Oe=mn.map((i)=>{let n;try{n=e?hn(i,e):void 0}catch{}return`${i.replace("@stacksjs/","")}@${n??"unknown"}`}).join("+"),Oe}var $t=Symbol.for("stx.image-delivery");function we(){let e=globalThis;return e[$t]??={catalog:new Map,transparent:new Set},e[$t]}var St=new Set;function yn(e){return`/${e.split(G.sep).map(encodeURIComponent).join("/")}`}function bn(e){let i=G.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:${ve}`){let n=(o)=>`${ve}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:i,async stat(o){let a=G.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=G.join(e,o);await K.promises.mkdir(G.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 _t(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=G.join(i,a.name);if(a.isDirectory()){if(i===e&&a.name==="_stx")continue;o.push(...await _t(e,c));continue}if(!a.isFile()||!fn.has(G.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:G.relative(e,c)})}return o}function Rt(e,i){return e.map((n)=>({key:yn(n.relativePath),input:n.absolutePath,name:bn(n.relativePath),...xn(n.absolutePath)?{options:{storage:i}}:{}}))}function xn(e){return Ue(e)==="possible"}function vn(e){for(let i=3;i<e.length;i+=4)if(e[i]!==255)return!0;return!1}async function wn(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(vn(v.data))n.add(l)}catch{n.add(l)}}));return n}function $n(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"),!Fe(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 Sn(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 G.join(e,"undecodable.json")}function Cn(e){try{let i=K.readFileSync(qe(e),"utf-8"),n=JSON.parse(i);return n&&typeof n==="object"?n:{}}catch{return{}}}function Rn(e,i){try{K.mkdirSync(G.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 ai(e){let i=Pt(e);return i?we().catalog.get(i):void 0}function ci(e){let i=Pt(e);return i?we().transparent.has(i):!1}function li(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 gy(e){let i=ai(e);if(!i)return;return{src:i.fallback.url,srcset:i.sources[i.fallback.format]||"",sources:li(i).map(({format:n,srcset:o})=>({type:`image/${n}`,srcset:o})),width:i.source.width,height:i.source.height,placeholder:ci(e)?void 0:i.placeholder?.dataUrl}}function As(){let e=we();e.catalog=new Map,e.transparent=new Set}function An(e){let i=we();i.catalog=new Map(e.entries),i.transparent=new Set(e.transparent)}async function my(e,i,n={}){if(!e||!K.existsSync(e))return As(),{count:0,fingerprint:""};if(n.offThread){let y=await He("delivery",{publicDir:e,outputDir:i});if(y!==Ie)return An(y.state),y.result}let o=await _t(e);if(o.length===0)return As(),{count:0,fingerprint:""};let a=Cn(i),c=o.filter((y)=>{let S=a[y.relativePath];if(!S)return!0;let R=kt(y.absolutePath);return!R||R.mtimeMs!==S.mtimeMs||R.size!==S.size});if(c.length===0)return As(),{count:0,fingerprint:""};let l=Ct(G.join(i,"_stx","images"),`${gn}:${wt()}`),u={outDir:G.join(i,"_stx","images"),storage:Ct(G.join(i,"_stx","images"),`${pn}:${wt()}`),baseUrl:ve,widths:dn,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(y){if(v=await Sn(c),v.length===c.length)throw y;let S=new Set(v.map((I)=>I.relativePath)),R=!1;for(let I of c){if(S.has(I.relativePath))continue;let k=kt(I.absolutePath);if(!k)continue;a[I.relativePath]=k,R=!0}if(R)Rn(i,a);if(v.length===0)return As(),{count:0,fingerprint:""};h=await f({...u,entries:Rt(v,l)})}let d=await wn(h.entries),C=$n(h.entries,d),x=we();x.catalog=new Map(Object.entries(h.entries)),x.transparent=d;let b=d.size===0&&C.length===0?h.fingerprint:At("sha256").update(h.fingerprint).update(JSON.stringify({transparent:[...d].sort(),droppedWebp:C.sort()})).digest("hex");return{count:v.length,fingerprint:b}}class It{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=Ii(e,o);if(a!==void 0)return a;for(let c of Ni(e,i,n,o))if(await s(c))return c;return null}}var fe=new It;var ne="\x00stx-boolean-attribute";function Ze(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var _n=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 Ve(e){let i=e.toLowerCase();return i.startsWith("aria-")||i.startsWith("data-")||_n.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)}="${Mn(c,Ze(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)}="${Mn(c,Ze(String(a)))}"`)}return n}function Pn(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 Ge={name:"StxLink",aliases:["stx-link"],render(e,i,n){let o=Pn(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(Lr(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 Ke(e){if(!e)return;let i=e.split("?")[0].split("#")[0];return In.get(i)}var En={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Je=[320,640,768,1024,1280,1536,1920];function X(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=!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=En[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 et(e,i,n,o){return i.map((a)=>`${$e(e,a,void 0,n,o)} ${a}w`).join(", ")}function Nn(e,i,n,o,a){return i.map((c)=>{let l=n?n*c:void 0;return`${$e(e,l,void 0,o,a)} ${c}x`}).join(", ")}function $e(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 On(e){return`var s=this.style;${e.map((i)=>`s.${i}=''`).join(";")}`}function Bn(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 tt={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,i,n){let o=X(e,"src")||"",a=ai(o),c=X(e,"alt")||"",l=X(e,"width")||(a?String(a.source.width):void 0),u=X(e,"height")||(a?String(a.source.height):void 0),f=X(e,"sizes"),v=X(e,"srcset"),h=X(e,"densities"),d=X(e,"format"),C=ci(o)||Ke(o)?.transparent===!0,x=X(e,"placeholder")||(a&&!C?"thumbhash":void 0),b=X(e,"placeholderColor")||"#e5e7eb",y=X(e,"provider"),S=X(e,"class")||X(e,"className")||"",R=X(e,"style")||"",I=X(e,"objectFit")||X(e,"fit"),k=X(e,"objectPosition")||X(e,"position"),E=X(e,"quality"),z=Be(e,"lazy",!0),W=Be(e,"preload",!1),B=Be(e,"priority",!1),O=X(e,"loading"),L=X(e,"decoding")||"async",U=!!a||Be(e,"picture",!1)||!!d,_=l?Number.parseInt(l):void 0,A=u?Number.parseInt(u):void 0,T=v||"",H="";if(a)T=a.sources[a.fallback.format]||"",H=f?Ye(f):"100vw";else if(!T&&f&&y&&y!=="local"&&y!=="static")T=et(o,Je,y,d),H=Ye(f);else if(!T&&h){let V=h.split(/\s+/).map((P)=>Number.parseFloat(P.replace("x","")));T=Nn(o,V,_,y,d)}else if(f)H=Ye(f);let D=[];if(R)D.push(R);if(I)D.push(`object-fit:${I}`);if(k)D.push(`object-position:${k}`);if(_&&A)D.push(`aspect-ratio:${_}/${A}`);let te=[],ae=x==="blur"||x==="color"||x==="thumbhash";if(ae&&!C){let V=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:b}:Ke(o);if(V&&x==="color")D.push(`background-color:${V.color}`),te.push("backgroundColor");else if(V)D.push(`background-color:${V.color}`),D.push(`background-image:url(${V.dataUrl})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),te.push("backgroundColor","backgroundImage");else{let P=Bn(_||16,A||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&&x&&x!=="empty"&&x!=="none")D.push(`background-image:url(${r(x)})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),te.push("backgroundImage");let j=a?.fallback.url||$e(o,_,A,y,d),Z=[];if(Z.push(`src="${r(Lr(j,"fetched"))}"`),Z.push(`alt="${r(c)}"`),l)Z.push(`width="${r(l)}"`);if(u)Z.push(`height="${r(u)}"`);let Ce=O||(B||W?"eager":z?"lazy":"");if(Ce)Z.push(`loading="${r(Ce)}"`);if(B)Z.push('fetchpriority="high"');if(Z.push(`decoding="${r(L)}"`),S)Z.push(`class="${r(S)}"`);if(D.length>0)Z.push(`style="${r(D.join(";"))}"`);if(T)Z.push(`srcset="${r(Lr(T,"fetched"))}"`);if(H)Z.push(`sizes="${r(H)}"`);let xe=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 V=typeof e.static.onload==="string"?e.static.onload:"",P=On(te)+(V?`;${V}`:"");Z.push(`onload="${r(P)}"`),xe.add("onload")}Z.push(...re(e,xe)),Z.push(...ie(e,xe));let le=`<img ${Z.join(" ")} />`,Q="";if(W){let P=d==="webp"?"image/webp":d==="avif"?"image/avif":"";Q=`<link rel="preload" as="image" href="${r(j)}"${P?` type="${P}"`:""}${T?` imagesrcset="${r(T)}"`:""}${H?` imagesizes="${r(H)}"`:""} />
|
|
3
|
-
`}if(U){let
|
|
4
|
-
${
|
|
2
|
+
import{Yl,Zl}from"./chunk-858p3hkz.js";import{Y,jr,Qs,eo,Ni,Di,to,Fr,zr,he,oe,F,ht,Hr,ao,Wr,Ze,s,m,Z,Ln}from"./chunk-vb609vbj.js";import{h,D,Ee,p,De,tt,we,ne}from"./chunk-vf7tpgqz.js";import{r}from"./chunk-xakqpa4z.js";import{ge}from"./chunk-fjpt8arw.js";import{Er}from"./chunk-1ts1pg90.js";import{x}from"./chunk-6bm7t0hm.js";import{t}from"./chunk-0wctbtad.js";import{createHash as At}from"crypto";import J from"fs";import K from"path";import ze from"fs";function Ae(e,i,n){let o=Buffer.alloc(n),a=ze.readSync(e,o,0,n,i);return o.subarray(0,a)}function Fe(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=ze.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(Fe(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)ze.closeSync(i)}}import sn from"fs";import We from"os";import{fileURLToPath as bt}from"url";var Ie=Symbol("stx.image-worker.unavailable");function on(e=typeof We.availableParallelism==="function"?We.availableParallelism():We.cpus().length){return Math.max(1,Math.min(2,e-1))}var Pe=0,vt=[];async function an(){if(Pe<on()){Pe++;return}await new Promise((e)=>vt.push(e)),Pe++}function cn(){Pe--,vt.shift()?.()}var ln="@stacksjs/stx/builtins/image-warmup-worker";function un(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:"&&sn.existsSync(bt(n)))return bt(n)}catch{}return Er(ln,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 Ie}function _e(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: ${_e(a)}`)}if(typeof n!=="function")return ue("node:worker_threads has no Worker in this runtime");let o=un();if(!o)return ue("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await an();try{return await new Promise((a,c)=>{let l;try{l=new n(o)}catch(g){a(ue(`could not start ${o}: ${_e(g)}`));return}let u=!1,f=!1,w=(g)=>{if(f)return;f=!0,g(),l.terminate()};l.on("message",(g)=>{if(g.type==="ready"){u=!0,l.postMessage({task:e,args:i});return}if(g.type==="result"){w(()=>a(g.value));return}let d=Error(g.error?.message??"image worker failed");if(g.error?.name)d.name=g.error.name;if(g.error?.stack)d.stack=g.error.stack;w(()=>c(d))}),l.on("error",(g)=>{w(()=>u?c(g instanceof Error?g:Error(_e(g)||"image worker crashed")):a(ue(`the worker failed before it was ready: ${_e(g)}`)))}),l.on("exit",(g)=>{w(()=>u?c(Error("image worker exited before it finished")):a(ue(`the worker exited with code ${g} before it was ready`)))})})}finally{cn()}}var fn=new Set([".avif",".jpeg",".jpg",".png",".webp"]),dn=[320,640,960,1280,1920],ve="/_stx/images",gn=`stx:${ve}:alpha-1`,pn=`stx:${ve}:opaque-1`,mn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Ne;function hn(e,i){let n=K.dirname(Bun.resolveSync(e,i));while(n!==K.dirname(n)){let o=K.join(n,"package.json");if(J.existsSync(o)){let a=JSON.parse(J.readFileSync(o,"utf8"));if(a.name===e)return a.version}n=K.dirname(n)}return}function wt(){if(Ne!==void 0)return Ne;let e;try{e=K.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Ne=mn.map((i)=>{let n;try{n=e?hn(i,e):void 0}catch{}return`${i.replace("@stacksjs/","")}@${n??"unknown"}`}).join("+"),Ne}var $t=Symbol.for("stx.image-delivery");function $e(){let e=globalThis;return e[$t]??={catalog:new Map,transparent:new Set},e[$t]}var St=new Set;function yn(e){return`/${e.split(K.sep).map(encodeURIComponent).join("/")}`}function bn(e){let i=K.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:${ve}`){let n=(o)=>`${ve}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:i,async stat(o){let a=K.join(e,o);try{let c=await J.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=K.join(e,o);await J.promises.mkdir(K.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await J.promises.writeFile(l,a),await J.promises.rename(l,c),{bytes:a.byteLength,path:c,url:n(o)}},url:n}}async function _t(e,i=e){let n=await J.promises.readdir(i,{withFileTypes:!0});n.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of n){let c=K.join(i,a.name);if(a.isDirectory()){if(i===e&&a.name==="_stx")continue;o.push(...await _t(e,c));continue}if(!a.isFile()||!fn.has(K.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:K.relative(e,c)})}return o}function Rt(e,i){return e.map((n)=>({key:yn(n.relativePath),input:n.absolutePath,name:bn(n.relativePath),...xn(n.absolutePath)?{options:{storage:i}}:{}}))}function xn(e){return Ue(e)==="possible"}function vn(e){for(let i=3;i<e.length;i+=4)if(e[i]!==255)return!0;return!1}async function wn(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,g)=>w.width-g.width)[0];try{let w=await a(new Uint8Array(await J.promises.readFile(f?.path??u.fallback.path)));if(vn(w.data))n.add(l)}catch{n.add(l)}}));return n}function $n(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=J.openSync(u.path,"r"),!Fe(Ae(f,0,32))}catch{return!0}finally{if(f!==void 0)J.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 Sn(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 K.join(e,"undecodable.json")}function Cn(e){try{let i=J.readFileSync(qe(e),"utf-8"),n=JSON.parse(i);return n&&typeof n==="object"?n:{}}catch{return{}}}function Rn(e,i){try{J.mkdirSync(K.dirname(qe(e)),{recursive:!0}),J.writeFileSync(qe(e),JSON.stringify(i))}catch{}}function kt(e){try{let i=J.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 li(e){let i=Pt(e);return i?$e().catalog.get(i):void 0}function ui(e){let i=Pt(e);return i?$e().transparent.has(i):!1}function di(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 yy(e){let i=li(e);if(!i)return;return{src:i.fallback.url,srcset:i.sources[i.fallback.format]||"",sources:di(i).map(({format:n,srcset:o})=>({type:`image/${n}`,srcset:o})),width:i.source.width,height:i.source.height,placeholder:ui(e)?void 0:i.placeholder?.dataUrl}}function Ps(){let e=$e();e.catalog=new Map,e.transparent=new Set}function kn(e){let i=$e();i.catalog=new Map(e.entries),i.transparent=new Set(e.transparent)}async function by(e,i,n={}){if(!e||!J.existsSync(e))return Ps(),{count:0,fingerprint:""};if(n.offThread){let y=await He("delivery",{publicDir:e,outputDir:i});if(y!==Ie)return kn(y.state),y.result}let o=await _t(e);if(o.length===0)return Ps(),{count:0,fingerprint:""};let a=Cn(i),c=o.filter((y)=>{let S=a[y.relativePath];if(!S)return!0;let R=kt(y.absolutePath);return!R||R.mtimeMs!==S.mtimeMs||R.size!==S.size});if(c.length===0)return Ps(),{count:0,fingerprint:""};let l=Ct(K.join(i,"_stx","images"),`${gn}:${wt()}`),u={outDir:K.join(i,"_stx","images"),storage:Ct(K.join(i,"_stx","images"),`${pn}:${wt()}`),baseUrl:ve,widths:dn,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,g;try{g=await f({...u,entries:Rt(c,l)})}catch(y){if(w=await Sn(c),w.length===c.length)throw y;let S=new Set(w.map((I)=>I.relativePath)),R=!1;for(let I of c){if(S.has(I.relativePath))continue;let k=kt(I.absolutePath);if(!k)continue;a[I.relativePath]=k,R=!0}if(R)Rn(i,a);if(w.length===0)return Ps(),{count:0,fingerprint:""};g=await f({...u,entries:Rt(w,l)})}let d=await wn(g.entries),C=$n(g.entries,d),v=$e();v.catalog=new Map(Object.entries(g.entries)),v.transparent=d;let b=d.size===0&&C.length===0?g.fingerprint:At("sha256").update(g.fingerprint).update(JSON.stringify({transparent:[...d].sort(),droppedWebp:C.sort()})).digest("hex");return{count:w.length,fingerprint:b}}class It{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=Ni(e,o);if(a!==void 0)return a;for(let c of Di(e,i,n,o))if(await s(c))return c;return null}}var fe=new It;var re="\x00stx-boolean-attribute";function Xe(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var An=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 Ve(e){let i=e.toLowerCase();return i.startsWith("aria-")||i.startsWith("data-")||An.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(m(c));continue}if(a===re){n.push(m(c));continue}n.push(`${m(c)}="${Ln(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(m(c));continue}if(typeof a==="object")continue;n.push(`${m(c)}="${Ln(c,Xe(String(a)))}"`)}return n}function _n(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 Ge={name:"StxLink",aliases:["stx-link"],render(e,i,n){let o=_n(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(Fr(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 g=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return f.push(...se(e,g)),f.push(...ie(e,g)),`<a ${f.join(" ")}>${i}</a>`}};var Pn=new Map;function Ke(e){if(!e)return;let i=e.split("?")[0].split("#")[0];return Pn.get(i)}var In={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Je=[320,640,768,1024,1280,1536,1920];function X(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=In[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)=>`${Se(e,a,void 0,n,o)} ${a}w`).join(", ")}function Nn(e,i,n,o,a){return i.map((c)=>{let l=n?n*c:void 0;return`${Se(e,l,void 0,o,a)} ${c}x`}).join(", ")}function Se(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 On(e){return`var s=this.style;${e.map((i)=>`s.${i}=''`).join(";")}`}function Bn(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=X(e,"src")||"",a=li(o),c=X(e,"alt")||"",l=X(e,"width")||(a?String(a.source.width):void 0),u=X(e,"height")||(a?String(a.source.height):void 0),f=X(e,"sizes"),w=X(e,"srcset"),g=X(e,"densities"),d=X(e,"format"),C=ui(o)||Ke(o)?.transparent===!0,v=X(e,"placeholder")||(a&&!C?"thumbhash":void 0),b=X(e,"placeholderColor")||"#e5e7eb",y=X(e,"provider"),S=X(e,"class")||X(e,"className")||"",R=X(e,"style")||"",I=X(e,"objectFit")||X(e,"fit"),k=X(e,"objectPosition")||X(e,"position"),E=X(e,"quality"),z=Oe(e,"lazy",!0),W=Oe(e,"preload",!1),B=Oe(e,"priority",!1),O=X(e,"loading"),L=X(e,"decoding")||"async",U=!!a||Oe(e,"picture",!1)||!!d,_=l?Number.parseInt(l):void 0,A=u?Number.parseInt(u):void 0,T=w||"",H="";if(a)T=a.sources[a.fallback.format]||"",H=f?Ye(f):"100vw";else if(!T&&f&&y&&y!=="local"&&y!=="static")T=Qe(o,Je,y,d),H=Ye(f);else if(!T&&g){let G=g.split(/\s+/).map((P)=>Number.parseFloat(P.replace("x","")));T=Nn(o,G,_,y,d)}else if(f)H=Ye(f);let j=[];if(R)j.push(R);if(I)j.push(`object-fit:${I}`);if(k)j.push(`object-position:${k}`);if(_&&A)j.push(`aspect-ratio:${_}/${A}`);let te=[],ae=v==="blur"||v==="color"||v==="thumbhash";if(ae&&!C){let G=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:b}:Ke(o);if(G&&v==="color")j.push(`background-color:${G.color}`),te.push("backgroundColor");else if(G)j.push(`background-color:${G.color}`),j.push(`background-image:url(${G.dataUrl})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),te.push("backgroundColor","backgroundImage");else{let P=Bn(_||16,A||9,b);j.push(`background-image:url(${P})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),te.push("backgroundImage")}}else if(!ae&&v&&v!=="empty"&&v!=="none")j.push(`background-image:url(${r(v)})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),te.push("backgroundImage");let M=a?.fallback.url||Se(o,_,A,y,d),V=[];if(V.push(`src="${r(Fr(M,"fetched"))}"`),V.push(`alt="${r(c)}"`),l)V.push(`width="${r(l)}"`);if(u)V.push(`height="${r(u)}"`);let Re=O||(B||W?"eager":z?"lazy":"");if(Re)V.push(`loading="${r(Re)}"`);if(B)V.push('fetchpriority="high"');if(V.push(`decoding="${r(L)}"`),S)V.push(`class="${r(S)}"`);if(j.length>0)V.push(`style="${r(j.join(";"))}"`);if(T)V.push(`srcset="${r(Fr(T,"fetched"))}"`);if(H)V.push(`sizes="${r(H)}"`);let xe=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 G=typeof e.static.onload==="string"?e.static.onload:"",P=On(te)+(G?`;${G}`:"");V.push(`onload="${r(P)}"`),xe.add("onload")}V.push(...se(e,xe)),V.push(...ie(e,xe));let le=`<img ${V.join(" ")} />`,Q="";if(W){let P=d==="webp"?"image/webp":d==="avif"?"image/avif":"";Q=`<link rel="preload" as="image" href="${r(M)}"${P?` type="${P}"`:""}${T?` imagesrcset="${r(T)}"`:""}${H?` imagesizes="${r(H)}"`:""} />
|
|
3
|
+
`}if(U){let G=[];if(a)for(let P of di(a))G.push(`<source type="image/${P.format}" srcset="${r(P.srcset)}"${H?` sizes="${r(H)}"`:""} />`);if(!a&&(d==="avif"||d==="auto")){let P=Se(o,_,A,y,"avif"),N=T?Qe(o,Je,y,"avif"):`${P}`;G.push(`<source type="image/avif" srcset="${r(N)}"${H?` sizes="${r(H)}"`:""} />`)}if(!a&&(d==="webp"||d==="auto")){let P=Se(o,_,A,y,"webp"),N=T?Qe(o,Je,y,"webp"):`${P}`;G.push(`<source type="image/webp" srcset="${r(N)}"${H?` sizes="${r(H)}"`:""} />`)}return`${Q}<picture>
|
|
4
|
+
${G.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 Tn=`<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>`,nt={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
|
|
8
|
-
<div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${c};background:${
|
|
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 Tn=`<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>`,nt={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 g=`<img ${f.join(" ")} />`,d=n.context;if(!d.__safeImageHandlerEmitted)return d.__safeImageHandlerEmitted=!0,`${Tn}${g}`;return g}};function rt(e){return e.replace(/[;{}()]/g,"").replace(/url/gi,"")}function Ce(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=Ce(e,i);if(o!==void 0){let a=Number.parseInt(o,10);if(!Number.isNaN(a))return a}return n}var st={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render(e,i,n){let o=rt(Ce(e,"color")||"#6366f1"),a=rt(Ce(e,"initialColor")||Ce(e,"initial-color")||""),c=rt(Ce(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">
|
|
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>
|
|
@@ -19,7 +19,7 @@ ${le}
|
|
|
19
19
|
@keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
|
|
20
20
|
@keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
|
|
21
21
|
@keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
|
|
22
|
-
</style>`}};function
|
|
22
|
+
</style>`}};function Te(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 Bt={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},ot={name:"StxModal",aliases:["stx-modal"],render(e,i,n){let o=Te(e,"id");if(!o)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let a=r(o),c=Te(e,"size")||"md",l=Te(e,"closeOnBackdrop")!=="false",u=Te(e,"closeOnEscape")!=="false",f=Bt[c]||Bt.md;return`<div id="stx-modal-${a}" class="stx-modal-backdrop" data-stx-modal="${a}" data-close-backdrop="${l}" data-close-escape="${u}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
|
|
23
23
|
<div class="stx-modal-panel" style="${f};width:100%;margin:1rem;border-radius:0.75rem;box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow:hidden;transform:scale(0.95) translateY(8px);transition:transform 0.2s ease,opacity 0.2s ease;opacity:0;background:var(--stx-modal-bg,#fff);color:var(--stx-modal-text,#1f2937)">
|
|
24
24
|
<div style="padding:1.5rem">${i}</div>
|
|
25
25
|
</div>
|
|
@@ -28,8 +28,8 @@ ${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"},at={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",
|
|
32
|
-
<div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${C};width:${
|
|
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"},at={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",g=Tt[l]||Tt.md,d=c==="left",C=d?"left:0":"right:0",v=d?"translateX(-100%)":"translateX(100%)",b=d?"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">
|
|
32
|
+
<div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${C};width:${g};max-width:100vw;transform:${v};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>
|
|
35
35
|
</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 jn,readFileSync as
|
|
41
|
-
`||L==="\t"){let U=Xn(e,B+S.length);if(e[U-1]!=="/")I++;k=U+1}else k=B+S.length}else{if(I--,I===0){E=O;break}k=O+R.length}}if(E===-1){a=x;continue}let z=e.slice(x,E),W=E+R.length;o.push({fullMatch:e.slice(l,W),tagName:v,attributes:y,content:z,startIndex:l,endIndex:W,isSelfClosing:!1}),a=W}}return o}function ft(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function kn(e,i){try{let n=Buffer.from(e,"base64").toString("utf8");return JSON.parse(n)}catch{}try{let n=e.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(n)}catch(n){if(i?.debug)console.error("Error decoding __stx_ prop:",n);return e}}function Le(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 Ht(e){let i=e.trim();if(!i.startsWith("{")||!i.endsWith("}"))return null;if(Le(i,0).length!==i.length)return null;return i.slice(1,-1).trim()}function qt(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=Le(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 Zn=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),Vn=new Set([":for","x-for","v-for","@for"]),Xt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Gn(e){return dt(e).map((i)=>[i.start,i.end])}function dt(e){let i=[],n=new Map;for(let o of Ne(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)?qt(o.attributes).find((v)=>Vn.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&&!Xt.has(a)){let v=n.get(a);if(!v)v=[],n.set(a,v);v.push(f)}}return i}var Kn=/(?:^|\s)((?:[\w-]+:)*-?space-[xy]-(?!reverse(?:\s|$))[\w./[\]-]+)(?=\s|$)/;function Zt(e){let i=new Map,n=[];for(let o of Ne(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&&!Xt.has(a)){let l=/(?:^|\s)class\s*=\s*(["'])([\s\S]*?)\1/.exec(o.attributes)?.[2];n.push({name:a,utility:l?Kn.exec(l)?.[1]??null:null,children:0})}}return i}function Vt(e){if(typeof e==="string")return e;if(Array.isArray(e))return e.filter(Boolean).map((i)=>Vt(i)).join(" ");if(e&&typeof e==="object")return Object.entries(e).filter(([,i])=>i).map(([i])=>i).join(" ");return e?String(e):""}function Bc(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(...Gn(e));let l=new Set([...mt(i),...Array.isArray(i.__stx_client_declared_names)?i.__stx_client_declared_names:[]]);function u(d){return a.some(([C,x])=>d>=C&&d<x)}let f=[],v=new Map,h=256;for(let d of Ne(n)){if(d.closing||u(d.start))continue;let C=d.attributes.trimEnd();if(!C||!C.includes(":"))continue;let x=/(?:^|\s)data-native(?:\s|=|$)/i.test(C.replace(/"[^"]*"|'[^']*'/g,"")),b=new Set((/(?:^|\s)data-stx-parent-bindings="([^"]*)"/.exec(C)?.[1]??"").split(/\s+/).filter(Boolean)),y=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,S,R=C,I=!1;while((S=y.exec(C))!==null){if(jr(C,S.index,!0)?.kind==="attribute")continue;let k=S[1],E=S[2];if(Xl(k))continue;if(b.has(k)&&!x)continue;if(F(E,l))continue;if(E.includes("()")&&!E.includes(".get(")||E.includes("$store")||E.includes("$ref"))continue;try{let z=Object.keys(i),W=Object.values(i),B=E.match(/^([a-zA-Z_$][\w$]*)/);if(B&&!z.includes(B[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(B[1]))continue;let O=JSON.stringify([z,E]),L=v.get(O);if(!L){if(L=Function(...z,`return (${E})`),v.size>=h)v.clear();v.set(O,L)}let U=L(...W);if(k==="class"){let _=Y(Vt(U));if(_){let A=R.match(/\sclass="([^"]*)"/);if(A)R=R.replace(A[0],()=>` class="${A[1]} ${_}"`);else R=R.replace(S[0],()=>` class="${_}"`)}else R=R.replace(S[0],"");I=!0;continue}if(Zn.has(k)){if(U)R=R.replace(S[0],` ${k}`);else R=R.replace(S[0],"");I=!0;continue}if(U===null||U===void 0||U===!1)R=R.replace(S[0],"");else{let _=x&&typeof U==="object"?JSON.stringify(U):String(U),A=Mn(k,_);R=R.replace(S[0],()=>` ${k}="${A}"`)}I=!0}catch(z){if(z instanceof he)throw z;continue}}if(I){let k=d.selfClosing?" /":"",z=`<${d.name}${R}${k}>`;f.push({start:d.start,end:d.end,replacement:z})}}if(f.length>0){let d=Array(f.length*2+1),C=0;for(let x=0;x<f.length;x++){let{start:b,end:y,replacement:S}=f[x];d[x*2]=n.slice(C,b),d[x*2+1]=S,C=y}d[f.length*2]=n.slice(C),n=d.join("")}return n}import Gt from"fs";import Kt from"path";var Jt=!1;function Jn(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 x=t(C),b=x.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(b&&l.has(b))return!0;for(let y of l){let S=y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${S}\\s*\\(`).test(x))return!0}return!1},f=new Set(Gl),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,(x,b)=>b.toUpperCase())},h=(C,x)=>{let b=v(C);if(c.static[b]=x,b!==C)c.staticNames[b]=C},d={...e};for(let[C,x]of Object.entries(e)){let b=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(C);if(!b)continue;delete d[C];let y=b[1]||"modelValue";if(d[`:${y}`]=x,d[`@update:${y}`]=`${x} = $event`,b[2]){let S=b[2].slice(1).split(".").map((R)=>`${R}: true`).join(", ");d[`:${b[1]?`${y}Modifiers`:"modelModifiers"}`]=`{ ${S} }`}}for(let[C,x]of Object.entries(d)){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]=x;continue}if(b.startsWith("__stx_")){let y=v(b.slice(6));c.serverDynamic[y]=kn(x,n);continue}if(b.startsWith(":")){let y=v(b.slice(1)),S=x===ne?y:x;if(y==="if"||y==="for"||y==="show"){c.clientReactive[y]=S;continue}if(o){c.clientReactive[y]=S;continue}if(F(S,a)){c.clientReactive[y]=S;continue}if(u(S)){c.clientReactive[y]=S;continue}try{if(!m(S)){if(n.debug)console.error(`Unsafe expression in :${y} binding: ${S}`);c.clientReactive[y]=S;continue}let R=Object.keys(i),I=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]),k=new Set(Array.isArray(i.__stx_client_declared_names)?i.__stx_client_declared_names:[]);if((Array.isArray(i.__stx_caller_client_bindings)?i.__stx_caller_client_bindings:[]).includes(S.trim())||Ee(S).some((O)=>!I.has(O)&&(k.has(O)||!R.includes(O)&&!(O in globalThis)))){c.clientReactive[y]=S;continue}let B=p(S,R)(...Object.values(i));if(c.serverDynamic[y]=B,y!==b.slice(1)&&c.serverDynamicNames)c.serverDynamicNames[y]=b.slice(1)}catch{c.clientReactive[y]=S}continue}if(typeof x==="string"&&x.includes("{{")&&x.includes("}}")){let y=tr(x,a);if(y!==null){c.clientReactive[v(b)]=y;continue}let S=x.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(S)try{let R=S[1];if(m(R)){let k=p(R,Object.keys(i))(...Object.values(i));h(b,k!=null?String(k):"")}else{if(n.debug)console.error(`Unsafe expression in ${b}: ${R}`);h(b,x)}}catch(R){if(n.debug)console.error(`Error evaluating expression for ${b}:`,R);h(b,x)}else{let R=x,I=/\{\{\s*([\s\S]+?)\s*\}\}/g,k;while((k=I.exec(x))!==null)try{let E=k[1];if(!m(E)){if(n.debug)console.error(`Unsafe expression in ${b}: ${E}`);continue}let W=p(E,Object.keys(i))(...Object.values(i));R=R.replace(k[0],String(W??""))}catch(E){if(n.debug)console.error(`Error evaluating expression in ${b}:`,E)}h(b,R)}continue}h(b,x===ne?"true":ft(x))}return c}var gt=new Set;function hy(){gt.clear()}function Yn(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 Qn(e,i,n){let o=`${n}\x00${e}\x00${i}`;if(gt.has(o))return;gt.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 yy(){pt.clear()}function er(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 tr(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 nr=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function rr(e,i,n){if(!e.includes("@"))return e;if(!nr.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=Le(e,n),n+=c.length;let l=Ht(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 Yt(e){return Object.entries(e).map(([i,n])=>n===ne?i:`${i}="${sr(n)}"`).join(" ")}function sr(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function ir(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 hg(e,i,n,o,a){if(!/import\s/.test(e))return e;if(!i.__importedComponents)i.__importedComponents=new Map;let c=i.__importedComponents,l=Kt.dirname(n),u=[],f=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let d of e.matchAll(f)){let[C,x,b]=d,y=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,S=b,R,I=[];while((R=y.exec(b))!==null){let[k,E,z,W]=R,B=null,O=null;if(W.startsWith(".")||W.startsWith("/")){let _=Kt.resolve(l,W);if(_.endsWith(".stx"))O=_;else{let A=`${_}.stx`;try{if(Gt.statSync(A).isFile())O=A}catch{try{if(Gt.statSync(_).isDirectory())B=_}catch{}}}}else B=Zs(W,l);if(!B&&!O)continue;let L=!1,U=(_,A)=>{c.set(_,A),c.set(_.toLowerCase(),A);let T=_.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();c.set(T,A),a.add(A)};if(z&&O)U(z,O),L=!0;else if(E){let _=E.slice(1,-1).split(",").map((T)=>T.trim()).filter(Boolean).map((T)=>{let H=T.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(H)return{source:H[1],local:H[2]};return{source:T,local:T}}),A=B?Nr(B):null;for(let{source:T,local:H}of _){let D=null;if(O)D=O;else if(A)D=A.get(T)??A.get(T.toLowerCase())??A.get(T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)U(H,D),L=!0}}if(L)I.push({start:R.index,end:R.index+k.length})}if(I.length===0)continue;for(let k=I.length-1;k>=0;k--)S=S.slice(0,I[k].start)+S.slice(I[k].end);u.push({start:d.index,end:d.index+C.length,value:`<script${x}>${S}</script>`})}if(u.length===0)return e;let v=[],h=0;for(let d of u)v.push(e.slice(h,d.start),d.value),h=d.end;return v.push(e.slice(h)),v.join("")}async function or(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,d=h.split(",").map((C)=>C.trim().replace(/^['"]|['"]$/g,"")).filter((C)=>C.length>0);for(let C of d){let x=C.split("/"),y=x[x.length-1].replace(/\.stx$/,""),S=y.includes("-")?y.split("-").map((k)=>k.charAt(0).toUpperCase()+k.slice(1)).join(""):y.charAt(0).toUpperCase()+y.slice(1),R=null,I=Qs(C,n,o);for(let k of I)try{if(await Bun.file(k).exists()){R=k;break}}catch{}if(R){l.set(S,R),l.set(y,R),l.set(y.toLowerCase(),R);let k=S.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(l.set(k,R),a.add(R),o.debug)console.log(`Imported component: ${S} -> ${R}`)}else if(o.debug)console.warn(`Could not resolve imported component: ${C}`)}c=c.replace(v,""),u.lastIndex=0}return c}async function ar(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,d=h+v[0].length-1,C=1,x=d+1;while(x<c.length&&C>0){if(c[x]==="(")C++;else if(c[x]===")"){if(C--,C===0)break}x++}if(C!==0)break;let b=c.substring(d+1,x),y=x+1,S=b.match(/^\s*['"]([^'"]+)['"]/);if(!S){f.lastIndex=y;continue}let R=S[1],I,k=b.slice(S[0].length),E=k.match(/^\s*,\s*/);if(E)I=k.slice(E[0].length).trim();let z={};if(I)try{z=M(I,i)}catch(_){let A=_ instanceof Error?_.message:String(_);c=c.replace(c.substring(h,y),`[Error parsing component props: ${A}]`);continue}let W="",B=y,L=c.substring(y).match(/^([\s\S]*?)@endcomponent/);if(L)W=L[1].trim(),B=y+L[0].length;let U=await Qe(R,z,W,l,i,n,o,u,a);c=c.substring(0,h)+U+c.substring(B),f.lastIndex=0}return c}async function cr(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=io(c);if(f.size>0){let y=Array.isArray(i.__stx_client_declared_names)?i.__stx_client_declared_names:[];i.__stx_client_declared_names=[...new Set([...y,...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,Ut(Br)),c=await b(c,/[a-z][a-z0-9]*/,!1,Br),c=v.restore(c),c;async function b(y,S,R,I){if(!y)return y;let k=y,E=Wt(k,S,I),z=dt(k),W=!o._nativeHostAttrs&&/space-[xy]-/.test(k),B,O=new Map;for(let _=E.length-1;_>=0;_--){let A=E[_],T=R?J(A.tagName):A.tagName,H=ye(rr(A.attributes,i,n)),D=z.filter(({start:N,end:q})=>A.startIndex>=N&&A.startIndex<q);if(D.some((N)=>N.tag==="template"))er(A.tagName,n);let te=D.length>0,ae=new Set(h);for(let N of D)for(let q of N.names)ae.add(q);let j=Jn(H,i,o,te,ae);if(typeof j.clientReactive.for==="string")for(let N of oe(j.clientReactive.for))ae.add(N);let Z=fe.getBuiltin(A.tagName),Ce=Z?await Hr(A.tagName,l,i,n,{...o,_nativePrimitivesFallback:void 0}):!1,xe=A.tagName==="Image"&&eo([...Object.keys(j.static),...Object.keys(j.serverDynamic),...Object.keys(j.clientReactive)],Object.keys(j.events),{...j.static,...j.serverDynamic})&&(o._pluginComponentDirs??[]).some((N)=>Nr(N).has("Image"));if(Z&&!Ce&&!xe){let N={context:i,filePath:n,options:o,dependencies:a},q=Z.render(j,A.content,N);if(Object.keys(j.events).length>0){let ce=Yt(j.events);q=q.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${ce}`)}if(Object.keys(j.clientReactive).length>0)q=Qt(q,j.clientReactive);O.set(_,q);continue}if(!R&&A.tagName.includes("-")&&!await Hr(T,l,i,n,o))continue;let le={};for(let[N,q]of Object.entries(j.static))le[N]=q;for(let[N,q]of Object.entries(j.serverDynamic))le[N]=q;let Q={declaredProps:new Set,consumedProps:new Set,reactiveProps:Object.keys(j.clientReactive),events:Object.keys(j.events)},V=await Qe(T,le,v.restore(A.content),l,i,n,o,u,a,[...ae],Q,A.tagName);if(W&&Yn(V)){B??=Zt(k);let N=B.get(A.startIndex);if(N)Qn(A.tagName,N,n)}let P=V;if(P=lr(P,j,Q.declaredProps,Q.consumedProps,o._nativeHostAttrs),o._nativeHostAttrs){let N=Q.reactiveProps.filter((ee)=>!Q.consumedProps.has(ee)&&!["if","for","show","key","ref"].includes(ee)).map(J),q=ht(P,!0);if(N.length&&q){if(!Object.hasOwn(ye(P.slice(q.insertPos,q.tagEnd)),"data-stx-native-host-root"))P=P.slice(0,q.insertPos)+' data-stx-native-host-root="true"'+P.slice(q.insertPos);let ee=be(P);P=P.slice(0,ee.insertPos)+` data-stx-native-forward="${N.join(" ")}"`+P.slice(ee.insertPos)}let ce=ht(P,!0);if(ce){let ee=ye(P.slice(ce.insertPos,ce.tagEnd)),Re=be(P),rn=ye(P.slice(Re.insertPos,Re.tagEnd));if(Object.hasOwn(ee,"data-stx-native-host-root")&&!Object.hasOwn(rn,"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 N=be(P);if(N){let q=Yt(j.events),ce=Object.keys(j.events).map((ee)=>ee.replace(/^@/,"").split(".")[0]).join(" ");P=P.substring(0,N.insertPos)+` data-stx-parent-events="${ce}" ${q}`+P.substring(N.insertPos)}}if(Object.keys(j.clientReactive).length>0)P=Qt(P,j.clientReactive);O.set(_,P)}if(O.size===0)return k;let L="",U=0;for(let _=0;_<E.length;_++){let A=O.get(_);if(A===void 0)continue;L+=k.slice(U,E[_].startIndex),L+=A,U=E[_].endIndex}return L+=k.slice(U),L}}function Qt(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?be(l):null;if(u){let h=a.map(([C,x])=>`:${J(C)}="${x.replace(/"/g,""")}"`).join(" "),d=c?` data-stx-parent-bindings="${c}"`:"";l=l.substring(0,u.insertPos)+`${d} ${h}`+l.substring(u.insertPos)}let f=i.if;if(f)l=`<template :if="${f.replace(/"/g,""")}">${l}</template>`;let v=i.for;if(v){let h=i.key,d=h?` :key="${h.replace(/"/g,""")}"`:"";l=`<template :for="${v.replace(/"/g,""")}"${d}>${l}</template>`}return l}function lr(e,i,n=new Set,o=new Set,a=!1){let c=ht(e,a);if(!c)return e;let l=a?be(e):null;if(l){let u=tn(e,l).filter((f)=>f.insertPos>c.insertPos);for(let f=u.length-1;f>=0;f--)e=en(e,u[f],i,n,o,a)}return en(e,c,i,n,o,a)}function en(e,i,n,o,a,c){let l=e.slice(i.insertPos,i.tagEnd),u=n.serverDynamic.class??n.static.class;if(c&&typeof u==="string"&&u&&!a.has("class")){let b=/(^|\s)class\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i,y=b.test(l)?l.replace(b,(S,R,I,k,E)=>`${R}class="${r(`${ft(I??k??E)} ${u}`)}"`):` class="${r(u)}"${l}`;e=e.slice(0,i.insertPos)+y+e.slice(i.tagEnd),i.tagEnd+=y.length-l.length,l=y}let f=c||/\bdata-native(?:\s|=)/i.test(l),v=f?a:o,h=new Set(Object.keys(ye(l))),d=new Set(["class","className"]);for(let b of Object.keys(n.static)){let y=n.staticNames[b]??b;if(h.has(y)||v.has(b)||!f&&!Ve(y))d.add(b)}for(let b of Object.keys(n.serverDynamic)){let y=n.serverDynamicNames?.[b]??b;if(h.has(y)||v.has(b)||!f&&!Ve(y))d.add(b)}let C=[];if(f){for(let[b,y]of Object.entries(n.static)){if(d.has(b)||y!==!0&&y!==ne)continue;d.add(b),C.push(`${r(n.staticNames?.[b]??b)}="true"`)}for(let[b,y]of Object.entries(n.serverDynamic)){if(d.has(b)||y!==!0)continue;d.add(b),C.push(`${r(n.serverDynamicNames?.[b]??b)}="true"`)}}let x=[...re(n,d),...ie(n,d),...C];if(f){for(let[b,y]of Object.entries(n.serverDynamic)){if(d.has(b)||y!==!1)continue;let S=n.serverDynamicNames?.[b]??b;x.push(`${r(S)}="false"`)}for(let[b,y]of Object.entries(n.serverDynamic)){if(d.has(b)||y===null||typeof y!=="object")continue;let S=JSON.stringify(y);if(S!==void 0){let R=n.serverDynamicNames?.[b]??b;x.push(`${r(R)}="${r(S)}"`)}}}if(x.length===0)return e;return`${e.slice(0,i.insertPos)} ${x.join(" ")}${e.slice(i.insertPos)}`}function be(e){let i=nn(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 ht(e,i=!1){let n=be(e);if(!n)return null;let o=e.slice(n.insertPos,n.tagEnd),a=/\bdata-stx-component-wrapper(?:\s|=|>|$)/i.test(o)?nn(e,n.tagEnd+1):n;return a&&i?ur(e,a)??a:a}function ur(e,i){return tn(e,i)[0]??null}function tn(e,i){let n=[];if(!e.includes("data-stx-native-host-root"))return n;let o=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),a=e.lastIndexOf("<",i.insertPos),c=0,l;while(a>=0&&a<e.length){if(e.startsWith("<!--",a)){let d=e.indexOf("-->",a+4);if(d<0)return n;a=e.indexOf("<",d+3);continue}let u=/^<(\/?)([a-z][\w-]*)\b/i.exec(e.slice(a));if(!u){a=e.indexOf("<",a+1);continue}let f=u[2].toLowerCase(),v=a+u[0].length,h=yt(e,v);if(u[1]){if(c--,l!==void 0&&c<l)l=void 0;if(c<=0)return n}else if(f==="script"||f==="style"){let d=new RegExp(`</${f}\\s*>`,"gi");if(d.lastIndex=h+1,!d.exec(e))return n;a=e.indexOf("<",d.lastIndex);continue}else{let d=ye(e.slice(v,h)),C=c>0&&(Object.hasOwn(d,"data-stx-component-wrapper")||Object.hasOwn(d,"data-stx-native-host-owner")),x=l===void 0&&!C&&Object.hasOwn(d,"data-stx-native-host-root");if(x)n.push({insertPos:v,tagEnd:h});if(!o.has(f)&&e[h-1]!=="/"){if(c++,l===void 0&&(C||x))l=c}else if(c===0)return n}a=e.indexOf("<",h+1)}return n}function nn(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}async function Ps(e,i,n,o,a){if(!Jt)Lt(fe),Jt=!0;let c=await hg(e,i,n,o,a);c=await or(c,i,n,o,a),c=await ar(c,i,n,o,a);let l=[];for(let u=0;u<3;u++){let f=l.length,v=ke(c,Xe,(d,C)=>`\x00STX_COMPONENT_COMMENT_${f+C}\x00`,`STX_COMPONENT_COMMENT:${f}`);l.push(...v.tokens);let h=c;if(c=await cr(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=ir(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
|
-
export{
|
|
40
|
+
</style>`}};import{existsSync as jn,readFileSync as Mn}from"fs";var je=new Map,Dt=new Set;function zn(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 Fn(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(jn(n))return n;for(let n of[`@iconify-json/${e}/icons.json`,`@iconify/json/json/${e}.json`])try{return x.resolve(n)}catch{}return null}function Un(e){if(je.has(e))return je.get(e);let i=Fn(e);if(!i)return zn(e),null;try{let n=JSON.parse(Mn(i,"utf8"));return je.set(e,n),n}catch{return null}}function Wn(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 Hn(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:Wn(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 ct={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 S=o.split(":");a=S[0],c=S[1]}let l=r(me(e,"size")||"24"),u=r(me(e,"color")||"currentColor"),f=r(me(e,"class")||""),w=r(me(e,"style")||""),g=je.get(a)??Un(a);if(!g)return`<!-- Icon: collection "${a}" not loaded -->`;let d=Hn(g,c);if(!d)return`<!-- Icon: "${c}" not found in ${a} -->`;let C=`0 0 ${d.width} ${d.height}`,v=d.body;if(u!=="currentColor")v=v.replace(/currentColor/g,u);let b=f?` class="${f}"`:"",y=w?` style="${w}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${l}" height="${l}" viewBox="${C}" fill="none"${b}${y}>${v}</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 lt={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 Me(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 ut={name:"TransitionGroup",aliases:["transition-group"],render(e,i,n){let o=(Me(e,"name")||"v").replace(/["'<>]/g,""),a=(Me(e,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",c=Me(e,"class"),l=Me(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(Ge),e.registerBuiltin(et),e.registerBuiltin(nt),e.registerBuiltin(st),e.registerBuiltin(it),e.registerBuiltin(ot),e.registerBuiltin(at),e.registerBuiltin(ct),e.registerBuiltin(lt),e.registerBuiltin(ut)}var zt=new Map;function qn(e){let i=zt.get(e.source);if(!i)i=new RegExp(`(${e.source})(?![\\w.:-])`,"y"),zt.set(e.source,i);return i}var Ft=new WeakMap;function Ut(e){let i=Ft.get(e);if(!i)i=new Set([...e].map((o)=>o.toLowerCase())),Ft.set(e,i);let n=i;return(o)=>!/[a-z]/.test(o)&&n.has(o.toLowerCase())}function Xn(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=qn(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 S=l+1+w.length;while(S<e.length&&e[S]!==">")S++;a=S+1;continue}let g=l+1+w.length,d=null,C=g,v=-1,b=!1;while(g<e.length){let S=e[g];if(d){if(S==="\\"&&g+1<e.length){g+=2;continue}if(S===d)d=null;g++;continue}if(S==='"'||S==="'"){d=S,g++;continue}if(S==="/"&&g+1<e.length&&e[g+1]===">"){v=g+2,b=!0;break}if(S===">"){v=g+1;break}g++}if(v===-1){a=l+1;continue}let y=e.slice(C,b?v-2:v-1).trim();if(b)o.push({fullMatch:e.slice(l,v),tagName:w,attributes:y,content:"",startIndex:l,endIndex:v,isSelfClosing:!0}),a=v;else{let S=`<${w}`,R=`</${w}>`,I=1,k=v,E=-1;while(I>0&&k<e.length){let B=e.indexOf(S,k),O=e.indexOf(R,k);if(O===-1)break;if(B!==-1&&B<O){let L=e[B+S.length];if(L===" "||L===">"||L==="/"||L===`
|
|
41
|
+
`||L==="\t"){let U=Xn(e,B+S.length);if(e[U-1]!=="/")I++;k=U+1}else k=B+S.length}else{if(I--,I===0){E=O;break}k=O+R.length}}if(E===-1){a=v;continue}let z=e.slice(v,E),W=E+R.length;o.push({fullMatch:e.slice(l,W),tagName:w,attributes:y,content:z,startIndex:l,endIndex:W,isSelfClosing:!1}),a=W}}return o}function ft(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function En(e,i){try{let n=Buffer.from(e,"base64").toString("utf8");return JSON.parse(n)}catch{}try{let n=e.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(n)}catch(n){if(i?.debug)console.error("Error decoding __stx_ prop:",n);return e}}function Le(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 Ht(e){let i=e.trim();if(!i.startsWith("{")||!i.endsWith("}"))return null;if(Le(i,0).length!==i.length)return null;return i.slice(1,-1).trim()}function qt(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=Le(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 Zn=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),Vn=new Set([":for","x-for","v-for","@for"]),Xt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Gn(e){return dt(e).map((i)=>[i.start,i.end])}function dt(e){let i=[],n=new Map;for(let o of De(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)?qt(o.attributes).find((w)=>Vn.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&&!Xt.has(a)){let w=n.get(a);if(!w)w=[],n.set(a,w);w.push(f)}}return i}var Kn=/(?:^|\s)((?:[\w-]+:)*-?space-[xy]-(?!reverse(?:\s|$))[\w./[\]-]+)(?=\s|$)/;function Zt(e){let i=new Map,n=[];for(let o of De(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&&!Xt.has(a)){let l=/(?:^|\s)class\s*=\s*(["'])([\s\S]*?)\1/.exec(o.attributes)?.[2];n.push({name:a,utility:l?Kn.exec(l)?.[1]??null:null,children:0})}}return i}function Vt(e){if(typeof e==="string")return e;if(Array.isArray(e))return e.filter(Boolean).map((i)=>Vt(i)).join(" ");if(e&&typeof e==="object")return Object.entries(e).filter(([,i])=>i).map(([i])=>i).join(" ");return e?String(e):""}function zc(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(...Gn(e));let l=new Set([...ht(i),...Array.isArray(i.__stx_client_declared_names)?i.__stx_client_declared_names:[]]);function u(d){return a.some(([C,v])=>d>=C&&d<v)}let f=[],w=new Map,g=256;for(let d of De(n)){if(d.closing||u(d.start))continue;let C=d.attributes.trimEnd();if(!C||!C.includes(":"))continue;let v=/(?:^|\s)data-native(?:\s|=|$)/i.test(C.replace(/"[^"]*"|'[^']*'/g,"")),b=new Set((/(?:^|\s)data-stx-parent-bindings="([^"]*)"/.exec(C)?.[1]??"").split(/\s+/).filter(Boolean)),y=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,S,R=C,I=!1;while((S=y.exec(C))!==null){if(zr(C,S.index,!0)?.kind==="attribute")continue;let k=S[1],E=S[2];if(Yl(k))continue;if(b.has(k)&&!v)continue;if(F(E,l))continue;if(E.includes("()")&&!E.includes(".get(")||E.includes("$store")||E.includes("$ref"))continue;try{let z=Object.keys(i),W=Object.values(i),B=E.match(/^([a-zA-Z_$][\w$]*)/);if(B&&!z.includes(B[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(B[1]))continue;let O=JSON.stringify([z,E]),L=w.get(O);if(!L){if(L=Function(...z,`return (${E})`),w.size>=g)w.clear();w.set(O,L)}let U=L(...W);if(k==="class"){let _=Z(Vt(U));if(_){let A=R.match(/\sclass="([^"]*)"/);if(A)R=R.replace(A[0],()=>` class="${A[1]} ${_}"`);else R=R.replace(S[0],()=>` class="${_}"`)}else R=R.replace(S[0],"");I=!0;continue}if(Zn.has(k)){if(U)R=R.replace(S[0],` ${k}`);else R=R.replace(S[0],"");I=!0;continue}if(U===null||U===void 0||U===!1)R=R.replace(S[0],"");else{let _=v&&typeof U==="object"?JSON.stringify(U):String(U),A=Ln(k,_);R=R.replace(S[0],()=>` ${k}="${A}"`)}I=!0}catch(z){if(z instanceof he)throw z;continue}}if(I){let k=d.selfClosing?" /":"",z=`<${d.name}${R}${k}>`;f.push({start:d.start,end:d.end,replacement:z})}}if(f.length>0){let d=Array(f.length*2+1),C=0;for(let v=0;v<f.length;v++){let{start:b,end:y,replacement:S}=f[v];d[v*2]=n.slice(C,b),d[v*2+1]=S,C=y}d[f.length*2]=n.slice(C),n=d.join("")}return n}import Gt from"fs";import Kt from"path";var Jt=!1;function Jn(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 v=t(C),b=v.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(b&&l.has(b))return!0;for(let y of l){let S=y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${S}\\s*\\(`).test(v))return!0}return!1},f=new Set(Zl),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,(v,b)=>b.toUpperCase())},g=(C,v)=>{let b=w(C);if(c.static[b]=v,b!==C)c.staticNames[b]=C},d={...e};for(let[C,v]of Object.entries(e)){let b=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(C);if(!b)continue;delete d[C];let y=b[1]||"modelValue";if(d[`:${y}`]=v,d[`@update:${y}`]=`${v} = $event`,b[2]){let S=b[2].slice(1).split(".").map((R)=>`${R}: true`).join(", ");d[`:${b[1]?`${y}Modifiers`:"modelModifiers"}`]=`{ ${S} }`}}for(let[C,v]of Object.entries(d)){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]=v;continue}if(b.startsWith("__stx_")){let y=w(b.slice(6));c.serverDynamic[y]=En(v,n);continue}if(b.startsWith(":")){let y=w(b.slice(1)),S=v===re?y:v;if(y==="if"||y==="for"||y==="show"){c.clientReactive[y]=S;continue}if(o){c.clientReactive[y]=S;continue}if(F(S,a)){c.clientReactive[y]=S;continue}if(u(S)){c.clientReactive[y]=S;continue}try{if(!h(S)){if(n.debug)console.error(`Unsafe expression in :${y} binding: ${S}`);c.clientReactive[y]=S;continue}let R=Object.keys(i),I=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]),k=new Set(Array.isArray(i.__stx_client_declared_names)?i.__stx_client_declared_names:[]);if((Array.isArray(i.__stx_caller_client_bindings)?i.__stx_caller_client_bindings:[]).includes(S.trim())||Ee(S).some((O)=>!I.has(O)&&(k.has(O)||!R.includes(O)&&!(O in globalThis)))){c.clientReactive[y]=S;continue}let B=p(S,R)(...Object.values(i));if(c.serverDynamic[y]=B,y!==b.slice(1)&&c.serverDynamicNames)c.serverDynamicNames[y]=b.slice(1)}catch{c.clientReactive[y]=S}continue}if(typeof v==="string"&&v.includes("{{")&&v.includes("}}")){let y=tr(v,a);if(y!==null){c.clientReactive[w(b)]=y;continue}let S=v.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(S)try{let R=S[1];if(h(R)){let k=p(R,Object.keys(i))(...Object.values(i));g(b,k!=null?String(k):"")}else{if(n.debug)console.error(`Unsafe expression in ${b}: ${R}`);g(b,v)}}catch(R){if(n.debug)console.error(`Error evaluating expression for ${b}:`,R);g(b,v)}else{let R=v,I=/\{\{\s*([\s\S]+?)\s*\}\}/g,k;while((k=I.exec(v))!==null)try{let E=k[1];if(!h(E)){if(n.debug)console.error(`Unsafe expression in ${b}: ${E}`);continue}let W=p(E,Object.keys(i))(...Object.values(i));R=R.replace(k[0],String(W??""))}catch(E){if(n.debug)console.error(`Error evaluating expression in ${b}:`,E)}g(b,R)}continue}g(b,v===re?"true":ft(v))}return c}var gt=new Set;function wy(){gt.clear()}function Yn(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 Qn(e,i,n){let o=`${n}\x00${e}\x00${i}`;if(gt.has(o))return;gt.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 vy(){pt.clear()}function er(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 tr(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 nr=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function rr(e,i,n){if(!e.includes("@"))return e;if(!nr.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=Le(e,n),n+=c.length;let l=Ht(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]=re}return i}function Yt(e){return Object.entries(e).map(([i,n])=>n===re?i:`${i}="${sr(n)}"`).join(" ")}function sr(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function ir(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 wg(e,i,n,o,a){if(!/import\s/.test(e))return e;if(!i.__importedComponents)i.__importedComponents=new Map;let c=i.__importedComponents,l=Kt.dirname(n),u=[],f=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let d of e.matchAll(f)){let[C,v,b]=d,y=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,S=b,R,I=[];while((R=y.exec(b))!==null){let[k,E,z,W]=R,B=null,O=null;if(W.startsWith(".")||W.startsWith("/")){let _=Kt.resolve(l,W);if(_.endsWith(".stx"))O=_;else{let A=`${_}.stx`;try{if(Gt.statSync(A).isFile())O=A}catch{try{if(Gt.statSync(_).isDirectory())B=_}catch{}}}}else B=Qs(W,l);if(!B&&!O)continue;let L=!1,U=(_,A)=>{c.set(_,A),c.set(_.toLowerCase(),A);let T=_.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();c.set(T,A),a.add(A)};if(z&&O)U(z,O),L=!0;else if(E){let _=E.slice(1,-1).split(",").map((T)=>T.trim()).filter(Boolean).map((T)=>{let H=T.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(H)return{source:H[1],local:H[2]};return{source:T,local:T}}),A=B?jr(B):null;for(let{source:T,local:H}of _){let j=null;if(O)j=O;else if(A)j=A.get(T)??A.get(T.toLowerCase())??A.get(T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(j)U(H,j),L=!0}}if(L)I.push({start:R.index,end:R.index+k.length})}if(I.length===0)continue;for(let k=I.length-1;k>=0;k--)S=S.slice(0,I[k].start)+S.slice(I[k].end);u.push({start:d.index,end:d.index+C.length,value:`<script${v}>${S}</script>`})}if(u.length===0)return e;let w=[],g=0;for(let d of u)w.push(e.slice(g,d.start),d.value),g=d.end;return w.push(e.slice(g)),w.join("")}async function or(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,g]=f,d=g.split(",").map((C)=>C.trim().replace(/^['"]|['"]$/g,"")).filter((C)=>C.length>0);for(let C of d){let v=C.split("/"),y=v[v.length-1].replace(/\.stx$/,""),S=y.includes("-")?y.split("-").map((k)=>k.charAt(0).toUpperCase()+k.slice(1)).join(""):y.charAt(0).toUpperCase()+y.slice(1),R=null,I=eo(C,n,o);for(let k of I)try{if(await Bun.file(k).exists()){R=k;break}}catch{}if(R){l.set(S,R),l.set(y,R),l.set(y.toLowerCase(),R);let k=S.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(l.set(k,R),a.add(R),o.debug)console.log(`Imported component: ${S} -> ${R}`)}else if(o.debug)console.warn(`Could not resolve imported component: ${C}`)}c=c.replace(w,""),u.lastIndex=0}return c}async function ar(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 g=w.index,d=g+w[0].length-1,C=1,v=d+1;while(v<c.length&&C>0){if(c[v]==="(")C++;else if(c[v]===")"){if(C--,C===0)break}v++}if(C!==0)break;let b=c.substring(d+1,v),y=v+1,S=b.match(/^\s*['"]([^'"]+)['"]/);if(!S){f.lastIndex=y;continue}let R=S[1],I,k=b.slice(S[0].length),E=k.match(/^\s*,\s*/);if(E)I=k.slice(E[0].length).trim();let z={};if(I)try{z=D(I,i)}catch(_){let A=_ instanceof Error?_.message:String(_);c=c.replace(c.substring(g,y),`[Error parsing component props: ${A}]`);continue}let W="",B=y,L=c.substring(y).match(/^([\s\S]*?)@endcomponent/);if(L)W=L[1].trim(),B=y+L[0].length;let U=await Ze(R,z,W,l,i,n,o,u,a);c=c.substring(0,g)+U+c.substring(B),f.lastIndex=0}return c}async function cr(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=ao(c);if(f.size>0){let y=Array.isArray(i.__stx_client_declared_names)?i.__stx_client_declared_names:[];i.__stx_client_declared_names=[...new Set([...y,...f])]}let w=ne(c);c=w.output;let g=ht(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,Ut(Hr)),c=await b(c,/[a-z][a-z0-9]*/,!1,Hr),c=w.restore(c),c;async function b(y,S,R,I){if(!y)return y;let k=y,E=Wt(k,S,I),z=dt(k),W=!o._nativeHostAttrs&&/space-[xy]-/.test(k),B,O=new Map;for(let _=E.length-1;_>=0;_--){let A=E[_],T=R?Y(A.tagName):A.tagName,H=ye(rr(A.attributes,i,n)),j=z.filter(({start:N,end:q})=>A.startIndex>=N&&A.startIndex<q);if(j.some((N)=>N.tag==="template"))er(A.tagName,n);let te=j.length>0,ae=new Set(g);for(let N of j)for(let q of N.names)ae.add(q);let M=Jn(H,i,o,te,ae);if(typeof M.clientReactive.for==="string")for(let N of oe(M.clientReactive.for))ae.add(N);let V=fe.getBuiltin(A.tagName),Re=V?await Wr(A.tagName,l,i,n,{...o,_nativePrimitivesFallback:void 0}):!1,xe=A.tagName==="Image"&&to([...Object.keys(M.static),...Object.keys(M.serverDynamic),...Object.keys(M.clientReactive)],Object.keys(M.events),{...M.static,...M.serverDynamic})&&(o._pluginComponentDirs??[]).some((N)=>jr(N).has("Image"));if(V&&!Re&&!xe){let N={context:i,filePath:n,options:o,dependencies:a},q=V.render(M,A.content,N);if(Object.keys(M.events).length>0){let ce=Yt(M.events);q=q.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${ce}`)}if(Object.keys(M.clientReactive).length>0)q=Qt(q,M.clientReactive);O.set(_,q);continue}if(!R&&A.tagName.includes("-")&&!await Wr(T,l,i,n,o))continue;let le={};for(let[N,q]of Object.entries(M.static))le[N]=q;for(let[N,q]of Object.entries(M.serverDynamic))le[N]=q;let Q={declaredProps:new Set,consumedProps:new Set,reactiveProps:Object.keys(M.clientReactive),events:Object.keys(M.events)},G=await Ze(T,le,w.restore(A.content),l,i,n,o,u,a,[...ae],Q,A.tagName);if(W&&Yn(G)){B??=Zt(k);let N=B.get(A.startIndex);if(N)Qn(A.tagName,N,n)}let P=G;if(P=lr(P,M,Q.declaredProps,Q.consumedProps,o._nativeHostAttrs),o._nativeHostAttrs){let N=Q.reactiveProps.filter((ee)=>!Q.consumedProps.has(ee)&&!["if","for","show","key","ref"].includes(ee)).map(Y),q=mt(P,!0);if(N.length&&q){if(!Object.hasOwn(ye(P.slice(q.insertPos,q.tagEnd)),"data-stx-native-host-root"))P=P.slice(0,q.insertPos)+' data-stx-native-host-root="true"'+P.slice(q.insertPos);let ee=be(P);P=P.slice(0,ee.insertPos)+` data-stx-native-forward="${N.join(" ")}"`+P.slice(ee.insertPos)}let ce=mt(P,!0);if(ce){let ee=ye(P.slice(ce.insertPos,ce.tagEnd)),ke=be(P),rn=ye(P.slice(ke.insertPos,ke.tagEnd));if(Object.hasOwn(ee,"data-stx-native-host-root")&&!Object.hasOwn(rn,"data-stx-native-host-owner"))P=P.slice(0,ke.insertPos)+" data-stx-native-host-owner"+P.slice(ke.insertPos)}}if(Object.keys(M.events).length>0){let N=be(P);if(N){let q=Yt(M.events),ce=Object.keys(M.events).map((ee)=>ee.replace(/^@/,"").split(".")[0]).join(" ");P=P.substring(0,N.insertPos)+` data-stx-parent-events="${ce}" ${q}`+P.substring(N.insertPos)}}if(Object.keys(M.clientReactive).length>0)P=Qt(P,M.clientReactive);O.set(_,P)}if(O.size===0)return k;let L="",U=0;for(let _=0;_<E.length;_++){let A=O.get(_);if(A===void 0)continue;L+=k.slice(U,E[_].startIndex),L+=A,U=E[_].endIndex}return L+=k.slice(U),L}}function Qt(e,i){let n=new Set(["if","for"]),o=new Set(["show"]),a=Object.entries(i).filter(([g])=>!n.has(g)),c=a.filter(([g])=>!o.has(g)).map(([g])=>Y(g)).join(" "),l=e,u=a.length>0?be(l):null;if(u){let g=a.map(([C,v])=>`:${Y(C)}="${v.replace(/"/g,""")}"`).join(" "),d=c?` data-stx-parent-bindings="${c}"`:"";l=l.substring(0,u.insertPos)+`${d} ${g}`+l.substring(u.insertPos)}let f=i.if;if(f)l=`<template :if="${f.replace(/"/g,""")}">${l}</template>`;let w=i.for;if(w){let g=i.key,d=g?` :key="${g.replace(/"/g,""")}"`:"";l=`<template :for="${w.replace(/"/g,""")}"${d}>${l}</template>`}return l}function lr(e,i,n=new Set,o=new Set,a=!1){let c=mt(e,a);if(!c)return e;let l=a?be(e):null;if(l){let u=tn(e,l).filter((f)=>f.insertPos>c.insertPos);for(let f=u.length-1;f>=0;f--)e=en(e,u[f],i,n,o,a)}return en(e,c,i,n,o,a)}function en(e,i,n,o,a,c){let l=e.slice(i.insertPos,i.tagEnd),u=n.serverDynamic.class??n.static.class;if(c&&typeof u==="string"&&u&&!a.has("class")){let b=/(^|\s)class\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i,y=b.test(l)?l.replace(b,(S,R,I,k,E)=>`${R}class="${r(`${ft(I??k??E)} ${u}`)}"`):` class="${r(u)}"${l}`;e=e.slice(0,i.insertPos)+y+e.slice(i.tagEnd),i.tagEnd+=y.length-l.length,l=y}let f=c||/\bdata-native(?:\s|=)/i.test(l),w=f?a:o,g=new Set(Object.keys(ye(l))),d=new Set(["class","className"]);for(let b of Object.keys(n.static)){let y=n.staticNames[b]??b;if(g.has(y)||w.has(b)||!f&&!Ve(y))d.add(b)}for(let b of Object.keys(n.serverDynamic)){let y=n.serverDynamicNames?.[b]??b;if(g.has(y)||w.has(b)||!f&&!Ve(y))d.add(b)}let C=[];if(f){for(let[b,y]of Object.entries(n.static)){if(d.has(b)||y!==!0&&y!==re)continue;d.add(b),C.push(`${r(n.staticNames?.[b]??b)}="true"`)}for(let[b,y]of Object.entries(n.serverDynamic)){if(d.has(b)||y!==!0)continue;d.add(b),C.push(`${r(n.serverDynamicNames?.[b]??b)}="true"`)}}let v=[...se(n,d),...ie(n,d),...C];if(f){for(let[b,y]of Object.entries(n.serverDynamic)){if(d.has(b)||y!==!1)continue;let S=n.serverDynamicNames?.[b]??b;v.push(`${r(S)}="false"`)}for(let[b,y]of Object.entries(n.serverDynamic)){if(d.has(b)||y===null||typeof y!=="object")continue;let S=JSON.stringify(y);if(S!==void 0){let R=n.serverDynamicNames?.[b]??b;v.push(`${r(R)}="${r(S)}"`)}}}if(v.length===0)return e;return`${e.slice(0,i.insertPos)} ${v.join(" ")}${e.slice(i.insertPos)}`}function be(e){let i=nn(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=be(e);if(!n)return null;let o=e.slice(n.insertPos,n.tagEnd),a=/\bdata-stx-component-wrapper(?:\s|=|>|$)/i.test(o)?nn(e,n.tagEnd+1):n;return a&&i?ur(e,a)??a:a}function ur(e,i){return tn(e,i)[0]??null}function tn(e,i){let n=[];if(!e.includes("data-stx-native-host-root"))return n;let o=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),a=e.lastIndexOf("<",i.insertPos),c=0,l;while(a>=0&&a<e.length){if(e.startsWith("<!--",a)){let d=e.indexOf("-->",a+4);if(d<0)return n;a=e.indexOf("<",d+3);continue}let u=/^<(\/?)([a-z][\w-]*)\b/i.exec(e.slice(a));if(!u){a=e.indexOf("<",a+1);continue}let f=u[2].toLowerCase(),w=a+u[0].length,g=yt(e,w);if(u[1]){if(c--,l!==void 0&&c<l)l=void 0;if(c<=0)return n}else if(f==="script"||f==="style"){let d=new RegExp(`</${f}\\s*>`,"gi");if(d.lastIndex=g+1,!d.exec(e))return n;a=e.indexOf("<",d.lastIndex);continue}else{let d=ye(e.slice(w,g)),C=c>0&&(Object.hasOwn(d,"data-stx-component-wrapper")||Object.hasOwn(d,"data-stx-native-host-owner")),v=l===void 0&&!C&&Object.hasOwn(d,"data-stx-native-host-root");if(v)n.push({insertPos:w,tagEnd:g});if(!o.has(f)&&e[g-1]!=="/"){if(c++,l===void 0&&(C||v))l=c}else if(c===0)return n}a=e.indexOf("<",g+1)}return n}function nn(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}async function Is(e,i,n,o,a){if(!Jt)Lt(fe),Jt=!0;let c=await wg(e,i,n,o,a);c=await or(c,i,n,o,a),c=await ar(c,i,n,o,a);let l=[];for(let u=0;u<3;u++){let f=l.length,w=we(c,tt,(d,C)=>`\x00STX_COMPONENT_COMMENT_${f+C}\x00`,`STX_COMPONENT_COMMENT:${f}`);l.push(...w.tokens);let g=c;if(c=await cr(w.output,i,n,o,a),c===g)break}if(l.length>0)c=c.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(u,f)=>l[Number(f)]??"");if(o.debug){let u=ir(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
|
+
export{li,ui,di,yy,Ps,by,En,zc,wy,vy,wg,Is};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{T}from"./chunk-jjq7c8s2.js";import{t,Kn,y}from"./chunk-0wctbtad.js";var M=new T(32,{maxBytes:2097152,sizeOf:(x)=>x.code.length*4}),B=/^[A-Za-z_$][\w$]*$/,O=new Set(["if","for","while","switch","with"]),_=["(","[","{"],D=[")","]","}"],Z=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function C(x){let u=t(x),h=[];for(let e of u.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let r=e.index??0;h.push({text:e[0],start:r,end:r+e[0].length})}return{code:u,tokens:h}}function z(x){let u=M.get(x);if(u)return u;let{code:h,tokens:e}=C(x),r=new Map,l=[];for(let o=0;o<e.length;o++){let n=e[o].text;if(["(","[","{"].includes(n))l.push(o);else if([")","]","}"].includes(n)){let i=l.at(-1);if(i!==void 0&&["()","[]","{}"].includes(e[i].text+n))l.pop(),r.set(i,o),r.set(o,i)}}function w(o,n){let i=[],s=o;for(let c=o;c<n;c++){if(["(","[","{"].includes(e[c].text)&&(r.get(c)??n)<n){c=r.get(c);continue}if(e[c].text===",")i.push([s,c]),s=c+1}return i.push([s,n]),i}let k=[];function b(o,n,i,s=!1,c){if(e[o]?.text==="...")o++;if(o>=n)return;let d=e[o].text;if(B.test(d)){if(i.add(d),i===g)k.push({name:d,token:o,functionScoped:s,declarationToken:c});return}if(d!=="{"&&d!=="[")return;let N=r.get(o);if(N===void 0||N>=n)return;for(let[v,m]of w(o+1,N)){let p=v;if(d==="{")for(let E=v;E<m;E++){if(e[E].text===":"){p=E+1;break}if(e[E].text==="=")break;if(["(","[","{"].includes(e[E].text)&&r.has(E))E=r.get(E)}b(p,m,i,s,c)}}function I(o,n){let i=new Set;for(let[s,c]of w(o,n))b(s,c,i);return i}function L(o){let n=o;for(;n<e.length;n++){let i=e[n].text;if(["(","[","{"].includes(i)&&r.has(n)){n=r.get(n);continue}if([",",";",")","]","}"].includes(i))break}return e[Math.max(o,n-1)]?.end??h.length}let g=new Set,A=[];for(let o=0;o<e.length;o++)if(e[o].text==="=>"){let n=o-1,i=n,s;if(e[n]?.text===")"&&r.has(n))i=r.get(n),s=I(i+1,n);else if(e[n]&&B.test(e[n].text))s=new Set([e[n].text]);else continue;let c=o+1,d=e[c]?.text==="{"&&r.has(c)?e[r.get(c)].end:L(c);A.push({start:e[i].start,end:d,bodyStart:e[c]?.start??d,functionBody:!0,names:s})}else if(e[o].text==="("&&r.has(o)){let n=e[o-1]?.text;if(!n||O.has(n)||!B.test(n)&&n!=="*"&&n!=="]")continue;let i=r.get(o),s=i+1;if(e[s]?.text===":"){s++;while(s<e.length&&!["{","=>",";","="].includes(e[s].text))s++}if(e[s]?.text!=="{"||!r.has(s))continue;A.push({start:e[o].start,end:e[r.get(s)].end,bodyStart:e[s].start,functionBody:n!=="catch",names:I(o+1,i)})}function a(o){let n=o;for(;n<e.length;n++){let i=e[n].text;if(_.includes(i)&&r.has(n)){n=r.get(n);continue}if(i===";"||D.includes(i))break;let s=e[n-1];if(n>o&&Z.has(i)&&s.text!==".")break;if(n>o&&/[\n\r]/.test(h.slice(s.end,e[n].start))&&(/^[\w$]+$/.test(s.text)||D.includes(s.text)||['"',"'","`"].includes(s.text))&&B.test(i)&&!["in","of","instanceof"].includes(i))break}return n}let f=[];for(let o=0;o<e.length;o++){if(e[o].text!=="for")continue;let n=e[o+1]?.text==="await"?o+2:o+1;if(e[n]?.text!=="("||!r.has(n))continue;let i=r.get(n),s=i+1,c=e[s]?.text==="{"&&r.has(s)?r.get(s):a(s),d=e[c]?.text===";"||e[c]?.text==="}"?e[c].end:e[Math.max(s,c-1)]?.end??h.length;f.push({headStart:n,headEnd:i,start:e[n].start,end:d})}for(let o=0;o<e.length;o++){let n=e[o].text,i=e[o-1]?.text;if(i==="."||e[o+1]?.text===":")continue;if(i==="as"||i==="<")continue;if(n==="const"||n==="let"||n==="var"){let s=a(o+1),c=o+1,d=!1,N=!1,v=0;for(let m=o+1;m<=s;m++){let p=e[m]?.text;if(m<s&&_.includes(p)&&r.has(m)&&r.get(m)<s){m=r.get(m);continue}if(m<s&&p===":"&&!N)d=!0;else if(m<s&&p==="="&&v===0)d=!1,N=!0;else if(m<s&&d&&p==="<")v++;else if(m<s&&d&&p===">"&&v>0)v--;else if(m===s||p===","&&v===0)b(c,m,g,n==="var",o),c=m+1,d=!1,N=!1}}else if(n==="function"||n==="class"){let s=o+1;if(e[s]?.text==="*")s++;if(e[s]&&B.test(e[s].text)&&e[s].text!=="extends")g.add(e[s].text),k.push({name:e[s].text,token:s,declarationToken:o})}else if(n==="import"){let s=o+1;if(e[s]?.text==="*"&&e[s+1]?.text==="as")s+=2;let c=e[s]?.text;if(c&&B.test(c)&&c!=="type"&&e[s+1]?.text!=="("&&e[s+1]?.text!==".")g.add(c),k.push({name:c,token:s,file:!0});let d=e[s]?.text==="{"?s:e[s+1]?.text===","&&e[s+2]?.text==="{"?s+2:-1;if(d!==-1&&r.has(d)){let N=r.get(d);for(let[v,m]of w(d+1,N)){let p=m-1;while(p>=v&&!B.test(e[p].text))p--;if(p>=v&&e[p].text!=="type")k.push({name:e[p].text,token:p,file:!0})}}}}let S={code:h,scopes:A,loops:f,declarations:g,sites:k,tokens:e,pairs:r};return M.set(x,S),S}function Qr(x){let u=z(x);return{code:u.code,shadows:(h,e)=>u.scopes.some((r)=>e>=r.start&&e<r.end&&r.names.has(h))}}function ko(x){return new Set(z(x).declarations)}function qn(x){let u=z(x),h=Kn(x),{depths:e}=y(h),r=[...h.matchAll(/[A-Za-z_$][\w$]*|\d+(?:[.]\d+)?|[^\s]/g)],l=[];for(let w of u.sites){if(w.file||w.declarationToken===void 0)continue;let k=u.tokens[w.declarationToken];if(e[k.start]!==0)continue;let b=0,I=r.length;while(b<I){let A=b+I>>>1;if(r[A].index<k.start)b=A+1;else I=A}let L=b-1,g=r[L--];if(g?.[0]==="declare")continue;if(k.text==="function"||k.text==="class"){while(g&&["async","export","default","abstract"].includes(g[0]))g=r[L--];if(g&&![";","}"].includes(g[0])){let A=h.slice(g.index+g[0].length,k.start);if(!/[\r\n]/.test(A)||!/^(?:[\w$]+|[)\]])$/.test(g[0])||["return","throw","yield","await","new"].includes(g[0]))continue}}l.push({name:w.name,start:k.start})}return l}function Wl(x){return[...new Set(qn(x).map((u)=>u.name))].sort()}function Be(x,u){let{scopes:h,loops:e,sites:r,tokens:l,pairs:w}=z(x),k=Array.from({length:l.length},()=>-1),b=[];for(let a=0;a<l.length;a++){k[a]=b.length?b[b.length-1]:-1;let f=l[a].text;if(f==="{"&&w.has(a))b.push(a);else if(f==="}"&&b.length&&w.get(a)===b[b.length-1])b.pop()}let I=new Set,L=new Map;for(let a of r){if(!u.has(a.name))continue;I.add(a.token);let f=a.file?-1:k[a.token],S=f===-1?[0,Number.POSITIVE_INFINITY]:[l[f].start,l[w.get(f)].end];if(a.functionScoped){let n=l[a.token].start,i=h.filter((s)=>s.functionBody&&n>=s.bodyStart&&n<s.end).sort((s,c)=>s.end-s.bodyStart-(c.end-c.bodyStart))[0];S=i?[i.bodyStart,i.end]:[0,Number.POSITIVE_INFINITY]}else if(!a.file){let n=e.filter((i)=>a.token>i.headStart&&a.token<i.headEnd).sort((i,s)=>i.headEnd-i.headStart-(s.headEnd-s.headStart))[0];if(n)S=[n.start,n.end]}let o=L.get(a.name);if(o)o.push(S);else L.set(a.name,[S])}let g=new Set;for(let a=0;a<l.length;a++){if(l[a].text!=="import"||l[a-1]?.text===".")continue;let f=a+1;if(l[f]?.text==="type")f++;if(l[f]&&B.test(l[f].text)&&l[f+1]?.text===",")f+=2;if(l[f]?.text==="{"&&w.has(f))for(let S=f+1;S<w.get(f);S++)g.add(S)}let A=new Set;for(let a=0;a<l.length;a++){let f=l[a].text;if(!u.has(f)||A.has(f)||I.has(a)||g.has(a))continue;let S=l[a-1]?.text;if(S==="#"||S==="."&&l[a-2]?.text!=="..")continue;if(l[a+1]?.text===":"&&(S==="{"||S===","))continue;let o=l[a].start;if(L.get(f)?.some(([n,i])=>o>=n&&o<i))continue;if(h.some((n)=>o>=n.start&&o<n.end&&n.names.has(f)))continue;A.add(f)}return A}function ql(x){let u=z(Kn(x));return u.tokens.some((h,e)=>{if(h.text!=="await")return!1;if(u.tokens[e-1]?.text==="."||u.tokens[e+1]?.text===":")return!1;let r=e+1;if(u.tokens[r]?.text==="("&&u.tokens[(u.pairs.get(r)??-2)+1]?.text==="{")return!1;return!u.scopes.some((l)=>l.functionBody&&l.start<=h.start&&h.start<l.end)})}
|
|
3
|
+
export{Qr,ko,qn,Wl,Be,ql};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Hm}from"./chunk-2jm7map2.js";import"./chunk-2m4ydym0.js";import"./chunk-p3x7kwb5.js";import"./chunk-yvaqgdv1.js";import"./chunk-xpsg91dh.js";import"./chunk-sbr3wg75.js";import"./chunk-m390z8w8.js";import"./chunk-1a2c4pv8.js";import"./chunk-zaj3nnvv.js";import"./chunk-d69k67bn.js";import"./chunk-xakqpa4z.js";import"./chunk-whnzf9hn.js";import"./chunk-fjpt8arw.js";import"./chunk-3aayrnbh.js";import"./chunk-v1x96kjr.js";import"./chunk-p0xqm2ne.js";import"./chunk-fwxgzktt.js";import"./chunk-2mv29s6w.js";import"./chunk-3tcy9r6r.js";import"./chunk-50zzar2c.js";import"./chunk-mr9pp5cf.js";import"./chunk-txk2z7v0.js";import"./chunk-ktv65e3n.js";import"./chunk-5fdc8pej.js";import"./chunk-vb609vbj.js";import"./chunk-qda8tmk9.js";import"./chunk-14df2jzs.js";import"./chunk-vf7tpgqz.js";import"./chunk-ayrd026n.js";import"./chunk-ex6dne7e.js";import"./chunk-jjq7c8s2.js";import"./chunk-858p3hkz.js";export{Hm as buildForProduction};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{fu,Na,gu,mu,Ma,hu,yu,bu,wu,Da,vu,Lm}from"./chunk-zrxvj3zf.js";import{Va,_u}from"./chunk-m9ta0640.js";import{le,ue,de,tr,Te,ze,ms,Rt,pn,nr,rr,sr,pe,or,ir,hs}from"./chunk-1vsjmwr1.js";import{Ru}from"./chunk-09xqy448.js";import"./chunk-1bf0grbf.js";export{ue as DEFAULT_FORMATS,de as DEFAULT_QUALITY,le as DEFAULT_WIDTHS,hs as ImageProcessingError,mu as clearImageCache,Ma as createImageDirective,_u as createImageHandler,yu as createImagePlugin,Lm as defaultImageConfig,ir as formatSize,Da as generateImageManifest,pn as generateSizes,Rt as generateSrcSet,nr as getFallbackVariant,ms as getImageMetadata,pe as getMimeType,or as getTotalSize,rr as groupVariantsByFormat,Va as handleImageRequest,hu as imageDirective,Te as isImageBackendAvailable,sr as isImageFile,tr as isSharpAvailable,wu as optimizeDirectory,bu as optimizeImage,Na as parseImageComponent,ze as processImage,gu as processImageComponents,fu as renderImageComponent,Ru as rewriteImagesWithSiblings,vu as writeImageManifest};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{d,h,Ml,p,n,u}from"./chunk-vf7tpgqz.js";import{pt,Mt,Tn,vi}from"./chunk-p0xqm2ne.js";function L(w,e){try{let g=w.trim();if(h(g))return p(g,Object.keys(e))(...Object.values(e));else return d(g,e)}catch{return!1}}function Q(w,e,g){let t=w,v=!0;while(v){v=!1;let a=t.match(/@switch\s*\(/);if(!a||a.index===void 0)break;let b=a.index,s=vi(t,b);if(!s)break;try{let o;if(h(s.expression))o=p(s.expression,Object.keys(e))(...Object.values(e));else o=d(s.expression,e);let r="",c=!1;for(let i of s.cases)if(i.type==="default"){if(!c)r=i.content.trim()}else try{let y;if(i.value&&h(i.value))y=p(i.value,Object.keys(e))(...Object.values(e));else if(i.value)y=d(i.value,e);if(o===y){r=i.content.trim(),c=!0;break}}catch{continue}t=t.substring(0,b)+r+t.substring(s.end),v=!0}catch(o){let r=o instanceof Error?o.message:String(o),c=u("Switch",`Error evaluating @switch expression: ${r}`,n.EVALUATION_ERROR);t=t.substring(0,b)+c+t.substring(s.end);break}}return t}function H(w){let e=[];return{masked:w.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(t)=>(e.push(t),`\x00stx-script-${e.length-1}\x00`)),scripts:e}}function J(w,e){if(e.length===0)return w;return w.replace(/\u0000stx-script-(\d+)\u0000/g,(g,t)=>e[Number(t)]??g)}function ge(w,e,g){let{masked:t,scripts:v}=H(w);return J(K(t,e,g),v)}function K(w,e,g){let t=w;t=Q(t,e,g);{let a=!0;while(a){a=!1;let b=t.match(/@unless\s*\(/);if(!b||b.index===void 0)break;let s=b.index,o=pt(t,s+7);if(!o)break;let r=o.endPos,c=Mt(t,"unless","endunless",r);if(c===-1){console.warn(`[stx] @unless directive at position ${s} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let i=t.slice(r,c),y=o.expression,m=-1;{let x=0,k=/@(?:if|unless)\s*\(/g,f=/@(?:endif|endunless)(?![a-z])/g,E=/@else(?![a-z])/g,S=[],C;while((C=k.exec(i))!==null)S.push({pos:C.index,type:"open"});while((C=f.exec(i))!==null)S.push({pos:C.index,type:"close"});while((C=E.exec(i))!==null)S.push({pos:C.index,type:"else"});S.sort((P,R)=>P.pos-R.pos);for(let P of S)if(P.type==="open")x++;else if(P.type==="close")x--;else if(P.type==="else"&&x===0){m=P.pos;break}}let l;if(m!==-1){let x=i.slice(0,m),k=i.slice(m+5);l=`@if (${y})${k}@else ${x}@endif`}else l=`@if (!(${y}))${i}@endif`;t=t.substring(0,s)+l+t.substring(c+10),a=!0}}t=gi(t,e,g),t=mi(t,e,g),t=fi(t,e);let v=()=>{let a=Tn(t);if(a.length===0)return!1;let b=Array(a.length);for(let r=a.length-1;r>=0;r--){let c=a[r];try{let i="",y=!1;for(let m of c.branches){if(y)break;if(m.type==="else")i=m.content,y=!0;else try{if(m.condition?Ml(m.condition,e):!1)i=m.content,y=!0}catch(l){i=u(m.type==="if"?"If":"Elseif",`Error in @${m.type}(${m.condition}): ${l instanceof Error?l.message:String(l)}`,n.EVALUATION_ERROR),y=!0}}b[r]=i}catch(i){let y=i instanceof Error?i.message:String(i);b[r]=u("If",`Error processing @if block: ${y}`,n.EVALUATION_ERROR)}}let s=Array(a.length*2+1),o=0;for(let r=0;r<a.length;r++){let c=a[r];s[r*2]=t.slice(o,c.start),s[r*2+1]=b[r],o=c.end}return s[a.length*2]=t.slice(o),t=s.join(""),!0};while(!0){let a=t;if(!v())break;if(t===a)break}return t}function q(w){let e=0;while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!=="(")return null;e++;while(e<w.length&&/\s/.test(w[e]))e++;let g=w[e];if(g!=="'"&&g!=='"')return null;e++;let t=[];while(e<w.length){let v=w[e];if(v==="\\"&&e+1<w.length){t.push(w[e+1]),e+=2;continue}if(v===g){e++;break}t.push(v),e++}while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!==")")return null;return e++,{value:t.join(""),consumed:e}}function fi(w,e){let g=w;function t(s,o,r,c){let i=1,y=c,m=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),l=new RegExp(`@${r}(?![a-z])`,"g");while(y<s.length&&i>0){m.lastIndex=y,l.lastIndex=y;let x=m.exec(s),k=l.exec(s),f=x?x.index:1/0,E=k?k.index:1/0;if(f<E)i++,y=f+x[0].length;else if(E<1/0){if(i--,i===0)return E;y=E+k[0].length}else break}return-1}function v(s,o,r){let c=0,i=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),y=new RegExp(`@${r}(?![a-z])`,"g"),m=/@else(?![a-z])/g,l=[],x;while((x=i.exec(s))!==null)l.push({pos:x.index,type:"open"});while((x=y.exec(s))!==null)l.push({pos:x.index,type:"close"});while((x=m.exec(s))!==null)l.push({pos:x.index,type:"else"});l.sort((k,f)=>k.pos-f.pos);for(let k of l)if(k.type==="open")c++;else if(k.type==="close")c--;else if(k.type==="else"&&c===0)return k.pos;return-1}{let s=!0;while(s){s=!1;let o=g.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,c,i,y=g.slice(r+5),m=q(y);if(m)c=m.value,i=r+5+m.consumed;else i=r+5;let l=t(g,"auth","endauth",i);if(l===-1){console.warn(`[stx] @auth directive at position ${r} has no matching @endauth \u2014 the block was skipped.`);break}let x=g.slice(i,l),k=v(x,"auth","endauth"),f;if(!e.auth)f=!1;else f=c?L(`auth?.check && auth?.user?.[${c}]`,e):L("auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=f?S:C}else E=f?x:"";g=g.substring(0,r)+E+g.substring(l+8),s=!0}}{let s=!0;while(s){s=!1;let o=g.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,c,i,y=g.slice(r+6),m=q(y);if(m)c=m.value,i=r+6+m.consumed;else i=r+6;let l=t(g,"guest","endguest",i);if(l===-1){console.warn(`[stx] @guest directive at position ${r} has no matching @endguest \u2014 the block was skipped.`);break}let x=g.slice(i,l),k=v(x,"guest","endguest"),f;if(!e.auth)f=!0;else f=c?L(`!auth?.check || !auth?.user?.[${c}]`,e):L("!auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=f?S:C}else E=f?x:"";g=g.substring(0,r)+E+g.substring(l+9),s=!0}}function a(s,o,r){if(e.userCan&&typeof e.userCan[s]==="boolean")return e.userCan[s];if(e.permissions?.check&&typeof e.permissions.check==="function")try{let c=[s];if(o)c.push(o);if(r){let i=L(r,e);c.push(i)}return e.permissions.check(...c)}catch{return!1}return!1}function b(s){let o=s.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!o)return null;return{ability:o[1],type:o[2],id:o[3]?.trim(),paramsEnd:o[0].length}}for(let s of["can","cannot"]){let o=`end${s}`,r=s==="can"?"elsecan":"elsecannot",c=!0;while(c){c=!1;let i=g.match(new RegExp(`@${s}\\s*\\(`));if(!i||i.index===void 0)break;let y=i.index,m=g.slice(y+`@${s}`.length),l=b(m);if(!l)break;let x=y+`@${s}`.length+l.paramsEnd,k=t(g,s,o,x);if(k===-1){console.warn(`[stx] @${s} directive at position ${y} has no matching @${o} \u2014 the block was skipped.`);break}let f=g.slice(x,k),E=[],S=0,C=new RegExp(`@${s}\\s*\\(`,"g"),P=new RegExp(`@${o}(?![a-z])`,"g"),R=new RegExp(`@${r}\\s*\\(`,"g"),T=/@else(?![a-z])/g,_=[],M;while((M=C.exec(f))!==null)_.push({pos:M.index,type:"open"});while((M=P.exec(f))!==null)_.push({pos:M.index,type:"close"});while((M=R.exec(f))!==null)_.push({pos:M.index,type:"elseDirective"});while((M=T.exec(f))!==null)_.push({pos:M.index,type:"else"});_.sort((A,z)=>A.pos-z.pos);for(let A of _){if(A.type==="open"){S++;continue}if(A.type==="close"){S--;continue}if(S===0)E.push(A)}let I=[],F=0;for(let A=0;A<E.length;A++){let z=E[A];if(I.push({content:f.slice(F,z.pos),ability:void 0}),z.type==="elseDirective"){let D=f.slice(z.pos+`@${r}`.length),B=b(D);if(B){I[I.length-1]={content:f.slice(F,z.pos)},F=z.pos+`@${r}`.length+B.paramsEnd,I.push({content:"",ability:B.ability,type:B.type,id:B.id}),I.pop();let G=E[A+1],U=G?G.pos:f.length;I.push({content:f.slice(F,U),ability:B.ability,type:B.type,id:B.id}),F=U}}else F=z.pos+5}if(F<f.length){let A=I[I.length-1];if(E.length>0&&E[E.length-1].type==="else")I.push({content:f.slice(F),isFinalElse:!0});else if(I.length===0)I.push({content:f.slice(F)})}let O=a(l.ability,l.type,l.id),j=s==="can"?O:!O,V="";if(j)V=I[0]?.content||"";else{let A=!1;for(let z=1;z<I.length;z++){let D=I[z];if(D.isFinalElse){V=D.content,A=!0;break}if(D.ability){let B=a(D.ability,D.type,D.id);if(s==="can"?B:!B){V=D.content,A=!0;break}}}if(!A&&I.length>0){let z=I[I.length-1];if(z.isFinalElse)V=z.content}}g=g.substring(0,y)+V+g.substring(k+`@${o}`.length),c=!0}}return g}function gi(w,e,g){let t=w;function v(a,b,s,o,r){let c=!0;while(c){c=!1;let i=new RegExp(`@${b}\\s*\\(`),y=a.match(i);if(!y||y.index===void 0)break;let m=y.index,l=pt(a,m+`@${b}`.length);if(!l)break;let x=l.endPos,k=Mt(a,b,s,x);if(k===-1){console.warn(`[stx] @${b} directive at position ${m} has no matching @${s} \u2014 the block was skipped.`);break}let f=a.slice(x,k),E=l.expression,S=-1,C=0,P=0;while(P<f.length){let R=f.indexOf("@",P);if(R===-1)break;let T=f.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(T)){C++,P=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(T)){C--,P=R+1;continue}if(C===0&&/^@else(?![a-z])/.test(T)){S=R;break}P=R+1}try{let R=o(E.trim()),T;if(S!==-1){let _=f.slice(0,S),M=f.slice(S+5);T=R?_:M}else T=R?f:"";a=a.substring(0,m)+T+a.substring(k+`@${s}`.length),c=!0}catch(R){let T=R instanceof Error?R.message:String(R),_=u(r,`Error processing @${b} directive: ${T}`,n.EVALUATION_ERROR);a=a.substring(0,m)+_+a.substring(k+`@${s}`.length);break}}return a}return t=v(t,"isset","endisset",(a)=>{let b=L(a,e);return b!==void 0&&b!==null},"Isset"),t=v(t,"empty","endempty",(a)=>{let b=L(a,e);return b===void 0||b===null||b===""||b===0||b===!1||Array.isArray(b)&&b.length===0||typeof b==="object"&&b!==null&&Object.keys(b).length===0},"Empty"),t}function mi(w,e,g){let t=w,v="development";function a(b,s,o,r){let c=new RegExp(`@${s}(?![a-z])`,"g"),i=new RegExp(`@${o}(?![a-z])`,"g"),y=new RegExp(`^@${s}(?![a-z])`),m=new RegExp(`^@${o}(?![a-z])`),l=b,x=!0;while(x){x=!1,c.lastIndex=0;let k=c.exec(l);if(!k)break;let f=k.index,E=f+k[0].length;if(s==="env"){let O=l.substring(E).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!O)break;E+=O[0].length,r=v===O[2]}let S=1,C=E,P=-1;while(S>0&&C<l.length){c.lastIndex=C,i.lastIndex=C;let O=c.exec(l),j=i.exec(l),V=O?O.index:1/0,A=j?j.index:1/0;if(V<A)S++,C=V+O[0].length;else if(A<1/0){if(S--,S===0){P=A;break}C=A+j[0].length}else break}if(P===-1){console.warn(`[stx] @${s} directive at position ${f} has no matching @${o} \u2014 the block was skipped.`);break}let R=l.substring(E,P),T=-1,_=0,M=0;while(M<R.length){let O=R.indexOf("@",M);if(O===-1)break;let j=R.substring(O);if(y.test(j)){_++,M=O+1;continue}if(m.test(j)){_--,M=O+1;continue}if(_===0&&/^@else(?![a-z])/.test(j)){T=O;break}M=O+1}let I;if(T!==-1){let O=R.slice(0,T),j=R.slice(T+5);I=r?O:j}else I=r?R:"";let F=`@${o}`.length;l=l.substring(0,f)+I+l.substring(P+F),x=!0}return l}return t=a(t,"env","endenv",!1),t=a(t,"production","endproduction",v==="production"),t=a(t,"development","enddevelopment",v==="development"),t=a(t,"staging","endstaging",v==="staging"),t=a(t,"testing","endtesting",v==="testing"),t}
|
|
3
|
+
export{ge,fi,gi,mi};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
function m(e,t={}){return{enterFrom:t.enterClass||`${e}-enter-from`,enterActive:t.enterActiveClass||`${e}-enter-active`,enterTo:t.enterToClass||`${e}-enter-to`,leaveFrom:t.leaveClass||`${e}-leave-from`,leaveActive:t.leaveActiveClass||`${e}-leave-active`,leaveTo:t.leaveToClass||`${e}-leave-to`}}function u(e){let t=getComputedStyle(e),o=t.transitionDuration||"0s",n=t.animationDuration||"0s",s=(a)=>{let i=a.match(/^([\d.]+)(s|ms)?$/);if(!i)return 0;let r=parseFloat(i[1]);return(i[2]||"s")==="ms"?r:r*1000};return Math.max(s(o),s(n))}function v(e,t){return new Promise((o)=>{let n=t??u(e);if(n===0){o();return}let s=!1,a=()=>{if(s)return;s=!0,e.removeEventListener("transitionend",i),e.removeEventListener("animationend",i),o()},i=(r)=>{if(r.target===e)a()};e.addEventListener("transitionend",i),e.addEventListener("animationend",i),setTimeout(a,n+50)})}function f(e){e.offsetHeight}async function
|
|
2
|
+
function m(e,t={}){return{enterFrom:t.enterClass||`${e}-enter-from`,enterActive:t.enterActiveClass||`${e}-enter-active`,enterTo:t.enterToClass||`${e}-enter-to`,leaveFrom:t.leaveClass||`${e}-leave-from`,leaveActive:t.leaveActiveClass||`${e}-leave-active`,leaveTo:t.leaveToClass||`${e}-leave-to`}}function u(e){let t=getComputedStyle(e),o=t.transitionDuration||"0s",n=t.animationDuration||"0s",s=(a)=>{let i=a.match(/^([\d.]+)(s|ms)?$/);if(!i)return 0;let r=parseFloat(i[1]);return(i[2]||"s")==="ms"?r:r*1000};return Math.max(s(o),s(n))}function v(e,t){return new Promise((o)=>{let n=t??u(e);if(n===0){o();return}let s=!1,a=()=>{if(s)return;s=!0,e.removeEventListener("transitionend",i),e.removeEventListener("animationend",i),o()},i=(r)=>{if(r.target===e)a()};e.addEventListener("transitionend",i),e.addEventListener("animationend",i),setTimeout(a,n+50)})}function f(e){e.offsetHeight}async function Oh(e,t={}){let o=t.name||"stx",n=m(o,t),s=typeof t.duration==="object"?t.duration.enter:t.duration;if(t.onBeforeEnter?.(e),e.classList.add(n.enterFrom),e.classList.add(n.enterActive),f(e),e.classList.remove(n.enterFrom),e.classList.add(n.enterTo),t.onEnter)await new Promise((a)=>{t.onEnter(e,a)});else await v(e,s);e.classList.remove(n.enterActive),e.classList.remove(n.enterTo),t.onAfterEnter?.(e)}async function Nh(e,t={}){let o=t.name||"stx",n=m(o,t),s=typeof t.duration==="object"?t.duration.leave:t.duration;if(t.onBeforeLeave?.(e),e.classList.add(n.leaveFrom),e.classList.add(n.leaveActive),f(e),e.classList.remove(n.leaveFrom),e.classList.add(n.leaveTo),t.onLeave)await new Promise((a)=>{t.onLeave(e,a)});else await v(e,s);e.classList.remove(n.leaveActive),e.classList.remove(n.leaveTo),t.onAfterLeave?.(e)}function Mh(e,t={},o){let n=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return e.replace(n,(s,a,i)=>{let r=p(a),l=r.name||"stx",c=r.duration||300,d=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
|
|
3
3
|
<div
|
|
4
4
|
class="stx-transition-wrapper"
|
|
5
5
|
data-transition="${l}"
|
|
@@ -41,7 +41,7 @@ function m(e,t={}){return{enterFrom:t.enterClass||`${e}-enter-from`,enterActive:
|
|
|
41
41
|
});
|
|
42
42
|
})();
|
|
43
43
|
</script>
|
|
44
|
-
`})}function p(e){let t={},o=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,n;while((n=o.exec(e))!==null){let s=n[1],a=n[2]||n[3]||n[4]||n[5];switch(s){case"name":t.name=a;break;case"duration":t.duration=parseInt(a,10);break;case"mode":t.mode=a;break;case"easing":t.easing=a;break}}return t}function
|
|
44
|
+
`})}function p(e){let t={},o=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,n;while((n=o.exec(e))!==null){let s=n[1],a=n[2]||n[3]||n[4]||n[5];switch(s){case"name":t.name=a;break;case"duration":t.duration=parseInt(a,10);break;case"mode":t.mode=a;break;case"easing":t.easing=a;break}}return t}function Dh(){return`
|
|
45
45
|
/* STX Transition Presets */
|
|
46
46
|
|
|
47
47
|
/* Fade */
|
|
@@ -228,7 +228,7 @@ function m(e,t={}){return{enterFrom:t.enterClass||`${e}-enter-from`,enterActive:
|
|
|
228
228
|
opacity: 1;
|
|
229
229
|
max-height: 1000px;
|
|
230
230
|
}
|
|
231
|
-
`}function
|
|
231
|
+
`}function Lh(){return`
|
|
232
232
|
// STX Transition Runtime
|
|
233
233
|
(function() {
|
|
234
234
|
if (typeof window === 'undefined') return;
|
|
@@ -317,5 +317,5 @@ else {
|
|
|
317
317
|
|
|
318
318
|
console.log('[stx] Transition runtime initialized');
|
|
319
319
|
})();
|
|
320
|
-
`}function
|
|
321
|
-
export{
|
|
320
|
+
`}function jh(e){let t=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return e.replace(t,(o,n,s,a)=>{let i=s||"300",r=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${n}" data-stx-transition-duration="${i}" data-stx-transition-condition="${a}" data-stx-transition-id="${r}"`})}
|
|
321
|
+
export{Oh,Nh,Mh,Dh,Lh,jh};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var g=0;function p(){return`async-${++g}-${Date.now().toString(36)}`}function
|
|
2
|
+
var g=0;function p(){return`async-${++g}-${Date.now().toString(36)}`}function sh(e,t={},c){let o=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,i=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,n=e;return n=n.replace(o,(r,s,a,d)=>{let l=p(),y=u(s);return m(l,y,a.trim(),d.trim())}),n=n.replace(i,(r,s,a)=>{let d=p(),l=u(s);return m(d,l,a.trim(),'<div class="stx-async-error">Failed to load component</div>')}),n}function u(e){let t={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},c=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,o;while((o=c.exec(e))!==null){let i=o[1],n=o[2]||o[3],r=o[4],s=o[5];switch(i){case"component":t.component=n||s||"";break;case"timeout":t.timeout=r?parseInt(r,10):30000;break;case"delay":t.delay=r?parseInt(r,10):200;break;case"suspensible":t.suspensible=s==="true";break;case"retries":t.retries=r?parseInt(r,10):0;break;case"loadingComponent":t.loadingComponent=n||s;break;case"errorComponent":t.errorComponent=n||s;break}}return t}function m(e,t,c,o){let{component:i,timeout:n,delay:r,suspensible:s,retries:a}=t;return`
|
|
3
3
|
<div class="stx-async-component" data-async-id="${e}" data-component="${i}" data-status="pending">
|
|
4
4
|
<div class="stx-async-loading" data-async-loading="${e}">
|
|
5
5
|
${c}
|
|
@@ -226,7 +226,7 @@ catch (error) {
|
|
|
226
226
|
loadComponent();
|
|
227
227
|
})();
|
|
228
228
|
</script>
|
|
229
|
-
`}function
|
|
229
|
+
`}function oh(e){return{__asyncComponent:!0,...typeof e==="function"?{loader:e}:e}}function ih(e){return typeof e==="object"&&e!==null&&"__asyncComponent"in e&&e.__asyncComponent===!0}function ah(){return`
|
|
230
230
|
/* STX Async Component Styles */
|
|
231
231
|
.stx-async-component {
|
|
232
232
|
position: relative;
|
|
@@ -300,7 +300,7 @@ catch (error) {
|
|
|
300
300
|
background-size: 200% 100%;
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
|
-
`}function
|
|
303
|
+
`}function ch(){return`
|
|
304
304
|
// STX Async Component Runtime
|
|
305
305
|
(function() {
|
|
306
306
|
if (typeof window === 'undefined') return;
|
|
@@ -355,4 +355,4 @@ catch (error) {
|
|
|
355
355
|
console.log('[stx] Async component runtime initialized');
|
|
356
356
|
})();
|
|
357
357
|
`}
|
|
358
|
-
export{
|
|
358
|
+
export{sh,oh,ih,ah,ch};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{
|
|
2
|
+
import{ul,s,Ce}from"./chunk-vb609vbj.js";import{mt}from"./chunk-xmy75h5v.js";import{l}from"./chunk-6x5a2w5a.js";import o from"fs";import u from"path";var _g=new Map,m=new Map;async function Sy(e){let n;for(let i=0;i<3;i++)try{let g=(await o.promises.stat(e)).mtime.getTime(),a=m.get(e);if(a&&a.mtime===g)return a.content;let h=await Bun.file(e).text(),w=(await o.promises.stat(e)).mtime.getTime();if(w!==g)continue;return m.set(e,{content:h,mtime:w}),h}catch(r){n=r;break}throw m.delete(e),Error(`File not found: ${e}${n?` (${n.message})`:""}`)}function ky(e){m.delete(e)}function _y(e){for(let t of m.keys())if(t.startsWith(e))m.delete(t)}var f=null,B=null,x=null;function Cy(e){x=e}async function Cg(e=!1){let t=x??await import("./chunk-j9gbnqxq.js");if(e)return t.generateSignalsRuntimeDev();if(f===null)f=t.generateSignalsRuntime();return f}var S=null;async function Eg(){if(S===null){let{getRouterScript:e}=await import("./chunk-g1v12bjm.js");S=e()}return S}var y={};async function Ey(e,t=!1){let n=e==="runtime"?await Cg(t):await Eg(),i=e==="runtime"&&t?"runtime-debug":e,r=y[i];if(!r||r.content!==n)r={content:n,hash:Bun.hash(n).toString(16).padStart(16,"0").slice(0,16)},y[i]=r;return{content:n,hash:r.hash,url:`/_stx/${e}.${r.hash}.js`}}var E=500,T=33554432,c=new Map,p=0;function C(e){return l(process.cwd(),"module-bundles",`${e}.js`)}function Ty(e){let t=Bun.hash(e).toString(16).padStart(16,"0").slice(0,16),n=c.get(t),i=n!==void 0;if(i)c.delete(t),p-=n.length*2;c.set(t,e),p+=e.length*2;while(c.size>1&&(c.size>E||p>T)){let r=c.keys().next().value;p-=c.get(r).length*2,c.delete(r)}if(!i)try{let r=C(t);if(!o.existsSync(r))o.mkdirSync(u.dirname(r),{recursive:!0}),o.writeFileSync(r,e)}catch{}return`/_stx/modules.${t}.js`}function xi(e){if(!/^[0-9a-f]{16}$/.test(e))return;let t=c.get(e);if(t!==void 0)return t;try{return o.readFileSync(C(e),"utf8")}catch{return}}function $y(){m.clear(),Ce(),ul(),f=null,B=null,S=null}function v(e){let t={debug:e.debug===!0,middleware:(e.middleware??[]).map((n)=>({name:n.name,timing:n.timing,handler:String(n.handler)})),customDirectives:(e.customDirectives??[]).map((n)=>({name:n.name,hasEndTag:n.hasEndTag===!0,rawParams:n.rawParams===!0,handler:String(n.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(t)).digest("hex")}async function Ar(e,t){try{if(!t.cachePath)return null;let n=u.resolve(t.cachePath),i=u.join(n,`${Fs(e)}.html`),r=u.join(n,`${Fs(e)}.meta.json`);if(!await s(i)||!await s(r))return null;let g=await Bun.file(r).text(),a=JSON.parse(g);if(a.cacheVersion!==t.cacheVersion)return null;if(a.engine!==mt())return null;if(a.optionsSignature!==v(t))return null;if((await o.promises.stat(e)).mtime.getTime()>a.mtime)return null;for(let d of a.dependencies)if(await s(d)){if((await o.promises.stat(d)).mtime.getTime()>a.mtime)return null}else return null;return await Bun.file(i).text()}catch(n){return console.warn(`Cache error for ${e}:`,n),null}}async function Pr(e,t,n,i){try{if(!i.cachePath)return;let r=u.resolve(i.cachePath);await o.promises.mkdir(r,{recursive:!0});let g=u.join(r,`${Fs(e)}.html`),a=u.join(r,`${Fs(e)}.meta.json`),h=await o.promises.stat(e);await Bun.write(g,t);let d={sourcePath:e,mtime:h.mtime.getTime(),dependencies:Array.from(n),cacheVersion:i.cacheVersion,engine:mt(),optionsSignature:v(i),generatedAt:Date.now()};await Bun.write(a,JSON.stringify(d,null,2)),_g.set(e,{output:t,mtime:h.mtime.getTime(),dependencies:n})}catch(r){console.warn(`Failed to cache template ${e}:`,r)}}var _=16;function Fs(e){return new Bun.CryptoHasher("sha1").update(e).digest("hex").substring(0,_)}
|
|
3
|
+
export{_g,Sy,ky,_y,Cy,Cg,Eg,Ey,Ty,xi,$y,Ar,Pr,Fs};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ri,Ai,Lt,ke,Or,Xs,Nr,Gs,Js,Rg,Ag,Pg,Mr,Ig,Og,Ng,Mg,sl,ol,il,Pi,al,Dg,jt,Bt,Ft,zt,Ht,Ut,gt,Lg}from"./chunk-5fdc8pej.js";export{Nr as Router,Ng as abortNavigation,Xs as bracketPathToRegex,jt as clearMiddleware,ol as createClientCookieManager,Ht as createMiddlewareContext,zt as createRouteLocation,sl as createServerCookieManager,il as createStorageManager,Mg as defineMiddleware,Ag as defineRoute,Pg as defineRoutes,Gs as findErrorPage,Js as formatRoutes,Ai as generateRouteManifest,Ri as generateRouteTypes,al as getMiddleware,Bt as getMiddlewareNames,gt as getRouterScript,Lg as getRouterScriptDev,Dg as hasMiddleware,Lt as isFileRequestPath,Ft as loadMiddlewareFromDirectory,Or as matchRoute,Og as navigateTo,ke as patternToRegex,Pi as registerMiddleware,Ig as resetRoutes,Mr as route,Ut as runMiddleware,Rg as setAppUrl};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{wy,vy,wg,Is}from"./chunk-d69k67bn.js";import"./chunk-xakqpa4z.js";import"./chunk-fjpt8arw.js";import"./chunk-p0xqm2ne.js";import{Ur}from"./chunk-vb609vbj.js";import"./chunk-qda8tmk9.js";import"./chunk-14df2jzs.js";import{Ee}from"./chunk-vf7tpgqz.js";import"./chunk-ayrd026n.js";import"./chunk-ex6dne7e.js";import"./chunk-jjq7c8s2.js";import"./chunk-858p3hkz.js";export{Ee as freeIdentifiers,Is as processComponents,wg as processESImports,Ur as rendersAsElement,wy as resetMarginStackWarnings,vy as resetTemplateLoopWarnings};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{yt,jg,Bg,Fg,zg,Hg,b,Ug,Wi,Vg,Cl,El}from"./chunk-vb609vbj.js";import"./chunk-qda8tmk9.js";import"./chunk-14df2jzs.js";import"./chunk-vf7tpgqz.js";import"./chunk-ayrd026n.js";import"./chunk-ex6dne7e.js";import"./chunk-jjq7c8s2.js";import"./chunk-858p3hkz.js";export{yt as STX_ENGINE_BINDING_NAMES,Wi as convertToCommonJS,Cl as extractScriptFromTemplate,b as extractVariables,El as hasVariables,Ug as isCompleteImport,Hg as isMissingBindingFailure,Fg as isModuleResolutionFailure,zg as isSyntaxFailure,Vg as splitDeclaration,jg as stripTypeScript,Bg as withoutStxReferrer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
function
|
|
2
|
+
function Wa(e){return e}class a{plugins=new Map;sortedPlugins=[];initialized=!1;async register(e,t){if(this.plugins.has(e.name))throw Error(`Plugin "${e.name}" is already registered`);if(e.dependencies){for(let r of e.dependencies)if(!this.plugins.has(r))throw Error(`Plugin "${e.name}" depends on "${r}" which is not registered`)}if(this.plugins.set(e.name,e),e.onRegister)await e.onRegister(t);this.sortPlugins()}async unregister(e){let t=this.plugins.get(e);if(!t)return!1;for(let[r,i]of this.plugins)if(i.dependencies?.includes(e))throw Error(`Cannot unregister "${e}" because "${r}" depends on it`);if(t.onUnregister)await t.onUnregister();return this.plugins.delete(e),this.sortPlugins(),!0}get(e){return this.plugins.get(e)}has(e){return this.plugins.has(e)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let e=[];for(let t of this.sortedPlugins)if(t.registerDirectives)e.push(...t.registerDirectives());return e}getAllFilters(){let e={};for(let t of this.sortedPlugins)if(t.registerFilters)Object.assign(e,t.registerFilters());return e}async runBeforeProcess(e){return this.runHooks("beforeProcess",e)}async runAfterParse(e){return this.runHooks("afterParse",e)}async runBeforeDirective(e,t){return this.runDirectiveHooks("beforeDirective",e,t)}async runAfterDirective(e,t){return this.runDirectiveHooks("afterDirective",e,t)}async runBeforeRender(e){return this.runHooks("beforeRender",e)}async runAfterRender(e){return this.runHooks("afterRender",e)}async runOnError(e){for(let t of this.sortedPlugins)if(t.onError)try{let r=await t.onError(e);if(r){if(r.template!==void 0)e.template=r.template;if(r.context)e.context={...e.context,...r.context};if(r.metadata)e.metadata={...e.metadata,...r.metadata};if(r.skip)return e}}catch(r){console.error(`Error in plugin "${t.name}" onError hook:`,r)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort((e,t)=>(e.priority??100)-(t.priority??100))}async runHooks(e,t){let r={...t};for(let i of this.sortedPlugins){let s=i[e];if(s)try{let n=await s(r);if(n){if(n.template!==void 0)r.template=n.template;if(n.context)r.context={...r.context,...n.context};if(n.metadata)r.metadata={...r.metadata,...n.metadata};if(n.skip)break}}catch(n){console.error(`Error in plugin "${i.name}" ${e} hook:`,n)}}return r}async runDirectiveHooks(e,t,r){let i={...r};for(let s of this.sortedPlugins){let n=s[e];if(n)try{let o=await n(t,i);if(o){if(o.template!==void 0)i.template=o.template;if(o.context)i.context={...i.context,...o.context};if(o.metadata)i.metadata={...i.metadata,...o.metadata};if(o.skip)break}}catch(o){console.error(`Error in plugin "${s.name}" ${e} hook:`,o)}}return i}}var eh=new a;var u=Wa({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess(e){console.log("[stx-debug] beforeProcess:",e.filePath)},afterParse(e){console.log("[stx-debug] afterParse:",e.template.length,"chars")},beforeDirective(e,t){console.log("[stx-debug] beforeDirective:",e)},afterDirective(e,t){console.log("[stx-debug] afterDirective:",e)},beforeRender(e){console.log("[stx-debug] beforeRender")},afterRender(e){console.log("[stx-debug] afterRender:",e.template.length,"chars")},onError(e){console.error("[stx-debug] onError:",e.error.message,"in phase:",e.phase)}}),l=Wa({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess(e){e.metadata.startTime=performance.now()},afterRender(e){let t=e.metadata.startTime;if(t){let r=performance.now()-t;console.log(`[stx-timing] Processing took ${r.toFixed(2)}ms`)}}});export{Wa,eh};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
function I(){let{NODE_ENV:n}=process.env;return n==="production"}function re(){let{STX_DEBUG:n}=process.env;return!I()||n==="true"}function Vn(){let{NODE_ENV:n}=process.env;return n==="test"}function ia(n,t){return t??(n==="compile"||I())}function st(n){if(!n)return n;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(n).trim()}catch{return n}}
|
|
3
|
+
export{I,re,Vn,ia,st};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{pa,fa,ga,ym,bm,wm,au,vm,xm}from"./chunk-9gr7m3tb.js";export{pa as ImageProcessorCache,au as applyTransformations,ym as clearImageCache,vm as generateResponsiveVariants,xm as generateSrcset,fa as getCachedImageResult,wm as optimizeImage,bm as processImage,ga as setCachedImageResult};
|