@stacksjs/stx 0.2.673 → 0.2.675
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-pn1ehs6a.js → chunk-028e9fty.js} +2 -2
- package/dist/{chunk-wns8g6k9.js → chunk-03hhanvm.js} +9 -9
- package/dist/{chunk-prf164ct.js → chunk-078qg8r5.js} +2 -2
- package/dist/{chunk-120ze5ms.js → chunk-09gchq7d.js} +3 -3
- package/dist/chunk-0gk78x3r.js +2 -0
- package/dist/{chunk-xwhmh0w0.js → chunk-0thxpgtp.js} +2 -2
- package/dist/chunk-1b9thkg5.js +3 -0
- package/dist/chunk-1s2y6f4b.js +2 -0
- package/dist/chunk-1wdawkn8.js +2 -0
- package/dist/chunk-248a88mc.js +2 -0
- package/dist/{chunk-0f4csefs.js → chunk-29wj0c68.js} +5 -5
- package/dist/chunk-2nqtmp8c.js +2 -0
- package/dist/chunk-2pga7zzb.js +4 -0
- package/dist/chunk-2xv29pfj.js +11 -0
- package/dist/{chunk-md2jn67b.js → chunk-374nhgyf.js} +2 -2
- package/dist/chunk-3vwkyjan.js +421 -0
- package/dist/chunk-3wsm9g9c.js +2 -0
- package/dist/chunk-3xx9d934.js +2 -0
- package/dist/chunk-41q5rww8.js +2 -0
- package/dist/chunk-4c5tk71j.js +2 -0
- package/dist/chunk-4e5jrxbn.js +14 -0
- package/dist/{chunk-kgfgb971.js → chunk-4fhbh04h.js} +4 -4
- package/dist/chunk-4x5dk7a4.js +2 -0
- package/dist/{chunk-mxbc2ahy.js → chunk-54fazdmn.js} +5 -5
- package/dist/chunk-57ege36s.js +2 -0
- package/dist/{chunk-5xvan09w.js → chunk-5fh9m8fm.js} +2 -2
- package/dist/chunk-5n4c99y5.js +2 -0
- package/dist/{chunk-mmwedr93.js → chunk-5z0q3qv3.js} +5 -5
- package/dist/{chunk-ecqrkyg8.js → chunk-5z8mq37c.js} +4 -4
- package/dist/{chunk-bnn7pd62.js → chunk-5zvrbms2.js} +2 -2
- package/dist/{chunk-ce6zddpf.js → chunk-6beg47t4.js} +2 -2
- package/dist/chunk-6kam8r5y.js +2 -0
- package/dist/{chunk-h4dkvnhd.js → chunk-6ncvb8gp.js} +10 -10
- package/dist/{chunk-hmyb701s.js → chunk-6qh2mx6q.js} +38 -38
- package/dist/chunk-6rftdp7c.js +2 -0
- package/dist/{chunk-zqtbtqbq.js → chunk-6ycyaf5g.js} +2 -2
- package/dist/chunk-7475sm3m.js +2 -0
- package/dist/{chunk-aprhqxky.js → chunk-78x52gz3.js} +5 -5
- package/dist/{chunk-pxdww4rb.js → chunk-78yjmbbs.js} +2 -2
- package/dist/{chunk-b4pcw34n.js → chunk-7j7h1eg3.js} +1 -1
- package/dist/{chunk-vhs13kbf.js → chunk-7q699phs.js} +1 -1
- package/dist/chunk-7s6hypn5.js +2 -0
- package/dist/chunk-7ym269yp.js +2 -0
- package/dist/{chunk-rcsgt4wy.js → chunk-81rdyz2n.js} +1 -1
- package/dist/chunk-855h3crg.js +2 -0
- package/dist/chunk-8an7vcxx.js +2 -0
- package/dist/{chunk-m6q3f5rf.js → chunk-8jdbrcgt.js} +10 -10
- package/dist/{chunk-0qqvmfrw.js → chunk-8md2707p.js} +76 -76
- package/dist/chunk-8p92r2sc.js +2 -0
- package/dist/{chunk-yg267y85.js → chunk-8xxc5edr.js} +3 -3
- package/dist/{chunk-dq56166k.js → chunk-93z9f2be.js} +40 -40
- package/dist/{chunk-6ajahb2x.js → chunk-97h9ga3b.js} +3 -3
- package/dist/chunk-9859r1d5.js +2 -0
- package/dist/{chunk-jg5zt20a.js → chunk-9azagdq6.js} +75 -75
- package/dist/{chunk-1sr6c0nk.js → chunk-9wdd7eq6.js} +2 -2
- package/dist/{chunk-wbzmr6a4.js → chunk-9ybjsfyp.js} +2 -2
- package/dist/chunk-ammn4wbd.js +2 -0
- package/dist/chunk-arh1qgmp.js +2 -0
- package/dist/{chunk-7d4z944r.js → chunk-bh19ezq0.js} +7 -7
- package/dist/chunk-bpf3xxng.js +3 -0
- package/dist/chunk-c2rq9pap.js +2 -0
- package/dist/chunk-cfm6a679.js +2 -0
- package/dist/{chunk-fvtwec1r.js → chunk-cxgremn0.js} +5 -5
- package/dist/chunk-dasxbb9y.js +2 -0
- package/dist/{chunk-qmfycza5.js → chunk-db5017x8.js} +2 -2
- package/dist/{chunk-p472crv1.js → chunk-dba795e1.js} +1 -1
- package/dist/{chunk-a3d0g4mr.js → chunk-dera8fmc.js} +2 -2
- package/dist/chunk-e02ne8zd.js +2 -0
- package/dist/chunk-e492je6q.js +2 -0
- package/dist/{chunk-ka8befem.js → chunk-e4ezpevb.js} +2 -2
- package/dist/chunk-etbpzmxv.js +4 -0
- package/dist/{chunk-365vg0eg.js → chunk-f26n6y9p.js} +4 -4
- package/dist/chunk-fqa5ej45.js +2 -0
- package/dist/{chunk-xqp4hstk.js → chunk-fzc98qgn.js} +7 -7
- package/dist/chunk-g98gafg7.js +3 -0
- package/dist/chunk-gc4w2s5n.js +31 -0
- package/dist/{chunk-n38yb274.js → chunk-ggf4z3bv.js} +6 -6
- package/dist/chunk-ggwvnpwj.js +2 -0
- package/dist/chunk-gx6wxmbv.js +2 -0
- package/dist/chunk-hamk3dky.js +2 -0
- package/dist/{chunk-g8r0km7g.js → chunk-haz2ezyk.js} +2 -2
- package/dist/chunk-hfbkbrwk.js +130 -0
- package/dist/chunk-hg0dd64a.js +2 -0
- package/dist/chunk-hh58k0nh.js +3 -0
- package/dist/chunk-hz5eh77e.js +2 -0
- package/dist/chunk-hz8dj5jy.js +21 -0
- package/dist/{chunk-3y41efsf.js → chunk-j6x7ryyn.js} +14 -14
- package/dist/{chunk-wpmrz872.js → chunk-jv021x8e.js} +2 -2
- package/dist/{chunk-r3e6x87d.js → chunk-k06n5bjp.js} +3 -3
- package/dist/{chunk-30nes8ne.js → chunk-k72jqz6a.js} +3 -3
- package/dist/chunk-kqbpkg8n.js +2 -0
- package/dist/{chunk-2dp7hyv7.js → chunk-kzb04293.js} +19 -19
- package/dist/{chunk-qv6axke4.js → chunk-mabja59q.js} +2 -2
- package/dist/chunk-mf19qxgv.js +3 -0
- package/dist/{chunk-7met6yva.js → chunk-mn47s2ef.js} +5 -5
- package/dist/chunk-mvz825w0.js +33 -0
- package/dist/chunk-n615cbxq.js +2 -0
- package/dist/chunk-nv0jjhtd.js +2 -0
- package/dist/chunk-nvbyscdh.js +20 -0
- package/dist/chunk-nw44qq6h.js +24 -0
- package/dist/{chunk-chzgfna2.js → chunk-p6g58hwg.js} +2 -2
- package/dist/chunk-prc5dxp1.js +2 -0
- package/dist/{chunk-04kg16qs.js → chunk-q3gactm1.js} +4 -4
- package/dist/{chunk-tre98h62.js → chunk-q4rejyd2.js} +2 -2
- package/dist/chunk-q7tfqavs.js +42 -0
- package/dist/{chunk-jst1fbdm.js → chunk-qdkwg2b8.js} +2 -2
- package/dist/{chunk-yfvm7q6t.js → chunk-qr7a378v.js} +3 -3
- package/dist/chunk-qwdgx34g.js +2 -0
- package/dist/chunk-r6t1712p.js +2 -0
- package/dist/{chunk-hzv2qj0t.js → chunk-ram7pa4k.js} +6 -6
- package/dist/{chunk-hvzzhkhr.js → chunk-rza1p6e4.js} +2 -2
- package/dist/chunk-s5q9ztvj.js +2 -0
- package/dist/chunk-s8qe247r.js +2 -0
- package/dist/chunk-sfpymq5h.js +2 -0
- package/dist/chunk-shft9r9d.js +2 -0
- package/dist/{chunk-hvf2e7pr.js → chunk-sr3hmrah.js} +2 -2
- package/dist/chunk-sswy3tfc.js +2 -0
- package/dist/chunk-swxznm5v.js +2 -0
- package/dist/chunk-t8tst3sk.js +2 -0
- package/dist/chunk-t9bsgbwv.js +3 -0
- package/dist/chunk-tst8p27s.js +12 -0
- package/dist/chunk-tz09earb.js +2 -0
- package/dist/{chunk-t2pzy3x1.js → chunk-vd5w1jaz.js} +3 -3
- package/dist/chunk-vf6yaymh.js +2 -0
- package/dist/{chunk-9p6efb17.js → chunk-vg1pg6yt.js} +1 -1
- package/dist/chunk-w0vpvcj0.js +2 -0
- package/dist/{chunk-vqc4h16r.js → chunk-wav0xbnb.js} +2 -2
- package/dist/{chunk-rcadtv3x.js → chunk-wr1gm35v.js} +1 -1
- package/dist/{chunk-dgb4z4kw.js → chunk-wscnjtss.js} +2 -2
- package/dist/{chunk-ym41ybz2.js → chunk-wtvy9r5w.js} +6 -6
- package/dist/chunk-x4q4bx3q.js +3 -0
- package/dist/{chunk-nrvwejdw.js → chunk-x7wr720m.js} +5 -5
- package/dist/chunk-xayfz35c.js +2 -0
- package/dist/{chunk-7b3kr56x.js → chunk-xdn6rtq2.js} +3 -3
- package/dist/chunk-xh5mh8kn.js +2 -0
- package/dist/chunk-xna6b7km.js +2 -0
- package/dist/chunk-xrrx2ddz.js +2 -0
- package/dist/{chunk-ptcj11b4.js → chunk-xtnxvmdb.js} +13 -13
- package/dist/chunk-xw4rm5zj.js +2 -0
- package/dist/{chunk-fzqj1mjz.js → chunk-yaccg2c0.js} +7 -7
- package/dist/chunk-yar7fwrb.js +2 -0
- package/dist/{chunk-2zzc7006.js → chunk-yn9kvsk1.js} +2 -2
- package/dist/chunk-yt33wzqk.js +2 -0
- package/dist/{chunk-jxda11cg.js → chunk-z17sy8g3.js} +2 -2
- package/dist/chunk-z4bfgvb3.js +25 -0
- package/dist/chunk-z6mrnh98.js +2 -0
- package/dist/chunk-zq7xbc1k.js +2 -0
- package/dist/cli.js +23 -23
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/loops.js +12 -2
- package/dist/native/compiler/headwind-to-style.js +13 -1
- package/dist/native/compiler/html-to-ir.d.ts +2 -0
- package/dist/native/compiler/html-to-ir.js +9 -0
- package/dist/native/compiler/ir.d.ts +1 -0
- package/dist/native/compiler/render-screen.js +4 -3
- package/dist/native/compiler/style-config.d.ts +3 -0
- package/dist/native/compiler/style-config.js +5 -0
- package/dist/native/components/primitives.d.ts +2 -0
- package/dist/native/event-names.js +2 -0
- package/dist/native/prop-names.js +1 -0
- package/dist/native/runtime/craft-bridge.js +15 -8
- package/dist/pwa.js +3 -3
- package/dist/signal-processing.d.ts +12 -0
- package/dist/signal-processing.js +76 -17
- package/dist/ssg-static-paths.d.ts +12 -0
- package/dist/ssg-static-paths.js +62 -0
- package/dist/ssg.d.ts +2 -4
- package/dist/ssg.js +43 -47
- package/dist/utils.js +1 -1
- package/package.json +5 -5
- package/dist/chunk-028ee6q5.js +0 -2
- package/dist/chunk-02ymqwmj.js +0 -2
- package/dist/chunk-1fd7x7b8.js +0 -20
- package/dist/chunk-1pnp91wx.js +0 -2
- package/dist/chunk-1ptwdkvn.js +0 -4
- package/dist/chunk-1v60t3sb.js +0 -2
- package/dist/chunk-280p4q7a.js +0 -2
- package/dist/chunk-2f17h17f.js +0 -2
- package/dist/chunk-4c183zem.js +0 -2
- package/dist/chunk-4yt8tg4j.js +0 -2
- package/dist/chunk-52gp2xxk.js +0 -2
- package/dist/chunk-5zgrvj4b.js +0 -2
- package/dist/chunk-67kj14at.js +0 -2
- package/dist/chunk-6rzshbey.js +0 -2
- package/dist/chunk-6vzktvyw.js +0 -2
- package/dist/chunk-81q3sc0w.js +0 -2
- package/dist/chunk-864qtx7y.js +0 -2
- package/dist/chunk-89jbdtgw.js +0 -3
- package/dist/chunk-8d33aqs5.js +0 -2
- package/dist/chunk-8tdz8svp.js +0 -2
- package/dist/chunk-8yqfpkp4.js +0 -130
- package/dist/chunk-99bhc1h1.js +0 -42
- package/dist/chunk-9rrnyd5m.js +0 -2
- package/dist/chunk-9szxxgv5.js +0 -2
- package/dist/chunk-9tdnfztv.js +0 -21
- package/dist/chunk-agqcqf3q.js +0 -14
- package/dist/chunk-amkwmxs8.js +0 -2
- package/dist/chunk-b1hxtn08.js +0 -2
- package/dist/chunk-b4fd2dtk.js +0 -2
- package/dist/chunk-b4vk2m82.js +0 -2
- package/dist/chunk-b58tv8jc.js +0 -25
- package/dist/chunk-b6nzy1rg.js +0 -2
- package/dist/chunk-b823zxq6.js +0 -3
- package/dist/chunk-bdg0fydw.js +0 -2
- package/dist/chunk-dpvxe52r.js +0 -2
- package/dist/chunk-e1fetwbr.js +0 -2
- package/dist/chunk-e4vpr36s.js +0 -2
- package/dist/chunk-e6p0k6br.js +0 -2
- package/dist/chunk-f8agvh5v.js +0 -2
- package/dist/chunk-fbtv2k1p.js +0 -3
- package/dist/chunk-fcn71bq1.js +0 -2
- package/dist/chunk-g2jmwh7p.js +0 -2
- package/dist/chunk-g64z2e92.js +0 -2
- package/dist/chunk-gw7h5k3b.js +0 -2
- package/dist/chunk-hvtzw1jh.js +0 -2
- package/dist/chunk-j0v970k3.js +0 -2
- package/dist/chunk-jefe0rgt.js +0 -31
- package/dist/chunk-jk41jwsc.js +0 -2
- package/dist/chunk-jr9wfthg.js +0 -2
- package/dist/chunk-k2pa44rf.js +0 -2
- package/dist/chunk-kq9y6gfy.js +0 -2
- package/dist/chunk-md2qhahg.js +0 -2
- package/dist/chunk-npa7gze7.js +0 -4
- package/dist/chunk-p38m3947.js +0 -2
- package/dist/chunk-qcjh3pp8.js +0 -2
- package/dist/chunk-qjtpxsyx.js +0 -12
- package/dist/chunk-qw441qys.js +0 -2
- package/dist/chunk-qxmyaajq.js +0 -2
- package/dist/chunk-qyjsne99.js +0 -2
- package/dist/chunk-rermy54w.js +0 -2
- package/dist/chunk-rwjf25ht.js +0 -2
- package/dist/chunk-rx0ep3v1.js +0 -2
- package/dist/chunk-sf0wsq74.js +0 -2
- package/dist/chunk-sfc2v7rt.js +0 -33
- package/dist/chunk-shpc1ttk.js +0 -2
- package/dist/chunk-sy0z64yz.js +0 -2
- package/dist/chunk-t0zh1dn9.js +0 -421
- package/dist/chunk-ta7bmfvg.js +0 -3
- package/dist/chunk-weqc0ssb.js +0 -2
- package/dist/chunk-wq712sw1.js +0 -2
- package/dist/chunk-xaa36b0x.js +0 -3
- package/dist/chunk-xr69d4tk.js +0 -2
- package/dist/chunk-xz6dw6yw.js +0 -2
- package/dist/chunk-y8kdy3d2.js +0 -2
- package/dist/chunk-ynz7bzc6.js +0 -24
- package/dist/chunk-yscr04dv.js +0 -2
- package/dist/chunk-z8p6tk5z.js +0 -2
- package/dist/chunk-zhf01af3.js +0 -3
- package/dist/chunk-zvygkwyf.js +0 -11
package/dist/chunk-t0zh1dn9.js
DELETED
|
@@ -1,421 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{je,mn,ys,Bo,A}from"./chunk-1sr6c0nk.js";import{gn}from"./chunk-xwhmh0w0.js";import{br,x,ic,st,Go,ac}from"./chunk-pxdww4rb.js";import{T}from"./chunk-ce6zddpf.js";import{bs,l,p,Nt,u,z,D,w,Ss,xe,Fe,ks}from"./chunk-2dp7hyv7.js";import{i,et}from"./chunk-qjtpxsyx.js";import{f}from"./chunk-b7e07ybq.js";import{H}from"./chunk-fbtv2k1p.js";import Je from"path";import Ct from"process";import{AsyncLocalStorage as io}from"async_hooks";var nr=new io;function ln(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function ur(e,s){return nr.run(ln(e),s)}async function fr(e,s){let t=nr.getStore();if(!t)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let o=t.pending.get(e);if(o)return o;let a=Promise.resolve().then(s).then((h)=>{let c=JSON.stringify(h,(E,R)=>{if(R===void 0||typeof R==="function"||typeof R==="symbol"||typeof R==="bigint"||typeof R==="number"&&!Number.isFinite(R))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(R&&typeof R==="object"&&!Array.isArray(R)&&Object.getPrototypeOf(R)!==Object.prototype&&Object.getPrototypeOf(R)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return R}),v=JSON.parse(c);return t.values.set(e,v),v}).catch((h)=>{throw t.pending.delete(e),h});return t.pending.set(e,a),a}function cr(e){let s=e.__stx_server_data;if(!s?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(s.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function L(e,s=!1){let t=i(e),o=[],a=new Set,h=0,c=0,v=t.length,E=()=>{if(h!==0)return;let R=t.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(R){if(s&&R[1]==="const")return;let I=R[2];if(!a.has(I))o.push(I),a.add(I);return}let C=t.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(C){if(s&&t.slice(c).startsWith("const"))return;C[1].split(",").forEach((I)=>{let P=I.trim();if(!P)return;let Z=P.indexOf(":"),V=(Z>=0?P.slice(Z+1).trim():P).split(/[\s=]/)[0];if(V&&!a.has(V))o.push(V),a.add(V)});return}let O=t.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(O){if(s&&t.slice(c).startsWith("const"))return;O[1].split(",").forEach((I)=>{let P=I.trim().replace(/^\.\.\./,"");if(!P)return;let Z=P.split(/[\s=]/)[0];if(Z&&!a.has(Z))o.push(Z),a.add(Z)});return}if(s)return;let M=t.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(M){let I=M[1];if(!a.has(I))o.push(I),a.add(I);return}let N=t.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(N){let I=N[1];if(!a.has(I))o.push(I),a.add(I)}};while(c<v){if(t[c]==="{"){h++,c++;continue}if(t[c]==="}"){h--,c++;continue}if(h===0&&/[a-z]/i.test(t[c])&&(c===0||/\s|[;{}()]/.test(t[c-1])))E();c++}return o.join(", ")}function ns(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function oo(e,s=L(e).split(",").map((t)=>t.trim()).filter(Boolean)){let t=new Set(L(e,!0).split(",").map((o)=>o.trim()));return s.map((o)=>t.has(o)?`get ${o}() { return ${o} }, set ${o}(__stxValue_${o}) { ${o} = __stxValue_${o} }`:o).join(", ")}function rs(e,s){let t=`{ ${oo(e,s)} }`;return L(e).split(",").some((o)=>o.trim()==="__stxLiveBindings")?`Object.defineProperties(${t}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:t}import kn from"fs";import Ce from"path";function j(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var pr=new Map;function ss(e,s=!0){let t=pr.get(e);if(s&&t)return t;let o=new Map,a=[Ce.join(e,"src"),Ce.join(e,"dist"),e];function h(c,v){if(v>6)return;let E;try{E=kn.readdirSync(c,{withFileTypes:!0})}catch{return}for(let R of E){let C=Ce.join(c,R.name);if(R.isDirectory()){if(R.name==="node_modules"||R.name.startsWith("."))continue;h(C,v+1)}else if(R.isFile()&&R.name.endsWith(".stx")){let O=R.name.slice(0,-4);if(!o.has(O))o.set(O,C);let M=O.toLowerCase();if(!o.has(M))o.set(M,C);let N=j(O);if(!o.has(N))o.set(N,C)}}}for(let c of a)if(h(c,0),o.size>0)break;if(s)pr.set(e,o);return o}function os(e,s){if(e.startsWith(".")||e.startsWith("/"))return null;let t=s;while(!0){let o=Ce.join(t,"node_modules",e);try{if(kn.statSync(o).isDirectory())return o}catch{}let a=Ce.dirname(t);if(a===t)return null;t=a}}function is(e,s,t={}){return[Ce.resolve(Ce.dirname(s),`${e}.stx`),Ce.resolve(Ce.dirname(s),e),Ce.resolve(t.componentsDir||"components",`${e}.stx`),Ce.resolve(t.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function dr(e){let s=e.endsWith(".stx")?e.slice(0,-4):e,t=s.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),o=j(s);return[s,t,o]}function So(e,s){let[t,o,a]=dr(e);for(let h of[t,t.toLowerCase(),o,a]){let c=s?.__importedComponents?.get(h);if(c!==void 0)return c}}function*ko(e,s,t={},o){let a=dr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield Ce.resolve(Ce.dirname(s),`${a[0]}.stx`);return}let h=[...new Set(a.map((E)=>`${E}.stx`))],c=t.projectRoot||process.cwd(),v=[...o?.__originalFilePath?[Ce.join(Ce.dirname(o.__originalFilePath),"components")]:[],...t.componentsDir?[t.componentsDir]:[],Ce.join(Ce.dirname(s),"components"),Ce.resolve(c,"src/components"),Ce.resolve(c,"components"),...import.meta.dir?[Ce.resolve(import.meta.dir,"components")]:[]];for(let E of new Set(v)){for(let R of h)yield Ce.join(E,R);try{for(let R of kn.readdirSync(E,{withFileTypes:!0}))if(R.isDirectory())for(let C of h)yield Ce.join(E,R.name,C)}catch{}}}function gr(e,s,t={},o){let a=So(e,o);if(a!==void 0)return a;for(let h of ko(e,s,t,o))try{if(kn.statSync(h,{throwIfNoEntry:!1})?.isFile())return h}catch{}return null}import Ks from"fs";import oe from"path";import mt from"path";import Kt from"fs";var ao=new Set(["touchstart","touchmove","wheel","mousewheel"]);function es(e,s){if(s.passive)return!0;if(s.prevent||s.nonpassive)return!1;return ao.has(e.toLowerCase())}var mr=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),hr={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},co=new Set(["ctrl","alt","shift","meta"]),_r={left:0,middle:1,right:2};function xr(e){let s={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let t of e){let o=t.toLowerCase();if(o==="prevent")s.prevent=!0;else if(o==="stop")s.stop=!0;else if(o==="once")s.once=!0;else if(o==="capture")s.capture=!0;else if(o==="self")s.self=!0;else if(o==="passive")s.passive=!0;else if(o==="nonpassive")s.nonpassive=!0;else if(co.has(o))s.systemKeys.push(o);else if(o in _r)s.mouse=o;else if(o in hr||/^[a-z]$/.test(o))s.keys.push(hr[o]||o.toUpperCase());else if(o.startsWith("debounce")){let a=o.match(/debounce(?:\.(\d+))?/);s.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(o.startsWith("throttle")){let a=o.match(/throttle(?:\.(\d+))?/);s.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return s}function wr(e,s=""){let t=[],o=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,h;while((h=a.exec(e))!==null){let[c,v,E]=h,R=h.index,C=R+c.length,O=`__stx_evt_${s}${o++}`,M=[],N=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,I;while((I=N.exec(E))!==null){let[,Z,U]=I,V=Z.split("."),X=V[0];if(!mr.has(X))continue;M.push({attribute:`@${Z}`,event:X,handler:U,modifiers:xr(V.slice(1)),elementId:O})}let P=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((I=P.exec(E))!==null){let[,Z,U]=I,V=Z.split("."),X=V[0];if(!mr.has(X))continue;M.push({attribute:`@${Z}`,event:X,handler:U,modifiers:xr(V.slice(1)),elementId:O})}if(M.length>0)t.push({originalTag:c,elementId:O,events:M,startIndex:R,endIndex:C})}return t}function lo(e){let s=[],{modifiers:t}=e;if(t.self)s.push("if ($event.target !== $el) return");for(let o of t.systemKeys)s.push(`if (!$event.${o}Key) return`);if(t.keys.length>0){let o=t.keys.map((a)=>`$event.key === '${a}'`).join(" || ");s.push(`if (!(${o})) return`)}if(t.mouse!==null){let o=_r[t.mouse];s.push(`if ($event.button !== ${o}) return`)}if(t.prevent)s.push("$event.preventDefault()");if(t.stop)s.push("$event.stopPropagation()");return s.join("; ")}function uo(e,s){let t=e;if(s.debounce!==null)t=`__stx_debounce(() => { ${t} }, ${s.debounce})`;else if(s.throttle!==null)t=`__stx_throttle(() => { ${t} }, ${s.throttle})`;return t}function ts(e){let s=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(s))return e;return`if (typeof ${s} === 'function' && !${s}._isSignal) ${s}($event);`}function fo(e){let{modifiers:s}=e,t=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),o=lo(e),a=uo(ts(e.handler),s),h=[];if(s.once)h.push("once: true");if(s.capture)h.push("capture: true");if(es(e.event,s))h.push("passive: true");let c=h.length>0?`, { ${h.join(", ")} }`:"",v=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
|
|
3
|
-
(function() {
|
|
4
|
-
var $el = document.getElementById('${t}');
|
|
5
|
-
if (!$el) return;
|
|
6
|
-
// Run mounted handler immediately (DOM is ready)
|
|
7
|
-
var scope = $el.closest('[data-stx-scope]');
|
|
8
|
-
if (scope && scope.__stx_execute) {
|
|
9
|
-
scope.__stx_execute('${v}', null, $el);
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
__stx_runHandler('${v}', null, $el);
|
|
13
|
-
}
|
|
14
|
-
})();`;if(e.event==="unmounted")return`
|
|
15
|
-
(function() {
|
|
16
|
-
var $el = document.getElementById('${t}');
|
|
17
|
-
if (!$el) return;
|
|
18
|
-
// Set up MutationObserver to detect removal
|
|
19
|
-
var observer = new MutationObserver(function(mutations) {
|
|
20
|
-
for (var m of mutations) {
|
|
21
|
-
for (var node of m.removedNodes) {
|
|
22
|
-
if (node === $el || (node.contains && node.contains($el))) {
|
|
23
|
-
observer.disconnect();
|
|
24
|
-
var scope = $el.closest('[data-stx-scope]');
|
|
25
|
-
if (scope && scope.__stx_execute) {
|
|
26
|
-
scope.__stx_execute('${v}', null, $el);
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
__stx_runHandler('${v}', null, $el);
|
|
30
|
-
}
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
observer.observe(document.body, { childList: true, subtree: true });
|
|
37
|
-
// Store observer for cleanup
|
|
38
|
-
$el.__stx_unmount_observer = observer;
|
|
39
|
-
})();`;return`
|
|
40
|
-
(function() {
|
|
41
|
-
var $el = document.getElementById('${t}');
|
|
42
|
-
if (!$el) return;
|
|
43
|
-
// eslint-disable-next-line pickier/no-unused-vars
|
|
44
|
-
$el.addEventListener('${e.event}', function($event) {
|
|
45
|
-
${o?o+";":""}
|
|
46
|
-
// Find the closest reactive scope and execute within its context
|
|
47
|
-
var scope = $el.closest('[data-stx-scope]');
|
|
48
|
-
if (scope && scope.__stx_execute) {
|
|
49
|
-
scope.__stx_execute('${v}', $event, $el);
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
// Fallback for non-reactive context (entity-safe; decoded + run in memory)
|
|
53
|
-
__stx_runHandler('${v}', $event, $el);
|
|
54
|
-
}
|
|
55
|
-
}${c});
|
|
56
|
-
})();`}function _o(e){if(e.length===0)return"";return`
|
|
57
|
-
<script data-stx-events>
|
|
58
|
-
(function() {
|
|
59
|
-
'use strict';
|
|
60
|
-
|
|
61
|
-
// Utility functions
|
|
62
|
-
function __stx_debounce(fn, delay) {
|
|
63
|
-
var timeout;
|
|
64
|
-
return function() {
|
|
65
|
-
var args = arguments;
|
|
66
|
-
var ctx = this;
|
|
67
|
-
clearTimeout(timeout);
|
|
68
|
-
timeout = setTimeout(function() { fn.apply(ctx, args); }, delay);
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function __stx_throttle(fn, delay) {
|
|
73
|
-
var last = 0;
|
|
74
|
-
return function() {
|
|
75
|
-
var now = Date.now();
|
|
76
|
-
if (now - last >= delay) {
|
|
77
|
-
last = now;
|
|
78
|
-
fn.apply(this, arguments);
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// Non-reactive fallback runner. The handler is embedded HTML-entity-encoded
|
|
84
|
-
// so the surrounding script element can never contain raw markup, including
|
|
85
|
-
// its own closing tag; we decode it to JS only in memory here, then run it
|
|
86
|
-
// with $event/$el in scope.
|
|
87
|
-
//
|
|
88
|
-
// This comment must not spell that closing tag out. It used to, as an
|
|
89
|
-
// example, and a browser ends the script element at the FIRST one it sees \u2014
|
|
90
|
-
// so everything below this line, __stx_runHandler included, was emitted as
|
|
91
|
-
// page text and no listener was ever bound. The comment about escaping was
|
|
92
|
-
// the thing that needed escaping.
|
|
93
|
-
function __stx_runHandler(h, $event, $el) {
|
|
94
|
-
var code = h
|
|
95
|
-
.replace(/</g, '<')
|
|
96
|
-
.replace(/>/g, '>')
|
|
97
|
-
.replace(/"/g, '"')
|
|
98
|
-
.replace(/'/g, "'")
|
|
99
|
-
.replace(/'/g, "'")
|
|
100
|
-
.replace(/&/g, '&');
|
|
101
|
-
try {
|
|
102
|
-
// eslint-disable-next-line no-new-func
|
|
103
|
-
(new Function('$event', '$el', code)).call($el, $event, $el);
|
|
104
|
-
}
|
|
105
|
-
catch (e) {
|
|
106
|
-
if (typeof console !== 'undefined') console.error('[stx] event handler error:', e);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// Event listeners
|
|
111
|
-
${e.map(fo).join(`
|
|
112
|
-
`)}
|
|
113
|
-
})();
|
|
114
|
-
</script>`}function po(e,s=""){let t=wr(e,s);if(t.length===0)return{template:e,bindings:[]};let o=e,a=[];for(let h=t.length-1;h>=0;h--){let c=t[h],v=c.originalTag;if(!v.includes(" id="))v=v.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${c.elementId}"`);else{let E=v.match(/id=["']([^"']+)["']/);if(E)for(let R of c.events)R.elementId=E[1]}for(let E of c.events){let R=E.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),C=new RegExp(`\\s*${R}\\s*=\\s*"[^"]*"`,"g"),O=new RegExp(`\\s*${R}\\s*=\\s*'[^']*'`,"g");v=v.replace(C,""),v=v.replace(O,"")}o=o.slice(0,c.startIndex)+v+o.slice(c.endIndex),a.push(...c.events)}return{template:o,bindings:a}}function yr(e){let s=e.$uid;return typeof s==="string"&&s?`${s}_`:""}function Ea(e,s,t){if(ac(e))return e;if(s.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:v,bindings:E}=po(e,yr(s)),R=s.__stx_event_bindings||[];return s.__stx_event_bindings=[...R,...E],v}let o=wr(e,yr(s));if(o.length===0)return e;let a=e;for(let v=o.length-1;v>=0;v--){let E=o[v],R=E.originalTag;if(!R.includes(" id="))R=R.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${E.elementId}"`);else{let C=R.match(/id=["']([^"']+)["']/);if(C)for(let O of E.events)O.elementId=C[1]}for(let C of E.events){let O=C.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),M=new RegExp(`\\s*${O}\\s*=\\s*"[^"]*"`,"g"),N=new RegExp(`\\s*${O}\\s*=\\s*'[^']*'`,"g");R=R.replace(M,""),R=R.replace(N,"")}a=a.slice(0,E.startIndex)+R+a.slice(E.endIndex)}let h=_o(o.flatMap((v)=>v.events)),c=a.lastIndexOf("</body>");if(c!==-1)a=a.slice(0,c)+h+`
|
|
115
|
-
`+a.slice(c);else a+=h;return a}function Sr(e,s){let t=new Set;for(let o of e.split(",")){let a=o.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(s){let h=a.lastIndexOf(":");if(h!==-1)a=a.slice(h+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))t.add(a)}return t}function Ht(e,s){let t=i(e),{depths:o,balanced:a}=et(t),h=(v)=>!a||o[v]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${s}\\b)`,"g");for(let v of t.matchAll(c)){let E=(v.index??0)+v[0].length-v[1].length;if(h(E))return!0}for(let v of t.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(h(v.index??0)&&Sr(v[1],!0).has(s))return!0;for(let v of t.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(h(v.index??0)&&Sr(v[1],!1).has(s))return!0;return!1}var $r="",Rn,ut=/^[A-Za-z_$][\w$]*$/,go=new Set(["if","for","while","switch","with"]),vr=["(","[","{"],Er=[")","]","}"],mo=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function ho(e){let s=i(e),t=[];for(let o of s.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=o.index??0;t.push({text:o[0],start:a,end:a+o[0].length})}return{code:s,tokens:t}}function fs(e){if(Rn&&e===$r)return Rn;let{code:s,tokens:t}=ho(e),o=new Map,a=[];for(let I=0;I<t.length;I++){let P=t[I].text;if(["(","[","{"].includes(P))a.push(I);else if([")","]","}"].includes(P)){let Z=a.at(-1);if(Z!==void 0&&["()","[]","{}"].includes(t[Z].text+P))a.pop(),o.set(Z,I),o.set(I,Z)}}function h(I,P){let Z=[],U=I;for(let V=I;V<P;V++){if(["(","[","{"].includes(t[V].text)&&(o.get(V)??P)<P){V=o.get(V);continue}if(t[V].text===",")Z.push([U,V]),U=V+1}return Z.push([U,P]),Z}let c=[];function v(I,P,Z,U=!1){if(t[I]?.text==="...")I++;if(I>=P)return;let V=t[I].text;if(ut.test(V)){if(Z.add(V),Z===C)c.push({name:V,token:I,functionScoped:U});return}if(V!=="{"&&V!=="[")return;let X=o.get(I);if(X===void 0||X>=P)return;for(let[Y,Q]of h(I+1,X)){let re=Y;if(V==="{")for(let pe=Y;pe<Q;pe++){if(t[pe].text===":"){re=pe+1;break}if(t[pe].text==="=")break;if(["(","[","{"].includes(t[pe].text)&&o.has(pe))pe=o.get(pe)}v(re,Q,Z,U)}}function E(I,P){let Z=new Set;for(let[U,V]of h(I,P))v(U,V,Z);return Z}function R(I){let P=I;for(;P<t.length;P++){let Z=t[P].text;if(["(","[","{"].includes(Z)&&o.has(P)){P=o.get(P);continue}if([",",";",")","]","}"].includes(Z))break}return t[Math.max(I,P-1)]?.end??s.length}let C=new Set,O=[];for(let I=0;I<t.length;I++)if(t[I].text==="=>"){let P=I-1,Z=P,U;if(t[P]?.text===")"&&o.has(P))Z=o.get(P),U=E(Z+1,P);else if(t[P]&&ut.test(t[P].text))U=new Set([t[P].text]);else continue;let V=I+1,X=t[V]?.text==="{"&&o.has(V)?t[o.get(V)].end:R(V);O.push({start:t[Z].start,end:X,bodyStart:t[V]?.start??X,functionBody:!0,names:U})}else if(t[I].text==="("&&o.has(I)){let P=t[I-1]?.text;if(!P||go.has(P)||!ut.test(P)&&P!=="*"&&P!=="]")continue;let Z=o.get(I),U=Z+1;if(t[U]?.text===":"){U++;while(U<t.length&&!["{","=>",";","="].includes(t[U].text))U++}if(t[U]?.text!=="{"||!o.has(U))continue;O.push({start:t[I].start,end:t[o.get(U)].end,bodyStart:t[U].start,functionBody:P!=="catch",names:E(I+1,Z)})}function M(I){let P=I;for(;P<t.length;P++){let Z=t[P].text;if(vr.includes(Z)&&o.has(P)){P=o.get(P);continue}if(Z===";"||Er.includes(Z))break;let U=t[P-1];if(P>I&&mo.has(Z)&&U.text!==".")break;if(P>I&&/[\n\r]/.test(s.slice(U.end,t[P].start))&&(/^[\w$]+$/.test(U.text)||Er.includes(U.text)||['"',"'","`"].includes(U.text))&&ut.test(Z)&&!["in","of","instanceof"].includes(Z))break}return P}let N=[];for(let I=0;I<t.length;I++){if(t[I].text!=="for")continue;let P=t[I+1]?.text==="await"?I+2:I+1;if(t[P]?.text!=="("||!o.has(P))continue;let Z=o.get(P),U=Z+1,V=t[U]?.text==="{"&&o.has(U)?o.get(U):M(U),X=t[V]?.text===";"||t[V]?.text==="}"?t[V].end:t[Math.max(U,V-1)]?.end??s.length;N.push({headStart:P,headEnd:Z,start:t[P].start,end:X})}for(let I=0;I<t.length;I++){let P=t[I].text,Z=t[I-1]?.text;if(Z==="."||t[I+1]?.text===":")continue;if(Z==="as"||Z==="<")continue;if(P==="const"||P==="let"||P==="var"){let U=M(I+1),V=I+1,X=!1,Y=!1,Q=0;for(let re=I+1;re<=U;re++){let pe=t[re]?.text;if(re<U&&vr.includes(pe)&&o.has(re)&&o.get(re)<U){re=o.get(re);continue}if(re<U&&pe===":"&&!Y)X=!0;else if(re<U&&pe==="="&&Q===0)X=!1,Y=!0;else if(re<U&&X&&pe==="<")Q++;else if(re<U&&X&&pe===">"&&Q>0)Q--;else if(re===U||pe===","&&Q===0)v(V,re,C,P==="var"),V=re+1,X=!1,Y=!1}}else if(P==="function"||P==="class"){let U=I+1;if(t[U]?.text==="*")U++;if(t[U]&&ut.test(t[U].text)&&t[U].text!=="extends")C.add(t[U].text),c.push({name:t[U].text,token:U})}else if(P==="import"){let U=I+1;if(t[U]?.text==="*"&&t[U+1]?.text==="as")U+=2;let V=t[U]?.text;if(V&&ut.test(V)&&V!=="type"&&t[U+1]?.text!=="("&&t[U+1]?.text!==".")C.add(V),c.push({name:V,token:U,file:!0});let X=t[U]?.text==="{"?U:t[U+1]?.text===","&&t[U+2]?.text==="{"?U+2:-1;if(X!==-1&&o.has(X)){let Y=o.get(X);for(let[Q,re]of h(X+1,Y)){let pe=re-1;while(pe>=Q&&!ut.test(t[pe].text))pe--;if(pe>=Q&&t[pe].text!=="type")c.push({name:t[pe].text,token:pe,file:!0})}}}}return $r=e,Rn={code:s,scopes:O,loops:N,declarations:C,sites:c,tokens:t,pairs:o},Rn}function xs(e){let s=fs(e);return{code:s.code,shadows:(t,o)=>s.scopes.some((a)=>o>=a.start&&o<a.end&&a.names.has(t))}}function Cn(e){return new Set(fs(e).declarations)}function rn(e,s){let{scopes:t,loops:o,sites:a,tokens:h,pairs:c}=fs(e),v=Array.from({length:h.length},()=>-1),E=[];for(let N=0;N<h.length;N++){v[N]=E.length?E[E.length-1]:-1;let I=h[N].text;if(I==="{"&&c.has(N))E.push(N);else if(I==="}"&&E.length&&c.get(N)===E[E.length-1])E.pop()}let R=new Set,C=new Map;for(let N of a){if(!s.has(N.name))continue;R.add(N.token);let I=N.file?-1:v[N.token],P=I===-1?[0,Number.POSITIVE_INFINITY]:[h[I].start,h[c.get(I)].end];if(N.functionScoped){let U=h[N.token].start,V=t.filter((X)=>X.functionBody&&U>=X.bodyStart&&U<X.end).sort((X,Y)=>X.end-X.bodyStart-(Y.end-Y.bodyStart))[0];P=V?[V.bodyStart,V.end]:[0,Number.POSITIVE_INFINITY]}else if(!N.file){let U=o.filter((V)=>N.token>V.headStart&&N.token<V.headEnd).sort((V,X)=>V.headEnd-V.headStart-(X.headEnd-X.headStart))[0];if(U)P=[U.start,U.end]}let Z=C.get(N.name);if(Z)Z.push(P);else C.set(N.name,[P])}let O=new Set;for(let N=0;N<h.length;N++){if(h[N].text!=="import"||h[N-1]?.text===".")continue;let I=N+1;if(h[I]?.text==="type")I++;if(h[I]&&ut.test(h[I].text)&&h[I+1]?.text===",")I+=2;if(h[I]?.text==="{"&&c.has(I))for(let P=I+1;P<c.get(I);P++)O.add(P)}let M=new Set;for(let N=0;N<h.length;N++){let I=h[N].text;if(!s.has(I)||M.has(I)||R.has(N)||O.has(N))continue;let P=h[N-1]?.text;if(P==="#"||P==="."&&h[N-2]?.text!=="..")continue;if(h[N+1]?.text===":"&&(P==="{"||P===","))continue;let Z=h[N].start;if(C.get(I)?.some(([U,V])=>Z>=U&&Z<V))continue;if(t.some((U)=>Z>=U.start&&Z<U.end&&U.names.has(I)))continue;M.add(I)}return M}var Re="0.2.673";var kr=Symbol.for(`stx.lazy-module-promises.${Re}`);function bo(){let e=globalThis;return e[kr]??=new Map,e[kr]}function r(e,s){let t=bo(),o=`${import.meta.url}\x00${e}`,a=t.get(o);if(a)return a;let h=s();return t.set(o,h),h.catch(()=>{if(t.get(o)===h)t.delete(o)}),h}var yo=/<\/(script)/gi;function sn(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(yo,"<\\/$1")}import Tr from"fs";class B{cache=new Map;maxSize;options;sizes;bytes=0;constructor(e=100,s){this.maxSize=e,this.options=s??null,this.sizes=s?new Map:null}get byteSize(){return this.bytes}setMaxBytes(e){if(!this.options)return;this.options={...this.options,maxBytes:e};while(this.bytes>e&&this.cache.size>0){let s=this.cache.keys().next().value;if(s===void 0)break;this.delete(s)}}get(e){if(!this.cache.has(e))return;let s=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,s),s}set(e,s){if(this.cache.has(e))this.delete(e);let t=this.options?this.options.sizeOf(s):0;if(this.options&&t>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+t>this.options.maxBytes)){let o=this.cache.keys().next().value;if(o===void 0)break;this.delete(o)}if(this.cache.set(e,s),this.sizes)this.sizes.set(e,t),this.bytes+=t}has(e){return this.cache.has(e)}delete(e){if(this.sizes){let s=this.sizes.get(e);if(s!==void 0)this.bytes-=s,this.sizes.delete(e)}return this.cache.delete(e)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var St=new Map,wo=500;function Et(e,s){if(s?.includes("g"))return new RegExp(e,s);let t=`${e}:${s||""}`;if(!St.has(t)){if(St.size>=wo){let o=St.keys().next().value;if(o)St.delete(o)}St.set(t,new RegExp(e,s))}return St.get(t)}class Rr{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(e){let s=Array.from(new Set(e)),t=s.sort().join(","),o=this.pool.find((v)=>v.context.join(",")===t);if(o)return o.func;let a=this.fnCache,h=this.fnCacheMaxSize,c=(...v)=>(E)=>{try{let R=`${t}:${E}`,C=a.get(R);if(!C){if(a.size>=h){let O=a.keys().next().value;if(O)a.delete(O)}C=Function(...s,`
|
|
116
|
-
'use strict';
|
|
117
|
-
try {
|
|
118
|
-
return ${E};
|
|
119
|
-
}
|
|
120
|
-
catch (e) {
|
|
121
|
-
if (e instanceof ReferenceError || e instanceof TypeError) {
|
|
122
|
-
return undefined;
|
|
123
|
-
}
|
|
124
|
-
throw e;
|
|
125
|
-
}
|
|
126
|
-
`),a.set(R,C)}return C(...v)}catch{return}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:c,context:s.slice()});return c}clear(){this.pool.length=0,this.fnCache.clear()}}var xu=new Rr;class Cr{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(e){this.enabled=e}isEnabled(){return this.enabled}setBudget(e,s){this.budgets.set(e,{warnThreshold:0.8,action:"warn",...s})}setBudgets(e){for(let[s,t]of Object.entries(e))this.setBudget(s,t)}removeBudget(e){this.budgets.delete(e)}getBudgets(){let e={};for(let[s,t]of this.budgets.entries())e[s]=t;return e}onViolation(e){this.violationHandlers.push(e)}offViolation(e){let s=this.violationHandlers.indexOf(e);if(s!==-1)this.violationHandlers.splice(s,1)}time(e,s){if(!this.enabled)return s();let t=performance.now(),o=s(),a=performance.now()-t;return this.recordTime(e,a),this.checkBudget(e,a),o}async timeAsync(e,s){if(!this.enabled)return s();let t=performance.now(),o=await s(),a=performance.now()-t;return this.recordTime(e,a),this.checkBudget(e,a),o}checkBudget(e,s){let t=this.budgets.get(e);if(!t)return;let o=s/t.maxTime*100,a=t.warnThreshold!==void 0?s>=t.maxTime*t.warnThreshold&&s<t.maxTime:!1,h=s>=t.maxTime;if(!a&&!h)return;let c={label:e,actualTime:s,budgetTime:t.maxTime,exceedancePercent:o,timestamp:new Date,isWarning:a};this.violations.push(c);while(this.violations.length>this.maxViolations)this.violations.shift();for(let E of this.violationHandlers)try{E(c)}catch{}let v=a?`[Performance Warning] "${e}" took ${s.toFixed(2)}ms (${o.toFixed(1)}% of ${t.maxTime}ms budget)`:`[Performance Budget Exceeded] "${e}" took ${s.toFixed(2)}ms (exceeded ${t.maxTime}ms budget by ${(o-100).toFixed(1)}%)`;switch(t.action){case"log":console.log(v);break;case"warn":console.warn(v);break;case"error":console.error(v);break;case"throw":if(h)throw Error(v);else console.warn(v);break}}recordTime(e,s){let t=this.metrics.get(e);if(t)t.count++,t.totalTime+=s,t.maxTime=Math.max(t.maxTime,s),t.minTime=Math.min(t.minTime,s);else this.metrics.set(e,{count:1,totalTime:s,maxTime:s,minTime:s})}getStats(e){if(e){let t=this.metrics.get(e);if(!t)return{};let o=this.budgets.get(e);return{count:t.count,avgTime:t.totalTime/t.count,totalTime:t.totalTime,maxTime:t.maxTime,minTime:t.minTime,budget:o?.maxTime,budgetUtilization:o?t.totalTime/t.count/o.maxTime*100:void 0}}let s={};for(let[t,o]of this.metrics.entries()){let a=this.budgets.get(t);s[t]={count:o.count,avgTime:o.totalTime/o.count,totalTime:o.totalTime,maxTime:o.maxTime,minTime:o.minTime,budget:a?.maxTime,budgetUtilization:a?o.totalTime/o.count/a.maxTime*100:void 0}}return s}getViolations(e){if(e)return this.violations.filter((s)=>s.label===e);return[...this.violations]}getViolationStats(){let e={},s=0,t=0;for(let o of this.violations)if(e[o.label]=(e[o.label]||0)+1,o.isWarning)s++;else t++;return{total:this.violations.length,byLabel:e,warnings:s,errors:t}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var _s=null;function vo(){if(!_s)_s=new Cr;return _s}var te=new Proxy({},{get(e,s){return vo()[s]}});var Ar=[];function y(e){let s=new B(e);return Ar.push(s),s}function Ta(){for(let e of Ar)e.clear()}function b(e,...s){return`${s.map((t)=>String(t??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function rr(e){let s=[];for(let t of new Set(e))try{s.push({path:t,mtimeMs:Tr.statSync(t).mtimeMs})}catch{}return s}function as(e){for(let s of e)try{if(Tr.statSync(s.path).mtimeMs!==s.mtimeMs)return!1}catch{return!1}return!0}var ye=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl"];var jo=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function zo(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let t=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!t)return null;return{pkg:t[1],subpath:t[2]||""}}let s=e.match(/^([^/]+)(\/.*)?$/);if(!s)return null;return{pkg:s[1],subpath:s[2]||""}}function Wo(e,s){let t=s;while(!0){let o=mt.join(t,"node_modules",e,"package.json");if(Kt.existsSync(o))return mt.dirname(o);let a=mt.dirname(t);if(a===t)return null;t=a}}function Fo(e,s){if(!e||typeof e!=="object")return null;let t=(a)=>{if(typeof a==="string")return a;if(a&&typeof a==="object"){if(typeof a.import==="string")return a.import;if(typeof a.default==="string")return a.default;if(typeof a.import==="object")return t(a.import);if(typeof a.default==="object")return t(a.default)}return null};if(Object.prototype.hasOwnProperty.call(e,s))return t(e[s]);let o=null;for(let a of Object.keys(e)){let h=a.indexOf("*");if(h===-1)continue;let c=a.slice(0,h),v=a.slice(h+1);if(!s.startsWith(c)||!s.endsWith(v))continue;if(s.length<c.length+v.length)continue;if(!o||c.length>o.prefix.length)o={pattern:a,prefix:c,suffix:v}}if(o){let a=s.slice(o.prefix.length,s.length-o.suffix.length),h=t(e[o.pattern]);if(h)return h.replace("*",a)}return null}function Vo(e,s){let t=zo(e);if(!t||!t.subpath)return null;let o=Wo(t.pkg,s);if(!o)return null;let a;try{a=JSON.parse(Kt.readFileSync(mt.join(o,"package.json"),"utf8"))}catch{return null}let h=`.${t.subpath}`,c=Fo(a.exports,h);if(!c)return null;let v=mt.resolve(o,c);return Kt.existsSync(v)?v:null}function Io(e,s){let t=s.filePath?mt.dirname(s.filePath):s.projectRoot||process.cwd(),o=s.projectRoot||process.cwd(),a=new Set,h=[],c=[];return{code:e.replace(jo,(E,R)=>{let C;try{if(R.startsWith("./")||R.startsWith("../")||R.startsWith("/")){if(C=R.startsWith("/")?R:mt.resolve(t,R),!Kt.existsSync(C))throw Error(`file not found: ${C}`)}else{let O=null;try{O=Bun.resolveSync(R,o)}catch{O=Vo(R,o)}if(!O)throw Error(`could not resolve ${R} (Bun.resolveSync + exports fallback both failed)`);C=O}}catch(O){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(R)} (from ${s.filePath||"<unknown>"}): ${O?.message||O}`),c.push(R),""}if(a.has(C))return"";a.add(C);try{let O=Kt.readFileSync(C,"utf8");h.push({source:R,resolvedPath:C,contents:O})}catch(O){console.warn(`[stx:vendor-css] could not read ${C}: ${O?.message||O}`),c.push(R)}return""}),styles:h,unresolved:c}}function Uo(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Oo(e){if(e.length===0)return"";return`${e.map((s)=>`<style data-stx-vendor="${Uo(s.source)}" data-stx-layer="vendor">
|
|
127
|
-
@layer vendor {
|
|
128
|
-
${s.contents}
|
|
129
|
-
}
|
|
130
|
-
</style>`).join(`
|
|
131
|
-
`)}
|
|
132
|
-
`}var Kl=x,Ir=y(256);function Pt(e){let s=b(e),t=Ir.get(s);if(!t)t=Ho(e),Ir.set(s,t);return{code:t.code,imports:[...t.imports],models:[...t.models]}}function Ho(e){let s=i(e),t=new Set;for(let v of e.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let E of v[1].split(",")){let R=E.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(R)t.add(R)}let o=Cn(s),a=ye.filter((v)=>{if(t.has(v)||o.has(v))return!1;return No(s,v,!0)}),h=Dr(s).filter((v)=>!t.has(v)&&!o.has(v));if(a.length===0&&h.length===0)return{code:e,imports:a,models:h};return{code:`${[a.length>0?`import { ${a.join(", ")} } from '@stacksjs/browser'`:"",h.length>0?"import '@stacksjs/browser'":"",h.length>0?`const { ${h.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
|
|
133
|
-
`)}
|
|
134
|
-
${e}`,imports:a,models:h}}var Ko=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process","Modal","Intl"]);function Dr(e){let s=new Set,t=xs(e),o=Cn(e),a=/(?<![\w$.])([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g;for(let h of t.code.matchAll(a)){let c=h[1];if(Ko.has(c)||o.has(c)||c.length<3)continue;if(t.shadows(c,h.index??0))continue;s.add(c)}return Array.from(s)}function Zo(e){return Cn(e)}var Or=y(128);function Wa(e){let s=b(e),t=Or.get(s);if(!t)t=qo(e),Or.set(s,t);return{code:t.code,stxImports:[...t.stxImports],browserImports:[...t.browserImports]}}function qo(e){let s=new Set,t=new Set,o=e;o=o.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let a=new Set,h=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,c;while((c=h.exec(e))!==null){let O=c[1],M=c[2];if(c[0].includes("import type"))continue;let N=[];for(let P of O.split(",")){let Z=P.trim();if(!Z||Z.startsWith("type "))continue;let U=Z.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!U)continue;let V=U[1],X=U[2]||V;if(a.add(V),a.add(X),M==="stx"||M==="@stacksjs/stx")s.add(V);else t.add(V);if(X!==V)N.push(`${X} = ${V}`)}let I=N.length>0?`var ${N.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";o=o.replace(c[0],I)}let v=Zo(o);for(let O of Kl){if(a.has(O)||v.has(O))continue;if(No(o,O,!0))s.add(O)}let E=i(o),R=new Set;for(let O of o.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let M of O[1].split(",")){let N=M.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let I of N){let P=I.trim();if(P)R.add(P)}}for(let O of ye){if(a.has(O)||v.has(O)||R.has(O))continue;if(No(E,O))t.add(O)}let C=Dr(E);for(let O of C)if(!a.has(O)&&!v.has(O))t.add(O);return{code:o,stxImports:Array.from(s),browserImports:Array.from(t)}}function No(e,s,t=!1){let o=xs(e);e=o.code;let a=new RegExp(`\\b${s.replace(/[$]/g,"\\$")}\\b`,"g");for(let h of e.matchAll(a)){let c=h.index??0;if(o.shadows(s,c))continue;let v=c+s.length,E=c-1;while(E>=0&&/\s/.test(e[E]))E--;if(e[E]==="."&&e.slice(Math.max(0,E-2),E+1)!=="...")continue;let R=v;while(R<e.length&&/\s/.test(e[R]))R++;if(e[R]===":"&&e[R+1]!==":"&&(e[E]==="{"||e[E]===","))continue;if(t&&!/^\s*(?:<[^>]*>)?\s*\(/.test(e.slice(v)))continue;if(Xo(e,v))continue;return!0}return!1}function Xo(e,s){let t=s;while(t<e.length&&(e[t]===" "||e[t]==="\t"))t++;if(e[t]!=="(")return!1;let o=0;for(;t<e.length;t++){let a=e[t];if(a==="(")o++;else if(a===")"){if(o--,o===0)break}}if(o!==0)return!1;t++;while(t<e.length&&(e[t]===" "||e[t]==="\t"))t++;return e[t]==="{"}function qa(e,s){let t=[];if(e.length>0)t.push(` var { ${e.join(", ")} } = window.stx || window;`);if(s.length>0)t.push(` var { ${s.join(", ")} } = window.StacksBrowser || {};`);if(t.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
|
|
135
|
-
${t.join(`
|
|
136
|
-
`)}
|
|
137
|
-
${Jo(e,s)}`;return""}function $p(e,s=[]){let{browserImports:t}=Wa(e),o=new Set(s);return qa([],t.filter((a)=>!o.has(a)))}function Jo(e,s){let t=[...e.map((o)=>`['${o}', typeof ${o}, 'stx']`),...s.map((o)=>`['${o}', typeof ${o}, '@stacksjs/browser']`)];if(t.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
|
|
138
|
-
[${t.join(", ")}].forEach(function (e) {
|
|
139
|
-
if (e[1] !== 'undefined') return;
|
|
140
|
-
console.error(
|
|
141
|
-
'[stx] "' + e[0] + '" is used in this client script and auto-imported from ' + e[2] + ', '
|
|
142
|
-
+ 'but the client runtime does not provide it. Either it is not exported to the browser, '
|
|
143
|
-
+ 'or it should be imported from a relative path so the bundler includes it.'
|
|
144
|
-
);
|
|
145
|
-
});
|
|
146
|
-
`}function Oe(e){let s=e.__stxClientPayload;if(s&&typeof s==="object"){let o={};for(let a in s){let h=s[a];if(typeof h==="function")continue;o[a]=h}return o.__stxDeclaredPayload=!0,o}let t={};for(let o in e){if(o.startsWith("__")||o.startsWith("$"))continue;let a=e[o];if(typeof a==="function")continue;t[o]=a}return t}var Yo=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,Pr=new Set;function Qo(e,s){let t=Yo.test(e),o=s.length>32768;if(!t&&!o)return;if(Pr.has(e))return;if(Pr.add(e),t)console.warn(`[stx] server\u2192client bridge is publishing "${e}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(o)console.warn(`[stx] server\u2192client bridge is publishing ${(s.length/1024).toFixed(1)}KB under "${e}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function dn(e,s){if(!s)return"";let t=rn(e,new Set(Object.keys(s))),o=s.__stxDeclaredPayload===!0,a=[],h=Object.entries(s).sort(([c],[v])=>c<v?-1:c>v?1:0);for(let[c,v]of h){if(!/^[A-Za-z_$][\w$]*$/.test(c))continue;if(c.startsWith("__")||c.startsWith("$"))continue;if(!o&&!t.has(c))continue;if(Ht(e,c)){if(o)console.warn(`[stx] defineClientPayload declares "${c}", but this client block also declares "${c}" at the top level, so the server value is not published (emitting it would be a duplicate binding). Rename the local, or drop "${c}" from defineClientPayload.`);continue}let E;try{E=JSON.stringify(v)}catch{continue}if(E===void 0)continue;Qo(c,E),a.push(` var ${c} = ${E.replace(/</g,"\\u003c")};`)}if(a.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
|
|
147
|
-
${a.join(`
|
|
148
|
-
`)}
|
|
149
|
-
`}var ea={left:0,middle:1,right:2};function ta(e){let s=[];if(e.self)s.push("if ($event.target !== $el) return");for(let t of e.systemKeys)s.push(`if (!$event.${t}Key) return`);if(e.keys.length>0){let t=e.keys.map((o)=>`$event.key === '${o}'`).join(" || ");s.push(`if (!(${t})) return`)}if(e.mouse!==null){let t=ea[e.mouse];s.push(`if ($event.button !== ${t}) return`)}if(e.prevent)s.push("$event.preventDefault()");if(e.stop)s.push("$event.stopPropagation()");return s.join("; ")}function na(e,s){let{elementId:t,event:o,modifiers:a}=e,h=ts(e.handler),c=ta(a),v=[];if(a.once)v.push("once: true");if(a.capture)v.push("capture: true");if(es(o,a))v.push("passive: true");let E=v.length>0?`, { ${v.join(", ")} }`:"",R="";if(c)R+=`${c}; `;let C=h.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),O=`var $emit = function(name, detail) {
|
|
150
|
-
$el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
|
|
151
|
-
};`;function M(N){if(/\$emit\s*\(/.test(N))return`${O}
|
|
152
|
-
${N}`;return`var scope = $el.closest('[data-stx-scope]');
|
|
153
|
-
if (scope && scope.__stx_execute) {
|
|
154
|
-
scope.__stx_execute('${C}', $event, $el);
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
${N}
|
|
158
|
-
}`}if(a.debounce!==null)return` ;(function() {
|
|
159
|
-
// eslint-disable-next-line pickier/no-unused-vars
|
|
160
|
-
var $el = document.getElementById('${t}')
|
|
161
|
-
if (!$el) return
|
|
162
|
-
var __timer
|
|
163
|
-
$el.addEventListener('${o}', function($event) {
|
|
164
|
-
${c?c+"; ":""}clearTimeout(__timer)
|
|
165
|
-
__timer = setTimeout(function() { ${M(h)} }, ${a.debounce})
|
|
166
|
-
}${E})
|
|
167
|
-
})()`;if(a.throttle!==null)return` ;(function() {
|
|
168
|
-
// eslint-disable-next-line pickier/no-unused-vars
|
|
169
|
-
var $el = document.getElementById('${t}')
|
|
170
|
-
if (!$el) return
|
|
171
|
-
var __last = 0
|
|
172
|
-
$el.addEventListener('${o}', function($event) {
|
|
173
|
-
${c?c+"; ":""}var __now = Date.now()
|
|
174
|
-
if (__now - __last >= ${a.throttle}) {
|
|
175
|
-
__last = __now
|
|
176
|
-
${M(h)}
|
|
177
|
-
}
|
|
178
|
-
}${E})
|
|
179
|
-
})()`;if(/\$emit\s*\(/.test(h))return` var $el = document.getElementById('${t}')
|
|
180
|
-
if ($el) $el.addEventListener('${o}', function($event) {
|
|
181
|
-
${R}${O}
|
|
182
|
-
${h}
|
|
183
|
-
}${E})`;return` var $el = document.getElementById('${t}')
|
|
184
|
-
if ($el) $el.addEventListener('${o}', function($event) {
|
|
185
|
-
${R}var scope = $el.closest('[data-stx-scope]');
|
|
186
|
-
if (scope && scope.__stx_execute) {
|
|
187
|
-
scope.__stx_execute('${C}', $event, $el);
|
|
188
|
-
}
|
|
189
|
-
else {
|
|
190
|
-
${h}
|
|
191
|
-
}
|
|
192
|
-
}${E})`}function sa(e){if(e.length===0)return"";return`
|
|
193
|
-
// STX: auto-generated event bindings
|
|
194
|
-
${e.map((t,o)=>na(t,o)).join(`
|
|
195
|
-
`)}`}function Mr(e){let s=[],t=new Set,o=e.replace(/^\s*import\s+.*$/gm,""),a=0,h=o.length,c=0;while(c<h){let v=o[c];if(v==="'"||v==='"'||v==="`"){let E=v;if(c++,E==="`"){let R=0;while(c<h){if(o[c]==="\\"){c+=2;continue}if(o[c]==="`"&&R===0){c++;break}if(o[c]==="$"&&o[c+1]==="{"){R++,c+=2;continue}if(o[c]==="}"&&R>0){R--,c++;continue}c++}}else while(c<h){if(o[c]==="\\"){c+=2;continue}if(o[c]===E){c++;break}c++}continue}if(v==="/"&&o[c+1]==="/"){while(c<h&&o[c]!==`
|
|
196
|
-
`)c++;continue}if(v==="/"&&o[c+1]==="*"){c+=2;while(c<h-1&&!(o[c]==="*"&&o[c+1]==="/"))c++;c+=2;continue}if(v==="{"){a++,c++;continue}if(v==="}"){a--,c++;continue}if(a===0){let E=o.slice(c),R=E.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(R){let M=R[1];if(!M.startsWith("_")&&!t.has(M))s.push(M),t.add(M);c+=R[0].length;continue}let C=E.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(C){C[1].split(",").forEach((M)=>{let N=M.trim(),I=N.indexOf(":"),P=I>=0?N.slice(I+1).trim().split(/[\s=]/)[0]:N.split(/[\s=]/)[0];if(P&&!P.startsWith("_")&&!t.has(P))s.push(P),t.add(P)}),c+=C[0].length;continue}let O=E.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(O){let M=O[1];if(!M.startsWith("_")&&!t.has(M))s.push(M),t.add(M);c+=O[0].length;continue}}c++}return s}var ra=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function ia(e){let s=new Set,t=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function o(M){let N;while((N=t.exec(M))!==null){let I=N[0];if(!ra.has(I))s.add(I)}}let a=/\{\{([\s\S]*?)\}\}/g,h;while((h=a.exec(e))!==null)o(h[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((h=c.exec(e))!==null)o(h[1]);let v=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((h=v.exec(e))!==null)o(h[1]);let E=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((h=E.exec(e))!==null)o(h[1]);let R=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((h=R.exec(e))!==null)o(h[1]);let C=/@model\s*=\s*["']([^"']*)["']/gi;while((h=C.exec(e))!==null)o(h[1]);let O=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((h=O.exec(e))!==null)o(h[1]);return s}async function Ne(e,s={}){let t=e,o="",a=!1,h=[],c=Io(t,{filePath:s.filePath,projectRoot:s.projectRoot});t=c.code;let v=Oo(c.styles),E=Pt(t);t=E.code,h=[...E.imports,...E.models];let{hasUserImports:R,bundleClientScript:C}=await r("stx/client-script-bundler",()=>import("./chunk-e6p0k6br.js"));if(R(t))t=await C(t,s.filePath||"",{projectRoot:s.projectRoot,minify:s.production}),a=!0;if(s.autoImports!==!1){let X=Wa(t);t=X.code,o=qa(X.stxImports,X.browserImports.filter((Y)=>!h.includes(Y)))}if(o=`${dn(t,s.serverData)}${o}`,t=T(t),!a&&De(s.attrs||""))t=Me(t);let O=sa(s.eventBindings||[]),M=(s.attrs||"").trim(),N=/\btype\s*=\s*["']module["']/i.test(M),I=s.instanceId?` data-stx-instance="${s.instanceId}"`:"";if(N){let X=M.replace(/\btype\s*=\s*["']module["']/i,"").trim(),Y=`type="module" data-stx-scoped${I}${X?` ${X}`:""}`;return`${v}<script ${Y}>
|
|
197
|
-
${sn(`${o}${t}
|
|
198
|
-
${O}`)}
|
|
199
|
-
</script>`}let P=Go(e),Z=/function __stx_setup_/.test(t),U=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function V(X){let Y=X.length>0?`
|
|
200
|
-
return ${rs(t,X)};`:"",Q=JSON.stringify(`[stx] client block failed${s.filePath?` (${s.filePath})`:""}; this block will not hydrate`);return`${v}<script data-stx-scoped data-stx-run="always"${I}>
|
|
201
|
-
window.stx.mount(function() {
|
|
202
|
-
'use strict';
|
|
203
|
-
try {
|
|
204
|
-
${sn(`${o}${t}
|
|
205
|
-
${O}${Y}`)}
|
|
206
|
-
} catch (error) {
|
|
207
|
-
console.error(${Q}, error);
|
|
208
|
-
return {};
|
|
209
|
-
}
|
|
210
|
-
})</script>`}if(!U&&!Z){if(P)return V(Mr(e));if(s.templateContent){let X=Mr(e);if(X.length>0){let Y=ia(s.templateContent);if(X.some((re)=>Y.has(re)))return V(X)}}}return`${v}<script data-stx-scoped data-stx-run="always"${I}>
|
|
211
|
-
;(function() {
|
|
212
|
-
'use strict';
|
|
213
|
-
try {
|
|
214
|
-
${sn(`${o}${t}
|
|
215
|
-
${O}`)}
|
|
216
|
-
} catch (error) {
|
|
217
|
-
console.error(${JSON.stringify(`[stx] client block failed${s.filePath?` (${s.filePath})`:""}; this block will not hydrate`)}, error);
|
|
218
|
-
}
|
|
219
|
-
})()</script>`}import{createHash as oa}from"crypto";var Tn="__stx_component_client_factories";function An(e){let s=e[Tn];return s instanceof Map?s:null}function za(e){e[Tn]=new Map}function ws(e,s){let t=An(e);if(!t)return null;let o=oa("sha256").update(s).digest("hex").slice(0,16),a=t.get(o);if(a)a.instances++;else t.set(o,{body:s,instances:1});return o}function Ha(e,s){let t=An(s);if(!t?.size)return e;let o=new Map;for(let[C,O]of t)if(O.instances===1)o.set(C,O.body);let a=[];if(o.size>0){let C=[...o.keys()].map((N)=>JSON.stringify(N).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),O=new RegExp(`window\\.__stxComponentFactories\\[(${C})\\]\\(("[^"]+")\\);`,"g"),M=O.exec(e);while(M!==null){let N=o.get(JSON.parse(M[1]));if(N!==void 0)a.push({start:M.index,end:M.index+M[0].length,replacement:`(${N})(${M[2]});`});M=O.exec(e)}}let h=[...t].filter(([,C])=>C.instances>1);if(h.length===0)return jr(e,a);let v=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
|
|
220
|
-
(function() {
|
|
221
|
-
const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
|
|
222
|
-
${h.map(([C,O])=>` try { factories[${JSON.stringify(C)}] = factories[${JSON.stringify(C)}] || ${O.body}; }
|
|
223
|
-
catch (e) { console.error('[stx] component factory ' + ${JSON.stringify(C)} + ' failed to register; instances of it will not hydrate.', e); }`).join(`
|
|
224
|
-
`)}
|
|
225
|
-
})();
|
|
226
|
-
</script>`,E=e.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i),R=E<0?0:E;return a.push({start:R,end:R,replacement:`${v}
|
|
227
|
-
`}),jr(e,a)}function jr(e,s){if(s.length===0)return e;s.sort((h,c)=>h.start-c.start||h.end-c.end);let t=Array(s.length*2+1),o=0,a=0;for(let h of s)t[a++]=e.slice(o,h.start),t[a++]=h.replacement,o=h.end;return t[a]=e.slice(o),t.join("")}function Nr(e){let s=An(e),t=new Map;if(s)for(let[o,a]of s)t.set(o,a.instances);return t}function Lr(e,s){let t=An(e);if(!t)return[];let o=[];for(let[a,h]of t){let c=h.instances-(s.get(a)??0);if(c>0)o.push({body:h.body,count:c})}return o}function Br(e,s){for(let{body:t,count:o}of s)for(let a=0;a<o;a++)ws(e,t)}function he(e,s,t=2){let o=0,a=null;for(let h=s+t;h<e.length;h++){let c=e[h];if(a){if(c==="\\"){h++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="{"){o++;continue}if(c==="}"){if(o>0){o--;continue}let v=0;while(e[h+v]==="}")v++;if(v>=t)return h}}return-1}import Jr from"fs";var zr=0,$s=new Map;function Xa(){zr=0,$s.clear()}function In(e,s){let t=zr++,o=`<!--__STX_${e.toUpperCase()}_${t}__-->`;return $s.set(o,{type:e,expression:s}),o}function Ja(){let e={};for(let[s,t]of $s)e[s]={type:t.type,expression:t.expression};return e}function Ya(e,s){let t=e;for(let[o,a]of s)t=t.split(o).join(a);return t}function Mo(e){return e.includes("<!--__STX_")}var aa=/@(?=[a-zA-Z_]\w*\s*\(|end[a-zA-Z]*\b|else(?:if)?\b|empty\b|case\b|default\b|break\b|continue\b|fallback\b)/g;function ca(e){return Array.from({length:e},()=>"{").join("⁠")}function Wr(e){return e.replace(/\{{2,}/g,(s)=>ca(s.length)).replace(/\{(?=!)/g,"{⁠").replace(aa,"@")}function cs(e,s,t=!1){let{openTag:o,tail:a}=t?la(e,s):ua(e).at(s);return pa(a,o,t)}function la(e,s){let t="",o=0;for(let c=0;c<s;c++){if(!e.startsWith("{{",c))continue;let v=he(e,c);if(v<0||v+2>s)break;t+=e.slice(o,c)+"x",c=v+1,o=v+2}t+=e.slice(o,s);let a=-1,h=null;for(let c=0;c<t.length;c++){let v=t[c];if(h){if(v===h)h=null;continue}if(v==='"'||v==="'"){h=v;continue}if(v===">"){a=-1;continue}if(v==="<")a=c}return{openTag:a,tail:a>=0?t.slice(a+1):t}}var On=null;function ua(e){if(On&&On.source===e)return On.scanner;let s=fa(e);return On={source:e,scanner:s},s}function fa(e){let s=0,t=-1,o=null,a=-1,h=(v,E)=>{let R=e[v];if(E.quote){if(R===E.quote)E.quote=null;return}if(E.openTag>=0){if(R==='"'||R==="'"){E.quote=R;return}if(R===">"){E.openTag=-1;return}}if(R==="<")E.openTag=v},c=(v,E)=>{if(E.openTag>=0||!e.startsWith("<!--",v))return-1;let R=e.indexOf("-->",v+4);return R<0?e.length:R+3};return{at(v){if(v<s)s=0,t=-1,o=null,a=-1;let E={openTag:t,quote:o},R=!1;while(s<v){if(a<0&&e.startsWith("{{",s)){let P=he(e,s);if(P<0)a=s;else if(P+2<=v){s=P+2;continue}else break}let I=c(s,E);if(I>=0){if(I>v){R=!0;break}s=I;continue}h(s,E),s++}if(t=E.openTag,o=E.quote,R)return{openTag:-1,tail:""};let C=a>=0?a:s,O={openTag:t,quote:o};for(let I=s;I<v;I++){let P=c(I,O);if(P>=0){if(P>v)return{openTag:-1,tail:""};I=P-1;continue}h(I,O)}if(O.openTag<0)return{openTag:-1,tail:""};let M="",N=O.openTag+1;for(let I=N;I<Math.min(v,C);I++){if(!e.startsWith("{{",I))continue;let P=he(e,I);M+=e.slice(N,I)+"x",I=P+1,N=P+2}return M+=e.slice(N,v),{openTag:O.openTag,tail:M}}}}function pa(e,s,t){if(s<0&&!t)return null;if(s>=0&&/^\s*[!/?]/.test(e))return/^\s*\/?\s*$/.test(e)?{kind:"tag-name"}:null;if(s>=0&&/^\s*$/.test(e))return{kind:"tag-name"};let o=0;if(s>=0)while(o<e.length&&!/\s/.test(e[o]))o++;while(o<e.length){while(/\s/.test(e[o]??"")&&o<e.length)o++;let a=o;while(o<e.length&&!/[\s=/>]/.test(e[o]))o++;let h=e.slice(a,o);if(!h)break;while(o<e.length&&/\s/.test(e[o]))o++;if(e[o]!=="=")continue;o++;while(o<e.length&&/\s/.test(e[o]))o++;let c=e[o];if(c==='"'||c==="'"){let v=++o,E=e.indexOf(c,o);if(E===-1)return{kind:"attribute",name:h,quote:c,valuePrefix:e.slice(v)};o=E+1}else{let v=o;while(o<e.length&&!/\s/.test(e[o]))o++;if(o===e.length)return{kind:"attribute",name:h,quote:null,valuePrefix:e.slice(v)}}}return{kind:"tag"}}class ne extends Error{attribute;near;constructor(e,s){super(`Unsafe interpolation in ${e}: ${s}`);this.name="UnsafeInterpolationContextError",this.attribute=e}locate(e,s){if(this.near===void 0)this.near=e.slice(Math.max(0,s-160),s).replace(/\s+/g," ").trim(),this.message+=` (after: ${JSON.stringify(this.near)})`;return this}}var Fr="unsafe:";var da=/^(?:javascript|vbscript|livescript|mocha|view-source):/,ga=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,ma=/^data:(?:text\/html|application\/xhtml\+xml)/,ha=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function xa(e){return e.replace(ha,"").toLowerCase()}function vs(e){let s=e.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(s))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(s))return"fetched";return null}function Pn(e,s="navigable"){let t=xa(e);if(da.test(t))return!0;return s==="navigable"?ga.test(t):ma.test(t)}function sr(e,s="navigable"){return Pn(e,s)?"unsafe:"+e:e}function ba(e){let s=e.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!s)return null;if(s[3].trim()!=="")return null;return vs(s[1])}function Vr(e,s,t=256){if(s<=t)return e.slice(0,s);let o=e.slice(s-t,s),a=o.search(/[\s"'`/]/);return a===-1?"":o.slice(a)}function Ur(e,s,t=s){let o=ba(e);return o&&Pn(s,o)?"unsafe:"+t:t}var Mn=/<script\b[^>]*>/iy,Ts=/<\/script\s*>/ig,Dn=/<style\b[^>]*>/iy,As=/<\/style\s*>/ig;function Hr(e,s,t,o){t.lastIndex=s;let a=t.exec(e);if(!a||a.index!==s)return-1;o.lastIndex=t.lastIndex;let h=o.exec(e);if(!h)return-1;return h.index+h[0].length}function W(e,s){return Hr(e,s,Mn,Ts)}function on(e,s){return Hr(e,s,Dn,As)}function Pe(e,s){if(!e.startsWith("<!--",s))return-1;let t=e.indexOf("-->",s+4);if(t===-1)return-1;return t+3}function Kr(e,s){if(e.startsWith("<!--",s)){let a=Pe(e,s);return a===-1?e.length:a}if(Mn.lastIndex=s,Mn.exec(e)?.index===s){Ts.lastIndex=Mn.lastIndex;let a=Ts.exec(e);return a?a.index+a[0].length:e.length}if(Dn.lastIndex=s,Dn.exec(e)?.index===s){As.lastIndex=Dn.lastIndex;let a=As.exec(e);return a?a.index+a[0].length:e.length}return-1}function ce(e,s){let t=[],o=0,a=e.length,h=!1,c=null;while(o<a){let v=e[o];if(h){if(c){if(v===c)c=null}else if(v==='"'||v==="'")c=v;else if(v===">")h=!1;o++;continue}if(v!=="<"){let O=e.indexOf("<",o+1);if(O===-1)break;o=O;continue}let E=s(e,o);if(E>o){t.push({start:o,end:E,token:e.slice(o,E)}),o=E;continue}let R=Kr(e,o);if(R>o){o=R;continue}let C=e.charCodeAt(o+1);if(C>=65&&C<=90||C>=97&&C<=122)h=!0;o++}return t}function Zr(e){let s=0,t=0,o=0,a=!1,h=null;while(o<e.length){if(a){let O=e[o];if(h){if(O===h)h=null}else if(O==='"'||O==="'")h=O;else if(O===">")a=!1;o++;continue}let c=e.indexOf("<",o),v=c===-1?e.length:c;while(o<v){let O=e[o++];if(O==="{")s++;else if(O==="}")t++;if(s>=2&&t>=2)return!0}if(c===-1)break;let E=Kr(e,c);if(E>c){o=E;continue}let R=e.charCodeAt(c+1),C=R===47?e.charCodeAt(c+2):R;if(C>=65&&C<=90||C>=97&&C<=122)a=!0;o=c+1}return!1}function $a(e,s){while(e.size>=s){let t=e.keys().next();if(t.done)return;e.delete(t.value)}}var ya=1024,_a=16777216,vt=new Map,Es=0;function wa(e,s){vt.set(e,s),Es+=e.length+s.output.length;for(let[t,o]of vt){if(Es<=_a)break;vt.delete(t),Es-=t.length+o.output.length}}function le(e,s,t,o){let a=o!==void 0&&e.length>=ya,h=a?`${o}\x00${e}`:"";if(a){let C=vt.get(h);if(C)return vt.delete(h),vt.set(h,C),{output:C.output,tokens:C.tokens.slice()}}let c=ce(e,s);if(c.length===0)return{output:e,tokens:[]};let v=c.map((C)=>C.token),E="",R=0;for(let C=0;C<c.length;C++){let O=c[C];E+=e.slice(R,O.start),E+=t(O.token,C),R=O.end}if(E+=e.slice(R),a)return wa(h,{output:E,tokens:v}),{output:E,tokens:v.slice()};return{output:E,tokens:v}}var Sa=1024,va=16777216,kt=new Map,Rs=0;function ka(e,s){kt.set(e,s),Rs+=e.length+s.output.length;for(let[t,o]of kt){if(Rs<=va)break;kt.delete(t),Rs-=t.length+o.output.length}}function Cs(e,s,t){return{output:s,scripts:t,restore:(o)=>o===s?e:or(o,t)}}function q(e){let s=e.length>=Sa;if(s){let a=kt.get(e);if(a)return kt.delete(e),kt.set(e,a),Cs(e,a.output,a.scripts.slice())}let{output:t,tokens:o}=le(e,W,(a,h)=>`\x00STX_SCRIPT_${h}\x00`);if(s)return ka(e,{output:t,scripts:o}),Cs(e,t,o.slice());return Cs(e,t,o)}function or(e,s){if(s.length===0)return e;return e.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(t,o)=>s[+o]??"")}function Tt(e){let s=e.indexOf(" as ");if(s!==-1){let h=e.slice(0,s).trim(),c=e.slice(s+4).trim();return h&&c?{arrayExpr:h,itemVar:c}:null}let t=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(e);if(!t)return null;let o=t[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),a=t[2].trim();return o&&a?{arrayExpr:a,itemVar:o}:null}function jn(e){let s=[],t=0,o="",a=0;for(let h=0;h<e.length;h++){let c=e[h];if(o){if(c==="\\")h++;else if(c===o)o="";continue}if(c==="'"||c==='"'||c==="`")o=c;else if(c==="("||c==="["||c==="{")t++;else if(c===")"||c==="]"||c==="}")t--;else if(c===","&&t===0)s.push(e.slice(a,h)),a=h+1}return s.push(e.slice(a)),s}function qr(e,s){let t=0;for(let o=0;o<e.length;o++){let a=e[o];if(a==="("||a==="["||a==="{")t++;else if(a===")"||a==="]"||a==="}")t--;else if(a===s&&t===0)return o}return-1}function Xr(e){let s=0;for(let t=0;t<e.length;t++){let o=e[t];if(o==="("||o==="["||o==="{")s++;else if((o===")"||o==="]"||o==="}")&&--s===0)return t}return-1}function ht(e,s){let t=e.trim().replace(/^\.\.\./,"").trim(),o=qr(t,"=");if(o!==-1&&t[o+1]!==">")t=t.slice(0,o).trim();if(!t)return;if(t.startsWith("{")&&t.endsWith("}")){for(let a of jn(t.slice(1,-1))){let h=a.trim();if(!h)continue;if(h.startsWith("...")){ht(h,s);continue}let c=qr(h,":");ht(c===-1?h:h.slice(c+1),s)}return}if(t.startsWith("[")&&t.endsWith("]")){for(let a of jn(t.slice(1,-1)))ht(a,s);return}if(/^[A-Z_$][\w$]*$/i.test(t))s.push(t)}function be(e){let s=e.trim(),t=[],o=0;for(let h=0;h<s.length;h++){let c=s[h];if(c==="("||c==="["||c==="{")o++;else if(c===")"||c==="]"||c==="}")o--;else if(o===0&&/\s/.test(c)){if(!/^\s+(?:in|of)\s/.exec(s.slice(h)))continue;let E=s.slice(0,h).trim();if(E.startsWith("(")&&Xr(E)===E.length-1)E=E.slice(1,-1);for(let R of jn(E))ht(R,t);if(t.length>0)return t;break}}let a=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(s);if(a){let h=a[1].trim();if(h.startsWith("(")&&Xr(h)===h.length-1)h=h.slice(1,-1);let c=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(h);if(c)ht(c[2],t),ht(c[1],t);else for(let v of jn(h))ht(v,t)}return t}function ue(e,s){let t=s instanceof Set?s:new Set(s);if(t.size===0)return!1;let c=e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g," ").replace(/`(?:[^`\\$]|\\.|\$(?!\{))*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:(?!:))/g,"$1$2");for(let v of c.match(/[a-zA-Z_$][\w$]*/g)||[])if(t.has(v))return!0;return!1}var Nn="__stx_client_loop_names";function Qe(e){let s=e?.[Nn];return Array.isArray(s)?s:[]}function Ln(e){if(!e.includes("#")&&!e.includes("v-slot:")&&!e.includes("data-stx-slot-binding"))return[];let s=[],t=[],o=/<!--[\s\S]*?-->|<script\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/script\s*>|<style\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/style\s*>|<\/?[a-z][\w:-]*\b(?:"[^"]*"|'[^']*'|[^'">])*>/gi;for(let a of e.matchAll(o)){let h=a[0];if(/^<\/template\s*>$/i.test(h)){let c=t.pop();if(c)c.end=a.index}else if(/^<template\b/i.test(h)&&!/\/\s*>$/.test(h)){let v=[...h.slice(9).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)].find((C)=>/^(?:#[\w-]+|v-slot:[\w-]+|data-stx-slot-binding)$/i.test(C[1])),E=(v?.[2]??v?.[3])?.trim();if(E&&v?.[1]==="data-stx-slot-binding")try{E=decodeURIComponent(E)}catch{E=void 0}let R=E?{start:a.index+h.length,end:e.length,binding:E}:void 0;if(t.push(R),R)s.push(R)}}return s}var qt={},Gr=new Map;function Ca(e){let s=Gr.get(e);if(!s){let t=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");s=new RegExp(`:${t}(?!\\w)`,"g"),Gr.set(e,s)}return s.lastIndex=0,s}var hs={uppercase:(e,s)=>e!==void 0&&e!==null?String(e).toUpperCase():"",lowercase:(e,s)=>e!==void 0&&e!==null?String(e).toLowerCase():"",capitalize:(e,s)=>{if(e===void 0||e===null)return"";let t=String(e);return t.charAt(0).toUpperCase()+t.slice(1)},number:(e,s,t=0)=>{if(e===void 0||e===null)return"";try{let o=Number(e);return Number.isNaN(o)?"":o.toFixed(Number.parseInt(String(t),10))}catch{return""}},fmt:(e,s,t="en-US")=>{if(e===void 0||e===null)return"";try{let o=Number(e);if(Number.isNaN(o))return String(e);return o.toLocaleString(t)}catch{return String(e)}},join:(e,s,t=",")=>{if(!Array.isArray(e))return"";return e.join(String(t))},escape:(e,s)=>{if(e===void 0||e===null)return"";return F(String(e))},translate:(e,s,t={})=>{if(!s||!s.__translations)return e;let o=s.__translations,a=s.__i18nConfig?.fallbackToKey??!0,h=String(e).split("."),c=o;for(let E of h){if(c===void 0||c===null)break;c=c[E]}if(c===void 0||c===null)return a?e:"";let v=String(c);return Object.entries(t).forEach(([E,R])=>{v=v.replace(Ca(E),()=>String(R))}),v},t:(e,s,t={})=>hs.translate(e,s,t),truncate:(e,s,t=50,o="...")=>{if(e===void 0||e===null)return"";let a=String(e);if(a.length<=t)return a;if(t<=o.length)return o.substring(0,t);return a.substring(0,t-o.length)+o},date:(e,s,t="short",o="en-US")=>{if(e===void 0||e===null)return"";try{let a=e instanceof Date?e:new Date(e);if(Number.isNaN(a.getTime()))return String(e);let h={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(t==="iso")return a.toISOString();return new Intl.DateTimeFormat(o,h[t]||h.short).format(a)}catch{return String(e)}},currency:(e,s,t="USD",o="en-US")=>{if(e===void 0||e===null)return"";try{let a=Number(e);if(Number.isNaN(a))return String(e);return new Intl.NumberFormat(o,{style:"currency",currency:t}).format(a)}catch{return String(e)}},pluralize:(e,s,t,o)=>{let a=Number(e);if(Number.isNaN(a))return t;let h=o||`${t}s`;return a===1?t:h},first:(e,s)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[0];return String(e).charAt(0)},last:(e,s)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[e.length-1];let t=String(e);return t.charAt(t.length-1)},length:(e,s)=>{if(e===void 0||e===null)return 0;if(Array.isArray(e)||typeof e==="string")return e.length;if(e instanceof Map||e instanceof Set)return e.size;if(typeof e==="object")return Object.keys(e).length;return 0},json:(e,s,t=!1)=>{if(e===void 0)return"undefined";if(e===null)return"null";try{return t?JSON.stringify(e,null,2):JSON.stringify(e)}catch{return String(e)}},default:(e,s,t="")=>e===void 0||e===null||e===""?t:e,reverse:(e,s)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return[...e].reverse();return String(e).split("").reverse().join("")},slice:(e,s,t=0,o)=>{if(e===void 0||e===null)return"";if(Array.isArray(e)||typeof e==="string")return e.slice(t,o);return e},replace:(e,s,t,o="")=>{if(e===void 0||e===null)return"";let a=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(e).replace(new RegExp(a,"g"),()=>o)},stripTags:(e,s)=>{if(e===void 0||e===null)return"";return String(e).replace(/<[^>]*>/g,"")},urlencode:(e,s)=>{if(e===void 0||e===null)return"";return encodeURIComponent(String(e))},abs:(e,s)=>{let t=Number(e);return Number.isNaN(t)?0:Math.abs(t)},round:(e,s,t=0)=>{let o=Number(e);if(Number.isNaN(o))return 0;let a=10**t;return Math.round(o*a)/a}};function ru(e,s){if(e in hs)console.warn(`Filter "${e}" already exists as a built-in filter. Custom filter will take precedence.`);qt[e]=s}function Ap(e){for(let[s,t]of Object.entries(e))ru(s,t)}function su(){return{...hs,...qt}}function Pp(){for(let e of Object.keys(qt))delete qt[e]}function It(e,s,t=2){let o="{".repeat(t);if(!e.includes(o))return e;let a="",h=0;for(;;){let c=e.indexOf(o,h);if(c===-1)break;let v=he(e,c,t);if(v===-1)break;a+=e.slice(h,c)+s(e.slice(c,v+t),e.slice(c+t,v),c),h=v+t}return h===0?e:a+e.slice(h)}function d(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function F(e){return Wr(d(e))}function Za(e){return e.replace(/ /g," ").replace(/\t/g,"	").replace(/\n/g," ").replace(/\r/g," ").replace(/\f/g,"").replace(/=/g,"=").replace(/`/g,"`")}function Qa(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\([\dA-Fa-f]{1,6})\s?/g,(s,t)=>String.fromCodePoint(Number.parseInt(t,16))).replace(/\\([^\r\n])/g,"$1").replace(/[\u0000-\u0020]+/g,"").toLowerCase()}function ec(e,s){let t=Qa(e);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(t))throw new ne(s,"network-capable or executable CSS is not allowed in an escaped interpolation");let o=/url\(([^)]*)\)/g,a;while((a=o.exec(t))!==null){let h=a[1].replace(/^["']|["']$/g,""),c=h.startsWith("/")&&!h.startsWith("//")||h.startsWith("./")||h.startsWith("../")||h.startsWith("#"),v=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(h);if(!c&&!v)throw new ne(s,"CSS URLs must be local paths or base64 raster images")}}function K(e,s,t,o=!1,a=0){try{return tc(e,s,t,o,a)}catch(h){if(h instanceof ne)h.locate(e,s);throw h}}function tc(e,s,t,o,a){let h=cs(e,s,o),c=F(t);if(!h)return c;if(h.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(t))throw new ne("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return t}if(h.kind==="tag"){let R=e.slice(s+a).trimStart(),C=t.trim();if(!R.startsWith("=")&&(C===""||/^(?!on)[A-Za-z_:][\w:.-]*(?:\s+(?!on)[A-Za-z_:][\w:.-]*)*$/.test(C)))return C;throw new ne("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let v=h.name.toLowerCase();if(/^on[a-z]/.test(v))throw new ne(h.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(v==="srcdoc")c=F(c);if(v==="style")ec(t,h.name);if(h.quote===null)c=Za(c);let E=vs(v);if(E&&h.valuePrefix.trim()===""&&Pn(t,E))return Fr+c;return Ur(Vr(e,s),t,c)}function fn(e,s){let t=` ${e}="`;return K(t,t.length,s,!0)}function si(e){return e.flatMap((s)=>{let t=s.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);return!t||/\bserver\b|\bsrc\s*=/.test(t[1])?[]:[t[2]]})}function ve(e,s){let{scripts:t}=q(e);for(let o of si(t)){if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(o))return!0;if(br(o,s))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(e))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(e))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(e))return!0;return!1}function ou(e){let s=[],t=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let o=t.exec(e);o;o=t.exec(e)){let a=o[1].toLowerCase(),h=new Set(be(o[3]));if(h.size===0)continue;let c=o.index+o[0].length;if(o[0].endsWith("/>")){s.push({start:o.index,end:c,names:h});continue}let v=new RegExp(`<(/?)${a}\\b[^>]*?(/?)>`,"gi");v.lastIndex=c;let E=1,R=e.length;for(let C=v.exec(e);C;C=v.exec(e)){if(C[2]==="/")continue;if(E+=C[1]==="/"?-1:1,E===0){R=C.index+C[0].length;break}}s.push({start:o.index,end:R,names:h})}return s}function Yr(e,s,t){let o=i(t);for(let a of e){if(s<a.start||s>=a.end)continue;for(let h of a.names)if(new RegExp(`(?<![.#\\w$])${h.replace(/\$/g,"\\$")}(?![\\w$])`).test(o))return!0}return!1}function Qr(e,s){let t=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","URL","URLSearchParams","Intl","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console","new","typeof","instanceof","in","void"],o=e.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),a="",h=!1,c=0;for(let R=0;R<o.length;R++){let C=o[R];if(!h&&C==="`"){h=!0,c=0;continue}if(h){if(C==="`"&&c===0){h=!1;continue}if(C==="$"&&o[R+1]==="{"){c++,R++,a+=" ";continue}if(C==="}"&&c>0){c--;continue}if(c>0){a+=C;continue}continue}a+=C}o=a;let v=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,E;while((E=v.exec(o))!==null){let R=E[1];if(!o.substring(0,E.index).trimEnd().endsWith(".")){if(!t.includes(R)&&!(R in s))return!1}}return!0}function nc(e,s){let t=i(e);for(let o of t.matchAll(/(?<![.\w$])([A-Z_$][\w$]*)\s*\(/gi))if(typeof s[o[1]]==="function")return!0;return!1}function sc(e,s){let t=s.__stx_serverDeclared;if(!t||t.size===0)return!1;let o=i(e);for(let a of t)if(new RegExp(`(?<![.#\\w$])${a}(?![\\w$])`).test(o))return!0;return!1}var ei=new Set;function ti(e){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(e.trim())}function ni(e,s){let t=`${s??"<unknown>"}\x00${e}`;if(process.env.STX_DEBUG||!ei.has(t))ei.add(t),console.warn(`[stx] {{ ${e} }} in a <script> in ${s??"<unknown>"} has no server value, so it was emitted as undefined. A mustache left in JavaScript is a SyntaxError that takes the whole script down, so give the value a default in <script server>.`);return"undefined"}function Lo(e,s,t){let o=e;return o=o.replace(/\{!!([\s\S]*?)!!\}/g,(a,h)=>{try{let c=_(h,s);if(c===void 0)return ti(h)?ni(h.trim(),t):a;return c===null?"":String(c)}catch{return a}}),o=It(o,(a,h,c)=>{let v=h.trim();if(/^__[A-Z_]+__$/.test(v))return a;try{let E=_(h,s);if(E===void 0)return ti(v)?ni(v,t):a;return JSON.stringify(E).replace(/</g,"\\u003c").replace(/@/g,"\\u0040").replace(/\{{2,}/g,(R)=>"\\u007b".repeat(R.length)).replace(/\{(?=!)/g,"\\u007b")}catch{return a}}),o}function iu(e,s){if(!e.includes("{"))return e;let t=e;return t=t.replace(/\{!!([\s\S]*?)!!\}/g,(o,a)=>{try{let h=_(a,s);if(h===void 0)return o;return h===null?"":String(h)}catch{return o}}),t=It(t,(o,a,h)=>{let c=a.trim();if(/^__[A-Z_]+__$/.test(c))return o;try{let v=_(a,s);if(v===void 0)return o;if(v===null)return"";let E=String(v);return K(t,h,E,!0,o.length)}catch(v){if(v instanceof ne)throw v;return o}}),t}function Ip(e,s,t={}){let{output:o,scripts:a}=q(e),h=a.map((c)=>{let v=c.match(/^<script\b((?:[^>\"']|\"[^\"]*\"|'[^']*')*)>/i),E=c.search(/<\/script\s*>$/i);if(!v||E===-1)return c;let R=v[1],C=c.slice(v[0].length,E);if(/\bdata-raw\b/.test(R))return c;if(t.skipServer&&/\bserver\b/.test(R))return c;let M=`<script${iu(R,s)}>`;if(/\bsrc\s*=/.test(R)||/\btype\s*=\s*["']application\/json["']/.test(R))return M+C+c.slice(E);return M+Lo(C,s)+c.slice(E)});return or(o,h)}function k(e,s,t){let o=e,a=(I,P)=>{let Z=on(I,P);if(Z===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(I.slice(P,Z))?-1:Z},h=(I,P,Z,U)=>{let V=Z.length,{output:X,tokens:Y}=le(I,P,(Q,re)=>U(V+re));return Z.push(...Y),X},c=[];o=h(o,a,c,(I)=>`<!--__STX_STYLE_${I}__-->`);let v=[];o=h(o,W,v,(I)=>`<!--__STX_SCRIPT_EXPR_${I}__-->`);let E=s?.__stx_signals_gate===!0||ve(e),R=new Set([...Array.isArray(s?.__stx_client_signal_names)?s.__stx_client_signal_names:[],...Do(si(v))]),C=new Set(Array.isArray(s?.__stx_preserved_client_expressions)?s.__stx_preserved_client_expressions:[]);o=It(o,(I,P,Z)=>{try{let U=_(P,s,!1,(V)=>Is(V,I,t,e));return U!==void 0&&U!==null?String(U):""}catch(U){let V=U instanceof Error?U.message:String(U);return m("Expression",`Error evaluating: {{{ ${P.trim()}}}}: ${V}`,t,e,Z,I)}},3),o=o.replace(/\{!!([\s\S]*?)!!\}/g,(I,P,Z)=>{try{let U=_(P,s,!1,(V)=>Is(V,I,t,e));if(U===void 0&&s.__stx_buildMode==="compile")return In("raw",P.trim());return U!==void 0&&U!==null?String(U):""}catch(U){if(s.__stx_buildMode==="compile")return In("raw",P.trim());let V=U instanceof Error?U.message:String(U);return m("Expression",`Error evaluating: {!! ${P.trim()} !!}: ${V}`,t,e,Z,I)}}),o=h(o,W,v,(I)=>`<!--__STX_SCRIPT_EXPR_${I}__-->`),o=h(o,a,c,(I)=>`<!--__STX_STYLE_${I}__-->`);let O=E?ou(o):[],M=Ln(o).map((I)=>({...I,names:new Set(be(`${I.binding} in __slot`))})),N=new Set(Qe(s));if(o=It(o,(I,P,Z)=>{let U=P.trim();if(Yr(M,Z,U))return I;if(ue(U,N))return I;if(O.length>0&&Yr(O,Z,U))return I;if(C.has(U))return I;let V=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],X=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,Q=U.match(X)?.[1],re=Q&&((Q in s)||V.includes(Q)),pe=Boolean(Q&&R.has(Q)),Ee=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,ke=U.match(Ee),We=ke&&!V.includes(ke[1])&&!(ke[1]in s);if(/^__[A-Z_]+__$/.test(U))return"";if(pe)return I;if(s.__stx_native_screen===!0&&nc(U,s))return I;let Te;try{let Ke=_(P,s,!1,(xt)=>{Te=xt});if(E&&!Qr(U,s))return I;if(Te)Is(Te,I,t,e);if(s.__stx_buildMode==="compile"&&!E&&(Ke===void 0||sc(U,s)))return In("expr",U);if(Ke===void 0||Ke===null)return"";let Ge=String(Ke);return K(o,Z,Ge,!1,I.length)}catch(Ke){if(Ke instanceof ne)throw Ke;if(E&&!Qr(U,s))return I;if(We)return I;let Ge=Ke instanceof Error?Ke.message:String(Ke);return m("Expression",`Error evaluating: {{ ${U} }}: ${Ge}`,t,e,Z,I)}}),v.length>0)o=o.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(I,P)=>v[Number(P)]??I);if(c.length>0)o=o.replace(/<!--__STX_STYLE_(\d+)__-->/g,(I,P)=>c[Number(P)]??I);return o}function au(e,s,t){if(!s.trim())return e;let o=e,a=s.trim();while(a.length>0){let h=a.match(/^(\w+)/);if(!h)break;let c=h[1];a=a.substring(c.length).trim();let v=qt[c]||hs[c];if(!v)throw Error(`Filter not found: ${c}. Available filters: ${Object.keys(su()).join(", ")}`);let E=[];if(a.startsWith(":")){let R=a.match(/^:([^|\s]+)/);if(R){let C=R[1].trim();try{let O=Number(C);E=[Number.isNaN(O)?C:O]}catch{E=[C]}a=a.substring(R[0].length).trim()}}else if(a.startsWith("(")){let R=1,C=1;while(R>0&&C<a.length){if(a[C]==="(")R++;if(a[C]===")")R--;C++}if(R===0){let O=a.substring(1,C-1).trim();if(O)try{if(O.startsWith("{")&&O.endsWith("}"))E=[_(`(${O})`,t,!0)];else{let M=[],N="",I=null,P=0,Z=0,U=0,V=!1;for(let X=0;X<O.length;X++){let Y=O[X];if(V){N+=Y,V=!1;continue}if(Y==="\\"){N+=Y,V=!0;continue}if(I){if(N+=Y,Y===I)I=null;continue}if(Y==='"'||Y==="'"||Y==="`"){I=Y,N+=Y;continue}if(Y==="(")P++;else if(Y===")")P--;else if(Y==="[")Z++;else if(Y==="]")Z--;else if(Y==="{")U++;else if(Y==="}")U--;if(Y===","&&P===0&&Z===0&&U===0){M.push(N),N="";continue}N+=Y}if(N)M.push(N);E=M.map((X)=>{let Y=X.trim();return _(Y,t,!0)})}}catch{E=[O]}a=a.substring(C).trim()}}try{o=v(o,t,...E)}catch(R){let C=R instanceof Error?R.message:String(R);throw Error(`Error applying filter '${c}': ${C}`)}if(a.startsWith("|"))a=a.substring(1).trim();else break}return o}function rc(e){let s=!1,t="",o=0,a=0,h=0,c=!1;for(let v=0;v<e.length;v++){let E=e[v],R=e[v+1];if(s&&c){c=!1;continue}if(s&&E==="\\"){c=!0;continue}if(c=!1,(E==='"'||E==="'"||E==="`")&&!c){if(!s)s=!0,t=E;else if(E===t)s=!1,t="";continue}if(s&&t==="`"&&E==="$"&&R==="{"){let C=1;v+=2;while(v<e.length&&C>0){if(e[v]==="{")C++;else if(e[v]==="}")C--;if(C>0)v++}continue}if(s)continue;if(E==="(")o++;else if(E===")")o--;else if(E==="[")a++;else if(E==="]")a--;else if(E==="{")h++;else if(E==="}")h--;if(E==="|"&&o===0&&a===0&&h===0){if(R==="|"){v++;continue}if(R==="="){v++;continue}return v}}return-1}var Zt=new Set,oc=1000;function Op(){Zt.clear()}function Is(e,s,t,o){if(!H())return;let a=`${t}\x00${e.expression}`;if(Zt.has(a))return;if(Zt.size>=oc)Zt.clear();Zt.add(a);let h=t,c=o;try{if(t&&Jr.existsSync(t))c=Jr.readFileSync(t,"utf8")}catch{}let v=c.indexOf(s);if(v>=0)h=`${t}:${c.slice(0,v).split(`
|
|
228
|
-
`).length}`;console.warn(`${h}: stx warning: ${s} rendered as an empty string. The safe evaluator rejected \`${e.expression}\` (${e.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function _(e,s,t=!1,o){try{let a=e.trim(),h=rc(a);if(h>0){let v=a.substring(0,h).trim(),E=a.substring(h+1).trim(),R=_(v,s,!0,o);return au(R,E,s)}let c=bs(a);if(c!==null){o?.({expression:a,rule:c});return}try{let v=Object.keys(s),E=Object.values(s);return u(a,v)(...E)}catch{return l(a,s)}}catch(a){if(a instanceof ReferenceError){let h=/(\b\w+)\s+is not defined/.exec(a.message);if(h){let c=h[1],v=cc(c,Object.keys(s));if(v&&v!==c)a.message=`${a.message} \u2014 did you mean '${v}'?`}}if(!t)console.error(`Error evaluating expression: ${e}`,a);throw a}}function cc(e,s){let t=null;for(let a of s){if(a===e)continue;let h=lc(e,a);if(t===null||h<t.dist)t={key:a,dist:h}}if(!t)return null;let o=Math.max(e.length,t.key.length);if(t.dist<=2||t.dist/o<=0.35)return t.key;return null}function lc(e,s){if(e===s)return 0;if(e.length===0)return s.length;if(s.length===0)return e.length;let[t,o]=e.length<s.length?[e,s]:[s,e],a=Array(t.length+1),h=Array(t.length+1);for(let c=0;c<=t.length;c++)a[c]=c;for(let c=1;c<=o.length;c++){h[0]=c;for(let v=1;v<=t.length;v++){let E=t[v-1]===o[c-1]?0:1;h[v]=Math.min(h[v-1]+1,a[v]+1,a[v-1]+E)}for(let v=0;v<=t.length;v++)a[v]=h[v]}return a[t.length]}function Np(e){if(!e)return"";return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}import uc from"process";function S(e="STX_PUBLIC_"){let s={},t={};for(let[o,a]of Object.entries(uc.env)){if(!o.startsWith(e)||a===void 0)continue;s[`import.meta.env.${o}`]=JSON.stringify(a),t[o]=a}return s["import.meta.env"]=JSON.stringify(t),s}function ri(e,s=""){let t=`${e}${s}`,o=0;for(let a=0;a<t.length;a++){let h=t.charCodeAt(a);o=(o<<5)-o+h,o=o&o}return`stx-${Math.abs(o).toString(36)}`}function ii(e,s,t={}){let{prefix:o="",preserveHost:a=!0,scopeKeyframes:h=!0,scopeCustomProperties:c=!1}=t;if(!e.trim())return"";let v=Os(e),E=[],R=new Map;if(h)for(let C of v){let O=C.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(O){let M=O[1],N=`${s}_${M}`;R.set(M,N)}}for(let C of v){let O=oi(C,s,o,a,R,c);E.push(O)}return E.join(`
|
|
229
|
-
|
|
230
|
-
`)}function Os(e){let s=[],t=e.replace(/\/\*[\s\S]*?\*\//g,""),o=0,a="",h=!1,c="";for(let v=0;v<t.length;v++){let E=t[v];if(E==="@"&&o===0)h=!0;if(E==="{")o++;else if(E==="}"){if(o--,o===0){if(h){c+=E;let R=c.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(R){let[,C,O,M]=R;if(C==="keyframes")s.push({selector:`@keyframes ${O.trim()}`,declarations:M.trim()});else if(C==="media"||C==="supports"||C==="container"){let N=Os(M);s.push({selector:`@${C} ${O.trim()}`,declarations:N.map((I)=>`${I.selector} { ${I.declarations} }`).join(`
|
|
231
|
-
`)})}else s.push({selector:`@${C} ${O.trim()}`,declarations:M.trim()})}c="",h=!1}else if(a.trim()){a+=E;let R=a.match(/([^{]+)\{([^}]*)\}/);if(R)s.push({selector:R[1].trim(),declarations:R[2].trim()});a=""}continue}}if(h)c+=E;else a+=E}return s}function oi(e,s,t,o,a,h){let{selector:c,declarations:v}=e;if(c.startsWith("@")){if(c.startsWith("@keyframes")){let C=c.replace("@keyframes ","").trim();return`@keyframes ${a.get(C)||C} { ${v} }`}if(c.startsWith("@media")||c.startsWith("@supports")||c.startsWith("@container")){let O=Os(`x { ${v} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((M)=>oi(M,s,t,o,a,h)).join(`
|
|
232
|
-
`);return`${c} {
|
|
233
|
-
${O}
|
|
234
|
-
}`}return`${c} { ${v} }`}let E=fc(c,s,t,o),R=v;for(let[C,O]of a)R=R.replace(new RegExp(`\\b${C}\\b`,"g"),O);if(h)R=R.replace(/--([a-z-]+)/gi,`--${s}-$1`);return`${E} { ${R} }`}function fc(e,s,t,o){let a=e.split(",").map((c)=>c.trim()),h=[];for(let c of a){if(c.startsWith(":host")){if(o)h.push(c);else{let R=c.replace(/:host(\([^)]*\))?/,`.${s}$1`);h.push(R)}continue}if(c.includes("::slotted")){h.push(c);continue}if(c===":root"){h.push(`:root .${s}`);continue}let v=t?`${t} .${s}`:`.${s}`;h.push(`${v} ${c}`);let E=pc(c,s);if(E)h.push(t?`${t} ${E}`:E)}return h.join(", ")}function pc(e,s){let t=0,o=e.length;for(let E=0;E<e.length;E++){let R=e[E];if(R==="["||R==="(")t++;else if(R==="]"||R===")")t--;else if(t===0&&(R===" "||R===">"||R==="+"||R==="~")){o=E;break}}let a=e.slice(0,o),h=e.slice(o);if(!a)return"";let c=a.length,v=0;for(let E=0;E<a.length;E++){let R=a[E];if(R==="["||R==="(")v++;else if(R==="]"||R===")")v--;else if(t===0&&v===0&&R===":"){c=E;break}}return`${a.slice(0,c)}.${s}${a.slice(c)}${h}`}var li=String.raw`(?<![\w-])scoped(?![\w-])`,Ps=/<style\s+([^>]*)>/gi,ai=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,ui=new RegExp(li,"i"),dc=new RegExp(li,"gi"),Ms=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function gc(e){Ps.lastIndex=0;let s=Ps.exec(e);while(s!==null){if(ui.test(s[1]))return!0;s=Ps.exec(e)}return!1}function Ro(e){let s=new Set,t=[];Ms.lastIndex=0;let o=Ms.exec(e);while(o!==null){let a=o[0].trim();if(s.has(a))t.push({start:o.index,end:o.index+o[0].length});else s.add(a);o=Ms.exec(e)}return t}function an(e){let s=Ro(e);if(s.length===0)return e;let t=Array(s.length+1),o=0;for(let a=0;a<s.length;a++){let h=s[a];t[a]=e.slice(o,h.start),o=h.end}return t[s.length]=e.slice(o),t.join("")}function us(e,s){if(!gc(e))return{html:e,hasScoped:!1};let t=ri(s),o=`data-v-${t}`,a=e,h=!1;if(ai.lastIndex=0,a=a.replace(ai,(c,v,E)=>{if(!ui.test(v))return c;h=!0;let R=mc(E,o),C=v.replace(dc,"").trim(),O=C?` ${C}`:"";return`<style data-stx-scoped="${t}"${O}>${R}</style>`}),!h)return{html:e,hasScoped:!1};return a=xc(a,o),{html:a,hasScoped:!0}}function mc(e,s){return ii(e,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${s}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${s}]`)}var hc=(e)=>`\x00stx-scope-mask-${e}\x00`,ci=/\u0000stx-scope-mask-(\d+)\u0000/g;function xc(e,s){let t=le(e,(a,h)=>{let c=W(a,h);return c>h?c:on(a,h)},(a,h)=>hc(h)),o=bc(t.output,s);return ci.lastIndex=0,o.replace(ci,(a,h)=>t.tokens[Number(h)])}function bc(e,s){let t=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return e.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(o,a,h)=>{if(t.has(a.toLowerCase()))return o;if(o.includes(s))return o;if(a.toLowerCase()==="style"||a.toLowerCase()==="script")return o;if(h)return o.replace(`<${a}${h}`,`<${a} ${s}${h}`);if(o.endsWith("/>"))return`<${a} ${s} />`;return`<${a} ${s}>`})}var Xt=/<\/?template\b[^>]*>/gi,yc=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function _c(e){let s=e.replace(/^<template\b/i,"").replace(/>$/,"");return yc.test(s)}function ae(e){Xt.lastIndex=0;let s;while((s=Xt.exec(e))!==null){if(s[0].startsWith("</")||_c(s[0]))continue;let t=s.index,o=Xt.lastIndex,a=1,h;while((h=Xt.exec(e))!==null)if(h[0].startsWith("</")){if(a--,a===0){let c=h.index;return{start:t,openEnd:o,closeStart:c,end:Xt.lastIndex,content:e.slice(o,c)}}}else a++;return null}return null}function ps(e,s){let t=e,o=/@json\s*\(/g,a;while((a=o.exec(t))!==null){let h=a.index,c=h+a[0].length-1,v=1,E=c+1,R=null,C=!1;while(E<t.length&&v>0){let X=t[E];if(C){C=!1,E++;continue}if(X==="\\"&&R){C=!0,E++;continue}if(R){if(X===R)R=null;E++;continue}if(X==='"'||X==="'"||X==="`"){R=X,E++;continue}if(X==="(")v++;else if(X===")"){if(v--,v===0)break}E++}if(v!==0)break;let O=t.substring(c+1,E).trim(),M=t.substring(h,E+1),N=-1,I=0,P=null,Z=!1;for(let X=0;X<O.length;X++){let Y=O[X];if(Z){Z=!1;continue}if(Y==="\\"&&P){Z=!0;continue}if(P){if(Y===P)P=null;continue}if(Y==='"'||Y==="'"||Y==="`"){P=Y;continue}if(Y==="("||Y==="["||Y==="{")I++;else if(Y===")"||Y==="]"||Y==="}")I--;if(Y===","&&I===0){N=X;break}}let U=N>=0?O.substring(0,N).trim():O,V=N>=0?O.substring(N+1).trim():void 0;try{let X=U.trim(),Y;if(p(X))Y=u(X,Object.keys(s))(...Object.values(s));else Y=void 0;let Q;if(V==="true")Q=JSON.stringify(Y,null,2);else Q=JSON.stringify(Y);let re=Q.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");t=t.substring(0,h)+re+t.substring(E+1),o.lastIndex=h+re.length}catch(X){D.log(X instanceof Error?X:Error(String(X)),{directive:"@json"},"error"),o.lastIndex=h+M.length}}return t}function gs(e){return e.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function ja(e){let s=e,t=/@memo\s*\(/g,o,a=[];while((o=t.exec(s))!==null){let h=o.index,c=h+o[0].length,v=1,E=c;while(E<s.length&&v>0){if(s[E]==="(")v++;else if(s[E]===")")v--;E++}if(v!==0)continue;let R=s.slice(c,E-1).trim(),C=E,O=s.slice(C),M=O.indexOf("@endmemo");if(M===-1)continue;let N=O.slice(0,M),I=C+M+8,P=N.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),Z=P?P[0].length:0,U=N.slice(Z),V=N.match(/(\s*)$/),X=V?V[0].length:0,Y=U.slice(0,U.length-X),Q=Y.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),re;if(Q){let[pe,Ee,ke="",We]=Q,Te=`<${Ee}${ke} data-stx-memo="${R}"${We}>`;re=N.slice(0,Z)+Te+Y.slice(pe.length)+N.slice(Z+Y.length)}else re=`${N.slice(0,Z)}<div data-stx-memo="${R}">${Y}</div>${N.slice(Z+Y.length)}`;a.push({start:h,end:I,replacement:re}),t.lastIndex=I}for(let h=a.length-1;h>=0;h--){let c=a[h];s=s.slice(0,c.start)+c.replacement+s.slice(c.end)}return s.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function Ao(e){let s=e.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return s=s.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),s}function gi(e,s){if(!/\bref\s*=/.test(e))return e;let t=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,o=ce(e,(E,R)=>{t.lastIndex=R;let C=t.exec(E);if(!C||/^(?:script|style)$/i.test(C[1]))return-1;return t.lastIndex}),a=[],h=0,c=0,v=[];for(let{start:E,end:R,token:C}of o){let O=/^<\/?([\w-]+)/.exec(C)[1].toLowerCase();if(C.startsWith("</")){let N;while(N=a.pop()){if(N.scoped)h--;if(N.name===O)break}continue}let M=/\sdata-stx-scope\s*=/.test(C);if(!h&&!M&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(C)&&!/\sdata-stx-ref-caller\s*=/.test(C))v.push(e.slice(c,E),C.replace(/\s*\/?>$/,(N)=>` data-stx-ref-caller="${s}"${N}`)),c=R;if(!mi.has(O)&&!/\/>$/.test(C)){if(a.push({name:O,scoped:M}),M)h++}}return v.push(e.slice(c)),v.join("")}var mi=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),hi=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,fi=/<\/?\s*([a-z][\w-]*)/iy,wc=/\s/;function Sc(e,s){let t=s-1;while(t>=0&&wc.test(e[t]))t--;return t>=0&&e[t]==="/"}function $c(e,s){let t=!1,o=!1;for(let a=s;a<e.length;a++){let h=e[a];if(t){if(h==="'")t=!1}else if(o){if(h==='"')o=!1}else if(h==="'")t=!0;else if(h==='"')o=!0;else if(h===">")return a}return-1}function vc(e,s){if(e.indexOf("{",s)===-1||e.indexOf("}",s)===-1)return!1;let t=0,o=s,a=!1,h=!1,c=!1;while(o<e.length){let v=e.indexOf("<",o),E=v===-1?e.length:v;if(E>o){if(t===0)while(o<E){let O=e.indexOf(h?"}":"{",o);if(O===-1||O>=E){if(h)c=!1;else a=!1;break}if(O>o)if(h)c=!1;else a=!1;if(h){if(c)return!0;c=!0}else if(a)h=!0,c=!1;else a=!0;o=O+1}o=E;continue}if(e.startsWith("<!--",o)){let O=e.indexOf("-->",o);o=O===-1?e.length:O+3;continue}let R=$c(e,o);if(R===-1)break;fi.lastIndex=o;let C=fi.exec(e)?.[1]?.toLowerCase()??"";if(e[o+1]==="/"){if(t===0)break;t--}else if(!Sc(e,R)&&!mi.has(C))t++;o=R+1}return!1}var pi=y(256);function Ba(e){if(e.length<1024)return di(e);let s=b(e),t=pi.get(s);if(t!==void 0)return t;let o=di(e);return pi.set(s,o),o}function di(e){if(e.length>=32768&&!Zr(e))return e;let t=new RegExp(`<(${"div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i"})\\b`,"gi"),o="",a=0,h;while((h=t.exec(e))!==null){let c=h.index,v=c+h[0].length,E=!1,R=!1,C=-1;while(v<e.length){let M=e[v];if(E){if(M==="'")E=!1}else if(R){if(M==='"')R=!1}else if(M==="'")E=!0;else if(M==='"')R=!0;else if(M===">"){C=v;break}v++}if(C===-1)continue;let O=e.slice(c,C+1);if(hi.test(O))continue;if(O.includes("x-cloak"))continue;if(vc(e,C+1))o+=e.slice(a,C)+" x-cloak>",a=C+1}return o+=e.slice(a),o}var Ec=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,kc=/<\/script>/gi,Rc=/<\/style>/gi;function Fa(e){let s=/<[a-z][\w-]*/gi,t="",o=0,a;while((a=s.exec(e))!==null){let h=a.index,c=a[0].slice(1).toLowerCase();if(c==="script"||c==="style"){let I=c==="script"?kc:Rc;I.lastIndex=h;let P=I.exec(e);if(P!==null)s.lastIndex=P.index+P[0].length;continue}let v=h+a[0].length,E=!1,R=!1,C=-1;while(v<e.length){let I=e[v];if(E){if(I==="'")E=!1}else if(R){if(I==='"')R=!1}else if(I==="'")E=!0;else if(I==='"')R=!0;else if(I===">"){C=v;break}v++}if(C===-1)continue;let O=e.slice(h+a[0].length,C);if(hi.test(O))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(O))continue;if(!Ec.test(O))continue;let M=e[C-1]==="/",N=M?C-1:C;t+=`${e.slice(o,N)} x-cloak${M?" ":""}`,o=N}return t+=e.slice(o),t}import Ti from"path";import js from"fs";import Jt from"path";function xi(e,s,t,o){let a=0;for(let h=s;h<e.length;h++)if(e[h]===t)a++;else if(e[h]===o&&!(o===">"&&e[h-1]==="=")){if(--a===0)return h}return-1}function Cc(e){let s=i(e),t=0,o=0,a=[];for(let h=0;h<s.length;h++)if("([{".includes(s[h]))t++;else if(")]}".includes(s[h]))t--;else if(s[h]===","&&t===0)a.push(e.slice(o,h).trim()),o=h+1;return a.push(e.slice(o).trim()),a}function Ds(e,s){let t=i(e),o=new RegExp(`\\b(?:${s.map((a)=>a.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let a of t.matchAll(o)){let h=a.index+a[0].length,c="";if(t[h]==="<"){let E=xi(t,h,"<",">");if(E<0)continue;c=e.slice(h+1,E),h=E+1;while(/\s/.test(t[h]||"")&&h<t.length)h++}if(t[h]!=="(")continue;let v=xi(t,h,"(",")");if(v>=0)return{type:c,args:Cc(e.slice(h+1,v))}}return null}var bi=`
|
|
235
|
-
type __StxCtor<T> = T extends StringConstructor ? string : T extends NumberConstructor ? number : T extends BooleanConstructor ? boolean : T extends ArrayConstructor ? unknown[] : T extends ObjectConstructor ? object : T extends readonly unknown[] ? __StxCtor<T[number]> : T extends abstract new (...args: any[]) => infer V ? V : unknown;
|
|
236
|
-
type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
|
|
237
|
-
type __StxOption<T> = T extends { type: infer C } ? __StxCtor<C> : T extends { default: infer D } ? D extends (...args: any[]) => infer V ? V : __StxWiden<D> : __StxCtor<T>;
|
|
238
|
-
type __StxRequired<O> = { [K in keyof O]-?: O[K] extends { required: true } ? K : never }[keyof O];
|
|
239
|
-
type __StxDefaulted<O> = { [K in keyof O]-?: O[K] extends { default: unknown } ? K : never }[keyof O];
|
|
240
|
-
type __StxOptions<O> = { [K in Exclude<__StxRequired<O>, __StxDefaulted<O>>]: __StxOption<O[K]> } & { [K in Exclude<keyof O, Exclude<__StxRequired<O>, __StxDefaulted<O>>>]?: __StxOption<O[K]> };
|
|
241
|
-
type __StxDefaults<P, K> = Omit<P, Extract<keyof P, K>> & Partial<Pick<P, Extract<keyof P, K>>>;
|
|
242
|
-
`;function yi(e,s){let t=[],o={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},a=i(e),h=e.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(M,N,I,P,Z)=>{if(a.slice(Z,Z+6)!=="import")return M;if(P.endsWith(".stx"))return"";let U=`${s}Import${t.length}`;if(t.push(`import * as ${U} from ${JSON.stringify(P)};`),N.startsWith("*"))return`import ${N.replace(/^\*\s+as\s+/,"")} = ${U};`;if(!N.startsWith("{"))return`import ${N} = ${U}.default;`;return N.slice(1,-1).split(",").map((V)=>{let[X,Y=X]=V.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!X)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(P)&&X in o)o[X].push(Y);return`import ${Y} = ${U}.${X};`}).join(`
|
|
243
|
-
`)}),c=Ds(e,o.defineProps),v=Ds(e,o.defineEmits),E=Ds(e,o.withDefaults);if(!c&&!v)return{declarations:"",props:null,events:null};let R=[],C=null,O=null;if(c){R.push(`const __options = (${c.args[0]||"{}"}) as const;`),R.push(`const __defaults = (${E?.args[1]||"{}"});`);let M=c.type||"__StxOptions<typeof __options>";R.push(`export type __StxProps = __StxDefaults<${M}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),C=`${s}.__StxProps`}if(v)R.push(`const __events = (${v.args[0]||"[]"}) as const;`),R.push(`export type __StxEvents = ${v.type||"Record<(typeof __events)[number], any[]>"};`),O=`${s}.__StxEvents`;return{declarations:`${t.join(`
|
|
244
|
-
`)}
|
|
245
|
-
namespace ${s} {
|
|
246
|
-
${h}
|
|
247
|
-
${R.join(`
|
|
248
|
-
`)}
|
|
249
|
-
}`,props:C,events:O}}var ir=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);function ar(e){if(e.includes("-")||e==="component")return!1;if(/^[A-Z]/.test(e))return!/[a-z]/.test(e)&&[...ir].some((s)=>s.toLowerCase()===e.toLowerCase());return ir.has(e)||/[A-Z]/.test(e)}function*Tc(e){let s=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,t;while(t=s.exec(e)){let o=s.lastIndex,a=[];while(o<e.length){while(/\s/.test(e[o]||""))o++;if(e[o]===">"||e.slice(o,o+2)==="/>"){o+=e[o]===">"?1:2;break}let h=/^[^\s=/>]+/.exec(e.slice(o))?.[0];if(!h){o++;continue}let c=o;o+=h.length;while(/\s/.test(e[o]||""))o++;if(e[o]!=="="){a.push({name:h,value:!0,offset:c,braced:!1});continue}o++;while(/\s/.test(e[o]||""))o++;let v=e[o],E=v==="{",R=v==='"'||v==="'";if(R||E)o++;let C=o;if(E){let O=i(e.slice(o)),M=1,N=0;for(;N<O.length;N++){if(O[N]==="{")M++;if(O[N]==="}"&&--M===0)break}o+=N}else if(R)while(o<e.length&&e[o]!==v)o++;else while(o<e.length&&!/[\s/>]/.test(e[o]))o++;if(a.push({name:h,value:e.slice(C,o),offset:C,braced:E}),R||E)o++}s.lastIndex=o,yield{name:t[1],offset:t.index,attributes:a}}}function _i(e,s,t){let o=[],a=[bi,"type __StxAssignedValue<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? T extends () => infer V ? V : T : T;","type __StxProp<P, K> = K extends keyof P ? P[K] : unknown;",'type __StxEvent<E, K> = K extends keyof E ? E[K] extends readonly unknown[] ? Exclude<E[K]["length"], 0 | 1> extends never ? E[K][0] : E[K] : E[K] : any;'],h=new Map,c=new Map,v=new Map,E=t.scriptCode(e,t.filePath),R=i(E);for(let I of E.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(R.slice(I.index,I.index+6)!=="import")continue;let P=I[2],Z=Jt.isAbsolute(P)||P.startsWith(".")?Jt.resolve(Jt.dirname(t.filePath),P):os(P,Jt.dirname(t.filePath));if(!Z)continue;let U=Z.endsWith(".stx")?Z:js.existsSync(`${Z}.stx`)?`${Z}.stx`:void 0,V=U?null:ss(Z,!1),X=I[1].startsWith("{")?I[1].slice(1,-1).split(","):[I[1]];for(let Y of X){let[Q,re=Q]=Y.trim().split(/\s+as\s+/),pe=U||V?.get(Q)||V?.get(Q.toLowerCase());if(pe)v.set(re,pe),v.set(re.toLowerCase(),pe),v.set(re.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),pe)}}for(let I of s.matchAll(/@import\s*\(([^)]+)\)/g))for(let P of I[1].matchAll(/['"]([^'"]+)['"]/g)){let Z=is(P[1],t.filePath,t).find((U)=>js.statSync(U,{throwIfNoEntry:!1})?.isFile());if(Z)v.set(Jt.basename(P[1]).replace(/\.stx$/,""),Z)}let C={__importedComponents:v},O=new Map,M=(I,P,Z)=>{let U=e.slice(0,I);return{code:P,offset:I,attribute:Z,anchor:!0,kind:"directive",line:U.split(`
|
|
250
|
-
`).length,column:I-U.lastIndexOf(`
|
|
251
|
-
`)}},N=(I,P,Z)=>o.push({expression:I,statement:{text:P+I.code+Z,prefixLength:P.length}});for(let I of Tc(s)){if(ar(I.name)||I.name==="component")continue;let P=gr(I.name,t.filePath,t,C);if(!P)continue;let Z=O.get(P);if(!Z){let V;try{V=t.readComponent?t.readComponent(P):js.readFileSync(P,"utf8")}catch{continue}if(V===void 0)continue;c.set(P,V),Z=yi(t.scriptCode(V,P),`__StxComponent${O.size}`),O.set(P,Z),a.push(Z.declarations)}let U=[];for(let V of I.attributes){let{name:X,offset:Y}=V,Q=V.value===!0?"true":V.value;if(X.startsWith("@")||X.startsWith("v-on:")){if(Z.events&&V.value!==!0)h.set(Y,`__StxEvent<${Z.events}, ${JSON.stringify(X.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let re=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(X);if(X.startsWith("v-")&&!X.startsWith("v-bind:")&&!re)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(X))continue;let pe=(re?re[1]||"modelValue":X.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(We,Te)=>Te.toUpperCase());if(U.push(pe),!Z.props)continue;let ke=X.startsWith(":")||X.startsWith("v-bind:")||!!re||V.braced?Q:V.value!==!0?JSON.stringify(Q):"true";N(M(Y,ke,X),";void ((",`) satisfies __StxProp<${Z.props}, ${JSON.stringify(pe)}>);`)}if(Z.props){let V=[...new Set(U)].map((Y)=>`${JSON.stringify(Y)}: undefined as any`).join(", "),X=M(I.offset,`<${I.name}>`);o.push({expression:X,statement:{text:`;void ({ ${V} } satisfies ${Z.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:O.size?a.join(`
|
|
252
|
-
`):"",checks:o,events:h,dependencies:c}}var wi=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function Ac(e){let s=(t)=>t.replace(/[^\n]/g," ");return e.replace(/<!--[\s\S]*?-->/g,s).replace(/\{\{--[\s\S]*?--\}\}/g,s)}function $t(e){let s=[],t=Ac(e);wi.lastIndex=0;let o;while((o=wi.exec(t))!==null){let a=(o[1]||"").trim(),h=(o[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,c=(o[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,v=o.index+h,E=o.index+o[0].length-c,R=e.slice(v,E);if(/\bsrc\s*=/.test(a))continue;let C=a.match(/\btype\s*=\s*["']([^"']+)["']/i);if(C&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(C[1]))continue;let O=/\bserver\b/.test(a)?"server":/\bclient\b/.test(a)?"client":"plain",M=Gt(e,v);s.push({kind:O,code:R,startLine:M,startColumn:Yt(e,v),offset:v,attrs:a})}return s}function Gt(e,s){let t=1;for(let o=0;o<s&&o<e.length;o++)if(e.charCodeAt(o)===10)t++;return t}function Yt(e,s){let t=e.lastIndexOf(`
|
|
253
|
-
`,s-1)+1;return s-t+1}function Bn(e){let s=e.split(""),t=(a,h)=>{for(let c=a;c<h&&c<s.length;c++)if(s[c]!==`
|
|
254
|
-
`)s[c]=" "},o=[/<script(?:\s[^>]*)?>[\s\S]*?<\/script>/gi,/<style(?:\s[^>]*)?>[\s\S]*?<\/style>/gi,/<!--[\s\S]*?-->/g,/\{\{--[\s\S]*?--\}\}/g,/@verbatim\b[\s\S]*?@endverbatim\b/g];for(let a of o){a.lastIndex=0;let h;while((h=a.exec(e))!==null)t(h.index,h.index+h[0].length)}return s.join("")}function Ic(e){let s=0,t="";for(let o=0;o<e.length;o++){let a=e[o];if(t){if(a==="\\"){o++;continue}if(a===t)t="";continue}if(a==='"'||a==="'"||a==="`"){t=a;continue}if(a==="("||a==="["||a==="{"){s++;continue}if(a===")"||a==="]"||a==="}"){s--;continue}if(a==="|"&&s===0){if(e[o+1]==="|"){o++;continue}if(e[o-1]==="|")continue;return e.slice(0,o)}}return e}var Ai=new Set([":for","x-for","v-for"]),zn=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,Ns="__stx_interpolated",Si="__StxElement",Ii="__StxTemplateValue",Oc=`type ${Ii}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function $i(e){return e.replace(/\{\{[\s\S]*?\}\}/g,Ns).replace(/\{!![\s\S]*?!!\}/g,Ns)}function Co(e){return e.replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/g,(s)=>{let t=s.split(`
|
|
255
|
-
`).length-1,o=s.length-t;return`0${" ".repeat(Math.max(0,o-1))}${`
|
|
256
|
-
`.repeat(t)}`})}var Pc=["foreach","endforeach","forelse","endforelse","for","endfor","while","endwhile","empty","if","elseif","else","endif","unless","endunless","isset","endisset","switch","case","default","endswitch","auth","endauth","guest","endguest","env","endenv","once","endonce","break","continue"],Mc=new RegExp(String.raw`^[ \t]*@(?:${Pc.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function Eo(e){return e.replace(Mc,(s)=>s.replace(/[^\n]/g," "))}var vi=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function Fl(e){let s=Bn(e),t=[],o=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,a;while((a=o.exec(s))!==null){if(a[1]||a[3])continue;let v=a[2]??a[4]??"",E=a[2]!==void 0?2:3,R=Ic(v);if(!R.trim())continue;let C=a.index+E+(R.length-R.trimStart().length);t.push({code:R.trim(),line:Gt(s,C),column:Yt(s,C),offset:C,kind:"interpolation"})}let h=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((a=h.exec(s))!==null){let c=a.index+a[0].length-1,v=0,E=c;for(;E<s.length;E++){let M=s[E];if(M==="(")v++;else if(M===")"){if(v--,v===0)break}}if(v!==0)continue;let R=s.slice(c+1,E),C=R.trim();if(h.lastIndex=E+1,!C)continue;let O=c+1+(R.length-R.trimStart().length);t.push({code:C,line:Gt(s,O),column:Yt(s,O),offset:a.index,kind:"condition"})}zn.lastIndex=0;while((a=zn.exec(s))!==null){let c=a[1],v=a[3]??"",E=c.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(vi.has(E)||vi.has(c))continue;if(!v.trim())continue;let R=a.index+a[0].indexOf(a[2],a[0].indexOf(c)+c.length)+1;if(Ai.has(E)){let O=v.match(/\s+(?:in|of)\s+/);if(!O||O.index===void 0)continue;let M=v.slice(O.index+O[0].length),N=O.index+O[0].length+(M.length-M.trimStart().length);t.push({code:$i(M.trim()),line:Gt(s,R+N),column:Yt(s,R+N),offset:R+N,kind:"directive",attribute:E});continue}let C=v.length-v.trimStart().length;t.push({code:$i(v.trim()),line:Gt(s,R+C),column:Yt(s,R+C),offset:R+C,kind:"directive",attribute:E})}return t.sort((c,v)=>c.line-v.line||c.column-v.column),t}var Dc=2000;function jc(e,s){let t=0,o=Math.min(e.length,s+Dc);for(let a=s;a<o;a++){let h=e[a];if(h==="(")t++;else if(h===")"){if(t--,t===0)return e.slice(s+1,a)}}return null}function Nc(e){let s=new Map,t=(v,E)=>{let R=v.split(/[,[\]{}()\s]+/).filter(Boolean);for(let C of R){let O=C.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(O))continue;let M=R.length===1?E:void 0,N=s.get(O);if(!N)s.set(O,{name:O,iterable:M});else if(N.iterable!==M)N.iterable=void 0}},o=/^\$?[A-Z_$][\w$]*$/i,a=(v)=>{let E=v.trim();return o.test(E)?E:void 0};for(let v of e.matchAll(/@for(?:each|else)\s*\(/g)){let E=jc(e,v.index+v[0].length-1);if(E===null)continue;let R=Tt(E);if(!R)continue;t(R.itemVar.replace(/=>/g," "),a(R.arrayExpr))}for(let v of e.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))t(v[1],v[2]==="of"?a(v[3]):void 0);for(let v of e.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))t(v[1]);let h=Bn(e);zn.lastIndex=0;let c;while((c=zn.exec(h))!==null){let v=c[1].replace(/\..*$/,"");if(!Ai.has(v))continue;let E=c[3].match(/\s+(?:in|of)\s+/);if(!E||E.index===void 0)continue;t(c[3].slice(0,E.index),a(c[3].slice(E.index+E[0].length)))}for(let v of e.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let E of v[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))t(E[1]);return[...s.values()].sort((v,E)=>v.name.localeCompare(E.name))}function Ie(e){let s=new Set;for(let t of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))s.add(t[1]);for(let t of e.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))s.add(t[1]);for(let t of e.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))s.add(t[1]);for(let t of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let o of t[1].split(",")){let a=o.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(a))s.add(a)}return[...s].sort()}var Ls=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],Lc={$bool:"declare function $bool(value: unknown, fallback?: boolean): boolean",$num:"declare function $num(value: unknown, fallback?: number): number",$uid:"declare var $uid: string",$native:"declare var $native: boolean"};function Ra(e=new Set){return[...Ls.filter((s)=>!e.has(s)).map((s)=>`declare var ${s}: any`),...Object.entries(Lc).filter(([s])=>!e.has(s)).map(([,s])=>s)].join(`
|
|
257
|
-
`)}function Aa(e){return new Set([...e.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((s)=>s[1]))}function Oi(e){let s=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,t,o=!1,a=new Set,h=i(e);while((t=s.exec(h))!==null){o=!0;for(let c of Bc(t[1])){let v=c.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(v))a.add(v)}}return o?[...a]:null}function Bc(e){let s=[],t=0,o="";for(let a of e){if(a===","&&t===0){s.push(o),o="";continue}if(a==="("||a==="["||a==="{")t++;else if(a===")"||a==="]"||a==="}")t--;o+=a}return s.push(o),s.filter((a)=>a.trim().length>0)}function zc(e){let s=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,t=[],o=e.replace(s,(a)=>(t.push(a.trim()),a.split(`
|
|
258
|
-
`).map(()=>"").join(`
|
|
259
|
-
`)));return{imports:t.join(`
|
|
260
|
-
`),body:o}}function Pi(e){let s=i(e),t=Array(s.length),o=0;for(let v=0;v<s.length;v++){let E=s[v];if(E==="}"||E===")"||E==="]")o=Math.max(0,o-1);if(t[v]=o,E==="{"||E==="("||E==="[")o++}let a=[],h=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,c;while((c=h.exec(s))!==null){if(t[c.index]!==0)continue;let v=c[1],E=c[2],R;if(v==="interface"){let C=s.indexOf("{",c.index);if(C===-1)continue;let O=0;R=-1;for(let M=C;M<s.length;M++)if(s[M]==="{")O++;else if(s[M]==="}"&&--O===0){R=M+1;break}if(R===-1)continue}else{let C=0;R=s.length;for(let O=s.indexOf("=",c.index)+1;O<s.length;O++){let M=s[O];if(M==="{"||M==="["||M==="("||M==="<")C++;else if(M==="}"||M==="]"||M===")"||M===">")C--;else if(C<=0&&(M===";"||M===`
|
|
261
|
-
`&&!/[=|&,<([{]\s*$/.test(s.slice(Math.max(0,O-40),O)))){R=M===";"?O+1:O;break}}}a.push({name:E,text:e.slice(c.index,R).replace(/^[ \t]*export[ \t]+/,"")}),h.lastIndex=R}return a}function Wc(e){return new Set(Pi(e).map((s)=>s.name))}function Pa(e,s=""){let t=Oi(e),o=Wc(s),a=Pi(e).filter((R)=>!o.has(R.name)).map((R)=>R.text);if(!t){let R=Ie(e).filter((C)=>!Ht(s,C));if(R.length===0&&a.length===0)return"";return["",`// ${Fc}`,...a,...R.map((C)=>`declare var ${C}: any`)].join(`
|
|
262
|
-
`)}if(t.length===0)return a.length>0?["",`// ${Ei}`,...a].join(`
|
|
263
|
-
`):"";let{imports:h,body:c}=zc(e),v=c.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),E=["",`// ${Ei}`];if(h)E.push(h);return E.push(...a),E.push(`async function ${ki}() {`,v,` return { ${t.join(", ")} }`,"}",`type ${Ri} = Awaited<ReturnType<typeof ${ki}>>`,...t.map((R)=>`declare var ${R}: ${Ri}[${JSON.stringify(R)}]`)),E.join(`
|
|
264
|
-
`)}function To(e){let t=i(e).split(""),o=0;for(let a=0;a<t.length;a++){let h=t[a];if(h==="{"||h==="("||h==="["){o++;continue}if(h==="}"||h===")"||h==="]"){o=Math.max(0,o-1);continue}if(o>0&&h!==`
|
|
265
|
-
`)t[a]=" "}return Ie(t.join(""))}function Ia(e,s){if(Oi(e)!==null)return[];let t=To(e),o=rn(s,new Set(t)),a=new Set(x);return t.filter((h)=>{if(a.has(h))return!1;if(Ht(s,h))return!1;return o.has(h)})}var Ei="stx: types for the declared client payload (#1868)",Fc="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",ki="__stxServerScope",Ri="__StxClientPayload";var Ci=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","$native","props","slot"];var Vc=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function Uc(e){let s=new Map,t=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let o of e){let a=i(o),{depths:h,balanced:c}=et(a);if(!c)continue;let v=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let E of a.matchAll(v)){let R=E.index??0;if(h[R+E[1].length]!==0)continue;let C=E[2],O=R+E[0].length-E[3].length,M=o.slice(O,R+E[0].length).trim().replace(/;$/,"").trim(),N=E[3],I=t.test(N)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(N)&&!/[,+\-*/%&|?:=]$/.test(M)&&et(N).balanced;s.set(C,s.has(C)||!I?null:M)}}return new Map([...s].filter((o)=>o[1]!==null))}function Mi(e,s,t=0,o=new Set){if(s.size===0||t>=5)return e;let a=i(e),h="",c=0;for(let v of a.matchAll(/[A-Za-z_$][\w$]*/g)){let E=v.index??0,R=v[0],C=s.get(R);if(!C||o.has(R))continue;let O=a.slice(0,E).trimEnd(),M=a.slice(E+R.length).trimStart();if(O.endsWith(".")||/^:(?!:)/.test(M)&&/[{,]$/.test(O))continue;if(E>0&&/[\w$]/.test(a[E-1]))continue;h+=`${e.slice(c,E)}(${Mi(C,s,t+1,new Set([...o,R]))})`,c=E+R.length}return h+e.slice(c)}function Hc(e,s){let t=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,o=[],a;while((a=t.exec(e))!==null){if(a.index>s)break;let h=a[1];if(a.index===s){if(h==="elseif"){let v=o[o.length-1];if(v?.current)v.seen.push(v.current);if(v)v.current=null}break}if(h==="endif"||h==="endunless"){o.pop();continue}let c="";if(a[2]==="("){let v=0,E=a.index+a[0].length-1,R=E+1;for(;E<e.length;E++){let C=e[E];if(C==="(")v++;else if(C===")"){if(v--,v===0)break}}c=e.slice(R,E).trim(),t.lastIndex=E+1}if(h==="if")o.push({seen:[],current:c});else if(h==="unless")o.push({seen:[],current:`!(${c})`});else if(h==="elseif"||h==="else"){let v=o[o.length-1];if(!v)continue;if(v.current)v.seen.push(v.current);v.current=h==="elseif"?c:null}}return o.flatMap((h)=>[...h.seen.map((c)=>`!(${c})`),...h.current?[h.current]:[]]).filter(Boolean)}function Kc(e){let s=e.code.trim();if(!s)return null;if(e.attribute?.startsWith("@")){if(Vc.test(s))return null;let o=";(($event: any): void => { ";return{text:`${o}${s} });`,prefixLength:o.length}}let t=";void ((";return{text:`${t}${s}));`,prefixLength:t.length}}var Zc=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function ls(e,s){if(!s)return e;return e.replace(Zc,(t,o,a,h)=>{let c=Ti.resolve(s,h).replace(/\\/g,"/");return`${o}${a}${c}${a}`})}function $o(e){return" ".repeat(Math.max(0,(e.startColumn??1)-1))}function qc(e){let s=new Set,t=i(e);for(let o of t.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let a=o[1],h=/\{([^}]*)\}/.exec(a);for(let R of h?.[1].split(",")??[]){let C=R.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(C&&/^[A-Z_$][\w$]*$/i.test(C))s.add(C)}let c=a.replace(/\{[^}]*\}/,""),v=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(c);if(v)s.add(v[1]);let E=/^\s*([A-Z_$][\w$]*)/i.exec(c);if(E&&E[1]!=="type")s.add(E[1])}return[...s].sort()}function Oa(e,s={}){let t=$t(e),o=e.split(`
|
|
266
|
-
`),a=Array.from({length:o.length},()=>""),h=new Map,c=s.filePath&&s.templateExpressions!==!1?_i(e,Bn(e),{filePath:s.filePath,componentsDir:s.componentsDir,projectRoot:s.projectRoot,readComponent:s.readComponent,scriptCode:(O,M)=>$t(O).map((N)=>ls(N.code,Ti.dirname(M))).join(`
|
|
267
|
-
`)}):void 0,v=new Set,E=[];for(let O of t){let M=Eo(Co(O.code)),N=ls(M,s.originDir??"").split(`
|
|
268
|
-
`);N.forEach((I,P)=>{let Z=O.startLine-1+P;if(Z<a.length)a[Z]=P===0?$o(O)+I:I,v.add(Z)}),E.push(O.startLine-1+N.length-1)}for(let O of E){let M=a[O]?.trim()===""?O:O+1;if(M<a.length&&a[M].trim()===""&&(M===O||!v.has(M)))a[M]=";"}let R=(O,M)=>{for(let[N,I]of O.split(`
|
|
269
|
-
`).entries())if(a.push(I),M)h.set(a.length,N===0?M:{...M,line:M.line+N,column:1,prefixLength:0})};if(s.globals!==!1){R("");let O=new Set([...t.flatMap((P)=>Ie(P.code)),...t.flatMap((P)=>qc(P.code))]),M=(P)=>{if(!O.has(P))R(`declare var ${P}: any`)};if(s.runtimeGlobals!==!1){if(!O.has("window"))R("declare var window: any");for(let P of x)M(P)}let N=[...new Set([...Ls,...ye,...Ci])].filter((P)=>s.runtimeGlobals!==!1||!x.includes(P));if(s.contextScope==="global"){R("declare global {");for(let P of N)R(` var ${P}: any`);R("}")}else{for(let P of Ls)M(P);for(let P of ye)M(P);for(let P of Ci)M(P)}R(`declare var ${Ns}: any`);let I=new Set(t.flatMap((P)=>Ie(P.code)));R(`type ${Si}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let P of Nc(e)){if(I.has(P.name))continue;let Z=P.iterable&&I.has(P.iterable)?`${Si}<typeof ${P.iterable}>`:"any";R(`declare var ${P.name}: ${Z}`)}}if(s.templateExpressions!==!1){if(c?.declarations)for(let M of c.declarations.split(`
|
|
270
|
-
`))R(M);let O=Fl(e).map((M)=>{let N=c?.events.get(M.offset??-1);if(N){M.anchor=!0;let I=M.code.trim(),P=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(I),Z=P?`void ((${P[2]}) satisfies __StxAssignedValue<typeof ${P[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(I)?`${I} satisfies (($event: ${N}) => unknown)`:I,U=`;(($event: ${N}): void => { `;return{expression:M,statement:{text:`${U}${Z} });`,prefixLength:U.length}}}return{expression:M,statement:Kc(M)}}).filter((M)=>M.statement!==null);if(O.push(...c?.checks||[]),O.length>0){let M=Bn(e),N=Ln(M),I=Uc(t.map((V)=>V.code)),Z=[...new Set(t.flatMap((V)=>Ie(V.code)))].filter((V)=>/^[A-Z_$][\w$]*$/i.test(V)),U=0;if(Z.length>0){R(Oc);for(let V of Z)R(`function __StxRead_${V}() { return ${V} }`),R(`type __StxT_${V} = ${Ii}<ReturnType<typeof __StxRead_${V}>>`);R(`;((${Z.map((V)=>`${V}: __StxT_${V}`).join(", ")}) => {`),U=1}for(let{expression:V,statement:X}of O){let Y=" ".repeat(U),Q=V.offset===void 0?[]:N.filter((Te)=>V.offset>=Te.start&&V.offset<Te.end),re=Q.map((Te)=>`;((${Te.binding.replace(/[\r\n]/g," ")}: any) => { `).join(""),pe=" });".repeat(Q.length),Ee=V.offset===void 0?[]:Hc(M,V.offset),ke=Ee.length>0?`${Ee.map((Te)=>`if (${Mi(Te,I)}) `).join("")}{ `:"",We=Ee.length>0?" }":"";R(Y+re+ke+X.text+We+pe,{line:V.line,column:V.column,expression:V,prefixLength:X.prefixLength+Y.length+re.length+ke.length,guardPrefixLength:Y.length+re.length+ke.length})}if(U>0)R("});")}}let C=!1;if(s.reference&&a[0]!==void 0&&a[0].trim()==="")a[0]=`/// <reference path=${JSON.stringify(s.reference.replace(/\\/g,"/"))} />`,C=!0;return R("export {}"),{text:a.join(`
|
|
271
|
-
`),lineMap:h,sourceLineCount:o.length,componentDependencies:c?.dependencies,referenced:C}}function Na(e,s){if(!e.expression)return!1;return e.inGuard===!0||s===2774}function Da(e,s,t){let o=e.lineMap.get(s);if(!o)return s<=e.sourceLineCount?{line:s,column:t}:null;let a=o.expression?.anchor?0:Math.max(0,t-1-(o.prefixLength??0));return{line:o.line,column:o.column+a,expression:o.expression,inGuard:t<=(o.guardPrefixLength??0)}}var Bs=y(256),Xc=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/(?:\bwindow\.)?localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables \u2014 or, where this must run before first paint and the runtime does not exist yet, the colorMode config for a light/dark theme, or @appearanceBootstrap when there is a second appearance axis"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}],Di=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function Jc(e){let s=Array.from(e,(a)=>a===`
|
|
272
|
-
`?`
|
|
273
|
-
`:" "),t=0,o="";while(t<e.length){let a=e[t],h=e[t+1];if(o){if(a==="\\"){t+=2;continue}if(a===o)o="";t++;continue}if(a==='"'||a==="'"||a==="`"){o=a,t++;continue}if(a==="/"&&h==="/"){while(t<e.length&&e[t]!==`
|
|
274
|
-
`)s[t]=e[t],t++;continue}if(a==="/"&&h==="*"){let c=e.indexOf("*/",t+2),v=c===-1?e.length:c+2;for(;t<v;t++)s[t]=e[t];continue}if(a==="{"&&h==="{"&&e.slice(t,t+4)==="{{--"){let c=e.indexOf("--}}",t+4),v=c===-1?e.length:c+4;for(;t<v;t++)s[t]=e[t];continue}t++}return s.join("")}function Gc(e){let s=new Map,t=Jc(e).split(`
|
|
275
|
-
`),o=e.split(`
|
|
276
|
-
`);return t.forEach((a,h)=>{Di.lastIndex=0;for(let c of a.matchAll(Di)){let v=c[1]==="-next-line",E=(o[h]??"").slice(0,c.index).trim(),R=v||E===""?h+2:h+1,O=(c[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),M=O.filter((I)=>/\w/.test(I));if(O.length>0&&M.length===0)continue;let N=s.get(R);if(N&&N.size===0)continue;if(M.length===0){s.set(R,new Set);continue}if(N)M.forEach((I)=>N.add(I));else s.set(R,new Set(M))}}),s}function Yc(e,s,t){let o=e.get(s);if(!o)return!1;if(o.size===0)return!0;return[...o].some((a)=>t.includes(a))}function Ae(e,s,t,o){let a=typeof t==="boolean"?{enabled:t,failOnViolation:t}:t??{enabled:!1};if(!a.enabled)return;let h=b(e,s,o,JSON.stringify(a)),c=Bs.get(h);if(c!==void 0){if(c&&a.failOnViolation)throw new z(c,o??s);return}let v=a.allowPatterns??[],E=Gc(e),R=[],C=i(e.replace(/\{\{--[\s\S]*?--\}\}/g,(I)=>I.replace(/[^\n]/g," ")));for(let{pattern:I,message:P,suggestion:Z}of Xc){if(v.some((V)=>/\w/.test(V)&&P.includes(V)))continue;I.lastIndex=0;let U=C.match(I);if(U&&U.length>0){let V=C.split(`
|
|
277
|
-
`),X=e.split(`
|
|
278
|
-
`),Y=[];if(V.forEach((Ee,ke)=>{if(I.lastIndex=0,I.test(Ee)&&!Yc(E,ke+1,P))Y.push(ke+1)}),Y.length===0&&V.some((Ee)=>(I.lastIndex=0,I.test(Ee))))continue;let Q=Y.length>0?` (script line${Y.length>1?"s":""} ${Y.join(", ")})`:"",re=Y.slice(0,3).map((Ee)=>` ${Ee} | ${(X[Ee-1]??"").trim().slice(0,100)}`).join(`
|
|
279
|
-
`),pe=re?`
|
|
280
|
-
${re}`:"";R.push(` \u2717 ${P}${Q}
|
|
281
|
-
\u2192 ${Z}${pe}`)}}if(R.length===0){Bs.set(h,"");return}let O=(I)=>{let P=`${process.cwd()}/`;return I.startsWith(P)?I.slice(P.length):I},N=`[STX] DOM API violation in ${o&&o!==s?`${O(o)} (composed into ${O(s)})`:O(s)}:
|
|
282
|
-
${R.join(`
|
|
283
|
-
`)}
|
|
284
|
-
Tip: prefer useRef(), navigate(), and composables for component code`;if(Bs.set(h,N),console.warn(N),a.failOnViolation)throw new z(N,o??s)}var Qc=[{open:"@if",close:"@endif",name:"if"},{open:"@unless",close:"@endunless",name:"unless"},{open:"@foreach",close:"@endforeach",name:"foreach"},{open:"@for",close:"@endfor",name:"for"},{open:"@while",close:"@endwhile",name:"while"},{open:"@forelse",close:"@endforelse",name:"forelse"},{open:"@switch",close:"@endswitch",name:"switch"},{open:"@isset",close:"@endisset",name:"isset"},{open:"@empty",close:"@endempty",name:"empty"},{open:"@auth",close:"@endauth",name:"auth"},{open:"@guest",close:"@endguest",name:"guest"},{open:"@can",close:"@endcan",name:"can"},{open:"@cannot",close:"@endcannot",name:"cannot"},{open:"@section",close:"@endsection",name:"section",altClose:"@show"},{open:"@push",close:"@endpush",name:"push"},{open:"@prepend",close:"@endprepend",name:"prepend"},{open:"@once",close:"@endonce",name:"once"},{open:"@markdown",close:"@endmarkdown",name:"markdown"},{open:"@component",close:"@endcomponent",name:"component"}],el=[{pattern:/@if\s*[^(]/,message:"@if directive missing parentheses",suggestion:"Use @if(condition)"},{pattern:/@foreach\s*[^(]/,message:"@foreach directive missing parentheses",suggestion:"Use @foreach(items as item)"},{pattern:/@foreach\([^)]*\)\s*[^@\n<]/,message:"@foreach may have content on same line",suggestion:"Put content on new line after @foreach()"},{pattern:/@include\s*[^(]/,message:"@include directive missing parentheses",suggestion:"Use @include('partial-name')"},{pattern:/@extends\s*[^(]/,message:"@extends directive missing parentheses",suggestion:"Use @extends('layout-name') or @layout('layout-name')"},{pattern:/@layout\s*[^(]/,message:"@layout directive missing parentheses",suggestion:"Use @layout('layout-name')"}],tl=[{pattern:/\{\{\s*constructor\s*\}\}/,message:"Attempting to access constructor property"},{pattern:/\{\{\s*__proto__\s*\}\}/,message:"Attempting to access __proto__ property"},{pattern:/\{\{\s*eval\s*\(/,message:"Attempting to use eval in expression"}];function Xl(e){let s=[],t=[];return nl(e,s),sl(e,s,t),rl(e,t),il(e,s),{valid:s.length===0,errors:s,warnings:t}}function nl(e,s){let t=(e.match(/\{\{/g)||[]).length,o=(e.match(/\}\}/g)||[]).length;if(t!==o)s.push({type:"expression",message:`Unclosed expression brackets: found ${t} opening '{{' and ${o} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function sl(e,s,t){for(let o of Qc){let a=new RegExp(`${o.open}(?:\\s|\\()`,"g"),h=new RegExp(o.close,"g"),c=(e.match(a)||[]).length,v=(e.match(h)||[]).length;if(o.altClose){let E=new RegExp(o.altClose,"g");v+=(e.match(E)||[]).length}if(c>v)s.push({type:"directive",message:`Unclosed @${o.name} directive: found ${c} opening and ${v} closing`,suggestion:`Add ${c-v} missing ${o.close} tag(s)`});else if(v>c)t.push({type:"directive",message:`Extra ${o.close} found: ${v-c} more closing than opening`,suggestion:`Check for orphaned ${o.close} tags`})}}function rl(e,s){for(let t of el)if(t.pattern.test(e))s.push({type:"syntax",message:t.message,suggestion:t.suggestion})}function il(e,s){for(let t of tl)if(t.pattern.test(e))s.push({type:"expression",message:`Security warning: ${t.message}`,suggestion:"Remove dangerous code from template expressions"})}function Jl(e,s){let t=e.slice(0,s).split(`
|
|
285
|
-
`);return{line:t.length,column:t[t.length-1].length+1}}function Yl(e,s,t){let o=[];switch(e){case"if":case"elseif":case"unless":if(t.length===0)o.push({type:"syntax",message:`@${e} requires a condition`,suggestion:`Use @${e}(condition)`});break;case"foreach":if(t.length===0||!t[0].includes(" as "))o.push({type:"syntax",message:'@foreach requires "items as item" syntax',suggestion:"Use @foreach(items as item) or @foreach(items as key => value)"});break;case"for":if(t.length===0)o.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(t.length===0)o.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(t.length===0)o.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(t.length===0)o.push({type:"syntax",message:`@${e} requires a path`,suggestion:`Use @${e}('path/to/template')`});break}return o}function Zl(e){return/@[a-z]+/i.test(e)||/\{\{/.test(e)}function Ql(e){let s=e.matchAll(/@([a-z]+)/gi),t=new Set;for(let o of s){let a=o[1].toLowerCase();if(!a.startsWith("end"))t.add(a)}return Array.from(t)}var Qt=new B(500),Fn=new B(1000),Fs=new B(2000),Vs=new B(500),Fi=33554432,Us=Fi;function ol(e){let s=e.componentRenderCacheBytes;if(typeof s!=="number"||s<0||s===Us)return;Us=s,Vn.setMaxBytes(s)}var Vn=new B(2000,{maxBytes:Fi,sizeOf:(e)=>e.output.length});function al(e){let s=new WeakSet;try{let t=(o)=>{if(o===void 0)return{__stxType:"undefined"};if(typeof o==="bigint")return{__stxType:"bigint",value:o.toString()};if(typeof o==="function"||typeof o==="symbol")throw TypeError("Non-serializable component input");if(o===null||typeof o!=="object")return o;if(s.has(o))throw TypeError("Circular component input");s.add(o);try{if(o instanceof Date)return{__stxType:"date",value:o.toISOString()};if(Array.isArray(o))return o.map(t);let a=Object.getPrototypeOf(o);if(a!==Object.prototype&&a!==null)throw TypeError("Non-plain component input");let h={};for(let c of Object.keys(o).sort())h[c]=t(o[c]);return h}finally{s.delete(o)}};return JSON.stringify(t(e))}catch{return null}}function cl(e){let s={};for(let[t,o]of Object.entries(e))if(!t.startsWith("__")||t==="__stxServeContext")s[t]=o;return s}function zs(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function ms(e){let s=process.cwd(),t=`${s}\x00${e}`,o=ji.get(t);if(o===void 0)o=Bun.hash(Vi(e,s).split(oe.sep).join("/")).toString(36).slice(0,6),ji.set(t,o);return o}var ji=new Map;function Vi(e,s){if(!oe.isAbsolute(e))return e;let t=(o)=>{try{return Ks.realpathSync(o)}catch{return o}};return oe.relative(t(s),t(e))}function eu(e){return/\bjs\b/.test(e)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(e)}function De(e){return!eu(e)}var Wn=new Map;function G(e){let s;try{s=JSON.stringify(e)}catch{return new Bun.Transpiler(e)}let t=Wn.get(s);if(t)return t;if(Wn.size>=16)Wn.clear();let o=new Bun.Transpiler(e);return Wn.set(s,o),o}var Ni=new WeakMap,ll=256;function Me(e){try{let s=G({loader:"ts",target:"browser",define:S()}),t=Ni.get(s);if(!t)t=new Map,Ni.set(s,t);let o=t.get(e);if(o!==void 0)return o;let a=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");a=a.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let h=[];a=a.replace(/\{!![\s\S]*?!!\}/g,(v)=>{let E=h.length;return h.push(v),`"__STX_EXPR_${E}__"`}),a=a.replace(/\{\{\{[\s\S]*?\}\}\}/g,(v)=>{let E=h.length;return h.push(v),`"__STX_EXPR_${E}__"`}),a=a.replace(/\{\{[\s\S]*?\}\}/g,(v)=>{let E=h.length;return h.push(v),`"__STX_EXPR_${E}__"`});let c=s.transformSync(a);for(let v=0;v<h.length;v++)c=c.replace(`"__STX_EXPR_${v}__"`,h[v]),c=c.replace(`'__STX_EXPR_${v}__'`,h[v]);if(t.size>=ll){let v=t.keys().next();if(!v.done)t.delete(v.value)}return t.set(e,c),c}catch(s){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",s);return e}}function ul(e){let s=[],t=new Set,o=0,a=0,h=e.length,c=(C)=>{a++;while(a<h){if(e[a]==="\\"){a+=2;continue}if(e[a]===C){a++;return}a++}},v=()=>{a++;while(a<h){if(e[a]==="\\"){a+=2;continue}if(e[a]==="`"){a++;return}if(e[a]==="$"&&e[a+1]==="{"){a+=2;let C=1;while(a<h&&C>0)if(e[a]==="{")C++,a++;else if(e[a]==="}")C--,a++;else if(e[a]==="'"||e[a]==='"')c(e[a]);else if(e[a]==="`")v();else a++;continue}a++}},E=()=>{if(e[a]==="/"&&e[a+1]==="/"){while(a<h&&e[a]!==`
|
|
286
|
-
`)a++;return!0}if(e[a]==="/"&&e[a+1]==="*"){a+=2;while(a<h-1&&!(e[a]==="*"&&e[a+1]==="/"))a++;return a+=2,!0}return!1},R=()=>{if(o!==0)return;let C=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(C){let I=C[2].split(",").map((P)=>{let Z=P.trim().split(":");return Z[Z.length-1].trim()});for(let P of I)if(P&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(P)&&!t.has(P))s.push(P),t.add(P);return}let O=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(O){let I=O[2];if(!t.has(I))s.push(I),t.add(I);return}let M=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(M){let I=M[1];if(!t.has(I))s.push(I),t.add(I);return}let N=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(N){let I=N[1];if(!t.has(I))s.push(I),t.add(I)}};while(a<h){if(E())continue;if(e[a]==="'"||e[a]==='"'){c(e[a]);continue}if(e[a]==="`"){v();continue}if(e[a]==="{"){o++,a++;continue}if(e[a]==="}"){o--,a++;continue}if(o===0&&/[a-z]/i.test(e[a])&&(a===0||/\s|[;{}()]/.test(e[a-1])))R();a++}return s}function fl(e){let s=[],t=0,o=0,a=null;for(let h=0;h<e.length;h++){let c=e[h];if(a){if(c==="\\"){h++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="("||c==="["||c==="{")t++;else if(c===")"||c==="]"||c==="}")t--;else if(c===","&&t===0)s.push(e.slice(o,h)),o=h+1}if(o<e.length)s.push(e.slice(o));return s}function pl(e){let s=0,t=null;for(let o=0;o<e.length;o++){let a=e[o];if(t){if(a==="\\"){o++;continue}if(a===t)t=null;continue}if(a==='"'||a==="'"||a==="`"){t=a;continue}if(a==="("||a==="["||a==="{")s++;else if(a===")"||a==="]"||a==="}")s--;else if(a==="="&&s===0){let h=e[o-1],c=e[o+1];if(h==="!"||h==="<"||h===">"||h==="=")continue;if(c==="="||c===">")continue;return o}}return-1}function dl(e,s){try{let t=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!t)return;let o=t.index-1;while(o>=0&&/\s/.test(e[o]))o--;if(e[o]!=="}")return;let a=o,h=0,c=-1;for(;o>=0;o--){let E=e[o];if(E==="}")h++;else if(E==="{"){if(h--,h===0){c=o;break}}}if(c===-1)return;let v=e.slice(c+1,a);for(let E of fl(v)){let R=E.trim();if(!R||R.startsWith("..."))continue;let C=pl(R);if(C===-1)continue;let O=R.slice(0,C).trim();if(!/^[A-Z_$][\w$]*$/i.test(O))continue;if(s[O]!==void 0)continue;let M=R.slice(C+1).trim();if(!M)continue;try{let N=Object.keys(s).filter(Nt),I=Function(...N,`"use strict"; return (${M});`);s[O]=I(...N.map((P)=>s[P]))}catch{}}}catch{}}var gl=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function tu(e,s){let t=e.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!t)return null;let o=t[2].toLowerCase();if(!gl.has(o))return null;let a=new RegExp(`<\\/?${o}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),h=ce(e,(R,C)=>(a.lastIndex=C,a.exec(R)?.index===C?a.lastIndex:-1));if(o==="span"&&/\sdata-stx-scope\s*=/.test(h[0]?.token||""))return null;let c=0,v=!1;for(let R of h){if(c+=R.token.startsWith("</")?-1:1,c<0)return null;if(c===0){if(e.slice(R.end).trim())return null;v=!0;break}}if(!v)return null;let E=t[0].length;return e.slice(0,E)+s+e.slice(E)}async function lr(e,s,t,o,a){let h=e.endsWith(".stx")?e.slice(0,-4):e,c=(Q)=>Q.split("-").map((re)=>re.charAt(0).toUpperCase()+re.slice(1)).join(""),v=t.__importedComponents;if(v){for(let Q of[h,h.toLowerCase(),c(h),j(h)])if(v.has(Q))return!0}let E=[...new Set([`${h}.stx`,`${c(h)}.stx`,`${j(h)}.stx`])],R=typeof a.root==="string"?oe.resolve(a.root):void 0,C=R??oe.dirname(o),O=[],M=(Q)=>{if(Q&&!O.includes(Q))O.push(Q)},N=t.__originalFilePath;if(N)M(oe.join(oe.dirname(N),"components"));M(s),M(a._rootComponentsDir),M(oe.join(oe.dirname(o),"components")),M(a.componentsDir);let I=a._targetComponentFallbackNames?.some((Q)=>Q.toLowerCase()===h.toLowerCase());if(!I)for(let Q of a._targetComponentDirs??[])M(Q);if(R)M(oe.resolve(R,"resources/views/components")),M(oe.resolve(R,"resources/components")),M(oe.resolve(R,"src/components")),M(oe.resolve(R,"components"));for(let Q of a._layerComponentDirs??[])M(Q);let P=a._pluginComponentDirs;if(Array.isArray(P))for(let Q of P)M(typeof Q==="string"?Q:null);if(M(a.fallbackComponentsDir),I)for(let Q of a._targetComponentDirs??[])M(Q);if(h.startsWith("./")||h.startsWith("../"))return n(oe.resolve(oe.dirname(o),`${h}.stx`));let Z=Li(oe.resolve(import.meta.dir,"components")),U=O.map((Q)=>oe.isAbsolute(Q)?Q:oe.resolve(C,Q)),V=`${E.join("\x00")}\x00\x00${U.join("\x00")}`,X=Fs.get(V);if(X!==void 0)return X;let Y=!1;e:for(let Q of U){if(Li(Q)===Z)continue;for(let re of E)if(await n(oe.join(Q,re))){Y=!0;break e}}return Fs.set(V,Y),Y}function Li(e){let s=Vs.get(e);if(s!==void 0)return s;let t=e;try{t=Ks.realpathSync(e)}catch{}return Vs.set(e,t),t}function nu(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function Ga(e){if(!e)return!1;let s=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(s)}function ml(e,s,t){if(!e.includes("{{")&&!e.includes("{!!"))return e;let o=(a,h)=>{let c;try{c=_(a,s)}catch{return h}if(c===void 0||c===null)return"";let v=String(c);if(/<\/style/i.test(v))return console.warn(`[stx] a <style> expression in ${t??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return v};return e.replace(/\{!!([\s\S]*?)!!\}/g,(a,h)=>o(h,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,h)=>o(h,a))}var Bi=new Set;function zi(e,s,t,o){let a=`${e}\x00${s}\x00${o??""}`;if(!process.env.STX_DEBUG&&Bi.has(a))return;Bi.add(a);let h=s?` used in ${s}`:"",c=o?` Cause: ${o}.`:"",v=t.length>0?`
|
|
287
|
-
searched:
|
|
288
|
-
${t.map((E)=>` - ${E}`).join(`
|
|
289
|
-
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${h}, so it rendered as nothing.${c}${v}`)}function Wi(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Do(e){let s=new Set,t=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let o of e){let a;while((a=t.exec(o))!==null)s.add(a[1]);t.lastIndex=0}return[...s]}async function Le(e,s,t,o,a,h,c,v=new Set,E,R=Qe(a),C,O=e){let{extractVariables:M}=await r("stx/variable-extractor",()=>import("./chunk-g64z2e92.js")),N=v??new Set;if(N.has(e))return`[Circular component reference: ${e}]`;let I=new Set(N);I.add(e);let P=typeof s.client==="string"?s.client.trim():"";if("client"in s)delete s.client;let Z=P&&P!=="load"&&nu(P)?P:"";try{let U=(ie)=>ie.split("-").map((se)=>se.charAt(0).toUpperCase()+se.slice(1)).join(""),V=O.endsWith(".stx")?O.slice(0,-4):O,X=null,Y=a.__importedComponents;if(Y){let ie=[V,V.toLowerCase(),U(V),j(V)];for(let se of ie)if(Y.has(se)){X=Y.get(se);break}}let Q=[];if(!X){let ie=[`${V}.stx`,`${U(V)}.stx`,`${j(V)}.stx`],se=[...new Set(ie)],ge=a.__originalFilePath,me=[];if(me.push(...c._layerComponentDirs??[]),ge){let Se=oe.join(oe.dirname(ge),"components");me.push(Se)}if(o)me.push(o);let He=c._rootComponentsDir;if(typeof He==="string"&&!me.includes(He))me.push(He);let Be=oe.join(oe.dirname(h),"components");if(!me.includes(Be))me.push(Be);if(c.componentsDir&&c.componentsDir!==o&&!me.includes(c.componentsDir))me.push(c.componentsDir);let at=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(V),ct=(C?.events??[]).map((Se)=>Se.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),lt=Object.hasOwn(s,"checked")||Boolean(C?.reactiveProps?.includes("checked")),_t=Object.hasOwn(s,"value")||Boolean(C?.reactiveProps?.includes("value")),_n=!ct.includes("valuechange")&&(lt||ct.includes("change")&&!_t),Xn=c._nativeHostAttrs&&/^textinput$/i.test(V),wt=ct.includes("update:value")&&!ct.includes("input"),Vt=c._targetComponentFallbackNames?.some((Se)=>Se.toLowerCase()===V.toLowerCase())&&(!at||_n)&&(!Xn||wt);for(let Se of Vt?[]:c._targetComponentDirs??[])if(Se&&!me.includes(Se))me.push(Se);let nt=typeof c.root==="string"?oe.resolve(c.root):void 0,wn=nt??oe.dirname(h),rt=[];if(nt)rt.push(oe.resolve(nt,"resources/views/components")),rt.push(oe.resolve(nt,"resources/components")),rt.push(oe.resolve(nt,"src/components")),rt.push(oe.resolve(nt,"components"));rt.push(oe.resolve(import.meta.dir,"components"));for(let Se of rt)if(!me.includes(Se))me.push(Se);let Ut=c._pluginComponentDirs;if(Array.isArray(Ut)){for(let Se of Ut)if(typeof Se==="string"&&!me.includes(Se))me.push(Se)}if(c.fallbackComponentsDir&&!me.includes(c.fallbackComponentsDir))me.push(c.fallbackComponentsDir);if(Vt){for(let Se of c._targetComponentDirs??[])if(Se&&!me.includes(Se))me.push(Se)}let Qs=[...new Set(me.map((Se)=>{if(!Se)return Se;return oe.isAbsolute(Se)?Se:oe.resolve(wn,Se)}))];me.length=0,me.push(...Qs);let Jn=`${V}\x00${h}\x00${Qs.join("\x00")}`,Gn=Fn.get(Jn);if(Gn)if(await n(Gn))X=Gn;else Fn.delete(Jn);if(!X&&(V.startsWith("./")||V.startsWith("../")))X=oe.resolve(oe.dirname(h),`${V}.stx`),Q.push(X);else if(!X)for(let Se of me){if(!Se)continue;for(let Sn of se){let $n=oe.join(Se,Sn);if(Q.push($n),await n($n)){X=$n;break}}if(X)break;if(!X)try{let Sn=await import("fs");if(!Sn.statSync(Se,{throwIfNoEntry:!1})?.isDirectory())continue;let so=8,Yn=[{path:Se,depth:0}];while(Yn.length>0&&!X){let vn=Yn.pop();if(vn.depth>=so)continue;let er;try{er=Sn.readdirSync(vn.path,{withFileTypes:!0})}catch{continue}for(let En of er){if(!En.isDirectory())continue;if(En.name==="node_modules"||En.name.startsWith("."))continue;let tr=oe.join(vn.path,En.name);for(let ro of se){let Qn=oe.join(tr,ro);if(Q.push(Qn),await n(Qn)){X=Qn;break}}if(X)break;Yn.push({path:tr,depth:vn.depth+1})}}}catch{}if(X)break}if(X)Fn.set(Jn,X)}if(!X||!await n(X))return zi(e,h,Q),Wi(e);E.add(X);let re;if(Qt.has(X))re=Qt.get(X);else try{re=await Bun.file(X).text(),Qt.set(X,re)}catch(ie){let se=ie instanceof Error?ie.message:String(ie);return zi(e,h,[X],se),Wi(e)}if(C)for(let ie of new Set([...Object.keys(s),...C.reactiveProps??[]])){let se=ie.toLowerCase();if(se.startsWith("aria-")||se.startsWith("data-"))continue;let ge=ie.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${ge}\\b`).test(re))C.declaredProps.add(ie);if(new RegExp(`\\$props\\s*(?:\\.\\s*${ge}\\b|\\[\\s*['"]${ge}['"]\\s*\\])`).test(re)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${ge}['"]`).test(re))C.consumedProps?.add(ie)}let pe=new Set(["__originalFilePath","__importedComponents",Tn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),Ee={};for(let[ie,se]of Object.entries(a))if(!ie.startsWith("__")||pe.has(ie))Ee[ie]=se;let ke=R.length>0?{[Nn]:[...R]}:{},We=t;if(t.includes("@include")){let{processIncludes:ie}=await r("stx/includes",()=>import("./chunk-p38m3947.js"));We=await ie(t,a,h,c,E)}if(/<[A-Z][\w.-]*[\s/>]/.test(We)){let{processComponents:ie}=await r("stx/component-renderer",()=>import("./chunk-6rzshbey.js"));We=await ie(We,{...a,__processedComponents:N,...ke},h,c,E)}let Te=[];if(Ga(We)){let{processExpressions:ie}=await r("stx/expressions",()=>import("./chunk-jr9wfthg.js")),se=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...ke}:R.length>0?{...a,...ke}:a;We=ie(We,se,h);for(let ge of We.matchAll(/\{\{([\s\S]*?)\}\}/g))Te.push(ge[1].trim())}let Ke=q(We),Ge=[],xt=Ke.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(ie,se)=>{let ge=Ke.scripts[Number(se)]||"",me=ge.match(/^<script\b([^>]*)>/i)?.[1]||"",He=me.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Be=!He||["module","text/javascript","application/javascript"].includes(He),at=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${me}`);if(!/\bserver\b/i.test(me)&&Be&&!at)return Ge.push(ge),"";return ge}),{extractSlotContent:Hn}=await r("stx/slots",()=>import("./chunk-rx0ep3v1.js")),ft=Hn(xt),pt={};if(ft.defaultSlot?.trim())pt.default=ft.defaultSlot;for(let[ie,se]of ft.namedSlots)pt[ie]=se.content;let dt=a.__stx_scope_seq??={n:0,key:ms(String(a.__filename??h))},Ot=Vi(e,process.cwd()),it=`stx_${(Ot.endsWith(".stx")?Ot.slice(0,-4):Ot).replace(/[^a-zA-Z0-9]/g,"_")}_${++dt.n}_${dt.key}`,Ve={...Ee,$uid:it,$native:c._nativeHostAttrs===!0,...s,props:s,slot:xt,$slots:pt,__processedComponents:I,__sections:{},__stx_signals_gate:ve(re)||Ga(t),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Te]};dl(re,Ve);let Mt=re,tn=ae(Mt);if(tn)Mt=tn.content.trim();let Kn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Dt=[...re.matchAll(Kn)];for(let[,ie,se]of Dt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(ie))Ae(se,X,c.strict);let Xe=[],jt=null,Zn=Dt.some((ie)=>/\bserver\b/.test(ie[1]||"")&&/\bcache\b/.test(ie[1]||"")),bt=null,Ye=null,Lt=null,nn=0,Bt=null;if(ol(c),Zn&&Us>0){let ie=al({props:s,slot:We,slotContext:t.trim()?cl(Ee):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...R].sort(),layers:c._layerGraph?.layers.map((se)=>se.configFile),uid:it});if(ie!==null){bt=`${X}\x00${b(re)}\x00${ie}`;let se=Vn.get(bt);if(se){for(let ge of se.dependencies)E.add(ge);if(Br(a,se.clientFactories),dt.n+=se.uidsConsumed,se.preservedClientExpressions.length>0){let ge=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let me of se.preservedClientExpressions)ge.add(me);a.__stx_preserved_client_expressions=[...ge]}return se.output}Ye=new Set(E),Lt=Nr(a),nn=dt.n,Bt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let zt=new Set;for(let ie of Dt){let se=ie[1]||"",ge=ie[2]||"",me=se.includes("server");if(De(se)&&ge.trim())ge=Me(ge);if(me&&ge){for(let Be of Ie(ge))zt.add(Be);try{await M(ge,Ve,X,{onFailure:(Be)=>{if(Be.kind!=="unknown")jt=Be.kind}})}catch(Be){}}if(!me){let Be=ge.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),at=Be.includes("{{")&&Be.includes("}}"),ct=Be.includes("{!!")&&Be.includes("!!}");if(at||ct)Be=Lo(Be,Ve,X);let lt=se.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Xe.push(`<script${lt}>${Be}</script>`)}}let Ze=q(re).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Wt=Ze?Ze[1]:"",qn=Ze?Ze[2]:"",tt="",J=Wt&&/\bscoped\b/i.test(Wt);if(Ze)tt=`<style${Wt}>${ml(qn,Ve,X)}</style>`;let ee=Mt;if(ee=ee.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Ze)ee=ee.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let ie=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,se=[];if(ee=ee.replace(ie,(ge,me)=>{let He=me.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(He)se.push(`<style${He[1]}>${He[2]}</style>`);return""}),ee=ee.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),se.length>0)tt=`${tt}${se.join(`
|
|
290
|
-
`)}`}if(t&&ee.includes("{{ text || slot }}"))ee=ee.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>t);let{applySlots:fe}=await r("stx/slots",()=>import("./chunk-rx0ep3v1.js")),{defaultSlot:_e,namedSlots:$e}=ft,ze=c._nativeHostAttrs===!0&&Xe.length>0||Xe.some((ie)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(ie)),gt=(ie)=>ze?gi(ie,it):ie,Ys=new Map([...$e].map(([ie,se])=>[ie,{...se,content:gt(se.content)}]));ee=await fe(ee,gt(_e),Ys,Ve,ze?it:"");let hn=Do(Xe),xn=(Array.isArray(Ve.__stx_client_signal_names)?Ve.__stx_client_signal_names:[]).filter((ie)=>!zt.has(ie));if(hn.length>0||xn.length>0)Ve.__stx_client_signal_names=[...new Set([...xn,...hn])];else delete Ve.__stx_client_signal_names;let Ft=R.filter((ie)=>!zt.has(ie)&&!(ie in s));if(Ft.length>0)Ve[Nn]=Ft;let bn={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:oe.dirname(X),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||ze||Xe.length===0,defaultLayout:void 0};Ve.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:yn}=await r("stx/process",()=>import("./chunk-8tdz8svp.js")),ot=await yn(ee,Ve,X,bn,E),yt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let ie of ot.matchAll(/\{\{([\s\S]*?)\}\}/g))yt.add(ie[1].trim());if(yt.size>0)a.__stx_preserved_client_expressions=[...yt];let qe=it,Ue=ot;if(ze){let ie="";if(Object.keys(s).length>0)try{ie=` data-stx-props="${zs(JSON.stringify(s))}"`}catch{}let se=Z?` stx-hydrate="${zs(Z)}"`:"",ge=Object.fromEntries(Object.entries(pt).map(([lt,_t])=>[lt,Boolean(_t)])),me=Object.keys(ge).length>0?` data-stx-slots="${zs(JSON.stringify(ge))}"`:"",He=` data-stx-scope="${qe}"${ie}${me}${se}`,Be=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(ot),at=Be?"span":"div";Ue=tu(ot,He)??`<${at}${He} data-stx-component-wrapper${Be?' style="display:contents"':""}>${ot}</${at}>`;let ct=await Promise.all(Xe.map(async(lt)=>{let _t=lt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!_t)return lt;let[,_n,Xn]=_t,wt=await bl(Xn,X,c.buildMode==="compile"),Vt=dn(wt.clientCode,Oe(Ve)),{vendorStyleTags:nt}=wt,wn=Vt?`function(__scopeId) {
|
|
291
|
-
${Vt}
|
|
292
|
-
return (${wt.factoryBody})(__scopeId);
|
|
293
|
-
}`:wt.factoryBody,rt=Z?null:ws(a,wn),Ut=rt?`window.__stxComponentFactories[${JSON.stringify(rt)}](${JSON.stringify(qe)});`:`(${wn})(${JSON.stringify(qe)});`;if(Z)return`${nt}<script type="stx/island" data-stx-island="${qe}" data-stx-scoped data-stx-owner="${qe}"${_n}>${Ut}</script>`;return`${nt}<script data-stx-scoped data-stx-run="always" data-stx-owner="${qe}"${_n}>${Ut}</script>`}));if(Ue=Ue+`
|
|
294
|
-
`+ct.join(`
|
|
295
|
-
`),tt)Ue+=`
|
|
296
|
-
`+tt}else{if(tt)Ue+=`
|
|
297
|
-
`+tt;if(Xe.length>0){let ie=Ve.__stx_event_bindings||[],se=Oe(Ve),ge=await Promise.all(Xe.map(async(me)=>{let He=me.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!He)return me;return await Ne(He[1],{eventBindings:ie,templateContent:Ue,filePath:X,projectRoot:process.cwd(),serverData:se,instanceId:it})}));Ue+=`
|
|
298
|
-
`+ge.join(`
|
|
299
|
-
`),Ve.__stx_event_bindings=[]}}if(J){let ie=us(Ue,X);if(ie.hasScoped)Ue=ie.html}if(bt&&Ye){let ie=Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[];Vn.set(bt,{output:Ue,dependencies:[...E].filter((se)=>!Ye.has(se)),clientFactories:Lt?Lr(a,Lt):[],uidsConsumed:dt.n-nn,preservedClientExpressions:Bt?ie.filter((se)=>!Bt.has(se)):[]})}if(jt)Ue=`<!--stx-render-failed:${jt}-->${Ue}`;return Ge.length>0?`${Ue}
|
|
300
|
-
${Ge.join(`
|
|
301
|
-
`)}`:Ue}catch(U){if(U instanceof z)throw U;return`[Error processing component: ${U instanceof Error?U.message:String(U)}]`}finally{N.delete(e)}}async function n(e){return Bun.file(e).exists()}function Hs(e,s){let t=oe.resolve(s),o=oe.resolve(e),a=t.endsWith(oe.sep)?t:t+oe.sep;if(o===t||o.startsWith(a))return o;return null}async function hl(e,s,t,o){let a=s.startsWith("layouts/")?s.slice(8):s,h=oe.join(e,a);for(let c of h.endsWith(".stx")?[h]:[h,`${h}.stx`])if(await n(c)){if(o)console.log(`Found layout in ${e}: ${c}`);return t?.add(c),c}return null}async function pn(e,s,t,o){let a=await xl(e,s,t,o);if(a===null)return null;let h=Hs(a,process.cwd());if(h)return h;let c=[t.root,t.layoutsDir,t.fallbackLayoutsDir,t.componentsDir,t.partialsDir,t.pagesDir,...t._layerLayoutDirs??[]].filter((v)=>typeof v==="string"&&v.length>0);for(let v of c){let E=oe.isAbsolute(v)?v:oe.resolve(process.cwd(),v);if(Hs(a,E))return oe.resolve(a)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${a} (template: ${e}, from: ${s})`),null}async function xl(e,s,t,o){if(t.debug)console.log(`Resolving template path: ${e} from ${s}`);let a=oe.dirname(s),h=process.cwd();if(e.startsWith("/")){let M=oe.join(h,e),N=Hs(M,h);if(!N)return console.warn(`[stx] rejected template path that escapes project root: ${e} (from ${s})`),null;if(t.debug)console.log(`Checking absolute path: ${N}`);if(await n(N)&&o)o.add(N);return N}let c=oe.join(a,e);if(await n(c)){if(t.debug)console.log(`Found direct path: ${c}`);if(o)o.add(c);return c}if(!e.endsWith(".stx")&&!e.endsWith(".jsx")&&!e.endsWith(".tsx"))for(let M of[".stx",".tsx",".jsx"]){let N=`${c}${M}`;if(await n(N)){if(t.debug)console.log(`Found direct path with extension: ${N}`);if(o)o.add(N);return N}}let v=[];if(v.push(...t._layerLayoutDirs??[]),t.layoutsDir)v.push(oe.isAbsolute(t.layoutsDir)?t.layoutsDir:oe.resolve(process.cwd(),t.layoutsDir));let E=oe.resolve(a),R=process.cwd();for(let M=0;M<10;M++){let N=oe.join(E,"layouts"),I=!1;try{I=Ks.statSync(N,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(I){v.push(N);break}let P=oe.dirname(E);if(P===E||P.length<R.length)break;E=P}for(let M of v){let N=await hl(M,e,o,t.debug);if(N)return N}if(t.fallbackLayoutsDir){let M=oe.isAbsolute(t.fallbackLayoutsDir)?t.fallbackLayoutsDir:oe.resolve(process.cwd(),t.fallbackLayoutsDir),N=e.startsWith("layouts/")?e.slice(8):e,I=[oe.join(M,N)];if(!e.endsWith(".stx"))I.push(`${I[0]}.stx`);for(let P of I)if(await n(P)){if(t.debug)console.log(`Found in options.fallbackLayoutsDir: ${P}`);if(o)o.add(P);return P}}if(e.startsWith("layouts/")||e.includes("/layouts/")){let M=e.split("layouts/"),N=oe.join(t.partialsDir||a,"layouts",M[1]);if(await n(N)){if(t.debug)console.log(`Found in layouts path: ${N}`);if(o)o.add(N);return N}if(!N.endsWith(".stx")){let I=`${N}.stx`;if(await n(I)){if(t.debug)console.log(`Found in layouts path with extension: ${I}`);if(o)o.add(I);return I}}}if(t.partialsDir){let M=oe.join(t.partialsDir,"layouts");if(await n(M)){let N=oe.join(M,e);if(await n(N)){if(t.debug)console.log(`Found in partials layouts dir: ${N}`);if(o)o.add(N);return N}if(!e.endsWith(".stx")){let I=`${N}.stx`;if(await n(I)){if(t.debug)console.log(`Found in partials layouts dir with extension: ${I}`);if(o)o.add(I);return I}}}}let C=t.partialsDir||oe.join(process.cwd(),"views"),O=oe.join(C,e);if(await n(O)){if(t.debug)console.log(`Found in views path: ${O}`);if(o)o.add(O);return O}if(!e.endsWith(".stx")){let M=`${O}.stx`;if(await n(M)){if(t.debug)console.log(`Found in views path with extension: ${M}`);if(o)o.add(M);return M}}if(a.includes("temp")){let M=oe.join(oe.dirname(a),"layouts",e);if(await n(M)){if(t.debug)console.log(`Found in temp layouts dir: ${M}`);if(o)o.add(M);return M}if(!e.endsWith(".stx")){let N=`${M}.stx`;if(await n(N)){if(t.debug)console.log(`Found in temp layouts dir with extension: ${N}`);if(o)o.add(N);return N}}}if(t.debug)console.warn(`Template not found after trying all paths: ${e} (referenced from ${s})`);else console.warn(`Template not found: ${e} (referenced from ${s})`);return null}function Ka(e,s,t){let o=0,a="",h="";try{if(typeof s==="number"&&s>=0){let c=e.split(`
|
|
302
|
-
`),v=0;for(let E=0;E<c.length;E++)if(v+=c[E].length+1,v>=s){o=E+1,a=c[E].trim();let R=Math.max(0,E-2),C=Math.min(c.length,E+3);h=c.slice(R,C).map((O,M)=>{let N=R+M+1;return`${N===o?"> ":" "}${N}: ${O}`}).join(`
|
|
303
|
-
`);break}}else if(t){let c=e.indexOf(t);if(c>=0)return Ka(e,c)}}catch{}return{lineNumber:o,lineContent:a,context:h}}var we={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"};function m(e,s,t,o,a,h){let{lineNumber:c,context:v}=Ka(o,a,h),E=t.split("/").pop(),R=0;if(typeof a==="number"&&a>=0&&o){let O=o.lastIndexOf(`
|
|
304
|
-
`,Math.max(0,a-1));R=a-(O+1)+1}let C="";if(c>0)C+=`
|
|
305
|
-
${t}:${c}${R>0?`:${R}`:""}: ${e.toLowerCase()} error: ${s}
|
|
306
|
-
`;if(C+=`
|
|
307
|
-
${we.bold}${we.red}\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E${we.reset}
|
|
308
|
-
`,C+=`${we.bold}${we.red}\u2502${we.reset} ${we.bold}${we.bgRed} ERROR ${we.reset} ${we.red}${e} Error${we.reset}${" ".repeat(Math.max(0,43-e.length))}${we.bold}${we.red}\u2502${we.reset}
|
|
309
|
-
`,C+=`${we.bold}${we.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${we.reset}
|
|
310
|
-
`,C+=`
|
|
311
|
-
${we.cyan}${we.bold}File:${we.reset} ${we.dim}${E}${we.reset}`,c>0)C+=` ${we.gray}(line ${c}${R>0?`, col ${R}`:""})${we.reset}`;if(C+=`
|
|
312
|
-
${we.yellow}${we.bold}Message:${we.reset} ${s}
|
|
313
|
-
`,v)C+=`
|
|
314
|
-
${we.blue}${we.bold}Context:${we.reset}
|
|
315
|
-
${we.dim}${v}${we.reset}
|
|
316
|
-
`;return C}function de(){Qt.clear(),Fn.clear(),Fs.clear(),Vs.clear(),Vn.clear()}function Rp(){return{size:Qt.size,maxSize:500}}var Ws=y(128);async function bl(e,s,t){let o=b(e,s,t),a=Ws.get(o);if(a){if(as(a.deps))return a;Ws.delete(o)}let h=Io(e,{filePath:s,projectRoot:process.cwd()}),c=h.code,v=Oo(h.styles);c=Pt(c).code;let{hasUserImports:E,bundleClientScript:R}=await r("stx/client-script-bundler",()=>import("./chunk-e6p0k6br.js")),C=[],O=!1;if(E(c)){let V=c;c=await R(V,s,{projectRoot:process.cwd(),minify:t,collectInputs:C}),O=c===V}let{stripStxRuntimeImports:M}=await r("stx/signal-processing",()=>import("./chunk-f8agvh5v.js"));c=M(c);let N=T(c),I=ul(N),P=new Set(L(N,!0).split(",").map((V)=>V.trim())),Z=`function(__scopeId) {
|
|
317
|
-
${st("const",[...ic,...I],N)}
|
|
318
|
-
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
319
|
-
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
320
|
-
__scopeVars.$refs = __scopeVars.$refs || {};
|
|
321
|
-
const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
|
|
322
|
-
const __previousCurrentProps = window.__STX_CURRENT_PROPS__;
|
|
323
|
-
// A clone the runtime is setting up may not be in the document yet (rows
|
|
324
|
-
// a loop builds inside a closed :if), where a lookup cannot see it, so the
|
|
325
|
-
// runtime hands its root over in __STX_SETUP_ROOT__ (signals.ts).
|
|
326
|
-
const __setupRoot = window.__STX_SETUP_ROOT__;
|
|
327
|
-
const __componentElement = (__setupRoot && __setupRoot.getAttribute('data-stx-scope') === __scopeId && __setupRoot) || document.querySelector('[data-stx-scope="' + __scopeId + '"]');
|
|
328
|
-
__scopeVars.$slots = Object.create(null);
|
|
329
|
-
if (__componentElement) {
|
|
330
|
-
try { Object.assign(__scopeVars.$slots, JSON.parse(__componentElement.getAttribute('data-stx-slots') || '{}')); }
|
|
331
|
-
catch {}
|
|
332
|
-
}
|
|
333
|
-
window.__STX_CURRENT_ELEMENT__ = __componentElement;
|
|
334
|
-
let __componentProps = __componentElement && __componentElement.__stx_props;
|
|
335
|
-
if (!__componentProps && __componentElement) {
|
|
336
|
-
try { __componentProps = JSON.parse(__componentElement.getAttribute('data-stx-props') || '{}'); }
|
|
337
|
-
catch { __componentProps = {}; }
|
|
338
|
-
}
|
|
339
|
-
window.__STX_CURRENT_PROPS__ = __componentProps && typeof __componentProps === 'object' && !Array.isArray(__componentProps) ? __componentProps : {};
|
|
340
|
-
|
|
341
|
-
// Scope-specific lifecycle callbacks. The queues drain as they run; the
|
|
342
|
-
// hook lists keep what setup registered, because a component behind an :if
|
|
343
|
-
// unmounts at each hide and mounts again at each show (signals.ts,
|
|
344
|
-
// suspendSubtreeScopes).
|
|
345
|
-
if (__scopeVars.__suspended && !__scopeVars.__mounted) {
|
|
346
|
-
// Set up again after an :if hid it -- a <template :if> clones the
|
|
347
|
-
// component afresh on every show, and the clone's script runs. This run's
|
|
348
|
-
// hooks close over this run's state, so they replace the ones the hide
|
|
349
|
-
// kept for a re-show rather than queueing beside them.
|
|
350
|
-
__scopeVars.__mountCallbacks = [];
|
|
351
|
-
__scopeVars.__destroyCallbacks = [];
|
|
352
|
-
__scopeVars.__mountHooks = [];
|
|
353
|
-
__scopeVars.__destroyHooks = [];
|
|
354
|
-
// So do its effects: the last run's watched a clone that is gone.
|
|
355
|
-
if (typeof __scopeVars.__disposeEffects === 'function') __scopeVars.__disposeEffects();
|
|
356
|
-
__scopeVars.__disposeEffects = null;
|
|
357
|
-
}
|
|
358
|
-
__scopeVars.__mountCallbacks = __scopeVars.__mountCallbacks || [];
|
|
359
|
-
__scopeVars.__destroyCallbacks = __scopeVars.__destroyCallbacks || [];
|
|
360
|
-
__scopeVars.__mountHooks = __scopeVars.__mountHooks || [];
|
|
361
|
-
__scopeVars.__destroyHooks = __scopeVars.__destroyHooks || [];
|
|
362
|
-
let __registeringSetupHooks = true;
|
|
363
|
-
const onMount = (fn) => { __scopeVars.__mountCallbacks.push(fn); __scopeVars.__mountHooks.push(fn); };
|
|
364
|
-
const onDestroy = (fn) => {
|
|
365
|
-
__scopeVars.__destroyCallbacks.push(fn);
|
|
366
|
-
// A teardown registered inside onMount belongs to this mount alone.
|
|
367
|
-
// Replaying it AND registering the next mount's teardown doubles cleanup.
|
|
368
|
-
if (__registeringSetupHooks) __scopeVars.__destroyHooks.push(fn);
|
|
369
|
-
};
|
|
370
|
-
// The effects this setup makes (effect, watch) belong to the scope and are
|
|
371
|
-
// disposed with it (disposeSubtreeScopes in the runtime), as its bindings
|
|
372
|
-
// are. Untracked, one reading a store kept running for a component the
|
|
373
|
-
// router had long swapped out.
|
|
374
|
-
const __endEffects = window.stx._beginEffects ? window.stx._beginEffects() : null;
|
|
375
|
-
|
|
376
|
-
try {
|
|
377
|
-
${N}
|
|
378
|
-
|
|
379
|
-
// Register all defined signals and functions in this scope
|
|
380
|
-
const __localVars = {};
|
|
381
|
-
try {
|
|
382
|
-
${I.map((V)=>P.has(V)?`Object.defineProperty(__localVars, '${V}', ${ns(V)});`:`if (typeof ${V} !== 'undefined') __localVars['${V}'] = ${V};`).join(`
|
|
383
|
-
`)}
|
|
384
|
-
}
|
|
385
|
-
catch (e) {}
|
|
386
|
-
Object.defineProperties(__scopeVars, Object.getOwnPropertyDescriptors(__localVars));
|
|
387
|
-
if (typeof __stxLiveBindings !== 'undefined') Object.defineProperties(__scopeVars, Object.getOwnPropertyDescriptors(__stxLiveBindings));
|
|
388
|
-
}
|
|
389
|
-
finally {
|
|
390
|
-
__registeringSetupHooks = false;
|
|
391
|
-
if (__endEffects) {
|
|
392
|
-
const __previousDispose = __scopeVars.__disposeEffects;
|
|
393
|
-
const __disposeSetup = __endEffects();
|
|
394
|
-
__scopeVars.__disposeEffects = typeof __previousDispose === 'function'
|
|
395
|
-
? function() { __previousDispose(); __disposeSetup(); }
|
|
396
|
-
: __disposeSetup;
|
|
397
|
-
}
|
|
398
|
-
window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
|
|
399
|
-
window.__STX_CURRENT_PROPS__ = __previousCurrentProps;
|
|
400
|
-
}
|
|
401
|
-
}`,U={vendorStyleTags:v,factoryBody:Z,clientCode:N,deps:rr([...C,...h.styles.map((V)=>V.resolvedPath)])};if(!O&&h.unresolved.length===0)Ws.set(o,U);return U}var un=["module","exports","require","props","$props","$bool","$num","defineProps","withDefaults","defineClientPayload","useServerData","useRuntimeConfig","useServerRuntimeConfig","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","setResponseStatus","setResponseHeader","notFound","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params"];var yl=100,_l=599,qs="__stxResponseStatus",en="__stxResponseHeaders";function Un(e){return typeof e==="number"&&Number.isInteger(e)&&e>=yl&&e<=_l}function cn(e){for(let s of e.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let t=s[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!t)continue;let o=Number(t[1]);if(Un(o))return o}return}function Zs(e,s){if(!e||typeof e!=="object")return!1;let t=typeof s==="string"&&/^\d+$/.test(s.trim())?Number(s.trim()):s;if(!Un(t))return!1;return e[qs]=t,!0}function wl(e,s,t){if(!e||typeof e!=="object")return;let o=String(s??"").trim();if(!o)return;e[en]={...e[en],[o]:String(t)}}function Rt(e){let s=e?.[qs];return Un(s)?s:void 0}function At(e){let s=e?.[en];if(!s||typeof s!=="object")return;let t=Object.entries(s).map(([o,a])=>[o,String(a)]);return t.length>0?Object.fromEntries(t):void 0}function Ma(e,s){if(!e||!s||e===s||typeof s!=="object")return;let t=Rt(e);if(t!==void 0)s[qs]=t;let o=At(e);if(o)s[en]={...s[en],...o}}function ds(e){return{setResponseStatus:(s)=>{Zs(e,s)},notFound:(s=404)=>{let t=Un(s)&&s>=400?s:404;Zs(e,t)},setResponseHeader:(s,t)=>{wl(e,s,t)}}}function La(e,s,t={}){if(!e.includes("@status"))return e;let{filePath:o,buildMode:a}=t,h=a==="compile",c="",v=0,E=/@status\s*\(/g,R;while((R=E.exec(e))!==null){let C=Sl(e,R.index+R[0].length-1);if(C<0)break;let O=e.slice(R.index+R[0].length,C).trim(),M=/^\d+$/.test(O)?Number(O):l(O,s),N=o?` in ${o}`:"";if(h)console.warn(`[stx] @status(${O})${N} is skipped when precompiling: the build has no request, so the branch it sits in is not the one a visitor will get. Call notFound() or setResponseStatus(${O}) from <script server> instead \u2014 that runs per request.`);else if(!Zs(s,M))console.warn(`[stx] @status(${O})${N} is not an HTTP status (100-599) \u2014 ignoring it.`);c+=e.slice(v,R.index),v=C+1+(e.slice(C+1).match(/^[^\S\n]*\n?/)?.[0].length??0),E.lastIndex=v}return v===0?e:c+e.slice(v)}function Sl(e,s){let t=1,o=null,a=!1;for(let h=s+1;h<e.length;h++){let c=e[h];if(a){a=!1;continue}if(o){if(c==="\\")a=!0;else if(c===o)o=null;continue}if(c==='"'||c==="'"||c==="`"){o=c;continue}if(c==="(")t++;else if(c===")"&&--t===0)return h}return-1}var Ui=new Set(un),$l=new Set(["props","$props","defineProps"]),vl=new Set(["stx","@stacksjs/stx"]),Hi=y(128),Ki=y(64);function El(e){let s=[],t=0,o=e.split(`
|
|
402
|
-
`);for(let a of o){let h=t,c=null,v=!1;for(let E=0;E<a.length;E++){let R=a[E];if(v){v=!1;continue}if(R==="\\"){v=!0;continue}if(c){if(R===c)c=null;continue}if(R==="'"||R==='"'||R==="`"){c=R;continue}if(R==="/"&&E+1<a.length&&a[E+1]==="/")break;if(R==="{")t++;else if(R==="}")t--}if(h===0){let E=a.match(/(?:const|let|var)\s+(\w+)\s*=/);if(E)s.push(E[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(a)){let R=a.match(/(?:const|let|var)\s+(\w+)/);if(R)s.push(R[1])}else{let R=a.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(R){let O=R[1].slice(1,-1).split(",").map((M)=>{let N=M.split(":");return(N.length>1?N[1]:N[0]).trim()}).filter((M)=>/^\w+$/.test(M));s.push(...O)}}}}return[...new Set(s)]}function zl(e){let s=e;s=s.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),s=s.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),s=s.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),s=s.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),s=s.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function t(o){if(!o.includes(":"))return o;let a=[],h="",c=0,v=0,E=null;for(let R=0;R<o.length;R++){let C=o[R];if(E){if(h+=C,C===E)E=null;continue}if(C==='"'||C==="'"||C==="`"){E=C,h+=C;continue}if(C==="<")c++;else if(C===">"&&c>0)c--;else if(C==="(")v++;else if(C===")")v--;if(C===","&&c===0&&v===0){a.push(h),h="";continue}h+=C}if(h)a.push(h);return a.map((R)=>{let C=R.trim(),O=C.startsWith("..."),M=O?C.slice(3):C,N=-1,I=0;for(let Q=0;Q<M.length;Q++)if(M[Q]==="<")I++;else if(M[Q]===">")I--;else if(M[Q]===":"&&I===0){N=Q;break}if(N===-1)return R;let Z=M.substring(0,N).trim().replace(/\?$/,""),U=M.substring(N+1),V=-1,X=0;for(let Q=0;Q<U.length;Q++)if(U[Q]==="<")X++;else if(U[Q]===">")X--;else if(U[Q]==="="&&X===0){V=Q;break}let Y=O?"...":"";if(V!==-1)return`${Y}${Z} = ${U.substring(V+1).trim()}`;return`${Y}${Z}`}).join(", ")}s=s.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(o,a,h)=>{if(!h.includes(":"))return o;return`${a}(${t(h)})`});{let o=/\b(function\s+\w*\s*)\(/g,a,h=[];while((a=o.exec(s))!==null){let c=a.index+a[0].length-1,v=1,E=c+1,R=0,C=null;while(E<s.length&&v>0){let N=s[E];if(C){if(N===C)C=null;E++;continue}if(N==='"'||N==="'"||N==="`"){C=N,E++;continue}if(N==="<")R++;else if(N===">"&&R>0)R--;else if(R===0){if(N==="(")v++;else if(N===")")v--}if(v>0)E++}if(v!==0)continue;let O=s.substring(c+1,E);if(!O.includes(":"))continue;let M=t(O);h.push({start:c+1,end:E,replacement:M})}for(let c=h.length-1;c>=0;c--){let{start:v,end:E,replacement:R}=h[c];s=s.substring(0,v)+R+s.substring(E)}}return s=s.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(o,a)=>{if(!a.includes(":"))return o;if(a.includes("{")||a.includes("}"))return o;return`(${a.split(",").map((c)=>{let[v,...E]=c.split("="),R=v.split(":")[0].trim();if(E.length>0)return`${R} = ${E.join("=").trim()}`;return R}).join(", ")}) =>`}),s=s.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),s=s.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),s=s.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),s=s.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),s=s.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),s=s.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),s=s.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),s=s.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),s=s.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),s=s.replace(/\n\s*\n\s*\n/g,`
|
|
403
|
-
|
|
404
|
-
`),s}function Hl(e){return e.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(s,...t)=>{let[,o,a]=t,h=o??a;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(h)?"":s})}function Vl(e){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(e)}function Ul(e){if(e instanceof SyntaxError)return!0;let s=e instanceof Error?e.message:String(e);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(s)}function Wl(e){if(!/is not defined|can't find variable/i.test(e))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(e)}var Zi=new Set;async function g(e,s,t,o={}){if(!e.trim())return;let a=S(),h=b(e,JSON.stringify(a)),c=Hi.get(h);if(c===void 0){try{let J=G({loader:"ts",target:"browser",define:a}),ee=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");ee=ee.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),c=J.transformSync(ee)}catch{c=zl(e)}Hi.set(h,c)}let v={exports:{}},E=v.exports,R=Ct.cwd(),C={},O=[...c.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((J)=>J[1]).filter((J)=>!J.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(J)),M=new Map;for(let J of O)try{if(J.startsWith(".")){C[J]=await import(Je.resolve(Je.dirname(t),J));continue}let ee=Je.resolve(R,"node_modules",J),fe=Je.join(ee,"package.json"),_e=JSON.parse(f("fs").readFileSync(fe,"utf8")),$e=_e.main||"index.js";if(_e.exports){let ze=typeof _e.exports==="string"?_e.exports:_e.exports["."];if(typeof ze==="string")$e=ze;else if(ze?.bun)$e=ze.bun;else if(ze?.import)$e=ze.import;else if(ze?.default)$e=ze.default}C[J]=await import(Je.resolve(ee,$e))}catch(ee){if(J.startsWith("."))M.set(J,ee instanceof Error?ee.message:String(ee))}let N=(J)=>{if(C[J])return C[J];let ee=M.get(J);if(ee!==void 0)throw Error(`Cannot require '${J}' from ${t}: ${ee}`);return f(J)},I=s.props||{},P=(J)=>{if(!J)return I;let ee={};for(let[fe,_e]of Object.entries(J)){let $e=I[fe];if($e!==void 0)ee[fe]=$e;else if(typeof _e==="function")ee[fe]=_e();else ee[fe]=_e}return ee};for(let[J,ee]of Object.entries(I))Object.defineProperty(P,J,{value:ee,enumerable:!0,configurable:!0,writable:!0});let Z=(J,ee=!1)=>{if(J===void 0||J===null)return ee;if(typeof J==="string"){let fe=J.trim().toLowerCase();if(fe===""||fe==="true"||fe==="1"||fe==="on"||fe==="yes")return!0;if(fe==="false"||fe==="0"||fe==="off"||fe==="no")return!1;return!0}return Boolean(J)},U=(J,ee=0)=>{if(J===void 0||J===null)return ee;if(typeof J==="string"){let _e=J.trim();if(_e==="")return ee;let $e=Number(_e);return Number.isFinite($e)?$e:ee}let fe=Number(J);return Number.isFinite(fe)?fe:ee};for(let J of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(I,J))continue;try{Object.defineProperty(P,J,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let V=(J)=>{if(!J)return I;let ee={...I};for(let[fe,_e]of Object.entries(J)){let $e=_e&&typeof _e==="object"&&!Array.isArray(_e)?_e:{type:_e};if(ee[fe]===void 0&&$e.default!==void 0)ee[fe]=typeof $e.default==="function"?$e.default():$e.default}return ee},X=()=>s.slots||{},Y=(J,ee)=>{let fe={...J};for(let[_e,$e]of Object.entries(ee))if(fe[_e]===void 0)if(typeof $e==="function")fe[_e]=$e();else fe[_e]=$e;return fe},Q=(J)=>{let ee=()=>J;return ee.set=(fe)=>{},ee.update=(fe)=>{},ee},re=(J)=>{let ee,fe=!1;return()=>{if(!fe)try{ee=J(),fe=!0}catch{ee=void 0}return ee}},pe=(J)=>{},Ee=(J)=>J(),ke=(J)=>{},We=(J)=>{},Te=ds(s);function Ke(J){let ee=J||{};if(ee.title!==void 0||ee.description!==void 0)pt({title:ee.title,description:ee.description})}function Ge(J){if(!J||typeof J!=="object")return;let ee=s.__stxClientPayload??{};Object.assign(ee,J),s.__stxClientPayload=ee}let xt=()=>{let J=s.__stxServeContext,ee=s.__stxServeSearch??J?.search??"",fe=J?.path??"",_e=Object.fromEntries(new URLSearchParams(ee)),$e=s.query,ze=Object.keys(_e).length>0?_e:$e??{},gt=ee||(Object.keys(ze).length>0?`?${new URLSearchParams(ze).toString()}`:"");return{params:s.params??{},query:ze,path:fe,name:"",fullPath:fe+gt,hash:"",matched:[]}},Hn=()=>({push:(J)=>{},replace:(J)=>{},back:()=>{},forward:()=>{},go:(J)=>{}}),ft=(J)=>{let ee=s.__stx_runtime_head||{};s.__stx_runtime_head=Fe(ee,xe(J||{},{known:Ss,source:"useHead()"}))},pt=(J)=>{ft(ks(J||{}))},dt=(J)=>({value:J}),Ot=(J)=>J,Js=(J)=>({value:typeof J==="function"?J():J}),it=(J,ee)=>{},Ve=(J)=>{},Mt=(J)=>{},tn=(J)=>J?J():Promise.resolve(),Kn=(J)=>(ee,...fe)=>{},Dt=(J)=>{},Xe=(J,ee)=>{},jt=(J,ee)=>ee,Zn=()=>({value:"light"}),bt=()=>Q(!1),Ye=(J)=>Q(!1),Lt=()=>Q(!1),nn=()=>Ye("(prefers-color-scheme: dark)"),Bt=()=>Ye("(prefers-color-scheme: light)"),zt=()=>Ye("(prefers-reduced-motion: reduce)"),Gs=()=>Ye("(prefers-contrast: more)"),Ze={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},Wt=new Proxy(Ze,{get(J,ee){if(ee in J)return J[ee];return},set(J,ee,fe){return J[ee]=fe,!0}}),qn={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},tt=console;try{let J=Po(c,t),ee=new Set(Object.keys(I)),fe=Object.keys(s).filter((se)=>!ee.has(se)&&!$l.has(se)&&Nt(se)),_e=fe.map((se)=>s[se]);if(!fe.includes("__stxServeContext"))fe.push("__stxServeContext"),_e.push(void 0);if(!ee.has("cookies")){let se=s.cookies??s.__stxServeContext?.cookies??{},ge=fe.indexOf("cookies");if(ge<0)fe.push("cookies"),_e.push(se);else _e[ge]=se}let $e=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),ze=[],gt=[];for(let[se,ge]of Object.entries(I)){if(!Nt(se))continue;if($e.has(se))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${se}\\b`).test(J))continue;ze.push(se),gt.push(ge)}let hn=El(J).map((se)=>`module.exports.${se} = typeof ${se} !== 'undefined' ? ${se} : module.exports.${se};`).join(`
|
|
405
|
-
`),xn=s.params??{},Ft=[],bn=[];for(let se=0;se<fe.length;se++){if(fe[se]==="params")continue;Ft.push(fe[se]),bn.push(_e[se])}let yn=[...un,...ze,...Ft],ot=`return (async () => {
|
|
406
|
-
${J}
|
|
407
|
-
${hn}
|
|
408
|
-
return module.exports
|
|
409
|
-
})()`,yt=b(ot,yn.join("\x00")),qe=Ki.get(yt);if(!qe)qe=Function(...yn,ot),Ki.set(yt,qe);let Ue=s.__stx_options?.runtimeConfig;if(Ue||/\buse(?:Server)?RuntimeConfig\b/.test(c))await gn(s,t,Ue);let ie=await je(s.__stx_runtime_config??mn()??A(),()=>ur(s,()=>qe(v,E,N,I,P,Z,U,V,Y,Ge,fr,Bo,ys,Q,re,pe,Ee,ke,We,Ke,xt,Hn,ft,pt,Te.setResponseStatus,Te.setResponseHeader,Te.notFound,dt,Ot,Js,it,Ve,Mt,tn,Kn,Dt,X,Xe,jt,Zn,bt,Ye,Lt,nn,Bt,zt,Gs,Wt,qn,tt,Ze.confirm,Ze.alert,Ze.fetch,xn,...gt,...bn)));if(o.preserveExisting){for(let[se,ge]of Object.entries(ie))if(!(se in s)||s[se]===void 0)s[se]=ge}else Object.assign(s,ie);for(let[se,ge]of Object.entries(I))if(!(se in s))s[se]=ge}catch(J){if(s.__stx_strict_hydration)throw J;let ee=Hl(J instanceof Error?J.message:String(J));if(Vl(ee))console.warn(`[stx] server <script> in ${t??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${ee}`),o.onFailure?.({kind:"module-resolution",message:ee,error:J});else if(Ul(J))console.warn(`[stx] server <script> in ${t??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${ee}`),o.onFailure?.({kind:"syntax",message:ee,error:J});else if(Wl(ee))console.warn(`[stx] server <script> in ${t??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${ee}`),o.onFailure?.({kind:"missing-binding",message:ee,error:J});else{let fe=`${t??"<unknown>"}\x00${ee}`;if(Ct.env.STX_DEBUG||!Zi.has(fe))Zi.add(fe),console.warn(`[stx] server <script> in ${t??"<unknown>"} threw, so every variable in that script is undefined and anything that reads one renders empty. Cause: ${ee}`);o.onFailure?.({kind:"unknown",message:ee,error:J})}try{await Il(c,s,t)}catch(fe){if(Ct.env.STX_DEBUG){let _e=fe instanceof Error?fe.message:String(fe);console.warn(`[stx] fallback extraction also failed in ${t??"<unknown>"}: ${_e}`)}}}}function ql(e){let s=0,t=null,o=!1,a=!1;for(let h=0;h<e.length;h++){let c=e[h];if(t){if(c===t){if(t=null,o||s===0)a=!0}continue}if(c==="'"||c==='"'||c==="`"){t=c;continue}if(c==="{")s++;else if(c==="}")s--;else if(e.startsWith("from",h)&&s===0)o=!0}return t===null&&s===0&&a}var kl=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function Po(e,s){let t=s?Je.dirname(s):Ct.cwd(),o=Ct.cwd(),a=e.split(`
|
|
410
|
-
`),h=[],c=0;while(c<a.length){let v=a[c].trim();if(v.startsWith("interface ")||v.startsWith("export interface ")||v.startsWith("type ")||v.startsWith("export type ")){if(v.includes("{")&&!v.includes("}")){let E=0;for(;c<a.length;c++){for(let R of a[c])if(R==="{")E++;else if(R==="}")E--;if(E<=0)break}}c++;continue}if(v.startsWith("definePageMeta(")){let E=0,R=!1,C=c;for(let N=c;N<a.length&&!R;N++){let I=null,P=!1,Z=a[N];for(let U=0;U<Z.length;U++){let V=Z[U];if(P){P=!1;continue}if(V==="\\"){P=!0;continue}if(I){if(V===I)I=null;continue}if(V==='"'||V==="'"||V==="`"){I=V;continue}if(V==="(")E++;else if(V===")"){if(E--,E===0){c=N+1,R=!0;break}}}}if(!R)c=a.length;let O=a.slice(C,c).join(`
|
|
411
|
-
`),M=[];for(let N of["title","description"]){let I=new RegExp(`\\b${N}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(O);if(I)M.push(`${N}: ${JSON.stringify(I[2])}`)}if(M.length>0)h.push(`useSeoMeta({ ${M.join(", ")} });`);continue}if(v.startsWith("import ")||v==="import"||v.startsWith("import{")||/^import['"]/.test(v)){let E=v,R=0;while(!ql(E)&&c+R+1<a.length)R++,E=`${E} ${a[c+R].trim()}`;c+=R;let C=E.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),O=E.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),M=E.match(/^import\s*['"](.+?)['"]/),N=E,I=(P)=>{if(P.startsWith("."))return Je.resolve(t,P);if(P.startsWith("~/")||P.startsWith("@/"))return Je.resolve(o,P.slice(2));try{return Bun.resolveSync(P,t)}catch{return P}};if(C){let[,P,Z]=C,U=I(Z);h.push(`const ${P} = (await import('${U}')).default`),h.push(`module.exports.${P} = ${P};`)}else if(O){let[,P,Z]=O,U=I(Z),V=[],X=[],Y=vl.has(Z);for(let Q of P.split(",")){let re=Q.trim();if(!re)continue;let pe=re.split(/\s+as\s+/);if(pe.length===2){let[Ee,ke]=[pe[0].trim(),pe[1].trim()];if(Y&&Ui.has(Ee)){h.push(`const ${ke} = ${Ee};`);continue}V.push(`${Ee}: ${ke}`),X.push(ke)}else{if(Y&&Ui.has(re))continue;V.push(re),X.push(re)}}if(V.length>0)h.push(`const { ${V.join(", ")} } = await import('${U}')`);for(let Q of X)h.push(`module.exports.${Q} = ${Q};`)}else if(M){let P=I(M[1]);h.push(`await import('${P}')`)}else h.push(N);c++;continue}if(kl.test(v))h.push(a[c]),c++;else if(v.startsWith("export const ")||v.startsWith("export let ")||v.startsWith("export var ")){let E=Xi(a,c),{type:R,name:C,value:O}=E;h.push(`${R} ${C} = ${O};`),h.push(`module.exports.${C} = ${C};`),c=E.nextIndex}else if(v.startsWith("export function ")||v.startsWith("export async function ")){let E=Xs(a,c);h.push(E.functionCode),h.push(`module.exports.${E.name} = ${E.name};`),c=E.nextIndex}else if(v.startsWith("const ")||v.startsWith("let ")||v.startsWith("var ")){let E=Xi(a,c),{type:R,name:C,value:O}=E;h.push(`${R} ${C} = ${O};`),h.push(`module.exports.${C} = ${C};`),c=E.nextIndex}else if(v.startsWith("function ")||v.startsWith("async function ")){let E=Xs(a,c);h.push(E.functionCode),h.push(`module.exports.${E.name} = ${E.name};`),c=E.nextIndex}else if(v.startsWith("export default function ")||v.startsWith("export default async function ")){let E=a[c].replace(/^(\s*)export\s+default\s+/,"$1"),R=[...a];R[c]=E;let C=Xs(R,c);if(h.push(C.functionCode),C.name)h.push(`module.exports.default = ${C.name};`);c=C.nextIndex}else if(v.startsWith("export default ")){let E=v.replace(/^export\s+default\s+/,"").replace(/;$/,"");h.push(`module.exports.default = ${E};`),c++}else if(v.startsWith("class ")||v.startsWith("export class ")){let E=v.match(/(?:export\s+)?class\s+(\w+)/);if(E){let R=E[1],C=a[c].replace(/^export\s+/,""),O=0,M=c;for(;M<a.length;M++){let N=a[M];for(let I of N)if(I==="{")O++;else if(I==="}")O--;if(M>c)C+=`
|
|
412
|
-
`+N;if(O<=0&&M>=c)break}h.push(C),h.push(`module.exports.${R} = ${R};`),c=M+1}else h.push(v),c++}else if(v.includes("module.exports"))h.push(v),c++;else if(v.trim()&&!v.startsWith("//"))h.push(v),c++;else c++}return Rl(h.join(`
|
|
413
|
-
`),t,o)}function Rl(e,s,t){let o=e.length,a="",h=0,c=null,v=!1,E=!1,R=0;while(h<o){let C=e[h],O=e[h+1];if(v){if(a+=C,C===`
|
|
414
|
-
`)v=!1;h++;continue}if(E){if(a+=C,C==="*"&&O==="/"){a+=O,h+=2,E=!1;continue}h++;continue}if(!c&&C==="/"&&O==="/"){v=!0,a+=C,h++;continue}if(!c&&C==="/"&&O==="*"){E=!0,a+=C,h++;continue}if(c){if(a+=C,C==="\\"){a+=O,h+=2;continue}if(C===c&&c!=="`"){c=null,h++;continue}if(c==="`"){if(C==="$"&&O==="{"){R++,a+=O,h+=2;continue}if(C==="`"){c=null,h++;continue}}h++;continue}if(R>0){if(C==="{")R++;else if(C==="}")R--}if(C==='"'||C==="'"||C==="`"){c=C,a+=C,h++;continue}if(C==="a"&&e.startsWith("await",h)){let M=Cl(e,h);if(M){let{quote:N,path:I,end:P}=M;if(I.startsWith(".")||I.startsWith("~/")||I.startsWith("@/")){let Z=I.startsWith(".")?Je.resolve(s,I):Je.resolve(t,I.slice(2));a+=`await import(${N}${Z}${N})`,h=P;continue}}}a+=C,h++}return a}function Cl(e,s){let t=s+5;if(t>=e.length)return null;if(!/\s/.test(e[t]))return null;while(t<e.length&&/\s/.test(e[t]))t++;if(!e.startsWith("import",t))return null;t+=6;while(t<e.length&&/\s/.test(e[t]))t++;if(e[t]!=="(")return null;t++;while(t<e.length&&/\s/.test(e[t]))t++;let o=e[t];if(o!=="'"&&o!=='"')return null;t++;let a=t;while(t<e.length&&e[t]!==o)if(e[t]==="\\")t+=2;else t++;if(t>=e.length)return null;let h=e.slice(a,t);t++;while(t<e.length&&/\s/.test(e[t]))t++;if(e[t]!==")")return null;return{quote:o,path:h,end:t+1}}function Qi(e,s){let t=e[s];if(t!=="{"&&t!=="[")return null;let a=w(e,t,t==="{"?"}":"]",s);if(a===-1)return null;return{pattern:e.slice(s,a+1),endPos:a+1}}function eo(e){let s=[],t=e.slice(1,-1).trim();if(!t)return s;let o=0,a=0,h="";while(o<t.length){let c=t[o];if(c==="{"||c==="["){let v=a===0?Qi(t,o):null;if(v){s.push(...eo(v.pattern)),o=v.endPos,h="";continue}a++}else if(c==="}"||c==="]")a--;if(a>0){o++;continue}if(c===","){if(h.trim())s.push(h.trim());h="",o++;continue}if(c===":"){h="",o++;continue}if(c==="="){if(h.trim())s.push(h.trim());h="",o++;while(o<t.length&&t[o]!==","&&a===0){if(t[o]==="{"||t[o]==="[")a++;else if(t[o]==="}"||t[o]==="]")a--;o++}continue}if(/[\w$]/.test(c))h+=c;o++}if(h.trim())s.push(h.trim());return s}function Gl(e){let s=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(e);if(!s)return null;let t=s[0].length,o=(a)=>a===" "||a==="\t";while(t<e.length&&o(e[t]))t++;if(e[t]===":"){let a=0,h=null;t++;for(;t<e.length;t++){let c=e[t];if(h){if(c==="\\"){t++;continue}if(c===h)h=null;continue}if(c==="'"||c==='"'||c==="`"){h=c;continue}if(c==="("||c==="["||c==="{"||c==="<"){a++;continue}if(c===")"||c==="]"||c==="}"||c===">"){a--;continue}if(c==="="&&a<=0){let v=e[t+1],E=e[t-1];if(v!=="="&&v!==">"&&E!=="="&&E!=="!"&&E!=="<"&&E!==">")break}}if(e[t]!=="=")return null}while(t<e.length&&o(e[t]))t++;if(e[t]!=="=")return null;return{type:s[1],name:s[2],value:e.slice(t+1).trim()}}function qi(e,s,t,o){let a=null,h=!1;for(let c of e){if(h){h=!1;continue}if(c==="\\"){h=!0;continue}if(a){if(c===a)a=null;continue}if(c==="'"||c==='"'||c==="`"){a=c;continue}if(c===s)o++;else if(c===t)o--}return o}function Xi(e,s){let t=e[s].trim(),o=Gl(t),a=o?[t,o.type,o.name,o.value]:null;if(!a){let C=t.match(/^(?:export\s+)?(const|let|var)\s+/);if(C){let O=t.slice(C[0].length),M=s;if(O.startsWith("{")||O.startsWith("[")){let I=O[0],P=I==="{"?"}":"]",Z=qi(O,I,P,0),U=O;for(let V=s+1;V<e.length&&Z>0;V++)U+=` ${e[V].trim()}`,M=V,Z=qi(e[V],I,P,Z);if(Z>0)U=O,M=s;O=U}let N=Qi(O,0);if(N){let I=C[1],P=N.pattern,Z=O.slice(N.endPos).trim();if(Z.startsWith("=")){let U=Z.slice(1).trim(),V=U,X=Math.max(M,s);if(Ji(U)){let pe=Gi(e,X,U);V=pe.value,X=pe.nextIndex}else X=X+1;V=V.trim().replace(/;$/,"");let Y=eo(P),Q=`__stx_src_${s}`,re=Y.map((pe)=>`module.exports.${pe} = ${pe};`).join(`
|
|
415
|
-
`);return{type:I,name:Q,value:`${V}; ${I} ${P} = ${Q};
|
|
416
|
-
${re}`,nextIndex:X}}}}throw Error(`Failed to parse variable declaration: ${t}`)}let[,h,c,v]=a,E=v,R=s;if(Ji(v)){let C=Gi(e,s,v);E=C.value,R=C.nextIndex}else R=s+1;while(R<e.length){let C=e[R].trim();if(C.startsWith(".")||C.startsWith("?."))E+=`
|
|
417
|
-
${e[R]}`,R++;else break}return E=E.trim().replace(/;$/,""),{type:h,name:c,value:E,nextIndex:R}}function Xs(e,s){let t=e[s].trim(),o=t.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!o)throw Error(`Failed to parse function declaration: ${t}`);let[,a]=o,h=t.replace(/^export\s+/,""),c=s;if(Tl(t)){let v=Al(e,s,h);h=v.functionCode,c=v.nextIndex}else c=s+1;return{name:a,functionCode:h,nextIndex:c}}function Ji(e){let s=e.trim();if(s.startsWith("{"))return w(s,"{","}",0)===-1;if(s.startsWith("["))return w(s,"[","]",0)===-1;return!to(s)}function to(e){let s={paren:0,bracket:0,brace:0},t=null,o=0;for(let a=0;a<e.length;a++){let h=e[a];if((a>0?e[a-1]:"")==="\\"&&t)continue;if((h==='"'||h==="'")&&!t){t=h;continue}if(h===t&&t!=="`"){t=null;continue}if(h==="`"&&!t){t="`";continue}if(h==="`"&&t==="`"&&o===0){t=null;continue}if(t==="`"&&h==="$"&&e[a+1]==="{"){o++,a++;continue}if(o>0&&h==="{"){o++;continue}if(o>0&&h==="}"){o--;continue}if(t)continue;if(h==="(")s.paren++;else if(h===")")s.paren--;else if(h==="[")s.bracket++;else if(h==="]")s.bracket--;else if(h==="{")s.brace++;else if(h==="}")s.brace--}return s.paren===0&&s.bracket===0&&s.brace===0&&t===null}function no(e){let s=e.indexOf("(");if(s===-1)return e.indexOf("{");let t=w(e,"(",")",s);if(t===-1)return-1;return e.indexOf("{",t)}function Tl(e){let s=no(e);if(s===-1)return!0;return w(e,"{","}",s)===-1}function Gi(e,s,t){let o=t,a=s+1;while(a<e.length&&!to(o)){let h=e[a];o+=`
|
|
418
|
-
${h}`,a++}while(a<e.length){let h=e[a].trim();if(h.startsWith(".")||h.startsWith("?."))o+=`
|
|
419
|
-
${e[a]}`,a++;else break}return{value:o,nextIndex:a}}function Al(e,s,t){let o=t,a=s+1;while(a<e.length){let h=no(o);if(h!==-1){if(w(o,"{","}",h)!==-1)break}let c=e[a];o+=`
|
|
420
|
-
${c}`,a++}return{functionCode:o,nextIndex:a}}function Yi(e,s){let t=l(e,s)??l(`(${e})`,s);if(t!==void 0)return t;if(!/\bprocess\b/.test(e))return;let o={...s,process:Object.freeze({env:{...Ct.env}})},a=Object.keys(o).filter(Nt),h=a.map((c)=>o[c]);try{return Function(...a,`'use strict'; return (${e});`)(...h)}catch{try{return Function(...a,`'use strict'; return ${e};`)(...h)}catch{return}}}async function Il(e,s,t){let o=e.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let h of o){let[,,c,v]=h;try{let E=v.trim().replace(/;$/,""),R=Yi(E,s);if(R!==void 0)s[c]=R}catch(E){console.warn(`Failed to parse export ${c} in fallback:`,E)}}let a=e.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let h of a){let[,,c,v]=h;if(!(c in s))try{let E=v.trim().replace(/;$/,""),R=Yi(E,s);if(R!==void 0)s[c]=R}catch{}}}function Va(e){let s=e.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),t=s?s[1]:"",o=s?e.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):e;return{scriptContent:t,templateWithoutScript:o}}function Ua(e){let s=e.trim();if(!s)return!1;return/(?:const|let|var|function)\s+\w+/.test(s)}
|
|
421
|
-
export{Re,he,L,ns,rs,j,ss,os,is,So,ko,_o,Ea,rn,r,sn,B,Et,te,y,Ta,b,rr,as,ye,S,Ae,ae,sr,W,on,Pe,ce,$a,le,q,or,cs,ne,Tt,be,ue,Qe,ir,ar,$t,Co,Eo,Fl,Ie,Ra,Aa,Pa,To,Ia,ls,$o,Oa,Na,Da,Ro,an,us,cn,Rt,At,Ma,ds,La,ln,cr,ps,gs,ja,Ao,Ba,Fa,za,Ha,un,zl,Hl,Vl,Ul,Wl,g,ql,Po,Gl,Va,Ua,Io,Oo,Kl,Pt,Wa,No,qa,$p,Oe,dn,Ne,Xl,Jl,Yl,Zl,Ql,ms,eu,De,G,Me,tu,lr,nu,Ga,Do,Le,n,pn,Ka,m,de,Rp,Xa,Ja,Ya,Mo,hs,ru,Ap,su,Pp,It,d,F,K,fn,ve,ou,Lo,iu,Ip,k,au,Op,_,Np};
|