@stacksjs/stx 0.2.876 → 0.2.880
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/{chunk-fdjx4vs3.js → chunk-00tq7ghn.js} +2 -2
- package/dist/{chunk-nv4c25zj.js → chunk-02qmvcmv.js} +3 -3
- package/dist/chunk-08cb7cyw.js +2 -0
- package/dist/chunk-0h1dyd38.js +2 -0
- package/dist/{chunk-2mt2zc5y.js → chunk-0m4c42qt.js} +10 -10
- package/dist/{chunk-x4jzhgdm.js → chunk-19k15mfc.js} +2 -2
- package/dist/chunk-1avy0p8v.js +2 -0
- package/dist/chunk-1jk46ve0.js +2 -0
- package/dist/chunk-1r612xxs.js +2 -0
- package/dist/chunk-1z6rrqvm.js +2 -0
- package/dist/chunk-2d68p12e.js +2 -0
- package/dist/chunk-2haf7t5h.js +2 -0
- package/dist/{chunk-1q5w3xav.js → chunk-2r0nrvqe.js} +2 -2
- package/dist/chunk-3jp5z1qj.js +2 -0
- package/dist/{chunk-dv56x3g8.js → chunk-3q0w0bzd.js} +10 -10
- package/dist/{chunk-eknm4jrm.js → chunk-3sema2js.js} +2 -2
- package/dist/{chunk-cj44e8mw.js → chunk-3wb82rxw.js} +5 -5
- package/dist/chunk-3zds0gmd.js +2 -0
- package/dist/{chunk-qnwd5bz4.js → chunk-463weehv.js} +1 -1
- package/dist/{chunk-wm029dh0.js → chunk-4fkcn6z5.js} +18 -12
- package/dist/{chunk-976kgb3r.js → chunk-4n45qa0b.js} +9 -9
- package/dist/chunk-4pjqj54a.js +2 -0
- package/dist/{chunk-j0rqa9bk.js → chunk-4r2rfdmr.js} +5 -5
- package/dist/{chunk-ft6em3wm.js → chunk-50cnypys.js} +6 -6
- package/dist/chunk-53cc06w7.js +2 -0
- package/dist/{chunk-y2e2zm6y.js → chunk-57q4nvs9.js} +3 -3
- package/dist/{chunk-3mz9bdf7.js → chunk-59er0fc7.js} +3 -3
- package/dist/{chunk-6kp4mg3h.js → chunk-5eftxrvv.js} +2 -2
- package/dist/chunk-5p3825qw.js +2 -0
- package/dist/chunk-5rd0an89.js +2 -0
- package/dist/{chunk-pk714ynv.js → chunk-69ezjc8k.js} +4 -4
- package/dist/{chunk-75v0yxeh.js → chunk-6c1vm6bs.js} +2 -2
- package/dist/{chunk-d3q0cg47.js → chunk-6df3j3qq.js} +3 -3
- package/dist/{chunk-kzc2tqzr.js → chunk-6t04tqvh.js} +2 -2
- package/dist/chunk-78zgmqhd.js +2 -0
- package/dist/chunk-7bsrnpmh.js +33 -0
- package/dist/chunk-7dq6ebvp.js +2 -0
- package/dist/chunk-7kqgp3p7.js +2 -0
- package/dist/{chunk-wzvdr4ta.js → chunk-7mcs59pr.js} +2 -2
- package/dist/chunk-83b9k17j.js +2 -0
- package/dist/chunk-86nsbxep.js +61 -0
- package/dist/{chunk-0g2mg8cw.js → chunk-8e1cv1hh.js} +3 -3
- package/dist/chunk-8h5nje66.js +2 -0
- package/dist/{chunk-ae8q4gze.js → chunk-8va3fs07.js} +5 -5
- package/dist/{chunk-fh72k2ks.js → chunk-93jhfbeg.js} +6 -6
- package/dist/{chunk-xmws1gaf.js → chunk-94ctmp0j.js} +2 -2
- package/dist/chunk-97kgrevs.js +4 -0
- package/dist/{chunk-nn6hvsxp.js → chunk-9cbf0seq.js} +2 -2
- package/dist/{chunk-mce3g2wb.js → chunk-9f31gs4m.js} +2 -2
- package/dist/chunk-9kza7gxd.js +2 -0
- package/dist/{chunk-b4d4tjvx.js → chunk-a0q0kb0s.js} +5 -5
- package/dist/chunk-a5gnxdfe.js +2 -0
- package/dist/chunk-a60ztvnp.js +3 -0
- package/dist/{chunk-s7fhpkvf.js → chunk-a7ryj8z8.js} +6 -6
- package/dist/{chunk-gqtb53s8.js → chunk-aaea157p.js} +2 -2
- package/dist/{chunk-wp0qpa50.js → chunk-agd2b928.js} +59 -27
- package/dist/chunk-aqxh80vh.js +2 -0
- package/dist/{chunk-2tcyfrvb.js → chunk-awp8a3t4.js} +2 -2
- package/dist/chunk-axra1yas.js +2 -0
- package/dist/chunk-az8b0726.js +21 -0
- package/dist/chunk-b7d3n4aw.js +2 -0
- package/dist/{chunk-r2bxjna3.js → chunk-c0g30cjs.js} +2 -2
- package/dist/{chunk-jt5tzddc.js → chunk-c73c0wf9.js} +2 -2
- package/dist/{chunk-3922g6sh.js → chunk-cad7e5q1.js} +9 -9
- package/dist/{chunk-bjjfr7qt.js → chunk-care745q.js} +2 -2
- package/dist/chunk-ce0zbpr5.js +2 -0
- package/dist/chunk-cjv89tnb.js +20 -0
- package/dist/chunk-cv1vm1w0.js +2 -0
- package/dist/{chunk-mw0rb1sf.js → chunk-czcx3nbx.js} +6 -6
- package/dist/chunk-d7b30bg6.js +2 -0
- package/dist/{chunk-stn7p7f1.js → chunk-dwyhpbpx.js} +2 -2
- package/dist/{chunk-y75bds1g.js → chunk-e362e615.js} +30 -30
- package/dist/{chunk-ydppkb8y.js → chunk-e41pgmgk.js} +2 -2
- package/dist/{chunk-ctjxcaxq.js → chunk-ec5q4nnw.js} +66 -66
- package/dist/{chunk-k0t9ye9j.js → chunk-egjmb32c.js} +126 -71
- package/dist/{chunk-g15reb1h.js → chunk-ew3vs3jq.js} +8 -8
- package/dist/{chunk-jqxerj6k.js → chunk-ezna4dhj.js} +2 -2
- package/dist/chunk-f3j1h3ch.js +2 -0
- package/dist/{chunk-mkwavsb3.js → chunk-f7znj9xg.js} +3 -3
- package/dist/chunk-fz4c5e9m.js +2 -0
- package/dist/{chunk-esjr9qhe.js → chunk-g2xy0z0e.js} +2 -2
- package/dist/{chunk-fwbccyhw.js → chunk-g83ph305.js} +2 -2
- package/dist/{chunk-kywe0f1v.js → chunk-gbncp2gp.js} +2 -2
- package/dist/chunk-gm67jt8p.js +2 -0
- package/dist/chunk-gmp10259.js +2 -0
- package/dist/{chunk-0sa9gqmc.js → chunk-h2tq6cbr.js} +11 -11
- package/dist/chunk-h3fv0q25.js +2 -0
- package/dist/{chunk-r09kz9bf.js → chunk-h63ma36g.js} +2 -2
- package/dist/chunk-hkx51atf.js +2 -0
- package/dist/{chunk-w8k9fz1w.js → chunk-hmntqqyd.js} +7 -7
- package/dist/{chunk-3w7gacva.js → chunk-hxhmhw23.js} +3 -3
- package/dist/chunk-jghpzx5m.js +2 -0
- package/dist/chunk-k206d3pn.js +2 -0
- package/dist/chunk-k40e0ete.js +4 -0
- package/dist/chunk-k6c5t9we.js +38 -0
- package/dist/{chunk-f4vgagjb.js → chunk-kee5a3ce.js} +3 -3
- package/dist/chunk-kn9tqjgv.js +25 -0
- package/dist/chunk-kna1bdm2.js +54 -0
- package/dist/{chunk-ttjscvre.js → chunk-mygsektn.js} +3 -3
- package/dist/chunk-nb6erf75.js +9 -0
- package/dist/chunk-ngzyzcrp.js +2 -0
- package/dist/{chunk-h17pfbng.js → chunk-nysbdr4r.js} +2 -2
- package/dist/chunk-p55a910x.js +1198 -0
- package/dist/chunk-p6hcrg3r.js +3 -0
- package/dist/chunk-p746twww.js +2 -0
- package/dist/chunk-pa2vt2ej.js +2 -0
- package/dist/chunk-pa6kgbmw.js +2 -0
- package/dist/{chunk-saqzk45g.js → chunk-pdprhg5k.js} +1 -1
- package/dist/chunk-pjjrx9pk.js +2 -0
- package/dist/{chunk-7rep2jqh.js → chunk-pm4rpc4a.js} +23 -23
- package/dist/chunk-pt3rp3zg.js +2 -0
- package/dist/{chunk-4517hny7.js → chunk-q1mb0fbt.js} +2 -2
- package/dist/{chunk-k1ew643q.js → chunk-q74affc4.js} +2 -2
- package/dist/chunk-qd9v1v8z.js +2 -0
- package/dist/chunk-qfwk93fk.js +2 -0
- package/dist/chunk-qg1kw5yf.js +2 -0
- package/dist/chunk-qn6y5ttj.js +2 -0
- package/dist/chunk-qxcc0aar.js +2 -0
- package/dist/{chunk-rzd9hyhv.js → chunk-ram5944w.js} +2 -2
- package/dist/{chunk-p5m1z6e1.js → chunk-rcxer2km.js} +4 -4
- package/dist/chunk-rdxph1tp.js +2 -0
- package/dist/chunk-rnrdngnn.js +2 -0
- package/dist/{chunk-x2ftkaz3.js → chunk-rsxxajv6.js} +2 -2
- package/dist/chunk-rw5sxr5a.js +2 -0
- package/dist/chunk-rzcdwybt.js +26 -0
- package/dist/chunk-s29hp1qw.js +14 -0
- package/dist/chunk-s7xywsqd.js +3 -0
- package/dist/{chunk-d6gqh2wv.js → chunk-satrf398.js} +1 -1
- package/dist/{chunk-zn6n075d.js → chunk-shcnt6aa.js} +3 -3
- package/dist/{chunk-ysfgabpf.js → chunk-sn4ndpd7.js} +3 -3
- package/dist/{chunk-zc8a2erc.js → chunk-ssg6ne5b.js} +4 -4
- package/dist/{chunk-afxfkb60.js → chunk-sv7fdqmc.js} +6 -6
- package/dist/chunk-swz0xprw.js +2 -0
- package/dist/chunk-t8r40wgf.js +2 -0
- package/dist/{chunk-dbvsa5ya.js → chunk-t94y8g35.js} +2 -2
- package/dist/{chunk-df6vjs3p.js → chunk-t9hxyvvc.js} +5 -5
- package/dist/{chunk-cvbwxskc.js → chunk-tgzs1kbj.js} +5 -5
- package/dist/chunk-tka73egx.js +2 -0
- package/dist/{chunk-xtaq95em.js → chunk-v1s838fe.js} +1 -1
- package/dist/chunk-v3747589.js +12 -0
- package/dist/chunk-v9h2bbhf.js +2 -0
- package/dist/chunk-v9mxhch2.js +2 -0
- package/dist/chunk-vm42j29z.js +2 -0
- package/dist/chunk-w2kdhm7k.js +2 -0
- package/dist/chunk-w5zzwe2f.js +2 -0
- package/dist/chunk-wbmx0rge.js +2 -0
- package/dist/chunk-wjafpvjv.js +2 -0
- package/dist/chunk-ws2h92mm.js +3 -0
- package/dist/chunk-ws9kr80x.js +2 -0
- package/dist/{chunk-zgds9nwv.js → chunk-xf0xacc9.js} +44 -44
- package/dist/chunk-xhr35ctb.js +2 -0
- package/dist/chunk-xmmr0916.js +2 -0
- package/dist/{chunk-yxdhz4ps.js → chunk-xpbakn6t.js} +2 -2
- package/dist/chunk-xz4v9tg1.js +3 -0
- package/dist/chunk-y7e61pz3.js +3 -0
- package/dist/{chunk-v0tdg16k.js → chunk-ybjgnnyf.js} +5 -5
- package/dist/chunk-yh2hnt3m.js +12 -0
- package/dist/{chunk-w6pzkcjp.js → chunk-ymqm898x.js} +2 -2
- package/dist/{chunk-2zaatnnh.js → chunk-yp4tn4zn.js} +4 -4
- package/dist/chunk-z7k1xn6k.js +2 -0
- package/dist/{chunk-vnkvnenn.js → chunk-z9ffr9gy.js} +7 -7
- package/dist/{chunk-nnp6rf4c.js → chunk-zch65qrd.js} +1 -1
- package/dist/{chunk-pbakxcv8.js → chunk-zek9t5za.js} +2 -2
- package/dist/cli.js +23 -23
- package/dist/client/signals-dom-ready-runtime.js +6 -0
- package/dist/client/signals-mount-runtime.js +1 -1
- package/dist/client-module-registry.js +10 -4
- package/dist/client-parameter-bindings.d.ts +5 -0
- package/dist/client-parameter-bindings.js +47 -6
- package/dist/client-script-bundler.js +4 -3
- package/dist/component-library.d.ts +1 -0
- package/dist/component-library.js +42 -14
- package/dist/composable-loader.js +19 -9
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/html-masking.d.ts +2 -0
- package/dist/html-masking.js +10 -0
- package/dist/inherited-context.d.ts +1 -1
- package/dist/inherited-context.js +43 -14
- package/dist/module-syntax.d.ts +2 -0
- package/dist/module-syntax.js +21 -0
- package/dist/native-component-context.js +42 -16
- package/dist/page-module-order.d.ts +10 -0
- package/dist/page-module-order.js +139 -0
- package/dist/process.js +6 -4
- package/dist/pwa.js +3 -3
- package/dist/script-attributes.d.ts +4 -0
- package/dist/script-attributes.js +10 -0
- package/dist/ssg.js +39 -39
- package/dist/strip-literals.d.ts +2 -0
- package/dist/strip-literals.js +12 -6
- package/dist/stx-virtual-ts.d.ts +1 -0
- package/dist/stx-virtual-ts.js +21 -27
- package/dist/typecheck.js +8 -0
- package/package.json +5 -5
- package/dist/chunk-027meh1k.js +0 -2
- package/dist/chunk-0hs633pt.js +0 -2
- package/dist/chunk-0j8zre1m.js +0 -2
- package/dist/chunk-0v02qms8.js +0 -2
- package/dist/chunk-0z9gttw0.js +0 -2
- package/dist/chunk-11dwmcpy.js +0 -3
- package/dist/chunk-1a237qky.js +0 -33
- package/dist/chunk-1ehjzhnc.js +0 -25
- package/dist/chunk-1gfg6qmr.js +0 -2
- package/dist/chunk-1kgnk6ds.js +0 -2
- package/dist/chunk-1ztp5vkh.js +0 -3
- package/dist/chunk-32wvc376.js +0 -2
- package/dist/chunk-3k2d2jsn.js +0 -2
- package/dist/chunk-3te2y9qf.js +0 -2
- package/dist/chunk-40330tm5.js +0 -2
- package/dist/chunk-447jc6zc.js +0 -2
- package/dist/chunk-4dk6k0ad.js +0 -2
- package/dist/chunk-4e48zkq0.js +0 -2
- package/dist/chunk-5ep7p8te.js +0 -2
- package/dist/chunk-5gx403te.js +0 -1184
- package/dist/chunk-6q9a5bph.js +0 -2
- package/dist/chunk-7ds9mx4c.js +0 -2
- package/dist/chunk-7njy024g.js +0 -2
- package/dist/chunk-7tjewwmd.js +0 -2
- package/dist/chunk-85xabvtj.js +0 -2
- package/dist/chunk-880f8j99.js +0 -2
- package/dist/chunk-8f3dbthj.js +0 -2
- package/dist/chunk-99e3mxnn.js +0 -20
- package/dist/chunk-9gv847nn.js +0 -2
- package/dist/chunk-9mz2n39m.js +0 -2
- package/dist/chunk-akthsg33.js +0 -54
- package/dist/chunk-b1tcym2x.js +0 -2
- package/dist/chunk-bdh73gxd.js +0 -4
- package/dist/chunk-bspj1rf1.js +0 -2
- package/dist/chunk-bx3hpsxn.js +0 -2
- package/dist/chunk-byq488g4.js +0 -2
- package/dist/chunk-c4s25bm2.js +0 -2
- package/dist/chunk-csjqtzwc.js +0 -2
- package/dist/chunk-df78j74w.js +0 -4
- package/dist/chunk-dgs3d367.js +0 -2
- package/dist/chunk-dmf6zcf4.js +0 -2
- package/dist/chunk-e2b2f502.js +0 -2
- package/dist/chunk-ec6mrad6.js +0 -2
- package/dist/chunk-eecctzgp.js +0 -17
- package/dist/chunk-fa57bncd.js +0 -2
- package/dist/chunk-g4eheg0t.js +0 -24
- package/dist/chunk-gfe1jrw9.js +0 -2
- package/dist/chunk-gn16yq49.js +0 -2
- package/dist/chunk-gvs61tqn.js +0 -2
- package/dist/chunk-h2928108.js +0 -2
- package/dist/chunk-hat353vx.js +0 -2
- package/dist/chunk-jmjgj3nh.js +0 -2
- package/dist/chunk-jqtpzzz4.js +0 -12
- package/dist/chunk-jvy7z3hz.js +0 -3
- package/dist/chunk-k9dne5by.js +0 -12
- package/dist/chunk-kq8mffgf.js +0 -2
- package/dist/chunk-kx06jzdw.js +0 -2
- package/dist/chunk-n5pvdrkb.js +0 -2
- package/dist/chunk-ne8q191s.js +0 -2
- package/dist/chunk-np8wgbsa.js +0 -3
- package/dist/chunk-nthw4dca.js +0 -2
- package/dist/chunk-pp99rmjm.js +0 -72
- package/dist/chunk-pqmjeea6.js +0 -2
- package/dist/chunk-qggwr60r.js +0 -2
- package/dist/chunk-qm3v4qb7.js +0 -2
- package/dist/chunk-qty0t69x.js +0 -2
- package/dist/chunk-rjv6885r.js +0 -2
- package/dist/chunk-rm5gbthk.js +0 -2
- package/dist/chunk-sgengtap.js +0 -2
- package/dist/chunk-snz2cxqv.js +0 -2
- package/dist/chunk-szp7ajfm.js +0 -33
- package/dist/chunk-ts37jw3s.js +0 -2
- package/dist/chunk-v4emesnw.js +0 -2
- package/dist/chunk-vnrbjbrw.js +0 -3
- package/dist/chunk-vxra53wq.js +0 -2
- package/dist/chunk-x76qvq1n.js +0 -2
- package/dist/chunk-x85z6dmw.js +0 -2
- package/dist/chunk-xkfe03y9.js +0 -2
- package/dist/chunk-y4hn1qh0.js +0 -2
- package/dist/chunk-yc8ggeh2.js +0 -2
- package/dist/chunk-yfed67yc.js +0 -2
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Al,Pl}from"./chunk-fdjx4vs3.js";import{m,O,ut,p}from"./chunk-pp99rmjm.js";import{G,Cr,zs,Hs,yi,wi,Vs,Lt,ze,we,ee,$r,Rr,fe,te,j,lt,Ar,ki,Or,qe,s,g,X,Tn}from"./chunk-5gx403te.js";import{r}from"./chunk-11dwmcpy.js";import{de}from"./chunk-dbvsa5ya.js";import{fr}from"./chunk-wzvdr4ta.js";import{n}from"./chunk-jqtpzzz4.js";import{b}from"./chunk-94mpe1ny.js";import{createHash as kt}from"crypto";import Y from"fs";import K from"path";import Me from"fs";function Ae(e,i,t){let o=Buffer.alloc(t),a=Me.readSync(e,o,0,t,i);return o.subarray(0,a)}function Le(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 t=i(12,16);if(t==="VP8X")return(e[20]&16)!==0;if(t==="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=Me.openSync(e,"r");let t=Ae(i,0,33);if(t.length>=3&&t[0]===255&&t[1]===216&&t[2]===255)return"none";if(t.length>=26&&t[0]===137&&t.toString("latin1",1,4)==="PNG"){let o=t[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(t.length>=25&&t.toString("latin1",0,4)==="RIFF"&&t.toString("latin1",8,12)==="WEBP"){if(Le(t))return"possible";let o=t.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(i!==void 0)Me.closeSync(i)}}import rn from"fs";import Fe from"os";import{fileURLToPath as yt}from"url";var _e=Symbol("stx.image-worker.unavailable");function sn(e=typeof Fe.availableParallelism==="function"?Fe.availableParallelism():Fe.cpus().length){return Math.max(1,Math.min(2,e-1))}var Pe=0,xt=[];async function on(){if(Pe<sn()){Pe++;return}await new Promise((e)=>xt.push(e)),Pe++}function an(){Pe--,xt.shift()?.()}var cn="@stacksjs/stx/builtins/image-warmup-worker";function ln(e=process.cwd()){let i=import.meta.url.endsWith(".ts")?"ts":"js";try{let t=new URL(`./image-warmup-worker.${i}`,import.meta.url);if(t.protocol==="file:"&&rn.existsSync(yt(t)))return yt(t)}catch{}return fr(cn,e)}var bt=!1;function ue(e){if(!bt)bt=!0,console.warn(`[stx] image worker unavailable (${e}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return _e}function Ie(e){return e instanceof Error?e.message:String(e)}async function We(e,i){let t;try{t=(await import("worker_threads")).Worker}catch(a){return ue(`could not load node:worker_threads: ${Ie(a)}`)}if(typeof t!=="function")return ue("node:worker_threads has no Worker in this runtime");let o=ln();if(!o)return ue("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await on();try{return await new Promise((a,c)=>{let l;try{l=new t(o)}catch(h){a(ue(`could not start ${o}: ${Ie(h)}`));return}let u=!1,f=!1,x=(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"){x(()=>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;x(()=>c(d))}),l.on("error",(h)=>{x(()=>u?c(h instanceof Error?h:Error(Ie(h)||"image worker crashed")):a(ue(`the worker failed before it was ready: ${Ie(h)}`)))}),l.on("exit",(h)=>{x(()=>u?c(Error("image worker exited before it finished")):a(ue(`the worker exited with code ${h} before it was ready`)))})})}finally{an()}}var un=new Set([".avif",".jpeg",".jpg",".png",".webp"]),fn=[320,640,960,1280,1920],xe="/_stx/images",dn=`stx:${xe}:alpha-1`,gn=`stx:${xe}:opaque-1`,pn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Ee;function mn(e,i){let t=K.dirname(Bun.resolveSync(e,i));while(t!==K.dirname(t)){let o=K.join(t,"package.json");if(Y.existsSync(o)){let a=JSON.parse(Y.readFileSync(o,"utf8"));if(a.name===e)return a.version}t=K.dirname(t)}return}function vt(){if(Ee!==void 0)return Ee;let e;try{e=K.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Ee=pn.map((i)=>{let t;try{t=e?mn(i,e):void 0}catch{}return`${i.replace("@stacksjs/","")}@${t??"unknown"}`}).join("+"),Ee}var wt=Symbol.for("stx.image-delivery");function ve(){let e=globalThis;return e[wt]??={catalog:new Map,transparent:new Set},e[wt]}var $t=new Set;function hn(e){return`/${e.split(K.sep).map(encodeURIComponent).join("/")}`}function yn(e){let i=K.extname(e),t=e.slice(0,-i.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=kt("sha256").update(e).digest("hex").slice(0,8);return`${t||"image"}-${o}`}function St(e,i=`stx:${xe}`){let t=(o)=>`${xe}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:i,async stat(o){let a=K.join(e,o);try{let c=await Y.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:t(o)}:null}catch{return null}},async write(o,a){let c=K.join(e,o);await Y.promises.mkdir(K.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await Y.promises.writeFile(l,a),await Y.promises.rename(l,c),{bytes:a.byteLength,path:c,url:t(o)}},url:t}}async function At(e,i=e){let t=await Y.promises.readdir(i,{withFileTypes:!0});t.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of t){let c=K.join(i,a.name);if(a.isDirectory()){o.push(...await At(e,c));continue}if(!a.isFile()||!un.has(K.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:K.relative(e,c)})}return o}function Ct(e,i){return e.map((t)=>({key:hn(t.relativePath),input:t.absolutePath,name:yn(t.relativePath),...bn(t.absolutePath)?{options:{storage:i}}:{}}))}function bn(e){return Ue(e)==="possible"}function xn(e){for(let i=3;i<e.length;i+=4)if(e[i]!==255)return!0;return!1}async function vn(e){let i=Object.entries(e).filter(([,c])=>c.fallback.format==="png"),t=new Set,o=8;if(i.length===0)return t;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((x)=>x.format==="png").sort((x,h)=>x.width-h.width)[0];try{let x=await a(new Uint8Array(await Y.promises.readFile(f?.path??u.fallback.path)));if(xn(x.data))t.add(l)}catch{t.add(l)}}));return t}function wn(e,i){let t=[];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=Y.openSync(u.path,"r"),!Le(Ae(f,0,32))}catch{return!0}finally{if(f!==void 0)Y.closeSync(f)}}))continue;if(a.variants=a.variants.filter((u)=>u.format!=="webp"),delete a.sources.webp,t.push(o),!$t.has(o))$t.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 t}async function $n(e){let i=[],t=8;if(e.length===0)return i;let{generateThumbHash:o}=await import("ts-images");for(let a=0;a<e.length;a+=8){let c=e.slice(a,a+8),l=await Promise.all(c.map(async(u)=>{try{return await o(u.absolutePath),u}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${u.relativePath}`),null}}));i.push(...l.filter((u)=>u!==null))}return i}function He(e){return K.join(e,"undecodable.json")}function Sn(e){try{let i=Y.readFileSync(He(e),"utf-8"),t=JSON.parse(i);return t&&typeof t==="object"?t:{}}catch{return{}}}function Cn(e,i){try{Y.mkdirSync(K.dirname(He(e)),{recursive:!0}),Y.writeFileSync(He(e),JSON.stringify(i))}catch{}}function Rt(e){try{let i=Y.statSync(e);return{mtimeMs:i.mtimeMs,size:i.size}}catch{return}}function It(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 Go(e){let i=It(e);return i?ve().catalog.get(i):void 0}function Xo(e){let i=It(e);return i?ve().transparent.has(i):!1}function Jo(e){let i=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),t=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<t).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function Yh(e){let i=Go(e);if(!i)return;return{src:i.fallback.url,srcset:i.sources[i.fallback.format]||"",sources:Jo(i).map(({format:t,srcset:o})=>({type:`image/${t}`,srcset:o})),width:i.source.width,height:i.source.height,placeholder:Xo(e)?void 0:i.placeholder?.dataUrl}}function bs(){let e=ve();e.catalog=new Map,e.transparent=new Set}function Rn(e){let i=ve();i.catalog=new Map(e.entries),i.transparent=new Set(e.transparent)}async function Zh(e,i,t={}){if(!e||!Y.existsSync(e))return bs(),{count:0,fingerprint:""};if(t.offThread){let y=await We("delivery",{publicDir:e,outputDir:i});if(y!==_e)return Rn(y.state),y.result}let o=await At(e);if(o.length===0)return bs(),{count:0,fingerprint:""};let a=Sn(i),c=o.filter((y)=>{let w=a[y.relativePath];if(!w)return!0;let A=Rt(y.absolutePath);return!A||A.mtimeMs!==w.mtimeMs||A.size!==w.size});if(c.length===0)return bs(),{count:0,fingerprint:""};let l=St(K.join(i,"_stx","images"),`${dn}:${vt()}`),u={outDir:K.join(i,"_stx","images"),storage:St(K.join(i,"_stx","images"),`${gn}:${vt()}`),baseUrl:xe,widths:fn,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},{createImageDeliveryCatalog:f}=await import("ts-images/delivery"),x=c,h;try{h=await f({...u,entries:Ct(c,l)})}catch(y){if(x=await $n(c),x.length===c.length)throw y;let w=new Set(x.map((k)=>k.relativePath)),A=!1;for(let k of c){if(w.has(k.relativePath))continue;let R=Rt(k.absolutePath);if(!R)continue;a[k.relativePath]=R,A=!0}if(A)Cn(i,a);if(x.length===0)return bs(),{count:0,fingerprint:""};h=await f({...u,entries:Ct(x,l)})}let d=await vn(h.entries),C=wn(h.entries,d),v=ve();v.catalog=new Map(Object.entries(h.entries)),v.transparent=d;let S=d.size===0&&C.length===0?h.fingerprint:kt("sha256").update(h.fingerprint).update(JSON.stringify({transparent:[...d].sort(),droppedWebp:C.sort()})).digest("hex");return{count:x.length,fingerprint:S}}class Pt{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,t,o){let a=yi(e,o);if(a!==void 0)return a;for(let c of wi(e,i,t,o))if(await s(c))return c;return null}}var ge=new Pt;var se="\x00stx-boolean-attribute";function Xe(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var kn=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function Ve(e){let i=e.toLowerCase();return i.startsWith("aria-")||i.startsWith("data-")||kn.has(i)}function ie(e,i){let t=[];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)t.push(g(c));continue}if(a===se){t.push(g(c));continue}t.push(`${g(c)}="${Tn(c,Xe(String(a)))}"`)}return t}function oe(e,i){let t=[];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){t.push(g(c));continue}if(typeof a==="object")continue;t.push(`${g(c)}="${Tn(c,Xe(String(a)))}"`)}return t}function An(e){if(e.clientReactive.to)return{value:e.clientReactive.to,reactive:!0};if(e.serverDynamic.to!==void 0)return{value:String(e.serverDynamic.to),reactive:!1};if(typeof e.static.to==="string")return{value:e.static.to,reactive:!1};return{value:"#",reactive:!1}}var Ze={name:"StxLink",aliases:["stx-link"],render(e,i,t){let o=An(e),a=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),c=typeof e.static.activeClass==="string"?e.static.activeClass:"active",l=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",u=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,f=[];if(o.reactive)f.push(`:href="${r(o.value)}"`);else f.push(`href="${r($r(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 x=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(x)f.push(`data-stx-active-match="${r(x)}"`);let h=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return f.push(...ie(e,h)),f.push(...oe(e,h)),`<a ${f.join(" ")}>${i}</a>`}};var In=new Map;function Ge(e){if(!e)return;let i=e.split("?")[0].split("#")[0];return In.get(i)}var Pn={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Ke=[320,640,768,1024,1280,1536,1920];function H(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let t=e.static[i];if(typeof t==="string")return t;return}function Ne(e,i,t=!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 t}function Je(e){if(e.includes("(")||e.includes(","))return e;let i=e.trim().split(/\s+/),t=[];for(let o of i)if(o.includes(":")){let[a,c]=o.split(":"),l=Pn[a];if(l)t.push(`(max-width: ${l}px) ${c}`);else{let u=Number.parseInt(a);if(!Number.isNaN(u))t.push(`(max-width: ${u}px) ${c}`)}}else t.push(o);return t.join(", ")}function Ye(e,i,t,o){return i.map((a)=>`${$e(e,a,void 0,t,o)} ${a}w`).join(", ")}function _n(e,i,t,o,a){return i.map((c)=>{let l=t?t*c:void 0;return`${$e(e,l,void 0,o,a)} ${c}x`}).join(", ")}function $e(e,i,t,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(i)c.push(`w_${i}`);if(t)c.push(`h_${t}`);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(t)c.set("h",String(t));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(t)c.set("height",String(t));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function En(e){return`var s=this.style;${e.map((i)=>`s.${i}=''`).join(";")}`}function Nn(e,i,t="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${i}"><rect width="100%" height="100%" fill="${t}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var Qe={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,i,t){let o=H(e,"src")||"",a=Go(o),c=H(e,"alt")||"",l=H(e,"width")||(a?String(a.source.width):void 0),u=H(e,"height")||(a?String(a.source.height):void 0),f=H(e,"sizes"),x=H(e,"srcset"),h=H(e,"densities"),d=H(e,"format"),C=Xo(o)||Ge(o)?.transparent===!0,v=H(e,"placeholder")||(a&&!C?"thumbhash":void 0),S=H(e,"placeholderColor")||"#e5e7eb",y=H(e,"provider"),w=H(e,"class")||H(e,"className")||"",A=H(e,"style")||"",k=H(e,"objectFit")||H(e,"fit"),R=H(e,"objectPosition")||H(e,"position"),E=H(e,"quality"),J=Ne(e,"lazy",!0),L=Ne(e,"preload",!1),U=Ne(e,"priority",!1),z=H(e,"loading"),N=H(e,"decoding")||"async",q=!!a||Ne(e,"picture",!1)||!!d,I=l?Number.parseInt(l):void 0,_=u?Number.parseInt(u):void 0,T=x||"",F="";if(a)T=a.sources[a.fallback.format]||"",F=f?Je(f):"100vw";else if(!T&&f&&y&&y!=="local"&&y!=="static")T=Ye(o,Ke,y,d),F=Je(f);else if(!T&&h){let Z=h.split(/\s+/).map((P)=>Number.parseFloat(P.replace("x","")));T=_n(o,Z,I,y,d)}else if(f)F=Je(f);let D=[];if(A)D.push(A);if(k)D.push(`object-fit:${k}`);if(R)D.push(`object-position:${R}`);if(I&&_)D.push(`aspect-ratio:${I}/${_}`);let re=[],ae=v==="blur"||v==="color"||v==="thumbhash";if(ae&&!C){let Z=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:S}:Ge(o);if(Z&&v==="color")D.push(`background-color:${Z.color}`),re.push("backgroundColor");else if(Z)D.push(`background-color:${Z.color}`),D.push(`background-image:url(${Z.dataUrl})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),re.push("backgroundColor","backgroundImage");else{let P=Nn(I||16,_||9,S);D.push(`background-image:url(${P})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),re.push("backgroundImage")}}else if(!ae&&v&&v!=="empty"&&v!=="none")D.push(`background-image:url(${r(v)})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),re.push("backgroundImage");let M=a?.fallback.url||$e(o,I,_,y,d),V=[];if(V.push(`src="${r($r(M,"fetched"))}"`),V.push(`alt="${r(c)}"`),l)V.push(`width="${r(l)}"`);if(u)V.push(`height="${r(u)}"`);let Re=z||(U||L?"eager":J?"lazy":"");if(Re)V.push(`loading="${r(Re)}"`);if(U)V.push('fetchpriority="high"');if(V.push(`decoding="${r(N)}"`),w)V.push(`class="${r(w)}"`);if(D.length>0)V.push(`style="${r(D.join(";"))}"`);if(T)V.push(`srcset="${r($r(T,"fetched"))}"`);if(F)V.push(`sizes="${r(F)}"`);let be=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","objectFit","objectPosition","fit","position","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(re.length>0){let Z=typeof e.static.onload==="string"?e.static.onload:"",P=En(re)+(Z?`;${Z}`:"");V.push(`onload="${r(P)}"`),be.add("onload")}V.push(...ie(e,be)),V.push(...oe(e,be));let le=`<img ${V.join(" ")} />`,Q="";if(L){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)}"`:""}${F?` imagesizes="${r(F)}"`:""} />
|
|
3
|
-
`}if(q){let Z=[];if(a)for(let P of
|
|
2
|
+
import{Fl,zl}from"./chunk-00tq7ghn.js";import{X,Ar,Ks,Gs,_i,Ei,Xs,Pe,We,xe,re,Or,Nr,me,se,B,gt,Mr,Ai,jr,Je,s,g,Y,In}from"./chunk-p55a910x.js";import{m,N,ht,p}from"./chunk-86nsbxep.js";import{r}from"./chunk-xz4v9tg1.js";import{fe}from"./chunk-t94y8g35.js";import{br}from"./chunk-7mcs59pr.js";import{b}from"./chunk-94mpe1ny.js";import{t}from"./chunk-yh2hnt3m.js";import{createHash as At}from"crypto";import J from"fs";import G from"path";import Le from"fs";function Ae(e,i,n){let o=Buffer.alloc(n),a=Le.readSync(e,o,0,n,i);return o.subarray(0,a)}function ze(e){if(e.length<25)return!1;let i=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(i(0,4)!=="RIFF"||i(8,12)!=="WEBP")return!1;let n=i(12,16);if(n==="VP8X")return(e[20]&16)!==0;if(n==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Ue(e){let i;try{i=Le.openSync(e,"r");let n=Ae(i,0,33);if(n.length>=3&&n[0]===255&&n[1]===216&&n[2]===255)return"none";if(n.length>=26&&n[0]===137&&n.toString("latin1",1,4)==="PNG"){let o=n[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ae(i,a,8);if(l.length<8)return"unknown";let u=l.toString("latin1",4,8);if(u==="tRNS")return"possible";if(u==="IDAT"||u==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(n.length>=25&&n.toString("latin1",0,4)==="RIFF"&&n.toString("latin1",8,12)==="WEBP"){if(ze(n))return"possible";let o=n.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(i!==void 0)Le.closeSync(i)}}import rn from"fs";import Fe from"os";import{fileURLToPath as bt}from"url";var Ee=Symbol("stx.image-worker.unavailable");function sn(e=typeof Fe.availableParallelism==="function"?Fe.availableParallelism():Fe.cpus().length){return Math.max(1,Math.min(2,e-1))}var _e=0,vt=[];async function on(){if(_e<sn()){_e++;return}await new Promise((e)=>vt.push(e)),_e++}function an(){_e--,vt.shift()?.()}var cn="@stacksjs/stx/builtins/image-warmup-worker";function ln(e=process.cwd()){let i=import.meta.url.endsWith(".ts")?"ts":"js";try{let n=new URL(`./image-warmup-worker.${i}`,import.meta.url);if(n.protocol==="file:"&&rn.existsSync(bt(n)))return bt(n)}catch{}return br(cn,e)}var xt=!1;function ue(e){if(!xt)xt=!0,console.warn(`[stx] image worker unavailable (${e}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return Ee}function Ie(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: ${Ie(a)}`)}if(typeof n!=="function")return ue("node:worker_threads has no Worker in this runtime");let o=ln();if(!o)return ue("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await on();try{return await new Promise((a,c)=>{let l;try{l=new n(o)}catch(h){a(ue(`could not start ${o}: ${Ie(h)}`));return}let u=!1,f=!1,x=(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"){x(()=>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;x(()=>c(d))}),l.on("error",(h)=>{x(()=>u?c(h instanceof Error?h:Error(Ie(h)||"image worker crashed")):a(ue(`the worker failed before it was ready: ${Ie(h)}`)))}),l.on("exit",(h)=>{x(()=>u?c(Error("image worker exited before it finished")):a(ue(`the worker exited with code ${h} before it was ready`)))})})}finally{an()}}var un=new Set([".avif",".jpeg",".jpg",".png",".webp"]),fn=[320,640,960,1280,1920],ve="/_stx/images",dn=`stx:${ve}:alpha-1`,gn=`stx:${ve}:opaque-1`,pn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Ne;function mn(e,i){let n=G.dirname(Bun.resolveSync(e,i));while(n!==G.dirname(n)){let o=G.join(n,"package.json");if(J.existsSync(o)){let a=JSON.parse(J.readFileSync(o,"utf8"));if(a.name===e)return a.version}n=G.dirname(n)}return}function wt(){if(Ne!==void 0)return Ne;let e;try{e=G.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Ne=pn.map((i)=>{let n;try{n=e?mn(i,e):void 0}catch{}return`${i.replace("@stacksjs/","")}@${n??"unknown"}`}).join("+"),Ne}var $t=Symbol.for("stx.image-delivery");function we(){let e=globalThis;return e[$t]??={catalog:new Map,transparent:new Set},e[$t]}var St=new Set;function hn(e){return`/${e.split(G.sep).map(encodeURIComponent).join("/")}`}function yn(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 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=G.join(e,o);await J.promises.mkdir(G.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 It(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=G.join(i,a.name);if(a.isDirectory()){o.push(...await It(e,c));continue}if(!a.isFile()||!un.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:hn(n.relativePath),input:n.absolutePath,name:yn(n.relativePath),...bn(n.absolutePath)?{options:{storage:i}}:{}}))}function bn(e){return Ue(e)==="possible"}function xn(e){for(let i=3;i<e.length;i+=4)if(e[i]!==255)return!0;return!1}async function vn(e){let i=Object.entries(e).filter(([,c])=>c.fallback.format==="png"),n=new Set,o=8;if(i.length===0)return n;let{decode:a}=await import("ts-images");for(let c=0;c<i.length;c+=8)await Promise.all(i.slice(c,c+8).map(async([l,u])=>{let f=u.variants.filter((x)=>x.format==="png").sort((x,h)=>x.width-h.width)[0];try{let x=await a(new Uint8Array(await J.promises.readFile(f?.path??u.fallback.path)));if(xn(x.data))n.add(l)}catch{n.add(l)}}));return n}function wn(e,i){let n=[];for(let o of i){let a=e[o],c=a?.variants.filter((u)=>u.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((u)=>{let f;try{return f=J.openSync(u.path,"r"),!ze(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 $n(e){let i=[],n=8;if(e.length===0)return i;let{generateThumbHash:o}=await import("ts-images");for(let a=0;a<e.length;a+=8){let c=e.slice(a,a+8),l=await Promise.all(c.map(async(u)=>{try{return await o(u.absolutePath),u}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${u.relativePath}`),null}}));i.push(...l.filter((u)=>u!==null))}return i}function qe(e){return G.join(e,"undecodable.json")}function Sn(e){try{let i=J.readFileSync(qe(e),"utf-8"),n=JSON.parse(i);return n&&typeof n==="object"?n:{}}catch{return{}}}function Cn(e,i){try{J.mkdirSync(G.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 ti(e){let i=Pt(e);return i?we().catalog.get(i):void 0}function ni(e){let i=Pt(e);return i?we().transparent.has(i):!1}function ri(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 iy(e){let i=ti(e);if(!i)return;return{src:i.fallback.url,srcset:i.sources[i.fallback.format]||"",sources:ri(i).map(({format:n,srcset:o})=>({type:`image/${n}`,srcset:o})),width:i.source.width,height:i.source.height,placeholder:ni(e)?void 0:i.placeholder?.dataUrl}}function _s(){let e=we();e.catalog=new Map,e.transparent=new Set}function Rn(e){let i=we();i.catalog=new Map(e.entries),i.transparent=new Set(e.transparent)}async function ay(e,i,n={}){if(!e||!J.existsSync(e))return _s(),{count:0,fingerprint:""};if(n.offThread){let y=await He("delivery",{publicDir:e,outputDir:i});if(y!==Ee)return Rn(y.state),y.result}let o=await It(e);if(o.length===0)return _s(),{count:0,fingerprint:""};let a=Sn(i),c=o.filter((y)=>{let w=a[y.relativePath];if(!w)return!0;let A=kt(y.absolutePath);return!A||A.mtimeMs!==w.mtimeMs||A.size!==w.size});if(c.length===0)return _s(),{count:0,fingerprint:""};let l=Ct(G.join(i,"_stx","images"),`${dn}:${wt()}`),u={outDir:G.join(i,"_stx","images"),storage:Ct(G.join(i,"_stx","images"),`${gn}:${wt()}`),baseUrl:ve,widths:fn,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},{createImageDeliveryCatalog:f}=await import("ts-images/delivery"),x=c,h;try{h=await f({...u,entries:Rt(c,l)})}catch(y){if(x=await $n(c),x.length===c.length)throw y;let w=new Set(x.map((k)=>k.relativePath)),A=!1;for(let k of c){if(w.has(k.relativePath))continue;let R=kt(k.absolutePath);if(!R)continue;a[k.relativePath]=R,A=!0}if(A)Cn(i,a);if(x.length===0)return _s(),{count:0,fingerprint:""};h=await f({...u,entries:Rt(x,l)})}let d=await vn(h.entries),C=wn(h.entries,d),v=we();v.catalog=new Map(Object.entries(h.entries)),v.transparent=d;let S=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:x.length,fingerprint:S}}class _t{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let i of e.aliases)this.builtins.set(i.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,i,n,o){let a=_i(e,o);if(a!==void 0)return a;for(let c of Ei(e,i,n,o))if(await s(c))return c;return null}}var de=new _t;var ne="\x00stx-boolean-attribute";function Xe(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var kn=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function Ve(e){let i=e.toLowerCase();return i.startsWith("aria-")||i.startsWith("data-")||kn.has(i)}function ie(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)}="${In(c,Xe(String(a)))}"`)}return n}function oe(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)}="${In(c,Xe(String(a)))}"`)}return n}function An(e){if(e.clientReactive.to)return{value:e.clientReactive.to,reactive:!0};if(e.serverDynamic.to!==void 0)return{value:String(e.serverDynamic.to),reactive:!1};if(typeof e.static.to==="string")return{value:e.static.to,reactive:!1};return{value:"#",reactive:!1}}var Ze={name:"StxLink",aliases:["stx-link"],render(e,i,n){let o=An(e),a=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),c=typeof e.static.activeClass==="string"?e.static.activeClass:"active",l=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",u=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,f=[];if(o.reactive)f.push(`:href="${r(o.value)}"`);else f.push(`href="${r(Or(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 x=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(x)f.push(`data-stx-active-match="${r(x)}"`);let h=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return f.push(...ie(e,h)),f.push(...oe(e,h)),`<a ${f.join(" ")}>${i}</a>`}};var Pn=new Map;function Ge(e){if(!e)return;let i=e.split("?")[0].split("#")[0];return Pn.get(i)}var _n={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Ke=[320,640,768,1024,1280,1536,1920];function H(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let n=e.static[i];if(typeof n==="string")return n;return}function Oe(e,i,n=!1){let o=e.serverDynamic[i];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[i];if(a!==void 0)return a!=="false"&&a!==!1;return n}function Ye(e){if(e.includes("(")||e.includes(","))return e;let i=e.trim().split(/\s+/),n=[];for(let o of i)if(o.includes(":")){let[a,c]=o.split(":"),l=_n[a];if(l)n.push(`(max-width: ${l}px) ${c}`);else{let u=Number.parseInt(a);if(!Number.isNaN(u))n.push(`(max-width: ${u}px) ${c}`)}}else n.push(o);return n.join(", ")}function Qe(e,i,n,o){return i.map((a)=>`${$e(e,a,void 0,n,o)} ${a}w`).join(", ")}function En(e,i,n,o,a){return i.map((c)=>{let l=n?n*c:void 0;return`${$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 Nn(e){return`var s=this.style;${e.map((i)=>`s.${i}=''`).join(";")}`}function On(e,i,n="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${i}"><rect width="100%" height="100%" fill="${n}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var et={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,i,n){let o=H(e,"src")||"",a=ti(o),c=H(e,"alt")||"",l=H(e,"width")||(a?String(a.source.width):void 0),u=H(e,"height")||(a?String(a.source.height):void 0),f=H(e,"sizes"),x=H(e,"srcset"),h=H(e,"densities"),d=H(e,"format"),C=ni(o)||Ge(o)?.transparent===!0,v=H(e,"placeholder")||(a&&!C?"thumbhash":void 0),S=H(e,"placeholderColor")||"#e5e7eb",y=H(e,"provider"),w=H(e,"class")||H(e,"className")||"",A=H(e,"style")||"",k=H(e,"objectFit")||H(e,"fit"),R=H(e,"objectPosition")||H(e,"position"),E=H(e,"quality"),K=Oe(e,"lazy",!0),L=Oe(e,"preload",!1),U=Oe(e,"priority",!1),z=H(e,"loading"),O=H(e,"decoding")||"async",q=!!a||Oe(e,"picture",!1)||!!d,I=l?Number.parseInt(l):void 0,_=u?Number.parseInt(u):void 0,D=x||"",F="";if(a)D=a.sources[a.fallback.format]||"",F=f?Ye(f):"100vw";else if(!D&&f&&y&&y!=="local"&&y!=="static")D=Qe(o,Ke,y,d),F=Ye(f);else if(!D&&h){let Z=h.split(/\s+/).map((P)=>Number.parseFloat(P.replace("x","")));D=En(o,Z,I,y,d)}else if(f)F=Ye(f);let j=[];if(A)j.push(A);if(k)j.push(`object-fit:${k}`);if(R)j.push(`object-position:${R}`);if(I&&_)j.push(`aspect-ratio:${I}/${_}`);let te=[],ae=v==="blur"||v==="color"||v==="thumbhash";if(ae&&!C){let Z=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:S}:Ge(o);if(Z&&v==="color")j.push(`background-color:${Z.color}`),te.push("backgroundColor");else if(Z)j.push(`background-color:${Z.color}`),j.push(`background-image:url(${Z.dataUrl})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),te.push("backgroundColor","backgroundImage");else{let P=On(I||16,_||9,S);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||$e(o,I,_,y,d),V=[];if(V.push(`src="${r(Or(M,"fetched"))}"`),V.push(`alt="${r(c)}"`),l)V.push(`width="${r(l)}"`);if(u)V.push(`height="${r(u)}"`);let Re=z||(U||L?"eager":K?"lazy":"");if(Re)V.push(`loading="${r(Re)}"`);if(U)V.push('fetchpriority="high"');if(V.push(`decoding="${r(O)}"`),w)V.push(`class="${r(w)}"`);if(j.length>0)V.push(`style="${r(j.join(";"))}"`);if(D)V.push(`srcset="${r(Or(D,"fetched"))}"`);if(F)V.push(`sizes="${r(F)}"`);let be=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","objectFit","objectPosition","fit","position","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(te.length>0){let Z=typeof e.static.onload==="string"?e.static.onload:"",P=Nn(te)+(Z?`;${Z}`:"");V.push(`onload="${r(P)}"`),be.add("onload")}V.push(...ie(e,be)),V.push(...oe(e,be));let le=`<img ${V.join(" ")} />`,Q="";if(L){let P=d==="webp"?"image/webp":d==="avif"?"image/avif":"";Q=`<link rel="preload" as="image" href="${r(M)}"${P?` type="${P}"`:""}${D?` imagesrcset="${r(D)}"`:""}${F?` imagesizes="${r(F)}"`:""} />
|
|
3
|
+
`}if(q){let Z=[];if(a)for(let P of ri(a))Z.push(`<source type="image/${P.format}" srcset="${r(P.srcset)}"${F?` sizes="${r(F)}"`:""} />`);if(!a&&(d==="avif"||d==="auto")){let P=$e(o,I,_,y,"avif"),T=D?Qe(o,Ke,y,"avif"):`${P}`;Z.push(`<source type="image/avif" srcset="${r(T)}"${F?` sizes="${r(F)}"`:""} />`)}if(!a&&(d==="webp"||d==="auto")){let P=$e(o,I,_,y,"webp"),T=D?Qe(o,Ke,y,"webp"):`${P}`;Z.push(`<source type="image/webp" srcset="${r(T)}"${F?` sizes="${r(F)}"`:""} />`)}return`${Q}<picture>
|
|
4
4
|
${Z.join(`
|
|
5
5
|
`)}
|
|
6
6
|
${le}
|
|
7
|
-
</picture>`}return`${Q}${le}`}};var
|
|
7
|
+
</picture>`}return`${Q}${le}`}};var Et="/images/safe-image-default.svg";function ge(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let n=e.static[i];if(typeof n==="string")return n;return}var Bn=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${Et}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,tt={name:"SafeImage",aliases:["safe-image","safe-img"],render(e,i,n){let o=ge(e,"src")||"",a=ge(e,"alt")||"",c=ge(e,"fallback")||Et,l=ge(e,"class")||ge(e,"className")||"",u=ge(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 x=new Set(["src","alt","fallback","class","className","fallbackClassName"]);f.push(...ie(e,x)),f.push(...oe(e,x));let h=`<img ${f.join(" ")} />`,d=n.context;if(!d.__safeImageHandlerEmitted)return d.__safeImageHandlerEmitted=!0,`${Bn}${h}`;return h}};function nt(e){return e.replace(/[;{}()]/g,"").replace(/url/gi,"")}function Se(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=Se(e,i);if(o!==void 0){let a=Number.parseInt(o,10);if(!Number.isNaN(a))return a}return n}var rt={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render(e,i,n){let o=nt(Se(e,"color")||"#6366f1"),a=nt(Se(e,"initialColor")||Se(e,"initial-color")||""),c=nt(Se(e,"height")||"3px"),l=Be(e,"duration",2000),u=Be(e,"throttle",200),f=Be(e,"zIndex",999999)||Be(e,"z-index",999999),x=a?`linear-gradient(to right, ${a}, ${o})`:o;return`
|
|
8
8
|
<div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${c};background:${x};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>
|
|
12
12
|
<script>
|
|
13
13
|
(function(){var el=document.getElementById('stx-loading-indicator'),p=0,l=!1,i=null;function u(v){p=Math.min(Math.max(v,0),100);if(el){el.style.opacity=p>0?'1':'0';el.style.transform='scaleX('+(p/100)+')'}}window.stxLoading={start:function(){l=!0;p=0;u(10);if(i)clearInterval(i);i=setInterval(function(){if(!l)return;var r=90-p,inc=Math.max(0.5,r*0.1);if(p<90)u(p+inc)},${u})},finish:function(){l=!1;if(i){clearInterval(i);i=null}u(100);setTimeout(function(){if(el)el.style.opacity='0';setTimeout(function(){p=0;if(el)el.style.transform='scaleX(0)'},300)},200)},set:function(v){u(v)},clear:function(){l=!1;p=0;if(i){clearInterval(i);i=null}if(el){el.style.opacity='0';el.style.transform='scaleX(0)'}}};document.addEventListener('click',function(e){var a=e.target.closest&&e.target.closest('a');if(!a)return;var h=a.getAttribute('href');if(!h||h.startsWith('http')||h.startsWith('#')||h.startsWith('mailto:')||h.startsWith('tel:')||a.target==='_blank')return;window.stxLoading.start()});window.addEventListener('popstate',function(){window.stxLoading.start()});window.addEventListener('load',function(){window.stxLoading.finish()})})();
|
|
14
|
-
</script>`}};function
|
|
14
|
+
</script>`}};function Ot(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 Tn(e,i,n){let o=Ot(e,i);if(o!==void 0){let a=Number.parseInt(o,10);if(!Number.isNaN(a))return a}return n}var Nt={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},st={name:"StxToast",aliases:["stx-toast"],render(e,i,n){let o=r(Ot(e,"position")||"top-right"),a=Tn(e,"max",5),c=Nt[o]||Nt["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${o}" data-stx-toast-max="${a}" style="position:fixed;${c};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
|
|
15
15
|
<style>
|
|
16
16
|
@keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
|
|
17
17
|
@keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
|
|
@@ -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)"},it={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,7 +28,7 @@ ${le}
|
|
|
28
28
|
@media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
|
|
29
29
|
.stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
|
|
30
30
|
.stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
|
|
31
|
-
</style>`}};function
|
|
31
|
+
</style>`}};function pe(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let n=e.static[i];if(typeof n==="string")return n;return}var Tt={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},ot={name:"StxDrawer",aliases:["stx-drawer"],render(e,i,n){let o=pe(e,"id");if(!o)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let a=r(o),c=pe(e,"side")||"right",l=pe(e,"size")||"md",u=pe(e,"closeOnBackdrop")!=="false",f=pe(e,"closeOnEscape")!=="false",x=pe(e,"overlay")!=="false",h=Tt[l]||Tt.md,d=c==="left",C=d?"left:0":"right:0",v=d?"translateX(-100%)":"translateX(100%)",S=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;${x?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
|
|
32
32
|
<div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${C};width:${h};max-width:100vw;transform:${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>
|
|
@@ -37,6 +37,6 @@ ${le}
|
|
|
37
37
|
@media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
|
|
38
38
|
.stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
|
|
39
39
|
.stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
|
|
40
|
-
</style>`}};import{existsSync as Dn,readFileSync as jn}from"fs";var
|
|
41
|
-
`||N==="\t"){let q=Hn(e,U+w.length);if(e[q-1]!=="/")k++;R=q+1}else R=U+w.length}else{if(k--,k===0){E=z;break}R=z+A.length}}if(E===-1){a=v;continue}let J=e.slice(v,E),L=E+A.length;o.push({fullMatch:e.slice(l,L),tagName:x,attributes:y,content:J,startIndex:l,endIndex:L,isSelfClosing:!1}),a=L}}return o}function ft(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function Ht(e,i){try{let t=Buffer.from(e,"base64").toString("utf8");return JSON.parse(t)}catch{}try{let t=e.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(t)}catch(t){if(i?.debug)console.error("Error decoding __stx_ prop:",t);return e}}function je(e,i){let t=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==="{")t++;else if(c==="}"){if(t--,t===0)return e.slice(i,a+1)}a++}return e.slice(i)}function qt(e){let i=e.trim();if(!i.startsWith("{")||!i.endsWith("}"))return null;if(je(i,0).length!==i.length)return null;return i.slice(1,-1).trim()}function Xt(e){let i=[],t=0,o=e.length;while(t<o){while(t<o&&/\s/.test(e[t]))t++;if(t>=o)break;let a="";while(t<o&&!/[\s=]/.test(e[t]))a+=e[t],t++;if(!a)break;while(t<o&&/\s/.test(e[t]))t++;if(t<o&&e[t]==="="){t++;while(t<o&&/\s/.test(e[t]))t++;let c="";if(t<o&&(e[t]==='"'||e[t]==="'")){let l=e[t];t++;while(t<o&&e[t]!==l){if(e[t]==="\\"&&t+1<o)t++,c+=e[t];else c+=e[t];t++}if(t<o)t++}else if(e[t]==="{")c=je(e,t),t+=c.length;else while(t<o&&!/\s/.test(e[t]))c+=e[t],t++;i.push({name:a,value:c})}else i.push({name:a,value:!0})}return i}var qn=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),Xn=new Set([":for","x-for","v-for","@for"]),Vt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Vn(e){return dt(e).map((i)=>[i.start,i.end])}function dt(e){let i=[],t=new Map;for(let o of Lt(e)){let a=o.name.toLowerCase();if(o.closing){let x=t.get(a)?.pop();if(x)x.end=o.end;continue}let l=/(?::for|x-for|v-for|@for)\s*=/.test(o.attributes)?Xt(o.attributes).find((x)=>Xn.has(x.name)):void 0,u=typeof l?.value==="string"?l.value:null,f=u!==null?{start:o.start,end:o.end,names:te(u),tag:a}:null;if(f)i.push(f);if(!o.selfClosing&&!Vt.has(a)){let x=t.get(a);if(!x)x=[],t.set(a,x);x.push(f)}}return i}var Zn=/(?:^|\s)((?:[\w-]+:)*-?space-[xy]-(?!reverse(?:\s|$))[\w./[\]-]+)(?=\s|$)/;function Zt(e){let i=new Map,t=[];for(let o of Lt(e)){let a=o.name.toLowerCase();if(o.closing){for(let l=t.length-1;l>=0;l--)if(t[l].name===a){t.length=l;break}continue}let c=t.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&&!Vt.has(a)){let l=/(?:^|\s)class\s*=\s*(["'])([\s\S]*?)\1/.exec(o.attributes)?.[2];t.push({name:a,utility:l?Zn.exec(l)?.[1]??null:null,children:0})}}return i}function Gt(e){if(typeof e==="string")return e;if(Array.isArray(e))return e.filter(Boolean).map((i)=>Gt(i)).join(" ");if(e&&typeof e==="object")return Object.entries(e).filter(([,i])=>i).map(([i])=>i).join(" ");return e?String(e):""}function kc(e,i){if(!/:[\w-]+=/.test(e))return e;let t=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(...Vn(e));let l=new Set([...lt(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=[],x=new Map,h=256;for(let d of Lt(t)){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,"")),S=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,y,w=C,A=!1;while((y=S.exec(C))!==null){if(Rr(C,y.index,!0)?.kind==="attribute")continue;let k=y[1],R=y[2];if(Al(k))continue;if(j(R,l))continue;if(R.includes("()")&&!R.includes(".get(")||R.includes("$store")||R.includes("$ref"))continue;try{let E=Object.keys(i),J=Object.values(i),L=R.match(/^([a-zA-Z_$][\w$]*)/);if(L&&!E.includes(L[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(L[1]))continue;let U=JSON.stringify([E,R]),z=x.get(U);if(!z){if(z=Function(...E,`return (${R})`),x.size>=h)x.clear();x.set(U,z)}let N=z(...J);if(k==="class"){let q=X(Gt(N));if(q){let I=w.match(/\sclass="([^"]*)"/);if(I)w=w.replace(I[0],()=>` class="${I[1]} ${q}"`);else w=w.replace(y[0],()=>` class="${q}"`)}else w=w.replace(y[0],"");A=!0;continue}if(qn.has(k)){if(N)w=w.replace(y[0],` ${k}`);else w=w.replace(y[0],"");A=!0;continue}if(N===null||N===void 0||N===!1)w=w.replace(y[0],"");else{let q=v&&typeof N==="object"?JSON.stringify(N):String(N),I=Tn(k,q);w=w.replace(y[0],()=>` ${k}="${I}"`)}A=!0}catch(E){if(E instanceof fe)throw E;continue}}if(A){let k=d.selfClosing?" /":"",E=`<${d.name}${w}${k}>`;f.push({start:d.start,end:d.end,replacement:E})}}if(f.length>0){let d=Array(f.length*2+1),C=0;for(let v=0;v<f.length;v++){let{start:S,end:y,replacement:w}=f[v];d[v*2]=t.slice(C,S),d[v*2+1]=w,C=y}d[f.length*2]=t.slice(C),t=d.join("")}return t}import Kt from"fs";import Jt from"path";var Yt=!1;function Gn(e,i,t,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=(d)=>{if(l.size===0)return!1;let C=n(d),v=C.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(v&&l.has(v))return!0;for(let S of l){let y=S.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${y}\\s*\\(`).test(C))return!0}return!1},f=new Set(Pl),x=(d)=>{if(!d.includes("-")||d.startsWith("@")||d.startsWith(":")||d.startsWith("x-")||d.startsWith("__"))return d;if(d.startsWith("aria-")||d.startsWith("data-"))return d;return d.replace(/-([a-z0-9])/g,(C,v)=>v.toUpperCase())},h=(d,C)=>{let v=x(d);if(c.static[v]=C,v!==d)c.staticNames[v]=d};for(let[d,C]of Object.entries(e)){let v=d.startsWith("x-")&&!f.has(d)&&!d.startsWith("x-bind:")&&!d.startsWith("x-on:")?`:${d.slice(2)}`:d;if(v.startsWith("@")){c.events[v]=C;continue}if(v.startsWith("__stx_")){let S=x(v.slice(6));c.serverDynamic[S]=Ht(C,t);continue}if(v.startsWith(":")){let S=x(v.slice(1)),y=C===se?S:C;if(S==="if"||S==="for"||S==="show"){c.clientReactive[S]=y;continue}if(o){c.clientReactive[S]=y;continue}if(j(y,a)){c.clientReactive[S]=y;continue}if(u(y)){c.clientReactive[S]=y;continue}try{if(!m(y)){if(t.debug)console.error(`Unsafe expression in :${S} binding: ${y}`);c.clientReactive[S]=y;continue}let w=Object.keys(i),A=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(ut(y).some((L)=>!A.has(L)&&!w.includes(L)&&(!(L in globalThis)||k.has(L)))){c.clientReactive[S]=y;continue}let J=p(y,w)(...Object.values(i));if(c.serverDynamic[S]=J,S!==v.slice(1)&&c.serverDynamicNames)c.serverDynamicNames[S]=v.slice(1)}catch{c.clientReactive[S]=y}continue}if(typeof C==="string"&&C.includes("{{")&&C.includes("}}")){let S=Qn(C,a);if(S!==null){c.clientReactive[x(v)]=S;continue}let y=C.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(y)try{let w=y[1];if(m(w)){let k=p(w,Object.keys(i))(...Object.values(i));h(v,k!=null?String(k):"")}else{if(t.debug)console.error(`Unsafe expression in ${v}: ${w}`);h(v,C)}}catch(w){if(t.debug)console.error(`Error evaluating expression for ${v}:`,w);h(v,C)}else{let w=C,A=/\{\{\s*([\s\S]+?)\s*\}\}/g,k;while((k=A.exec(C))!==null)try{let R=k[1];if(!m(R)){if(t.debug)console.error(`Unsafe expression in ${v}: ${R}`);continue}let J=p(R,Object.keys(i))(...Object.values(i));w=w.replace(k[0],String(J??""))}catch(R){if(t.debug)console.error(`Error evaluating expression in ${v}:`,R)}h(v,w)}continue}h(v,C===se?"true":ft(C))}return c}var gt=new Set;function Qh(){gt.clear()}function Kn(e){let i=/^\s*(?:<!--[\s\S]*?-->\s*)*<(?:div|span)\b((?:[^>"']|"[^"]*"|'[^']*')*)>/.exec(e);return!!i&&/\sdata-stx-component-wrapper(?=[\s=]|$)/.test(i[1])&&!/\sstx-hydrate(?=[\s=]|$)/.test(i[1])}function Jn(e,i,t){let o=`${t}\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 ${t} 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 ey(){pt.clear()}function Yn(e,i){let t=`${i}\x00${e}`;if(pt.has(t))return;pt.add(t),console.warn(`[stx] <${e}> in ${i} is inside a <template :for>, so its props and slot expressions will not see the loop variables and render empty. Put the directive on the element the loop repeats instead -- <tr :for="..."> or <span :for="..." class="contents"> -- which binds correctly.`)}function Qn(e,i){if(i.size===0)return null;let t=/\{\{\s*([\s\S]+?)\s*\}\}/g,o=[...e.matchAll(t)];if(!o.some((u)=>j(u[1],i)))return null;let a=e.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(a&&o.length===1)return a[1];let c="",l=0;for(let u of o)c+=e.slice(l,u.index).replace(/[`\\$]/g,(f)=>`\\${f}`),c+=`\${${u[1]}}`,l=u.index+u[0].length;return c+=e.slice(l).replace(/[`\\$]/g,(u)=>`\\${u}`),`\`${c}\``}var er=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function tr(e,i,t){if(!e.includes("@"))return e;if(!er.some(([a,c])=>a.test(e)&&e.includes(c)))return e;try{return de(e,i,t)}catch{return e}}function ye(e){let i={},t=0,o=e.length;while(t<o){while(t<o&&/\s/.test(e[t]))t++;if(t>=o)break;let a="";while(t<o&&!/[\s=]/.test(e[t]))a+=e[t],t++;if(!a)break;while(t<o&&/\s/.test(e[t]))t++;if(t<o&&e[t]==="="){t++;while(t<o&&/\s/.test(e[t]))t++;let c="";if(t<o&&(e[t]==='"'||e[t]==="'")){let l=e[t];t++;while(t<o){let u=e[t];if(u==="\\"&&t+1<o){t++,c+=e[t],t++;continue}if(u===l){t++;break}c+=u,t++}}else if(e[t]==="{"){c=je(e,t),t+=c.length;let l=qt(c);if(l!==null){i[`:${a}`]=l;continue}}else while(t<o&&!/\s/.test(e[t]))c+=e[t],t++;i[a]=c}else i[a]=se}return i}function Qt(e){return Object.entries(e).map(([i,t])=>t===se?i:`${i}="${nr(t)}"`).join(" ")}function nr(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function rr(e){let i=new Set,t=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,o;while((o=t.exec(e))!==null){let a=o[1];if(ge.isBuiltin(a))i.add(a)}return[...i].sort()}async function Zf(e,i,t,o,a){if(!/import\s/.test(e))return e;if(!i.__importedComponents)i.__importedComponents=new Map;let c=i.__importedComponents,l=Jt.dirname(t),u=[],f=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let d of e.matchAll(f)){let[C,v,S]=d,y=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,w=S,A,k=[];while((A=y.exec(S))!==null){let[R,E,J,L]=A,U=null,z=null;if(L.startsWith(".")||L.startsWith("/")){let I=Jt.resolve(l,L);if(I.endsWith(".stx"))z=I;else{let _=`${I}.stx`;try{if(Kt.statSync(_).isFile())z=_}catch{try{if(Kt.statSync(I).isDirectory())U=I}catch{}}}}else U=zs(L,l);if(!U&&!z)continue;let N=!1,q=(I,_)=>{c.set(I,_),c.set(I.toLowerCase(),_);let T=I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();c.set(T,_),a.add(_)};if(J&&z)q(J,z),N=!0;else if(E){let I=E.slice(1,-1).split(",").map((T)=>T.trim()).filter(Boolean).map((T)=>{let F=T.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(F)return{source:F[1],local:F[2]};return{source:T,local:T}}),_=U?Cr(U):null;for(let{source:T,local:F}of I){let D=null;if(z)D=z;else if(_)D=_.get(T)??_.get(T.toLowerCase())??_.get(T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)q(F,D),N=!0}}if(N)k.push({start:A.index,end:A.index+R.length})}if(k.length===0)continue;for(let R=k.length-1;R>=0;R--)w=w.slice(0,k[R].start)+w.slice(k[R].end);u.push({start:d.index,end:d.index+C.length,value:`<script${v}>${w}</script>`})}if(u.length===0)return e;let x=[],h=0;for(let d of u)x.push(e.slice(h,d.start),d.value),h=d.end;return x.push(e.slice(h)),x.join("")}async function sr(e,i,t,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[x,h]=f,d=h.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$/,""),w=y.includes("-")?y.split("-").map((R)=>R.charAt(0).toUpperCase()+R.slice(1)).join(""):y.charAt(0).toUpperCase()+y.slice(1),A=null,k=Hs(C,t,o);for(let R of k)try{if(await Bun.file(R).exists()){A=R;break}}catch{}if(A){l.set(w,A),l.set(y,A),l.set(y.toLowerCase(),A);let R=w.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(l.set(R,A),a.add(A),o.debug)console.log(`Imported component: ${w} -> ${A}`)}else if(o.debug)console.warn(`Could not resolve imported component: ${C}`)}c=c.replace(x,""),u.lastIndex=0}return c}async function ir(e,i,t,o,a){let c=e,l=o.componentsDir||"components";if(!i.__processedComponents)i.__processedComponents=new Set;let u=i.__processedComponents,f=/@component\s*\(/g,x;while((x=f.exec(c))!==null){let h=x.index,d=h+x[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 S=c.substring(d+1,v),y=v+1,w=S.match(/^\s*['"]([^'"]+)['"]/);if(!w){f.lastIndex=y;continue}let A=w[1],k,R=S.slice(w[0].length),E=R.match(/^\s*,\s*/);if(E)k=R.slice(E[0].length).trim();let J={};if(k)try{J=O(k,i)}catch(I){let _=I instanceof Error?I.message:String(I);c=c.replace(c.substring(h,y),`[Error parsing component props: ${_}]`);continue}let L="",U=y,N=c.substring(y).match(/^([\s\S]*?)@endcomponent/);if(N)L=N[1].trim(),U=y+N[0].length;let q=await qe(A,J,L,l,i,t,o,u,a);c=c.substring(0,h)+q+c.substring(U),f.lastIndex=0}return c}async function or(e,i,t,o,a){if(!e)return e;let c=e,l=o.componentsDir||"components";if(!i.__processedComponents)i.__processedComponents=new Set;let u=i.__processedComponents,f=lr(c);if(f.size>0){let y=Array.isArray(i.__stx_client_declared_names)?i.__stx_client_declared_names:[];i.__stx_client_declared_names=[...new Set([...y,...f])]}let x=ee(c);c=x.output;let h=lt(i);return c=await S(c,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),c=await S(c,/[A-Z][a-zA-Z0-9]*/,!0,Ft(Ar)),c=await S(c,/[a-z][a-z0-9]*/,!1,Ar),c=x.restore(c),c;async function S(y,w,A,k){if(!y)return y;let R=y,E=Wt(R,w,k),J=dt(R),L=!o._nativeHostAttrs&&/space-[xy]-/.test(R),U,z=new Map;for(let I=E.length-1;I>=0;I--){let _=E[I],T=A?G(_.tagName):_.tagName,F=ye(tr(_.attributes,i,t)),D=J.filter(({start:B,end:W})=>_.startIndex>=B&&_.startIndex<W);if(D.some((B)=>B.tag==="template"))Yn(_.tagName,t);let re=D.length>0,ae=new Set(h);for(let B of D)for(let W of B.names)ae.add(W);let M=Gn(F,i,o,re,ae);if(typeof M.clientReactive.for==="string")for(let B of te(M.clientReactive.for))ae.add(B);let V=ge.getBuiltin(_.tagName),Re=V?await Or(_.tagName,l,i,t,o):!1,be=_.tagName==="Image"&&Vs([...Object.keys(M.static),...Object.keys(M.serverDynamic),...Object.keys(M.clientReactive)],Object.keys(M.events),{...M.static,...M.serverDynamic})&&(o._pluginComponentDirs??[]).some((B)=>Cr(B).has("Image"));if(V&&!Re&&!be){let B={context:i,filePath:t,options:o,dependencies:a},W=V.render(M,_.content,B);if(Object.keys(M.events).length>0){let ce=Qt(M.events);W=W.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${ce}`)}if(Object.keys(M.clientReactive).length>0)W=en(W,M.clientReactive);z.set(I,W);continue}if(!A&&_.tagName.includes("-")&&!await Or(T,l,i,t,o))continue;let le={};for(let[B,W]of Object.entries(M.static))le[B]=W;for(let[B,W]of Object.entries(M.serverDynamic))le[B]=W;let Q={declaredProps:new Set,consumedProps:new Set,reactiveProps:Object.keys(M.clientReactive),events:Object.keys(M.events)},Z=await qe(T,le,x.restore(_.content),l,i,t,o,u,a,[...ae],Q,_.tagName);if(L&&Kn(Z)){U??=Zt(R);let B=U.get(_.startIndex);if(B)Jn(_.tagName,B,t)}let P=Z;if(P=ar(P,M,Q.declaredProps,Q.consumedProps,o._nativeHostAttrs),o._nativeHostAttrs){let B=Q.reactiveProps.filter((ne)=>!Q.consumedProps.has(ne)&&!["if","for","show","key","ref"].includes(ne)).map(G),W=mt(P,!0);if(B.length&&W){if(!Object.hasOwn(ye(P.slice(W.insertPos,W.tagEnd)),"data-stx-native-host-root"))P=P.slice(0,W.insertPos)+' data-stx-native-host-root="true"'+P.slice(W.insertPos);let ne=Ce(P);P=P.slice(0,ne.insertPos)+` data-stx-native-forward="${B.join(" ")}"`+P.slice(ne.insertPos)}let ce=mt(P,!0);if(ce){let ne=ye(P.slice(ce.insertPos,ce.tagEnd)),ke=Ce(P),nn=ye(P.slice(ke.insertPos,ke.tagEnd));if(Object.hasOwn(ne,"data-stx-native-host-root")&&!Object.hasOwn(nn,"data-stx-native-host-owner"))P=P.slice(0,ke.insertPos)+" data-stx-native-host-owner"+P.slice(ke.insertPos)}}if(Object.keys(M.events).length>0){let B=Ce(P);if(B){let W=Qt(M.events),ce=Object.keys(M.events).map((ne)=>ne.replace(/^@/,"").split(".")[0]).join(" ");P=P.substring(0,B.insertPos)+` data-stx-parent-events="${ce}" ${W}`+P.substring(B.insertPos)}}if(Object.keys(M.clientReactive).length>0)P=en(P,M.clientReactive);z.set(I,P)}if(z.size===0)return R;let N="",q=0;for(let I=0;I<E.length;I++){let _=z.get(I);if(_===void 0)continue;N+=R.slice(q,E[I].startIndex),N+=_,q=E[I].endIndex}return N+=R.slice(q),N}}function en(e,i){let t=new Set(["if","for"]),o=new Set(["show"]),a=Object.entries(i).filter(([h])=>!t.has(h)),c=a.filter(([h])=>!o.has(h)).map(([h])=>G(h)).join(" "),l=e,u=a.length>0?Ce(l):null;if(u){let h=a.map(([C,v])=>`:${G(C)}="${v.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 x=i.for;if(x){let h=i.key,d=h?` :key="${h.replace(/"/g,""")}"`:"";l=`<template :for="${x.replace(/"/g,""")}"${d}>${l}</template>`}return l}function ar(e,i,t=new Set,o=new Set,a=!1){let c=mt(e,a);if(!c)return e;let l=e.slice(c.insertPos,c.tagEnd),u=i.serverDynamic.class??i.static.class;if(a&&typeof u==="string"&&u&&!o.has("class")){let S=/(^|\s)class\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i,y=S.test(l)?l.replace(S,(w,A,k,R,E)=>`${A}class="${r(`${ft(k??R??E)} ${u}`)}"`):` class="${r(u)}"${l}`;e=e.slice(0,c.insertPos)+y+e.slice(c.tagEnd),c.tagEnd+=y.length-l.length,l=y}let f=a||/\bdata-native(?:\s|=)/i.test(l),x=f?o:t,h=new Set(Object.keys(ye(l))),d=new Set(["class","className"]);for(let S of Object.keys(i.static)){let y=i.staticNames[S]??S;if(h.has(y)||x.has(S)||!f&&!Ve(y))d.add(S)}for(let S of Object.keys(i.serverDynamic)){let y=i.serverDynamicNames?.[S]??S;if(h.has(y)||x.has(S)||!f&&!Ve(y))d.add(S)}let C=[];if(f){for(let[S,y]of Object.entries(i.static)){if(d.has(S)||y!==!0&&y!==se)continue;d.add(S),C.push(`${r(i.staticNames?.[S]??S)}="true"`)}for(let[S,y]of Object.entries(i.serverDynamic)){if(d.has(S)||y!==!0)continue;d.add(S),C.push(`${r(i.serverDynamicNames?.[S]??S)}="true"`)}}let v=[...ie(i,d),...oe(i,d),...C];if(f){for(let[S,y]of Object.entries(i.serverDynamic)){if(d.has(S)||y!==!1)continue;let w=i.serverDynamicNames?.[S]??S;v.push(`${r(w)}="false"`)}for(let[S,y]of Object.entries(i.serverDynamic)){if(d.has(S)||y===null||typeof y!=="object")continue;let w=JSON.stringify(y);if(w!==void 0){let A=i.serverDynamicNames?.[S]??S;v.push(`${r(A)}="${r(w)}"`)}}}if(v.length===0)return e;return`${e.slice(0,c.insertPos)} ${v.join(" ")}${e.slice(c.insertPos)}`}function Ce(e){let i=tn(e,0);if(i)return i;let t=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(e);if(t)return{insertPos:t.index+1+t[1].length,tagEnd:ht(e,t.index+1+t[1].length)};return null}function mt(e,i=!1){let t=Ce(e);if(!t)return null;let o=e.slice(t.insertPos,t.tagEnd),a=/\bdata-stx-component-wrapper(?:\s|=|>|$)/i.test(o)?tn(e,t.tagEnd+1):t;return a&&i?cr(e,a)??a:a}function cr(e,i){if(!e.includes("data-stx-native-host-root"))return null;let t=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),o=e.lastIndexOf("<",i.insertPos),a=0,c;while(o>=0&&o<e.length){if(e.startsWith("<!--",o)){let h=e.indexOf("-->",o+4);if(h<0)return null;o=e.indexOf("<",h+3);continue}let l=/^<(\/?)([a-z][\w-]*)\b/i.exec(e.slice(o));if(!l){o=e.indexOf("<",o+1);continue}let u=l[2].toLowerCase(),f=o+l[0].length,x=ht(e,f);if(l[1]){if(a--,c!==void 0&&a<c)c=void 0;if(a<=0)return null}else if(u==="script"||u==="style"){let h=new RegExp(`</${u}\\s*>`,"gi");if(h.lastIndex=x+1,!h.exec(e))return null;o=e.indexOf("<",h.lastIndex);continue}else{let h=ye(e.slice(f,x)),d=a>0&&(Object.hasOwn(h,"data-stx-component-wrapper")||Object.hasOwn(h,"data-stx-native-host-owner"));if(c===void 0&&!d&&Object.hasOwn(h,"data-stx-native-host-root"))return{insertPos:f,tagEnd:x};if(!t.has(u)&&e[x-1]!=="/"){if(a++,c===void 0&&d)c=a}else if(a===0)return null}o=e.indexOf("<",x+1)}return null}function tn(e,i){let t=i;while(t<e.length){let o=e.slice(t),a=o.match(/^\s+/);if(a){t+=a[0].length;continue}if(o.startsWith("<!--")){let u=e.indexOf("-->",t+4);if(u===-1)return null;t=u+3;continue}let c=o.match(/^<(script|style)\b[^>]*>/i);if(c){let u=`</${c[1].toLowerCase()}>`,f=e.toLowerCase().indexOf(u,t+c[0].length);if(f===-1)return null;t=f+u.length;continue}let l=o.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!l)return null;return{insertPos:t+1+l[1].length,tagEnd:ht(e,t+1+l[1].length)}}return null}function ht(e,i){let t="";for(let o=i;o<e.length;o++){let a=e[o];if(t){if(a==="\\")o++;else if(a===t)t=""}else if(a==='"'||a==="'")t=a;else if(a===">")return o}return e.length}function lr(e){let i=new Set;for(let t of e.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)){let o=t[1];if(!/\bclient\b/.test(o)||/\bserver\b/.test(o))continue;for(let a of ki(t[2]))i.add(a);for(let a of t[2].matchAll(/^\s*import\s+(?:type\s+)?(?:([\w$]+)\s*,?\s*)?(?:\{([^}]*)\}|\*\s+as\s+([\w$]+))?\s*from\s/gm)){if(a[1])i.add(a[1]);if(a[3])i.add(a[3]);for(let c of(a[2]??"").split(",")){let l=c.replace(/^\s*type\s+/,"").split(/\s+as\s+/).pop().trim();if(/^[A-Za-z_$][\w$]*$/.test(l))i.add(l)}}}return i}async function ws(e,i,t,o,a){if(!Yt)Mt(ge),Yt=!0;let c=await Zf(e,i,t,o,a);c=await sr(c,i,t,o,a),c=await ir(c,i,t,o,a);let l=[];for(let u=0;u<3;u++){let f=l.length,x=we(c,ze,(d,C)=>`\x00STX_COMPONENT_COMMENT_${f+C}\x00`,`STX_COMPONENT_COMMENT:${f}`);l.push(...x.tokens);let h=c;if(c=await or(x.output,i,t,o,a),c===h)break}if(l.length>0)c=c.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(u,f)=>l[Number(f)]??"");if(o.debug){let u=rr(c);if(u.length>0)console.warn(`[stx] ${t}: 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 Dn,readFileSync as jn}from"fs";var De=new Map,Dt=new Set;function Mn(e){if(Dt.has(e))return;Dt.add(e),console.warn(`[stx] icon collection "${e}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${e}\`.`)}function Ln(e){let i=process.cwd();for(let n of[`${i}/node_modules/@iconify-json/${e}/icons.json`,`${i}/pantry/@iconify-json/${e}/icons.json`,`${i}/node_modules/@iconify/json/json/${e}.json`,`${i}/pantry/@iconify/json/json/${e}.json`])if(Dn(n))return n;for(let n of[`@iconify-json/${e}/icons.json`,`@iconify/json/json/${e}.json`])try{return b.resolve(n)}catch{}return null}function zn(e){if(De.has(e))return De.get(e);let i=Ln(e);if(!i)return Mn(e),null;try{let n=JSON.parse(jn(i,"utf8"));return De.set(e,n),n}catch{return null}}function Un(e,i,n,o){let a=[];if(i.rotate)a.push(`rotate(${i.rotate*90} ${n/2} ${o/2})`);if(i.hFlip)a.push(`translate(${n} 0) scale(-1 1)`);if(i.vFlip)a.push(`translate(0 ${o}) scale(1 -1)`);return a.length?`<g transform="${a.join(" ")}">${e}</g>`:e}function Fn(e,i){let n=i,o=e.icons[n],a={hFlip:!1,vFlip:!1,rotate:0};for(let u=0;!o&&u<8;u++){let f=e.aliases?.[n];if(!f)return null;if(f.hFlip)a.hFlip=!a.hFlip;if(f.vFlip)a.vFlip=!a.vFlip;if(f.rotate)a.rotate=((a.rotate+f.rotate)%4+4)%4;n=f.parent,o=e.icons[n]}if(!o)return null;let c=o.width??e.width??24,l=o.height??e.height??24;return{body:Un(o.body,a,c,l),width:c,height:l}}function he(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);if(e.static[i]!==void 0)return String(e.static[i]);if(e.clientReactive[i]!==void 0)return e.clientReactive[i];return}var at={name:"Icon",aliases:["icon","stx-icon"],render(e,i,n){let o=he(e,"name")??he(e,"icon");if(!o)return"<!-- Icon: missing name/icon prop -->";let a="lucide",c=o;if(o.includes(":")){let w=o.split(":");a=w[0],c=w[1]}let l=r(he(e,"size")||"24"),u=r(he(e,"color")||"currentColor"),f=r(he(e,"class")||""),x=r(he(e,"style")||""),h=De.get(a)??zn(a);if(!h)return`<!-- Icon: collection "${a}" not loaded -->`;let d=Fn(h,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 S=f?` class="${f}"`:"",y=x?` style="${x}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${l}" height="${l}" viewBox="${C}" fill="none"${S}${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 ct={name:"Suspense",aliases:["suspense"],render(e,i,n){let o=Mt(i,"fallback"),a=o.rest,c=Mt(a,"error"),l=c.rest,u=o.region??jt(e,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',f=c.region??jt(e,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${u}</div><div data-stx-suspense-error hidden>${f}</div><div data-stx-suspense-content hidden>${l}</div></div>`}};function je(e,...i){for(let n of i){if(e.serverDynamic[n]!==void 0)return String(e.serverDynamic[n]);let o=e.static[n];if(typeof o==="string")return o}return}var lt={name:"TransitionGroup",aliases:["transition-group"],render(e,i,n){let o=(je(e,"name")||"v").replace(/["'<>]/g,""),a=(je(e,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",c=je(e,"class"),l=je(e,"id"),u=[`data-stx-transition-group="${o}"`,c?`class="${c}"`:"",l?`id="${l}"`:""].filter(Boolean).join(" ");return`<${a} ${u}>${i}</${a}>`}};function Lt(e=de){e.registerBuiltin(Ze),e.registerBuiltin(et),e.registerBuiltin(tt),e.registerBuiltin(rt),e.registerBuiltin(st),e.registerBuiltin(it),e.registerBuiltin(ot),e.registerBuiltin(at),e.registerBuiltin(ct),e.registerBuiltin(lt)}var zt=new Map;function Wn(e){let i=zt.get(e.source);if(!i)i=new RegExp(`(${e.source})(?![\\w.:-])`,"y"),zt.set(e.source,i);return i}var Ut=new WeakMap;function Ft(e){let i=Ut.get(e);if(!i)i=new Set([...e].map((o)=>o.toLowerCase())),Ut.set(e,i);let n=i;return(o)=>!/[a-z]/.test(o)&&n.has(o.toLowerCase())}function Hn(e,i){let n="";for(let o=i;o<e.length;o++){let a=e[o];if(n){if(a==="\\")o++;else if(a===n)n=""}else if(a==='"'||a==="'")n=a;else if(a===">")return o}return e.length}function Wt(e,i,n){let o=[],a=0,c=typeof n==="function"?n:n?(l)=>n.has(l.toLowerCase()):void 0;while(a<e.length){let l=e.indexOf("<",a);if(l===-1)break;let u=Wn(i);u.lastIndex=l+1;let f=u.exec(e);if(!f){a=l+1;continue}let x=f[1];if(c&&c(x)){let w=l+1+x.length;while(w<e.length&&e[w]!==">")w++;a=w+1;continue}let h=l+1+x.length,d=null,C=h,v=-1,S=!1;while(h<e.length){let w=e[h];if(d){if(w==="\\"&&h+1<e.length){h+=2;continue}if(w===d)d=null;h++;continue}if(w==='"'||w==="'"){d=w,h++;continue}if(w==="/"&&h+1<e.length&&e[h+1]===">"){v=h+2,S=!0;break}if(w===">"){v=h+1;break}h++}if(v===-1){a=l+1;continue}let y=e.slice(C,S?v-2:v-1).trim();if(S)o.push({fullMatch:e.slice(l,v),tagName:x,attributes:y,content:"",startIndex:l,endIndex:v,isSelfClosing:!0}),a=v;else{let w=`<${x}`,A=`</${x}>`,k=1,R=v,E=-1;while(k>0&&R<e.length){let U=e.indexOf(w,R),z=e.indexOf(A,R);if(z===-1)break;if(U!==-1&&U<z){let O=e[U+w.length];if(O===" "||O===">"||O==="/"||O===`
|
|
41
|
+
`||O==="\t"){let q=Hn(e,U+w.length);if(e[q-1]!=="/")k++;R=q+1}else R=U+w.length}else{if(k--,k===0){E=z;break}R=z+A.length}}if(E===-1){a=v;continue}let K=e.slice(v,E),L=E+A.length;o.push({fullMatch:e.slice(l,L),tagName:x,attributes:y,content:K,startIndex:l,endIndex:L,isSelfClosing:!1}),a=L}}return o}function ut(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function Ht(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 Me(e,i){let n=0,o="",a=i;while(a<e.length){let c=e[a];if(o){if(c==="\\")a++;else if(c===o)o=""}else if(c==='"'||c==="'"||c==="`")o=c;else if(c==="{")n++;else if(c==="}"){if(n--,n===0)return e.slice(i,a+1)}a++}return e.slice(i)}function qt(e){let i=e.trim();if(!i.startsWith("{")||!i.endsWith("}"))return null;if(Me(i,0).length!==i.length)return null;return i.slice(1,-1).trim()}function Xt(e){let i=[],n=0,o=e.length;while(n<o){while(n<o&&/\s/.test(e[n]))n++;if(n>=o)break;let a="";while(n<o&&!/[\s=]/.test(e[n]))a+=e[n],n++;if(!a)break;while(n<o&&/\s/.test(e[n]))n++;if(n<o&&e[n]==="="){n++;while(n<o&&/\s/.test(e[n]))n++;let c="";if(n<o&&(e[n]==='"'||e[n]==="'")){let l=e[n];n++;while(n<o&&e[n]!==l){if(e[n]==="\\"&&n+1<o)n++,c+=e[n];else c+=e[n];n++}if(n<o)n++}else if(e[n]==="{")c=Me(e,n),n+=c.length;else while(n<o&&!/\s/.test(e[n]))c+=e[n],n++;i.push({name:a,value:c})}else i.push({name:a,value:!0})}return i}var qn=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),Xn=new Set([":for","x-for","v-for","@for"]),Vt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Vn(e){return ft(e).map((i)=>[i.start,i.end])}function ft(e){let i=[],n=new Map;for(let o of Pe(e)){let a=o.name.toLowerCase();if(o.closing){let x=n.get(a)?.pop();if(x)x.end=o.end;continue}let l=/(?::for|x-for|v-for|@for)\s*=/.test(o.attributes)?Xt(o.attributes).find((x)=>Xn.has(x.name)):void 0,u=typeof l?.value==="string"?l.value:null,f=u!==null?{start:o.start,end:o.end,names:se(u),tag:a}:null;if(f)i.push(f);if(!o.selfClosing&&!Vt.has(a)){let x=n.get(a);if(!x)x=[],n.set(a,x);x.push(f)}}return i}var Zn=/(?:^|\s)((?:[\w-]+:)*-?space-[xy]-(?!reverse(?:\s|$))[\w./[\]-]+)(?=\s|$)/;function Zt(e){let i=new Map,n=[];for(let o of Pe(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&&!Vt.has(a)){let l=/(?:^|\s)class\s*=\s*(["'])([\s\S]*?)\1/.exec(o.attributes)?.[2];n.push({name:a,utility:l?Zn.exec(l)?.[1]??null:null,children:0})}}return i}function Gt(e){if(typeof e==="string")return e;if(Array.isArray(e))return e.filter(Boolean).map((i)=>Gt(i)).join(" ");if(e&&typeof e==="object")return Object.entries(e).filter(([,i])=>i).map(([i])=>i).join(" ");return e?String(e):""}function Pc(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(...Vn(e));let l=new Set([...gt(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=[],x=new Map,h=256;for(let d of Pe(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,"")),S=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,y,w=C,A=!1;while((y=S.exec(C))!==null){if(Nr(C,y.index,!0)?.kind==="attribute")continue;let k=y[1],R=y[2];if(Fl(k))continue;if(B(R,l))continue;if(R.includes("()")&&!R.includes(".get(")||R.includes("$store")||R.includes("$ref"))continue;try{let E=Object.keys(i),K=Object.values(i),L=R.match(/^([a-zA-Z_$][\w$]*)/);if(L&&!E.includes(L[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(L[1]))continue;let U=JSON.stringify([E,R]),z=x.get(U);if(!z){if(z=Function(...E,`return (${R})`),x.size>=h)x.clear();x.set(U,z)}let O=z(...K);if(k==="class"){let q=Y(Gt(O));if(q){let I=w.match(/\sclass="([^"]*)"/);if(I)w=w.replace(I[0],()=>` class="${I[1]} ${q}"`);else w=w.replace(y[0],()=>` class="${q}"`)}else w=w.replace(y[0],"");A=!0;continue}if(qn.has(k)){if(O)w=w.replace(y[0],` ${k}`);else w=w.replace(y[0],"");A=!0;continue}if(O===null||O===void 0||O===!1)w=w.replace(y[0],"");else{let q=v&&typeof O==="object"?JSON.stringify(O):String(O),I=In(k,q);w=w.replace(y[0],()=>` ${k}="${I}"`)}A=!0}catch(E){if(E instanceof me)throw E;continue}}if(A){let k=d.selfClosing?" /":"",E=`<${d.name}${w}${k}>`;f.push({start:d.start,end:d.end,replacement:E})}}if(f.length>0){let d=Array(f.length*2+1),C=0;for(let v=0;v<f.length;v++){let{start:S,end:y,replacement:w}=f[v];d[v*2]=n.slice(C,S),d[v*2+1]=w,C=y}d[f.length*2]=n.slice(C),n=d.join("")}return n}import Kt from"fs";import Jt from"path";var Yt=!1;function Gn(e,i,n,o=!1,a=new Set){let c={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},l=new Set(Array.isArray(i.__stx_client_signal_names)?i.__stx_client_signal_names:[]),u=(d)=>{if(l.size===0)return!1;let C=t(d),v=C.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(v&&l.has(v))return!0;for(let S of l){let y=S.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${y}\\s*\\(`).test(C))return!0}return!1},f=new Set(zl),x=(d)=>{if(!d.includes("-")||d.startsWith("@")||d.startsWith(":")||d.startsWith("x-")||d.startsWith("__"))return d;if(d.startsWith("aria-")||d.startsWith("data-"))return d;return d.replace(/-([a-z0-9])/g,(C,v)=>v.toUpperCase())},h=(d,C)=>{let v=x(d);if(c.static[v]=C,v!==d)c.staticNames[v]=d};for(let[d,C]of Object.entries(e)){let v=d.startsWith("x-")&&!f.has(d)&&!d.startsWith("x-bind:")&&!d.startsWith("x-on:")?`:${d.slice(2)}`:d;if(v.startsWith("@")){c.events[v]=C;continue}if(v.startsWith("__stx_")){let S=x(v.slice(6));c.serverDynamic[S]=Ht(C,n);continue}if(v.startsWith(":")){let S=x(v.slice(1)),y=C===ne?S:C;if(S==="if"||S==="for"||S==="show"){c.clientReactive[S]=y;continue}if(o){c.clientReactive[S]=y;continue}if(B(y,a)){c.clientReactive[S]=y;continue}if(u(y)){c.clientReactive[S]=y;continue}try{if(!m(y)){if(n.debug)console.error(`Unsafe expression in :${S} binding: ${y}`);c.clientReactive[S]=y;continue}let w=Object.keys(i),A=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(ht(y).some((L)=>!A.has(L)&&!w.includes(L)&&(!(L in globalThis)||k.has(L)))){c.clientReactive[S]=y;continue}let K=p(y,w)(...Object.values(i));if(c.serverDynamic[S]=K,S!==v.slice(1)&&c.serverDynamicNames)c.serverDynamicNames[S]=v.slice(1)}catch{c.clientReactive[S]=y}continue}if(typeof C==="string"&&C.includes("{{")&&C.includes("}}")){let S=Qn(C,a);if(S!==null){c.clientReactive[x(v)]=S;continue}let y=C.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(y)try{let w=y[1];if(m(w)){let k=p(w,Object.keys(i))(...Object.values(i));h(v,k!=null?String(k):"")}else{if(n.debug)console.error(`Unsafe expression in ${v}: ${w}`);h(v,C)}}catch(w){if(n.debug)console.error(`Error evaluating expression for ${v}:`,w);h(v,C)}else{let w=C,A=/\{\{\s*([\s\S]+?)\s*\}\}/g,k;while((k=A.exec(C))!==null)try{let R=k[1];if(!m(R)){if(n.debug)console.error(`Unsafe expression in ${v}: ${R}`);continue}let K=p(R,Object.keys(i))(...Object.values(i));w=w.replace(k[0],String(K??""))}catch(R){if(n.debug)console.error(`Error evaluating expression in ${v}:`,R)}h(v,w)}continue}h(v,C===ne?"true":ut(C))}return c}var dt=new Set;function cy(){dt.clear()}function Kn(e){let i=/^\s*(?:<!--[\s\S]*?-->\s*)*<(?:div|span)\b((?:[^>"']|"[^"]*"|'[^']*')*)>/.exec(e);return!!i&&/\sdata-stx-component-wrapper(?=[\s=]|$)/.test(i[1])&&!/\sstx-hydrate(?=[\s=]|$)/.test(i[1])}function Jn(e,i,n){let o=`${n}\x00${e}\x00${i}`;if(dt.has(o))return;dt.add(o);let a=/space-x-/.test(i)?"flex":"flex flex-col",c=i.replace(/space-[xy]-/,"gap-");console.warn(`[stx] <${e}> in ${n} is a later child of a "${i}" stack, so it gets no spacing: the utility puts its margin on the component's scope wrapper, which generates no box. Use "${a} ${c}" on the parent instead -- gap reaches through the wrapper.`)}var pt=new Set;function ly(){pt.clear()}function Yn(e,i){let n=`${i}\x00${e}`;if(pt.has(n))return;pt.add(n),console.warn(`[stx] <${e}> in ${i} is inside a <template :for>, so its props and slot expressions will not see the loop variables and render empty. Put the directive on the element the loop repeats instead -- <tr :for="..."> or <span :for="..." class="contents"> -- which binds correctly.`)}function Qn(e,i){if(i.size===0)return null;let n=/\{\{\s*([\s\S]+?)\s*\}\}/g,o=[...e.matchAll(n)];if(!o.some((u)=>B(u[1],i)))return null;let a=e.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(a&&o.length===1)return a[1];let c="",l=0;for(let u of o)c+=e.slice(l,u.index).replace(/[`\\$]/g,(f)=>`\\${f}`),c+=`\${${u[1]}}`,l=u.index+u[0].length;return c+=e.slice(l).replace(/[`\\$]/g,(u)=>`\\${u}`),`\`${c}\``}var er=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function tr(e,i,n){if(!e.includes("@"))return e;if(!er.some(([a,c])=>a.test(e)&&e.includes(c)))return e;try{return fe(e,i,n)}catch{return e}}function ye(e){let i={},n=0,o=e.length;while(n<o){while(n<o&&/\s/.test(e[n]))n++;if(n>=o)break;let a="";while(n<o&&!/[\s=]/.test(e[n]))a+=e[n],n++;if(!a)break;while(n<o&&/\s/.test(e[n]))n++;if(n<o&&e[n]==="="){n++;while(n<o&&/\s/.test(e[n]))n++;let c="";if(n<o&&(e[n]==='"'||e[n]==="'")){let l=e[n];n++;while(n<o){let u=e[n];if(u==="\\"&&n+1<o){n++,c+=e[n],n++;continue}if(u===l){n++;break}c+=u,n++}}else if(e[n]==="{"){c=Me(e,n),n+=c.length;let l=qt(c);if(l!==null){i[`:${a}`]=l;continue}}else while(n<o&&!/\s/.test(e[n]))c+=e[n],n++;i[a]=c}else i[a]=ne}return i}function Qt(e){return Object.entries(e).map(([i,n])=>n===ne?i:`${i}="${nr(n)}"`).join(" ")}function nr(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function rr(e){let i=new Set,n=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,o;while((o=n.exec(e))!==null){let a=o[1];if(de.isBuiltin(a))i.add(a)}return[...i].sort()}async function cg(e,i,n,o,a){if(!/import\s/.test(e))return e;if(!i.__importedComponents)i.__importedComponents=new Map;let c=i.__importedComponents,l=Jt.dirname(n),u=[],f=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let d of e.matchAll(f)){let[C,v,S]=d,y=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,w=S,A,k=[];while((A=y.exec(S))!==null){let[R,E,K,L]=A,U=null,z=null;if(L.startsWith(".")||L.startsWith("/")){let I=Jt.resolve(l,L);if(I.endsWith(".stx"))z=I;else{let _=`${I}.stx`;try{if(Kt.statSync(_).isFile())z=_}catch{try{if(Kt.statSync(I).isDirectory())U=I}catch{}}}}else U=Ks(L,l);if(!U&&!z)continue;let O=!1,q=(I,_)=>{c.set(I,_),c.set(I.toLowerCase(),_);let D=I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();c.set(D,_),a.add(_)};if(K&&z)q(K,z),O=!0;else if(E){let I=E.slice(1,-1).split(",").map((D)=>D.trim()).filter(Boolean).map((D)=>{let F=D.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(F)return{source:F[1],local:F[2]};return{source:D,local:D}}),_=U?Ar(U):null;for(let{source:D,local:F}of I){let j=null;if(z)j=z;else if(_)j=_.get(D)??_.get(D.toLowerCase())??_.get(D.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(j)q(F,j),O=!0}}if(O)k.push({start:A.index,end:A.index+R.length})}if(k.length===0)continue;for(let R=k.length-1;R>=0;R--)w=w.slice(0,k[R].start)+w.slice(k[R].end);u.push({start:d.index,end:d.index+C.length,value:`<script${v}>${w}</script>`})}if(u.length===0)return e;let x=[],h=0;for(let d of u)x.push(e.slice(h,d.start),d.value),h=d.end;return x.push(e.slice(h)),x.join("")}async function sr(e,i,n,o,a){let c=e;if(!i.__importedComponents)i.__importedComponents=new Map;let l=i.__importedComponents,u=/@import\s*\(\s*([^)]+)\s*\)/g,f;while((f=u.exec(c))!==null){let[x,h]=f,d=h.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$/,""),w=y.includes("-")?y.split("-").map((R)=>R.charAt(0).toUpperCase()+R.slice(1)).join(""):y.charAt(0).toUpperCase()+y.slice(1),A=null,k=Gs(C,n,o);for(let R of k)try{if(await Bun.file(R).exists()){A=R;break}}catch{}if(A){l.set(w,A),l.set(y,A),l.set(y.toLowerCase(),A);let R=w.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(l.set(R,A),a.add(A),o.debug)console.log(`Imported component: ${w} -> ${A}`)}else if(o.debug)console.warn(`Could not resolve imported component: ${C}`)}c=c.replace(x,""),u.lastIndex=0}return c}async function ir(e,i,n,o,a){let c=e,l=o.componentsDir||"components";if(!i.__processedComponents)i.__processedComponents=new Set;let u=i.__processedComponents,f=/@component\s*\(/g,x;while((x=f.exec(c))!==null){let h=x.index,d=h+x[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 S=c.substring(d+1,v),y=v+1,w=S.match(/^\s*['"]([^'"]+)['"]/);if(!w){f.lastIndex=y;continue}let A=w[1],k,R=S.slice(w[0].length),E=R.match(/^\s*,\s*/);if(E)k=R.slice(E[0].length).trim();let K={};if(k)try{K=N(k,i)}catch(I){let _=I instanceof Error?I.message:String(I);c=c.replace(c.substring(h,y),`[Error parsing component props: ${_}]`);continue}let L="",U=y,O=c.substring(y).match(/^([\s\S]*?)@endcomponent/);if(O)L=O[1].trim(),U=y+O[0].length;let q=await Je(A,K,L,l,i,n,o,u,a);c=c.substring(0,h)+q+c.substring(U),f.lastIndex=0}return c}async function or(e,i,n,o,a){if(!e)return e;let c=e,l=o.componentsDir||"components";if(!i.__processedComponents)i.__processedComponents=new Set;let u=i.__processedComponents,f=lr(c);if(f.size>0){let y=Array.isArray(i.__stx_client_declared_names)?i.__stx_client_declared_names:[];i.__stx_client_declared_names=[...new Set([...y,...f])]}let x=re(c);c=x.output;let h=gt(i);return c=await S(c,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),c=await S(c,/[A-Z][a-zA-Z0-9]*/,!0,Ft(Mr)),c=await S(c,/[a-z][a-z0-9]*/,!1,Mr),c=x.restore(c),c;async function S(y,w,A,k){if(!y)return y;let R=y,E=Wt(R,w,k),K=ft(R),L=!o._nativeHostAttrs&&/space-[xy]-/.test(R),U,z=new Map;for(let I=E.length-1;I>=0;I--){let _=E[I],D=A?X(_.tagName):_.tagName,F=ye(tr(_.attributes,i,n)),j=K.filter(({start:T,end:W})=>_.startIndex>=T&&_.startIndex<W);if(j.some((T)=>T.tag==="template"))Yn(_.tagName,n);let te=j.length>0,ae=new Set(h);for(let T of j)for(let W of T.names)ae.add(W);let M=Gn(F,i,o,te,ae);if(typeof M.clientReactive.for==="string")for(let T of se(M.clientReactive.for))ae.add(T);let V=de.getBuiltin(_.tagName),Re=V?await jr(_.tagName,l,i,n,o):!1,be=_.tagName==="Image"&&Xs([...Object.keys(M.static),...Object.keys(M.serverDynamic),...Object.keys(M.clientReactive)],Object.keys(M.events),{...M.static,...M.serverDynamic})&&(o._pluginComponentDirs??[]).some((T)=>Ar(T).has("Image"));if(V&&!Re&&!be){let T={context:i,filePath:n,options:o,dependencies:a},W=V.render(M,_.content,T);if(Object.keys(M.events).length>0){let ce=Qt(M.events);W=W.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${ce}`)}if(Object.keys(M.clientReactive).length>0)W=en(W,M.clientReactive);z.set(I,W);continue}if(!A&&_.tagName.includes("-")&&!await jr(D,l,i,n,o))continue;let le={};for(let[T,W]of Object.entries(M.static))le[T]=W;for(let[T,W]of Object.entries(M.serverDynamic))le[T]=W;let Q={declaredProps:new Set,consumedProps:new Set,reactiveProps:Object.keys(M.clientReactive),events:Object.keys(M.events)},Z=await Je(D,le,x.restore(_.content),l,i,n,o,u,a,[...ae],Q,_.tagName);if(L&&Kn(Z)){U??=Zt(R);let T=U.get(_.startIndex);if(T)Jn(_.tagName,T,n)}let P=Z;if(P=ar(P,M,Q.declaredProps,Q.consumedProps,o._nativeHostAttrs),o._nativeHostAttrs){let T=Q.reactiveProps.filter((ee)=>!Q.consumedProps.has(ee)&&!["if","for","show","key","ref"].includes(ee)).map(X),W=mt(P,!0);if(T.length&&W){if(!Object.hasOwn(ye(P.slice(W.insertPos,W.tagEnd)),"data-stx-native-host-root"))P=P.slice(0,W.insertPos)+' data-stx-native-host-root="true"'+P.slice(W.insertPos);let ee=Ce(P);P=P.slice(0,ee.insertPos)+` data-stx-native-forward="${T.join(" ")}"`+P.slice(ee.insertPos)}let ce=mt(P,!0);if(ce){let ee=ye(P.slice(ce.insertPos,ce.tagEnd)),ke=Ce(P),nn=ye(P.slice(ke.insertPos,ke.tagEnd));if(Object.hasOwn(ee,"data-stx-native-host-root")&&!Object.hasOwn(nn,"data-stx-native-host-owner"))P=P.slice(0,ke.insertPos)+" data-stx-native-host-owner"+P.slice(ke.insertPos)}}if(Object.keys(M.events).length>0){let T=Ce(P);if(T){let W=Qt(M.events),ce=Object.keys(M.events).map((ee)=>ee.replace(/^@/,"").split(".")[0]).join(" ");P=P.substring(0,T.insertPos)+` data-stx-parent-events="${ce}" ${W}`+P.substring(T.insertPos)}}if(Object.keys(M.clientReactive).length>0)P=en(P,M.clientReactive);z.set(I,P)}if(z.size===0)return R;let O="",q=0;for(let I=0;I<E.length;I++){let _=z.get(I);if(_===void 0)continue;O+=R.slice(q,E[I].startIndex),O+=_,q=E[I].endIndex}return O+=R.slice(q),O}}function en(e,i){let n=new Set(["if","for"]),o=new Set(["show"]),a=Object.entries(i).filter(([h])=>!n.has(h)),c=a.filter(([h])=>!o.has(h)).map(([h])=>X(h)).join(" "),l=e,u=a.length>0?Ce(l):null;if(u){let h=a.map(([C,v])=>`:${X(C)}="${v.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 x=i.for;if(x){let h=i.key,d=h?` :key="${h.replace(/"/g,""")}"`:"";l=`<template :for="${x.replace(/"/g,""")}"${d}>${l}</template>`}return l}function ar(e,i,n=new Set,o=new Set,a=!1){let c=mt(e,a);if(!c)return e;let l=e.slice(c.insertPos,c.tagEnd),u=i.serverDynamic.class??i.static.class;if(a&&typeof u==="string"&&u&&!o.has("class")){let S=/(^|\s)class\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i,y=S.test(l)?l.replace(S,(w,A,k,R,E)=>`${A}class="${r(`${ut(k??R??E)} ${u}`)}"`):` class="${r(u)}"${l}`;e=e.slice(0,c.insertPos)+y+e.slice(c.tagEnd),c.tagEnd+=y.length-l.length,l=y}let f=a||/\bdata-native(?:\s|=)/i.test(l),x=f?o:n,h=new Set(Object.keys(ye(l))),d=new Set(["class","className"]);for(let S of Object.keys(i.static)){let y=i.staticNames[S]??S;if(h.has(y)||x.has(S)||!f&&!Ve(y))d.add(S)}for(let S of Object.keys(i.serverDynamic)){let y=i.serverDynamicNames?.[S]??S;if(h.has(y)||x.has(S)||!f&&!Ve(y))d.add(S)}let C=[];if(f){for(let[S,y]of Object.entries(i.static)){if(d.has(S)||y!==!0&&y!==ne)continue;d.add(S),C.push(`${r(i.staticNames?.[S]??S)}="true"`)}for(let[S,y]of Object.entries(i.serverDynamic)){if(d.has(S)||y!==!0)continue;d.add(S),C.push(`${r(i.serverDynamicNames?.[S]??S)}="true"`)}}let v=[...ie(i,d),...oe(i,d),...C];if(f){for(let[S,y]of Object.entries(i.serverDynamic)){if(d.has(S)||y!==!1)continue;let w=i.serverDynamicNames?.[S]??S;v.push(`${r(w)}="false"`)}for(let[S,y]of Object.entries(i.serverDynamic)){if(d.has(S)||y===null||typeof y!=="object")continue;let w=JSON.stringify(y);if(w!==void 0){let A=i.serverDynamicNames?.[S]??S;v.push(`${r(A)}="${r(w)}"`)}}}if(v.length===0)return e;return`${e.slice(0,c.insertPos)} ${v.join(" ")}${e.slice(c.insertPos)}`}function Ce(e){let i=tn(e,0);if(i)return i;let n=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(e);if(n)return{insertPos:n.index+1+n[1].length,tagEnd:yt(e,n.index+1+n[1].length)};return null}function mt(e,i=!1){let n=Ce(e);if(!n)return null;let o=e.slice(n.insertPos,n.tagEnd),a=/\bdata-stx-component-wrapper(?:\s|=|>|$)/i.test(o)?tn(e,n.tagEnd+1):n;return a&&i?cr(e,a)??a:a}function cr(e,i){if(!e.includes("data-stx-native-host-root"))return null;let n=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),o=e.lastIndexOf("<",i.insertPos),a=0,c;while(o>=0&&o<e.length){if(e.startsWith("<!--",o)){let h=e.indexOf("-->",o+4);if(h<0)return null;o=e.indexOf("<",h+3);continue}let l=/^<(\/?)([a-z][\w-]*)\b/i.exec(e.slice(o));if(!l){o=e.indexOf("<",o+1);continue}let u=l[2].toLowerCase(),f=o+l[0].length,x=yt(e,f);if(l[1]){if(a--,c!==void 0&&a<c)c=void 0;if(a<=0)return null}else if(u==="script"||u==="style"){let h=new RegExp(`</${u}\\s*>`,"gi");if(h.lastIndex=x+1,!h.exec(e))return null;o=e.indexOf("<",h.lastIndex);continue}else{let h=ye(e.slice(f,x)),d=a>0&&(Object.hasOwn(h,"data-stx-component-wrapper")||Object.hasOwn(h,"data-stx-native-host-owner"));if(c===void 0&&!d&&Object.hasOwn(h,"data-stx-native-host-root"))return{insertPos:f,tagEnd:x};if(!n.has(u)&&e[x-1]!=="/"){if(a++,c===void 0&&d)c=a}else if(a===0)return null}o=e.indexOf("<",x+1)}return null}function tn(e,i){let n=i;while(n<e.length){let o=e.slice(n),a=o.match(/^\s+/);if(a){n+=a[0].length;continue}if(o.startsWith("<!--")){let u=e.indexOf("-->",n+4);if(u===-1)return null;n=u+3;continue}let c=o.match(/^<(script|style)\b[^>]*>/i);if(c){let u=`</${c[1].toLowerCase()}>`,f=e.toLowerCase().indexOf(u,n+c[0].length);if(f===-1)return null;n=f+u.length;continue}let l=o.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!l)return null;return{insertPos:n+1+l[1].length,tagEnd:yt(e,n+1+l[1].length)}}return null}function yt(e,i){let n="";for(let o=i;o<e.length;o++){let a=e[o];if(n){if(a==="\\")o++;else if(a===n)n=""}else if(a==='"'||a==="'")n=a;else if(a===">")return o}return e.length}function lr(e){let i=new Set;for(let n of e.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)){let o=n[1];if(!/\bclient\b/.test(o)||/\bserver\b/.test(o))continue;for(let a of Ai(n[2]))i.add(a);for(let a of n[2].matchAll(/^\s*import\s+(?:type\s+)?(?:([\w$]+)\s*,?\s*)?(?:\{([^}]*)\}|\*\s+as\s+([\w$]+))?\s*from\s/gm)){if(a[1])i.add(a[1]);if(a[3])i.add(a[3]);for(let c of(a[2]??"").split(",")){let l=c.replace(/^\s*type\s+/,"").split(/\s+as\s+/).pop().trim();if(/^[A-Za-z_$][\w$]*$/.test(l))i.add(l)}}}return i}async function Cs(e,i,n,o,a){if(!Yt)Lt(de),Yt=!0;let c=await cg(e,i,n,o,a);c=await sr(c,i,n,o,a),c=await ir(c,i,n,o,a);let l=[];for(let u=0;u<3;u++){let f=l.length,x=xe(c,We,(d,C)=>`\x00STX_COMPONENT_COMMENT_${f+C}\x00`,`STX_COMPONENT_COMMENT:${f}`);l.push(...x.tokens);let h=c;if(c=await or(x.output,i,n,o,a),c===h)break}if(l.length>0)c=c.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(u,f)=>l[Number(f)]??"");if(o.debug){let u=rr(c);if(u.length>0)console.warn(`[stx] ${n}: unresolved component tag(s) after render passes: ${u.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return c}
|
|
42
|
+
export{ti,ni,ri,iy,_s,ay,Pc,cy,ly,cg,Cs};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var d=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],u=/<body\b([^>]*)>/gi;function
|
|
3
|
-
export{
|
|
2
|
+
var d=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],u=/<body\b([^>]*)>/gi;function U(n){let i=0,e,c=d.map(()=>{return});while(i<n.length){if(e===void 0||e!==null&&e.index<i)u.lastIndex=i,e=u.exec(n);if(!e)return null;let a=e.index,r=-1,o=null;for(let l=0;l<d.length;l++){let g=d[l],t=c[l];if(t===void 0||t!==null&&t.index<i)g.open.lastIndex=i,t=g.open.exec(n),c[l]=t;if(!t)continue;if(t.index<a&&(r===-1||t.index<r))r=t.index,o=g.close}if(r===-1||!o)return{index:a,tag:e[0],attrs:e[1]??""};o.lastIndex=r;let s=o.exec(n);if(!s)return null;i=s.index+s[0].length}return null}function ct(n,i){let e=U(n);if(!e)return n;return n.slice(0,e.index)+i(e.tag,e.attrs)+n.slice(e.index+e.tag.length)}
|
|
3
|
+
export{U,ct};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{wn,Go,Xo,Jo,ey,Yo}from"./chunk-tgzs1kbj.js";import"./chunk-ssg6ne5b.js";import"./chunk-agd2b928.js";import"./chunk-6t04tqvh.js";export{Xo as buildServerApi,ey as createServerApi,wn as discoverServerApi,Go as generateApiTypes,Yo as isServerApiSource,Jo as productionApiDispatcher};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{fr,Fe}from"./chunk-9f31gs4m.js";import{G,S,Pr,Js,A}from"./chunk-p55a910x.js";import{a,L}from"./chunk-ec5q4nnw.js";import{Yo}from"./chunk-tgzs1kbj.js";import{Z}from"./chunk-nb6erf75.js";import{ft}from"./chunk-6c1vm6bs.js";import{l}from"./chunk-s7xywsqd.js";import{t,C}from"./chunk-yh2hnt3m.js";import d from"path";import j from"fs";import{AsyncLocalStorage as lt}from"async_hooks";import{randomUUID as St}from"crypto";var vt=12;function X(e,n,s){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(d.basename(e))||Yo(e,n,s)}var ct=2;function Kf(e){let n=process.env.STX_BUNDLE_CACHE_DIR?.trim();return n?d.resolve(n):l(e,"bundle-cache")}function rt(e,n){let s=e;for(let i of Bt(n))if(i!==d.sep)s=s.split(i).join("\x00root");return s}var it=new Map;function Bt(e){let n=d.resolve(e),s=it.get(n);if(!s){let i=n;try{i=j.realpathSync(n)}catch{}s=[...new Set([n,i])].sort((c,p)=>p.length-c.length),it.set(n,s)}return s}function jt(e,n){try{let s=j.statSync(e),i=d.resolve(n),c=e.startsWith(`${i}${d.sep}`);return{path:c?d.relative(i,e):e,...c?{inRoot:!0}:{},mtimeMs:s.mtimeMs,size:s.size,hash:Bun.hash(j.readFileSync(e)).toString(36)}}catch{return null}}function ut(e,n){return e.inRoot?d.join(d.resolve(n),e.path):e.path}function Et(e,n){for(let s of e){let i=ut(s,n);try{let c=j.statSync(i);if(c.size!==s.size)return!1;if(c.mtimeMs!==s.mtimeMs&&Bun.hash(j.readFileSync(i)).toString(36)!==s.hash)return!1}catch{return!1}}return!0}var dt=new Map,_t=100;function Gf(e=process.env){let n=Number(e.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(n)&&n>=1?Math.floor(n):2000}var q=new Map;async function Mt(e){let n=q.get(e)??0;if(n>0&&n<_t){q.set(e,n+1);return}q.set(e,1);try{let s=(await j.promises.readdir(e)).filter((o)=>o.endsWith(".js")),i=Gf();if(s.length<=i)return;let p=(await Promise.all(s.map(async(o)=>{try{return{name:o,at:(await j.promises.stat(d.join(e,o))).mtimeMs}}catch{return null}}))).filter((o)=>o!==null);p.sort((o,b)=>b.at-o.at);for(let o of p.slice(i)){let b=o.name.slice(0,-3);await j.promises.rm(d.join(e,`${b}.js`),{force:!0}),await j.promises.rm(d.join(e,`${b}.deps.json`),{force:!0})}N("pruned bundle cache to",i,"entries")}catch{}}function Ce(e){return dt.get(e)??[]}function Y(e,n){if(e)dt.set(e,n)}function Xf(e=process.env){return e.STX_DEBUG==="true"||e.STX_DEBUG==="1"}function N(...e){if(Xf())console.log("[stx:bundler]",...e)}var et=[];function kc(e,n,s){et.push({filePath:e||"<inline>",message:n,details:s})}function gn(){return et.slice()}function mn(){et.length=0}var K;function Zh(e){K=e}function _c(){if(K)return K;try{let e=L.strict;return typeof e==="object"&&e!==null?e.bundlerFallback??"warn":"warn"}catch{return"warn"}}var tt=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function hn(e){let n=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,s;while((s=n.exec(e))!==null){let c=s[1];if(!tt.some((o)=>o.test(c)))return N("detected user import:",c),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((s=i.exec(e))!==null){let c=s[1];if(/\.css(?:\?.*)?$/.test(c))continue;if(!tt.some((o)=>o.test(c)))return N("detected side-effect import:",c),!0}return!1}var pr="stx-module:",Rt=/\.(?:[cm]?[jt]sx?|json)$/i;function Jf(e,n){return d.relative(e,n).split(d.sep).join("/")}function Yf(e,n){if(n.size===0)return e;return e.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(s,i,c,p)=>{let o=n.get(p);return o&&!p.startsWith(pr)?`${i}${c}${o}${c}`:s})}function Zf(e,n){let s=0,i=(p)=>{let o=`__stxMod${s++}`,b=JSON.stringify(p);return n.push(`var ${o} = globalThis.__stxModules && globalThis.__stxModules[${b}];`,`if (${o} === undefined) throw new Error("[stx] module " + ${JSON.stringify(b)} + " is not registered on this page (#1957)");`),o},c=(p,o)=>{for(let b of p.split(",")){let I=b.trim();if(!I)continue;let M=I.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!M)continue;let w=M[1].startsWith('"')?JSON.parse(M[1]):M[1],f=M[2]??w;n.push(`var ${f} = ${o}[${JSON.stringify(w)}];`)}};return e=e.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,o,b)=>{let I=b.slice(pr.length),M=i(I),w=o.trim(),f=w.match(/^([\w$]+)\s*(?:,\s*|$)/);if(f&&!w.startsWith("{")&&!w.startsWith("*"))n.push(`var ${f[1]} = ${M}.default;`),w=w.slice(f[0].length).trim();let v=w.match(/^\*\s*as\s+([\w$]+)$/);if(v)n.push(`var ${v[1]} = ${M};`);else if(w.startsWith("{"))c(w.replace(/^\{|\}$/g,""),M);return""}),e=e.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,o)=>(i(o.slice(pr.length)),"")),e}function ot(e){let n=[e,`${e}.ts`,`${e}.tsx`,`${e}.js`,`${e}.mjs`,`${e}.jsx`,d.join(e,"index.ts"),d.join(e,"index.tsx"),d.join(e,"index.js"),d.join(e,"index.mjs")];for(let s of n)try{if(j.existsSync(s)&&j.statSync(s,{throwIfNoEntry:!1})?.isFile())return s}catch{}return}var H=new lt;function ws(e,n){let s=new Bun.CryptoHasher("md5");for(let[i,c]of[...e].sort(([p],[o])=>p<o?-1:p>o?1:0))s.update(`${i}\x00${c}\x00`);return H.run({modules:e,key:s.digest("hex").slice(0,12)},n)}var pt=new lt;function Qf(e){return pt.run(!0,e)}function eg(){return pt.getStore()===!0}function Cc(e){if(!eg())return;throw Error(`The client script of ${e} needs bundling, and it is being rendered inside a Bun.build loader, where Bun never finishes a second build. Make the page an entrypoint of the build (bun-plugin-stx renders entrypoints before the bundler starts), or render it once outside the build so its bundle is cached.`)}function yn(){return H.getStore()?.key??""}function mt(e,n,s,i,c,p,o=new Map,b,I,M){let w=new Map([[s,i],...M??[]]),f=(B)=>B!==void 0&&w.has(B),v=(B,r,u)=>{if(X(r,e,b))return null;if(!p||!f(B)||!Rt.test(r))return null;try{if(!j.statSync(r,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}c.add(r);let E=`${pr}${Jf(process.cwd(),r)}`;return o.set(u,E),{path:E,external:!0}},y=(B,r)=>{let u=f(B)?n:d.dirname(B),E=d.resolve(u,r);return ot(E)??E};return{name:"stx-client-bundle",setup(B){if(B.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(r)=>({path:r.path,external:!0})),B.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(r)=>({path:r.path,external:!0})),B.onResolve({filter:/^\//},(r)=>{if(f(r.path))return{path:r.path};let u=ot(r.path);if(u){let E=v(r.importer,u,r.path);if(E)return E;if(!f(u))c.add(u);return{path:u}}return{path:r.path,external:!0}}),B.onResolve({filter:/^\.\.?\//},(r)=>{let u=y(r.importer,r.path),E=v(r.importer,u,r.path);if(E)return E;return c.add(u),{path:u}}),B.onResolve({filter:/^[@~]\//},(r)=>{let u=d.resolve(e,r.path.slice(2)),E=[u,`${u}.ts`,`${u}.tsx`,`${u}.js`,`${u}.mjs`,`${u}.jsx`,d.join(u,"index.ts"),d.join(u,"index.tsx"),d.join(u,"index.js"),d.join(u,"index.mjs")];for(let h of E)if(j.existsSync(h)&&j.statSync(h,{throwIfNoEntry:!1})?.isFile()){let D=v(r.importer,h,r.path);if(D)return D;return N(`resolved ${r.path[0]}/ import:`,r.path,"\u2192",h),c.add(h),{path:h}}return console.warn(`[stx:bundler] could not resolve ${r.path[0]}/ import:`,r.path),{path:u}}),p)B.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(r)=>{if(!f(r.importer))return;let u=`${pr}npm:${r.path}`;return o.set(r.path,u),{path:u,external:!0}});B.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(r)=>{if(w.has(r.path))return{contents:w.get(r.path),loader:"ts"};if(X(r.path,e,b))throw Error(`Server-only API source cannot be imported by a client script: ${r.path}`);let u=d.extname(r.path).toLowerCase(),E=u===".json"?"json":u===".tsx"?"tsx":u===".jsx"?"jsx":u===".ts"||u===".mts"||u===".cts"?"ts":"js";if(!f(r.path))c.add(r.path);let h=I?.get(r.path);if(h!==void 0)return{contents:h,loader:"js"};return{contents:j.readFileSync(r.path,"utf8"),loader:E}})}}}var Q=new Map,V=S(64),at=Symbol.for("stx.client-bundle-build-queue");function tg(e){let n=globalThis,i=(n[at]??Promise.resolve()).then(e,e);return n[at]=i.then(()=>{return},()=>{return}),i}async function bn(e,n,s={}){let i=s.projectRoot||process.cwd(),c=(await a(i)).serverApi,p=s.minify??!1,o=s.externalizeUserModules??!0,b=s.expose?.length?[...new Set(s.expose)].sort():void 0,I=s.cacheDir||Kf(i),M=H.getStore(),w=new Bun.CryptoHasher("md5");w.update(`${vt}\x00${ft()}\x00${JSON.stringify(c??!1)}\x00${o?"registry":"inline"}\x00${b?b.join(","):"*"}\x00${p?"minified":"readable"}\x00${M?.key??""}\x00${rt(e,i)}\x00${rt(n,i)}`);let f=w.digest("hex").slice(0,12),v=d.join(I,`${f}.js`),y=V.get(v);if(y){if(Js(y.files)&&y.files.every((h)=>!X(h.path,i,c))){N("memo hit:",f);let h=y.files.map((D)=>D.path);return Y(n,h),s.collectInputs?.push(...h),y.code}V.delete(v),N("memo invalidated by dep change:",f)}let B=d.join(I,`${f}.deps.json`),r=Bun.file(v);if(await r.exists()){let h=Bun.file(B),D=!1,k=null;if(await h.exists())try{let O=JSON.parse(await h.text());if(O.metadataVersion===ct&&Array.isArray(O.files)&&Et(O.files,i))k=Pr(O.files.map((g)=>ut(g,i))),D=k.length===O.files.length&&!k.some((g)=>X(g.path,i,c))}catch{D=!1}if(D){if(N("cache hit:",f),k)Y(n,k.map((U)=>U.path)),s.collectInputs?.push(...k.map((U)=>U.path));let O=await r.text(),g=new Date;if(j.promises.utimes(v,g,g).catch(()=>{}),k)V.set(v,{code:O,files:k});return O}N("cache invalidated by dep change:",f)}let u=Q.get(f);if(u){let h=await u;if(s.collectInputs)s.collectInputs.push(...(V.get(v)?.files??[]).map((D)=>D.path));return h}Cc(n);let E=tg(()=>Ft(e,n,{projectRoot:i,minify:p,cacheDir:I,hash:f,cachePath:v,depsPath:B,collectInputs:s.collectInputs,externalizeUserModules:o,serverApi:c,expose:b,throwOnFailure:s.throwOnFailure,substitutes:M?.modules}));Q.set(f,E);try{return await E}finally{Q.delete(f)}}function Ec(e){return`${e}-${process.pid}-${St()}`}async function Qh(e,n){let{projectRoot:s}=n,i=Ec(new Bun.CryptoHasher("md5").update([...e.keys()].join("\x00")).digest("hex").slice(0,12)),c=d.join(l(s,"bundle-tmp"),"out",i);j.mkdirSync(c,{recursive:!0});let p=new Map,o=new Map,b=0;for(let[f,v]of e){let y=d.join(s,`.stx-split-${i}-${b++}.ts`);p.set(y,v),o.set(d.basename(y).replace(/\.ts$/,""),f)}let[I,M]=[...p][0],w=new Set;Cc(n.filePath);try{let f=await Bun.build({entrypoints:[...p.keys()],outdir:c,target:"browser",format:"esm",splitting:!0,minify:!1,naming:{entry:"[name].js",chunk:"chunk-[hash].js"},plugins:[mt(s,d.dirname(n.filePath),I,M,w,!1,new Map,void 0,H.getStore()?.modules,p)],define:{"process.env.NODE_ENV":'"development"',...A()},root:s});if(!f.success)throw Error(f.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ")||"Unable to bundle the entries");let v={entries:new Map,chunks:new Map};for(let y of f.outputs){let B=d.basename(y.path);if(y.kind==="entry-point"){let r=o.get(B.replace(/\.js$/,""));if(r!==void 0)v.entries.set(r,await y.text())}else if(y.kind==="chunk")v.chunks.set(B.replace(/\.js$/,""),await y.text())}return n.collectInputs?.push(...w),v}finally{try{j.rmSync(c,{recursive:!0,force:!0})}catch{}}}async function Ft(e,n,s){let{projectRoot:i,minify:c,cacheDir:p,hash:o,cachePath:b,depsPath:I,externalizeUserModules:M}=s,w=l(i,"bundle-tmp"),f=Ec(o),v=d.join(i,`.stx-client-${f}.ts`),y=d.join(w,"out",f);j.mkdirSync(y,{recursive:!0});let B=d.dirname(n),r=new Set,u=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,E=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,h=t(e),{depths:D,balanced:k}=C(h),O=(R)=>!k||D[R]===0,g;while((g=u.exec(h))!==null){if(g[1])continue;if(!O(g.index))continue;if(g[2])g[2].split(",").forEach((R)=>{let m=It(R);if(m)r.add(m)});else if(g[3])r.add(g[3])}while((g=E.exec(h))!==null){if(g[1])continue;if(!O(g.index))continue;r.add(g[2])}let U=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=U.exec(h))!==null){if(!O(g.index))continue;let R=/^\s*['"]([^'"]+)['"]/.exec(e.slice(g.index+g[0].length))?.[1];if(R&&tt.some((m)=>m.test(R)))continue;if(g[1])r.add(g[1]);if(g[2])r.add(g[2]);for(let m of(g[3]??"").split(",")){let _=m.trim();if(!_||/^type\s/.test(_))continue;let P=/\bas\s+(\w+)\s*$/.exec(_)?.[1]??/^\w+$/.exec(_)?.[0];if(P)r.add(P)}}for(let R of h.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let m of R[1].split(",")){let _=/\bas\s+(\w+)\s*$/.exec(m)?.[1]??/^\s*(\w+)\s*$/.exec(m)?.[1];if(_)r.delete(_)}let gt=r.size>0?`
|
|
3
|
+
export { ${[...r].join(", ")} }`:"";N("bundling:",o,"from:",d.basename(n));let nt=new Set,st=new Map;try{let R=await Bun.build({entrypoints:[v],outdir:y,target:"browser",format:"esm",minify:c?{whitespace:!1,identifiers:!0,syntax:!0}:!1,plugins:[mt(i,B,v,e+gt,nt,M,st,s.serverApi,s.substitutes)],define:{"process.env.NODE_ENV":c?'"production"':'"development"',...A()},root:i});if(!R.success){let F=R.logs.filter((T)=>T.level==="error").map((T)=>T.message).join(", ")||`Unable to bundle ${d.basename(n)}`,z=fr(R.logs,n||void 0);if(console.warn("[stx:bundler] build failed:",F),kc(n||"",F,z),s.throwOnFailure||_c()==="error")throw Error(F);return e}let m="";for(let x of R.outputs){m=await x.text();break}let _=[];for(let x of m.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let F of x[1].split(",")){let z=F.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(z){_.push([z[2],z[1]]);continue}let T=F.trim();if(/^[A-Za-z_$][\w$]*$/.test(T))_.push([T,T])}if(s.expose){let x=new Set(s.expose);for(let F=_.length-1;F>=0;F--)if(!x.has(_[F][0]))_.splice(F,1)}let P=[];m=Zf(Yf(m,st),P);let ht=m.match(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm)||[];if(m=m.replace(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),c&&m)try{m=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(m)}catch{}let xt=Z(m),W=`__stxBundle_${o}`,yt=new Set(G(e,!0).split(",").map((x)=>x.trim())),$t=_.map(([x,F])=>`get ${JSON.stringify(x)}() { return ${F} }${yt.has(x)?`, set ${JSON.stringify(x)}(__stxValue_${F}) { ${F} = __stxValue_${F} }`:""}`).join(", "),bt=_.map(([x])=>`var ${x} = undefined;`).join(`
|
|
4
|
+
`),wt=_.map(([x])=>`${x} = ${W}[${JSON.stringify(x)}];`).join(`
|
|
5
|
+
`);if(m=`${ht.join(`
|
|
6
|
+
`)}
|
|
7
|
+
${bt}
|
|
8
|
+
var ${W} = ${xt?"await (async function":"(function"}() {
|
|
9
|
+
${P.join(`
|
|
10
|
+
`)}
|
|
11
|
+
${m}
|
|
12
|
+
return { ${$t} };
|
|
13
|
+
})();
|
|
14
|
+
${wt}
|
|
15
|
+
var __stxLiveBindings = typeof __stxLiveBindings === 'undefined' ? {} : __stxLiveBindings;
|
|
16
|
+
Object.keys(${W}).forEach(function(name) {
|
|
17
|
+
if (!Object.prototype.hasOwnProperty.call(__stxLiveBindings, name))
|
|
18
|
+
Object.defineProperty(__stxLiveBindings, name, Object.getOwnPropertyDescriptor(${W}, name));
|
|
19
|
+
});`.trim(),N("bundled:",o,"output:",m.length,"bytes"),r.size>0&&_.length===0)return console.warn(`[stx:bundler] dropped every binding for ${d.basename(n)} (${o}); serving the unbundled source and not caching this result`),e;j.mkdirSync(p,{recursive:!0}),await Bun.write(b,m);let J=Pr(nt);return await Bun.write(I,JSON.stringify({metadataVersion:ct,files:J.map((x)=>jt(x.path,i)).filter((x)=>x!==null)})),Y(n,J.map((x)=>x.path)),s.collectInputs?.push(...J.map((x)=>x.path)),V.set(b,{code:m,files:J}),await Mt(p),m}catch(R){let m=fr(R,n||void 0),_=Fe(R,n||void 0);if(console.warn(`[stx:bundler] error: ${_}`),kc(n||"",_,m),s.throwOnFailure||_c()==="error")throw R;return e}finally{try{j.rmSync(y,{recursive:!0,force:!0})}catch{}}}function It(e){let n=e.trim();if(!n)return null;let s=n.indexOf("=");if(s!==-1)n=n.slice(0,s).trim();let i=n.indexOf(":");if(i!==-1)n=n.slice(i+1).trim();if(n.startsWith("..."))n=n.slice(3).trim();return/^[A-Za-z_$][\w$]*$/.test(n)?n:null}
|
|
20
|
+
export{Kf,Gf,Ce,Xf,kc,gn,mn,Zh,_c,hn,pr,Jf,Yf,Zf,ws,Qf,eg,Cc,yn,tg,bn,Ec,Qh};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{ce,le,ue,Kn,_e,Be,Et,cn,Gn,Xn,Jn,de,Yn,Zn}from"./chunk-q74affc4.js";import{Ot}from"./chunk-ymqm898x.js";function nu(s,r={}){let{src:e,alt:t,width:n,height:a,sizes:i="100vw",loading:m="lazy",priority:o=!1,quality:u=ue,placeholder:l="none",formats:f=le,widths:y=ce,decoding:c="async",fetchpriority:h,objectFit:d,objectPosition:g}=s,{class:p,style:v}=s,{processedImage:w,variants:I,optimize:b=!0,isDev:A=!1}=r;if(I&&I.length>0)return J(s,I,w);if(A||!b)return K(s);return Z(s)}function J(s,r,e){let{src:t,alt:n,width:a,height:i,sizes:m="100vw",loading:o="lazy",priority:u=!1,decoding:l="async",fetchpriority:f,objectFit:y,objectPosition:c,placeholder:h="none"}=s,{class:d,style:g}=s,p=Xn(r),v=Gn(r),w=typeof m==="object"?cn(m):m,I=e?e.aspectRatio:a&&i?Number(a)/Number(i):void 0,b=[];if(I)b.push(`aspect-ratio: ${I}`);if(y)b.push(`object-fit: ${y}`);if(c)b.push(`object-position: ${c}`);if(g)b.push(g);let A=b.length>0?` style="${b.join("; ")}"`:"",S=d?` class="${d}"`:"",F=u?"":` loading="${o}"`,R=` decoding="${l}"`,C=f?` fetchpriority="${f}"`:u?' fetchpriority="high"':"",E=["avif","webp","jpeg","png"],M=[];for(let k of E){let z=p.get(k);if(z&&z.length>0){let O=Et(z),Y=de(k);M.push(` <source type="${Y}" srcset="${O}" sizes="${w}" />`)}}let U="",L="",T;if(h!=="none"&&e?.placeholder){let k=`img-${Math.random().toString(36).slice(2,8)}`;if(U=`<div class="stx-image-wrapper" id="${k}">`,L="</div>",h==="blur")T=`
|
|
3
3
|
#${k} {
|
|
4
4
|
position: relative;
|
|
5
5
|
background-image: url('${e.placeholder}');
|
|
@@ -23,14 +23,14 @@ ${M.join(`
|
|
|
23
23
|
src="${v?.url||t}"
|
|
24
24
|
alt="${B(n)}"${_}${H}${S}${A}${F}${R}${C}
|
|
25
25
|
/>
|
|
26
|
-
</picture>${L}`,V;if(u&&v){let k=p.get("webp"),z=k?.[Math.floor(k.length/2)]||v,O=
|
|
26
|
+
</picture>${L}`,V;if(u&&v){let k=p.get("webp"),z=k?.[Math.floor(k.length/2)]||v,O=de(z.format);V=`<link rel="preload" as="image" href="${z.url}" type="${O}" />`}return{html:Q,preloadLink:V,placeholderCss:T}}function K(s){let{src:r,alt:e,width:t,height:n,loading:a="lazy",decoding:i="async",priority:m=!1,fetchpriority:o,objectFit:u,objectPosition:l}=s,{class:f,style:y}=s,c=[];if(u)c.push(`object-fit: ${u}`);if(l)c.push(`object-position: ${l}`);if(y)c.push(y);let h=c.length>0?` style="${c.join("; ")}"`:"",d=f?` class="${f}"`:"",g=t?` width="${t}"`:"",p=n?` height="${n}"`:"",v=m?"":` loading="${a}"`,w=` decoding="${i}"`,I=o?` fetchpriority="${o}"`:m?' fetchpriority="high"':"";return{html:`<img src="${r}" alt="${B(e)}"${g}${p}${d}${h}${v}${w}${I} />`}}function Z(s){let{src:r,alt:e,width:t,height:n,sizes:a="100vw",loading:i="lazy",priority:m=!1,quality:o=ue,formats:u=le,widths:l=ce,decoding:f="async",fetchpriority:y,objectFit:c,objectPosition:h}=s,{class:d,style:g}=s,p=[];if(c)p.push(`object-fit: ${c}`);if(h)p.push(`object-position: ${h}`);if(g)p.push(g);let v=p.length>0?` style="${p.join("; ")}"`:"",w=d?` class="${d}"`:"",I=t?` width="${t}"`:"",b=n?` height="${n}"`:"",A=m?"":` loading="${i}"`,S=` decoding="${f}"`,F=y?` fetchpriority="${y}"`:m?' fetchpriority="high"':"",R=typeof a==="object"?cn(a):a,C=`
|
|
27
27
|
data-stx-image
|
|
28
28
|
data-src="${r}"
|
|
29
29
|
data-sizes="${R}"
|
|
30
30
|
data-quality="${o}"
|
|
31
31
|
data-formats="${u.join(",")}"
|
|
32
32
|
data-widths="${l.join(",")}"
|
|
33
|
-
`.replace(/\s+/g," ").trim();return{html:`<img src="${r}" alt="${B(e)}"${I}${b}${w}${v}${A}${S}${F} ${C} />`}}function
|
|
33
|
+
`.replace(/\s+/g," ").trim();return{html:`<img src="${r}" alt="${B(e)}"${I}${b}${w}${v}${A}${S}${F} ${C} />`}}function Ea(s){let r=s.match(/<Image\s+([^>]*?)\/?>/);if(!r)return null;let e=r[1],t={},n=/(\w+)(?:=(?:"([^"]*)"|'([^']*)'|(\{[^}]+\})))?/g,a;while((a=n.exec(e))!==null){let[,i,m,o,u]=a,l=m??o??u??!0;switch(i){case"src":t.src=String(l);break;case"alt":t.alt=String(l);break;case"width":t.width=Number(l)||l;break;case"height":t.height=Number(l)||l;break;case"sizes":t.sizes=String(l);break;case"loading":t.loading=l;break;case"priority":t.priority=l===!0||l==="true";break;case"quality":t.quality=Number(l);break;case"placeholder":t.placeholder=l;break;case"class":t.class=String(l);break;case"style":t.style=String(l);break;case"decoding":t.decoding=l;break;case"fetchpriority":t.fetchpriority=l;break;case"objectFit":t.objectFit=l;break;case"objectPosition":t.objectPosition=String(l);break}}if(!t.src||!t.alt)return null;return t}async function ru(s,r){let e=/<Image\s+[^>]*?\/?>/g,t=[],n=[],a=s,i,m=[];while((i=e.exec(s))!==null)m.push({match:i[0],index:i.index});for(let o=m.length-1;o>=0;o--){let{match:u}=m[o],l=Ea(u);if(l){let f=await r(l);if(a=a.replace(u,f.html),f.preloadLink)t.push(f.preloadLink);if(f.placeholderCss)n.push(f.placeholderCss)}}return{html:a,preloadLinks:t,styles:n}}function B(s){return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var D=new Map;function su(){D.clear()}async function G(s,r){let e=`${s}:${JSON.stringify(r)}`;if(D.has(e))return D.get(e);try{let t=await Be(s,r);return D.set(e,t),t}catch{return null}}function Ta(){return Ot({name:"image",hasEndTag:!1,description:"Render an optimized image with responsive variants",transform:async(s,r,e)=>{let{src:t,alt:n,options:a}=X(s,r,e);if(!t)return console.warn("@image directive: missing src argument"),"<!-- @image: missing src -->";let i={widths:a.widths||(a.width?[a.width]:ce),formats:a.formats||le,quality:a.quality||ue,placeholder:(a.placeholder==="color"?"dominant-color":a.placeholder)||"none"};if(!await _e())return q(t,n||"",a);let o=await G(t,i);if(!o)return q(t,n||"",a);return te(o,n||"",a)}})}function X(s,r,e){if(r.src)return{src:String(r.src),alt:String(r.alt||""),options:r.options||{}};let n=s.trim();if(n.startsWith("@image(")||n.startsWith("("))n=n.replace(/^@image\(/,"").replace(/^\(/,"").replace(/\)$/,"");let a=ee(n),i=a[0]||"",m=a[1]||"",o={};if(i&&!i.startsWith("/")&&!i.startsWith(".")&&!i.startsWith("http")){let u=e[i];if(typeof u==="string")i=u}if(a[2])try{if(typeof a[2]==="string")o=JSON.parse(a[2]);else o=a[2]}catch{}return{src:i,alt:m,options:o}}function ee(s){let r=[],e="",t=!1,n="",a=0,i=0;for(let m=0;m<s.length;m++){let o=s[m],u=m>0?s[m-1]:"";if((o==='"'||o==="'")&&u!=="\\"){if(!t)t=!0,n=o;else if(o===n)t=!1,n="";else e+=o;continue}if(!t){if(o==="{")a++;if(o==="}")a--;if(o==="[")i++;if(o==="]")i--;if(o===","&&a===0&&i===0){r.push(e.trim()),e="";continue}}e+=o}if(e.trim())r.push(e.trim());return r}function q(s,r,e){let t=[`src="${x(s)}"`];if(r)t.push(`alt="${x(r)}"`);if(e.width)t.push(`width="${e.width}"`);if(e.height)t.push(`height="${e.height}"`);if(e.class)t.push(`class="${x(e.class)}"`);if(e.style)t.push(`style="${x(e.style)}"`);if(e.lazy!==!1)t.push('loading="lazy"');return t.push('decoding="async"'),`<img ${t.join(" ")} />`}function te(s,r,e){let{variants:t,placeholder:n,width:a,height:i,aspectRatio:m}=s,o=new Map;for(let g of t){let p=o.get(g.format)||[];p.push(g),o.set(g.format,p)}let u=["avif","webp","jpeg","png"],l=[];for(let g of u){let p=o.get(g);if(p&&p.length>0){let v=Et(p),w=de(g),I=e.sizes||"100vw";l.push(` <source type="${w}" srcset="${x(v)}" sizes="${x(I)}" />`)}}let f=o.get("jpeg")||[],y=f.length>0?f[Math.floor(f.length/2)]:t[Math.floor(t.length/2)],c=[`src="${y?.url||s.src}"`,`alt="${x(r)}"`];if(e.width||a)c.push(`width="${e.width||a}"`);if(e.height||i)c.push(`height="${e.height||i}"`);if(e.class)c.push(`class="${x(e.class)}"`);let h=[];if(m)h.push(`aspect-ratio: ${m.toFixed(4)}`);if(e.style)h.push(e.style);if(h.length>0)c.push(`style="${h.join("; ")}"`);if(e.lazy!==!1&&!e.priority)c.push('loading="lazy"');if(c.push('decoding="async"'),e.priority)c.push('fetchpriority="high"');let d=`<picture>
|
|
34
34
|
`;if(d+=l.join(`
|
|
35
35
|
`)+`
|
|
36
36
|
`,d+=` <img ${c.join(" ")} />
|
|
@@ -38,6 +38,6 @@ ${M.join(`
|
|
|
38
38
|
${d}
|
|
39
39
|
</div>`}else if(e.placeholder==="color"){let p=n.replace(/[^a-zA-Z0-9#(),.\s%-]/g,"");d=`<div id="${g}" class="stx-image-placeholder" style="background-color: ${p};">
|
|
40
40
|
${d}
|
|
41
|
-
</div>`}}if(e.priority&&y){let g=
|
|
42
|
-
`+d}return d}function x(s){return s.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var
|
|
43
|
-
export{
|
|
41
|
+
</div>`}}if(e.priority&&y){let g=de(y.format);d=`<link rel="preload" as="image" href="${x(y.url)}" type="${g}" />
|
|
42
|
+
`+d}return d}function x(s){return s.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var ou=Ta();import P from"fs";import j from"path";function iu(s={}){let{inputDirs:r=["public","src/assets","assets"],outputDir:e="dist/images",baseUrl:t="/images",formats:n=le,widths:a=ce,quality:i=ue,placeholder:m="none",concurrency:o=4,cache:u=!0,cacheDir:l=".stx/image-cache",referencedOnly:f=!1,verbose:y=!1}=s,c={imageReferences:new Set,processedImages:new Map,stats:{totalImages:0,optimizedImages:0,savedBytes:0,variants:0}};return{name:"stx-image-optimization",async setup(h){if(!await _e()){console.warn("[stx-images] no image backend available, optimization disabled");return}if(u)await P.promises.mkdir(l,{recursive:!0});if(y){let g=await Kn();console.log("[stx-images] Plugin initialized"),console.log(` Backend: ${g?"sharp (native fast path) + ts-images":"ts-images (pure TS)"}`),console.log(` Input dirs: ${r.join(", ")}`),console.log(` Output dir: ${e}`),console.log(` Formats: ${n.join(", ")}`),console.log(` Widths: ${a.join(", ")}`)}},async buildStart(){c.imageReferences.clear(),c.processedImages.clear(),c.stats={totalImages:0,optimizedImages:0,savedBytes:0,variants:0}},async transform(h,d){if(d.endsWith(".html")||d.endsWith(".stx")){let g=se(h);for(let p of g)c.imageReferences.add(p)}if(h.includes("<Image")||h.includes("@image"))return await ae(h,{formats:n,widths:a,quality:i,placeholder:m,outputDir:e,baseUrl:t,processedImages:c.processedImages});return h},async buildEnd(h){if(!await _e())return;await P.promises.mkdir(e,{recursive:!0});let g=[];for(let w of r){if(!P.existsSync(w))continue;let I=await N(w);g.push(...I)}let p=f?g.filter((w)=>re(w,c.imageReferences)):g;if(c.stats.totalImages=p.length,y)console.log(`[stx-images] Processing ${p.length} images...`);let v=W(p,o);for(let w of v)await Promise.all(w.map(async(I)=>{try{let b=await Be(I,{formats:n,widths:a,quality:i,placeholder:m,outputDir:e,baseUrl:t});c.processedImages.set(I,b),c.stats.optimizedImages++,c.stats.variants+=b.variants.length;let A=P.statSync(I).size,S=Yn(b.variants);if(c.stats.savedBytes+=Math.max(0,A-S/b.variants.length),y)console.log(` \u2713 ${j.basename(I)} \u2192 ${b.variants.length} variants`)}catch(b){console.error(`[stx-images] Error processing ${I}:`,b)}}));if(console.log("[stx-images] Optimization complete:"),console.log(` Images: ${c.stats.optimizedImages}/${c.stats.totalImages}`),console.log(` Variants: ${c.stats.variants}`),c.stats.savedBytes>0)console.log(` Saved: ~${Zn(c.stats.savedBytes)}`)}}}function se(s){let r=[],e=/src=["']([^"']+\.(jpg|jpeg|png|webp|avif|gif))["']/gi,t;while((t=e.exec(s))!==null)r.push(t[1]);let n=/<Image[^>]+src=["']([^"']+)["']/gi;while((t=n.exec(s))!==null)r.push(t[1]);let a=/@image\s*\(\s*['"]([^'"]+)['"]/gi;while((t=a.exec(s))!==null)r.push(t[1]);let i=/background(?:-image)?:\s*url\(["']?([^"')]+\.(jpg|jpeg|png|webp|avif|gif))["']?\)/gi;while((t=i.exec(s))!==null)r.push(t[1]);return r}function re(s,r){let e=j.basename(s);for(let t of r)if(t.endsWith(e)||t.includes(e))return!0;return!1}async function ae(s,r){return s}async function N(s){let r=[];async function e(t){let n=await P.promises.readdir(t,{withFileTypes:!0});for(let a of n){let i=j.join(t,a.name);if(a.isDirectory())await e(i);else if(a.isFile()&&Jn(i))r.push(i)}}return await e(s),r}function W(s,r){let e=[];for(let t=0;t<s.length;t+=r)e.push(s.slice(t,t+r));return e}async function au(s,r,e={}){if(!await _e())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");return Be(s,{...e,outputDir:r})}async function cu(s,r,e={}){let{formats:t=le,widths:n=ce,quality:a=ue,placeholder:i="none",concurrency:m=4,verbose:o=!1}=e;if(!await _e())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");await P.promises.mkdir(r,{recursive:!0});let l=await N(s),f=[],y={totalImages:l.length,optimizedImages:0,savedBytes:0,variants:0},c=W(l,m);for(let h of c){let d=await Promise.all(h.map(async(g)=>{try{let p=await Be(g,{formats:t,widths:n,quality:a,placeholder:i,outputDir:r,baseUrl:"/"});if(y.optimizedImages++,y.variants+=p.variants.length,o)console.log(` \u2713 ${j.basename(g)}`);return p}catch(p){return console.error(`Error processing ${g}:`,p),null}}));f.push(...d.filter((g)=>g!==null))}return{processed:f,stats:y}}function $a(s){let r={};for(let e of s)r[e.src]={variants:e.variants,placeholder:e.placeholder};return r}async function lu(s,r){let e=$a(s);await Bun.write(r,JSON.stringify(e,null,2))}var Em={enabled:!0,widths:[320,640,768,1024,1280,1536,1920],formats:["webp","jpeg"],quality:80,devOptimize:!1,cacheDir:".stx/image-cache",placeholder:"none",inputDirs:["public","src/assets","assets"],outputDir:"dist/images",baseUrl:"/images"};
|
|
43
|
+
export{nu,Ea,ru,su,Ta,ou,iu,au,cu,$a,lu,Em};
|
|
@@ -298,5 +298,5 @@ catch (error) {
|
|
|
298
298
|
init();
|
|
299
299
|
}
|
|
300
300
|
})();
|
|
301
|
-
</script>`}var
|
|
302
|
-
export{
|
|
301
|
+
</script>`}var nm={name:"pwa.installButton",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return r(t,n)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},rm={name:"pwa.updatePrompt",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return p(t,n)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},sm={name:"pwa.offlineIndicator",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return d(t,n)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},om={name:"pwa.pushSubscribe",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return l(t,n)},hasEndTag:!0,description:"Renders a push notification subscription button"},wo=[nm,rm,sm,om];function Vy(t){return[...t,...wo]}
|
|
302
|
+
export{nm,rm,sm,om,wo,Vy};
|