@stacksjs/stx 0.2.713 → 0.2.714
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-00bf81ep.js +2 -0
- package/dist/chunk-04bhg3nn.js +2 -0
- package/dist/{chunk-vstvadc2.js → chunk-05qf3e2p.js} +3 -3
- package/dist/{chunk-f8fekg2d.js → chunk-0babpwqd.js} +22 -22
- package/dist/chunk-0g9a1kks.js +2 -0
- package/dist/{chunk-rt7q8dfs.js → chunk-0k1nwbch.js} +9 -9
- package/dist/{chunk-x45dv67k.js → chunk-142z94rk.js} +4 -4
- package/dist/chunk-19vshytp.js +2 -0
- package/dist/{chunk-13z9b912.js → chunk-1kpfkjy7.js} +18 -18
- package/dist/{chunk-mzfbpcy0.js → chunk-1ncmrzk1.js} +2 -2
- package/dist/chunk-2fmn23mb.js +2 -0
- package/dist/{chunk-3ps07041.js → chunk-2mqzpzy7.js} +4 -4
- package/dist/{chunk-wbfg7p3k.js → chunk-2t00wxz0.js} +1 -1
- package/dist/chunk-336t7zzz.js +2 -0
- package/dist/{chunk-w246aa0j.js → chunk-35br675g.js} +4 -4
- package/dist/chunk-362sjw8c.js +2 -0
- package/dist/{chunk-dxqvv686.js → chunk-39nkd53v.js} +2 -2
- package/dist/{chunk-yw66yks2.js → chunk-3e40sm05.js} +4 -4
- package/dist/{chunk-zjw6j2x0.js → chunk-3fwdxxh1.js} +4 -4
- package/dist/chunk-3j8x8mhx.js +2 -0
- package/dist/chunk-3nbvr34s.js +2 -0
- package/dist/chunk-3r0zha0y.js +2 -0
- package/dist/{chunk-zav8yrtp.js → chunk-3xyvc3g1.js} +5 -5
- package/dist/{chunk-stvw8y3c.js → chunk-4c86wr9a.js} +2 -2
- package/dist/chunk-4ee5msma.js +2 -0
- package/dist/chunk-54a60nh2.js +2 -0
- package/dist/chunk-5d1c504j.js +2 -0
- package/dist/chunk-5wpgbwap.js +2 -0
- package/dist/{chunk-s3ms09rt.js → chunk-5zg56hwd.js} +5 -5
- package/dist/{chunk-qa9t9k6z.js → chunk-62awa752.js} +1 -1
- package/dist/{chunk-mr3r8crk.js → chunk-630yrhzv.js} +2 -2
- package/dist/{chunk-kxf8z7vp.js → chunk-6fx89gvg.js} +2 -2
- package/dist/chunk-6h1qa3hw.js +2 -0
- package/dist/chunk-6jn0p1a9.js +2 -0
- package/dist/chunk-6vj7vx7z.js +2 -0
- package/dist/{chunk-ckrmrdjp.js → chunk-72hfqwvk.js} +5 -5
- package/dist/{chunk-qd6s902s.js → chunk-7407ac26.js} +5 -5
- package/dist/{chunk-cwhzk2n3.js → chunk-74fepz6h.js} +2 -2
- package/dist/{chunk-y083wv0f.js → chunk-77rjnavp.js} +13 -13
- package/dist/{chunk-42w6snem.js → chunk-78x8qfvt.js} +4 -4
- package/dist/chunk-79sjdpfy.js +2 -0
- package/dist/{chunk-aa6fa3x4.js → chunk-7nmrycrz.js} +4 -4
- package/dist/{chunk-t413xatv.js → chunk-87zvjhp9.js} +10 -10
- package/dist/{chunk-zecgd1wz.js → chunk-88rftjjk.js} +4 -4
- package/dist/chunk-8dfq934n.js +2 -0
- package/dist/{chunk-t6ayy0t5.js → chunk-8fazd6fr.js} +2 -2
- package/dist/chunk-8w1ep4w3.js +2 -0
- package/dist/chunk-918xy0ra.js +2 -0
- package/dist/{chunk-tvcr9sct.js → chunk-9chqvq23.js} +3 -3
- package/dist/chunk-a0r5011d.js +2 -0
- package/dist/chunk-a49at1ah.js +2 -0
- package/dist/{chunk-ak09a5v6.js → chunk-a9kxcdkz.js} +2 -2
- package/dist/chunk-agjysd2b.js +2 -0
- package/dist/chunk-ajcb0z8k.js +2 -0
- package/dist/chunk-ak04tgvw.js +2 -0
- package/dist/chunk-anew18ct.js +2 -0
- package/dist/chunk-azatpcm0.js +2 -0
- package/dist/chunk-c1481efw.js +2 -0
- package/dist/chunk-c510b95e.js +2 -0
- package/dist/chunk-c8yrvpr7.js +2 -0
- package/dist/chunk-cbbjepfk.js +2 -0
- package/dist/{chunk-max3smha.js → chunk-cgpf1fva.js} +2 -2
- package/dist/{chunk-6cz1sbb1.js → chunk-d9hw6n2d.js} +3 -3
- package/dist/{chunk-zjaw79zp.js → chunk-dhy6n39n.js} +2 -2
- package/dist/{chunk-edka95zp.js → chunk-dmnncw90.js} +3 -3
- package/dist/chunk-dn8x6c98.js +2 -0
- package/dist/{chunk-b7j48bq9.js → chunk-dnqzrktd.js} +2 -2
- package/dist/chunk-dph9dzzs.js +2 -0
- package/dist/{chunk-af7av42v.js → chunk-dxzs589r.js} +3 -3
- package/dist/{chunk-e6ky15dr.js → chunk-ez35607j.js} +2 -2
- package/dist/{chunk-768evhvm.js → chunk-f2c3t1ky.js} +2 -2
- package/dist/{chunk-x2gxx8eg.js → chunk-f4gqzg1y.js} +2 -2
- package/dist/chunk-f9smbpkp.js +2 -0
- package/dist/chunk-fb8sw7fc.js +2 -0
- package/dist/{chunk-029qng4p.js → chunk-fsz9k5k0.js} +5 -5
- package/dist/chunk-g8fg3kq8.js +2 -0
- package/dist/{chunk-vapj4s7f.js → chunk-g8ve8pag.js} +6 -6
- package/dist/{chunk-0tay8xjs.js → chunk-gjfgmhpw.js} +1 -1
- package/dist/chunk-gw4pycg0.js +2 -0
- package/dist/{chunk-an387127.js → chunk-h16qbyjd.js} +2 -2
- package/dist/chunk-h5srt1gz.js +2 -0
- package/dist/{chunk-t63f15yh.js → chunk-hez09ssh.js} +2 -2
- package/dist/{chunk-2aarvd3a.js → chunk-hnqpqtk2.js} +6 -6
- package/dist/chunk-hrb9fmq0.js +2 -0
- package/dist/{chunk-gecdjyb5.js → chunk-hx2s1j09.js} +8 -8
- package/dist/{chunk-xjge15am.js → chunk-j0sj81bg.js} +6 -6
- package/dist/{chunk-fcbd7kwj.js → chunk-j28r2d0q.js} +2 -2
- package/dist/chunk-jb5najk3.js +1101 -0
- package/dist/chunk-jc7823qy.js +2 -0
- package/dist/chunk-jresy8fn.js +2 -0
- package/dist/{chunk-bjejmqk4.js → chunk-jtgb1s62.js} +2 -2
- package/dist/{chunk-tnmz1t1p.js → chunk-k3j8kd19.js} +5 -5
- package/dist/{chunk-mj8c8949.js → chunk-k93mp66m.js} +4 -4
- package/dist/{chunk-cc2ss77r.js → chunk-m1n9re2p.js} +6 -6
- package/dist/{chunk-8v2vbc4y.js → chunk-m5nzpjej.js} +1 -1
- package/dist/chunk-m6d2bq3y.js +2 -0
- package/dist/chunk-m8r7v1js.js +2 -0
- package/dist/{chunk-c1fjdp7s.js → chunk-mpphyb4g.js} +1 -1
- package/dist/{chunk-s9b6abkb.js → chunk-mwxbdpb1.js} +2 -2
- package/dist/chunk-mymb85q5.js +3 -0
- package/dist/{chunk-83p5k4eb.js → chunk-narz7105.js} +2 -2
- package/dist/chunk-ngahc72q.js +2 -0
- package/dist/{chunk-khrckvwn.js → chunk-nqfpvejh.js} +1 -1
- package/dist/chunk-nvtp22qp.js +2 -0
- package/dist/{chunk-46bd866e.js → chunk-ny5j5jhm.js} +3 -3
- package/dist/{chunk-4ckxs446.js → chunk-pd89jnqk.js} +3 -3
- package/dist/{chunk-067sgh2j.js → chunk-q73xkgn0.js} +76 -76
- package/dist/{chunk-3t3p2c1t.js → chunk-q7fh1xka.js} +6 -6
- package/dist/{chunk-5n4qg8za.js → chunk-qc93ce5h.js} +2 -2
- package/dist/{chunk-3457kk19.js → chunk-qf2aa8qe.js} +6 -6
- package/dist/{chunk-jb5sftzz.js → chunk-r3hden6p.js} +2 -2
- package/dist/{chunk-7dc3n69c.js → chunk-r3j4m04w.js} +2 -2
- package/dist/chunk-r5re2zj0.js +2 -0
- package/dist/{chunk-wp6q0geg.js → chunk-rbmt5w9v.js} +2 -2
- package/dist/chunk-rgv7rjrs.js +2 -0
- package/dist/{chunk-67abad76.js → chunk-rj4j7qcj.js} +1 -1
- package/dist/chunk-s9hw4vcx.js +2 -0
- package/dist/{chunk-g1tq4xdb.js → chunk-serrx31a.js} +2 -2
- package/dist/{chunk-42rw3f1h.js → chunk-sfkexejc.js} +2 -2
- package/dist/{chunk-cpyc6t0d.js → chunk-snxzvyz3.js} +1 -1
- package/dist/chunk-sx1aer4p.js +2 -0
- package/dist/{chunk-p3dkhz9v.js → chunk-tdrcn1mn.js} +30 -30
- package/dist/chunk-tdvmf3ge.js +2 -0
- package/dist/{chunk-h54w4fg6.js → chunk-tz4wh90e.js} +5 -5
- package/dist/chunk-tzhm09xq.js +2 -0
- package/dist/{chunk-0sg7zzmr.js → chunk-tzk4cmvm.js} +5 -5
- package/dist/{chunk-9dg5ja4w.js → chunk-v402swbm.js} +1 -1
- package/dist/chunk-vf9s563f.js +2 -0
- package/dist/chunk-vpmk1w2t.js +2 -0
- package/dist/chunk-wj5j2ekg.js +2 -0
- package/dist/{chunk-b6318vv3.js → chunk-wk50m71x.js} +1 -1
- package/dist/{chunk-vh879axx.js → chunk-wv412s1h.js} +7 -7
- package/dist/{chunk-rb2a1qxb.js → chunk-x5dc06p5.js} +6 -6
- package/dist/chunk-x7z2s532.js +2 -0
- package/dist/{chunk-ap30qs8p.js → chunk-x9wwd2ee.js} +2 -2
- package/dist/{chunk-ncs2j5kc.js → chunk-xaddgvkx.js} +2 -2
- package/dist/{chunk-6n11z33h.js → chunk-y3w2rc1y.js} +5 -5
- package/dist/{chunk-hcve898s.js → chunk-ye3yyq6n.js} +4 -4
- package/dist/{chunk-5ctdwyq1.js → chunk-yen9xzzg.js} +6 -6
- package/dist/chunk-yg1wcsbj.js +2 -0
- package/dist/{chunk-vcpynqvy.js → chunk-z4dpz6dh.js} +3 -3
- package/dist/{chunk-39073rh9.js → chunk-z5pm69w1.js} +39 -39
- package/dist/{chunk-xyyt8v1r.js → chunk-zkx2m308.js} +12 -12
- package/dist/cli.js +19 -19
- package/dist/craft-bridge.d.ts +0 -18
- package/dist/craft-bridge.js +12 -7
- package/dist/craft-components.d.ts +0 -20
- package/dist/craft-components.js +5 -13
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/document-injection.d.ts +2 -0
- package/dist/document-injection.js +8 -0
- package/dist/native-build.js +2 -1
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +15 -15
- package/package.json +5 -5
- package/dist/chunk-07sc6jtz.js +0 -2
- package/dist/chunk-0kjac48x.js +0 -2
- package/dist/chunk-0wtqxs6s.js +0 -2
- package/dist/chunk-12vjp2gr.js +0 -2
- package/dist/chunk-18fr730w.js +0 -2
- package/dist/chunk-1hzf9rcy.js +0 -2
- package/dist/chunk-29sapda2.js +0 -2
- package/dist/chunk-2qf6kd9r.js +0 -2
- package/dist/chunk-2snfd93r.js +0 -2
- package/dist/chunk-4c1fbthr.js +0 -2
- package/dist/chunk-4fxg20je.js +0 -2
- package/dist/chunk-58v34kba.js +0 -2
- package/dist/chunk-5fjc7402.js +0 -2
- package/dist/chunk-5wrgzs4c.js +0 -2
- package/dist/chunk-5x6y26y1.js +0 -2
- package/dist/chunk-6q2647s6.js +0 -2
- package/dist/chunk-77msvbad.js +0 -3033
- package/dist/chunk-8s4rxgs8.js +0 -2
- package/dist/chunk-9736003n.js +0 -2
- package/dist/chunk-97r557ws.js +0 -2
- package/dist/chunk-bcr8sq50.js +0 -2
- package/dist/chunk-ccv7dw6h.js +0 -2
- package/dist/chunk-cx1xn3j3.js +0 -2
- package/dist/chunk-d9ryb159.js +0 -2
- package/dist/chunk-dhdt7e54.js +0 -2
- package/dist/chunk-et83qyc2.js +0 -2
- package/dist/chunk-faa56mhz.js +0 -2
- package/dist/chunk-fphxtr18.js +0 -2
- package/dist/chunk-fvk1xr5a.js +0 -2
- package/dist/chunk-g6wd49b5.js +0 -2
- package/dist/chunk-gk0nq2ky.js +0 -2
- package/dist/chunk-h8kbcz9t.js +0 -2
- package/dist/chunk-hava1caf.js +0 -3
- package/dist/chunk-hsthpqed.js +0 -2
- package/dist/chunk-jyz9frny.js +0 -2
- package/dist/chunk-kyymkayr.js +0 -2
- package/dist/chunk-mzwa2478.js +0 -2
- package/dist/chunk-n3z0cek6.js +0 -2
- package/dist/chunk-nbew0ttz.js +0 -2
- package/dist/chunk-nefv911a.js +0 -2
- package/dist/chunk-p41knx6v.js +0 -2
- package/dist/chunk-qcx9yp5x.js +0 -2
- package/dist/chunk-r6bc2q44.js +0 -2
- package/dist/chunk-rdj74dqc.js +0 -2
- package/dist/chunk-rtbkjq0y.js +0 -2
- package/dist/chunk-rwjgpmrw.js +0 -2
- package/dist/chunk-s4ks8rjm.js +0 -2
- package/dist/chunk-s9vfypaf.js +0 -2
- package/dist/chunk-sy1btryy.js +0 -2
- package/dist/chunk-t7mbaf69.js +0 -2
- package/dist/chunk-w2h6nn70.js +0 -2
- package/dist/chunk-wrv0tf80.js +0 -2
- package/dist/chunk-x5h95nnq.js +0 -2
- package/dist/chunk-xferp2q8.js +0 -2
- package/dist/chunk-xge355wc.js +0 -2
- package/dist/chunk-xn1hv092.js +0 -2
- package/dist/chunk-yd199exa.js +0 -2
- package/dist/chunk-ykmcnk3x.js +0 -2
- package/dist/chunk-z05dbey1.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{we,ti,ni,zf,Ot,Pc,ri,Ic,vh,De,mn,Me}from"./chunk-q73xkgn0.js";import{jc,s}from"./chunk-05qf3e2p.js";import"./chunk-jtgb1s62.js";import"./chunk-rbmt5w9v.js";import"./chunk-zkx2m308.js";import"./chunk-zn3c0ew5.js";import"./chunk-ez35607j.js";export{we as BROWSER_CORE_IMPORTS,zf as STX_AUTO_IMPORTS,ti as extractAndStripCssImports,De as extractBridgeData,jc as findInterpolationEnd,Ic as generateAutoImportDestructuring,vh as generateBrowserAutoImportDestructuring,mn as generateServerDataBridge,Ot as injectBrowserCoreAutoImports,Me as processClientScript,ri as referencesName,ni as renderVendorStyleTags,s as stripCommentsAndLiterals,Pc as transformAutoImports};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ki,_i,Ci,yg,Ei,Ti,bg,$i,Ri,al,vg}from"./chunk-d9hw6n2d.js";export{ki as VideoProcessorCache,al as analyzeVideo,yg as clearVideoCache,Ri as generateDASHManifest,$i as generateHLSManifest,Ei as generatePoster,bg as generateSpriteSheet,Ti as generateThumbnails,_i as getCachedVideoResult,vg as processVideo,Ci as setCachedVideoResult};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{vn,O}from"./chunk-
|
|
2
|
+
import{vn,O}from"./chunk-rbmt5w9v.js";import m from"fs";import e from"path";async function bn(r,o,i){if(r.__stx_runtime_config)return;let n=vn();if(n||i){r.__stx_runtime_config=n??O(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-dph9dzzs.js"),c=await f(t);if(c.runtimeConfig)r.__stx_runtime_config=O(c.runtimeConfig);return}let s=e.dirname(t);if(s===t)return;t=s}}async function ai(r,o){function i(n){if(n===null)return"null";if(Array.isArray(n))return`Array<${n.length?[...new Set(n.map(i))].join(" | "):"unknown"}>`;if(typeof n==="object")return`{ ${Object.entries(n).map(([t,s])=>`readonly ${JSON.stringify(t)}: ${i(s)}`).join("; ")} }`;return typeof n}await Bun.write(e.join(r,".stx/runtime-config.d.ts"),`import '@stacksjs/stx/runtime-config'
|
|
3
3
|
declare module '@stacksjs/stx/runtime-config' { interface PublicRuntimeConfig ${i(o.public??{})} }
|
|
4
4
|
`),await Bun.write(e.join(r,".stx/runtime-config-server.d.ts"),`import '@stacksjs/stx/runtime-config-server'
|
|
5
5
|
declare module '@stacksjs/stx/runtime-config-server' { interface PrivateRuntimeConfig ${i(o.private??{})} }
|
|
6
6
|
`)}
|
|
7
|
-
export{bn,
|
|
7
|
+
export{bn,ai};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Yn,$e}from"./chunk-1xjv71dw.js";import{F,w,gr,_s,_}from"./chunk-067sgh2j.js";import{a,P}from"./chunk-f8fekg2d.js";import{bo}from"./chunk-qd6s902s.js";import{et}from"./chunk-j2mpqa4p.js";import{l}from"./chunk-5n4qg8za.js";import{s,ge}from"./chunk-vstvadc2.js";import d from"path";import v from"fs";import{AsyncLocalStorage as ht}from"async_hooks";var xt=11;function X(t,e,n){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(d.basename(t))||bo(t,e,n)}var at=2;function Qp(t){let e=process.env.STX_BUNDLE_CACHE_DIR?.trim();return e?d.resolve(e):l(t,"bundle-cache")}function st(t,e){let n=t;for(let i of $t(e))if(i!==d.sep)n=n.split(i).join("\x00root");return n}var rt=new Map;function $t(t){let e=d.resolve(t),n=rt.get(e);if(!n){let i=e;try{i=v.realpathSync(e)}catch{}n=[...new Set([e,i])].sort((u,m)=>m.length-u.length),rt.set(e,n)}return n}function yt(t,e){try{let n=v.statSync(t),i=d.resolve(e),u=t.startsWith(`${i}${d.sep}`);return{path:u?d.relative(i,t):t,...u?{inRoot:!0}:{},mtimeMs:n.mtimeMs,size:n.size,hash:Bun.hash(v.readFileSync(t)).toString(36)}}catch{return null}}function ct(t,e){return t.inRoot?d.join(d.resolve(e),t.path):t.path}function bt(t,e){for(let n of t){let i=ct(n,e);try{let u=v.statSync(i);if(u.size!==n.size)return!1;if(u.mtimeMs!==n.mtimeMs&&Bun.hash(v.readFileSync(i)).toString(36)!==n.hash)return!1}catch{return!1}}return!0}var lt=new Map,wt=100;function ef(t=process.env){let e=Number(t.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(e)&&e>=1?Math.floor(e):2000}var G=new Map;async function St(t){let e=G.get(t)??0;if(e>0&&e<wt){G.set(t,e+1);return}G.set(t,1);try{let n=(await v.promises.readdir(t)).filter((c)=>c.endsWith(".js")),i=ef();if(n.length<=i)return;let m=(await Promise.all(n.map(async(c)=>{try{return{name:c,at:(await v.promises.stat(d.join(t,c))).mtimeMs}}catch{return null}}))).filter((c)=>c!==null);m.sort((c,y)=>y.at-c.at);for(let c of m.slice(i)){let y=c.name.slice(0,-3);await v.promises.rm(d.join(t,`${y}.js`),{force:!0}),await v.promises.rm(d.join(t,`${y}.deps.json`),{force:!0})}C("pruned bundle cache to",i,"entries")}catch{}}function Te(t){return lt.get(t)??[]}function q(t,e){if(t)lt.set(t,e)}function tf(t=process.env){return t.STX_DEBUG==="true"||t.STX_DEBUG==="1"}function C(...t){if(tf())console.log("[stx:bundler]",...t)}var Y=[];function ja(t,e,n){Y.push({filePath:t||"<inline>",message:e,details:n})}function Yt(){return Y.slice()}function Zt(){Y.length=0}var Z;function Gm(t){Z=t}function Ba(){if(Z)return Z;try{let t=P.strict;return typeof t==="object"&&t!==null?t.bundlerFallback??"warn":"warn"}catch{return"warn"}}var Q=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function Qt(t){let e=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,n;while((n=e.exec(t))!==null){let u=n[1];if(!Q.some((c)=>c.test(u)))return C("detected user import:",u),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((n=i.exec(t))!==null){let u=n[1];if(/\.css(?:\?.*)?$/.test(u))continue;if(!Q.some((c)=>c.test(u)))return C("detected side-effect import:",u),!0}return!1}var Jn="stx-module:",vt=/\.(?:[cm]?[jt]sx?|json)$/i;function nf(t,e){return d.relative(t,e).split(d.sep).join("/")}function rf(t,e){if(e.size===0)return t;return t.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(n,i,u,m)=>{let c=e.get(m);return c&&!m.startsWith(Jn)?`${i}${u}${c}${u}`:n})}function sf(t,e){let n=0,i=(m)=>{let c=`__stxMod${n++}`,y=JSON.stringify(m);return e.push(`var ${c} = globalThis.__stxModules && globalThis.__stxModules[${y}];`,`if (${c} === undefined) throw new Error("[stx] module " + ${JSON.stringify(y)} + " is not registered on this page (#1957)");`),c},u=(m,c)=>{for(let y of m.split(",")){let I=y.trim();if(!I)continue;let B=I.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!B)continue;let j=B[1].startsWith('"')?JSON.parse(B[1]):B[1],p=B[2]??j;e.push(`var ${p} = ${c}[${JSON.stringify(j)}];`)}};return t=t.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(m,c,y)=>{let I=y.slice(Jn.length),B=i(I),j=c.trim(),p=j.match(/^([\w$]+)\s*(?:,\s*|$)/);if(p&&!j.startsWith("{")&&!j.startsWith("*"))e.push(`var ${p[1]} = ${B}.default;`),j=j.slice(p[0].length).trim();let r=j.match(/^\*\s*as\s+([\w$]+)$/);if(r)e.push(`var ${r[1]} = ${B};`);else if(j.startsWith("{"))u(j.replace(/^\{|\}$/g,""),B);return""}),t=t.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(m,c)=>(i(c.slice(Jn.length)),"")),t}function it(t){let e=[t,`${t}.ts`,`${t}.tsx`,`${t}.js`,`${t}.mjs`,`${t}.jsx`,d.join(t,"index.ts"),d.join(t,"index.tsx"),d.join(t,"index.js"),d.join(t,"index.mjs")];for(let n of e)try{if(v.existsSync(n)&&v.statSync(n,{throwIfNoEntry:!1})?.isFile())return n}catch{}return}var K=new ht;function go(t,e){let n=new Bun.CryptoHasher("md5");for(let[i,u]of[...t].sort(([m],[c])=>m<c?-1:m>c?1:0))n.update(`${i}\x00${u}\x00`);return K.run({modules:t,key:n.digest("hex").slice(0,12)},e)}function en(){return K.getStore()?.key??""}function Bt(t,e,n,i,u,m,c=new Map,y,I){let B=(p,r,o)=>{if(X(r,t,y))return null;if(!m||p!==n||!vt.test(r))return null;try{if(!v.statSync(r,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}u.add(r);let b=`${Jn}${nf(process.cwd(),r)}`;return c.set(o,b),{path:b,external:!0}},j=(p,r)=>{let o=p===n?e:d.dirname(p),b=d.resolve(o,r);return it(b)??b};return{name:"stx-client-bundle",setup(p){if(p.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(r)=>({path:r.path,external:!0})),p.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(r)=>({path:r.path,external:!0})),p.onResolve({filter:/^\//},(r)=>{if(r.path===n)return{path:n};let o=it(r.path);if(o){let b=B(r.importer,o,r.path);if(b)return b;if(o!==n)u.add(o);return{path:o}}return{path:r.path,external:!0}}),p.onResolve({filter:/^\.\.?\//},(r)=>{let o=j(r.importer,r.path),b=B(r.importer,o,r.path);if(b)return b;return u.add(o),{path:o}}),p.onResolve({filter:/^[@~]\//},(r)=>{let o=d.resolve(t,r.path.slice(2)),b=[o,`${o}.ts`,`${o}.tsx`,`${o}.js`,`${o}.mjs`,`${o}.jsx`,d.join(o,"index.ts"),d.join(o,"index.tsx"),d.join(o,"index.js"),d.join(o,"index.mjs")];for(let x of b)if(v.existsSync(x)&&v.statSync(x,{throwIfNoEntry:!1})?.isFile()){let N=B(r.importer,x,r.path);if(N)return N;return C(`resolved ${r.path[0]}/ import:`,r.path,"\u2192",x),u.add(x),{path:x}}return console.warn(`[stx:bundler] could not resolve ${r.path[0]}/ import:`,r.path),{path:o}}),m)p.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(r)=>{if(r.importer!==n)return;let o=`${Jn}npm:${r.path}`;return c.set(r.path,o),{path:o,external:!0}});p.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(r)=>{if(r.path===n)return{contents:i,loader:"ts"};if(X(r.path,t,y))throw Error(`Server-only API source cannot be imported by a client script: ${r.path}`);let o=d.extname(r.path).toLowerCase(),b=o===".json"?"json":o===".tsx"?"tsx":o===".jsx"?"jsx":o===".ts"||o===".mts"||o===".cts"?"ts":"js";if(r.path!==n)u.add(r.path);let x=I?.get(r.path);if(x!==void 0)return{contents:x,loader:"js"};return{contents:v.readFileSync(r.path,"utf8"),loader:b}})}}}var H=new Map,z=w(64),ot=Symbol.for("stx.client-bundle-build-queue");function of(t){let e=globalThis,i=(e[ot]??Promise.resolve()).then(t,t);return e[ot]=i.then(()=>{return},()=>{return}),i}async function tn(t,e,n={}){let i=n.projectRoot||process.cwd(),u=(await a(i)).serverApi,m=n.minify??!1,c=n.externalizeUserModules??!0,y=n.expose?.length?[...new Set(n.expose)].sort():void 0,I=n.cacheDir||Qp(i),B=K.getStore(),j=new Bun.CryptoHasher("md5");j.update(`${xt}\x00${et()}\x00${JSON.stringify(u??!1)}\x00${c?"registry":"inline"}\x00${y?y.join(","):"*"}\x00${m?"minified":"readable"}\x00${B?.key??""}\x00${st(t,i)}\x00${st(e,i)}`);let p=j.digest("hex").slice(0,12),r=d.join(I,`${p}.js`),o=z.get(r);if(o){if(_s(o.files)&&o.files.every((R)=>!X(R.path,i,u))){C("memo hit:",p);let R=o.files.map((A)=>A.path);return q(e,R),n.collectInputs?.push(...R),o.code}z.delete(r),C("memo invalidated by dep change:",p)}let b=d.join(I,`${p}.deps.json`),x=Bun.file(r);if(await x.exists()){let R=Bun.file(b),A=!1,O=null;if(await R.exists())try{let D=JSON.parse(await R.text());if(D.metadataVersion===at&&Array.isArray(D.files)&&bt(D.files,i))O=gr(D.files.map((g)=>ct(g,i))),A=O.length===D.files.length&&!O.some((g)=>X(g.path,i,u))}catch{A=!1}if(A){if(C("cache hit:",p),O)q(e,O.map((L)=>L.path)),n.collectInputs?.push(...O.map((L)=>L.path));let D=await x.text(),g=new Date;if(v.promises.utimes(r,g,g).catch(()=>{}),O)z.set(r,{code:D,files:O});return D}C("cache invalidated by dep change:",p)}let N=H.get(p);if(N){let R=await N;if(n.collectInputs)n.collectInputs.push(...(z.get(r)?.files??[]).map((A)=>A.path));return R}let V=of(()=>_t(t,e,{projectRoot:i,minify:m,cacheDir:I,hash:p,cachePath:r,depsPath:b,collectInputs:n.collectInputs,externalizeUserModules:c,serverApi:u,expose:y,throwOnFailure:n.throwOnFailure,substitutes:B?.modules}));H.set(p,V);try{return await V}finally{H.delete(p)}}var jt=0;function af(t){return`${t}-${process.pid}-${++jt}`}async function _t(t,e,n){let{projectRoot:i,minify:u,cacheDir:m,hash:c,cachePath:y,depsPath:I,externalizeUserModules:B}=n,j=l(i,"bundle-tmp"),p=af(c),r=d.join(i,`.stx-client-${p}.ts`),o=d.join(j,"out",p);v.mkdirSync(o,{recursive:!0});let b=d.dirname(e),x=new Set,N=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,V=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,R=s(t),{depths:A,balanced:O}=ge(R),D=(E)=>!O||A[E]===0,g;while((g=N.exec(R))!==null){if(g[1])continue;if(!D(g.index))continue;if(g[2])g[2].split(",").forEach((E)=>{let f=Et(E);if(f)x.add(f)});else if(g[3])x.add(g[3])}while((g=V.exec(R))!==null){if(g[1])continue;if(!D(g.index))continue;x.add(g[2])}let L=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=L.exec(R))!==null){if(!D(g.index))continue;let E=/^\s*['"]([^'"]+)['"]/.exec(t.slice(g.index+g[0].length))?.[1];if(E&&Q.some((f)=>f.test(E)))continue;if(g[1])x.add(g[1]);if(g[2])x.add(g[2]);for(let f of(g[3]??"").split(",")){let S=f.trim();if(!S||/^type\s/.test(S))continue;let U=/\bas\s+(\w+)\s*$/.exec(S)?.[1]??/^\w+$/.exec(S)?.[0];if(U)x.add(U)}}for(let E of R.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let f of E[1].split(",")){let S=/\bas\s+(\w+)\s*$/.exec(f)?.[1]??/^\s*(\w+)\s*$/.exec(f)?.[1];if(S)x.delete(S)}let ut=x.size>0?`
|
|
3
|
-
export { ${[...x].join(", ")} }`:"";
|
|
2
|
+
import{Yn,$e}from"./chunk-1xjv71dw.js";import{z,w,gr,Cs,C}from"./chunk-q73xkgn0.js";import{a,P}from"./chunk-0babpwqd.js";import{vo}from"./chunk-7407ac26.js";import{et}from"./chunk-j2mpqa4p.js";import{l}from"./chunk-qc93ce5h.js";import{s,ge}from"./chunk-05qf3e2p.js";import d from"path";import v from"fs";import{AsyncLocalStorage as ht}from"async_hooks";var xt=11;function X(t,e,n){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(d.basename(t))||vo(t,e,n)}var at=2;function tf(t){let e=process.env.STX_BUNDLE_CACHE_DIR?.trim();return e?d.resolve(e):l(t,"bundle-cache")}function st(t,e){let n=t;for(let i of $t(e))if(i!==d.sep)n=n.split(i).join("\x00root");return n}var rt=new Map;function $t(t){let e=d.resolve(t),n=rt.get(e);if(!n){let i=e;try{i=v.realpathSync(e)}catch{}n=[...new Set([e,i])].sort((u,m)=>m.length-u.length),rt.set(e,n)}return n}function yt(t,e){try{let n=v.statSync(t),i=d.resolve(e),u=t.startsWith(`${i}${d.sep}`);return{path:u?d.relative(i,t):t,...u?{inRoot:!0}:{},mtimeMs:n.mtimeMs,size:n.size,hash:Bun.hash(v.readFileSync(t)).toString(36)}}catch{return null}}function ct(t,e){return t.inRoot?d.join(d.resolve(e),t.path):t.path}function bt(t,e){for(let n of t){let i=ct(n,e);try{let u=v.statSync(i);if(u.size!==n.size)return!1;if(u.mtimeMs!==n.mtimeMs&&Bun.hash(v.readFileSync(i)).toString(36)!==n.hash)return!1}catch{return!1}}return!0}var lt=new Map,wt=100;function nf(t=process.env){let e=Number(t.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(e)&&e>=1?Math.floor(e):2000}var G=new Map;async function St(t){let e=G.get(t)??0;if(e>0&&e<wt){G.set(t,e+1);return}G.set(t,1);try{let n=(await v.promises.readdir(t)).filter((c)=>c.endsWith(".js")),i=nf();if(n.length<=i)return;let m=(await Promise.all(n.map(async(c)=>{try{return{name:c,at:(await v.promises.stat(d.join(t,c))).mtimeMs}}catch{return null}}))).filter((c)=>c!==null);m.sort((c,y)=>y.at-c.at);for(let c of m.slice(i)){let y=c.name.slice(0,-3);await v.promises.rm(d.join(t,`${y}.js`),{force:!0}),await v.promises.rm(d.join(t,`${y}.deps.json`),{force:!0})}D("pruned bundle cache to",i,"entries")}catch{}}function Te(t){return lt.get(t)??[]}function q(t,e){if(t)lt.set(t,e)}function rf(t=process.env){return t.STX_DEBUG==="true"||t.STX_DEBUG==="1"}function D(...t){if(rf())console.log("[stx:bundler]",...t)}var Y=[];function Ba(t,e,n){Y.push({filePath:t||"<inline>",message:e,details:n})}function Yt(){return Y.slice()}function Zt(){Y.length=0}var Z;function Gm(t){Z=t}function Fa(){if(Z)return Z;try{let t=P.strict;return typeof t==="object"&&t!==null?t.bundlerFallback??"warn":"warn"}catch{return"warn"}}var Q=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function Qt(t){let e=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,n;while((n=e.exec(t))!==null){let u=n[1];if(!Q.some((c)=>c.test(u)))return D("detected user import:",u),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((n=i.exec(t))!==null){let u=n[1];if(/\.css(?:\?.*)?$/.test(u))continue;if(!Q.some((c)=>c.test(u)))return D("detected side-effect import:",u),!0}return!1}var Jn="stx-module:",vt=/\.(?:[cm]?[jt]sx?|json)$/i;function sf(t,e){return d.relative(t,e).split(d.sep).join("/")}function of(t,e){if(e.size===0)return t;return t.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(n,i,u,m)=>{let c=e.get(m);return c&&!m.startsWith(Jn)?`${i}${u}${c}${u}`:n})}function af(t,e){let n=0,i=(m)=>{let c=`__stxMod${n++}`,y=JSON.stringify(m);return e.push(`var ${c} = globalThis.__stxModules && globalThis.__stxModules[${y}];`,`if (${c} === undefined) throw new Error("[stx] module " + ${JSON.stringify(y)} + " is not registered on this page (#1957)");`),c},u=(m,c)=>{for(let y of m.split(",")){let R=y.trim();if(!R)continue;let B=R.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!B)continue;let j=B[1].startsWith('"')?JSON.parse(B[1]):B[1],p=B[2]??j;e.push(`var ${p} = ${c}[${JSON.stringify(j)}];`)}};return t=t.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(m,c,y)=>{let R=y.slice(Jn.length),B=i(R),j=c.trim(),p=j.match(/^([\w$]+)\s*(?:,\s*|$)/);if(p&&!j.startsWith("{")&&!j.startsWith("*"))e.push(`var ${p[1]} = ${B}.default;`),j=j.slice(p[0].length).trim();let r=j.match(/^\*\s*as\s+([\w$]+)$/);if(r)e.push(`var ${r[1]} = ${B};`);else if(j.startsWith("{"))u(j.replace(/^\{|\}$/g,""),B);return""}),t=t.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(m,c)=>(i(c.slice(Jn.length)),"")),t}function it(t){let e=[t,`${t}.ts`,`${t}.tsx`,`${t}.js`,`${t}.mjs`,`${t}.jsx`,d.join(t,"index.ts"),d.join(t,"index.tsx"),d.join(t,"index.js"),d.join(t,"index.mjs")];for(let n of e)try{if(v.existsSync(n)&&v.statSync(n,{throwIfNoEntry:!1})?.isFile())return n}catch{}return}var K=new ht;function mo(t,e){let n=new Bun.CryptoHasher("md5");for(let[i,u]of[...t].sort(([m],[c])=>m<c?-1:m>c?1:0))n.update(`${i}\x00${u}\x00`);return K.run({modules:t,key:n.digest("hex").slice(0,12)},e)}function en(){return K.getStore()?.key??""}function Bt(t,e,n,i,u,m,c=new Map,y,R){let B=(p,r,o)=>{if(X(r,t,y))return null;if(!m||p!==n||!vt.test(r))return null;try{if(!v.statSync(r,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}u.add(r);let b=`${Jn}${sf(process.cwd(),r)}`;return c.set(o,b),{path:b,external:!0}},j=(p,r)=>{let o=p===n?e:d.dirname(p),b=d.resolve(o,r);return it(b)??b};return{name:"stx-client-bundle",setup(p){if(p.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(r)=>({path:r.path,external:!0})),p.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(r)=>({path:r.path,external:!0})),p.onResolve({filter:/^\//},(r)=>{if(r.path===n)return{path:n};let o=it(r.path);if(o){let b=B(r.importer,o,r.path);if(b)return b;if(o!==n)u.add(o);return{path:o}}return{path:r.path,external:!0}}),p.onResolve({filter:/^\.\.?\//},(r)=>{let o=j(r.importer,r.path),b=B(r.importer,o,r.path);if(b)return b;return u.add(o),{path:o}}),p.onResolve({filter:/^[@~]\//},(r)=>{let o=d.resolve(t,r.path.slice(2)),b=[o,`${o}.ts`,`${o}.tsx`,`${o}.js`,`${o}.mjs`,`${o}.jsx`,d.join(o,"index.ts"),d.join(o,"index.tsx"),d.join(o,"index.js"),d.join(o,"index.mjs")];for(let x of b)if(v.existsSync(x)&&v.statSync(x,{throwIfNoEntry:!1})?.isFile()){let A=B(r.importer,x,r.path);if(A)return A;return D(`resolved ${r.path[0]}/ import:`,r.path,"\u2192",x),u.add(x),{path:x}}return console.warn(`[stx:bundler] could not resolve ${r.path[0]}/ import:`,r.path),{path:o}}),m)p.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(r)=>{if(r.importer!==n)return;let o=`${Jn}npm:${r.path}`;return c.set(r.path,o),{path:o,external:!0}});p.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(r)=>{if(r.path===n)return{contents:i,loader:"ts"};if(X(r.path,t,y))throw Error(`Server-only API source cannot be imported by a client script: ${r.path}`);let o=d.extname(r.path).toLowerCase(),b=o===".json"?"json":o===".tsx"?"tsx":o===".jsx"?"jsx":o===".ts"||o===".mts"||o===".cts"?"ts":"js";if(r.path!==n)u.add(r.path);let x=R?.get(r.path);if(x!==void 0)return{contents:x,loader:"js"};return{contents:v.readFileSync(r.path,"utf8"),loader:b}})}}}var H=new Map,k=w(64),ot=Symbol.for("stx.client-bundle-build-queue");function cf(t){let e=globalThis,i=(e[ot]??Promise.resolve()).then(t,t);return e[ot]=i.then(()=>{return},()=>{return}),i}async function tn(t,e,n={}){let i=n.projectRoot||process.cwd(),u=(await a(i)).serverApi,m=n.minify??!1,c=n.externalizeUserModules??!0,y=n.expose?.length?[...new Set(n.expose)].sort():void 0,R=n.cacheDir||tf(i),B=K.getStore(),j=new Bun.CryptoHasher("md5");j.update(`${xt}\x00${et()}\x00${JSON.stringify(u??!1)}\x00${c?"registry":"inline"}\x00${y?y.join(","):"*"}\x00${m?"minified":"readable"}\x00${B?.key??""}\x00${st(t,i)}\x00${st(e,i)}`);let p=j.digest("hex").slice(0,12),r=d.join(R,`${p}.js`),o=k.get(r);if(o){if(Cs(o.files)&&o.files.every((M)=>!X(M.path,i,u))){D("memo hit:",p);let M=o.files.map((O)=>O.path);return q(e,M),n.collectInputs?.push(...M),o.code}k.delete(r),D("memo invalidated by dep change:",p)}let b=d.join(R,`${p}.deps.json`),x=Bun.file(r);if(await x.exists()){let M=Bun.file(b),O=!1,I=null;if(await M.exists())try{let F=JSON.parse(await M.text());if(F.metadataVersion===at&&Array.isArray(F.files)&&bt(F.files,i))I=gr(F.files.map((g)=>ct(g,i))),O=I.length===F.files.length&&!I.some((g)=>X(g.path,i,u))}catch{O=!1}if(O){if(D("cache hit:",p),I)q(e,I.map((T)=>T.path)),n.collectInputs?.push(...I.map((T)=>T.path));let F=await x.text(),g=new Date;if(v.promises.utimes(r,g,g).catch(()=>{}),I)k.set(r,{code:F,files:I});return F}D("cache invalidated by dep change:",p)}let A=H.get(p);if(A){let M=await A;if(n.collectInputs)n.collectInputs.push(...(k.get(r)?.files??[]).map((O)=>O.path));return M}let V=cf(()=>_t(t,e,{projectRoot:i,minify:m,cacheDir:R,hash:p,cachePath:r,depsPath:b,collectInputs:n.collectInputs,externalizeUserModules:c,serverApi:u,expose:y,throwOnFailure:n.throwOnFailure,substitutes:B?.modules}));H.set(p,V);try{return await V}finally{H.delete(p)}}var jt=0;function lf(t){return`${t}-${process.pid}-${++jt}`}async function _t(t,e,n){let{projectRoot:i,minify:u,cacheDir:m,hash:c,cachePath:y,depsPath:R,externalizeUserModules:B}=n,j=l(i,"bundle-tmp"),p=lf(c),r=d.join(i,`.stx-client-${p}.ts`),o=d.join(j,"out",p);v.mkdirSync(o,{recursive:!0});let b=d.dirname(e),x=new Set,A=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,V=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,M=s(t),{depths:O,balanced:I}=ge(M),F=(_)=>!I||O[_]===0,g;while((g=A.exec(M))!==null){if(g[1])continue;if(!F(g.index))continue;if(g[2])g[2].split(",").forEach((_)=>{let f=Et(_);if(f)x.add(f)});else if(g[3])x.add(g[3])}while((g=V.exec(M))!==null){if(g[1])continue;if(!F(g.index))continue;x.add(g[2])}let T=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=T.exec(M))!==null){if(!F(g.index))continue;let _=/^\s*['"]([^'"]+)['"]/.exec(t.slice(g.index+g[0].length))?.[1];if(_&&Q.some((f)=>f.test(_)))continue;if(g[1])x.add(g[1]);if(g[2])x.add(g[2]);for(let f of(g[3]??"").split(",")){let S=f.trim();if(!S||/^type\s/.test(S))continue;let L=/\bas\s+(\w+)\s*$/.exec(S)?.[1]??/^\w+$/.exec(S)?.[0];if(L)x.add(L)}}for(let _ of M.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let f of _[1].split(",")){let S=/\bas\s+(\w+)\s*$/.exec(f)?.[1]??/^\s*(\w+)\s*$/.exec(f)?.[1];if(S)x.delete(S)}let ut=x.size>0?`
|
|
3
|
+
export { ${[...x].join(", ")} }`:"";D("bundling:",c,"from:",d.basename(e));let tt=new Set,nt=new Map;try{let _=await Bun.build({entrypoints:[r],outdir:o,target:"browser",format:"esm",minify:u?{whitespace:!1,identifiers:!0,syntax:!0}:!1,plugins:[Bt(i,b,r,t+ut,tt,B,nt,n.serverApi,n.substitutes)],define:{"process.env.NODE_ENV":u?'"production"':'"development"',...C()},root:i});if(!_.success){let E=_.logs.filter((N)=>N.level==="error").map((N)=>N.message).join(", ")||`Unable to bundle ${d.basename(e)}`,U=Yn(_.logs,e||void 0);if(console.warn("[stx:bundler] build failed:",E),Ba(e||"",E,U),n.throwOnFailure||Fa()==="error")throw Error(E);return t}let f="";for(let h of _.outputs){f=await h.text();break}let S=[];for(let h of f.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let E of h[1].split(",")){let U=E.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(U){S.push([U[2],U[1]]);continue}let N=E.trim();if(/^[A-Za-z_$][\w$]*$/.test(N))S.push([N,N])}if(n.expose){let h=new Set(n.expose);for(let E=S.length-1;E>=0;E--)if(!h.has(S[E][0]))S.splice(E,1)}let L=[];f=af(of(f,nt),L);let dt=f.match(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm)||[];if(f=f.replace(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),u&&f)try{f=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(f)}catch{}let J=`__stxBundle_${c}`,pt=new Set(z(t,!0).split(",").map((h)=>h.trim())),ft=S.map(([h,E])=>`get ${JSON.stringify(h)}() { return ${E} }${pt.has(h)?`, set ${JSON.stringify(h)}(__stxValue_${E}) { ${E} = __stxValue_${E} }`:""}`).join(", "),mt=S.map(([h])=>`var ${h} = undefined;`).join(`
|
|
4
4
|
`),gt=S.map(([h])=>`${h} = ${J}[${JSON.stringify(h)}];`).join(`
|
|
5
5
|
`);if(f=`${dt.join(`
|
|
6
6
|
`)}
|
|
7
7
|
${mt}
|
|
8
8
|
var ${J} = (function() {
|
|
9
|
-
${
|
|
9
|
+
${L.join(`
|
|
10
10
|
`)}
|
|
11
11
|
${f}
|
|
12
12
|
return { ${ft} };
|
|
@@ -16,5 +16,5 @@ var __stxLiveBindings = typeof __stxLiveBindings === 'undefined' ? {} : __stxLiv
|
|
|
16
16
|
Object.keys(${J}).forEach(function(name) {
|
|
17
17
|
if (!Object.prototype.hasOwnProperty.call(__stxLiveBindings, name))
|
|
18
18
|
Object.defineProperty(__stxLiveBindings, name, Object.getOwnPropertyDescriptor(${J}, name));
|
|
19
|
-
});`.trim(),
|
|
20
|
-
export{
|
|
19
|
+
});`.trim(),D("bundled:",c,"output:",f.length,"bytes"),x.size>0&&S.length===0)return console.warn(`[stx:bundler] dropped every binding for ${d.basename(e)} (${c}); serving the unbundled source and not caching this result`),t;v.mkdirSync(m,{recursive:!0}),await Bun.write(y,f);let W=gr(tt);return await Bun.write(R,JSON.stringify({metadataVersion:at,files:W.map((h)=>yt(h.path,i)).filter((h)=>h!==null)})),q(e,W.map((h)=>h.path)),n.collectInputs?.push(...W.map((h)=>h.path)),k.set(y,{code:f,files:W}),await St(m),f}catch(_){let f=Yn(_,e||void 0),S=$e(_,e||void 0);if(console.warn(`[stx:bundler] error: ${S}`),Ba(e||"",S,f),n.throwOnFailure||Fa()==="error")throw _;return t}finally{try{v.rmSync(o,{recursive:!0,force:!0})}catch{}}}function Et(t){let e=t.trim();if(!e)return null;let n=e.indexOf("=");if(n!==-1)e=e.slice(0,n).trim();let i=e.indexOf(":");if(i!==-1)e=e.slice(i+1).trim();if(e.startsWith("..."))e=e.slice(3).trim();return/^[A-Za-z_$][\w$]*$/.test(e)?e:null}
|
|
20
|
+
export{tf,nf,Te,rf,Ba,Yt,Zt,Gm,Fa,Qt,Jn,sf,of,af,mo,en,cf,tn,lf};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Yc,Zc,Qc}from"./chunk-e6ky15dr.js";import{le,Fn,zn,so,Hr,Vr,Hn,Vn,oo,Ur}from"./chunk-jb5sftzz.js";function z(e,s,i,a,d,y){let r=!0,u=new Set,h=(p)=>a.get?a.get(p):p,o=()=>h(e());return Object.defineProperty(o,"_isSignal",{value:!0}),Object.defineProperty(o,"modifiers",{get:s}),o.set=(p)=>{if(!r)return;let f=s(),t=a.set?a.set(p,f):p;if(f.trim&&typeof t==="string")t=t.trim();if(f.number&&typeof t==="string"&&t!==""){let l=Number(t);if(!Number.isNaN(l))t=l}if(Object.is(e(),t))return;e.set(t),i(t)},o.update=(p)=>o.set(p(o())),o.input=(p)=>{if(!s().lazy)o.set(p)},o.change=(p)=>{if(s().lazy)o.set(p)},o.subscribe=(p)=>{if(!r)return()=>{};let f=e.subscribe((t,l)=>p(h(t),h(l)));return u.add(f),()=>{f(),u.delete(f)}},Object.defineProperty(o,"value",{get:o,set:o.set}),d(()=>{r=!1,u.forEach((p)=>p()),u.clear()}),y?.(()=>{r=!0}),o}function X(e,s=!0,i){if(!s||!e||typeof window>"u")return;let a=window;if(!a.__STX_DATA__){let y=document.querySelector("script[data-stx-server-data]");try{let r=JSON.parse(y?.textContent||"{}");a.__STX_DATA__=r&&typeof r==="object"&&!Array.isArray(r)?r:{}}catch{a.__STX_DATA__={}}}let d=a.__STX_DATA__;if(d&&Object.prototype.hasOwnProperty.call(d,e))try{return{data:i?i(d[e]):d[e]}}catch(y){return{data:null,error:y instanceof Error?y:Error(String(y))}}return}function Q(e){if(typeof window>"u")return;let s=window;if(e===void 0)s.__STX_DATA__={};else{if(!s.__STX_DATA__)try{let i=JSON.parse(document.querySelector("script[data-stx-server-data]")?.textContent||"{}");s.__STX_DATA__=i&&typeof i==="object"&&!Array.isArray(i)?i:{}}catch{s.__STX_DATA__={}}if(s.__STX_DATA__)delete s.__STX_DATA__[e]}}function Y(e){let s=null;try{s=typeof indexedDB<"u"?indexedDB:null}catch{s=null}if(!s)return null;let i=s,a=e||"stx-kept",d=null,y=()=>{if(!d)d=new Promise((u,h)=>{let o=i.open(a,1);o.onupgradeneeded=()=>{o.result.createObjectStore("kv")},o.onsuccess=()=>u(o.result),o.onerror=()=>h(o.error),o.onblocked=()=>h(Error("blocked"))}),d.catch(()=>{d=null});return d},r=(u,h)=>y().then((o)=>new Promise((p,f)=>{let t=o.transaction("kv",u),l=h(t.objectStore("kv"));t.oncomplete=()=>p(l?l.result:void 0),t.onerror=()=>f(t.error),t.onabort=()=>f(t.error)}));return{get:(u)=>r("readonly",(h)=>h.get(u)),set:(u,h)=>r("readwrite",(o)=>{o.put(h,u)}),remove:(u)=>r("readwrite",(h)=>{h.delete(u)}),removePrefix:(u)=>r("readwrite",(h)=>{h.delete(IDBKeyRange.bound(u,`${u}\uFFFF`))})}}function J(e,s){let i=e||{},a=null;if(i.storage!==void 0)a=i.storage;else try{a=typeof localStorage<"u"?localStorage:null}catch{a=null}let d=null,y=i.backend!==void 0;if(y)d=i.backend||null;let r=()=>{if(y)return d;y=!0;try{d=s?s():null}catch{d=null}if(d){let n=d;n.get("__stx_probe__").catch(()=>{if(d===n)d=null})}return d},u=i.limit||32768,h=i.defer||((n)=>{let c=typeof requestIdleCallback==="function"?requestIdleCallback:null;if(c)c(n,{timeout:200});else setTimeout(n,16)}),o=new Map,p=new Set,f=new Map,t=!1,l=Promise.resolve(),g=(n)=>{try{return JSON.parse(n)}catch{return n}},m=(n,c)=>{if(!a)return!1;try{return a.setItem(n,c),!0}catch{return!1}},_=(n)=>{try{if(a)a.removeItem(n)}catch{}},k=()=>{if(t=!1,!f.size)return l;let n=Array.from(f.entries());return f.clear(),l=l.then(()=>Promise.all(n.map(([c,v])=>{if(!d){p.delete(c);try{m(c,JSON.stringify(v===void 0?null:v))}catch{}return}let x;try{return x={v},d.set(c,x).catch(()=>{let S;try{S=JSON.stringify(v)}catch{return}return d?d.set(c,{j:S}).catch(()=>{m(c,S)}):void 0})}catch{return}}))).then(()=>{}),l},N=(n,c)=>{if(f.set(n,c),p.add(n),t)return;t=!0,h(()=>{k()})},D=(n)=>{if(!n||typeof n!=="object")return;let c=n;if("v"in c)return{value:c.v};if(typeof c.j==="string")return{value:g(c.j)};return},E={peek(n){if(o.has(n))return{value:o.get(n)};let c=null;try{c=a?a.getItem(n):null}catch{c=null}if(c===null||c===void 0)return;let v=g(c);return o.set(n,v),{value:v}},load(n){let c=E.peek(n),v=c?null:r();if(c||!v)return Promise.resolve(c);return v.get(n).then((x)=>{if(o.has(n))return{value:o.get(n)};let S=D(x);if(S)o.set(n,S.value),p.add(n);return S},()=>{return})},set(n,c){if(o.set(n,c),d&&p.has(n)){N(n,c);return}let v;try{v=JSON.stringify(c===void 0?null:c)}catch{return}if(v.length<=u&&m(n,v))return;if(!r()){if(v.length>u)m(n,v);return}_(n),N(n,c)},forget(n){for(let v of Array.from(o.keys()))if(v.indexOf(n)===0)o.delete(v);for(let v of Array.from(f.keys()))if(v.indexOf(n)===0)f.delete(v);for(let v of Array.from(p))if(v.indexOf(n)===0)p.delete(v);try{if(a)for(let v=a.length-1;v>=0;v--){let x=a.key(v);if(x&&x.indexOf(n)===0)a.removeItem(x)}}catch{}let c=r();if(!c)return l;return l=l.then(()=>c.removePrefix(n)).catch(()=>{}),l},flush(){return k()}};try{if(typeof document<"u"&&document.addEventListener)document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden")k()});if(typeof addEventListener==="function")addEventListener("pagehide",()=>{k()})}catch{}return E}function Z(e,s){if(!e)return!1;if(e===s.key)return!0;if(!s.url)return!1;if(e===s.url)return!0;try{let i=typeof location<"u"&&location.origin&&location.origin!=="null"?location.origin:"http://localhost",a=new URL(e,i),d=new URL(s.url,i);if(a.origin!==d.origin||a.pathname!==d.pathname)return!1;return!a.search||a.search===d.search}catch{return!1}}function ee(e){let s=e.prefix||"stx:kept:",i=e.matches||((t,l)=>t===l.key||t===l.url),a=new Set,d=new Map,y,r=(t)=>t===void 0?y:t,u=(t,l)=>{let g=r(l);if(g===!1||g===null||g==="")return null;return`${s}${g===void 0?"":`${g}:`}query:${t}`},h=(t)=>{let l=t&&t.value;if(!l||typeof l!=="object"||!("d"in l))return;return{data:l.d,at:Number(l.at)||0}},o=()=>{let t=globalThis;return t.__stx_outboxes instanceof Map?t.__stx_outboxes:null},p={setScope(t){y=t},scope:()=>y,keyFor:u,seed(t,l){let g=u(t,l);return g?h(e.kept.peek(g)):void 0},restore(t,l){let g=u(t,l);return g?e.kept.load(g).then(h):Promise.resolve(void 0)},persist(t,l,g){let m=u(t,g);if(m)e.kept.set(m,{d:l,at:Date.now()})},overlay(t,l,g){let m=o();if(!m||!m.size)return l;let _=l;return m.forEach((k)=>{try{_=k.overlay(t,_,g)}catch{}}),_},watch(t){return a.add(t),()=>{a.delete(t)}},cachedQuery(t,l){let g=d.get(t);if(g){if(l&&g.__options)g.__options(l);return g}let m=l||{},_=m.initial===void 0?null:m.initial,k=()=>typeof m.scope==="function"?m.scope():m.scope,N=()=>(typeof m.url==="function"?m.url():m.url)||null,D=()=>({key:t,url:N()}),E=k(),n=_,c=0,v=e.sharedRequest(),x=0,S=p.seed(t,E);if(S)n=S.data;let I=e.state(p.overlay(D(),n)),U=e.state(!1),q=e.state(!1),K=e.state(null),P=e.state(S?S.at:0),R=0,F=()=>{I.set(p.overlay(D(),n))},W=(b)=>{let w=R;p.restore(t,b).then((T)=>{if(!T||w!==R||c)return;n=T.data,P.set(T.at),F()})};if(!S)W(E);let _t=()=>{let b=k();if(b===E)return;E=b,R++,x=0,q.set(!1),U.set(!1),c=0;let w=p.seed(t,E);if(n=w?w.data:_,P.set(w?w.at:0),F(),!w)W(E)},xt=(b,w)=>{let T=m.timeoutMs||15000,C=typeof AbortController<"u"?new AbortController:null,O=null,V=new Promise((M,j)=>{O=setTimeout(()=>{if(C)C.abort();j(Error("The request took too long."))},T)}),A;if(m.load)A=m.load({force:b,url:w,signal:C?C.signal:void 0});else if(w){let M=m.fetch||((L,H)=>fetch(L,H)),j={method:"GET",headers:{Accept:"application/json"}};if(b)j.cache="no-cache";if(C)j.signal=C.signal;A=M(w,j).then((L)=>{if(!L.ok)return L.json().catch(()=>null).then((H)=>{throw Error(H&&(H.error||H.message)||`Request failed (${L.status})`)});return L.json()})}else return Promise.resolve(I());return Promise.race([A,V]).then((M)=>{if(O)clearTimeout(O);return m.transform?m.transform(M):M},(M)=>{if(O)clearTimeout(O);throw M})},G=(b)=>{let w=R,T=N(),C=()=>{if(w!==R)return Promise.resolve(I());if(x++,q.set(!0),c===0&&!P())U.set(!0);let V=()=>{if(w!==R)return;if(x=Math.max(0,x-1),!x)q.set(!1),U.set(!1)};return xt(b,T).then((A)=>{if(w!==R||T!==N())return V(),I();return n=A,c=Date.now(),P.set(c),K.set(null),p.persist(t,A,E),F(),V(),I()},(A)=>{if(w===R&&T===N())K.set(A&&A.message?A.message:"Could not load.");return V(),I()})},O=`${w} ${T||""}`;return b?v.fresh(O,C):v.run(O,C)},B={data:I,loading:U,isFetching:q,error:K,updatedAt:P,get key(){return t},load(b){if(_t(),!b&&c&&Date.now()-c<(m.staleTime||0))return Promise.resolve(I());return G(!!b)},refresh(){return B.load(!0)},set(b){n=typeof b==="function"?b(n):b,p.persist(t,n,E),F()},invalidate(){c=0},__options(b){m={...m,...b}}};if(a.add({target:D,updated:()=>{if(c||P())G(!1)},outbox:(b)=>{if(b)n=p.overlay(D(),n,b.id),c=0,G(!0);F()}}),d.set(t,B),m.immediate)B.load();return B}},f=typeof window<"u"?window:typeof addEventListener==="function"?globalThis:null;if(e.listen!==!1&&f&&typeof f.addEventListener==="function")f.addEventListener("stx:updated",(t)=>{let l=t.detail||{};if(l.kind!=="api"||typeof l.url!=="string")return;a.forEach((g)=>{if(i(l.url,g.target()))g.updated()})}),f.addEventListener("stx:outbox",(t)=>{let l=t.detail||{},g=l.sent&&typeof l.sent.id==="string"?l.sent:null;a.forEach((m)=>{if(g){let _=Array.isArray(g.affects)?g.affects:[],k=m.target();if(!_.some((N)=>i(N,k)))return}m.outbox(g)})});return p}function te(e){let s=e&&e.covers||((r,u)=>Object.is(r,u)),i=[],a=[],d=0,y=(r,u)=>{let h;try{h=Promise.resolve(u())}catch(f){h=Promise.reject(f)}let o={key:r,promise:h};i.push(o);let p=()=>{let f=i.indexOf(o);if(f!==-1)i.splice(f,1)};return h.then(p,p),h};return{run(r,u){for(let h of i)if(s(h.key,r))return h.promise;for(let h of a)if(s(h.key,r))return h.promise;return y(r,u)},fresh(r,u){for(let f of a)if(s(f.key,r))return f.promise;let h=i.filter((f)=>s(f.key,r)).map((f)=>f.promise);if(!h.length)return y(r,u);let o={key:r,promise:null},p=()=>{};return o.promise=Promise.all(h.map((f)=>f.then(p,p))).then(()=>{let f=a.indexOf(o);if(f!==-1)a.splice(f,1);return y(r,u)}),a.push(o),o.promise},latest(){let r=++d;return()=>r===d},get busy(){return i.length>0||a.length>0}}}function ne(e){let s=!1,i=null,a=null,d=0;async function y(){if(s)return;i=new AbortController;try{let r=await e.request(e.endpoint,{signal:i.signal,cache:"no-store",headers:{Accept:"text/event-stream"}});if(!r.ok||!r.body||!r.headers.get("content-type")?.includes("text/event-stream"))throw Error("Broadcast stream unavailable");if(s){await r.body.cancel();return}let u=r.body.getReader(),h=new TextDecoder,o="";d=0,e.onStatus?.(!0),e.onConnected?.();try{while(!s){let{done:p,value:f}=await u.read();if(p)break;if(o+=h.decode(f,{stream:!0}).replace(/\r\n/g,`
|
|
2
|
+
import{Zc,Qc,el}from"./chunk-ez35607j.js";import{le,Fn,zn,oo,Hr,Vr,Hn,Vn,io,Ur}from"./chunk-r3hden6p.js";function z(e,s,i,a,d,y){let r=!0,u=new Set,h=(p)=>a.get?a.get(p):p,o=()=>h(e());return Object.defineProperty(o,"_isSignal",{value:!0}),Object.defineProperty(o,"modifiers",{get:s}),o.set=(p)=>{if(!r)return;let f=s(),t=a.set?a.set(p,f):p;if(f.trim&&typeof t==="string")t=t.trim();if(f.number&&typeof t==="string"&&t!==""){let l=Number(t);if(!Number.isNaN(l))t=l}if(Object.is(e(),t))return;e.set(t),i(t)},o.update=(p)=>o.set(p(o())),o.input=(p)=>{if(!s().lazy)o.set(p)},o.change=(p)=>{if(s().lazy)o.set(p)},o.subscribe=(p)=>{if(!r)return()=>{};let f=e.subscribe((t,l)=>p(h(t),h(l)));return u.add(f),()=>{f(),u.delete(f)}},Object.defineProperty(o,"value",{get:o,set:o.set}),d(()=>{r=!1,u.forEach((p)=>p()),u.clear()}),y?.(()=>{r=!0}),o}function X(e,s=!0,i){if(!s||!e||typeof window>"u")return;let a=window;if(!a.__STX_DATA__){let y=document.querySelector("script[data-stx-server-data]");try{let r=JSON.parse(y?.textContent||"{}");a.__STX_DATA__=r&&typeof r==="object"&&!Array.isArray(r)?r:{}}catch{a.__STX_DATA__={}}}let d=a.__STX_DATA__;if(d&&Object.prototype.hasOwnProperty.call(d,e))try{return{data:i?i(d[e]):d[e]}}catch(y){return{data:null,error:y instanceof Error?y:Error(String(y))}}return}function Q(e){if(typeof window>"u")return;let s=window;if(e===void 0)s.__STX_DATA__={};else{if(!s.__STX_DATA__)try{let i=JSON.parse(document.querySelector("script[data-stx-server-data]")?.textContent||"{}");s.__STX_DATA__=i&&typeof i==="object"&&!Array.isArray(i)?i:{}}catch{s.__STX_DATA__={}}if(s.__STX_DATA__)delete s.__STX_DATA__[e]}}function Y(e){let s=null;try{s=typeof indexedDB<"u"?indexedDB:null}catch{s=null}if(!s)return null;let i=s,a=e||"stx-kept",d=null,y=()=>{if(!d)d=new Promise((u,h)=>{let o=i.open(a,1);o.onupgradeneeded=()=>{o.result.createObjectStore("kv")},o.onsuccess=()=>u(o.result),o.onerror=()=>h(o.error),o.onblocked=()=>h(Error("blocked"))}),d.catch(()=>{d=null});return d},r=(u,h)=>y().then((o)=>new Promise((p,f)=>{let t=o.transaction("kv",u),l=h(t.objectStore("kv"));t.oncomplete=()=>p(l?l.result:void 0),t.onerror=()=>f(t.error),t.onabort=()=>f(t.error)}));return{get:(u)=>r("readonly",(h)=>h.get(u)),set:(u,h)=>r("readwrite",(o)=>{o.put(h,u)}),remove:(u)=>r("readwrite",(h)=>{h.delete(u)}),removePrefix:(u)=>r("readwrite",(h)=>{h.delete(IDBKeyRange.bound(u,`${u}\uFFFF`))})}}function J(e,s){let i=e||{},a=null;if(i.storage!==void 0)a=i.storage;else try{a=typeof localStorage<"u"?localStorage:null}catch{a=null}let d=null,y=i.backend!==void 0;if(y)d=i.backend||null;let r=()=>{if(y)return d;y=!0;try{d=s?s():null}catch{d=null}if(d){let n=d;n.get("__stx_probe__").catch(()=>{if(d===n)d=null})}return d},u=i.limit||32768,h=i.defer||((n)=>{let c=typeof requestIdleCallback==="function"?requestIdleCallback:null;if(c)c(n,{timeout:200});else setTimeout(n,16)}),o=new Map,p=new Set,f=new Map,t=!1,l=Promise.resolve(),g=(n)=>{try{return JSON.parse(n)}catch{return n}},m=(n,c)=>{if(!a)return!1;try{return a.setItem(n,c),!0}catch{return!1}},_=(n)=>{try{if(a)a.removeItem(n)}catch{}},k=()=>{if(t=!1,!f.size)return l;let n=Array.from(f.entries());return f.clear(),l=l.then(()=>Promise.all(n.map(([c,v])=>{if(!d){p.delete(c);try{m(c,JSON.stringify(v===void 0?null:v))}catch{}return}let x;try{return x={v},d.set(c,x).catch(()=>{let S;try{S=JSON.stringify(v)}catch{return}return d?d.set(c,{j:S}).catch(()=>{m(c,S)}):void 0})}catch{return}}))).then(()=>{}),l},N=(n,c)=>{if(f.set(n,c),p.add(n),t)return;t=!0,h(()=>{k()})},D=(n)=>{if(!n||typeof n!=="object")return;let c=n;if("v"in c)return{value:c.v};if(typeof c.j==="string")return{value:g(c.j)};return},E={peek(n){if(o.has(n))return{value:o.get(n)};let c=null;try{c=a?a.getItem(n):null}catch{c=null}if(c===null||c===void 0)return;let v=g(c);return o.set(n,v),{value:v}},load(n){let c=E.peek(n),v=c?null:r();if(c||!v)return Promise.resolve(c);return v.get(n).then((x)=>{if(o.has(n))return{value:o.get(n)};let S=D(x);if(S)o.set(n,S.value),p.add(n);return S},()=>{return})},set(n,c){if(o.set(n,c),d&&p.has(n)){N(n,c);return}let v;try{v=JSON.stringify(c===void 0?null:c)}catch{return}if(v.length<=u&&m(n,v))return;if(!r()){if(v.length>u)m(n,v);return}_(n),N(n,c)},forget(n){for(let v of Array.from(o.keys()))if(v.indexOf(n)===0)o.delete(v);for(let v of Array.from(f.keys()))if(v.indexOf(n)===0)f.delete(v);for(let v of Array.from(p))if(v.indexOf(n)===0)p.delete(v);try{if(a)for(let v=a.length-1;v>=0;v--){let x=a.key(v);if(x&&x.indexOf(n)===0)a.removeItem(x)}}catch{}let c=r();if(!c)return l;return l=l.then(()=>c.removePrefix(n)).catch(()=>{}),l},flush(){return k()}};try{if(typeof document<"u"&&document.addEventListener)document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden")k()});if(typeof addEventListener==="function")addEventListener("pagehide",()=>{k()})}catch{}return E}function Z(e,s){if(!e)return!1;if(e===s.key)return!0;if(!s.url)return!1;if(e===s.url)return!0;try{let i=typeof location<"u"&&location.origin&&location.origin!=="null"?location.origin:"http://localhost",a=new URL(e,i),d=new URL(s.url,i);if(a.origin!==d.origin||a.pathname!==d.pathname)return!1;return!a.search||a.search===d.search}catch{return!1}}function ee(e){let s=e.prefix||"stx:kept:",i=e.matches||((t,l)=>t===l.key||t===l.url),a=new Set,d=new Map,y,r=(t)=>t===void 0?y:t,u=(t,l)=>{let g=r(l);if(g===!1||g===null||g==="")return null;return`${s}${g===void 0?"":`${g}:`}query:${t}`},h=(t)=>{let l=t&&t.value;if(!l||typeof l!=="object"||!("d"in l))return;return{data:l.d,at:Number(l.at)||0}},o=()=>{let t=globalThis;return t.__stx_outboxes instanceof Map?t.__stx_outboxes:null},p={setScope(t){y=t},scope:()=>y,keyFor:u,seed(t,l){let g=u(t,l);return g?h(e.kept.peek(g)):void 0},restore(t,l){let g=u(t,l);return g?e.kept.load(g).then(h):Promise.resolve(void 0)},persist(t,l,g){let m=u(t,g);if(m)e.kept.set(m,{d:l,at:Date.now()})},overlay(t,l,g){let m=o();if(!m||!m.size)return l;let _=l;return m.forEach((k)=>{try{_=k.overlay(t,_,g)}catch{}}),_},watch(t){return a.add(t),()=>{a.delete(t)}},cachedQuery(t,l){let g=d.get(t);if(g){if(l&&g.__options)g.__options(l);return g}let m=l||{},_=m.initial===void 0?null:m.initial,k=()=>typeof m.scope==="function"?m.scope():m.scope,N=()=>(typeof m.url==="function"?m.url():m.url)||null,D=()=>({key:t,url:N()}),E=k(),n=_,c=0,v=e.sharedRequest(),x=0,S=p.seed(t,E);if(S)n=S.data;let I=e.state(p.overlay(D(),n)),U=e.state(!1),q=e.state(!1),K=e.state(null),P=e.state(S?S.at:0),R=0,F=()=>{I.set(p.overlay(D(),n))},W=(b)=>{let w=R;p.restore(t,b).then((T)=>{if(!T||w!==R||c)return;n=T.data,P.set(T.at),F()})};if(!S)W(E);let _t=()=>{let b=k();if(b===E)return;E=b,R++,x=0,q.set(!1),U.set(!1),c=0;let w=p.seed(t,E);if(n=w?w.data:_,P.set(w?w.at:0),F(),!w)W(E)},xt=(b,w)=>{let T=m.timeoutMs||15000,C=typeof AbortController<"u"?new AbortController:null,O=null,V=new Promise((M,j)=>{O=setTimeout(()=>{if(C)C.abort();j(Error("The request took too long."))},T)}),A;if(m.load)A=m.load({force:b,url:w,signal:C?C.signal:void 0});else if(w){let M=m.fetch||((L,H)=>fetch(L,H)),j={method:"GET",headers:{Accept:"application/json"}};if(b)j.cache="no-cache";if(C)j.signal=C.signal;A=M(w,j).then((L)=>{if(!L.ok)return L.json().catch(()=>null).then((H)=>{throw Error(H&&(H.error||H.message)||`Request failed (${L.status})`)});return L.json()})}else return Promise.resolve(I());return Promise.race([A,V]).then((M)=>{if(O)clearTimeout(O);return m.transform?m.transform(M):M},(M)=>{if(O)clearTimeout(O);throw M})},G=(b)=>{let w=R,T=N(),C=()=>{if(w!==R)return Promise.resolve(I());if(x++,q.set(!0),c===0&&!P())U.set(!0);let V=()=>{if(w!==R)return;if(x=Math.max(0,x-1),!x)q.set(!1),U.set(!1)};return xt(b,T).then((A)=>{if(w!==R||T!==N())return V(),I();return n=A,c=Date.now(),P.set(c),K.set(null),p.persist(t,A,E),F(),V(),I()},(A)=>{if(w===R&&T===N())K.set(A&&A.message?A.message:"Could not load.");return V(),I()})},O=`${w} ${T||""}`;return b?v.fresh(O,C):v.run(O,C)},B={data:I,loading:U,isFetching:q,error:K,updatedAt:P,get key(){return t},load(b){if(_t(),!b&&c&&Date.now()-c<(m.staleTime||0))return Promise.resolve(I());return G(!!b)},refresh(){return B.load(!0)},set(b){n=typeof b==="function"?b(n):b,p.persist(t,n,E),F()},invalidate(){c=0},__options(b){m={...m,...b}}};if(a.add({target:D,updated:()=>{if(c||P())G(!1)},outbox:(b)=>{if(b)n=p.overlay(D(),n,b.id),c=0,G(!0);F()}}),d.set(t,B),m.immediate)B.load();return B}},f=typeof window<"u"?window:typeof addEventListener==="function"?globalThis:null;if(e.listen!==!1&&f&&typeof f.addEventListener==="function")f.addEventListener("stx:updated",(t)=>{let l=t.detail||{};if(l.kind!=="api"||typeof l.url!=="string")return;a.forEach((g)=>{if(i(l.url,g.target()))g.updated()})}),f.addEventListener("stx:outbox",(t)=>{let l=t.detail||{},g=l.sent&&typeof l.sent.id==="string"?l.sent:null;a.forEach((m)=>{if(g){let _=Array.isArray(g.affects)?g.affects:[],k=m.target();if(!_.some((N)=>i(N,k)))return}m.outbox(g)})});return p}function te(e){let s=e&&e.covers||((r,u)=>Object.is(r,u)),i=[],a=[],d=0,y=(r,u)=>{let h;try{h=Promise.resolve(u())}catch(f){h=Promise.reject(f)}let o={key:r,promise:h};i.push(o);let p=()=>{let f=i.indexOf(o);if(f!==-1)i.splice(f,1)};return h.then(p,p),h};return{run(r,u){for(let h of i)if(s(h.key,r))return h.promise;for(let h of a)if(s(h.key,r))return h.promise;return y(r,u)},fresh(r,u){for(let f of a)if(s(f.key,r))return f.promise;let h=i.filter((f)=>s(f.key,r)).map((f)=>f.promise);if(!h.length)return y(r,u);let o={key:r,promise:null},p=()=>{};return o.promise=Promise.all(h.map((f)=>f.then(p,p))).then(()=>{let f=a.indexOf(o);if(f!==-1)a.splice(f,1);return y(r,u)}),a.push(o),o.promise},latest(){let r=++d;return()=>r===d},get busy(){return i.length>0||a.length>0}}}function ne(e){let s=!1,i=null,a=null,d=0;async function y(){if(s)return;i=new AbortController;try{let r=await e.request(e.endpoint,{signal:i.signal,cache:"no-store",headers:{Accept:"text/event-stream"}});if(!r.ok||!r.body||!r.headers.get("content-type")?.includes("text/event-stream"))throw Error("Broadcast stream unavailable");if(s){await r.body.cancel();return}let u=r.body.getReader(),h=new TextDecoder,o="";d=0,e.onStatus?.(!0),e.onConnected?.();try{while(!s){let{done:p,value:f}=await u.read();if(p)break;if(o+=h.decode(f,{stream:!0}).replace(/\r\n/g,`
|
|
3
3
|
`),o.length>1048576)throw Error("Broadcast frame too large");let t;while((t=o.indexOf(`
|
|
4
4
|
|
|
5
5
|
`))!==-1){let l=o.slice(0,t);o=o.slice(t+2);let g=l.split(`
|
|
@@ -10518,7 +10518,7 @@ ${se}
|
|
|
10518
10518
|
${ue}
|
|
10519
10519
|
${me}
|
|
10520
10520
|
${Ke}
|
|
10521
|
-
${tt(
|
|
10521
|
+
${tt(Qc(),el(),Zc())}
|
|
10522
10522
|
|
|
10523
10523
|
${ht}
|
|
10524
10524
|
${it}
|
|
@@ -10571,5 +10571,5 @@ ${lt}
|
|
|
10571
10571
|
${ct}
|
|
10572
10572
|
${at}
|
|
10573
10573
|
})();
|
|
10574
|
-
`}var
|
|
10575
|
-
export{gt,Bn,
|
|
10574
|
+
`}var Mm={state:le,derived:Fn,effect:zn,batch:oo,onMount:Hr,onDestroy:Vr,isSignal:Hn,isDerived:Vn,untrack:io,peek:Ur,generateSignalsRuntime:gt,generateSignalsRuntimeDev:Bn};
|
|
10575
|
+
export{gt,Bn,Mm};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Xc,Jc}from"./chunk-e6ky15dr.js";import{z,xs,Ss,ks,Uo,Wo,mr,Oe,pe,X,Cs,ie,J,I,tt,yr,Xo,wr,Be,r,p,H,yn}from"./chunk-067sgh2j.js";import{f,R,nt,d}from"./chunk-xyyt8v1r.js";import{n}from"./chunk-hava1caf.js";import{se}from"./chunk-7dc3n69c.js";import{s}from"./chunk-vstvadc2.js";import{g}from"./chunk-0dve54ne.js";import{createHash as Ct}from"crypto";import ee from"fs";import Q from"path";import{decode as sn,generateThumbHash as on}from"ts-images";import{createImageDeliveryCatalog as yt}from"ts-images/delivery";import De from"fs";function Ce(e,t,i){let o=Buffer.alloc(i),a=De.readSync(e,o,0,i,t);return o.subarray(0,a)}function je(e){if(e.length<25)return!1;let t=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(t(0,4)!=="RIFF"||t(8,12)!=="WEBP")return!1;let i=t(12,16);if(i==="VP8X")return(e[20]&16)!==0;if(i==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Me(e){let t;try{t=De.openSync(e,"r");let i=Ce(t,0,33);if(i.length>=3&&i[0]===255&&i[1]===216&&i[2]===255)return"none";if(i.length>=26&&i[0]===137&&i.toString("latin1",1,4)==="PNG"){let o=i[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ce(t,a,8);if(l.length<8)return"unknown";let m=l.toString("latin1",4,8);if(m==="tRNS")return"possible";if(m==="IDAT"||m==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(i.length>=25&&i.toString("latin1",0,4)==="RIFF"&&i.toString("latin1",8,12)==="WEBP"){if(je(i))return"possible";let o=i.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(t!==void 0)De.closeSync(t)}}import Jt from"fs";import Re from"os";import{join as dt}from"path";import{fileURLToPath as gt}from"url";import{Worker as mt}from"worker_threads";var ke=Symbol("stx.image-worker.unavailable");function Yt(e=typeof Re.availableParallelism==="function"?Re.availableParallelism():Re.cpus().length){return Math.max(1,Math.min(2,e-1))}var Ae=0,ht=[];async function Qt(){if(Ae<Yt()){Ae++;return}await new Promise((e)=>ht.push(e)),Ae++}function en(){Ae--,ht.shift()?.()}var tn="@stacksjs/stx/builtins/image-warmup-worker";function nn(e=process.cwd()){let t=import.meta.url.endsWith(".ts")?"ts":"js";try{let i=new URL(`./image-warmup-worker.${t}`,import.meta.url);if(i.protocol==="file:"&&Jt.existsSync(gt(i)))return gt(i)}catch{}try{let i=typeof Bun<"u"?Bun.resolveSync(tn,e):void 0;return i&&rn(i)?i:void 0}catch{return}}function rn(e,t=process.env){let i=e.replace(/\\/g,"/");if(i.split("/").some((a)=>/@\d[^/]*@@@\d+$/.test(a)))return!1;return![t.BUN_INSTALL_CACHE_DIR,dt(t.BUN_INSTALL||dt(Re.homedir(),".bun"),"install","cache")].filter((a)=>!!a).map((a)=>`${a.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((a)=>i.startsWith(a))}var pt=!1;function me(e){if(!pt)pt=!0,console.warn(`[stx] image worker unavailable (${e}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return ke}function Le(e){return e instanceof Error?e.message:String(e)}async function ze(e,t){if(typeof mt!=="function")return me("node:worker_threads has no Worker in this runtime");let i=nn();if(!i)return me("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await Qt();try{return await new Promise((o,a)=>{let c;try{c=new mt(i)}catch(y){o(me(`could not start ${i}: ${Le(y)}`));return}let l=!1,m=!1,u=(y)=>{if(m)return;m=!0,y(),c.terminate()};c.on("message",(y)=>{if(y.type==="ready"){l=!0,c.postMessage({task:e,args:t});return}if(y.type==="result"){u(()=>o(y.value));return}let w=Error(y.error?.message??"image worker failed");if(y.error?.name)w.name=y.error.name;if(y.error?.stack)w.stack=y.error.stack;u(()=>a(w))}),c.on("error",(y)=>{u(()=>l?a(y instanceof Error?y:Error(Le(y)||"image worker crashed")):o(me(`the worker failed before it was ready: ${Le(y)}`)))}),c.on("exit",(y)=>{u(()=>l?a(Error("image worker exited before it finished")):o(me(`the worker exited with code ${y} before it was ready`)))})})}finally{en()}}var an=new Set([".avif",".jpeg",".jpg",".png",".webp"]),cn=[320,640,960,1280,1920],he="/_stx/images",ln=`stx:${he}:alpha-1`,un=`stx:${he}:opaque-1`,fn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Pe;function dn(e,t){let i=Q.dirname(Bun.resolveSync(e,t));while(i!==Q.dirname(i)){let o=Q.join(i,"package.json");if(ee.existsSync(o)){let a=JSON.parse(ee.readFileSync(o,"utf8"));if(a.name===e)return a.version}i=Q.dirname(i)}return}function xt(){if(Pe!==void 0)return Pe;let e;try{e=Q.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Pe=fn.map((t)=>{let i;try{i=e?dn(t,e):void 0}catch{}return`${t.replace("@stacksjs/","")}@${i??"unknown"}`}).join("+"),Pe}var bt=Symbol.for("stx.image-delivery");function ye(){let e=globalThis;return e[bt]??={catalog:new Map,transparent:new Set},e[bt]}var vt=new Set;function gn(e){return`/${e.split(Q.sep).map(encodeURIComponent).join("/")}`}function mn(e){let t=Q.extname(e),i=e.slice(0,-t.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=Ct("sha256").update(e).digest("hex").slice(0,8);return`${i||"image"}-${o}`}function wt(e,t=`stx:${he}`){let i=(o)=>`${he}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:t,async stat(o){let a=Q.join(e,o);try{let c=await ee.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:i(o)}:null}catch{return null}},async write(o,a){let c=Q.join(e,o);await ee.promises.mkdir(Q.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await ee.promises.writeFile(l,a),await ee.promises.rename(l,c),{bytes:a.byteLength,path:c,url:i(o)}},url:i}}async function Rt(e,t=e){let i=await ee.promises.readdir(t,{withFileTypes:!0});i.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of i){let c=Q.join(t,a.name);if(a.isDirectory()){o.push(...await Rt(e,c));continue}if(!a.isFile()||!an.has(Q.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:Q.relative(e,c)})}return o}function $t(e,t){return e.map((i)=>({key:gn(i.relativePath),input:i.absolutePath,name:mn(i.relativePath),...pn(i.absolutePath)?{options:{storage:t}}:{}}))}function pn(e){return Me(e)==="possible"}function hn(e){for(let t=3;t<e.length;t+=4)if(e[t]!==255)return!0;return!1}async function xn(e){let t=Object.entries(e).filter(([,a])=>a.fallback.format==="png"),i=new Set,o=8;for(let a=0;a<t.length;a+=8)await Promise.all(t.slice(a,a+8).map(async([c,l])=>{let m=l.variants.filter((u)=>u.format==="png").sort((u,y)=>u.width-y.width)[0];try{let u=await sn(new Uint8Array(await ee.promises.readFile(m?.path??l.fallback.path)));if(hn(u.data))i.add(c)}catch{i.add(c)}}));return i}function bn(e,t){let i=[];for(let o of t){let a=e[o],c=a?.variants.filter((m)=>m.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((m)=>{let u;try{return u=ee.openSync(m.path,"r"),!je(Ce(u,0,32))}catch{return!0}finally{if(u!==void 0)ee.closeSync(u)}}))continue;if(a.variants=a.variants.filter((m)=>m.format!=="webp"),delete a.sources.webp,i.push(o),!vt.has(o))vt.add(o),console.warn(`[stx-images] ${o} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return i}async function vn(e){let t=[],i=8;for(let o=0;o<e.length;o+=8){let a=e.slice(o,o+8),c=await Promise.all(a.map(async(l)=>{try{return await on(l.absolutePath),l}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${l.relativePath}`),null}}));t.push(...c.filter((l)=>l!==null))}return t}function Ue(e){return Q.join(e,"undecodable.json")}function wn(e){try{let t=ee.readFileSync(Ue(e),"utf-8"),i=JSON.parse(t);return i&&typeof i==="object"?i:{}}catch{return{}}}function $n(e,t){try{ee.mkdirSync(Q.dirname(Ue(e)),{recursive:!0}),ee.writeFileSync(Ue(e),JSON.stringify(t))}catch{}}function St(e){try{let t=ee.statSync(e);return{mtimeMs:t.mtimeMs,size:t.size}}catch{return}}function At(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let t=e.split(/[?#]/,1)[0];if(!t)return;try{return`/${t.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function So(e){let t=At(e);return t?ye().catalog.get(t):void 0}function ko(e){let t=At(e);return t?ye().transparent.has(t):!1}function _o(e){let t=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),i=t(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:t(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<i).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function nh(e){let t=So(e);if(!t)return;return{src:t.fallback.url,srcset:t.sources[t.fallback.format]||"",sources:_o(t).map(({format:i,srcset:o})=>({type:`image/${i}`,srcset:o})),width:t.source.width,height:t.source.height,placeholder:ko(e)?void 0:t.placeholder?.dataUrl}}function es(){let e=ye();e.catalog=new Map,e.transparent=new Set}function Sn(e){let t=ye();t.catalog=new Map(e.entries),t.transparent=new Set(e.transparent)}async function rh(e,t,i={}){if(!e||!ee.existsSync(e))return es(),{count:0,fingerprint:""};if(i.offThread){let h=await ze("delivery",{publicDir:e,outputDir:t});if(h!==ke)return Sn(h.state),h.result}let o=await Rt(e);if(o.length===0)return es(),{count:0,fingerprint:""};let a=wn(t),c=o.filter((h)=>{let v=a[h.relativePath];if(!v)return!0;let S=St(h.absolutePath);return!S||S.mtimeMs!==v.mtimeMs||S.size!==v.size});if(c.length===0)return es(),{count:0,fingerprint:""};let l=wt(Q.join(t,"_stx","images"),`${ln}:${xt()}`),m={outDir:Q.join(t,"_stx","images"),storage:wt(Q.join(t,"_stx","images"),`${un}:${xt()}`),baseUrl:he,widths:cn,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},u=c,y;try{y=await yt({...m,entries:$t(c,l)})}catch(h){if(u=await vn(c),u.length===c.length)throw h;let v=new Set(u.map((A)=>A.relativePath)),S=!1;for(let A of c){if(v.has(A.relativePath))continue;let P=St(A.absolutePath);if(!P)continue;a[A.relativePath]=P,S=!0}if(S)$n(t,a);if(u.length===0)return es(),{count:0,fingerprint:""};y=await yt({...m,entries:$t(u,l)})}let w=await xn(y.entries),x=bn(y.entries,w),C=ye();C.catalog=new Map(Object.entries(y.entries)),C.transparent=w;let b=w.size===0&&x.length===0?y.fingerprint:Ct("sha256").update(y.fingerprint).update(JSON.stringify({transparent:[...w].sort(),droppedWebp:x.sort()})).digest("hex");return{count:u.length,fingerprint:b}}class kt{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let t of e.aliases)this.builtins.set(t.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,t,i,o){let a=Uo(e,o);if(a!==void 0)return a;for(let c of Wo(e,t,i,o))if(await r(c))return c;return null}}var le=new kt;var re="\x00stx-boolean-attribute";function We(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var Cn=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function Fe(e){let t=e.toLowerCase();return t.startsWith("aria-")||t.startsWith("data-")||Cn.has(t)}function oe(e,t){let i=[];for(let[o,a]of Object.entries(e.static)){if(t.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)i.push(p(c));continue}if(a===re){i.push(p(c));continue}i.push(`${p(c)}="${yn(c,We(String(a)))}"`)}return i}function ae(e,t){let i=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(t.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){i.push(p(c));continue}if(typeof a==="object")continue;i.push(`${p(c)}="${yn(c,We(String(a)))}"`)}return i}function Rn(e){if(e.clientReactive.to)return{value:e.clientReactive.to,reactive:!0};if(e.serverDynamic.to!==void 0)return{value:String(e.serverDynamic.to),reactive:!1};if(typeof e.static.to==="string")return{value:e.static.to,reactive:!1};return{value:"#",reactive:!1}}var He={name:"StxLink",aliases:["stx-link"],render(e,t,i){let o=Rn(e),a=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),c=typeof e.static.activeClass==="string"?e.static.activeClass:"active",l=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",m=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,u=[];if(o.reactive)u.push(`:href="${n(o.value)}"`);else u.push(`href="${n(mr(o.value,"navigable"))}"`);if(a)u.push(`class="${n(a)}"`);if(u.push("data-stx-link"),u.push(`data-stx-active-class="${n(c)}"`),u.push(`data-stx-exact-active-class="${n(l)}"`),m)u.push("data-stx-prefetch");let y=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(y)u.push(`data-stx-active-match="${n(y)}"`);let w=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return u.push(...oe(e,w)),u.push(...ae(e,w)),`<a ${u.join(" ")}>${t}</a>`}};var An=new Map;function qe(e){if(!e)return;let t=e.split("?")[0].split("#")[0];return An.get(t)}var kn={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Xe=[320,640,768,1024,1280,1536,1920];function K(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);let i=e.static[t];if(typeof i==="string")return i;return}function _e(e,t,i=!1){let o=e.serverDynamic[t];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[t];if(a!==void 0)return a!=="false"&&a!==!1;return i}function Ze(e){if(e.includes("(")||e.includes(","))return e;let t=e.trim().split(/\s+/),i=[];for(let o of t)if(o.includes(":")){let[a,c]=o.split(":"),l=kn[a];if(l)i.push(`(max-width: ${l}px) ${c}`);else{let m=Number.parseInt(a);if(!Number.isNaN(m))i.push(`(max-width: ${m}px) ${c}`)}}else i.push(o);return i.join(", ")}function Ve(e,t,i,o){return t.map((a)=>`${xe(e,a,void 0,i,o)} ${a}w`).join(", ")}function Pn(e,t,i,o,a){return t.map((c)=>{let l=i?i*c:void 0;return`${xe(e,l,void 0,o,a)} ${c}x`}).join(", ")}function xe(e,t,i,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(t)c.push(`w_${t}`);if(i)c.push(`h_${i}`);if(a)c.push(`f_${a}`);c.push("q_auto");let l=c.join(",");return e.replace("/upload/",`/upload/${l}/`)}if(o==="imgix"){let c=new URLSearchParams;if(t)c.set("w",String(t));if(i)c.set("h",String(i));if(a)c.set("fm",a);c.set("auto","format");let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}if(o==="bunny"){let c=new URLSearchParams;if(t)c.set("width",String(t));if(i)c.set("height",String(i));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function _n(e){return`var s=this.style;${e.map((t)=>`s.${t}=''`).join(";")}`}function In(e,t,i="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${t}"><rect width="100%" height="100%" fill="${i}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var Ge={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,t,i){let o=K(e,"src")||"",a=So(o),c=K(e,"alt")||"",l=K(e,"width")||(a?String(a.source.width):void 0),m=K(e,"height")||(a?String(a.source.height):void 0),u=K(e,"sizes"),y=K(e,"srcset"),w=K(e,"densities"),x=K(e,"format"),C=ko(o)||qe(o)?.transparent===!0,b=K(e,"placeholder")||(a&&!C?"thumbhash":void 0),h=K(e,"placeholderColor")||"#e5e7eb",v=K(e,"provider"),S=K(e,"class")||K(e,"className")||"",A=K(e,"style")||"",P=K(e,"objectFit")||K(e,"fit"),k=K(e,"objectPosition")||K(e,"position"),N=K(e,"quality"),W=_e(e,"lazy",!0),M=_e(e,"preload",!1),L=_e(e,"priority",!1),Z=K(e,"loading"),O=K(e,"decoding")||"async",E=!!a||_e(e,"picture",!1)||!!x,B=l?Number.parseInt(l):void 0,T=m?Number.parseInt(m):void 0,U=y||"",G="";if(a)U=a.sources[a.fallback.format]||"",G=u?Ze(u):"100vw";else if(!U&&u&&v&&v!=="local"&&v!=="static")U=Ve(o,Xe,v,x),G=Ze(u);else if(!U&&w){let _=w.split(/\s+/).map((q)=>Number.parseFloat(q.replace("x","")));U=Pn(o,_,B,v,x)}else if(u)G=Ze(u);let j=[];if(A)j.push(A);if(P)j.push(`object-fit:${P}`);if(k)j.push(`object-position:${k}`);if(B&&T)j.push(`aspect-ratio:${B}/${T}`);let F=[],ce=b==="blur"||b==="color"||b==="thumbhash";if(ce&&!C){let _=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:h}:qe(o);if(_&&b==="color")j.push(`background-color:${_.color}`),F.push("backgroundColor");else if(_)j.push(`background-color:${_.color}`),j.push(`background-image:url(${_.dataUrl})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),F.push("backgroundColor","backgroundImage");else{let q=In(B||16,T||9,h);j.push(`background-image:url(${q})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),F.push("backgroundImage")}}else if(!ce&&b&&b!=="empty"&&b!=="none")j.push(`background-image:url(${n(b)})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),F.push("backgroundImage");let we=a?.fallback.url||xe(o,B,T,v,x),Y=[];if(Y.push(`src="${n(mr(we,"fetched"))}"`),Y.push(`alt="${n(c)}"`),l)Y.push(`width="${n(l)}"`);if(m)Y.push(`height="${n(m)}"`);let ne=Z||(L||M?"eager":W?"lazy":"");if(ne)Y.push(`loading="${n(ne)}"`);if(L)Y.push('fetchpriority="high"');if(Y.push(`decoding="${n(O)}"`),S)Y.push(`class="${n(S)}"`);if(j.length>0)Y.push(`style="${n(j.join(";"))}"`);if(U)Y.push(`srcset="${n(mr(U,"fetched"))}"`);if(G)Y.push(`sizes="${n(G)}"`);let $e=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","objectFit","objectPosition","fit","position","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(F.length>0){let _=typeof e.static.onload==="string"?e.static.onload:"",q=_n(F)+(_?`;${_}`:"");Y.push(`onload="${n(q)}"`),$e.add("onload")}Y.push(...oe(e,$e)),Y.push(...ae(e,$e));let D=`<img ${Y.join(" ")} />`,V="";if(M){let q=x==="webp"?"image/webp":x==="avif"?"image/avif":"";V=`<link rel="preload" as="image" href="${n(we)}"${q?` type="${q}"`:""}${U?` imagesrcset="${n(U)}"`:""}${G?` imagesizes="${n(G)}"`:""} />
|
|
3
|
-
`}if(E){let _=[];if(a)for(let
|
|
2
|
+
import{Jc,Yc}from"./chunk-ez35607j.js";import{H,Ss,ks,_s,Wo,qo,mr,Oe,pe,X,Es,ie,J,I,tt,yr,Jo,wr,Be,r,p,V,yn}from"./chunk-q73xkgn0.js";import{f,R,nt,d}from"./chunk-zkx2m308.js";import{n}from"./chunk-mymb85q5.js";import{se}from"./chunk-r3j4m04w.js";import{s}from"./chunk-05qf3e2p.js";import{g}from"./chunk-0dve54ne.js";import{createHash as Ct}from"crypto";import ee from"fs";import Q from"path";import{decode as sn,generateThumbHash as on}from"ts-images";import{createImageDeliveryCatalog as yt}from"ts-images/delivery";import De from"fs";function Ce(e,t,i){let o=Buffer.alloc(i),a=De.readSync(e,o,0,i,t);return o.subarray(0,a)}function je(e){if(e.length<25)return!1;let t=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(t(0,4)!=="RIFF"||t(8,12)!=="WEBP")return!1;let i=t(12,16);if(i==="VP8X")return(e[20]&16)!==0;if(i==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Me(e){let t;try{t=De.openSync(e,"r");let i=Ce(t,0,33);if(i.length>=3&&i[0]===255&&i[1]===216&&i[2]===255)return"none";if(i.length>=26&&i[0]===137&&i.toString("latin1",1,4)==="PNG"){let o=i[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ce(t,a,8);if(l.length<8)return"unknown";let m=l.toString("latin1",4,8);if(m==="tRNS")return"possible";if(m==="IDAT"||m==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(i.length>=25&&i.toString("latin1",0,4)==="RIFF"&&i.toString("latin1",8,12)==="WEBP"){if(je(i))return"possible";let o=i.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(t!==void 0)De.closeSync(t)}}import Jt from"fs";import Re from"os";import{join as dt}from"path";import{fileURLToPath as gt}from"url";import{Worker as mt}from"worker_threads";var ke=Symbol("stx.image-worker.unavailable");function Yt(e=typeof Re.availableParallelism==="function"?Re.availableParallelism():Re.cpus().length){return Math.max(1,Math.min(2,e-1))}var Ae=0,ht=[];async function Qt(){if(Ae<Yt()){Ae++;return}await new Promise((e)=>ht.push(e)),Ae++}function en(){Ae--,ht.shift()?.()}var tn="@stacksjs/stx/builtins/image-warmup-worker";function nn(e=process.cwd()){let t=import.meta.url.endsWith(".ts")?"ts":"js";try{let i=new URL(`./image-warmup-worker.${t}`,import.meta.url);if(i.protocol==="file:"&&Jt.existsSync(gt(i)))return gt(i)}catch{}try{let i=typeof Bun<"u"?Bun.resolveSync(tn,e):void 0;return i&&rn(i)?i:void 0}catch{return}}function rn(e,t=process.env){let i=e.replace(/\\/g,"/");if(i.split("/").some((a)=>/@\d[^/]*@@@\d+$/.test(a)))return!1;return![t.BUN_INSTALL_CACHE_DIR,dt(t.BUN_INSTALL||dt(Re.homedir(),".bun"),"install","cache")].filter((a)=>!!a).map((a)=>`${a.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((a)=>i.startsWith(a))}var pt=!1;function me(e){if(!pt)pt=!0,console.warn(`[stx] image worker unavailable (${e}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return ke}function Le(e){return e instanceof Error?e.message:String(e)}async function ze(e,t){if(typeof mt!=="function")return me("node:worker_threads has no Worker in this runtime");let i=nn();if(!i)return me("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await Qt();try{return await new Promise((o,a)=>{let c;try{c=new mt(i)}catch(y){o(me(`could not start ${i}: ${Le(y)}`));return}let l=!1,m=!1,u=(y)=>{if(m)return;m=!0,y(),c.terminate()};c.on("message",(y)=>{if(y.type==="ready"){l=!0,c.postMessage({task:e,args:t});return}if(y.type==="result"){u(()=>o(y.value));return}let w=Error(y.error?.message??"image worker failed");if(y.error?.name)w.name=y.error.name;if(y.error?.stack)w.stack=y.error.stack;u(()=>a(w))}),c.on("error",(y)=>{u(()=>l?a(y instanceof Error?y:Error(Le(y)||"image worker crashed")):o(me(`the worker failed before it was ready: ${Le(y)}`)))}),c.on("exit",(y)=>{u(()=>l?a(Error("image worker exited before it finished")):o(me(`the worker exited with code ${y} before it was ready`)))})})}finally{en()}}var an=new Set([".avif",".jpeg",".jpg",".png",".webp"]),cn=[320,640,960,1280,1920],he="/_stx/images",ln=`stx:${he}:alpha-1`,un=`stx:${he}:opaque-1`,fn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Pe;function dn(e,t){let i=Q.dirname(Bun.resolveSync(e,t));while(i!==Q.dirname(i)){let o=Q.join(i,"package.json");if(ee.existsSync(o)){let a=JSON.parse(ee.readFileSync(o,"utf8"));if(a.name===e)return a.version}i=Q.dirname(i)}return}function xt(){if(Pe!==void 0)return Pe;let e;try{e=Q.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Pe=fn.map((t)=>{let i;try{i=e?dn(t,e):void 0}catch{}return`${t.replace("@stacksjs/","")}@${i??"unknown"}`}).join("+"),Pe}var bt=Symbol.for("stx.image-delivery");function ye(){let e=globalThis;return e[bt]??={catalog:new Map,transparent:new Set},e[bt]}var vt=new Set;function gn(e){return`/${e.split(Q.sep).map(encodeURIComponent).join("/")}`}function mn(e){let t=Q.extname(e),i=e.slice(0,-t.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=Ct("sha256").update(e).digest("hex").slice(0,8);return`${i||"image"}-${o}`}function wt(e,t=`stx:${he}`){let i=(o)=>`${he}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:t,async stat(o){let a=Q.join(e,o);try{let c=await ee.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:i(o)}:null}catch{return null}},async write(o,a){let c=Q.join(e,o);await ee.promises.mkdir(Q.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await ee.promises.writeFile(l,a),await ee.promises.rename(l,c),{bytes:a.byteLength,path:c,url:i(o)}},url:i}}async function Rt(e,t=e){let i=await ee.promises.readdir(t,{withFileTypes:!0});i.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of i){let c=Q.join(t,a.name);if(a.isDirectory()){o.push(...await Rt(e,c));continue}if(!a.isFile()||!an.has(Q.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:Q.relative(e,c)})}return o}function $t(e,t){return e.map((i)=>({key:gn(i.relativePath),input:i.absolutePath,name:mn(i.relativePath),...pn(i.absolutePath)?{options:{storage:t}}:{}}))}function pn(e){return Me(e)==="possible"}function hn(e){for(let t=3;t<e.length;t+=4)if(e[t]!==255)return!0;return!1}async function xn(e){let t=Object.entries(e).filter(([,a])=>a.fallback.format==="png"),i=new Set,o=8;for(let a=0;a<t.length;a+=8)await Promise.all(t.slice(a,a+8).map(async([c,l])=>{let m=l.variants.filter((u)=>u.format==="png").sort((u,y)=>u.width-y.width)[0];try{let u=await sn(new Uint8Array(await ee.promises.readFile(m?.path??l.fallback.path)));if(hn(u.data))i.add(c)}catch{i.add(c)}}));return i}function bn(e,t){let i=[];for(let o of t){let a=e[o],c=a?.variants.filter((m)=>m.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((m)=>{let u;try{return u=ee.openSync(m.path,"r"),!je(Ce(u,0,32))}catch{return!0}finally{if(u!==void 0)ee.closeSync(u)}}))continue;if(a.variants=a.variants.filter((m)=>m.format!=="webp"),delete a.sources.webp,i.push(o),!vt.has(o))vt.add(o),console.warn(`[stx-images] ${o} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return i}async function vn(e){let t=[],i=8;for(let o=0;o<e.length;o+=8){let a=e.slice(o,o+8),c=await Promise.all(a.map(async(l)=>{try{return await on(l.absolutePath),l}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${l.relativePath}`),null}}));t.push(...c.filter((l)=>l!==null))}return t}function Ue(e){return Q.join(e,"undecodable.json")}function wn(e){try{let t=ee.readFileSync(Ue(e),"utf-8"),i=JSON.parse(t);return i&&typeof i==="object"?i:{}}catch{return{}}}function $n(e,t){try{ee.mkdirSync(Q.dirname(Ue(e)),{recursive:!0}),ee.writeFileSync(Ue(e),JSON.stringify(t))}catch{}}function St(e){try{let t=ee.statSync(e);return{mtimeMs:t.mtimeMs,size:t.size}}catch{return}}function At(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let t=e.split(/[?#]/,1)[0];if(!t)return;try{return`/${t.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function ko(e){let t=At(e);return t?ye().catalog.get(t):void 0}function _o(e){let t=At(e);return t?ye().transparent.has(t):!1}function Co(e){let t=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),i=t(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:t(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<i).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function nh(e){let t=ko(e);if(!t)return;return{src:t.fallback.url,srcset:t.sources[t.fallback.format]||"",sources:Co(t).map(({format:i,srcset:o})=>({type:`image/${i}`,srcset:o})),width:t.source.width,height:t.source.height,placeholder:_o(e)?void 0:t.placeholder?.dataUrl}}function ts(){let e=ye();e.catalog=new Map,e.transparent=new Set}function Sn(e){let t=ye();t.catalog=new Map(e.entries),t.transparent=new Set(e.transparent)}async function rh(e,t,i={}){if(!e||!ee.existsSync(e))return ts(),{count:0,fingerprint:""};if(i.offThread){let h=await ze("delivery",{publicDir:e,outputDir:t});if(h!==ke)return Sn(h.state),h.result}let o=await Rt(e);if(o.length===0)return ts(),{count:0,fingerprint:""};let a=wn(t),c=o.filter((h)=>{let v=a[h.relativePath];if(!v)return!0;let S=St(h.absolutePath);return!S||S.mtimeMs!==v.mtimeMs||S.size!==v.size});if(c.length===0)return ts(),{count:0,fingerprint:""};let l=wt(Q.join(t,"_stx","images"),`${ln}:${xt()}`),m={outDir:Q.join(t,"_stx","images"),storage:wt(Q.join(t,"_stx","images"),`${un}:${xt()}`),baseUrl:he,widths:cn,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},u=c,y;try{y=await yt({...m,entries:$t(c,l)})}catch(h){if(u=await vn(c),u.length===c.length)throw h;let v=new Set(u.map((A)=>A.relativePath)),S=!1;for(let A of c){if(v.has(A.relativePath))continue;let P=St(A.absolutePath);if(!P)continue;a[A.relativePath]=P,S=!0}if(S)$n(t,a);if(u.length===0)return ts(),{count:0,fingerprint:""};y=await yt({...m,entries:$t(u,l)})}let w=await xn(y.entries),x=bn(y.entries,w),C=ye();C.catalog=new Map(Object.entries(y.entries)),C.transparent=w;let b=w.size===0&&x.length===0?y.fingerprint:Ct("sha256").update(y.fingerprint).update(JSON.stringify({transparent:[...w].sort(),droppedWebp:x.sort()})).digest("hex");return{count:u.length,fingerprint:b}}class kt{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let t of e.aliases)this.builtins.set(t.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,t,i,o){let a=Wo(e,o);if(a!==void 0)return a;for(let c of qo(e,t,i,o))if(await r(c))return c;return null}}var le=new kt;var re="\x00stx-boolean-attribute";function We(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var Cn=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function Fe(e){let t=e.toLowerCase();return t.startsWith("aria-")||t.startsWith("data-")||Cn.has(t)}function oe(e,t){let i=[];for(let[o,a]of Object.entries(e.static)){if(t.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)i.push(p(c));continue}if(a===re){i.push(p(c));continue}i.push(`${p(c)}="${yn(c,We(String(a)))}"`)}return i}function ae(e,t){let i=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(t.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){i.push(p(c));continue}if(typeof a==="object")continue;i.push(`${p(c)}="${yn(c,We(String(a)))}"`)}return i}function Rn(e){if(e.clientReactive.to)return{value:e.clientReactive.to,reactive:!0};if(e.serverDynamic.to!==void 0)return{value:String(e.serverDynamic.to),reactive:!1};if(typeof e.static.to==="string")return{value:e.static.to,reactive:!1};return{value:"#",reactive:!1}}var He={name:"StxLink",aliases:["stx-link"],render(e,t,i){let o=Rn(e),a=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),c=typeof e.static.activeClass==="string"?e.static.activeClass:"active",l=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",m=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,u=[];if(o.reactive)u.push(`:href="${n(o.value)}"`);else u.push(`href="${n(mr(o.value,"navigable"))}"`);if(a)u.push(`class="${n(a)}"`);if(u.push("data-stx-link"),u.push(`data-stx-active-class="${n(c)}"`),u.push(`data-stx-exact-active-class="${n(l)}"`),m)u.push("data-stx-prefetch");let y=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(y)u.push(`data-stx-active-match="${n(y)}"`);let w=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return u.push(...oe(e,w)),u.push(...ae(e,w)),`<a ${u.join(" ")}>${t}</a>`}};var An=new Map;function qe(e){if(!e)return;let t=e.split("?")[0].split("#")[0];return An.get(t)}var kn={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Xe=[320,640,768,1024,1280,1536,1920];function K(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);let i=e.static[t];if(typeof i==="string")return i;return}function _e(e,t,i=!1){let o=e.serverDynamic[t];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[t];if(a!==void 0)return a!=="false"&&a!==!1;return i}function Ze(e){if(e.includes("(")||e.includes(","))return e;let t=e.trim().split(/\s+/),i=[];for(let o of t)if(o.includes(":")){let[a,c]=o.split(":"),l=kn[a];if(l)i.push(`(max-width: ${l}px) ${c}`);else{let m=Number.parseInt(a);if(!Number.isNaN(m))i.push(`(max-width: ${m}px) ${c}`)}}else i.push(o);return i.join(", ")}function Ve(e,t,i,o){return t.map((a)=>`${xe(e,a,void 0,i,o)} ${a}w`).join(", ")}function Pn(e,t,i,o,a){return t.map((c)=>{let l=i?i*c:void 0;return`${xe(e,l,void 0,o,a)} ${c}x`}).join(", ")}function xe(e,t,i,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(t)c.push(`w_${t}`);if(i)c.push(`h_${i}`);if(a)c.push(`f_${a}`);c.push("q_auto");let l=c.join(",");return e.replace("/upload/",`/upload/${l}/`)}if(o==="imgix"){let c=new URLSearchParams;if(t)c.set("w",String(t));if(i)c.set("h",String(i));if(a)c.set("fm",a);c.set("auto","format");let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}if(o==="bunny"){let c=new URLSearchParams;if(t)c.set("width",String(t));if(i)c.set("height",String(i));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function _n(e){return`var s=this.style;${e.map((t)=>`s.${t}=''`).join(";")}`}function In(e,t,i="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${t}"><rect width="100%" height="100%" fill="${i}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var Ge={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,t,i){let o=K(e,"src")||"",a=ko(o),c=K(e,"alt")||"",l=K(e,"width")||(a?String(a.source.width):void 0),m=K(e,"height")||(a?String(a.source.height):void 0),u=K(e,"sizes"),y=K(e,"srcset"),w=K(e,"densities"),x=K(e,"format"),C=_o(o)||qe(o)?.transparent===!0,b=K(e,"placeholder")||(a&&!C?"thumbhash":void 0),h=K(e,"placeholderColor")||"#e5e7eb",v=K(e,"provider"),S=K(e,"class")||K(e,"className")||"",A=K(e,"style")||"",P=K(e,"objectFit")||K(e,"fit"),k=K(e,"objectPosition")||K(e,"position"),N=K(e,"quality"),U=_e(e,"lazy",!0),M=_e(e,"preload",!1),L=_e(e,"priority",!1),q=K(e,"loading"),O=K(e,"decoding")||"async",E=!!a||_e(e,"picture",!1)||!!x,B=l?Number.parseInt(l):void 0,T=m?Number.parseInt(m):void 0,z=y||"",G="";if(a)z=a.sources[a.fallback.format]||"",G=u?Ze(u):"100vw";else if(!z&&u&&v&&v!=="local"&&v!=="static")z=Ve(o,Xe,v,x),G=Ze(u);else if(!z&&w){let _=w.split(/\s+/).map((F)=>Number.parseFloat(F.replace("x","")));z=Pn(o,_,B,v,x)}else if(u)G=Ze(u);let j=[];if(A)j.push(A);if(P)j.push(`object-fit:${P}`);if(k)j.push(`object-position:${k}`);if(B&&T)j.push(`aspect-ratio:${B}/${T}`);let W=[],ce=b==="blur"||b==="color"||b==="thumbhash";if(ce&&!C){let _=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:h}:qe(o);if(_&&b==="color")j.push(`background-color:${_.color}`),W.push("backgroundColor");else if(_)j.push(`background-color:${_.color}`),j.push(`background-image:url(${_.dataUrl})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),W.push("backgroundColor","backgroundImage");else{let F=In(B||16,T||9,h);j.push(`background-image:url(${F})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),W.push("backgroundImage")}}else if(!ce&&b&&b!=="empty"&&b!=="none")j.push(`background-image:url(${n(b)})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),W.push("backgroundImage");let we=a?.fallback.url||xe(o,B,T,v,x),Y=[];if(Y.push(`src="${n(mr(we,"fetched"))}"`),Y.push(`alt="${n(c)}"`),l)Y.push(`width="${n(l)}"`);if(m)Y.push(`height="${n(m)}"`);let ne=q||(L||M?"eager":U?"lazy":"");if(ne)Y.push(`loading="${n(ne)}"`);if(L)Y.push('fetchpriority="high"');if(Y.push(`decoding="${n(O)}"`),S)Y.push(`class="${n(S)}"`);if(j.length>0)Y.push(`style="${n(j.join(";"))}"`);if(z)Y.push(`srcset="${n(mr(z,"fetched"))}"`);if(G)Y.push(`sizes="${n(G)}"`);let $e=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","objectFit","objectPosition","fit","position","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(W.length>0){let _=typeof e.static.onload==="string"?e.static.onload:"",F=_n(W)+(_?`;${_}`:"");Y.push(`onload="${n(F)}"`),$e.add("onload")}Y.push(...oe(e,$e)),Y.push(...ae(e,$e));let D=`<img ${Y.join(" ")} />`,Z="";if(M){let F=x==="webp"?"image/webp":x==="avif"?"image/avif":"";Z=`<link rel="preload" as="image" href="${n(we)}"${F?` type="${F}"`:""}${z?` imagesrcset="${n(z)}"`:""}${G?` imagesizes="${n(G)}"`:""} />
|
|
3
|
+
`}if(E){let _=[];if(a)for(let F of Co(a))_.push(`<source type="image/${F.format}" srcset="${n(F.srcset)}"${G?` sizes="${n(G)}"`:""} />`);if(!a&&(x==="avif"||x==="auto")){let F=xe(o,B,T,v,"avif"),te=z?Ve(o,Xe,v,"avif"):`${F}`;_.push(`<source type="image/avif" srcset="${n(te)}"${G?` sizes="${n(G)}"`:""} />`)}if(!a&&(x==="webp"||x==="auto")){let F=xe(o,B,T,v,"webp"),te=z?Ve(o,Xe,v,"webp"):`${F}`;_.push(`<source type="image/webp" srcset="${n(te)}"${G?` sizes="${n(G)}"`:""} />`)}return`${Z}<picture>
|
|
4
4
|
${_.join(`
|
|
5
5
|
`)}
|
|
6
6
|
${D}
|
|
7
|
-
</picture>`}return`${
|
|
7
|
+
</picture>`}return`${Z}${D}`}};var Pt="/images/safe-image-default.svg";function ue(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);let i=e.static[t];if(typeof i==="string")return i;return}var En=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${Pt}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,Ke={name:"SafeImage",aliases:["safe-image","safe-img"],render(e,t,i){let o=ue(e,"src")||"",a=ue(e,"alt")||"",c=ue(e,"fallback")||Pt,l=ue(e,"class")||ue(e,"className")||"",m=ue(e,"fallbackClassName")||"",u=[];if(u.push(`src="${n(o)}"`),u.push(`alt="${n(a)}"`),l)u.push(`class="${n(l)}"`);if(u.push(`data-fallback="${n(c)}"`),m)u.push(`data-fallback-class="${n(m)}"`);u.push('onerror="window.__stxSafeImageHandler(this)"');let y=new Set(["src","alt","fallback","class","className","fallbackClassName"]);u.push(...oe(e,y)),u.push(...ae(e,y));let w=`<img ${u.join(" ")} />`,x=i.context;if(!x.__safeImageHandlerEmitted)return x.__safeImageHandlerEmitted=!0,`${En}${w}`;return w}};function Je(e){return e.replace(/[;{}()]/g,"").replace(/url/gi,"")}function be(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);let i=e.static[t];if(typeof i==="string")return i;return}function Ie(e,t,i){let o=be(e,t);if(o!==void 0){let a=Number.parseInt(o,10);if(!Number.isNaN(a))return a}return i}var Ye={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render(e,t,i){let o=Je(be(e,"color")||"#6366f1"),a=Je(be(e,"initialColor")||be(e,"initial-color")||""),c=Je(be(e,"height")||"3px"),l=Ie(e,"duration",2000),m=Ie(e,"throttle",200),u=Ie(e,"zIndex",999999)||Ie(e,"z-index",999999),y=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:${y};z-index:${u};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>
|
|
@@ -37,6 +37,6 @@ ${D}
|
|
|
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 On,readFileSync as Bn}from"fs";var Ne=new Map,Ot=new Set;function Tn(e){if(Ot.has(e))return;Ot.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 Dn(e){let t=process.cwd();for(let i of[`${t}/node_modules/@iconify-json/${e}/icons.json`,`${t}/pantry/@iconify-json/${e}/icons.json`,`${t}/node_modules/@iconify/json/json/${e}.json`,`${t}/pantry/@iconify/json/json/${e}.json`])if(On(i))return i;for(let i of[`@iconify-json/${e}/icons.json`,`@iconify/json/json/${e}.json`])try{return g.resolve(i)}catch{}return null}function jn(e){if(Ne.has(e))return Ne.get(e);let t=Dn(e);if(!t)return Tn(e),null;try{let i=JSON.parse(Bn(t,"utf8"));return Ne.set(e,i.icons),i.icons}catch{return null}}function de(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);if(e.static[t]!==void 0)return String(e.static[t]);if(e.clientReactive[t]!==void 0)return e.clientReactive[t];return}var st={name:"Icon",aliases:["icon","stx-icon"],render(e,t,i){let o=de(e,"name")??de(e,"icon");if(!o)return"<!-- Icon: missing name/icon prop -->";let a="lucide",c=o;if(o.includes(":")){let P=o.split(":");a=P[0],c=P[1]}let l=n(de(e,"size")||"24"),m=n(de(e,"color")||"currentColor"),u=n(de(e,"class")||""),y=n(de(e,"style")||""),w=Ne.get(a)??jn(a);if(!w)return`<!-- Icon: collection "${a}" not loaded -->`;let x=w[c];if(!x)return`<!-- Icon: "${c}" not found in ${a} -->`;let C=x.width||24,b=x.height||24,h=`0 0 ${C} ${b}`,v=x.body;if(m!=="currentColor")v=v.replace(/currentColor/g,m);let S=u?` class="${u}"`:"",A=y?` style="${y}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${l}" height="${l}" viewBox="${h}" fill="none"${S}${A}>${v}</svg>`}};function Bt(e,...t){for(let i of t){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let o=e.static[i];if(typeof o==="string")return o}return}function Tt(e,t){let i=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${t}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),o=e.match(i);if(!o)return{region:null,rest:e};return{region:o[2],rest:e.replace(o[0],"")}}var it={name:"Suspense",aliases:["suspense"],render(e,t,i){let o=Tt(t,"fallback"),a=o.rest,c=Tt(a,"error"),l=c.rest,m=o.region??Bt(e,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',u=c.region??Bt(e,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${m}</div><div data-stx-suspense-error hidden>${u}</div><div data-stx-suspense-content hidden>${l}</div></div>`}};function Te(e,...t){for(let i of t){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let o=e.static[i];if(typeof o==="string")return o}return}var ot={name:"TransitionGroup",aliases:["transition-group"],render(e,t,i){let o=(Te(e,"name")||"v").replace(/["'<>]/g,""),a=(Te(e,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",c=Te(e,"class"),l=Te(e,"id"),m=[`data-stx-transition-group="${o}"`,c?`class="${c}"`:"",l?`id="${l}"`:""].filter(Boolean).join(" ");return`<${a} ${m}>${t}</${a}>`}};function Dt(e=le){e.registerBuiltin(He),e.registerBuiltin(Ge),e.registerBuiltin(Ke),e.registerBuiltin(Ye),e.registerBuiltin(Qe),e.registerBuiltin(et),e.registerBuiltin(rt),e.registerBuiltin(st),e.registerBuiltin(it),e.registerBuiltin(ot)}var jt=new Map;function Mn(e){let t=jt.get(e.source);if(!t)t=new RegExp(`(${e.source})(?![\\w.:-])`,"y"),jt.set(e.source,t);return t}var Mt=new WeakMap;function Lt(e){let t=Mt.get(e);if(!t)t=new Set([...e].map((o)=>o.toLowerCase())),Mt.set(e,t);let i=t;return(o)=>!/[a-z]/.test(o)&&i.has(o.toLowerCase())}function Ln(e,t){let i="";for(let o=t;o<e.length;o++){let a=e[o];if(i){if(a==="\\")o++;else if(a===i)i=""}else if(a==='"'||a==="'")i=a;else if(a===">")return o}return e.length}function zt(e,t,i){let o=[],a=0,c=typeof i==="function"?i:i?(l)=>i.has(l.toLowerCase()):void 0;while(a<e.length){let l=e.indexOf("<",a);if(l===-1)break;let m=Mn(t);m.lastIndex=l+1;let u=m.exec(e);if(!u){a=l+1;continue}let y=u[1];if(c&&c(y)){let S=l+1+y.length;while(S<e.length&&e[S]!==">")S++;a=S+1;continue}let w=l+1+y.length,x=null,C=w,b=-1,h=!1;while(w<e.length){let S=e[w];if(x){if(S==="\\"&&w+1<e.length){w+=2;continue}if(S===x)x=null;w++;continue}if(S==='"'||S==="'"){x=S,w++;continue}if(S==="/"&&w+1<e.length&&e[w+1]===">"){b=w+2,h=!0;break}if(S===">"){b=w+1;break}w++}if(b===-1){a=l+1;continue}let v=e.slice(C,h?b-2:b-1).trim();if(h)o.push({fullMatch:e.slice(l,b),tagName:y,attributes:v,content:"",startIndex:l,endIndex:b,isSelfClosing:!0}),a=b;else{let S=`<${y}`,A=`</${y}>`,P=1,k=b,N=-1;while(P>0&&k<e.length){let L=e.indexOf(S,k),
|
|
41
|
-
`||O==="\t"){let E=Ln(e,L+S.length);if(e[E-1]!=="/")P++;k=E+1}else k=L+S.length}else{if(P--,P===0){N=Z;break}k=Z+A.length}}if(N===-1){a=b;continue}let W=e.slice(b,N),M=N+A.length;o.push({fullMatch:e.slice(l,M),tagName:y,attributes:v,content:W,startIndex:l,endIndex:M,isSelfClosing:!1}),a=M}}return o}function at(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function Ut(e,t){try{let i=Buffer.from(e,"base64").toString("utf8");return JSON.parse(i)}catch{}try{let i=e.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(i)}catch(i){if(t?.debug)console.error("Error decoding __stx_ prop:",i);return e}}function ct(e,t){let i=0,o="",a=t;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==="{")i++;else if(c==="}"){if(i--,i===0)return e.slice(t,a+1)}a++}return e.slice(t)}function Wt(e){let t=e.trim();if(!t.startsWith("{")||!t.endsWith("}"))return null;if(ct(t,0).length!==t.length)return null;return t.slice(1,-1).trim()}var zn=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),Un=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Wn(e){return lt(e).map((t)=>[t.start,t.end])}function lt(e){let t=[],i=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,o;while((o=i.exec(e))!==null){let a=o[2]||"",c=/(?:^|\s)(?::for|x-for|v-for|@for)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+))/.exec(a);if(!c)continue;let l=J(c[1]??c[2]??c[3]??""),m=o.index,u=m+o[0].length,y=o[1].toLowerCase();if(o[0].endsWith("/>")||Un.has(y)){t.push({start:m,end:u,names:l});continue}let w=y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),x=new RegExp(`<\\/?${w}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");x.lastIndex=u;let C=1,b=u,h;while((h=x.exec(e))!==null)if(h[0].startsWith("</")){if(C--,C===0){b=h.index+h[0].length;break}}else if(!h[0].endsWith("/>"))C++;t.push({start:m,end:b,names:l})}return t}function Ft(e){if(typeof e==="string")return e;if(Array.isArray(e))return e.filter(Boolean).map((t)=>Ft(t)).join(" ");if(e&&typeof e==="object")return Object.entries(e).filter(([,t])=>t).map(([t])=>t).join(" ");return e?String(e):""}function Ua(e,t){if(!/:[\w-]+=/.test(e))return e;let i=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(...Wn(e));let l=new Set([...tt(t),...Array.isArray(t.__stx_client_declared_names)?t.__stx_client_declared_names:[]]);function m(C){return a.some(([b,h])=>C>=b&&C<h)}let u=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*?)\s*(\/?)>/g,y=[],w=new Map,x=256;while((c=u.exec(i))!==null){if(m(c.index))continue;let C=c[0],b=c[2];if(!b||!b.includes(":"))continue;let h=/(?:^|\s)data-native(?:\s|=|$)/i.test(b.replace(/"[^"]*"|'[^']*'/g,"")),v=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,S,A=b,P=!1;while((S=v.exec(b))!==null){if(Cs(b,S.index,!0)?.kind==="attribute")continue;let k=S[1],N=S[2];if(Xc(k))continue;if(I(N,l))continue;if(N.includes("()")&&!N.includes(".get(")||N.includes("$store")||N.includes("$ref"))continue;try{let W=Object.keys(t),M=Object.values(t),L=N.match(/^([a-zA-Z_$][\w$]*)/);if(L&&!W.includes(L[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(L[1]))continue;let Z=JSON.stringify([W,N]),O=w.get(Z);if(!O){if(O=Function(...W,`return (${N})`),w.size>=x)w.clear();w.set(Z,O)}let E=O(...M);if(k==="class"){let B=H(Ft(E));if(B){let T=A.match(/\sclass="([^"]*)"/);if(T)A=A.replace(T[0],()=>` class="${T[1]} ${B}"`);else A=A.replace(S[0],()=>` class="${B}"`)}else A=A.replace(S[0],"");P=!0;continue}if(zn.has(k)){if(E)A=A.replace(S[0],` ${k}`);else A=A.replace(S[0],"");P=!0;continue}if(E===null||E===void 0||E===!1)A=A.replace(S[0],"");else{let B=h&&typeof E==="object"?JSON.stringify(E):String(E),T=yn(k,B);A=A.replace(S[0],()=>` ${k}="${T}"`)}P=!0}catch(W){if(W instanceof ie)throw W;continue}}if(P){let k=c[3]?" /":"",W=`<${c[1]}${A}${k}>`;y.push({start:c.index,end:c.index+C.length,replacement:W})}}if(y.length>0){let C=Array(y.length*2+1),b=0;for(let h=0;h<y.length;h++){let{start:v,end:S,replacement:A}=y[h];C[h*2]=i.slice(b,v),C[h*2+1]=A,b=S}C[y.length*2]=i.slice(b),i=C.join("")}return i}import Ht from"fs";import qt from"path";var Xt=!1;function Fn(e,t,i,o=!1,a=new Set){let c={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},l=new Set(Array.isArray(t.__stx_client_signal_names)?t.__stx_client_signal_names:[]),m=(x)=>{if(l.size===0)return!1;let C=s(x),b=C.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(b&&l.has(b))return!0;for(let h of l){let v=h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${v}\\s*\\(`).test(C))return!0}return!1},u=new Set(Jc),y=(x)=>{if(!x.includes("-")||x.startsWith("@")||x.startsWith(":")||x.startsWith("x-")||x.startsWith("__"))return x;if(x.startsWith("aria-")||x.startsWith("data-"))return x;return x.replace(/-([a-z0-9])/g,(C,b)=>b.toUpperCase())},w=(x,C)=>{let b=y(x);if(c.static[b]=C,b!==x)c.staticNames[b]=x};for(let[x,C]of Object.entries(e)){let b=x.startsWith("x-")&&!u.has(x)&&!x.startsWith("x-bind:")&&!x.startsWith("x-on:")?`:${x.slice(2)}`:x;if(b.startsWith("@")){c.events[b]=C;continue}if(b.startsWith("__stx_")){let h=y(b.slice(6));c.serverDynamic[h]=Ut(C,i);continue}if(b.startsWith(":")){let h=y(b.slice(1)),v=C===re?h:C;if(h==="if"||h==="for"||h==="show"){c.clientReactive[h]=v;continue}if(o){c.clientReactive[h]=v;continue}if(I(v,a)){c.clientReactive[h]=v;continue}if(m(v)){c.clientReactive[h]=v;continue}try{if(!f(v)){if(i.debug)console.error(`Unsafe expression in :${h} binding: ${v}`);c.clientReactive[h]=v;continue}let S=Object.keys(t),A=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]),P=new Set(Array.isArray(t.__stx_client_declared_names)?t.__stx_client_declared_names:[]);if(nt(v).some((M)=>!A.has(M)&&!S.includes(M)&&(!(M in globalThis)||P.has(M)))){c.clientReactive[h]=v;continue}let W=d(v,S)(...Object.values(t));if(c.serverDynamic[h]=W,h!==b.slice(1)&&c.serverDynamicNames)c.serverDynamicNames[h]=b.slice(1)}catch{c.clientReactive[h]=v}continue}if(typeof C==="string"&&C.includes("{{")&&C.includes("}}")){let h=Hn(C,a);if(h!==null){c.clientReactive[y(b)]=h;continue}let v=C.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(v)try{let S=v[1];if(f(S)){let P=d(S,Object.keys(t))(...Object.values(t));w(b,P!=null?String(P):"")}else{if(i.debug)console.error(`Unsafe expression in ${b}: ${S}`);w(b,C)}}catch(S){if(i.debug)console.error(`Error evaluating expression for ${b}:`,S);w(b,C)}else{let S=C,A=/\{\{\s*([\s\S]+?)\s*\}\}/g,P;while((P=A.exec(C))!==null)try{let k=P[1];if(!f(k)){if(i.debug)console.error(`Unsafe expression in ${b}: ${k}`);continue}let W=d(k,Object.keys(t))(...Object.values(t));S=S.replace(P[0],String(W??""))}catch(k){if(i.debug)console.error(`Error evaluating expression in ${b}:`,k)}w(b,S)}continue}w(b,C===re?"true":at(C))}return c}function Hn(e,t){if(t.size===0)return null;let i=/\{\{\s*([\s\S]+?)\s*\}\}/g,o=[...e.matchAll(i)];if(!o.some((m)=>I(m[1],t)))return null;let a=e.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(a&&o.length===1)return a[1];let c="",l=0;for(let m of o)c+=e.slice(l,m.index).replace(/[`\\$]/g,(u)=>`\\${u}`),c+=`\${${m[1]}}`,l=m.index+m[0].length;return c+=e.slice(l).replace(/[`\\$]/g,(m)=>`\\${m}`),`\`${c}\``}var qn=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function Xn(e,t,i){if(!e.includes("@"))return e;if(!qn.some(([a,c])=>a.test(e)&&e.includes(c)))return e;try{return se(e,t,i)}catch{return e}}function ge(e){let t={},i=0,o=e.length;while(i<o){while(i<o&&/\s/.test(e[i]))i++;if(i>=o)break;let a="";while(i<o&&!/[\s=]/.test(e[i]))a+=e[i],i++;if(!a)break;while(i<o&&/\s/.test(e[i]))i++;if(i<o&&e[i]==="="){i++;while(i<o&&/\s/.test(e[i]))i++;let c="";if(i<o&&(e[i]==='"'||e[i]==="'")){let l=e[i];i++;while(i<o){let m=e[i];if(m==="\\"&&i+1<o){i++,c+=e[i],i++;continue}if(m===l){i++;break}c+=m,i++}}else if(e[i]==="{"){c=ct(e,i),i+=c.length;let l=Wt(c);if(l!==null){t[`:${a}`]=l;continue}}else while(i<o&&!/\s/.test(e[i]))c+=e[i],i++;t[a]=c}else t[a]=re}return t}function Zt(e){return Object.entries(e).map(([t,i])=>i===re?t:`${t}="${Zn(i)}"`).join(" ")}function Zn(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Vn(e){let t=new Set,i=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,o;while((o=i.exec(e))!==null){let a=o[1];if(le.isBuiltin(a))t.add(a)}return[...t].sort()}async function gf(e,t,i,o,a){if(!/import\s/.test(e))return e;if(!t.__importedComponents)t.__importedComponents=new Map;let c=t.__importedComponents,l=qt.dirname(i),m=[],u=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let x of e.matchAll(u)){let[C,b,h]=x,v=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,S=h,A,P=[];while((A=v.exec(h))!==null){let[k,N,W,M]=A,L=null,Z=null;if(M.startsWith(".")||M.startsWith("/")){let B=qt.resolve(l,M);if(B.endsWith(".stx"))Z=B;else{let T=`${B}.stx`;try{if(Ht.statSync(T).isFile())Z=T}catch{try{if(Ht.statSync(B).isDirectory())L=B}catch{}}}}else L=Ss(M,l);if(!L&&!Z)continue;let O=!1,E=(B,T)=>{c.set(B,T),c.set(B.toLowerCase(),T);let U=B.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();c.set(U,T),a.add(T)};if(W&&Z)E(W,Z),O=!0;else if(N){let B=N.slice(1,-1).split(",").map((U)=>U.trim()).filter(Boolean).map((U)=>{let G=U.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(G)return{source:G[1],local:G[2]};return{source:U,local:U}}),T=L?xs(L):null;for(let{source:U,local:G}of B){let j=null;if(Z)j=Z;else if(T)j=T.get(U)??T.get(U.toLowerCase())??T.get(U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(j)E(G,j),O=!0}}if(O)P.push({start:A.index,end:A.index+k.length})}if(P.length===0)continue;for(let k=P.length-1;k>=0;k--)S=S.slice(0,P[k].start)+S.slice(P[k].end);m.push({start:x.index,end:x.index+C.length,value:`<script${b}>${S}</script>`})}if(m.length===0)return e;let y=[],w=0;for(let x of m)y.push(e.slice(w,x.start),x.value),w=x.end;return y.push(e.slice(w)),y.join("")}async function Gn(e,t,i,o,a){let c=e;if(!t.__importedComponents)t.__importedComponents=new Map;let l=t.__importedComponents,m=/@import\s*\(\s*([^)]+)\s*\)/g,u;while((u=m.exec(c))!==null){let[y,w]=u,x=w.split(",").map((C)=>C.trim().replace(/^['"]|['"]$/g,"")).filter((C)=>C.length>0);for(let C of x){let b=C.split("/"),v=b[b.length-1].replace(/\.stx$/,""),S=v.includes("-")?v.split("-").map((k)=>k.charAt(0).toUpperCase()+k.slice(1)).join(""):v.charAt(0).toUpperCase()+v.slice(1),A=null,P=ks(C,i,o);for(let k of P)try{if(await Bun.file(k).exists()){A=k;break}}catch{}if(A){l.set(S,A),l.set(v,A),l.set(v.toLowerCase(),A);let k=S.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(l.set(k,A),a.add(A),o.debug)console.log(`Imported component: ${S} -> ${A}`)}else if(o.debug)console.warn(`Could not resolve imported component: ${C}`)}c=c.replace(y,""),m.lastIndex=0}return c}async function Kn(e,t,i,o,a){let c=e,l=o.componentsDir||"components";if(!t.__processedComponents)t.__processedComponents=new Set;let m=t.__processedComponents,u=/@component\s*\(/g,y;while((y=u.exec(c))!==null){let w=y.index,x=w+y[0].length-1,C=1,b=x+1;while(b<c.length&&C>0){if(c[b]==="(")C++;else if(c[b]===")"){if(C--,C===0)break}b++}if(C!==0)break;let h=c.substring(x+1,b),v=b+1,S=h.match(/^\s*['"]([^'"]+)['"]/);if(!S){u.lastIndex=0;continue}let A=S[1],P,k=h.slice(S[0].length),N=k.match(/^\s*,\s*/);if(N)P=k.slice(N[0].length).trim();let W={};if(P)try{W=R(P,t)}catch(B){let T=B instanceof Error?B.message:String(B);c=c.replace(c.substring(w,v),`[Error parsing component props: ${T}]`);continue}let M="",L=v,O=c.substring(v).match(/^([\s\S]*?)@endcomponent/);if(O)M=O[1].trim(),L=v+O[0].length;let E=await Be(A,W,M,l,t,i,o,m,a);c=c.substring(0,w)+E+c.substring(L),u.lastIndex=0}return c}async function Jn(e,t,i,o,a){if(!e)return e;let c=e,l=o.componentsDir||"components";if(!t.__processedComponents)t.__processedComponents=new Set;let m=t.__processedComponents,u=er(c);if(u.size>0){let v=Array.isArray(t.__stx_client_declared_names)?t.__stx_client_declared_names:[];t.__stx_client_declared_names=[...new Set([...v,...u])]}let y=X(c);c=y.output;let w=tt(t);return c=await h(c,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),c=await h(c,/[A-Z][a-zA-Z0-9]*/,!0,Lt(yr)),c=await h(c,/[a-z][a-z0-9]*/,!1,yr),c=y.restore(c),c;async function h(v,S,A,P){if(!v)return v;let k=v,N=zt(k,S,P),W=lt(k),M=new Map;for(let O=N.length-1;O>=0;O--){let E=N[O],B=A?z(E.tagName):E.tagName,T=ge(Xn(E.attributes,t,i)),U=W.filter(({start:V,end:_})=>E.startIndex>=V&&E.startIndex<_),G=U.length>0,j=new Set(w);for(let V of U)for(let _ of V.names)j.add(_);let F=Fn(T,t,o,G,j);if(typeof F.clientReactive.for==="string")for(let V of J(F.clientReactive.for))j.add(V);let ce=le.getBuiltin(E.tagName),we=ce?await wr(E.tagName,l,t,i,o):!1;if(ce&&!we){let V={context:t,filePath:i,options:o,dependencies:a},_=ce.render(F,E.content,V);if(Object.keys(F.events).length>0){let q=Zt(F.events);_=_.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${q}`)}if(Object.keys(F.clientReactive).length>0)_=Vt(_,F.clientReactive);M.set(O,_);continue}if(!A&&E.tagName.includes("-")&&!await wr(B,l,t,i,o))continue;let Y={};for(let[V,_]of Object.entries(F.static))Y[V]=_;for(let[V,_]of Object.entries(F.serverDynamic))Y[V]=_;let ne={declaredProps:new Set,consumedProps:new Set,reactiveProps:Object.keys(F.clientReactive),events:Object.keys(F.events)},D=await Be(B,Y,y.restore(E.content),l,t,i,o,m,a,[...j],ne,E.tagName);if(D=Yn(D,F,ne.declaredProps,ne.consumedProps,o._nativeHostAttrs),o._nativeHostAttrs){let V=ne.reactiveProps.filter((te)=>!ne.consumedProps.has(te)&&!["if","for","show","key","ref"].includes(te)).map(z),_=ut(D,!0);if(V.length&&_){if(!Object.hasOwn(ge(D.slice(_.insertPos,_.tagEnd)),"data-stx-native-host-root"))D=D.slice(0,_.insertPos)+' data-stx-native-host-root="true"'+D.slice(_.insertPos);let te=ve(D);D=D.slice(0,te.insertPos)+` data-stx-native-forward="${V.join(" ")}"`+D.slice(te.insertPos)}let q=ut(D,!0);if(q){let te=ge(D.slice(q.insertPos,q.tagEnd)),Se=ve(D),Kt=ge(D.slice(Se.insertPos,Se.tagEnd));if(Object.hasOwn(te,"data-stx-native-host-root")&&!Object.hasOwn(Kt,"data-stx-native-host-owner"))D=D.slice(0,Se.insertPos)+" data-stx-native-host-owner"+D.slice(Se.insertPos)}}if(Object.keys(F.events).length>0){let V=ve(D);if(V){let _=Zt(F.events),q=Object.keys(F.events).map((te)=>te.replace(/^@/,"").split(".")[0]).join(" ");D=D.substring(0,V.insertPos)+` data-stx-parent-events="${q}" ${_}`+D.substring(V.insertPos)}}if(Object.keys(F.clientReactive).length>0)D=Vt(D,F.clientReactive);M.set(O,D)}if(M.size===0)return k;let L="",Z=0;for(let O=0;O<N.length;O++){let E=M.get(O);if(E===void 0)continue;L+=k.slice(Z,N[O].startIndex),L+=E,Z=N[O].endIndex}return L+=k.slice(Z),L}}function Vt(e,t){let i=new Set(["if","for"]),o=new Set(["show"]),a=Object.entries(t).filter(([w])=>!i.has(w)),c=a.filter(([w])=>!o.has(w)).map(([w])=>z(w)).join(" "),l=e,m=a.length>0?ve(l):null;if(m){let w=a.map(([C,b])=>`:${z(C)}="${b.replace(/"/g,""")}"`).join(" "),x=c?` data-stx-parent-bindings="${c}"`:"";l=l.substring(0,m.insertPos)+`${x} ${w}`+l.substring(m.insertPos)}let u=t.if;if(u)l=`<template :if="${u.replace(/"/g,""")}">${l}</template>`;let y=t.for;if(y){let w=t.key,x=w?` :key="${w.replace(/"/g,""")}"`:"";l=`<template :for="${y.replace(/"/g,""")}"${x}>${l}</template>`}return l}function Yn(e,t,i=new Set,o=new Set,a=!1){let c=ut(e,a);if(!c)return e;let l=e.slice(c.insertPos,c.tagEnd),m=t.serverDynamic.class??t.static.class;if(a&&typeof m==="string"&&m&&!o.has("class")){let h=/(^|\s)class\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i,v=h.test(l)?l.replace(h,(S,A,P,k,N)=>`${A}class="${n(`${at(P??k??N)} ${m}`)}"`):` class="${n(m)}"${l}`;e=e.slice(0,c.insertPos)+v+e.slice(c.tagEnd),c.tagEnd+=v.length-l.length,l=v}let u=a||/\bdata-native(?:\s|=)/i.test(l),y=u?o:i,w=new Set(Object.keys(ge(l))),x=new Set(["class","className"]);for(let h of Object.keys(t.static)){let v=t.staticNames[h]??h;if(w.has(v)||y.has(h)||!u&&!Fe(v))x.add(h)}for(let h of Object.keys(t.serverDynamic)){let v=t.serverDynamicNames?.[h]??h;if(w.has(v)||y.has(h)||!u&&!Fe(v))x.add(h)}let C=[];if(u){for(let[h,v]of Object.entries(t.static)){if(x.has(h)||v!==!0&&v!==re)continue;x.add(h),C.push(`${n(t.staticNames?.[h]??h)}="true"`)}for(let[h,v]of Object.entries(t.serverDynamic)){if(x.has(h)||v!==!0)continue;x.add(h),C.push(`${n(t.serverDynamicNames?.[h]??h)}="true"`)}}let b=[...oe(t,x),...ae(t,x),...C];if(u){for(let[h,v]of Object.entries(t.serverDynamic)){if(x.has(h)||v!==!1)continue;let S=t.serverDynamicNames?.[h]??h;b.push(`${n(S)}="false"`)}for(let[h,v]of Object.entries(t.serverDynamic)){if(x.has(h)||v===null||typeof v!=="object")continue;let S=JSON.stringify(v);if(S!==void 0){let A=t.serverDynamicNames?.[h]??h;b.push(`${n(A)}="${n(S)}"`)}}}if(b.length===0)return e;return`${e.slice(0,c.insertPos)} ${b.join(" ")}${e.slice(c.insertPos)}`}function ve(e){let t=Gt(e,0);if(t)return t;let i=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(e);if(i)return{insertPos:i.index+1+i[1].length,tagEnd:ft(e,i.index+1+i[1].length)};return null}function ut(e,t=!1){let i=ve(e);if(!i)return null;let o=e.slice(i.insertPos,i.tagEnd),a=/\bdata-stx-component-wrapper(?:\s|=|>|$)/i.test(o)?Gt(e,i.tagEnd+1):i;return a&&t?Qn(e,a)??a:a}function Qn(e,t){if(!e.includes("data-stx-native-host-root"))return null;let i=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),o=e.lastIndexOf("<",t.insertPos),a=0,c;while(o>=0&&o<e.length){if(e.startsWith("<!--",o)){let w=e.indexOf("-->",o+4);if(w<0)return null;o=e.indexOf("<",w+3);continue}let l=/^<(\/?)([a-z][\w-]*)\b/i.exec(e.slice(o));if(!l){o=e.indexOf("<",o+1);continue}let m=l[2].toLowerCase(),u=o+l[0].length,y=ft(e,u);if(l[1]){if(a--,c!==void 0&&a<c)c=void 0;if(a<=0)return null}else if(m==="script"||m==="style"){let w=new RegExp(`</${m}\\s*>`,"gi");if(w.lastIndex=y+1,!w.exec(e))return null;o=e.indexOf("<",w.lastIndex);continue}else{let w=ge(e.slice(u,y)),x=a>0&&(Object.hasOwn(w,"data-stx-component-wrapper")||Object.hasOwn(w,"data-stx-native-host-owner"));if(c===void 0&&!x&&Object.hasOwn(w,"data-stx-native-host-root"))return{insertPos:u,tagEnd:y};if(!i.has(m)&&e[y-1]!=="/"){if(a++,c===void 0&&x)c=a}else if(a===0)return null}o=e.indexOf("<",y+1)}return null}function Gt(e,t){let i=t;while(i<e.length){let o=e.slice(i),a=o.match(/^\s+/);if(a){i+=a[0].length;continue}if(o.startsWith("<!--")){let m=e.indexOf("-->",i+4);if(m===-1)return null;i=m+3;continue}let c=o.match(/^<(script|style)\b[^>]*>/i);if(c){let m=`</${c[1].toLowerCase()}>`,u=e.toLowerCase().indexOf(m,i+c[0].length);if(u===-1)return null;i=u+m.length;continue}let l=o.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!l)return null;return{insertPos:i+1+l[1].length,tagEnd:ft(e,i+1+l[1].length)}}return null}function ft(e,t){let i="";for(let o=t;o<e.length;o++){let a=e[o];if(i){if(a==="\\")o++;else if(a===i)i=""}else if(a==='"'||a==="'")i=a;else if(a===">")return o}return e.length}function er(e){let t=new Set;for(let i of e.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)){let o=i[1];if(!/\bclient\b/.test(o)||/\bserver\b/.test(o))continue;for(let a of Xo(i[2]))t.add(a);for(let a of i[2].matchAll(/^\s*import\s+(?:type\s+)?(?:([\w$]+)\s*,?\s*)?(?:\{([^}]*)\}|\*\s+as\s+([\w$]+))?\s*from\s/gm)){if(a[1])t.add(a[1]);if(a[3])t.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))t.add(l)}}}return t}async function ts(e,t,i,o,a){if(!Xt)Dt(le),Xt=!0;let c=await gf(e,t,i,o,a);c=await Gn(c,t,i,o,a),c=await Kn(c,t,i,o,a);let l=[];for(let m=0;m<3;m++){let u=l.length,y=pe(c,Oe,(x,C)=>`\x00STX_COMPONENT_COMMENT_${u+C}\x00`,`STX_COMPONENT_COMMENT:${u}`);l.push(...y.tokens);let w=c;if(c=await Jn(y.output,t,i,o,a),c===w)break}if(l.length>0)c=c.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(m,u)=>l[Number(u)]??"");if(o.debug){let m=Vn(c);if(m.length>0)console.warn(`[stx] ${i}: unresolved component tag(s) after render passes: ${m.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return c}
|
|
42
|
-
export{
|
|
40
|
+
</style>`}};import{existsSync as On,readFileSync as Bn}from"fs";var Ne=new Map,Ot=new Set;function Tn(e){if(Ot.has(e))return;Ot.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 Dn(e){let t=process.cwd();for(let i of[`${t}/node_modules/@iconify-json/${e}/icons.json`,`${t}/pantry/@iconify-json/${e}/icons.json`,`${t}/node_modules/@iconify/json/json/${e}.json`,`${t}/pantry/@iconify/json/json/${e}.json`])if(On(i))return i;for(let i of[`@iconify-json/${e}/icons.json`,`@iconify/json/json/${e}.json`])try{return g.resolve(i)}catch{}return null}function jn(e){if(Ne.has(e))return Ne.get(e);let t=Dn(e);if(!t)return Tn(e),null;try{let i=JSON.parse(Bn(t,"utf8"));return Ne.set(e,i.icons),i.icons}catch{return null}}function de(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);if(e.static[t]!==void 0)return String(e.static[t]);if(e.clientReactive[t]!==void 0)return e.clientReactive[t];return}var st={name:"Icon",aliases:["icon","stx-icon"],render(e,t,i){let o=de(e,"name")??de(e,"icon");if(!o)return"<!-- Icon: missing name/icon prop -->";let a="lucide",c=o;if(o.includes(":")){let P=o.split(":");a=P[0],c=P[1]}let l=n(de(e,"size")||"24"),m=n(de(e,"color")||"currentColor"),u=n(de(e,"class")||""),y=n(de(e,"style")||""),w=Ne.get(a)??jn(a);if(!w)return`<!-- Icon: collection "${a}" not loaded -->`;let x=w[c];if(!x)return`<!-- Icon: "${c}" not found in ${a} -->`;let C=x.width||24,b=x.height||24,h=`0 0 ${C} ${b}`,v=x.body;if(m!=="currentColor")v=v.replace(/currentColor/g,m);let S=u?` class="${u}"`:"",A=y?` style="${y}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${l}" height="${l}" viewBox="${h}" fill="none"${S}${A}>${v}</svg>`}};function Bt(e,...t){for(let i of t){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let o=e.static[i];if(typeof o==="string")return o}return}function Tt(e,t){let i=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${t}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),o=e.match(i);if(!o)return{region:null,rest:e};return{region:o[2],rest:e.replace(o[0],"")}}var it={name:"Suspense",aliases:["suspense"],render(e,t,i){let o=Tt(t,"fallback"),a=o.rest,c=Tt(a,"error"),l=c.rest,m=o.region??Bt(e,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',u=c.region??Bt(e,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${m}</div><div data-stx-suspense-error hidden>${u}</div><div data-stx-suspense-content hidden>${l}</div></div>`}};function Te(e,...t){for(let i of t){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let o=e.static[i];if(typeof o==="string")return o}return}var ot={name:"TransitionGroup",aliases:["transition-group"],render(e,t,i){let o=(Te(e,"name")||"v").replace(/["'<>]/g,""),a=(Te(e,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",c=Te(e,"class"),l=Te(e,"id"),m=[`data-stx-transition-group="${o}"`,c?`class="${c}"`:"",l?`id="${l}"`:""].filter(Boolean).join(" ");return`<${a} ${m}>${t}</${a}>`}};function Dt(e=le){e.registerBuiltin(He),e.registerBuiltin(Ge),e.registerBuiltin(Ke),e.registerBuiltin(Ye),e.registerBuiltin(Qe),e.registerBuiltin(et),e.registerBuiltin(rt),e.registerBuiltin(st),e.registerBuiltin(it),e.registerBuiltin(ot)}var jt=new Map;function Mn(e){let t=jt.get(e.source);if(!t)t=new RegExp(`(${e.source})(?![\\w.:-])`,"y"),jt.set(e.source,t);return t}var Mt=new WeakMap;function Lt(e){let t=Mt.get(e);if(!t)t=new Set([...e].map((o)=>o.toLowerCase())),Mt.set(e,t);let i=t;return(o)=>!/[a-z]/.test(o)&&i.has(o.toLowerCase())}function Ln(e,t){let i="";for(let o=t;o<e.length;o++){let a=e[o];if(i){if(a==="\\")o++;else if(a===i)i=""}else if(a==='"'||a==="'")i=a;else if(a===">")return o}return e.length}function zt(e,t,i){let o=[],a=0,c=typeof i==="function"?i:i?(l)=>i.has(l.toLowerCase()):void 0;while(a<e.length){let l=e.indexOf("<",a);if(l===-1)break;let m=Mn(t);m.lastIndex=l+1;let u=m.exec(e);if(!u){a=l+1;continue}let y=u[1];if(c&&c(y)){let S=l+1+y.length;while(S<e.length&&e[S]!==">")S++;a=S+1;continue}let w=l+1+y.length,x=null,C=w,b=-1,h=!1;while(w<e.length){let S=e[w];if(x){if(S==="\\"&&w+1<e.length){w+=2;continue}if(S===x)x=null;w++;continue}if(S==='"'||S==="'"){x=S,w++;continue}if(S==="/"&&w+1<e.length&&e[w+1]===">"){b=w+2,h=!0;break}if(S===">"){b=w+1;break}w++}if(b===-1){a=l+1;continue}let v=e.slice(C,h?b-2:b-1).trim();if(h)o.push({fullMatch:e.slice(l,b),tagName:y,attributes:v,content:"",startIndex:l,endIndex:b,isSelfClosing:!0}),a=b;else{let S=`<${y}`,A=`</${y}>`,P=1,k=b,N=-1;while(P>0&&k<e.length){let L=e.indexOf(S,k),q=e.indexOf(A,k);if(q===-1)break;if(L!==-1&&L<q){let O=e[L+S.length];if(O===" "||O===">"||O==="/"||O===`
|
|
41
|
+
`||O==="\t"){let E=Ln(e,L+S.length);if(e[E-1]!=="/")P++;k=E+1}else k=L+S.length}else{if(P--,P===0){N=q;break}k=q+A.length}}if(N===-1){a=b;continue}let U=e.slice(b,N),M=N+A.length;o.push({fullMatch:e.slice(l,M),tagName:y,attributes:v,content:U,startIndex:l,endIndex:M,isSelfClosing:!1}),a=M}}return o}function at(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function Ut(e,t){try{let i=Buffer.from(e,"base64").toString("utf8");return JSON.parse(i)}catch{}try{let i=e.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(i)}catch(i){if(t?.debug)console.error("Error decoding __stx_ prop:",i);return e}}function ct(e,t){let i=0,o="",a=t;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==="{")i++;else if(c==="}"){if(i--,i===0)return e.slice(t,a+1)}a++}return e.slice(t)}function Wt(e){let t=e.trim();if(!t.startsWith("{")||!t.endsWith("}"))return null;if(ct(t,0).length!==t.length)return null;return t.slice(1,-1).trim()}var zn=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),Un=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Wn(e){return lt(e).map((t)=>[t.start,t.end])}function lt(e){let t=[],i=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,o;while((o=i.exec(e))!==null){let a=o[2]||"",c=/(?:^|\s)(?::for|x-for|v-for|@for)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+))/.exec(a);if(!c)continue;let l=J(c[1]??c[2]??c[3]??""),m=o.index,u=m+o[0].length,y=o[1].toLowerCase();if(o[0].endsWith("/>")||Un.has(y)){t.push({start:m,end:u,names:l});continue}let w=y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),x=new RegExp(`<\\/?${w}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");x.lastIndex=u;let C=1,b=u,h;while((h=x.exec(e))!==null)if(h[0].startsWith("</")){if(C--,C===0){b=h.index+h[0].length;break}}else if(!h[0].endsWith("/>"))C++;t.push({start:m,end:b,names:l})}return t}function Ft(e){if(typeof e==="string")return e;if(Array.isArray(e))return e.filter(Boolean).map((t)=>Ft(t)).join(" ");if(e&&typeof e==="object")return Object.entries(e).filter(([,t])=>t).map(([t])=>t).join(" ");return e?String(e):""}function Wa(e,t){if(!/:[\w-]+=/.test(e))return e;let i=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(...Wn(e));let l=new Set([...tt(t),...Array.isArray(t.__stx_client_declared_names)?t.__stx_client_declared_names:[]]);function m(C){return a.some(([b,h])=>C>=b&&C<h)}let u=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*?)\s*(\/?)>/g,y=[],w=new Map,x=256;while((c=u.exec(i))!==null){if(m(c.index))continue;let C=c[0],b=c[2];if(!b||!b.includes(":"))continue;let h=/(?:^|\s)data-native(?:\s|=|$)/i.test(b.replace(/"[^"]*"|'[^']*'/g,"")),v=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,S,A=b,P=!1;while((S=v.exec(b))!==null){if(Es(b,S.index,!0)?.kind==="attribute")continue;let k=S[1],N=S[2];if(Jc(k))continue;if(I(N,l))continue;if(N.includes("()")&&!N.includes(".get(")||N.includes("$store")||N.includes("$ref"))continue;try{let U=Object.keys(t),M=Object.values(t),L=N.match(/^([a-zA-Z_$][\w$]*)/);if(L&&!U.includes(L[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(L[1]))continue;let q=JSON.stringify([U,N]),O=w.get(q);if(!O){if(O=Function(...U,`return (${N})`),w.size>=x)w.clear();w.set(q,O)}let E=O(...M);if(k==="class"){let B=V(Ft(E));if(B){let T=A.match(/\sclass="([^"]*)"/);if(T)A=A.replace(T[0],()=>` class="${T[1]} ${B}"`);else A=A.replace(S[0],()=>` class="${B}"`)}else A=A.replace(S[0],"");P=!0;continue}if(zn.has(k)){if(E)A=A.replace(S[0],` ${k}`);else A=A.replace(S[0],"");P=!0;continue}if(E===null||E===void 0||E===!1)A=A.replace(S[0],"");else{let B=h&&typeof E==="object"?JSON.stringify(E):String(E),T=yn(k,B);A=A.replace(S[0],()=>` ${k}="${T}"`)}P=!0}catch(U){if(U instanceof ie)throw U;continue}}if(P){let k=c[3]?" /":"",U=`<${c[1]}${A}${k}>`;y.push({start:c.index,end:c.index+C.length,replacement:U})}}if(y.length>0){let C=Array(y.length*2+1),b=0;for(let h=0;h<y.length;h++){let{start:v,end:S,replacement:A}=y[h];C[h*2]=i.slice(b,v),C[h*2+1]=A,b=S}C[y.length*2]=i.slice(b),i=C.join("")}return i}import Ht from"fs";import qt from"path";var Xt=!1;function Fn(e,t,i,o=!1,a=new Set){let c={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},l=new Set(Array.isArray(t.__stx_client_signal_names)?t.__stx_client_signal_names:[]),m=(x)=>{if(l.size===0)return!1;let C=s(x),b=C.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(b&&l.has(b))return!0;for(let h of l){let v=h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${v}\\s*\\(`).test(C))return!0}return!1},u=new Set(Yc),y=(x)=>{if(!x.includes("-")||x.startsWith("@")||x.startsWith(":")||x.startsWith("x-")||x.startsWith("__"))return x;if(x.startsWith("aria-")||x.startsWith("data-"))return x;return x.replace(/-([a-z0-9])/g,(C,b)=>b.toUpperCase())},w=(x,C)=>{let b=y(x);if(c.static[b]=C,b!==x)c.staticNames[b]=x};for(let[x,C]of Object.entries(e)){let b=x.startsWith("x-")&&!u.has(x)&&!x.startsWith("x-bind:")&&!x.startsWith("x-on:")?`:${x.slice(2)}`:x;if(b.startsWith("@")){c.events[b]=C;continue}if(b.startsWith("__stx_")){let h=y(b.slice(6));c.serverDynamic[h]=Ut(C,i);continue}if(b.startsWith(":")){let h=y(b.slice(1)),v=C===re?h:C;if(h==="if"||h==="for"||h==="show"){c.clientReactive[h]=v;continue}if(o){c.clientReactive[h]=v;continue}if(I(v,a)){c.clientReactive[h]=v;continue}if(m(v)){c.clientReactive[h]=v;continue}try{if(!f(v)){if(i.debug)console.error(`Unsafe expression in :${h} binding: ${v}`);c.clientReactive[h]=v;continue}let S=Object.keys(t),A=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]),P=new Set(Array.isArray(t.__stx_client_declared_names)?t.__stx_client_declared_names:[]);if(nt(v).some((M)=>!A.has(M)&&!S.includes(M)&&(!(M in globalThis)||P.has(M)))){c.clientReactive[h]=v;continue}let U=d(v,S)(...Object.values(t));if(c.serverDynamic[h]=U,h!==b.slice(1)&&c.serverDynamicNames)c.serverDynamicNames[h]=b.slice(1)}catch{c.clientReactive[h]=v}continue}if(typeof C==="string"&&C.includes("{{")&&C.includes("}}")){let h=Hn(C,a);if(h!==null){c.clientReactive[y(b)]=h;continue}let v=C.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(v)try{let S=v[1];if(f(S)){let P=d(S,Object.keys(t))(...Object.values(t));w(b,P!=null?String(P):"")}else{if(i.debug)console.error(`Unsafe expression in ${b}: ${S}`);w(b,C)}}catch(S){if(i.debug)console.error(`Error evaluating expression for ${b}:`,S);w(b,C)}else{let S=C,A=/\{\{\s*([\s\S]+?)\s*\}\}/g,P;while((P=A.exec(C))!==null)try{let k=P[1];if(!f(k)){if(i.debug)console.error(`Unsafe expression in ${b}: ${k}`);continue}let U=d(k,Object.keys(t))(...Object.values(t));S=S.replace(P[0],String(U??""))}catch(k){if(i.debug)console.error(`Error evaluating expression in ${b}:`,k)}w(b,S)}continue}w(b,C===re?"true":at(C))}return c}function Hn(e,t){if(t.size===0)return null;let i=/\{\{\s*([\s\S]+?)\s*\}\}/g,o=[...e.matchAll(i)];if(!o.some((m)=>I(m[1],t)))return null;let a=e.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(a&&o.length===1)return a[1];let c="",l=0;for(let m of o)c+=e.slice(l,m.index).replace(/[`\\$]/g,(u)=>`\\${u}`),c+=`\${${m[1]}}`,l=m.index+m[0].length;return c+=e.slice(l).replace(/[`\\$]/g,(m)=>`\\${m}`),`\`${c}\``}var qn=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function Xn(e,t,i){if(!e.includes("@"))return e;if(!qn.some(([a,c])=>a.test(e)&&e.includes(c)))return e;try{return se(e,t,i)}catch{return e}}function ge(e){let t={},i=0,o=e.length;while(i<o){while(i<o&&/\s/.test(e[i]))i++;if(i>=o)break;let a="";while(i<o&&!/[\s=]/.test(e[i]))a+=e[i],i++;if(!a)break;while(i<o&&/\s/.test(e[i]))i++;if(i<o&&e[i]==="="){i++;while(i<o&&/\s/.test(e[i]))i++;let c="";if(i<o&&(e[i]==='"'||e[i]==="'")){let l=e[i];i++;while(i<o){let m=e[i];if(m==="\\"&&i+1<o){i++,c+=e[i],i++;continue}if(m===l){i++;break}c+=m,i++}}else if(e[i]==="{"){c=ct(e,i),i+=c.length;let l=Wt(c);if(l!==null){t[`:${a}`]=l;continue}}else while(i<o&&!/\s/.test(e[i]))c+=e[i],i++;t[a]=c}else t[a]=re}return t}function Zt(e){return Object.entries(e).map(([t,i])=>i===re?t:`${t}="${Zn(i)}"`).join(" ")}function Zn(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Vn(e){let t=new Set,i=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,o;while((o=i.exec(e))!==null){let a=o[1];if(le.isBuiltin(a))t.add(a)}return[...t].sort()}async function hf(e,t,i,o,a){if(!/import\s/.test(e))return e;if(!t.__importedComponents)t.__importedComponents=new Map;let c=t.__importedComponents,l=qt.dirname(i),m=[],u=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let x of e.matchAll(u)){let[C,b,h]=x,v=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,S=h,A,P=[];while((A=v.exec(h))!==null){let[k,N,U,M]=A,L=null,q=null;if(M.startsWith(".")||M.startsWith("/")){let B=qt.resolve(l,M);if(B.endsWith(".stx"))q=B;else{let T=`${B}.stx`;try{if(Ht.statSync(T).isFile())q=T}catch{try{if(Ht.statSync(B).isDirectory())L=B}catch{}}}}else L=ks(M,l);if(!L&&!q)continue;let O=!1,E=(B,T)=>{c.set(B,T),c.set(B.toLowerCase(),T);let z=B.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();c.set(z,T),a.add(T)};if(U&&q)E(U,q),O=!0;else if(N){let B=N.slice(1,-1).split(",").map((z)=>z.trim()).filter(Boolean).map((z)=>{let G=z.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(G)return{source:G[1],local:G[2]};return{source:z,local:z}}),T=L?Ss(L):null;for(let{source:z,local:G}of B){let j=null;if(q)j=q;else if(T)j=T.get(z)??T.get(z.toLowerCase())??T.get(z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(j)E(G,j),O=!0}}if(O)P.push({start:A.index,end:A.index+k.length})}if(P.length===0)continue;for(let k=P.length-1;k>=0;k--)S=S.slice(0,P[k].start)+S.slice(P[k].end);m.push({start:x.index,end:x.index+C.length,value:`<script${b}>${S}</script>`})}if(m.length===0)return e;let y=[],w=0;for(let x of m)y.push(e.slice(w,x.start),x.value),w=x.end;return y.push(e.slice(w)),y.join("")}async function Gn(e,t,i,o,a){let c=e;if(!t.__importedComponents)t.__importedComponents=new Map;let l=t.__importedComponents,m=/@import\s*\(\s*([^)]+)\s*\)/g,u;while((u=m.exec(c))!==null){let[y,w]=u,x=w.split(",").map((C)=>C.trim().replace(/^['"]|['"]$/g,"")).filter((C)=>C.length>0);for(let C of x){let b=C.split("/"),v=b[b.length-1].replace(/\.stx$/,""),S=v.includes("-")?v.split("-").map((k)=>k.charAt(0).toUpperCase()+k.slice(1)).join(""):v.charAt(0).toUpperCase()+v.slice(1),A=null,P=_s(C,i,o);for(let k of P)try{if(await Bun.file(k).exists()){A=k;break}}catch{}if(A){l.set(S,A),l.set(v,A),l.set(v.toLowerCase(),A);let k=S.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(l.set(k,A),a.add(A),o.debug)console.log(`Imported component: ${S} -> ${A}`)}else if(o.debug)console.warn(`Could not resolve imported component: ${C}`)}c=c.replace(y,""),m.lastIndex=0}return c}async function Kn(e,t,i,o,a){let c=e,l=o.componentsDir||"components";if(!t.__processedComponents)t.__processedComponents=new Set;let m=t.__processedComponents,u=/@component\s*\(/g,y;while((y=u.exec(c))!==null){let w=y.index,x=w+y[0].length-1,C=1,b=x+1;while(b<c.length&&C>0){if(c[b]==="(")C++;else if(c[b]===")"){if(C--,C===0)break}b++}if(C!==0)break;let h=c.substring(x+1,b),v=b+1,S=h.match(/^\s*['"]([^'"]+)['"]/);if(!S){u.lastIndex=0;continue}let A=S[1],P,k=h.slice(S[0].length),N=k.match(/^\s*,\s*/);if(N)P=k.slice(N[0].length).trim();let U={};if(P)try{U=R(P,t)}catch(B){let T=B instanceof Error?B.message:String(B);c=c.replace(c.substring(w,v),`[Error parsing component props: ${T}]`);continue}let M="",L=v,O=c.substring(v).match(/^([\s\S]*?)@endcomponent/);if(O)M=O[1].trim(),L=v+O[0].length;let E=await Be(A,U,M,l,t,i,o,m,a);c=c.substring(0,w)+E+c.substring(L),u.lastIndex=0}return c}async function Jn(e,t,i,o,a){if(!e)return e;let c=e,l=o.componentsDir||"components";if(!t.__processedComponents)t.__processedComponents=new Set;let m=t.__processedComponents,u=er(c);if(u.size>0){let v=Array.isArray(t.__stx_client_declared_names)?t.__stx_client_declared_names:[];t.__stx_client_declared_names=[...new Set([...v,...u])]}let y=X(c);c=y.output;let w=tt(t);return c=await h(c,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),c=await h(c,/[A-Z][a-zA-Z0-9]*/,!0,Lt(yr)),c=await h(c,/[a-z][a-z0-9]*/,!1,yr),c=y.restore(c),c;async function h(v,S,A,P){if(!v)return v;let k=v,N=zt(k,S,P),U=lt(k),M=new Map;for(let O=N.length-1;O>=0;O--){let E=N[O],B=A?H(E.tagName):E.tagName,T=ge(Xn(E.attributes,t,i)),z=U.filter(({start:Z,end:_})=>E.startIndex>=Z&&E.startIndex<_),G=z.length>0,j=new Set(w);for(let Z of z)for(let _ of Z.names)j.add(_);let W=Fn(T,t,o,G,j);if(typeof W.clientReactive.for==="string")for(let Z of J(W.clientReactive.for))j.add(Z);let ce=le.getBuiltin(E.tagName),we=ce?await wr(E.tagName,l,t,i,o):!1;if(ce&&!we){let Z={context:t,filePath:i,options:o,dependencies:a},_=ce.render(W,E.content,Z);if(Object.keys(W.events).length>0){let F=Zt(W.events);_=_.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${F}`)}if(Object.keys(W.clientReactive).length>0)_=Vt(_,W.clientReactive);M.set(O,_);continue}if(!A&&E.tagName.includes("-")&&!await wr(B,l,t,i,o))continue;let Y={};for(let[Z,_]of Object.entries(W.static))Y[Z]=_;for(let[Z,_]of Object.entries(W.serverDynamic))Y[Z]=_;let ne={declaredProps:new Set,consumedProps:new Set,reactiveProps:Object.keys(W.clientReactive),events:Object.keys(W.events)},D=await Be(B,Y,y.restore(E.content),l,t,i,o,m,a,[...j],ne,E.tagName);if(D=Yn(D,W,ne.declaredProps,ne.consumedProps,o._nativeHostAttrs),o._nativeHostAttrs){let Z=ne.reactiveProps.filter((te)=>!ne.consumedProps.has(te)&&!["if","for","show","key","ref"].includes(te)).map(H),_=ut(D,!0);if(Z.length&&_){if(!Object.hasOwn(ge(D.slice(_.insertPos,_.tagEnd)),"data-stx-native-host-root"))D=D.slice(0,_.insertPos)+' data-stx-native-host-root="true"'+D.slice(_.insertPos);let te=ve(D);D=D.slice(0,te.insertPos)+` data-stx-native-forward="${Z.join(" ")}"`+D.slice(te.insertPos)}let F=ut(D,!0);if(F){let te=ge(D.slice(F.insertPos,F.tagEnd)),Se=ve(D),Kt=ge(D.slice(Se.insertPos,Se.tagEnd));if(Object.hasOwn(te,"data-stx-native-host-root")&&!Object.hasOwn(Kt,"data-stx-native-host-owner"))D=D.slice(0,Se.insertPos)+" data-stx-native-host-owner"+D.slice(Se.insertPos)}}if(Object.keys(W.events).length>0){let Z=ve(D);if(Z){let _=Zt(W.events),F=Object.keys(W.events).map((te)=>te.replace(/^@/,"").split(".")[0]).join(" ");D=D.substring(0,Z.insertPos)+` data-stx-parent-events="${F}" ${_}`+D.substring(Z.insertPos)}}if(Object.keys(W.clientReactive).length>0)D=Vt(D,W.clientReactive);M.set(O,D)}if(M.size===0)return k;let L="",q=0;for(let O=0;O<N.length;O++){let E=M.get(O);if(E===void 0)continue;L+=k.slice(q,N[O].startIndex),L+=E,q=N[O].endIndex}return L+=k.slice(q),L}}function Vt(e,t){let i=new Set(["if","for"]),o=new Set(["show"]),a=Object.entries(t).filter(([w])=>!i.has(w)),c=a.filter(([w])=>!o.has(w)).map(([w])=>H(w)).join(" "),l=e,m=a.length>0?ve(l):null;if(m){let w=a.map(([C,b])=>`:${H(C)}="${b.replace(/"/g,""")}"`).join(" "),x=c?` data-stx-parent-bindings="${c}"`:"";l=l.substring(0,m.insertPos)+`${x} ${w}`+l.substring(m.insertPos)}let u=t.if;if(u)l=`<template :if="${u.replace(/"/g,""")}">${l}</template>`;let y=t.for;if(y){let w=t.key,x=w?` :key="${w.replace(/"/g,""")}"`:"";l=`<template :for="${y.replace(/"/g,""")}"${x}>${l}</template>`}return l}function Yn(e,t,i=new Set,o=new Set,a=!1){let c=ut(e,a);if(!c)return e;let l=e.slice(c.insertPos,c.tagEnd),m=t.serverDynamic.class??t.static.class;if(a&&typeof m==="string"&&m&&!o.has("class")){let h=/(^|\s)class\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i,v=h.test(l)?l.replace(h,(S,A,P,k,N)=>`${A}class="${n(`${at(P??k??N)} ${m}`)}"`):` class="${n(m)}"${l}`;e=e.slice(0,c.insertPos)+v+e.slice(c.tagEnd),c.tagEnd+=v.length-l.length,l=v}let u=a||/\bdata-native(?:\s|=)/i.test(l),y=u?o:i,w=new Set(Object.keys(ge(l))),x=new Set(["class","className"]);for(let h of Object.keys(t.static)){let v=t.staticNames[h]??h;if(w.has(v)||y.has(h)||!u&&!Fe(v))x.add(h)}for(let h of Object.keys(t.serverDynamic)){let v=t.serverDynamicNames?.[h]??h;if(w.has(v)||y.has(h)||!u&&!Fe(v))x.add(h)}let C=[];if(u){for(let[h,v]of Object.entries(t.static)){if(x.has(h)||v!==!0&&v!==re)continue;x.add(h),C.push(`${n(t.staticNames?.[h]??h)}="true"`)}for(let[h,v]of Object.entries(t.serverDynamic)){if(x.has(h)||v!==!0)continue;x.add(h),C.push(`${n(t.serverDynamicNames?.[h]??h)}="true"`)}}let b=[...oe(t,x),...ae(t,x),...C];if(u){for(let[h,v]of Object.entries(t.serverDynamic)){if(x.has(h)||v!==!1)continue;let S=t.serverDynamicNames?.[h]??h;b.push(`${n(S)}="false"`)}for(let[h,v]of Object.entries(t.serverDynamic)){if(x.has(h)||v===null||typeof v!=="object")continue;let S=JSON.stringify(v);if(S!==void 0){let A=t.serverDynamicNames?.[h]??h;b.push(`${n(A)}="${n(S)}"`)}}}if(b.length===0)return e;return`${e.slice(0,c.insertPos)} ${b.join(" ")}${e.slice(c.insertPos)}`}function ve(e){let t=Gt(e,0);if(t)return t;let i=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(e);if(i)return{insertPos:i.index+1+i[1].length,tagEnd:ft(e,i.index+1+i[1].length)};return null}function ut(e,t=!1){let i=ve(e);if(!i)return null;let o=e.slice(i.insertPos,i.tagEnd),a=/\bdata-stx-component-wrapper(?:\s|=|>|$)/i.test(o)?Gt(e,i.tagEnd+1):i;return a&&t?Qn(e,a)??a:a}function Qn(e,t){if(!e.includes("data-stx-native-host-root"))return null;let i=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),o=e.lastIndexOf("<",t.insertPos),a=0,c;while(o>=0&&o<e.length){if(e.startsWith("<!--",o)){let w=e.indexOf("-->",o+4);if(w<0)return null;o=e.indexOf("<",w+3);continue}let l=/^<(\/?)([a-z][\w-]*)\b/i.exec(e.slice(o));if(!l){o=e.indexOf("<",o+1);continue}let m=l[2].toLowerCase(),u=o+l[0].length,y=ft(e,u);if(l[1]){if(a--,c!==void 0&&a<c)c=void 0;if(a<=0)return null}else if(m==="script"||m==="style"){let w=new RegExp(`</${m}\\s*>`,"gi");if(w.lastIndex=y+1,!w.exec(e))return null;o=e.indexOf("<",w.lastIndex);continue}else{let w=ge(e.slice(u,y)),x=a>0&&(Object.hasOwn(w,"data-stx-component-wrapper")||Object.hasOwn(w,"data-stx-native-host-owner"));if(c===void 0&&!x&&Object.hasOwn(w,"data-stx-native-host-root"))return{insertPos:u,tagEnd:y};if(!i.has(m)&&e[y-1]!=="/"){if(a++,c===void 0&&x)c=a}else if(a===0)return null}o=e.indexOf("<",y+1)}return null}function Gt(e,t){let i=t;while(i<e.length){let o=e.slice(i),a=o.match(/^\s+/);if(a){i+=a[0].length;continue}if(o.startsWith("<!--")){let m=e.indexOf("-->",i+4);if(m===-1)return null;i=m+3;continue}let c=o.match(/^<(script|style)\b[^>]*>/i);if(c){let m=`</${c[1].toLowerCase()}>`,u=e.toLowerCase().indexOf(m,i+c[0].length);if(u===-1)return null;i=u+m.length;continue}let l=o.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!l)return null;return{insertPos:i+1+l[1].length,tagEnd:ft(e,i+1+l[1].length)}}return null}function ft(e,t){let i="";for(let o=t;o<e.length;o++){let a=e[o];if(i){if(a==="\\")o++;else if(a===i)i=""}else if(a==='"'||a==="'")i=a;else if(a===">")return o}return e.length}function er(e){let t=new Set;for(let i of e.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)){let o=i[1];if(!/\bclient\b/.test(o)||/\bserver\b/.test(o))continue;for(let a of Jo(i[2]))t.add(a);for(let a of i[2].matchAll(/^\s*import\s+(?:type\s+)?(?:([\w$]+)\s*,?\s*)?(?:\{([^}]*)\}|\*\s+as\s+([\w$]+))?\s*from\s/gm)){if(a[1])t.add(a[1]);if(a[3])t.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))t.add(l)}}}return t}async function ns(e,t,i,o,a){if(!Xt)Dt(le),Xt=!0;let c=await hf(e,t,i,o,a);c=await Gn(c,t,i,o,a),c=await Kn(c,t,i,o,a);let l=[];for(let m=0;m<3;m++){let u=l.length,y=pe(c,Oe,(x,C)=>`\x00STX_COMPONENT_COMMENT_${u+C}\x00`,`STX_COMPONENT_COMMENT:${u}`);l.push(...y.tokens);let w=c;if(c=await Jn(y.output,t,i,o,a),c===w)break}if(l.length>0)c=c.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(m,u)=>l[Number(u)]??"");if(o.debug){let m=Vn(c);if(m.length>0)console.warn(`[stx] ${i}: unresolved component tag(s) after render passes: ${m.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return c}
|
|
42
|
+
export{ko,_o,Co,nh,ts,rh,Wa,hf,ns};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{b}from"./chunk-
|
|
2
|
+
import{b}from"./chunk-zkx2m308.js";function Je(e,r){let n=y(e,r);return n.ok?{expression:n.expression,endPos:n.endPos}:null}function y(e,r){let n=r;while(n<e.length&&/\s/.test(e[n]))n++;if(e[n]!=="(")return{ok:!1,reason:"missing-open-paren",pos:n};let c=b(e,"(",")",n);if(c===-1)return{ok:!1,reason:"unclosed-paren",pos:n};return{ok:!0,expression:e.slice(n+1,c),endPos:c+1}}function k(e,r){let n=e.lastIndexOf("<",r);if(n===-1)return!1;return n>e.lastIndexOf(">",r)}function bt(e,r,n,c){let o=1,i=c,u=new RegExp(`@${r}\\s*\\(`,"g"),a=new RegExp(`@${n}(?![a-z])`,"g");while(i<e.length&&o>0){u.lastIndex=i,a.lastIndex=i;let p=u.exec(e),t=a.exec(e),s=p?p.index:1/0,f=t?t.index:1/0;if(s<f)o++,i=s+p[0].length;else if(f<1/0){if(o--,o===0)return f;i=f+t[0].length}else break}return-1}function v(e,r){let n=e.slice(r).match(/^@if\s*/);if(!n)return null;let c=r+n[0].length,o=Je(e,c);if(!o)return null;let i=o.endPos,u=bt(e,"if","endif",i);if(u===-1)return null;let a=e.slice(i,u),p=[],t=0,s="if",f=o.expression,l=0,x=0;while(t<a.length){let h=a.indexOf("@",t);if(h===-1)break;t=h;let d=a.substring(h);if(k(a,h)){t++;continue}if(/^@if\s*\(/.test(d)){x++,t++;continue}if(/^@endif(?![a-z])/.test(d)){x--,t+=6;continue}if(x===0){let g=d.match(/^@elseif\s*/);if(g){p.push({type:s,condition:f,content:a.substring(l,t),start:i+l,end:i+t});let E=t+g[0].length,m=Je(a,E);if(!m){t++;continue}s="elseif",f=m.expression,t=m.endPos,l=t;continue}else if(/^@else(?![a-z])/.test(d)){p.push({type:s,condition:f,content:a.substring(l,t),start:i+l,end:i+t}),s="else",f=void 0,t+=5,l=t;continue}}t++}return p.push({type:s,condition:f,content:a.slice(l),start:i+l,end:i+a.length}),{fullMatch:e.slice(r,u+6),branches:p,start:r,end:u+6}}function on(e){let r=[],n=/@if\s*\(/g,c=n.exec(e);while(c!==null){if(r.some((u)=>c.index>u.start&&c.index<u.end)){c=n.exec(e);continue}let i=v(e,c.index);if(i)r.push(i),n.lastIndex=i.end;c=n.exec(e)}return r}function as(e,r,n){let c=[],o=new RegExp(`@${r}\\s*\\(`,"g"),i=o.exec(e);while(i!==null){if(c.some((d)=>i.index>d.start&&i.index<d.end)){i=o.exec(e);continue}let a=i.index,p=a+i[0].length-1,t=b(e,"(",")",p);if(t===-1){i=o.exec(e);continue}let s=e.slice(p+1,t),f=t+1,l=bt(e,r,n,f);if(l===-1){i=o.exec(e);continue}let x=e.slice(f,l),h=l+`@${n}`.length;c.push({fullMatch:e.slice(a,h),name:r,params:s,content:x,start:a,end:h}),o.lastIndex=h,i=o.exec(e)}return c}function Oo(e,r){let n=e.slice(r).match(/^@switch\s*/);if(!n)return null;let c=r+n[0].length,o=Je(e,c);if(!o)return null;let i=o.endPos,u=bt(e,"switch","endswitch",i);if(u===-1)return null;let a=e.slice(i,u),p=[],t=0,s=null,f=0;while(t<a.length){let l=a.slice(t),x=l.match(/^@switch\s*\(/),h=l.match(/^@endswitch(?![a-z])/);if(x){if(f++,s)s.content+=x[0];t+=x[0].length;continue}if(h){if(f--,s)s.content+=h[0];t+=h[0].length;continue}if(f>0){if(s)s.content+=a[t];t++;continue}let d=l.match(/^@case\s*/),g=l.match(/^@default(?![a-z])/),E=l.match(/^@break(?![a-z])/);if(d&&l.startsWith("@case")){if(s)p.push(s);let m=t+d[0].length,P=Je(a,m);if(!P){t++;continue}s={type:"case",value:P.expression,content:""},t=P.endPos}else if(g&&l.startsWith("@default")){if(s)p.push(s);s={type:"default",content:""},t+=g[0].length}else if(E&&l.startsWith("@break"))t+=E[0].length;else{if(s)s.content+=a[t];t++}}if(s)p.push(s);return{fullMatch:e.slice(r,u+10),expression:o.expression,cases:p,start:r,end:u+10}}export{Je,bt,on,as,Oo};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{m,ei,Rc,Ac,Hf,Vf,Uf,Wf,qf,Is,Kf,Le,Y,je,Gf,wr,Xf,Oc,si,Be,r,hn,Nc,h,fe,wh}from"./chunk-q73xkgn0.js";import"./chunk-jtgb1s62.js";import"./chunk-rbmt5w9v.js";import"./chunk-zkx2m308.js";import"./chunk-zn3c0ew5.js";import"./chunk-ez35607j.js";export{fe as clearComponentCache,si as componentClientSignalNames,ei as convertToCommonJS,h as createDetailedErrorMessage,qf as extractDirectiveNames,Rc as extractScriptFromTemplate,m as extractVariables,r as fileExists,wh as getComponentCacheStats,Vf as getPositionInfo,Y as getSharedTranspiler,Nc as getSourceLineInfo,Wf as hasDirectives,Ac as hasVariables,Xf as isHydrateTrigger,Kf as isJavaScriptScript,Be as renderComponentWithSlot,hn as resolveTemplatePath,Gf as scopeOnRootElement,Is as scopeSequenceKey,Le as shouldTranspileTypeScript,Oc as slotContentHasExpressions,je as transpileTypeScript,wr as userComponentFileExists,Uf as validateDirective,Hf as validateTemplate};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{W,Oe}from"./chunk-q73xkgn0.js";var o=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function u(t,e,r){let i={fullTag:r,content:e,attrs:t};if(/\bserver\b/.test(t))return{...i,type:"server"};if(/\bdata-stx-scoped\b/.test(t))return{...i,type:"client"};if(o.test(e))return{...i,type:"signals"};if(/\bclient\b/.test(t)||/\btype\s*=\s*["']module["']/.test(t)||/\bsrc\s*=/.test(t))return{...i,type:"client"};return{...i,type:"server"}}var S=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function Jt(t){let e=[],r=[],i=[],c=0;while(c<t.length){let s=t.indexOf("<",c);if(s===-1)break;let p=Oe(t,s);if(p>s){c=p;continue}let a=W(t,s);if(a>s){let f=t.slice(s,a),l=S.exec(f);if(l){let n=u(l[1],l[2],f);switch(n.type){case"signals":e.push(n);break;case"client":r.push(n);break;case"server":i.push(n);break}}c=a;continue}c=s+(t.startsWith("<!--",s)?4:1)}return{signals:e,client:r,server:i}}
|
|
3
3
|
export{Jt};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import s from"path";var h=new Set([".jpg",".jpeg",".png",".gif"]),d=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}];async function
|
|
3
|
-
export{
|
|
2
|
+
import s from"path";var h=new Set([".jpg",".jpeg",".png",".gif"]),d=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}];async function ql(e,r){let a=r.formats??d;if(!r.publicDir)return e;let i=y(e),o=[],m=/<img\b[^>]*?>/gi,c=[],u;while((u=m.exec(e))!==null){let t=u[0],n=t.match(/\bsrc=["']([^"']+)["']/i);if(!n)continue;if(A(u.index,i))continue;c.push({idx:u.index,length:t.length,src:n[1],raw:t})}if(c.length===0)return e;let f=await Promise.all(c.map(async(t)=>{let n=await S(t.src,r.publicDir,a);return{match:t,sources:n}}));for(let{match:t,sources:n}of f){if(n.length===0)continue;let x=`<picture>${n.map((p)=>`<source type="${p.mime}" srcset="${P(p.url)}">`).join("")}${t.raw}</picture>`;o.push({start:t.idx,end:t.idx+t.length,replacement:x})}if(o.length===0)return e;let l="",g=0;for(let t of o)l+=e.slice(g,t.start),l+=t.replacement,g=t.end;return l+=e.slice(g),l}async function S(e,r,a){if(!w(e))return[];let i=s.extname(e).toLowerCase();if(!h.has(i))return[];if(!e.startsWith("/"))return[];let o=s.join(r,e.slice(1)),m=s.dirname(o),c=s.basename(o,i),u=s.resolve(m),f=s.resolve(r);if(!u.startsWith(f))return[];let l=s.posix.dirname(e),g=a.map(async(n)=>{let b=s.join(m,`${c}${n.ext}`);if(!await Bun.file(b).exists())return null;return{url:s.posix.join(l,`${c}${n.ext}`),mime:n.mime}});return(await Promise.all(g)).filter((n)=>n!==null)}function w(e){if(!e)return!1;if(e.startsWith("http://")||e.startsWith("https://"))return!1;if(e.startsWith("//"))return!1;if(e.startsWith("data:"))return!1;return!0}function y(e){let r=[],a=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,i;while((i=a.exec(e))!==null)r.push([i.index,i.index+i[0].length]);return r}function A(e,r){for(let[a,i]of r)if(e>=a&&e<i)return!0;return!1}function P(e){return e.replace(/&/g,"&").replace(/"/g,""")}
|
|
3
|
+
export{ql};
|