@stacksjs/stx 0.2.825 → 0.2.827
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-02zvytqx.js +2 -0
- package/dist/{chunk-bt0amey5.js → chunk-04z1xyrb.js} +2 -2
- package/dist/chunk-0jhq2kza.js +2 -0
- package/dist/{chunk-f0txsdpa.js → chunk-0rvntfhj.js} +3 -3
- package/dist/chunk-12m1qwzd.js +2 -0
- package/dist/chunk-17zrprh0.js +2 -0
- package/dist/chunk-1bpx9b0m.js +2 -0
- package/dist/{chunk-wy0gghvh.js → chunk-1vzncfka.js} +2 -2
- package/dist/chunk-2b1w7py1.js +2 -0
- package/dist/chunk-2mrdtxfy.js +2 -0
- package/dist/{chunk-2vqpz4qv.js → chunk-2qngyyaz.js} +2 -2
- package/dist/{chunk-7yb82rm6.js → chunk-2x9zhezb.js} +2 -2
- package/dist/{chunk-9fm8khcc.js → chunk-3esj6tb8.js} +5 -5
- package/dist/{chunk-3fwhb1q4.js → chunk-3g7bjpj6.js} +3 -3
- package/dist/{chunk-981z8va1.js → chunk-3p7r3ajd.js} +2 -2
- package/dist/chunk-3qx7whh5.js +2 -0
- package/dist/chunk-3vsz0vrk.js +2 -0
- package/dist/{chunk-en390342.js → chunk-3x3zcfxp.js} +48 -48
- package/dist/chunk-3zfras5s.js +2 -0
- package/dist/chunk-42c92rp3.js +2 -0
- package/dist/{chunk-0wgjhyb8.js → chunk-48z7tg83.js} +3 -3
- package/dist/chunk-4a3r1kh1.js +43 -0
- package/dist/{chunk-24d3yy27.js → chunk-4d8ep00w.js} +49 -49
- package/dist/chunk-4z0jpzdq.js +3 -0
- package/dist/{chunk-6qvn1h09.js → chunk-5201w0f1.js} +3 -3
- package/dist/{chunk-xmdcjyyx.js → chunk-543yvntm.js} +2 -2
- package/dist/{chunk-e99szqws.js → chunk-5phdmpa7.js} +6 -6
- package/dist/{chunk-06y0da27.js → chunk-5r63bv4g.js} +3 -3
- package/dist/chunk-67nq6csk.js +2 -0
- package/dist/chunk-6aak0b7c.js +2 -0
- package/dist/{chunk-7sh9fa3q.js → chunk-6k26n0sj.js} +2 -2
- package/dist/chunk-6r4teng3.js +2 -0
- package/dist/{chunk-d6d2s7n6.js → chunk-6tjm38e4.js} +2 -2
- package/dist/{chunk-06hc6rs6.js → chunk-716jrdcg.js} +1 -1
- package/dist/{chunk-ac2vz9c3.js → chunk-717qsbap.js} +10 -10
- package/dist/chunk-72n804gy.js +2 -0
- package/dist/chunk-7amk61bt.js +2 -0
- package/dist/{chunk-3yh6y00f.js → chunk-7k9yahng.js} +6 -6
- package/dist/{chunk-wf0n9gpj.js → chunk-7p8m82pj.js} +4 -4
- package/dist/{chunk-rzt51r2b.js → chunk-7z2ygy9p.js} +7 -7
- package/dist/chunk-8n8vj099.js +2 -0
- package/dist/chunk-8ta7f5en.js +2 -0
- package/dist/{chunk-r9e0r6jx.js → chunk-8y8kgw9s.js} +3 -3
- package/dist/{chunk-cnh6tcdj.js → chunk-8yy8qrcv.js} +10 -10
- package/dist/chunk-a7ewznxk.js +2 -0
- package/dist/{chunk-gjf8cjdt.js → chunk-ac9ncbfw.js} +3 -3
- package/dist/chunk-ahd8jdzx.js +2 -0
- package/dist/chunk-ay7ggc4k.js +2 -0
- package/dist/chunk-ayk94a19.js +2 -0
- package/dist/{chunk-mv3yhspn.js → chunk-b1q40vq4.js} +2 -2
- package/dist/{chunk-dsfdgqmd.js → chunk-b3nv89wq.js} +2 -2
- package/dist/{chunk-3axb6t08.js → chunk-b7tb00nz.js} +2 -2
- package/dist/chunk-b92vzax2.js +2 -0
- package/dist/{chunk-pbpr3bdy.js → chunk-bh35v908.js} +1 -1
- package/dist/chunk-bh7v78je.js +2 -0
- package/dist/{chunk-vfy3b7gm.js → chunk-bjvmmsvp.js} +6 -6
- package/dist/{chunk-djpmrctd.js → chunk-bwnwv91e.js} +8 -8
- package/dist/chunk-c7ybxv8x.js +2 -0
- package/dist/{chunk-3dz29mpg.js → chunk-c8vza3p0.js} +22 -22
- package/dist/{chunk-8ttmzcxb.js → chunk-c9mdvpf5.js} +29 -29
- package/dist/{chunk-5emrarpf.js → chunk-car6nhfe.js} +2 -2
- package/dist/{chunk-e4jwhmpb.js → chunk-cca18z35.js} +31 -31
- package/dist/chunk-cfrgrnej.js +2 -0
- package/dist/{chunk-vzbyn4nh.js → chunk-ckg6q98b.js} +5 -5
- package/dist/{chunk-k81trehg.js → chunk-cv1zc9dg.js} +2 -2
- package/dist/chunk-cw8vpk41.js +2 -0
- package/dist/chunk-d2n2zrdg.js +2 -0
- package/dist/{chunk-0scyzg9r.js → chunk-d9s37xm5.js} +19 -19
- package/dist/chunk-db1c0c3c.js +2 -0
- package/dist/{chunk-cxz4cdcn.js → chunk-e75dntfb.js} +2 -2
- package/dist/chunk-e8a6s6xs.js +25 -0
- package/dist/{chunk-wceg59n0.js → chunk-ekh3mxyp.js} +2 -2
- package/dist/{chunk-4mj9dem1.js → chunk-em8tv6nz.js} +2 -2
- package/dist/{chunk-7qk4exw1.js → chunk-ema1c29k.js} +2 -2
- package/dist/{chunk-z23arg8m.js → chunk-f49x34sr.js} +2 -2
- package/dist/{chunk-8w9spdbn.js → chunk-f6b7av6b.js} +9 -9
- package/dist/{chunk-9gmceny5.js → chunk-f7jgda7x.js} +5 -5
- package/dist/chunk-fb90n0by.js +2 -0
- package/dist/chunk-fevyb337.js +3 -0
- package/dist/chunk-fqq5qzm0.js +2 -0
- package/dist/chunk-fr9e8kb9.js +2 -0
- package/dist/{chunk-ge0k6c49.js → chunk-ftw0a5dm.js} +6 -6
- package/dist/{chunk-b4x5ndt9.js → chunk-fwktw49p.js} +4 -4
- package/dist/chunk-g4qzy5hv.js +2 -0
- package/dist/{chunk-tksjakyv.js → chunk-gcf97wgx.js} +1 -1
- package/dist/chunk-gg48cgx3.js +2 -0
- package/dist/{chunk-076fj387.js → chunk-hd378dgy.js} +1 -1
- package/dist/chunk-j9aftb7p.js +2 -0
- package/dist/chunk-jp6sbk05.js +2 -0
- package/dist/chunk-k6ye0159.js +3 -0
- package/dist/{chunk-vyj9xddw.js → chunk-kfkbqwyf.js} +2 -2
- package/dist/{chunk-ap2t6fdt.js → chunk-kh2n3zqa.js} +1 -1
- package/dist/{chunk-b1n2tq8f.js → chunk-kmqcvpz2.js} +5 -5
- package/dist/chunk-kshem79d.js +2 -0
- package/dist/chunk-kve27dy3.js +2 -0
- package/dist/chunk-m3tnxk01.js +2 -0
- package/dist/chunk-m716f2ga.js +2 -0
- package/dist/{chunk-3wjh3aw8.js → chunk-m973xh3a.js} +13 -13
- package/dist/chunk-m9bbhg46.js +3 -0
- package/dist/chunk-m9dj8pgb.js +2 -0
- package/dist/{chunk-gp37b8vw.js → chunk-mfebs2s2.js} +2 -2
- package/dist/{chunk-qj4r08jb.js → chunk-mxvevxb8.js} +4 -4
- package/dist/{chunk-btxnrqxf.js → chunk-myje6fhm.js} +5 -5
- package/dist/{chunk-1f7d1c0y.js → chunk-mypygxdm.js} +2 -2
- package/dist/{chunk-76eh43e9.js → chunk-nfpsaaqm.js} +2 -2
- package/dist/{chunk-zen28e3p.js → chunk-ng5revck.js} +29 -29
- package/dist/chunk-nxnkd48v.js +2 -0
- package/dist/chunk-pe5qqem0.js +2 -0
- package/dist/chunk-pg146fc5.js +2 -0
- package/dist/{chunk-67kbsav0.js → chunk-q5pwvr98.js} +1 -1
- package/dist/{chunk-2nj9aewf.js → chunk-qadce16v.js} +1 -1
- package/dist/chunk-qg2tpvdw.js +2 -0
- package/dist/chunk-qm6epp9h.js +2 -0
- package/dist/{chunk-faxbznng.js → chunk-qn06sy9j.js} +5 -5
- package/dist/{chunk-q7zwv88b.js → chunk-qnrgfm9v.js} +2 -2
- package/dist/{chunk-0kbzs147.js → chunk-qz82cpyv.js} +9 -9
- package/dist/chunk-rbq4dn2a.js +2 -0
- package/dist/{chunk-kvgxmb0s.js → chunk-ret52ds0.js} +6 -6
- package/dist/{chunk-xpy9yjyx.js → chunk-rkdsgfhd.js} +13 -13
- package/dist/{chunk-bfbh0hfn.js → chunk-rmygv0n0.js} +6 -6
- package/dist/{chunk-n7arptzc.js → chunk-s53wjw7y.js} +3 -3
- package/dist/{chunk-p1fpferp.js → chunk-s5dhvnnd.js} +6 -6
- package/dist/chunk-s5ejh2yx.js +2 -0
- package/dist/chunk-s6399qe7.js +2 -0
- package/dist/chunk-se3fqsxk.js +2 -0
- package/dist/chunk-t59bc7na.js +3 -0
- package/dist/{chunk-yr3ped5m.js → chunk-t96229jm.js} +2 -2
- package/dist/{chunk-z5hmwq1z.js → chunk-tngj0fp6.js} +8 -8
- package/dist/chunk-txzap6yn.js +2 -0
- package/dist/{chunk-g0zxp9qh.js → chunk-tzhs7drk.js} +11 -11
- package/dist/chunk-v1mwhvf8.js +2 -0
- package/dist/chunk-vb4xzz5c.js +2 -0
- package/dist/{chunk-me6kgvsm.js → chunk-vpnyqf0h.js} +1 -1
- package/dist/chunk-vxhq8n8y.js +2 -0
- package/dist/{chunk-mwxbdpb1.js → chunk-vyv76w55.js} +2 -2
- package/dist/chunk-w39cfxa6.js +2 -0
- package/dist/chunk-w9gpscjf.js +2 -0
- package/dist/chunk-wb6w807m.js +2 -0
- package/dist/chunk-wpyhavjy.js +2 -0
- package/dist/{chunk-j3st59hv.js → chunk-wr7bmkne.js} +2 -2
- package/dist/chunk-wt7qhv5b.js +2 -0
- package/dist/{chunk-y8p85kcj.js → chunk-wvds0s9m.js} +2 -2
- package/dist/chunk-x742wppj.js +2 -0
- package/dist/chunk-xdwnbr9b.js +4 -0
- package/dist/{chunk-a1htb5r5.js → chunk-xj3my6b9.js} +105 -105
- package/dist/{chunk-qz3fdmrc.js → chunk-xn9jg1q5.js} +3 -3
- package/dist/chunk-xrspzeqx.js +2 -0
- package/dist/{chunk-xegj9wqj.js → chunk-xtn0hnmz.js} +6 -6
- package/dist/{chunk-jb2rvsf4.js → chunk-y6nz6bk2.js} +3 -3
- package/dist/{chunk-cmnze7at.js → chunk-ybq56wam.js} +2 -2
- package/dist/{chunk-y9bj3566.js → chunk-yrw5ensv.js} +3 -3
- package/dist/{chunk-axwa3s1m.js → chunk-yv1vw0kx.js} +2 -2
- package/dist/{chunk-pvj0bpqg.js → chunk-z25w7kmr.js} +4 -4
- package/dist/chunk-zty254tw.js +2 -0
- package/dist/{chunk-j737tnvt.js → chunk-zvvv6x8c.js} +4 -4
- package/dist/cli.js +23 -23
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/loops.d.ts +2 -0
- package/dist/loops.js +22 -3
- package/dist/performance-utils.d.ts +2 -0
- package/dist/performance-utils.js +7 -0
- package/dist/process.js +17 -3
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +11 -11
- package/package.json +5 -5
- package/dist/chunk-030tgwve.js +0 -2
- package/dist/chunk-09285y4b.js +0 -2
- package/dist/chunk-0jvrzpfs.js +0 -2
- package/dist/chunk-1qwb0pyb.js +0 -2
- package/dist/chunk-30rpspzt.js +0 -43
- package/dist/chunk-3bf48zrh.js +0 -2
- package/dist/chunk-3bny2583.js +0 -2
- package/dist/chunk-3e7t4qzd.js +0 -2
- package/dist/chunk-40rzr6qj.js +0 -2
- package/dist/chunk-4sev2jfs.js +0 -2
- package/dist/chunk-5e5jschg.js +0 -3
- package/dist/chunk-5ea3zebc.js +0 -2
- package/dist/chunk-6h1qa3hw.js +0 -2
- package/dist/chunk-6tfhx4zw.js +0 -2
- package/dist/chunk-716qmx26.js +0 -2
- package/dist/chunk-7bjxmzre.js +0 -2
- package/dist/chunk-7mw1yc6j.js +0 -2
- package/dist/chunk-7pz76f28.js +0 -2
- package/dist/chunk-7vfq8t4x.js +0 -2
- package/dist/chunk-9w9vr35m.js +0 -2
- package/dist/chunk-a8fy7jv8.js +0 -2
- package/dist/chunk-akj26p4b.js +0 -3
- package/dist/chunk-an1cc36z.js +0 -2
- package/dist/chunk-b22yj5j5.js +0 -2
- package/dist/chunk-brhas9mp.js +0 -3
- package/dist/chunk-c1e45rtv.js +0 -2
- package/dist/chunk-cgamtmxv.js +0 -2
- package/dist/chunk-d30p1zvd.js +0 -2
- package/dist/chunk-dfy5g8cb.js +0 -2
- package/dist/chunk-e38gkp8q.js +0 -2
- package/dist/chunk-fm8hq9y2.js +0 -2
- package/dist/chunk-g4sdthck.js +0 -2
- package/dist/chunk-g8nqmnb7.js +0 -2
- package/dist/chunk-h67pm636.js +0 -2
- package/dist/chunk-hb8jxg45.js +0 -2
- package/dist/chunk-hfgzqapw.js +0 -2
- package/dist/chunk-hras294c.js +0 -25
- package/dist/chunk-j0hrk24j.js +0 -2
- package/dist/chunk-jjbdtj4w.js +0 -2
- package/dist/chunk-jzgyrxye.js +0 -2
- package/dist/chunk-k0xdvegc.js +0 -2
- package/dist/chunk-kg9gnar1.js +0 -2
- package/dist/chunk-kq5k2qbz.js +0 -2
- package/dist/chunk-m934bzg2.js +0 -2
- package/dist/chunk-mmeck545.js +0 -2
- package/dist/chunk-mz6qjee1.js +0 -2
- package/dist/chunk-ndjmt3vg.js +0 -3
- package/dist/chunk-pgpkrf6g.js +0 -2
- package/dist/chunk-prt4ntb0.js +0 -2
- package/dist/chunk-px6336z8.js +0 -2
- package/dist/chunk-q5bct2ks.js +0 -2
- package/dist/chunk-r2hjn9ds.js +0 -2
- package/dist/chunk-rqdnzbq0.js +0 -2
- package/dist/chunk-rrkn40eq.js +0 -2
- package/dist/chunk-s2zsa16d.js +0 -2
- package/dist/chunk-sddp2398.js +0 -2
- package/dist/chunk-sfr0767s.js +0 -2
- package/dist/chunk-sv4emtcj.js +0 -2
- package/dist/chunk-sx8j2e58.js +0 -2
- package/dist/chunk-t2tv5ezg.js +0 -2
- package/dist/chunk-tcyvwy8p.js +0 -2
- package/dist/chunk-tg18j1yf.js +0 -2
- package/dist/chunk-tj7dh2dz.js +0 -2
- package/dist/chunk-tsvnhc0c.js +0 -4
- package/dist/chunk-vafxrky2.js +0 -2
- package/dist/chunk-vvjp9xp0.js +0 -2
- package/dist/chunk-wpendr22.js +0 -3
- package/dist/chunk-x30gh7vt.js +0 -2
- package/dist/chunk-y3trpdp9.js +0 -2
- package/dist/chunk-zqsygwa0.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ze,xn,Ws,Si,N}from"./chunk-2vqpz4qv.js";import{vn}from"./chunk-axwa3s1m.js";import{Or,k,dl,at,Ai,pl}from"./chunk-bt0amey5.js";import{P}from"./chunk-r9e0r6jx.js";import{T,qs,u,f,jt,d,q,F,x,Js,_e,Ve,Ys}from"./chunk-8ttmzcxb.js";import{r,ge}from"./chunk-b4x5ndt9.js";import{g}from"./chunk-0dve54ne.js";import{K}from"./chunk-wpendr22.js";import st from"path";import Ct from"process";import{AsyncLocalStorage as Go}from"async_hooks";var mr=new Go;function mn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function hr(e,t){return mr.run(mn(e),t)}async function $r(e,t){let i=mr.getStore();if(!i)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 n=i.pending.get(e);if(n)return n;let a=Promise.resolve().then(t).then((l)=>{let c=JSON.stringify(l,(v,E)=>{if(E===void 0||typeof E==="function"||typeof E==="symbol"||typeof E==="bigint"||typeof E==="number"&&!Number.isFinite(E))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(E&&typeof E==="object"&&!Array.isArray(E)&&Object.getPrototypeOf(E)!==Object.prototype&&Object.getPrototypeOf(E)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return E}),b=JSON.parse(c);return i.values.set(e,b),b}).catch((l)=>{throw i.pending.delete(e),l});return i.pending.set(e,a),a}function _r(e){let t=e.__stx_server_data;if(!t?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(t.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function H(e,t=!1){let i=r(e),n=[],a=new Set,l=0,c=0,b=i.length,v=()=>{if(l!==0)return;let E=i.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(E){if(t&&E[1]==="const")return;let I=E[2];if(!a.has(I))n.push(I),a.add(I);return}let A=i.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){if(t&&i.slice(c).startsWith("const"))return;A[1].split(",").forEach((I)=>{let z=I.trim();if(!z)return;let L=z.indexOf(":"),Q=(L>=0?z.slice(L+1).trim():z).split(/[\s=]/)[0];if(Q&&!a.has(Q))n.push(Q),a.add(Q)});return}let M=i.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(M){if(t&&i.slice(c).startsWith("const"))return;M[1].split(",").forEach((I)=>{let z=I.trim().replace(/^\.\.\./,"");if(!z)return;let L=z.split(/[\s=]/)[0];if(L&&!a.has(L))n.push(L),a.add(L)});return}if(t)return;let X=i.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(X){let I=X[1];if(!a.has(I))n.push(I),a.add(I);return}let j=i.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let I=j[1];if(!a.has(I))n.push(I),a.add(I)}};while(c<b){if(i[c]==="{"){l++,c++;continue}if(i[c]==="}"){l--,c++;continue}if(l===0&&/[a-z]/i.test(i[c])&&(c===0||/\s|[;{}()]/.test(i[c-1])))v();c++}return n.join(", ")}function Ps(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function Yo(e,t=H(e).split(",").map((i)=>i.trim()).filter(Boolean)){let i=new Set(H(e,!0).split(",").map((n)=>n.trim()));return t.map((n)=>i.has(n)?`get ${n}() { return ${n} }, set ${n}(__stxValue_${n}) { ${n} = __stxValue_${n} }`:n).join(", ")}function Is(e,t){let i=`{ ${Yo(e,t)} }`;return H(e).split(",").some((n)=>n.trim()==="__stxLiveBindings")?`Object.defineProperties(${i}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:i}import vt from"fs";import Ee from"path";function V(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Er=new Map;function yr(e,t=!0){let i=Er.get(e);if(t&&i)return i;let n=new Map,a=[Ee.join(e,"src"),Ee.join(e,"dist"),e];function l(c,b){if(b>6)return;let v;try{v=vt.readdirSync(c,{withFileTypes:!0})}catch{return}for(let E of v){let A=Ee.join(c,E.name);if(E.isDirectory()){if(E.name==="node_modules"||E.name.startsWith("."))continue;l(A,b+1)}else if(E.isFile()&&E.name.endsWith(".stx")){let M=E.name.slice(0,-4);if(!n.has(M))n.set(M,A);let X=M.toLowerCase();if(!n.has(X))n.set(X,A);let j=V(M);if(!n.has(j))n.set(j,A)}}}for(let c of a)if(l(c,0),n.size>0)break;if(t)Er.set(e,n);return n}function Os(e,t){if(e.startsWith(".")||e.startsWith("/"))return null;let i=t;while(!0){let n=Ee.join(i,"node_modules",e);try{if(vt.statSync(n).isDirectory())return n}catch{}let a=Ee.dirname(i);if(a===i)return null;i=a}}function Ns(e,t,i={}){return[Ee.resolve(Ee.dirname(t),`${e}.stx`),Ee.resolve(Ee.dirname(t),e),Ee.resolve(i.componentsDir||"components",`${e}.stx`),Ee.resolve(i.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function Rr(e){let t=e.endsWith(".stx")?e.slice(0,-4):e,i=t.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),n=V(t);return[t,i,n]}function oi(e,t){let[i,n,a]=Rr(e);for(let l of[i,i.toLowerCase(),n,a]){let c=t?.__importedComponents?.get(l);if(c!==void 0)return c}}function Qo(e,t){let i=t?Ee.resolve(t):void 0,n=Ee.dirname(Ee.resolve(e));for(;;){if(vt.existsSync(Ee.join(n,"package.json")))return i&&n===i?void 0:n;let a=Ee.dirname(n);if(a===n)return;n=a}}var ea=["src/ui","src/components","components","dist"];function us(e,t){let i=Ee.resolve(e);if(!t&&!i.split(Ee.sep).includes("node_modules"))return[];let n=Qo(i,t);if(!n)return[];let a=[];try{let b=JSON.parse(vt.readFileSync(Ee.join(n,"package.json"),"utf8")).stx?.components;if(Array.isArray(b))a=b.filter((v)=>typeof v==="string")}catch{}let l=a.length?a:ea;return[Ee.dirname(Ee.resolve(e)),...l.map((c)=>Ee.resolve(n,c))]}function*ii(e,t,i={},n){let a=Rr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield Ee.resolve(Ee.dirname(t),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],c=i.projectRoot||process.cwd(),b=[...us(t,i.projectRoot),...n?.__originalFilePath?[Ee.join(Ee.dirname(n.__originalFilePath),"components")]:[],...i.componentsDir?[i.componentsDir]:[],Ee.join(Ee.dirname(t),"components"),Ee.resolve(c,"src/components"),Ee.resolve(c,"components"),...import.meta.dir?[Ee.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(b)){for(let E of l)yield Ee.join(v,E);try{for(let E of vt.readdirSync(v,{withFileTypes:!0}))if(E.isDirectory())for(let A of l)yield Ee.join(v,E.name,A)}catch{}}}function Ar(e,t,i={},n){let a=oi(e,n);if(a!==void 0)return a;for(let l of ii(e,t,i,n))try{if(vt.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Ms(e,t=[],i={}){let n=new Set([...e].map((E)=>E.replace(/[-_]/g,"").toLowerCase()));if(!n.has("src")||!n.has("alt")&&!n.has("decorative"))return!1;let a=new Map(Object.entries(i).map(([E,A])=>[E.replace(/[-_]/g,"").toLowerCase(),A])),l=a.get("alt"),c=a.get("decorative"),b=typeof l==="string"&&!!l.trim(),v=typeof c==="string"?!["false","0","off","no"].includes(c.trim().toLowerCase()):Boolean(c);if(!b&&!v)return!1;if(["source","resizemode","defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((E)=>n.has(E)))return!1;if([...t].some((E)=>!["load","error"].includes(E.replace(/^@/,"").split(".")[0].toLowerCase())))return!1;return["fit","objectfit","position","objectposition","rounded","aspectratio","zoomonhover","sources","webpsrc","webpsrcset"].some((E)=>n.has(E))}import Jn from"fs";import ae from"path";import ht from"path";import Kt from"fs";var ta=new Set(["touchstart","touchmove","wheel","mousewheel"]);function fs(e,t){if(t.passive)return!0;if(t.prevent||t.nonpassive)return!1;return ta.has(e.toLowerCase())}var Tr=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"]),Ir={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"},na=new Set(["ctrl","alt","shift","meta"]),jr={left:0,middle:1,right:2};function Pr(e){let t={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let i of e){let n=i.toLowerCase();if(n==="prevent")t.prevent=!0;else if(n==="stop")t.stop=!0;else if(n==="once")t.once=!0;else if(n==="capture")t.capture=!0;else if(n==="self")t.self=!0;else if(n==="passive")t.passive=!0;else if(n==="nonpassive")t.nonpassive=!0;else if(na.has(n))t.systemKeys.push(n);else if(n in jr)t.mouse=n;else if(n in Ir||/^[a-z]$/.test(n))t.keys.push(Ir[n]||n.toUpperCase());else if(n.startsWith("debounce")){let a=n.match(/debounce(?:\.(\d+))?/);t.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(n.startsWith("throttle")){let a=n.match(/throttle(?:\.(\d+))?/);t.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return t}function Dr(e,t=""){let i=[],n=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[c,b,v]=l,E=l.index,A=E+c.length,M=`__stx_evt_${t}${n++}`,X=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,I;while((I=j.exec(v))!==null){let[,L,B]=I,Q=L.split("."),D=Q[0];if(!Tr.has(D))continue;X.push({attribute:`@${L}`,event:D,handler:B,modifiers:Pr(Q.slice(1)),elementId:M})}let z=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((I=z.exec(v))!==null){let[,L,B]=I,Q=L.split("."),D=Q[0];if(!Tr.has(D))continue;X.push({attribute:`@${L}`,event:D,handler:B,modifiers:Pr(Q.slice(1)),elementId:M})}if(X.length>0)i.push({originalTag:c,elementId:M,events:X,startIndex:E,endIndex:A})}return i}function sa(e){let t=[],{modifiers:i}=e;if(i.self)t.push("if ($event.target !== $el) return");for(let n of i.systemKeys)t.push(`if (!$event.${n}Key) return`);if(i.keys.length>0){let n=i.keys.map((a)=>`$event.key === '${a}'`).join(" || ");t.push(`if (!(${n})) return`)}if(i.mouse!==null){let n=jr[i.mouse];t.push(`if ($event.button !== ${n}) return`)}if(i.prevent)t.push("$event.preventDefault()");if(i.stop)t.push("$event.stopPropagation()");return t.join("; ")}function ra(e,t){let i=e;if(t.debounce!==null)i=`__stx_debounce(() => { ${i} }, ${t.debounce})`;else if(t.throttle!==null)i=`__stx_throttle(() => { ${i} }, ${t.throttle})`;return i}function ps(e){let t=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(t))return e;return`if (typeof ${t} === 'function' && !${t}._isSignal) ${t}($event);`}function ia(e){let{modifiers:t}=e,i=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),n=sa(e),a=ra(ps(e.handler),t),l=[];if(t.once)l.push("once: true");if(t.capture)l.push("capture: true");if(fs(e.event,t))l.push("passive: true");let c=l.length>0?`, { ${l.join(", ")} }`:"",b=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
|
|
2
|
+
import{He,Sn,Ws,ki,M}from"./chunk-2qngyyaz.js";import{xn}from"./chunk-yv1vw0kx.js";import{Or,k,pl,ct,Pi,fl}from"./chunk-04z1xyrb.js";import{I}from"./chunk-8y8kgw9s.js";import{T,qs,u,f,Bt,d,K,z,x,Js,Ce,Ue,Ys}from"./chunk-c9mdvpf5.js";import{r,me}from"./chunk-fwktw49p.js";import{g}from"./chunk-0dve54ne.js";import{X}from"./chunk-t59bc7na.js";import rt from"path";import Rt from"process";import{AsyncLocalStorage as Go}from"async_hooks";var mr=new Go;function hn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function hr(e,t){return mr.run(hn(e),t)}async function $r(e,t){let i=mr.getStore();if(!i)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 n=i.pending.get(e);if(n)return n;let a=Promise.resolve().then(t).then((l)=>{let c=JSON.stringify(l,(v,E)=>{if(E===void 0||typeof E==="function"||typeof E==="symbol"||typeof E==="bigint"||typeof E==="number"&&!Number.isFinite(E))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(E&&typeof E==="object"&&!Array.isArray(E)&&Object.getPrototypeOf(E)!==Object.prototype&&Object.getPrototypeOf(E)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return E}),b=JSON.parse(c);return i.values.set(e,b),b}).catch((l)=>{throw i.pending.delete(e),l});return i.pending.set(e,a),a}function _r(e){let t=e.__stx_server_data;if(!t?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(t.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function V(e,t=!1){let i=r(e),n=[],a=new Set,l=0,c=0,b=i.length,v=()=>{if(l!==0)return;let E=i.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(E){if(t&&E[1]==="const")return;let P=E[2];if(!a.has(P))n.push(P),a.add(P);return}let A=i.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){if(t&&i.slice(c).startsWith("const"))return;A[1].split(",").forEach((P)=>{let B=P.trim();if(!B)return;let L=B.indexOf(":"),G=(L>=0?B.slice(L+1).trim():B).split(/[\s=]/)[0];if(G&&!a.has(G))n.push(G),a.add(G)});return}let O=i.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(O){if(t&&i.slice(c).startsWith("const"))return;O[1].split(",").forEach((P)=>{let B=P.trim().replace(/^\.\.\./,"");if(!B)return;let L=B.split(/[\s=]/)[0];if(L&&!a.has(L))n.push(L),a.add(L)});return}if(t)return;let H=i.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let P=H[1];if(!a.has(P))n.push(P),a.add(P);return}let j=i.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let P=j[1];if(!a.has(P))n.push(P),a.add(P)}};while(c<b){if(i[c]==="{"){l++,c++;continue}if(i[c]==="}"){l--,c++;continue}if(l===0&&/[a-z]/i.test(i[c])&&(c===0||/\s|[;{}()]/.test(i[c-1])))v();c++}return n.join(", ")}function Ps(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function Yo(e,t=V(e).split(",").map((i)=>i.trim()).filter(Boolean)){let i=new Set(V(e,!0).split(",").map((n)=>n.trim()));return t.map((n)=>i.has(n)?`get ${n}() { return ${n} }, set ${n}(__stxValue_${n}) { ${n} = __stxValue_${n} }`:n).join(", ")}function Is(e,t){let i=`{ ${Yo(e,t)} }`;return V(e).split(",").some((n)=>n.trim()==="__stxLiveBindings")?`Object.defineProperties(${i}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:i}import vt from"fs";import $e from"path";function U(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Er=new Map;function yr(e,t=!0){let i=Er.get(e);if(t&&i)return i;let n=new Map,a=[$e.join(e,"src"),$e.join(e,"dist"),e];function l(c,b){if(b>6)return;let v;try{v=vt.readdirSync(c,{withFileTypes:!0})}catch{return}for(let E of v){let A=$e.join(c,E.name);if(E.isDirectory()){if(E.name==="node_modules"||E.name.startsWith("."))continue;l(A,b+1)}else if(E.isFile()&&E.name.endsWith(".stx")){let O=E.name.slice(0,-4);if(!n.has(O))n.set(O,A);let H=O.toLowerCase();if(!n.has(H))n.set(H,A);let j=U(O);if(!n.has(j))n.set(j,A)}}}for(let c of a)if(l(c,0),n.size>0)break;if(t)Er.set(e,n);return n}function Os(e,t){if(e.startsWith(".")||e.startsWith("/"))return null;let i=t;while(!0){let n=$e.join(i,"node_modules",e);try{if(vt.statSync(n).isDirectory())return n}catch{}let a=$e.dirname(i);if(a===i)return null;i=a}}function Ns(e,t,i={}){return[$e.resolve($e.dirname(t),`${e}.stx`),$e.resolve($e.dirname(t),e),$e.resolve(i.componentsDir||"components",`${e}.stx`),$e.resolve(i.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function Rr(e){let t=e.endsWith(".stx")?e.slice(0,-4):e,i=t.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),n=U(t);return[t,i,n]}function ii(e,t){let[i,n,a]=Rr(e);for(let l of[i,i.toLowerCase(),n,a]){let c=t?.__importedComponents?.get(l);if(c!==void 0)return c}}function Qo(e,t){let i=t?$e.resolve(t):void 0,n=$e.dirname($e.resolve(e));for(;;){if(vt.existsSync($e.join(n,"package.json")))return i&&n===i?void 0:n;let a=$e.dirname(n);if(a===n)return;n=a}}var ea=["src/ui","src/components","components","dist"];function us(e,t){let i=$e.resolve(e);if(!t&&!i.split($e.sep).includes("node_modules"))return[];let n=Qo(i,t);if(!n)return[];let a=[];try{let b=JSON.parse(vt.readFileSync($e.join(n,"package.json"),"utf8")).stx?.components;if(Array.isArray(b))a=b.filter((v)=>typeof v==="string")}catch{}let l=a.length?a:ea;return[$e.dirname($e.resolve(e)),...l.map((c)=>$e.resolve(n,c))]}function*ai(e,t,i={},n){let a=Rr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield $e.resolve($e.dirname(t),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],c=i.projectRoot||process.cwd(),b=[...us(t,i.projectRoot),...n?.__originalFilePath?[$e.join($e.dirname(n.__originalFilePath),"components")]:[],...i.componentsDir?[i.componentsDir]:[],$e.join($e.dirname(t),"components"),$e.resolve(c,"src/components"),$e.resolve(c,"components"),...import.meta.dir?[$e.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(b)){for(let E of l)yield $e.join(v,E);try{for(let E of vt.readdirSync(v,{withFileTypes:!0}))if(E.isDirectory())for(let A of l)yield $e.join(v,E.name,A)}catch{}}}function Ar(e,t,i={},n){let a=ii(e,n);if(a!==void 0)return a;for(let l of ai(e,t,i,n))try{if(vt.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Ms(e,t=[],i={}){let n=new Set([...e].map((E)=>E.replace(/[-_]/g,"").toLowerCase()));if(!n.has("src")||!n.has("alt")&&!n.has("decorative"))return!1;let a=new Map(Object.entries(i).map(([E,A])=>[E.replace(/[-_]/g,"").toLowerCase(),A])),l=a.get("alt"),c=a.get("decorative"),b=typeof l==="string"&&!!l.trim(),v=typeof c==="string"?!["false","0","off","no"].includes(c.trim().toLowerCase()):Boolean(c);if(!b&&!v)return!1;if(["source","resizemode","defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((E)=>n.has(E)))return!1;if([...t].some((E)=>!["load","error"].includes(E.replace(/^@/,"").split(".")[0].toLowerCase())))return!1;return["fit","objectfit","position","objectposition","rounded","aspectratio","zoomonhover","sources","webpsrc","webpsrcset"].some((E)=>n.has(E))}import Jn from"fs";import ae from"path";import ht from"path";import Kt from"fs";var ta=new Set(["touchstart","touchmove","wheel","mousewheel"]);function fs(e,t){if(t.passive)return!0;if(t.prevent||t.nonpassive)return!1;return ta.has(e.toLowerCase())}var Tr=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"]),Ir={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"},na=new Set(["ctrl","alt","shift","meta"]),jr={left:0,middle:1,right:2};function Pr(e){let t={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let i of e){let n=i.toLowerCase();if(n==="prevent")t.prevent=!0;else if(n==="stop")t.stop=!0;else if(n==="once")t.once=!0;else if(n==="capture")t.capture=!0;else if(n==="self")t.self=!0;else if(n==="passive")t.passive=!0;else if(n==="nonpassive")t.nonpassive=!0;else if(na.has(n))t.systemKeys.push(n);else if(n in jr)t.mouse=n;else if(n in Ir||/^[a-z]$/.test(n))t.keys.push(Ir[n]||n.toUpperCase());else if(n.startsWith("debounce")){let a=n.match(/debounce(?:\.(\d+))?/);t.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(n.startsWith("throttle")){let a=n.match(/throttle(?:\.(\d+))?/);t.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return t}function Dr(e,t=""){let i=[],n=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[c,b,v]=l,E=l.index,A=E+c.length,O=`__stx_evt_${t}${n++}`,H=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,P;while((P=j.exec(v))!==null){let[,L,F]=P,G=L.split("."),D=G[0];if(!Tr.has(D))continue;H.push({attribute:`@${L}`,event:D,handler:F,modifiers:Pr(G.slice(1)),elementId:O})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((P=B.exec(v))!==null){let[,L,F]=P,G=L.split("."),D=G[0];if(!Tr.has(D))continue;H.push({attribute:`@${L}`,event:D,handler:F,modifiers:Pr(G.slice(1)),elementId:O})}if(H.length>0)i.push({originalTag:c,elementId:O,events:H,startIndex:E,endIndex:A})}return i}function sa(e){let t=[],{modifiers:i}=e;if(i.self)t.push("if ($event.target !== $el) return");for(let n of i.systemKeys)t.push(`if (!$event.${n}Key) return`);if(i.keys.length>0){let n=i.keys.map((a)=>`$event.key === '${a}'`).join(" || ");t.push(`if (!(${n})) return`)}if(i.mouse!==null){let n=jr[i.mouse];t.push(`if ($event.button !== ${n}) return`)}if(i.prevent)t.push("$event.preventDefault()");if(i.stop)t.push("$event.stopPropagation()");return t.join("; ")}function ra(e,t){let i=e;if(t.debounce!==null)i=`__stx_debounce(() => { ${i} }, ${t.debounce})`;else if(t.throttle!==null)i=`__stx_throttle(() => { ${i} }, ${t.throttle})`;return i}function ps(e){let t=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(t))return e;return`if (typeof ${t} === 'function' && !${t}._isSignal) ${t}($event);`}function ia(e){let{modifiers:t}=e,i=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),n=sa(e),a=ra(ps(e.handler),t),l=[];if(t.once)l.push("once: true");if(t.capture)l.push("capture: true");if(fs(e.event,t))l.push("passive: true");let c=l.length>0?`, { ${l.join(", ")} }`:"",b=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
|
|
3
3
|
(function() {
|
|
4
4
|
var $el = document.getElementById('${i}');
|
|
5
5
|
if (!$el) return;
|
|
@@ -53,7 +53,7 @@ else {
|
|
|
53
53
|
__stx_runHandler('${b}', $event, $el);
|
|
54
54
|
}
|
|
55
55
|
}${c});
|
|
56
|
-
})();`}function
|
|
56
|
+
})();`}function ci(e){if(e.length===0)return"";return`
|
|
57
57
|
<script data-stx-events>
|
|
58
58
|
(function() {
|
|
59
59
|
'use strict';
|
|
@@ -111,19 +111,19 @@ else {
|
|
|
111
111
|
${e.map(ia).join(`
|
|
112
112
|
`)}
|
|
113
113
|
})();
|
|
114
|
-
</script>`}function oa(e,t=""){let i=Dr(e,t);if(i.length===0)return{template:e,bindings:[]};let n=e,a=[];for(let l=i.length-1;l>=0;l--){let c=i[l],b=c.originalTag;if(!b.includes(" id="))b=b.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${c.elementId}"`);else{let v=b.match(/id=["']([^"']+)["']/);if(v)for(let E of c.events)E.elementId=v[1]}for(let v of c.events){let E=v.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),A=new RegExp(`\\s*${E}\\s*=\\s*"[^"]*"`,"g"),
|
|
115
|
-
`+a.slice(c);else a+=l;return a}function Nr(e,t){let i=new Set;for(let n of e.split(",")){let a=n.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(t){let l=a.lastIndexOf(":");if(l!==-1)a=a.slice(l+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))i.add(a)}return i}function Rt(e,t){let i=r(e),{depths:n,balanced:a}=ge(i),l=(b)=>!a||n[b]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${t}\\b)`,"g");for(let b of i.matchAll(c)){let v=(b.index??0)+b[0].length-b[1].length;if(l(v))return!0}for(let b of i.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(b.index??0)&&Nr(b[1],!0).has(t))return!0;for(let b of i.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(b.index??0)&&Nr(b[1],!1).has(t))return!0;return!1}var Lr=new T(32,{maxBytes:2097152,sizeOf:(e)=>e.code.length*4}),dt=/^[A-Za-z_$][\w$]*$/,aa=new Set(["if","for","while","switch","with"]),zr=["(","[","{"],Br=[")","]","}"],ca=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function la(e){let t=r(e),i=[];for(let n of t.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=n.index??0;i.push({text:n[0],start:a,end:a+n[0].length})}return{code:t,tokens:i}}function ds(e){let t=Lr.get(e);if(t)return t;let{code:i,tokens:n}=la(e),a=new Map,l=[];for(let L=0;L<n.length;L++){let B=n[L].text;if(["(","[","{"].includes(B))l.push(L);else if([")","]","}"].includes(B)){let Q=l.at(-1);if(Q!==void 0&&["()","[]","{}"].includes(n[Q].text+B))l.pop(),a.set(Q,L),a.set(L,Q)}}function c(L,B){let Q=[],D=L;for(let ee=L;ee<B;ee++){if(["(","[","{"].includes(n[ee].text)&&(a.get(ee)??B)<B){ee=a.get(ee);continue}if(n[ee].text===",")Q.push([D,ee]),D=ee+1}return Q.push([D,B]),Q}let b=[];function v(L,B,Q,D=!1){if(n[L]?.text==="...")L++;if(L>=B)return;let ee=n[L].text;if(dt.test(ee)){if(Q.add(ee),Q===M)b.push({name:ee,token:L,functionScoped:D});return}if(ee!=="{"&&ee!=="[")return;let ne=a.get(L);if(ne===void 0||ne>=B)return;for(let[te,le]of c(L+1,ne)){let he=te;if(ee==="{")for(let ue=te;ue<le;ue++){if(n[ue].text===":"){he=ue+1;break}if(n[ue].text==="=")break;if(["(","[","{"].includes(n[ue].text)&&a.has(ue))ue=a.get(ue)}v(he,le,Q,D)}}function E(L,B){let Q=new Set;for(let[D,ee]of c(L,B))v(D,ee,Q);return Q}function A(L){let B=L;for(;B<n.length;B++){let Q=n[B].text;if(["(","[","{"].includes(Q)&&a.has(B)){B=a.get(B);continue}if([",",";",")","]","}"].includes(Q))break}return n[Math.max(L,B-1)]?.end??i.length}let M=new Set,X=[];for(let L=0;L<n.length;L++)if(n[L].text==="=>"){let B=L-1,Q=B,D;if(n[B]?.text===")"&&a.has(B))Q=a.get(B),D=E(Q+1,B);else if(n[B]&&dt.test(n[B].text))D=new Set([n[B].text]);else continue;let ee=L+1,ne=n[ee]?.text==="{"&&a.has(ee)?n[a.get(ee)].end:A(ee);X.push({start:n[Q].start,end:ne,bodyStart:n[ee]?.start??ne,functionBody:!0,names:D})}else if(n[L].text==="("&&a.has(L)){let B=n[L-1]?.text;if(!B||aa.has(B)||!dt.test(B)&&B!=="*"&&B!=="]")continue;let Q=a.get(L),D=Q+1;if(n[D]?.text===":"){D++;while(D<n.length&&!["{","=>",";","="].includes(n[D].text))D++}if(n[D]?.text!=="{"||!a.has(D))continue;X.push({start:n[L].start,end:n[a.get(D)].end,bodyStart:n[D].start,functionBody:B!=="catch",names:E(L+1,Q)})}function j(L){let B=L;for(;B<n.length;B++){let Q=n[B].text;if(zr.includes(Q)&&a.has(B)){B=a.get(B);continue}if(Q===";"||Br.includes(Q))break;let D=n[B-1];if(B>L&&ca.has(Q)&&D.text!==".")break;if(B>L&&/[\n\r]/.test(i.slice(D.end,n[B].start))&&(/^[\w$]+$/.test(D.text)||Br.includes(D.text)||['"',"'","`"].includes(D.text))&&dt.test(Q)&&!["in","of","instanceof"].includes(Q))break}return B}let I=[];for(let L=0;L<n.length;L++){if(n[L].text!=="for")continue;let B=n[L+1]?.text==="await"?L+2:L+1;if(n[B]?.text!=="("||!a.has(B))continue;let Q=a.get(B),D=Q+1,ee=n[D]?.text==="{"&&a.has(D)?a.get(D):j(D),ne=n[ee]?.text===";"||n[ee]?.text==="}"?n[ee].end:n[Math.max(D,ee-1)]?.end??i.length;I.push({headStart:B,headEnd:Q,start:n[B].start,end:ne})}for(let L=0;L<n.length;L++){let B=n[L].text,Q=n[L-1]?.text;if(Q==="."||n[L+1]?.text===":")continue;if(Q==="as"||Q==="<")continue;if(B==="const"||B==="let"||B==="var"){let D=j(L+1),ee=L+1,ne=!1,te=!1,le=0;for(let he=L+1;he<=D;he++){let ue=n[he]?.text;if(he<D&&zr.includes(ue)&&a.has(he)&&a.get(he)<D){he=a.get(he);continue}if(he<D&&ue===":"&&!te)ne=!0;else if(he<D&&ue==="="&&le===0)ne=!1,te=!0;else if(he<D&&ne&&ue==="<")le++;else if(he<D&&ne&&ue===">"&&le>0)le--;else if(he===D||ue===","&&le===0)v(ee,he,M,B==="var"),ee=he+1,ne=!1,te=!1}}else if(B==="function"||B==="class"){let D=L+1;if(n[D]?.text==="*")D++;if(n[D]&&dt.test(n[D].text)&&n[D].text!=="extends")M.add(n[D].text),b.push({name:n[D].text,token:D})}else if(B==="import"){let D=L+1;if(n[D]?.text==="*"&&n[D+1]?.text==="as")D+=2;let ee=n[D]?.text;if(ee&&dt.test(ee)&&ee!=="type"&&n[D+1]?.text!=="("&&n[D+1]?.text!==".")M.add(ee),b.push({name:ee,token:D,file:!0});let ne=n[D]?.text==="{"?D:n[D+1]?.text===","&&n[D+2]?.text==="{"?D+2:-1;if(ne!==-1&&a.has(ne)){let te=a.get(ne);for(let[le,he]of c(ne+1,te)){let ue=he-1;while(ue>=le&&!dt.test(n[ue].text))ue--;if(ue>=le&&n[ue].text!=="type")b.push({name:n[ue].text,token:ue,file:!0})}}}}let z={code:i,scopes:X,loops:I,declarations:M,sites:b,tokens:n,pairs:a};return Lr.set(e,z),z}function Zt(e){let t=ds(e);return{code:t.code,shadows:(i,n)=>t.scopes.some((a)=>n>=a.start&&n<a.end&&a.names.has(i))}}function In(e){return new Set(ds(e).declarations)}function Ie(e,t){let{scopes:i,loops:n,sites:a,tokens:l,pairs:c}=ds(e),b=Array.from({length:l.length},()=>-1),v=[];for(let j=0;j<l.length;j++){b[j]=v.length?v[v.length-1]:-1;let I=l[j].text;if(I==="{"&&c.has(j))v.push(j);else if(I==="}"&&v.length&&c.get(j)===v[v.length-1])v.pop()}let E=new Set,A=new Map;for(let j of a){if(!t.has(j.name))continue;E.add(j.token);let I=j.file?-1:b[j.token],z=I===-1?[0,Number.POSITIVE_INFINITY]:[l[I].start,l[c.get(I)].end];if(j.functionScoped){let B=l[j.token].start,Q=i.filter((D)=>D.functionBody&&B>=D.bodyStart&&B<D.end).sort((D,ee)=>D.end-D.bodyStart-(ee.end-ee.bodyStart))[0];z=Q?[Q.bodyStart,Q.end]:[0,Number.POSITIVE_INFINITY]}else if(!j.file){let B=n.filter((Q)=>j.token>Q.headStart&&j.token<Q.headEnd).sort((Q,D)=>Q.headEnd-Q.headStart-(D.headEnd-D.headStart))[0];if(B)z=[B.start,B.end]}let L=A.get(j.name);if(L)L.push(z);else A.set(j.name,[z])}let M=new Set;for(let j=0;j<l.length;j++){if(l[j].text!=="import"||l[j-1]?.text===".")continue;let I=j+1;if(l[I]?.text==="type")I++;if(l[I]&&dt.test(l[I].text)&&l[I+1]?.text===",")I+=2;if(l[I]?.text==="{"&&c.has(I))for(let z=I+1;z<c.get(I);z++)M.add(z)}let X=new Set;for(let j=0;j<l.length;j++){let I=l[j].text;if(!t.has(I)||X.has(I)||E.has(j)||M.has(j))continue;let z=l[j-1]?.text;if(z==="#"||z==="."&&l[j-2]?.text!=="..")continue;if(l[j+1]?.text===":"&&(z==="{"||z===","))continue;let L=l[j].start;if(A.get(I)?.some(([B,Q])=>L>=B&&L<Q))continue;if(i.some((B)=>L>=B.start&&L<B.end&&B.names.has(I)))continue;X.add(I)}return X}var Pe="0.2.825";var Wr=Symbol.for(`stx.lazy-module-promises.${Pe}`);function fa(){let e=globalThis;return e[Wr]??=new Map,e[Wr]}function o(e,t){let i=fa(),n=`${import.meta.url}\x00${e}`,a=i.get(n);if(a)return a;let l=t();return i.set(n,l),l.catch(()=>{if(i.get(n)===l)i.delete(n)}),l}var pa=/<\/(script)/gi;function dn(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(pa,"<\\/$1")}import Fr from"fs";var Vr=[];function w(e){let t=new T(e);return Vr.push(t),t}function Ac(){for(let e of Vr)e.clear()}function S(e,...t){return`${t.map((i)=>String(i??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function br(e){let t=[];for(let i of new Set(e))try{t.push({path:i,mtimeMs:Fr.statSync(i).mtimeMs})}catch{}return t}function Ds(e){for(let t of e)try{if(Fr.statSync(t.path).mtimeMs!==t.mtimeMs)return!1}catch{return!1}return!0}var xe=["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 da=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function ga(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let i=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!i)return null;return{pkg:i[1],subpath:i[2]||""}}let t=e.match(/^([^/]+)(\/.*)?$/);if(!t)return null;return{pkg:t[1],subpath:t[2]||""}}function ma(e,t){let i=t;while(!0){let n=ht.join(i,"node_modules",e,"package.json");if(Kt.existsSync(n))return ht.dirname(n);let a=ht.dirname(i);if(a===i)return null;i=a}}function ha(e,t){if(!e||typeof e!=="object")return null;let i=(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 i(a.import);if(typeof a.default==="object")return i(a.default)}return null};if(Object.prototype.hasOwnProperty.call(e,t))return i(e[t]);let n=null;for(let a of Object.keys(e)){let l=a.indexOf("*");if(l===-1)continue;let c=a.slice(0,l),b=a.slice(l+1);if(!t.startsWith(c)||!t.endsWith(b))continue;if(t.length<c.length+b.length)continue;if(!n||c.length>n.prefix.length)n={pattern:a,prefix:c,suffix:b}}if(n){let a=t.slice(n.prefix.length,t.length-n.suffix.length),l=i(e[n.pattern]);if(l)return l.replace("*",a)}return null}function xa(e,t){let i=ga(e);if(!i||!i.subpath)return null;let n=ma(i.pkg,t);if(!n)return null;let a;try{a=JSON.parse(Kt.readFileSync(ht.join(n,"package.json"),"utf8"))}catch{return null}let l=`.${i.subpath}`,c=ha(a.exports,l);if(!c)return null;let b=ht.resolve(n,c);return Kt.existsSync(b)?b:null}function hi(e,t){let i=t.filePath?ht.dirname(t.filePath):t.projectRoot||process.cwd(),n=t.projectRoot||process.cwd(),a=new Set,l=[],c=[];return{code:e.replace(da,(v,E)=>{let A;try{if(E.startsWith("./")||E.startsWith("../")||E.startsWith("/")){if(A=E.startsWith("/")?E:ht.resolve(i,E),!Kt.existsSync(A))throw Error(`file not found: ${A}`)}else{let M=null;try{M=Bun.resolveSync(E,n)}catch{M=xa(E,n)}if(!M)throw Error(`could not resolve ${E} (Bun.resolveSync + exports fallback both failed)`);A=M}}catch(M){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(E)} (from ${t.filePath||"<unknown>"}): ${M?.message||M}`),c.push(E),""}if(a.has(A))return"";a.add(A);try{let M=Kt.readFileSync(A,"utf8");l.push({source:E,resolvedPath:A,contents:M})}catch(M){console.warn(`[stx:vendor-css] could not read ${A}: ${M?.message||M}`),c.push(E)}return""}),styles:l,unresolved:c}}function ba(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function yi(e){if(e.length===0)return"";return`${e.map((t)=>`<style data-stx-vendor="${ba(t.source)}" data-stx-layer="vendor">
|
|
114
|
+
</script>`}function oa(e,t=""){let i=Dr(e,t);if(i.length===0)return{template:e,bindings:[]};let n=e,a=[];for(let l=i.length-1;l>=0;l--){let c=i[l],b=c.originalTag;if(!b.includes(" id="))b=b.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${c.elementId}"`);else{let v=b.match(/id=["']([^"']+)["']/);if(v)for(let E of c.events)E.elementId=v[1]}for(let v of c.events){let E=v.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),A=new RegExp(`\\s*${E}\\s*=\\s*"[^"]*"`,"g"),O=new RegExp(`\\s*${E}\\s*=\\s*'[^']*'`,"g");b=b.replace(A,""),b=b.replace(O,"")}n=n.slice(0,c.startIndex)+b+n.slice(c.endIndex),a.push(...c.events)}return{template:n,bindings:a}}function Mr(e){let t=e.$uid;return typeof t==="string"&&t?`${t}_`:""}function Ac(e,t,i){if(fl(e))return e;if(t.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:b,bindings:v}=oa(e,Mr(t)),E=t.__stx_event_bindings||[];return t.__stx_event_bindings=[...E,...v],b}let n=Dr(e,Mr(t));if(n.length===0)return e;let a=e;for(let b=n.length-1;b>=0;b--){let v=n[b],E=v.originalTag;if(!E.includes(" id="))E=E.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${v.elementId}"`);else{let A=E.match(/id=["']([^"']+)["']/);if(A)for(let O of v.events)O.elementId=A[1]}for(let A of v.events){let O=A.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),H=new RegExp(`\\s*${O}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${O}\\s*=\\s*'[^']*'`,"g");E=E.replace(H,""),E=E.replace(j,"")}a=a.slice(0,v.startIndex)+E+a.slice(v.endIndex)}let l=ci(n.flatMap((b)=>b.events)),c=a.lastIndexOf("</body>");if(c!==-1)a=a.slice(0,c)+l+`
|
|
115
|
+
`+a.slice(c);else a+=l;return a}function Nr(e,t){let i=new Set;for(let n of e.split(",")){let a=n.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(t){let l=a.lastIndexOf(":");if(l!==-1)a=a.slice(l+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))i.add(a)}return i}function At(e,t){let i=r(e),{depths:n,balanced:a}=me(i),l=(b)=>!a||n[b]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${t}\\b)`,"g");for(let b of i.matchAll(c)){let v=(b.index??0)+b[0].length-b[1].length;if(l(v))return!0}for(let b of i.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(b.index??0)&&Nr(b[1],!0).has(t))return!0;for(let b of i.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(b.index??0)&&Nr(b[1],!1).has(t))return!0;return!1}var Lr=new T(32,{maxBytes:2097152,sizeOf:(e)=>e.code.length*4}),dt=/^[A-Za-z_$][\w$]*$/,aa=new Set(["if","for","while","switch","with"]),zr=["(","[","{"],Br=[")","]","}"],ca=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function la(e){let t=r(e),i=[];for(let n of t.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=n.index??0;i.push({text:n[0],start:a,end:a+n[0].length})}return{code:t,tokens:i}}function ds(e){let t=Lr.get(e);if(t)return t;let{code:i,tokens:n}=la(e),a=new Map,l=[];for(let L=0;L<n.length;L++){let F=n[L].text;if(["(","[","{"].includes(F))l.push(L);else if([")","]","}"].includes(F)){let G=l.at(-1);if(G!==void 0&&["()","[]","{}"].includes(n[G].text+F))l.pop(),a.set(G,L),a.set(L,G)}}function c(L,F){let G=[],D=L;for(let ee=L;ee<F;ee++){if(["(","[","{"].includes(n[ee].text)&&(a.get(ee)??F)<F){ee=a.get(ee);continue}if(n[ee].text===",")G.push([D,ee]),D=ee+1}return G.push([D,F]),G}let b=[];function v(L,F,G,D=!1){if(n[L]?.text==="...")L++;if(L>=F)return;let ee=n[L].text;if(dt.test(ee)){if(G.add(ee),G===O)b.push({name:ee,token:L,functionScoped:D});return}if(ee!=="{"&&ee!=="[")return;let ne=a.get(L);if(ne===void 0||ne>=F)return;for(let[te,le]of c(L+1,ne)){let he=te;if(ee==="{")for(let ue=te;ue<le;ue++){if(n[ue].text===":"){he=ue+1;break}if(n[ue].text==="=")break;if(["(","[","{"].includes(n[ue].text)&&a.has(ue))ue=a.get(ue)}v(he,le,G,D)}}function E(L,F){let G=new Set;for(let[D,ee]of c(L,F))v(D,ee,G);return G}function A(L){let F=L;for(;F<n.length;F++){let G=n[F].text;if(["(","[","{"].includes(G)&&a.has(F)){F=a.get(F);continue}if([",",";",")","]","}"].includes(G))break}return n[Math.max(L,F-1)]?.end??i.length}let O=new Set,H=[];for(let L=0;L<n.length;L++)if(n[L].text==="=>"){let F=L-1,G=F,D;if(n[F]?.text===")"&&a.has(F))G=a.get(F),D=E(G+1,F);else if(n[F]&&dt.test(n[F].text))D=new Set([n[F].text]);else continue;let ee=L+1,ne=n[ee]?.text==="{"&&a.has(ee)?n[a.get(ee)].end:A(ee);H.push({start:n[G].start,end:ne,bodyStart:n[ee]?.start??ne,functionBody:!0,names:D})}else if(n[L].text==="("&&a.has(L)){let F=n[L-1]?.text;if(!F||aa.has(F)||!dt.test(F)&&F!=="*"&&F!=="]")continue;let G=a.get(L),D=G+1;if(n[D]?.text===":"){D++;while(D<n.length&&!["{","=>",";","="].includes(n[D].text))D++}if(n[D]?.text!=="{"||!a.has(D))continue;H.push({start:n[L].start,end:n[a.get(D)].end,bodyStart:n[D].start,functionBody:F!=="catch",names:E(L+1,G)})}function j(L){let F=L;for(;F<n.length;F++){let G=n[F].text;if(zr.includes(G)&&a.has(F)){F=a.get(F);continue}if(G===";"||Br.includes(G))break;let D=n[F-1];if(F>L&&ca.has(G)&&D.text!==".")break;if(F>L&&/[\n\r]/.test(i.slice(D.end,n[F].start))&&(/^[\w$]+$/.test(D.text)||Br.includes(D.text)||['"',"'","`"].includes(D.text))&&dt.test(G)&&!["in","of","instanceof"].includes(G))break}return F}let P=[];for(let L=0;L<n.length;L++){if(n[L].text!=="for")continue;let F=n[L+1]?.text==="await"?L+2:L+1;if(n[F]?.text!=="("||!a.has(F))continue;let G=a.get(F),D=G+1,ee=n[D]?.text==="{"&&a.has(D)?a.get(D):j(D),ne=n[ee]?.text===";"||n[ee]?.text==="}"?n[ee].end:n[Math.max(D,ee-1)]?.end??i.length;P.push({headStart:F,headEnd:G,start:n[F].start,end:ne})}for(let L=0;L<n.length;L++){let F=n[L].text,G=n[L-1]?.text;if(G==="."||n[L+1]?.text===":")continue;if(G==="as"||G==="<")continue;if(F==="const"||F==="let"||F==="var"){let D=j(L+1),ee=L+1,ne=!1,te=!1,le=0;for(let he=L+1;he<=D;he++){let ue=n[he]?.text;if(he<D&&zr.includes(ue)&&a.has(he)&&a.get(he)<D){he=a.get(he);continue}if(he<D&&ue===":"&&!te)ne=!0;else if(he<D&&ue==="="&&le===0)ne=!1,te=!0;else if(he<D&&ne&&ue==="<")le++;else if(he<D&&ne&&ue===">"&&le>0)le--;else if(he===D||ue===","&&le===0)v(ee,he,O,F==="var"),ee=he+1,ne=!1,te=!1}}else if(F==="function"||F==="class"){let D=L+1;if(n[D]?.text==="*")D++;if(n[D]&&dt.test(n[D].text)&&n[D].text!=="extends")O.add(n[D].text),b.push({name:n[D].text,token:D})}else if(F==="import"){let D=L+1;if(n[D]?.text==="*"&&n[D+1]?.text==="as")D+=2;let ee=n[D]?.text;if(ee&&dt.test(ee)&&ee!=="type"&&n[D+1]?.text!=="("&&n[D+1]?.text!==".")O.add(ee),b.push({name:ee,token:D,file:!0});let ne=n[D]?.text==="{"?D:n[D+1]?.text===","&&n[D+2]?.text==="{"?D+2:-1;if(ne!==-1&&a.has(ne)){let te=a.get(ne);for(let[le,he]of c(ne+1,te)){let ue=he-1;while(ue>=le&&!dt.test(n[ue].text))ue--;if(ue>=le&&n[ue].text!=="type")b.push({name:n[ue].text,token:ue,file:!0})}}}}let B={code:i,scopes:H,loops:P,declarations:O,sites:b,tokens:n,pairs:a};return Lr.set(e,B),B}function Zt(e){let t=ds(e);return{code:t.code,shadows:(i,n)=>t.scopes.some((a)=>n>=a.start&&n<a.end&&a.names.has(i))}}function In(e){return new Set(ds(e).declarations)}function Oe(e,t){let{scopes:i,loops:n,sites:a,tokens:l,pairs:c}=ds(e),b=Array.from({length:l.length},()=>-1),v=[];for(let j=0;j<l.length;j++){b[j]=v.length?v[v.length-1]:-1;let P=l[j].text;if(P==="{"&&c.has(j))v.push(j);else if(P==="}"&&v.length&&c.get(j)===v[v.length-1])v.pop()}let E=new Set,A=new Map;for(let j of a){if(!t.has(j.name))continue;E.add(j.token);let P=j.file?-1:b[j.token],B=P===-1?[0,Number.POSITIVE_INFINITY]:[l[P].start,l[c.get(P)].end];if(j.functionScoped){let F=l[j.token].start,G=i.filter((D)=>D.functionBody&&F>=D.bodyStart&&F<D.end).sort((D,ee)=>D.end-D.bodyStart-(ee.end-ee.bodyStart))[0];B=G?[G.bodyStart,G.end]:[0,Number.POSITIVE_INFINITY]}else if(!j.file){let F=n.filter((G)=>j.token>G.headStart&&j.token<G.headEnd).sort((G,D)=>G.headEnd-G.headStart-(D.headEnd-D.headStart))[0];if(F)B=[F.start,F.end]}let L=A.get(j.name);if(L)L.push(B);else A.set(j.name,[B])}let O=new Set;for(let j=0;j<l.length;j++){if(l[j].text!=="import"||l[j-1]?.text===".")continue;let P=j+1;if(l[P]?.text==="type")P++;if(l[P]&&dt.test(l[P].text)&&l[P+1]?.text===",")P+=2;if(l[P]?.text==="{"&&c.has(P))for(let B=P+1;B<c.get(P);B++)O.add(B)}let H=new Set;for(let j=0;j<l.length;j++){let P=l[j].text;if(!t.has(P)||H.has(P)||E.has(j)||O.has(j))continue;let B=l[j-1]?.text;if(B==="#"||B==="."&&l[j-2]?.text!=="..")continue;if(l[j+1]?.text===":"&&(B==="{"||B===","))continue;let L=l[j].start;if(A.get(P)?.some(([F,G])=>L>=F&&L<G))continue;if(i.some((F)=>L>=F.start&&L<F.end&&F.names.has(P)))continue;H.add(P)}return H}var Ie="0.2.827";var Wr=Symbol.for(`stx.lazy-module-promises.${Ie}`);function fa(){let e=globalThis;return e[Wr]??=new Map,e[Wr]}function o(e,t){let i=fa(),n=`${import.meta.url}\x00${e}`,a=i.get(n);if(a)return a;let l=t();return i.set(n,l),l.catch(()=>{if(i.get(n)===l)i.delete(n)}),l}var pa=/<\/(script)/gi;function pn(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(pa,"<\\/$1")}import Fr from"fs";var Vr=[];function w(e){let t=new T(e);return Vr.push(t),t}function Pc(){for(let e of Vr)e.clear()}function S(e,...t){return`${t.map((i)=>String(i??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function br(e){let t=[];for(let i of new Set(e))try{t.push({path:i,mtimeMs:Fr.statSync(i).mtimeMs})}catch{}return t}function Ds(e){for(let t of e)try{if(Fr.statSync(t.path).mtimeMs!==t.mtimeMs)return!1}catch{return!1}return!0}var Se=["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 da=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function ga(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let i=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!i)return null;return{pkg:i[1],subpath:i[2]||""}}let t=e.match(/^([^/]+)(\/.*)?$/);if(!t)return null;return{pkg:t[1],subpath:t[2]||""}}function ma(e,t){let i=t;while(!0){let n=ht.join(i,"node_modules",e,"package.json");if(Kt.existsSync(n))return ht.dirname(n);let a=ht.dirname(i);if(a===i)return null;i=a}}function ha(e,t){if(!e||typeof e!=="object")return null;let i=(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 i(a.import);if(typeof a.default==="object")return i(a.default)}return null};if(Object.prototype.hasOwnProperty.call(e,t))return i(e[t]);let n=null;for(let a of Object.keys(e)){let l=a.indexOf("*");if(l===-1)continue;let c=a.slice(0,l),b=a.slice(l+1);if(!t.startsWith(c)||!t.endsWith(b))continue;if(t.length<c.length+b.length)continue;if(!n||c.length>n.prefix.length)n={pattern:a,prefix:c,suffix:b}}if(n){let a=t.slice(n.prefix.length,t.length-n.suffix.length),l=i(e[n.pattern]);if(l)return l.replace("*",a)}return null}function xa(e,t){let i=ga(e);if(!i||!i.subpath)return null;let n=ma(i.pkg,t);if(!n)return null;let a;try{a=JSON.parse(Kt.readFileSync(ht.join(n,"package.json"),"utf8"))}catch{return null}let l=`.${i.subpath}`,c=ha(a.exports,l);if(!c)return null;let b=ht.resolve(n,c);return Kt.existsSync(b)?b:null}function yi(e,t){let i=t.filePath?ht.dirname(t.filePath):t.projectRoot||process.cwd(),n=t.projectRoot||process.cwd(),a=new Set,l=[],c=[];return{code:e.replace(da,(v,E)=>{let A;try{if(E.startsWith("./")||E.startsWith("../")||E.startsWith("/")){if(A=E.startsWith("/")?E:ht.resolve(i,E),!Kt.existsSync(A))throw Error(`file not found: ${A}`)}else{let O=null;try{O=Bun.resolveSync(E,n)}catch{O=xa(E,n)}if(!O)throw Error(`could not resolve ${E} (Bun.resolveSync + exports fallback both failed)`);A=O}}catch(O){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(E)} (from ${t.filePath||"<unknown>"}): ${O?.message||O}`),c.push(E),""}if(a.has(A))return"";a.add(A);try{let O=Kt.readFileSync(A,"utf8");l.push({source:E,resolvedPath:A,contents:O})}catch(O){console.warn(`[stx:vendor-css] could not read ${A}: ${O?.message||O}`),c.push(E)}return""}),styles:l,unresolved:c}}function ba(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function bi(e){if(e.length===0)return"";return`${e.map((t)=>`<style data-stx-vendor="${ba(t.source)}" data-stx-layer="vendor">
|
|
116
116
|
@layer vendor {
|
|
117
117
|
${t.contents}
|
|
118
118
|
}
|
|
119
119
|
</style>`).join(`
|
|
120
120
|
`)}
|
|
121
|
-
`}var
|
|
121
|
+
`}var cg=k,Ur=w(256);function Mt(e){let t=S(e),i=Ur.get(t);if(!i)i=ya(e),Ur.set(t,i);return{code:i.code,imports:[...i.imports],models:[...i.models]}}function ya(e){let t=r(e),i=new Set;for(let b of e.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let v of b[1].split(",")){let E=v.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(E)i.add(E)}let n=In(t),a=Se.filter((b)=>{if(i.has(b)||n.has(b))return!1;return lg(t,b,!0)}),l=Kr(t).filter((b)=>!i.has(b)&&!n.has(b));if(a.length===0&&l.length===0)return{code:e,imports:a,models:l};return{code:`${[a.length>0?`import { ${a.join(", ")} } from '@stacksjs/browser'`:"",l.length>0?"import '@stacksjs/browser'":"",l.length>0?`const { ${l.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
|
|
122
122
|
`)}
|
|
123
|
-
${e}`,imports:a,models:l}}var _a=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 Kr(e,t=Zt(e)){let i=new Set,n=In(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 l of t.code.matchAll(a)){let c=l[1];if(_a.has(c)||n.has(c)||c.length<3)continue;if(t.shadows(c,l.index??0))continue;i.add(c)}return Array.from(i)}function wa(e){return In(e)}var Hr=w(128);function
|
|
123
|
+
${e}`,imports:a,models:l}}var _a=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 Kr(e,t=Zt(e)){let i=new Set,n=In(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 l of t.code.matchAll(a)){let c=l[1];if(_a.has(c)||n.has(c)||c.length<3)continue;if(t.shadows(c,l.index??0))continue;i.add(c)}return Array.from(i)}function wa(e){return In(e)}var Hr=w(128);function Gc(e){let t=S(e),i=Hr.get(t);if(!i)i=Sa(e),Hr.set(t,i);return{code:i.code,stxImports:[...i.stxImports],browserImports:[...i.browserImports]}}function Sa(e){let t=new Set,i=new Set,n=e;n=n.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let a=new Set,l=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,c;while((c=l.exec(e))!==null){let j=c[1],P=c[2];if(c[0].includes("import type"))continue;let B=[];for(let F of j.split(",")){let G=F.trim();if(!G||G.startsWith("type "))continue;let D=G.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!D)continue;let ee=D[1],ne=D[2]||ee;if(a.add(ee),a.add(ne),P==="stx"||P==="@stacksjs/stx")t.add(ee);else i.add(ee);if(ne!==ee)B.push(`${ne} = ${ee}`)}let L=B.length>0?`var ${B.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";n=n.replace(c[0],L)}let b=wa(n),v=Zt(n);for(let j of cg){if(a.has(j)||b.has(j))continue;if(gs(v,j,!0))t.add(j)}let E=r(n),A=Zt(E),O=new Set;for(let j of n.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let P of j[1].split(",")){let B=P.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let L of B){let F=L.trim();if(F)O.add(F)}}for(let j of Se){if(a.has(j)||b.has(j)||O.has(j))continue;if(gs(A,j))i.add(j)}let H=Kr(E,A);for(let j of H)if(!a.has(j)&&!b.has(j))i.add(j);return{code:n,stxImports:Array.from(t),browserImports:Array.from(i)}}function lg(e,t,i=!1){return gs(Zt(e),t,i)}function gs(e,t,i=!1){let n=e.code,a=new RegExp(`\\b${t.replace(/[$]/g,"\\$")}\\b`,"g");for(let l of n.matchAll(a)){let c=l.index??0;if(e.shadows(t,c))continue;let b=c+t.length,v=c-1;while(v>=0&&/\s/.test(n[v]))v--;if(n[v]==="."&&n.slice(Math.max(0,v-2),v+1)!=="...")continue;let E=b;while(E<n.length&&/\s/.test(n[E]))E++;if(n[E]===":"&&n[E+1]!==":"&&(n[v]==="{"||n[v]===","))continue;if(i&&!/^\s*(?:<[^>]*>)?\s*\(/.test(n.slice(b)))continue;if($a(n,b))continue;return!0}return!1}function $a(e,t){let i=t;while(i<e.length&&(e[i]===" "||e[i]==="\t"))i++;if(e[i]!=="(")return!1;let n=0;for(;i<e.length;i++){let a=e[i];if(a==="(")n++;else if(a===")"){if(n--,n===0)break}}if(n!==0)return!1;i++;while(i<e.length&&(e[i]===" "||e[i]==="\t"))i++;return e[i]==="{"}function Jc(e,t){let i=[];if(e.length>0)i.push(` var { ${e.join(", ")} } = window.stx || window;`);if(t.length>0)i.push(` var { ${t.join(", ")} } = window.StacksBrowser || {};`);if(i.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
|
|
124
124
|
${i.join(`
|
|
125
125
|
`)}
|
|
126
|
-
${va(e,t)}`;return""}function
|
|
126
|
+
${va(e,t)}`;return""}function Yh(e,t=[]){let{browserImports:i}=Gc(e),n=new Set(t);return Jc([],i.filter((a)=>!n.has(a)))}function va(e,t){let i=[...e.map((n)=>`['${n}', typeof ${n}, 'stx']`),...t.map((n)=>`['${n}', typeof ${n}, '@stacksjs/browser']`)];if(i.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
|
|
127
127
|
[${i.join(", ")}].forEach(function (e) {
|
|
128
128
|
if (e[1] !== 'undefined') return;
|
|
129
129
|
console.error(
|
|
@@ -132,12 +132,12 @@ ${va(e,t)}`;return""}function Gh(e,t=[]){let{browserImports:i}=Xc(e),n=new Set(t
|
|
|
132
132
|
+ 'or it should be imported from a relative path so the bundler includes it.'
|
|
133
133
|
);
|
|
134
134
|
});
|
|
135
|
-
`}function
|
|
135
|
+
`}function Le(e){let t=e.__stxClientPayload;if(t&&typeof t==="object"){let n={};for(let a in t){let l=t[a];if(typeof l==="function")continue;n[a]=l}return n.__stxDeclaredPayload=!0,n}let i={};for(let n in e){if(n.startsWith("__")||n.startsWith("$"))continue;let a=e[n];if(typeof a==="function")continue;i[n]=a}return i}var Ea=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,qr=new Set;function ka(e,t){let i=Ea.test(e),n=t.length>32768;if(!i&&!n)return;if(qr.has(e))return;if(qr.add(e),i)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(n)console.warn(`[stx] server\u2192client bridge is publishing ${(t.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 bn(e,t){if(!t)return"";let i=Oe(e,new Set(Object.keys(t))),n=t.__stxDeclaredPayload===!0,a=[],l=Object.entries(t).sort(([c],[b])=>c<b?-1:c>b?1:0);for(let[c,b]of l){if(!/^[A-Za-z_$][\w$]*$/.test(c))continue;if(c.startsWith("__")||c.startsWith("$"))continue;if(!n&&!i.has(c))continue;if(At(e,c)){if(n)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 v;try{v=JSON.stringify(b)}catch{continue}if(v===void 0)continue;ka(c,v),a.push(` var ${c} = ${v.replace(/</g,"\\u003c")};`)}if(a.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
|
|
136
136
|
${a.join(`
|
|
137
137
|
`)}
|
|
138
|
-
`}var Ra={left:0,middle:1,right:2};function Ca(e){let t=[];if(e.self)t.push("if ($event.target !== $el) return");for(let i of e.systemKeys)t.push(`if (!$event.${i}Key) return`);if(e.keys.length>0){let i=e.keys.map((n)=>`$event.key === '${n}'`).join(" || ");t.push(`if (!(${i})) return`)}if(e.mouse!==null){let i=Ra[e.mouse];t.push(`if ($event.button !== ${i}) return`)}if(e.prevent)t.push("$event.preventDefault()");if(e.stop)t.push("$event.stopPropagation()");return t.join("; ")}function Aa(e,t){let{elementId:i,event:n,modifiers:a}=e,l=ps(e.handler),c=Ca(a),b=[];if(a.once)b.push("once: true");if(a.capture)b.push("capture: true");if(fs(n,a))b.push("passive: true");let v=b.length>0?`, { ${b.join(", ")} }`:"",E="";if(c)E+=`${c}; `;let A=l.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),
|
|
138
|
+
`}var Ra={left:0,middle:1,right:2};function Ca(e){let t=[];if(e.self)t.push("if ($event.target !== $el) return");for(let i of e.systemKeys)t.push(`if (!$event.${i}Key) return`);if(e.keys.length>0){let i=e.keys.map((n)=>`$event.key === '${n}'`).join(" || ");t.push(`if (!(${i})) return`)}if(e.mouse!==null){let i=Ra[e.mouse];t.push(`if ($event.button !== ${i}) return`)}if(e.prevent)t.push("$event.preventDefault()");if(e.stop)t.push("$event.stopPropagation()");return t.join("; ")}function Aa(e,t){let{elementId:i,event:n,modifiers:a}=e,l=ps(e.handler),c=Ca(a),b=[];if(a.once)b.push("once: true");if(a.capture)b.push("capture: true");if(fs(n,a))b.push("passive: true");let v=b.length>0?`, { ${b.join(", ")} }`:"",E="";if(c)E+=`${c}; `;let A=l.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),O=`var $emit = function(name, detail) {
|
|
139
139
|
$el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
|
|
140
|
-
};`;function
|
|
140
|
+
};`;function H(j){if(/\$emit\s*\(/.test(j))return`${O}
|
|
141
141
|
${j}`;return`var scope = $el.closest('[data-stx-scope]');
|
|
142
142
|
if (scope && scope.__stx_execute) {
|
|
143
143
|
scope.__stx_execute('${A}', $event, $el);
|
|
@@ -151,7 +151,7 @@ else {
|
|
|
151
151
|
var __timer
|
|
152
152
|
$el.addEventListener('${n}', function($event) {
|
|
153
153
|
${c?c+"; ":""}clearTimeout(__timer)
|
|
154
|
-
__timer = setTimeout(function() { ${
|
|
154
|
+
__timer = setTimeout(function() { ${H(l)} }, ${a.debounce})
|
|
155
155
|
}${v})
|
|
156
156
|
})()`;if(a.throttle!==null)return` ;(function() {
|
|
157
157
|
// eslint-disable-next-line pickier/no-unused-vars
|
|
@@ -162,12 +162,12 @@ else {
|
|
|
162
162
|
${c?c+"; ":""}var __now = Date.now()
|
|
163
163
|
if (__now - __last >= ${a.throttle}) {
|
|
164
164
|
__last = __now
|
|
165
|
-
${
|
|
165
|
+
${H(l)}
|
|
166
166
|
}
|
|
167
167
|
}${v})
|
|
168
168
|
})()`;if(/\$emit\s*\(/.test(l))return` var $el = document.getElementById('${i}')
|
|
169
169
|
if ($el) $el.addEventListener('${n}', function($event) {
|
|
170
|
-
${E}${
|
|
170
|
+
${E}${O}
|
|
171
171
|
${l}
|
|
172
172
|
}${v})`;return` var $el = document.getElementById('${i}')
|
|
173
173
|
if ($el) $el.addEventListener('${n}', function($event) {
|
|
@@ -182,46 +182,46 @@ else {
|
|
|
182
182
|
// STX: auto-generated event bindings
|
|
183
183
|
${e.map((i,n)=>Aa(i,n)).join(`
|
|
184
184
|
`)}`}function Zr(e){let t=[],i=new Set,n=e.replace(/^\s*import\s+.*$/gm,""),a=0,l=n.length,c=0;while(c<l){let b=n[c];if(b==="'"||b==='"'||b==="`"){let v=b;if(c++,v==="`"){let E=0;while(c<l){if(n[c]==="\\"){c+=2;continue}if(n[c]==="`"&&E===0){c++;break}if(n[c]==="$"&&n[c+1]==="{"){E++,c+=2;continue}if(n[c]==="}"&&E>0){E--,c++;continue}c++}}else while(c<l){if(n[c]==="\\"){c+=2;continue}if(n[c]===v){c++;break}c++}continue}if(b==="/"&&n[c+1]==="/"){while(c<l&&n[c]!==`
|
|
185
|
-
`)c++;continue}if(b==="/"&&n[c+1]==="*"){c+=2;while(c<l-1&&!(n[c]==="*"&&n[c+1]==="/"))c++;c+=2;continue}if(b==="{"){a++,c++;continue}if(b==="}"){a--,c++;continue}if(a===0){let v=n.slice(c),E=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(E){let
|
|
186
|
-
${
|
|
187
|
-
${
|
|
188
|
-
</script>`}let
|
|
189
|
-
return ${Is(i,D)};`:"",ne=JSON.stringify(`[stx] client block failed${t.filePath?` (${t.filePath})`:""}; this block will not hydrate`);return`${b}<script data-stx-scoped data-stx-run="always"${
|
|
185
|
+
`)c++;continue}if(b==="/"&&n[c+1]==="*"){c+=2;while(c<l-1&&!(n[c]==="*"&&n[c+1]==="/"))c++;c+=2;continue}if(b==="{"){a++,c++;continue}if(b==="}"){a--,c++;continue}if(a===0){let v=n.slice(c),E=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(E){let H=E[1];if(!H.startsWith("_")&&!i.has(H))t.push(H),i.add(H);c+=E[0].length;continue}let A=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){A[1].split(",").forEach((H)=>{let j=H.trim(),P=j.indexOf(":"),B=P>=0?j.slice(P+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(B&&!B.startsWith("_")&&!i.has(B))t.push(B),i.add(B)}),c+=A[0].length;continue}let O=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(O){let H=O[1];if(!H.startsWith("_")&&!i.has(H))t.push(H),i.add(H);c+=O[0].length;continue}}c++}return t}var Ia=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 Pa(e){let t=new Set,i=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function n(H){let j;while((j=i.exec(H))!==null){let P=j[0];if(!Ia.has(P))t.add(P)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)n(l[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=c.exec(e))!==null)n(l[1]);let b=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=b.exec(e))!==null)n(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)n(l[1]);let E=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=E.exec(e))!==null)n(l[1]);let A=/@model\s*=\s*["']([^"']*)["']/gi;while((l=A.exec(e))!==null)n(l[1]);let O=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=O.exec(e))!==null)n(l[1]);return t}async function je(e,t={}){let i=e,n="",a=!1,l=[],c=yi(i,{filePath:t.filePath,projectRoot:t.projectRoot});i=c.code;let b=bi(c.styles),v=Mt(i);i=v.code,l=[...v.imports,...v.models];let{hasUserImports:E,bundleClientScript:A}=await o("stx/client-script-bundler",()=>import("./chunk-a7ewznxk.js"));if(E(i))i=await A(i,t.filePath||"",{projectRoot:t.projectRoot,minify:t.production}),a=!0;if(t.autoImports!==!1){let D=Gc(i);i=D.code,n=Jc(D.stxImports,D.browserImports.filter((ee)=>!l.includes(ee)))}if(n=`${bn(i,t.serverData)}${n}`,i=I(i),!a&&Be(t.attrs||""))i=Fe(i);let O=Ta(t.eventBindings||[]),H=(t.attrs||"").trim(),j=/\btype\s*=\s*["']module["']/i.test(H),P=t.instanceId?` data-stx-instance="${t.instanceId}"`:"";if(j){let D=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),ee=`type="module" data-stx-scoped${P}${D?` ${D}`:""}`;return`${b}<script ${ee}>
|
|
186
|
+
${pn(`${n}${i}
|
|
187
|
+
${O}`)}
|
|
188
|
+
</script>`}let B=Pi(e),L=/function __stx_setup_/.test(i),F=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function G(D){let ee=D.length>0?`
|
|
189
|
+
return ${Is(i,D)};`:"",ne=JSON.stringify(`[stx] client block failed${t.filePath?` (${t.filePath})`:""}; this block will not hydrate`);return`${b}<script data-stx-scoped data-stx-run="always"${P}>
|
|
190
190
|
window.stx.mount(function() {
|
|
191
191
|
'use strict';
|
|
192
192
|
try {
|
|
193
|
-
${
|
|
194
|
-
${
|
|
193
|
+
${pn(`${n}${i}
|
|
194
|
+
${O}${ee}`)}
|
|
195
195
|
} catch (error) {
|
|
196
196
|
console.error(${ne}, error);
|
|
197
197
|
return {};
|
|
198
198
|
}
|
|
199
|
-
})</script>`}if(!
|
|
199
|
+
})</script>`}if(!F&&!L){if(B)return G(Zr(e));if(t.templateContent){let D=Zr(e);if(D.length>0){let ee=Pa(t.templateContent);if(D.some((te)=>ee.has(te)))return G(D)}}}return`${b}<script data-stx-scoped data-stx-run="always"${P}>
|
|
200
200
|
;(function() {
|
|
201
201
|
'use strict';
|
|
202
202
|
try {
|
|
203
|
-
${
|
|
204
|
-
${
|
|
203
|
+
${pn(`${n}${i}
|
|
204
|
+
${O}`)}
|
|
205
205
|
} catch (error) {
|
|
206
206
|
console.error(${JSON.stringify(`[stx] client block failed${t.filePath?` (${t.filePath})`:""}; this block will not hydrate`)}, error);
|
|
207
207
|
}
|
|
208
|
-
})()</script>`}import{createHash as za}from"crypto";var ms=/<(\/?)([a-zA-Z][a-zA-Z0-9-]*)\b/y;function
|
|
208
|
+
})()</script>`}import{createHash as za}from"crypto";var ms=/<(\/?)([a-zA-Z][a-zA-Z0-9-]*)\b/y;function li(e){let t=[],i=0;while(i<e.length){let n=e.indexOf("<",i);if(n===-1)break;if(e.startsWith("<!--",n)){let O=e.indexOf("-->",n+4);if(O===-1)break;i=O+3;continue}ms.lastIndex=n;let a=ms.exec(e);if(!a){i=n+1;continue}let l=ms.lastIndex,c=l,b=null;for(;c<e.length;c++){let O=e[c];if(b){if(O===b)b=null}else if(O==='"'||O==="'")b=O;else if(O===">")break}if(c===e.length)break;let v=a[1]==="/",E=e[c-1]==="/";t.push({start:n,end:c+1,name:a[2],attributes:e.slice(l,E?c-1:c),closing:v,selfClosing:E}),i=c+1;let A=a[2].toLowerCase();if(!v&&(A==="script"||A==="style")){let O=A==="script"?Mn:jn;O.lastIndex=i;let H=O.exec(e);if(!H)break;i=H.index}}return t}var Pn=/<script\b[^>]*>/iy,Mn=/<\/script\s*>/ig,On=/<style\b[^>]*>/iy,jn=/<\/style\s*>/ig;function Xr(e,t,i,n){i.lastIndex=t;let a=i.exec(e);if(!a||a.index!==t)return-1;n.lastIndex=i.lastIndex;let l=n.exec(e);if(!l)return-1;return l.index+l[0].length}function q(e,t){return Xr(e,t,Pn,Mn)}function fn(e,t){return Xr(e,t,On,jn)}function Me(e,t){if(!e.startsWith("<!--",t))return-1;let i=e.indexOf("-->",t+4);if(i===-1)return-1;return i+3}function Jr(e,t){if(e.startsWith("<!--",t)){let a=Me(e,t);return a===-1?e.length:a}if(Pn.lastIndex=t,Pn.exec(e)?.index===t){Mn.lastIndex=Pn.lastIndex;let a=Mn.exec(e);return a?a.index+a[0].length:e.length}if(On.lastIndex=t,On.exec(e)?.index===t){jn.lastIndex=On.lastIndex;let a=jn.exec(e);return a?a.index+a[0].length:e.length}return-1}function y(e,t){let i=[],n=0,a=e.length,l=!1,c=null;while(n<a){let b=e[n];if(l){if(c){if(b===c)c=null}else if(b==='"'||b==="'")c=b;else if(b===">")l=!1;n++;continue}if(b!=="<"){let O=e.indexOf("<",n+1);if(O===-1)break;n=O;continue}let v=t(e,n);if(v>n){i.push({start:n,end:v,token:e.slice(n,v)}),n=v;continue}let E=Jr(e,n);if(E>n){n=E;continue}let A=e.charCodeAt(n+1);if(A>=65&&A<=90||A>=97&&A<=122)l=!0;n++}return i}function Gr(e){let t=0,i=0,n=0,a=!1,l=null;while(n<e.length){if(a){let O=e[n];if(l){if(O===l)l=null}else if(O==='"'||O==="'")l=O;else if(O===">")a=!1;n++;continue}let c=e.indexOf("<",n),b=c===-1?e.length:c;while(n<b){let O=e[n++];if(O==="{")t++;else if(O==="}")i++;if(t>=2&&i>=2)return!0}if(c===-1)break;let v=Jr(e,c);if(v>c){n=v;continue}let E=e.charCodeAt(c+1),A=E===47?e.charCodeAt(c+2):E;if(A>=65&&A<=90||A>=97&&A<=122)a=!0;n=c+1}return!1}function Ic(e,t){while(e.size>=t){let i=e.keys().next();if(i.done)return;e.delete(i.value)}}var Oa=1024,Ma=16777216,Et=new Map,hs=0;function ja(e,t){Et.set(e,t),hs+=e.length+t.output.length;for(let[i,n]of Et){if(hs<=Ma)break;Et.delete(i),hs-=i.length+n.output.length}}function fe(e,t,i,n){let a=n!==void 0&&e.length>=Oa,l=a?`${n}\x00${e}`:"";if(a){let A=Et.get(l);if(A)return Et.delete(l),Et.set(l,A),{output:A.output,tokens:A.tokens.slice()}}let c=y(e,t);if(c.length===0)return{output:e,tokens:[]};let b=c.map((A)=>A.token),v="",E=0;for(let A=0;A<c.length;A++){let O=c[A];v+=e.slice(E,O.start),v+=i(O.token,A),E=O.end}if(v+=e.slice(E),a)return ja(l,{output:v,tokens:b}),{output:v,tokens:b.slice()};return{output:v,tokens:b}}var Da=1024,Na=16777216,kt=new Map,xs=0;function La(e,t){kt.set(e,t),xs+=e.length+t.output.length;for(let[i,n]of kt){if(xs<=Na)break;kt.delete(i),xs-=i.length+n.output.length}}function bs(e,t,i){return{output:t,scripts:i,restore:(n)=>n===t?e:vr(n,i)}}function J(e){let t=e.length>=Da;if(t){let a=kt.get(e);if(a)return kt.delete(e),kt.set(e,a),bs(e,a.output,a.scripts.slice())}let{output:i,tokens:n}=fe(e,q,(a,l)=>`\x00STX_SCRIPT_${l}\x00`);if(t)return La(e,{output:i,scripts:n}),bs(e,i,n.slice());return bs(e,i,n)}function vr(e,t){if(t.length===0)return e;return e.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(i,n)=>t[+n]??"")}var Dn="__stx_component_client_factories";function Nn(e){let t=e[Dn];return t instanceof Map?t:null}function Wc(e){e[Dn]=new Map}function ys(e,t){let i=Nn(e);if(!i)return null;let n=za("sha256").update(t).digest("hex").slice(0,16),a=i.get(n);if(a)a.instances++;else i.set(n,{body:t,instances:1});return n}function qc(e,t){let i=Nn(t);if(!i?.size)return e;let n=new Map;for(let[A,O]of i)if(O.instances===1)n.set(A,O.body);let a=[];if(n.size>0){let A=[...n.keys()].map((j)=>JSON.stringify(j).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),O=new RegExp(`window\\.__stxComponentFactories\\[(${A})\\]\\(("[^"]+")\\);`,"g"),H=O.exec(e);while(H!==null){let j=n.get(JSON.parse(H[1]));if(j!==void 0)a.push({start:H.index,end:H.index+H[0].length,replacement:`(${j})(${H[2]});`});H=O.exec(e)}}let l=[...i].filter(([,A])=>A.instances>1);if(l.length===0)return Yr(e,a);let b=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
|
|
209
209
|
(function() {
|
|
210
210
|
const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
|
|
211
|
-
${l.map(([A,
|
|
211
|
+
${l.map(([A,O])=>` try { factories[${JSON.stringify(A)}] = factories[${JSON.stringify(A)}] || ${O.body}; }
|
|
212
212
|
catch (e) { console.error('[stx] component factory ' + ${JSON.stringify(A)} + ' failed to register; instances of it will not hydrate.', e); }`).join(`
|
|
213
213
|
`)}
|
|
214
214
|
})();
|
|
215
|
-
</script>`,v,E=/<(?:template\b|script\b(?=[^>]*\bdata-stx-scoped\b))/iy;return y(e,(A,
|
|
216
|
-
`}),Yr(e,a)}function Yr(e,t){if(t.length===0)return e;t.sort((l,c)=>l.start-c.start||l.end-c.end);let i=Array(t.length*2+1),n=0,a=0;for(let l of t)i[a++]=e.slice(n,l.start),i[a++]=l.replacement,n=l.end;return i[a]=e.slice(n),i.join("")}function Qr(e){let t=Nn(e),i=new Map;if(t)for(let[n,a]of t)i.set(n,a.instances);return i}function ei(e,t){let i=Nn(e);if(!i)return[];let n=[];for(let[a,l]of i){let c=l.instances-(t.get(a)??0);if(c>0)n.push({body:l.body,count:c})}return n}function ti(e,t){for(let{body:i,count:n}of t)for(let a=0;a<n;a++)ys(e,i)}function ve(e,t,i=2){let n=0,a=null;for(let l=t+i;l<e.length;l++){let c=e[l];if(a){if(c==="\\"){l++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="{"){n++;continue}if(c==="}"){if(n>0){n--;continue}let b=0;while(e[l+b]==="}")b++;if(b>=i)return l}}return-1}import ki from"fs";var ni=0,_s=new Map;function Qc(){ni=0,_s.clear()}function Ln(e,t){let i=ni++,n=`<!--__STX_${e.toUpperCase()}_${i}__-->`;return _s.set(n,{type:e,expression:t}),n}function el(){let e={};for(let[t,i]of _s)e[t]={type:i.type,expression:i.expression};return e}function tl(e,t){let i=e;for(let[n,a]of t)i=i.split(n).join(a);return i}function wi(e){return e.includes("<!--__STX_")}var Ba=/@(?=[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 Wa(e){return Array.from({length:e},()=>"{").join("⁠")}function si(e){return e.replace(/\{{2,}/g,(t)=>Wa(t.length)).replace(/\{(?=!)/g,"{⁠").replace(Ba,"@")}function xr(e,t,i=!1){let{openTag:n,tail:a}=i?Fa(e,t):Va(e).at(t);return Ha(a,n,i)}function Fa(e,t){let i="",n=0;for(let c=0;c<t;c++){if(!e.startsWith("{{",c))continue;let b=ve(e,c);if(b<0||b+2>t)break;i+=e.slice(n,c)+"x",c=b+1,n=b+2}i+=e.slice(n,t);let a=-1,l=null;for(let c=0;c<i.length;c++){let b=i[c];if(l){if(b===l)l=null;continue}if(b==='"'||b==="'"){l=b;continue}if(b===">"){a=-1;continue}if(b==="<")a=c}return{openTag:a,tail:a>=0?i.slice(a+1):i}}var zn=null;function Va(e){if(zn&&zn.source===e)return zn.scanner;let t=Ua(e);return zn={source:e,scanner:t},t}function Ua(e){let t=0,i=-1,n=null,a=-1,l=(b,v)=>{let E=e[b];if(v.quote){if(E===v.quote)v.quote=null;return}if(v.openTag>=0){if(E==='"'||E==="'"){v.quote=E;return}if(E===">"){v.openTag=-1;return}}if(E==="<")v.openTag=b},c=(b,v)=>{if(v.openTag>=0||!e.startsWith("<!--",b))return-1;let E=e.indexOf("-->",b+4);return E<0?e.length:E+3};return{at(b){if(b<t)t=0,i=-1,n=null,a=-1;let v={openTag:i,quote:n},E=!1;while(t<b){if(a<0&&e.startsWith("{{",t)){let z=ve(e,t);if(z<0)a=t;else if(z+2<=b){t=z+2;continue}else break}let I=c(t,v);if(I>=0){if(I>b){E=!0;break}t=I;continue}l(t,v),t++}if(i=v.openTag,n=v.quote,E)return{openTag:-1,tail:""};let A=a>=0?a:t,M={openTag:i,quote:n};for(let I=t;I<b;I++){let z=c(I,M);if(z>=0){if(z>b)return{openTag:-1,tail:""};I=z-1;continue}l(I,M)}if(M.openTag<0)return{openTag:-1,tail:""};let X="",j=M.openTag+1;for(let I=j;I<Math.min(b,A);I++){if(!e.startsWith("{{",I))continue;let z=ve(e,I);X+=e.slice(j,I)+"x",I=z+1,j=z+2}return X+=e.slice(j,b),{openTag:M.openTag,tail:X}}}}function Ha(e,t,i){if(t<0&&!i)return null;if(t>=0&&/^\s*[!/?]/.test(e))return/^\s*\/?\s*$/.test(e)?{kind:"tag-name"}:null;if(t>=0&&/^\s*$/.test(e))return{kind:"tag-name"};let n=0;if(t>=0)while(n<e.length&&!/\s/.test(e[n]))n++;while(n<e.length){while(/\s/.test(e[n]??"")&&n<e.length)n++;let a=n;while(n<e.length&&!/[\s=/>]/.test(e[n]))n++;let l=e.slice(a,n);if(!l)break;while(n<e.length&&/\s/.test(e[n]))n++;if(e[n]!=="=")continue;n++;while(n<e.length&&/\s/.test(e[n]))n++;let c=e[n];if(c==='"'||c==="'"){let b=++n,v=e.indexOf(c,n);if(v===-1)return{kind:"attribute",name:l,quote:c,valuePrefix:e.slice(b)};n=v+1}else{let b=n;while(n<e.length&&!/\s/.test(e[n]))n++;if(n===e.length)return{kind:"attribute",name:l,quote:null,valuePrefix:e.slice(b)}}}return{kind:"tag"}}class oe extends Error{attribute;near;constructor(e,t){super(`Unsafe interpolation in ${e}: ${t}`);this.name="UnsafeInterpolationContextError",this.attribute=e}locate(e,t){if(this.near===void 0)this.near=e.slice(Math.max(0,t-160),t).replace(/\s+/g," ").trim(),this.message+=` (after: ${JSON.stringify(this.near)})`;return this}}var ri="unsafe:";var qa=/^(?:javascript|vbscript|livescript|mocha|view-source):/,Za=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,Ka=/^data:(?:text\/html|application\/xhtml\+xml)/,Xa=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function Ja(e){return e.replace(Xa,"").toLowerCase()}function ws(e){let t=e.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(t))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(t))return"fetched";return null}function Bn(e,t="navigable"){let i=Ja(e);if(qa.test(i))return!0;return t==="navigable"?Za.test(i):Ka.test(i)}function wr(e,t="navigable"){return Bn(e,t)?"unsafe:"+e:e}function Ga(e){let t=e.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!t)return null;if(t[3].trim()!=="")return null;return ws(t[1])}function xi(e,t,i=256){if(t<=i)return e.slice(0,t);let n=e.slice(t-i,t),a=n.search(/[\s"'`/]/);return a===-1?"":n.slice(a)}function _i(e,t,i=t){let n=Ga(e);return n&&Bn(t,n)?"unsafe:"+i:i}function At(e){let t=e.indexOf(" as ");if(t!==-1){let l=e.slice(0,t).trim(),c=e.slice(t+4).trim();return l&&c?{arrayExpr:l,itemVar:c}:null}let i=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(e);if(!i)return null;let n=i[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),a=i[2].trim();return n&&a?{arrayExpr:a,itemVar:n}:null}function Wn(e){let t=[],i=0,n="",a=0;for(let l=0;l<e.length;l++){let c=e[l];if(n){if(c==="\\")l++;else if(c===n)n="";continue}if(c==="'"||c==='"'||c==="`")n=c;else if(c==="("||c==="["||c==="{")i++;else if(c===")"||c==="]"||c==="}")i--;else if(c===","&&i===0)t.push(e.slice(a,l)),a=l+1}return t.push(e.slice(a)),t}function $i(e,t){let i=0;for(let n=0;n<e.length;n++){let a=e[n];if(a==="("||a==="["||a==="{")i++;else if(a===")"||a==="]"||a==="}")i--;else if(a===t&&i===0)return n}return-1}function Ei(e){let t=0;for(let i=0;i<e.length;i++){let n=e[i];if(n==="("||n==="["||n==="{")t++;else if((n===")"||n==="]"||n==="}")&&--t===0)return i}return-1}function xt(e,t){let i=e.trim().replace(/^\.\.\./,"").trim(),n=$i(i,"=");if(n!==-1&&i[n+1]!==">")i=i.slice(0,n).trim();if(!i)return;if(i.startsWith("{")&&i.endsWith("}")){for(let a of Wn(i.slice(1,-1))){let l=a.trim();if(!l)continue;if(l.startsWith("...")){xt(l,t);continue}let c=$i(l,":");xt(c===-1?l:l.slice(c+1),t)}return}if(i.startsWith("[")&&i.endsWith("]")){for(let a of Wn(i.slice(1,-1)))xt(a,t);return}if(/^[A-Z_$][\w$]*$/i.test(i))t.push(i)}function J(e){let t=e.trim(),i=[],n=0;for(let l=0;l<t.length;l++){let c=t[l];if(c==="("||c==="["||c==="{")n++;else if(c===")"||c==="]"||c==="}")n--;else if(n===0&&/\s/.test(c)){if(!/^\s+(?:in|of)\s/.exec(t.slice(l)))continue;let v=t.slice(0,l).trim();if(v.startsWith("(")&&Ei(v)===v.length-1)v=v.slice(1,-1);for(let E of Wn(v))xt(E,i);if(i.length>0)return i;break}}let a=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(t);if(a){let l=a[1].trim();if(l.startsWith("(")&&Ei(l)===l.length-1)l=l.slice(1,-1);let c=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(l);if(c)xt(c[2],i),xt(c[1],i);else for(let b of Wn(l))xt(b,i)}return i}function O(e,t){let i=t instanceof Set?t:new Set(t);if(i.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 b of c.match(/[a-zA-Z_$][\w$]*/g)||[])if(i.has(b))return!0;return!1}var Fn="__stx_client_loop_names";function rt(e){let t=e?.[Fn];return Array.isArray(t)?t:[]}function Vn(e){if(!e.includes("#")&&!e.includes("v-slot:")&&!e.includes("data-stx-slot-binding"))return[];let t=[],i=[],n=/<!--[\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(n)){let l=a[0];if(/^<\/template\s*>$/i.test(l)){let c=i.pop();if(c)c.end=a.index}else if(/^<template\b/i.test(l)&&!/\/\s*>$/.test(l)){let b=[...l.slice(9).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)].find((A)=>/^(?:#[\w-]+|v-slot:[\w-]+|data-stx-slot-binding)$/i.test(A[1])),v=(b?.[2]??b?.[3])?.trim();if(v&&b?.[1]==="data-stx-slot-binding")try{v=decodeURIComponent(v)}catch{v=void 0}let E=v?{start:a.index+l.length,end:e.length,binding:v}:void 0;if(i.push(E),E)t.push(E)}}return t}var Jt={},Ri=new Map;function Ya(e){let t=Ri.get(e);if(!t){let i=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=new RegExp(`:${i}(?!\\w)`,"g"),Ri.set(e,t)}return t.lastIndex=0,t}var Us={uppercase:(e,t)=>e!==void 0&&e!==null?String(e).toUpperCase():"",lowercase:(e,t)=>e!==void 0&&e!==null?String(e).toLowerCase():"",capitalize:(e,t)=>{if(e===void 0||e===null)return"";let i=String(e);return i.charAt(0).toUpperCase()+i.slice(1)},number:(e,t,i=0)=>{if(e===void 0||e===null)return"";try{let n=Number(e);return Number.isNaN(n)?"":n.toFixed(Number.parseInt(String(i),10))}catch{return""}},fmt:(e,t,i="en-US")=>{if(e===void 0||e===null)return"";try{let n=Number(e);if(Number.isNaN(n))return String(e);return n.toLocaleString(i)}catch{return String(e)}},join:(e,t,i=",")=>{if(!Array.isArray(e))return"";return e.join(String(i))},escape:(e,t)=>{if(e===void 0||e===null)return"";return U(String(e))},translate:(e,t,i={})=>{if(!t||!t.__translations)return e;let n=t.__translations,a=t.__i18nConfig?.fallbackToKey??!0,l=String(e).split("."),c=n;for(let v of l){if(c===void 0||c===null)break;c=c[v]}if(c===void 0||c===null)return a?e:"";let b=String(c);return Object.entries(i).forEach(([v,E])=>{b=b.replace(Ya(v),()=>String(E))}),b},t:(e,t,i={})=>Us.translate(e,t,i),truncate:(e,t,i=50,n="...")=>{if(e===void 0||e===null)return"";let a=String(e);if(a.length<=i)return a;if(i<=n.length)return n.substring(0,i);return a.substring(0,i-n.length)+n},date:(e,t,i="short",n="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 l={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(i==="iso")return a.toISOString();return new Intl.DateTimeFormat(n,l[i]||l.short).format(a)}catch{return String(e)}},currency:(e,t,i="USD",n="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(n,{style:"currency",currency:i}).format(a)}catch{return String(e)}},pluralize:(e,t,i,n)=>{let a=Number(e);if(Number.isNaN(a))return i;let l=n||`${i}s`;return a===1?i:l},first:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[0];return String(e).charAt(0)},last:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[e.length-1];let i=String(e);return i.charAt(i.length-1)},length:(e,t)=>{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,t,i=!1)=>{if(e===void 0)return"undefined";if(e===null)return"null";try{return i?JSON.stringify(e,null,2):JSON.stringify(e)}catch{return String(e)}},default:(e,t,i="")=>e===void 0||e===null||e===""?i:e,reverse:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return[...e].reverse();return String(e).split("").reverse().join("")},slice:(e,t,i=0,n)=>{if(e===void 0||e===null)return"";if(Array.isArray(e)||typeof e==="string")return e.slice(i,n);return e},replace:(e,t,i,n="")=>{if(e===void 0||e===null)return"";let a=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(e).replace(new RegExp(a,"g"),()=>n)},stripTags:(e,t)=>{if(e===void 0||e===null)return"";return String(e).replace(/<[^>]*>/g,"")},urlencode:(e,t)=>{if(e===void 0||e===null)return"";return encodeURIComponent(String(e))},abs:(e,t)=>{let i=Number(e);return Number.isNaN(i)?0:Math.abs(i)},round:(e,t,i=0)=>{let n=Number(e);if(Number.isNaN(n))return 0;let a=10**i;return Math.round(n*a)/a}};function hg(e,t){if(e in Us)console.warn(`Filter "${e}" already exists as a built-in filter. Custom filter will take precedence.`);Jt[e]=t}function Yh(e){for(let[t,i]of Object.entries(e))hg(t,i)}function yg(){return{...Us,...Jt}}function Zh(){for(let e of Object.keys(Jt))delete Jt[e]}function Mt(e,t,i=2){let n="{".repeat(i);if(!e.includes(n))return e;let a="",l=0;for(;;){let c=e.indexOf(n,l);if(c===-1)break;let b=ve(e,c,i);if(b===-1)break;a+=e.slice(l,c)+t(e.slice(c,b+i),e.slice(c+i,b),c),l=b+i}return l===0?e:a+e.slice(l)}function Qa(e,t,i){let n=i[0];if(n!=="'"&&n!=='"'&&n!=="`")return!1;let a=xr(e,t);if(!a||a.kind!=="attribute"||a.quote===n)return!1;if(!/^(?::|@|x-|v-)/.test(a.name))return!1;let l=0;for(let c=0;c<a.valuePrefix.length;c++)if(a.valuePrefix[c]==="\\")c++;else if(a.valuePrefix[c]===n)l++;return l%2===1}function p(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function U(e){return si(p(e))}function ec(e){return e.replace(/ /g," ").replace(/\t/g,"	").replace(/\n/g," ").replace(/\r/g," ").replace(/\f/g,"").replace(/=/g,"=").replace(/`/g,"`")}function tc(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\([\dA-Fa-f]{1,6})\s?/g,(t,i)=>String.fromCodePoint(Number.parseInt(i,16))).replace(/\\([^\r\n])/g,"$1").replace(/[\u0000-\u0020]+/g,"").toLowerCase()}function nc(e,t){let i=tc(e);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(i))throw new oe(t,"network-capable or executable CSS is not allowed in an escaped interpolation");let n=/url\(([^)]*)\)/g,a;while((a=n.exec(i))!==null){let l=a[1].replace(/^["']|["']$/g,""),c=l.startsWith("/")&&!l.startsWith("//")||l.startsWith("./")||l.startsWith("../")||l.startsWith("#"),b=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(l);if(!c&&!b)throw new oe(t,"CSS URLs must be local paths or base64 raster images")}}function Z(e,t,i,n=!1,a=0){try{return sc(e,t,i,n,a)}catch(l){if(l instanceof oe)l.locate(e,t);throw l}}function sc(e,t,i,n,a){let l=xr(e,t,n),c=U(i);if(!l)return c;if(l.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(i))throw new oe("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return i}if(l.kind==="tag"){let E=e.slice(t+a).trimStart(),A=i.trim();if(!E.startsWith("=")&&(A===""||/^(?!on)[A-Za-z_:][\w:.-]*(?:\s+(?!on)[A-Za-z_:][\w:.-]*)*$/.test(A)))return A;throw new oe("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let b=l.name.toLowerCase();if(/^on[a-z]/.test(b))throw new oe(l.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(b==="srcdoc")c=U(c);if(b==="style")nc(i,l.name);if(l.quote===null)c=ec(c);let v=ws(b);if(v&&l.valuePrefix.trim()===""&&Bn(i,v))return ri+c;return _i(xi(e,t),i,c)}function wn(e,t){let i=` ${e}="`;return Z(i,i.length,t,!0)}function Mi(e){return e.flatMap((t)=>{let i=t.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);return!i||/\bserver\b|\bsrc\s*=/.test(i[1])?[]:[i[2]]})}function Se(e,t){let{scripts:i}=G(e);for(let n of Mi(i)){if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(n)||Yc.test(n))return!0;if(Or(n,t))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 bg(e){let t=[],i=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let n=i.exec(e);n;n=i.exec(e)){let a=n[1].toLowerCase(),l=new Set(J(n[3]));if(l.size===0)continue;let c=n.index+n[0].length;if(n[0].endsWith("/>")){t.push({start:n.index,end:c,names:l});continue}let b=new RegExp(`<(/?)${a}\\b[^>]*?(/?)>`,"gi");b.lastIndex=c;let v=1,E=e.length;for(let A=b.exec(e);A;A=b.exec(e)){if(A[2]==="/")continue;if(v+=A[1]==="/"?-1:1,v===0){E=A.index+A[0].length;break}}t.push({start:n.index,end:E,names:l})}return t}function Ci(e,t,i){let n=r(i);for(let a of e){if(t<a.start||t>=a.end)continue;for(let l of a.names)if(new RegExp(`(?<![.#\\w$])${l.replace(/\$/g,"\\$")}(?![\\w$])`).test(n))return!0}return!1}function Ti(e,t){let i=["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"],n=e.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),a="",l=!1,c=0;for(let E=0;E<n.length;E++){let A=n[E];if(!l&&A==="`"){l=!0,c=0;continue}if(l){if(A==="`"&&c===0){l=!1;continue}if(A==="$"&&n[E+1]==="{"){c++,E++,a+=" ";continue}if(A==="}"&&c>0){c--;continue}if(c>0){a+=A;continue}continue}a+=A}n=a;let b=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,v;while((v=b.exec(n))!==null){let E=v[1];if(!n.substring(0,v.index).trimEnd().endsWith(".")){if(!i.includes(E)&&!(E in t))return!1}}return!0}function rc(e,t){let i=r(e);for(let n of i.matchAll(/(?<![.\w$])([A-Z_$][\w$]*)\s*\(/gi))if(typeof t[n[1]]==="function")return!0;return!1}function ic(e,t){let i=t.__stx_serverDeclared;if(!i||i.size===0)return!1;let n=r(e);for(let a of i)if(new RegExp(`(?<![.#\\w$])${a}(?![\\w$])`).test(n))return!0;return!1}var Ii=new Set;function Pi(e){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(e.trim())}function oc(e,t,i){let n=i[0];if(n!=="'"&&n!=='"'&&n!=="`")return!1;let a=0;for(let l=e.lastIndexOf(`
|
|
217
|
-
`,t-1)+1;l<t;l++)if(e[l]==="\\")l++;else if(e[l]===n)a++;return a%2===1}function Oi(e,t){let i=`${t??"<unknown>"}\x00${e}`;if(process.env.STX_DEBUG||!
|
|
218
|
-
`).length}`;console.warn(`${l}: stx warning: ${t} 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 R(e,t,i=!1,n){try{let a=e.trim(),l=ac(a);if(l>0){let b=a.substring(0,l).trim(),v=a.substring(l+1).trim(),E=R(b,t,!0,n);return
|
|
215
|
+
</script>`,v,E=/<(?:template\b|script\b(?=[^>]*\bdata-stx-scoped\b))/iy;return y(e,(A,O)=>{if(v===void 0){if(E.lastIndex=O,E.test(A))v=O}return-1}),a.push({start:v??0,end:v??0,replacement:`${b}
|
|
216
|
+
`}),Yr(e,a)}function Yr(e,t){if(t.length===0)return e;t.sort((l,c)=>l.start-c.start||l.end-c.end);let i=Array(t.length*2+1),n=0,a=0;for(let l of t)i[a++]=e.slice(n,l.start),i[a++]=l.replacement,n=l.end;return i[a]=e.slice(n),i.join("")}function Qr(e){let t=Nn(e),i=new Map;if(t)for(let[n,a]of t)i.set(n,a.instances);return i}function ei(e,t){let i=Nn(e);if(!i)return[];let n=[];for(let[a,l]of i){let c=l.instances-(t.get(a)??0);if(c>0)n.push({body:l.body,count:c})}return n}function ti(e,t){for(let{body:i,count:n}of t)for(let a=0;a<n;a++)ys(e,i)}function xe(e,t,i=2){let n=0,a=null;for(let l=t+i;l<e.length;l++){let c=e[l];if(a){if(c==="\\"){l++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="{"){n++;continue}if(c==="}"){if(n>0){n--;continue}let b=0;while(e[l+b]==="}")b++;if(b>=i)return l}}return-1}import Ei from"fs";var ni=0,_s=new Map;function el(){ni=0,_s.clear()}function Ln(e,t){let i=ni++,n=`<!--__STX_${e.toUpperCase()}_${i}__-->`;return _s.set(n,{type:e,expression:t}),n}function tl(){let e={};for(let[t,i]of _s)e[t]={type:i.type,expression:i.expression};return e}function nl(e,t){let i=e;for(let[n,a]of t)i=i.split(n).join(a);return i}function vi(e){return e.includes("<!--__STX_")}var Ba=/@(?=[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 Wa(e){return Array.from({length:e},()=>"{").join("⁠")}function si(e){return e.replace(/\{{2,}/g,(t)=>Wa(t.length)).replace(/\{(?=!)/g,"{⁠").replace(Ba,"@")}function xr(e,t,i=!1){let{openTag:n,tail:a}=i?Fa(e,t):Va(e).at(t);return Ha(a,n,i)}function Fa(e,t){let i="",n=0;for(let c=0;c<t;c++){if(!e.startsWith("{{",c))continue;let b=xe(e,c);if(b<0||b+2>t)break;i+=e.slice(n,c)+"x",c=b+1,n=b+2}i+=e.slice(n,t);let a=-1,l=null;for(let c=0;c<i.length;c++){let b=i[c];if(l){if(b===l)l=null;continue}if(b==='"'||b==="'"){l=b;continue}if(b===">"){a=-1;continue}if(b==="<")a=c}return{openTag:a,tail:a>=0?i.slice(a+1):i}}var zn=null;function Va(e){if(zn&&zn.source===e)return zn.scanner;let t=Ua(e);return zn={source:e,scanner:t},t}function Ua(e){let t=0,i=-1,n=null,a=-1,l=(b,v)=>{let E=e[b];if(v.quote){if(E===v.quote)v.quote=null;return}if(v.openTag>=0){if(E==='"'||E==="'"){v.quote=E;return}if(E===">"){v.openTag=-1;return}}if(E==="<")v.openTag=b},c=(b,v)=>{if(v.openTag>=0||!e.startsWith("<!--",b))return-1;let E=e.indexOf("-->",b+4);return E<0?e.length:E+3};return{at(b){if(b<t)t=0,i=-1,n=null,a=-1;let v={openTag:i,quote:n},E=!1;while(t<b){if(a<0&&e.startsWith("{{",t)){let B=xe(e,t);if(B<0)a=t;else if(B+2<=b){t=B+2;continue}else break}let P=c(t,v);if(P>=0){if(P>b){E=!0;break}t=P;continue}l(t,v),t++}if(i=v.openTag,n=v.quote,E)return{openTag:-1,tail:""};let A=a>=0?a:t,O={openTag:i,quote:n};for(let P=t;P<b;P++){let B=c(P,O);if(B>=0){if(B>b)return{openTag:-1,tail:""};P=B-1;continue}l(P,O)}if(O.openTag<0)return{openTag:-1,tail:""};let H="",j=O.openTag+1;for(let P=j;P<Math.min(b,A);P++){if(!e.startsWith("{{",P))continue;let B=xe(e,P);H+=e.slice(j,P)+"x",P=B+1,j=B+2}return H+=e.slice(j,b),{openTag:O.openTag,tail:H}}}}function Ha(e,t,i){if(t<0&&!i)return null;if(t>=0&&/^\s*[!/?]/.test(e))return/^\s*\/?\s*$/.test(e)?{kind:"tag-name"}:null;if(t>=0&&/^\s*$/.test(e))return{kind:"tag-name"};let n=0;if(t>=0)while(n<e.length&&!/\s/.test(e[n]))n++;while(n<e.length){while(/\s/.test(e[n]??"")&&n<e.length)n++;let a=n;while(n<e.length&&!/[\s=/>]/.test(e[n]))n++;let l=e.slice(a,n);if(!l)break;while(n<e.length&&/\s/.test(e[n]))n++;if(e[n]!=="=")continue;n++;while(n<e.length&&/\s/.test(e[n]))n++;let c=e[n];if(c==='"'||c==="'"){let b=++n,v=e.indexOf(c,n);if(v===-1)return{kind:"attribute",name:l,quote:c,valuePrefix:e.slice(b)};n=v+1}else{let b=n;while(n<e.length&&!/\s/.test(e[n]))n++;if(n===e.length)return{kind:"attribute",name:l,quote:null,valuePrefix:e.slice(b)}}}return{kind:"tag"}}class ie extends Error{attribute;near;constructor(e,t){super(`Unsafe interpolation in ${e}: ${t}`);this.name="UnsafeInterpolationContextError",this.attribute=e}locate(e,t){if(this.near===void 0)this.near=e.slice(Math.max(0,t-160),t).replace(/\s+/g," ").trim(),this.message+=` (after: ${JSON.stringify(this.near)})`;return this}}var ri="unsafe:";var qa=/^(?:javascript|vbscript|livescript|mocha|view-source):/,Za=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,Ka=/^data:(?:text\/html|application\/xhtml\+xml)/,Xa=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function Ja(e){return e.replace(Xa,"").toLowerCase()}function ws(e){let t=e.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(t))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(t))return"fetched";return null}function Bn(e,t="navigable"){let i=Ja(e);if(qa.test(i))return!0;return t==="navigable"?Za.test(i):Ka.test(i)}function wr(e,t="navigable"){return Bn(e,t)?"unsafe:"+e:e}function Ga(e){let t=e.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!t)return null;if(t[3].trim()!=="")return null;return ws(t[1])}function oi(e,t,i=256){if(t<=i)return e.slice(0,t);let n=e.slice(t-i,t),a=n.search(/[\s"'`/]/);return a===-1?"":n.slice(a)}function _i(e,t,i=t){let n=Ga(e);return n&&Bn(t,n)?"unsafe:"+i:i}function Pt(e){let t=e.indexOf(" as ");if(t!==-1){let l=e.slice(0,t).trim(),c=e.slice(t+4).trim();return l&&c?{arrayExpr:l,itemVar:c}:null}let i=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(e);if(!i)return null;let n=i[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),a=i[2].trim();return n&&a?{arrayExpr:a,itemVar:n}:null}function Wn(e){let t=[],i=0,n="",a=0;for(let l=0;l<e.length;l++){let c=e[l];if(n){if(c==="\\")l++;else if(c===n)n="";continue}if(c==="'"||c==='"'||c==="`")n=c;else if(c==="("||c==="["||c==="{")i++;else if(c===")"||c==="]"||c==="}")i--;else if(c===","&&i===0)t.push(e.slice(a,l)),a=l+1}return t.push(e.slice(a)),t}function Si(e,t){let i=0;for(let n=0;n<e.length;n++){let a=e[n];if(a==="("||a==="["||a==="{")i++;else if(a===")"||a==="]"||a==="}")i--;else if(a===t&&i===0)return n}return-1}function $i(e){let t=0;for(let i=0;i<e.length;i++){let n=e[i];if(n==="("||n==="["||n==="{")t++;else if((n===")"||n==="]"||n==="}")&&--t===0)return i}return-1}function xt(e,t){let i=e.trim().replace(/^\.\.\./,"").trim(),n=Si(i,"=");if(n!==-1&&i[n+1]!==">")i=i.slice(0,n).trim();if(!i)return;if(i.startsWith("{")&&i.endsWith("}")){for(let a of Wn(i.slice(1,-1))){let l=a.trim();if(!l)continue;if(l.startsWith("...")){xt(l,t);continue}let c=Si(l,":");xt(c===-1?l:l.slice(c+1),t)}return}if(i.startsWith("[")&&i.endsWith("]")){for(let a of Wn(i.slice(1,-1)))xt(a,t);return}if(/^[A-Z_$][\w$]*$/i.test(i))t.push(i)}function Y(e){let t=e.trim(),i=[],n=0;for(let l=0;l<t.length;l++){let c=t[l];if(c==="("||c==="["||c==="{")n++;else if(c===")"||c==="]"||c==="}")n--;else if(n===0&&/\s/.test(c)){if(!/^\s+(?:in|of)\s/.exec(t.slice(l)))continue;let v=t.slice(0,l).trim();if(v.startsWith("(")&&$i(v)===v.length-1)v=v.slice(1,-1);for(let E of Wn(v))xt(E,i);if(i.length>0)return i;break}}let a=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(t);if(a){let l=a[1].trim();if(l.startsWith("(")&&$i(l)===l.length-1)l=l.slice(1,-1);let c=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(l);if(c)xt(c[2],i),xt(c[1],i);else for(let b of Wn(l))xt(b,i)}return i}function N(e,t){let i=t instanceof Set?t:new Set(t);if(i.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 b of c.match(/[a-zA-Z_$][\w$]*/g)||[])if(i.has(b))return!0;return!1}var Fn="__stx_client_loop_names";function st(e){let t=e?.[Fn];return Array.isArray(t)?t:[]}function Vn(e){if(!e.includes("#")&&!e.includes("v-slot:")&&!e.includes("data-stx-slot-binding"))return[];let t=[],i=[],n=/<!--[\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(n)){let l=a[0];if(/^<\/template\s*>$/i.test(l)){let c=i.pop();if(c)c.end=a.index}else if(/^<template\b/i.test(l)&&!/\/\s*>$/.test(l)){let b=[...l.slice(9).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)].find((A)=>/^(?:#[\w-]+|v-slot:[\w-]+|data-stx-slot-binding)$/i.test(A[1])),v=(b?.[2]??b?.[3])?.trim();if(v&&b?.[1]==="data-stx-slot-binding")try{v=decodeURIComponent(v)}catch{v=void 0}let E=v?{start:a.index+l.length,end:e.length,binding:v}:void 0;if(i.push(E),E)t.push(E)}}return t}var Jt={},Ri=new Map;function Ya(e){let t=Ri.get(e);if(!t){let i=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=new RegExp(`:${i}(?!\\w)`,"g"),Ri.set(e,t)}return t.lastIndex=0,t}var Us={uppercase:(e,t)=>e!==void 0&&e!==null?String(e).toUpperCase():"",lowercase:(e,t)=>e!==void 0&&e!==null?String(e).toLowerCase():"",capitalize:(e,t)=>{if(e===void 0||e===null)return"";let i=String(e);return i.charAt(0).toUpperCase()+i.slice(1)},number:(e,t,i=0)=>{if(e===void 0||e===null)return"";try{let n=Number(e);return Number.isNaN(n)?"":n.toFixed(Number.parseInt(String(i),10))}catch{return""}},fmt:(e,t,i="en-US")=>{if(e===void 0||e===null)return"";try{let n=Number(e);if(Number.isNaN(n))return String(e);return n.toLocaleString(i)}catch{return String(e)}},join:(e,t,i=",")=>{if(!Array.isArray(e))return"";return e.join(String(i))},escape:(e,t)=>{if(e===void 0||e===null)return"";return W(String(e))},translate:(e,t,i={})=>{if(!t||!t.__translations)return e;let n=t.__translations,a=t.__i18nConfig?.fallbackToKey??!0,l=String(e).split("."),c=n;for(let v of l){if(c===void 0||c===null)break;c=c[v]}if(c===void 0||c===null)return a?e:"";let b=String(c);return Object.entries(i).forEach(([v,E])=>{b=b.replace(Ya(v),()=>String(E))}),b},t:(e,t,i={})=>Us.translate(e,t,i),truncate:(e,t,i=50,n="...")=>{if(e===void 0||e===null)return"";let a=String(e);if(a.length<=i)return a;if(i<=n.length)return n.substring(0,i);return a.substring(0,i-n.length)+n},date:(e,t,i="short",n="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 l={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(i==="iso")return a.toISOString();return new Intl.DateTimeFormat(n,l[i]||l.short).format(a)}catch{return String(e)}},currency:(e,t,i="USD",n="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(n,{style:"currency",currency:i}).format(a)}catch{return String(e)}},pluralize:(e,t,i,n)=>{let a=Number(e);if(Number.isNaN(a))return i;let l=n||`${i}s`;return a===1?i:l},first:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[0];return String(e).charAt(0)},last:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[e.length-1];let i=String(e);return i.charAt(i.length-1)},length:(e,t)=>{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,t,i=!1)=>{if(e===void 0)return"undefined";if(e===null)return"null";try{return i?JSON.stringify(e,null,2):JSON.stringify(e)}catch{return String(e)}},default:(e,t,i="")=>e===void 0||e===null||e===""?i:e,reverse:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return[...e].reverse();return String(e).split("").reverse().join("")},slice:(e,t,i=0,n)=>{if(e===void 0||e===null)return"";if(Array.isArray(e)||typeof e==="string")return e.slice(i,n);return e},replace:(e,t,i,n="")=>{if(e===void 0||e===null)return"";let a=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(e).replace(new RegExp(a,"g"),()=>n)},stripTags:(e,t)=>{if(e===void 0||e===null)return"";return String(e).replace(/<[^>]*>/g,"")},urlencode:(e,t)=>{if(e===void 0||e===null)return"";return encodeURIComponent(String(e))},abs:(e,t)=>{let i=Number(e);return Number.isNaN(i)?0:Math.abs(i)},round:(e,t,i=0)=>{let n=Number(e);if(Number.isNaN(n))return 0;let a=10**i;return Math.round(n*a)/a}};function bg(e,t){if(e in Us)console.warn(`Filter "${e}" already exists as a built-in filter. Custom filter will take precedence.`);Jt[e]=t}function Qh(e){for(let[t,i]of Object.entries(e))bg(t,i)}function wg(){return{...Us,...Jt}}function ey(){for(let e of Object.keys(Jt))delete Jt[e]}function Dt(e,t,i=2){let n="{".repeat(i);if(!e.includes(n))return e;let a="",l=0;for(;;){let c=e.indexOf(n,l);if(c===-1)break;let b=xe(e,c,i);if(b===-1)break;a+=e.slice(l,c)+t(e.slice(c,b+i),e.slice(c+i,b),c),l=b+i}return l===0?e:a+e.slice(l)}function Qa(e,t,i){let n=i[0];if(n!=="'"&&n!=='"'&&n!=="`")return!1;let a=xr(e,t);if(!a||a.kind!=="attribute"||a.quote===n)return!1;if(!/^(?::|@|x-|v-)/.test(a.name))return!1;let l=0;for(let c=0;c<a.valuePrefix.length;c++)if(a.valuePrefix[c]==="\\")c++;else if(a.valuePrefix[c]===n)l++;return l%2===1}function p(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function W(e){return si(p(e))}function ec(e){return e.replace(/ /g," ").replace(/\t/g,"	").replace(/\n/g," ").replace(/\r/g," ").replace(/\f/g,"").replace(/=/g,"=").replace(/`/g,"`")}function tc(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\([\dA-Fa-f]{1,6})\s?/g,(t,i)=>String.fromCodePoint(Number.parseInt(i,16))).replace(/\\([^\r\n])/g,"$1").replace(/[\u0000-\u0020]+/g,"").toLowerCase()}function nc(e,t){let i=tc(e);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(i))throw new ie(t,"network-capable or executable CSS is not allowed in an escaped interpolation");let n=/url\(([^)]*)\)/g,a;while((a=n.exec(i))!==null){let l=a[1].replace(/^["']|["']$/g,""),c=l.startsWith("/")&&!l.startsWith("//")||l.startsWith("./")||l.startsWith("../")||l.startsWith("#"),b=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(l);if(!c&&!b)throw new ie(t,"CSS URLs must be local paths or base64 raster images")}}function Q(e,t,i,n=!1,a=0){try{return sc(e,t,i,n,a)}catch(l){if(l instanceof ie)l.locate(e,t);throw l}}function sc(e,t,i,n,a){let l=xr(e,t,n),c=W(i);if(!l)return c;if(l.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(i))throw new ie("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return i}if(l.kind==="tag"){let E=e.slice(t+a).trimStart(),A=i.trim();if(!E.startsWith("=")&&(A===""||/^(?!on)[A-Za-z_:][\w:.-]*(?:\s+(?!on)[A-Za-z_:][\w:.-]*)*$/.test(A)))return A;throw new ie("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let b=l.name.toLowerCase();if(/^on[a-z]/.test(b))throw new ie(l.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(b==="srcdoc")c=W(c);if(b==="style")nc(i,l.name);if(l.quote===null)c=ec(c);let v=ws(b);if(v&&l.valuePrefix.trim()===""&&Bn(i,v))return ri+c;return _i(oi(e,t),i,c)}function vn(e,t){let i=` ${e}="`;return Q(i,i.length,t,!0)}function Mi(e){return e.flatMap((t)=>{let i=t.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);return!i||/\bserver\b|\bsrc\s*=/.test(i[1])?[]:[i[2]]})}function ke(e,t){let{scripts:i}=J(e);for(let n of Mi(i)){if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(n)||Zc.test(n))return!0;if(Or(n,t))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 vg(e){let t=[],i=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let n=i.exec(e);n;n=i.exec(e)){let a=n[1].toLowerCase(),l=new Set(Y(n[3]));if(l.size===0)continue;let c=n.index+n[0].length;if(n[0].endsWith("/>")){t.push({start:n.index,end:c,names:l});continue}let b=new RegExp(`<(/?)${a}\\b[^>]*?(/?)>`,"gi");b.lastIndex=c;let v=1,E=e.length;for(let A=b.exec(e);A;A=b.exec(e)){if(A[2]==="/")continue;if(v+=A[1]==="/"?-1:1,v===0){E=A.index+A[0].length;break}}t.push({start:n.index,end:E,names:l})}return t}function Ci(e,t,i){let n=r(i);for(let a of e){if(t<a.start||t>=a.end)continue;for(let l of a.names)if(new RegExp(`(?<![.#\\w$])${l.replace(/\$/g,"\\$")}(?![\\w$])`).test(n))return!0}return!1}function Ai(e,t){let i=["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"],n=e.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),a="",l=!1,c=0;for(let E=0;E<n.length;E++){let A=n[E];if(!l&&A==="`"){l=!0,c=0;continue}if(l){if(A==="`"&&c===0){l=!1;continue}if(A==="$"&&n[E+1]==="{"){c++,E++,a+=" ";continue}if(A==="}"&&c>0){c--;continue}if(c>0){a+=A;continue}continue}a+=A}n=a;let b=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,v;while((v=b.exec(n))!==null){let E=v[1];if(!n.substring(0,v.index).trimEnd().endsWith(".")){if(!i.includes(E)&&!(E in t))return!1}}return!0}function rc(e,t){let i=r(e);for(let n of i.matchAll(/(?<![.\w$])([A-Z_$][\w$]*)\s*\(/gi))if(typeof t[n[1]]==="function")return!0;return!1}function ic(e,t){let i=t.__stx_serverDeclared;if(!i||i.size===0)return!1;let n=r(e);for(let a of i)if(new RegExp(`(?<![.#\\w$])${a}(?![\\w$])`).test(n))return!0;return!1}var Ti=new Set;function Ii(e){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(e.trim())}function oc(e,t,i){let n=i[0];if(n!=="'"&&n!=='"'&&n!=="`")return!1;let a=0;for(let l=e.lastIndexOf(`
|
|
217
|
+
`,t-1)+1;l<t;l++)if(e[l]==="\\")l++;else if(e[l]===n)a++;return a%2===1}function Oi(e,t){let i=`${t??"<unknown>"}\x00${e}`;if(process.env.STX_DEBUG||!Ti.has(i))Ti.add(i),console.warn(`[stx] {{ ${e} }} in a <script> in ${t??"<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 xi(e,t,i){let n=e;return n=n.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>{try{let c=R(l,t);if(c===void 0)return Ii(l)?Oi(l.trim(),i):a;return c===null?"":String(c)}catch{return a}}),n=Dt(n,(a,l,c)=>{let b=l.trim();if(oc(n,c,l))return a;if(/^__[A-Z_]+__$/.test(b))return a;try{let v=R(l,t);if(v===void 0)return Ii(b)?Oi(b,i):a;return JSON.stringify(v).replace(/</g,"\\u003c").replace(/@/g,"\\u0040").replace(/\{{2,}/g,(E)=>"\\u007b".repeat(E.length)).replace(/\{(?=!)/g,"\\u007b")}catch{return a}}),n}function xg(e,t){if(!e.includes("{"))return e;let i=e;return i=i.replace(/\{!!([\s\S]*?)!!\}/g,(n,a)=>{try{let l=R(a,t);if(l===void 0)return n;return l===null?"":String(l)}catch{return n}}),i=Dt(i,(n,a,l)=>{let c=a.trim();if(/^__[A-Z_]+__$/.test(c))return n;try{let b=R(a,t);if(b===void 0)return n;if(b===null)return"";let v=String(b);return Q(i,l,v,!0,n.length)}catch(b){if(b instanceof ie)throw b;return n}}),i}function ty(e,t,i={}){let{output:n,scripts:a}=J(e),l=a.map((c)=>{let b=c.match(/^<script\b((?:[^>\"']|\"[^\"]*\"|'[^']*')*)>/i),v=c.search(/<\/script\s*>$/i);if(!b||v===-1)return c;let E=b[1],A=c.slice(b[0].length,v);if(/\bdata-raw\b/.test(E))return c;if(i.skipServer&&/\bserver\b/.test(E))return c;let H=`<script${xg(E,t)}>`;if(/\bsrc\s*=/.test(E)||/\btype\s*=\s*["']application\/json["']/.test(E))return H+A+c.slice(v);return H+xi(A,t)+c.slice(v)});return vr(n,l)}function _(e,t,i){let n=e,a=(P,B)=>{let L=fn(P,B);if(L===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(P.slice(B,L))?-1:L},l=(P,B,L,F)=>{let G=L.length,{output:D,tokens:ee}=fe(P,B,(ne,te)=>F(G+te));return L.push(...ee),D},c=[];n=l(n,a,c,(P)=>`<!--__STX_STYLE_${P}__-->`);let b=[];n=l(n,q,b,(P)=>`<!--__STX_SCRIPT_EXPR_${P}__-->`);let v=t?.__stx_signals_gate===!0||ke(e),E=new Set([...Array.isArray(t?.__stx_client_signal_names)?t.__stx_client_signal_names:[],...wi(Mi(b))]),A=new Set(Array.isArray(t?.__stx_preserved_client_expressions)?t.__stx_preserved_client_expressions:[]);n=Dt(n,(P,B,L)=>{if(N(B,E))return P;try{let F=R(B,t,!1,(G)=>Ss(G,P,i,e));return F!==void 0&&F!==null?String(F):""}catch(F){let G=F instanceof Error?F.message:String(F);return h("Expression",`Error evaluating: {{{ ${B.trim()}}}}: ${G}`,i,e,L,P)}},3),n=n.replace(/\{!!([\s\S]*?)!!\}/g,(P,B,L)=>{if(N(B,E))return P;try{let F=R(B,t,!1,(G)=>Ss(G,P,i,e));if(F===void 0&&t.__stx_buildMode==="compile")return Ln("raw",B.trim());return F!==void 0&&F!==null?String(F):""}catch(F){if(t.__stx_buildMode==="compile")return Ln("raw",B.trim());let G=F instanceof Error?F.message:String(F);return h("Expression",`Error evaluating: {!! ${B.trim()} !!}: ${G}`,i,e,L,P)}}),n=l(n,q,b,(P)=>`<!--__STX_SCRIPT_EXPR_${P}__-->`),n=l(n,a,c,(P)=>`<!--__STX_STYLE_${P}__-->`);let O=v?vg(n):[],H=Vn(n).map((P)=>({...P,names:new Set(Y(`${P.binding} in __slot`))})),j=new Set(st(t));if(n=Dt(n,(P,B,L)=>{let F=B.trim();if(Qa(n,L,B))return P;if(Ci(H,L,F))return P;if(N(F,j))return P;if(O.length>0&&Ci(O,L,F))return P;if(A.has(F))return P;let G=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],D=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,ne=F.match(D)?.[1],te=ne&&((ne in t)||G.includes(ne)),le=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,he=F.match(le),ue=he&&!G.includes(he[1])&&!(he[1]in t);if(/^__[A-Z_]+__$/.test(F))return"";if(N(F,E))return P;if(t.__stx_native_screen===!0&&rc(F,t))return P;let Ee;try{let Ae=R(B,t,!1,(Ke)=>{Ee=Ke});if(v&&!Ai(F,t))return P;if(Ee)Ss(Ee,P,i,e);if(t.__stx_buildMode==="compile"&&!v&&(Ae===void 0||ic(F,t)))return Ln("expr",F);if(Ae===void 0||Ae===null)return"";let We=String(Ae);return Q(n,L,We,!1,P.length)}catch(Ae){if(Ae instanceof ie)throw Ae;if(v&&!Ai(F,t))return P;if(ue)return P;let We=Ae instanceof Error?Ae.message:String(Ae);return h("Expression",`Error evaluating: {{ ${F} }}: ${We}`,i,e,L,P)}}),b.length>0)n=n.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(P,B)=>b[Number(B)]??P);if(c.length>0)n=n.replace(/<!--__STX_STYLE_(\d+)__-->/g,(P,B)=>c[Number(B)]??P);return n}function Sg(e,t,i){if(!t.trim())return e;let n=e,a=t.trim();while(a.length>0){let l=a.match(/^(\w+)/);if(!l)break;let c=l[1];a=a.substring(c.length).trim();let b=Jt[c]||Us[c];if(!b)throw Error(`Filter not found: ${c}. Available filters: ${Object.keys(wg()).join(", ")}`);let v=[];if(a.startsWith(":")){let E=a.match(/^:([^|\s]+)/);if(E){let A=E[1].trim();try{let O=Number(A);v=[Number.isNaN(O)?A:O]}catch{v=[A]}a=a.substring(E[0].length).trim()}}else if(a.startsWith("(")){let E=1,A=1;while(E>0&&A<a.length){if(a[A]==="(")E++;if(a[A]===")")E--;A++}if(E===0){let O=a.substring(1,A-1).trim();if(O)try{if(O.startsWith("{")&&O.endsWith("}"))v=[R(`(${O})`,i,!0)];else{let H=[],j="",P=null,B=0,L=0,F=0,G=!1;for(let D=0;D<O.length;D++){let ee=O[D];if(G){j+=ee,G=!1;continue}if(ee==="\\"){j+=ee,G=!0;continue}if(P){if(j+=ee,ee===P)P=null;continue}if(ee==='"'||ee==="'"||ee==="`"){P=ee,j+=ee;continue}if(ee==="(")B++;else if(ee===")")B--;else if(ee==="[")L++;else if(ee==="]")L--;else if(ee==="{")F++;else if(ee==="}")F--;if(ee===","&&B===0&&L===0&&F===0){H.push(j),j="";continue}j+=ee}if(j)H.push(j);v=H.map((D)=>{let ee=D.trim();return R(ee,i,!0)})}}catch{v=[O]}a=a.substring(A).trim()}}try{n=b(n,i,...v)}catch(E){let A=E instanceof Error?E.message:String(E);throw Error(`Error applying filter '${c}': ${A}`)}if(a.startsWith("|"))a=a.substring(1).trim();else break}return n}function ac(e){let t=!1,i="",n=0,a=0,l=0,c=!1;for(let b=0;b<e.length;b++){let v=e[b],E=e[b+1];if(t&&c){c=!1;continue}if(t&&v==="\\"){c=!0;continue}if(c=!1,(v==='"'||v==="'"||v==="`")&&!c){if(!t)t=!0,i=v;else if(v===i)t=!1,i="";continue}if(t&&i==="`"&&v==="$"&&E==="{"){let A=1;b+=2;while(b<e.length&&A>0){if(e[b]==="{")A++;else if(e[b]==="}")A--;if(A>0)b++}continue}if(t)continue;if(v==="(")n++;else if(v===")")n--;else if(v==="[")a++;else if(v==="]")a--;else if(v==="{")l++;else if(v==="}")l--;if(v==="|"&&n===0&&a===0&&l===0){if(E==="|"){b++;continue}if(E==="="){b++;continue}return b}}return-1}var Xt=new Set,cc=1000;function ny(){Xt.clear()}function Ss(e,t,i,n){if(!X())return;let a=`${i}\x00${e.expression}`;if(Xt.has(a))return;if(Xt.size>=cc)Xt.clear();Xt.add(a);let l=i,c=n;try{if(i&&Ei.existsSync(i))c=Ei.readFileSync(i,"utf8")}catch{}let b=c.indexOf(t);if(b>=0)l=`${i}:${c.slice(0,b).split(`
|
|
218
|
+
`).length}`;console.warn(`${l}: stx warning: ${t} 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 R(e,t,i=!1,n){try{let a=e.trim(),l=ac(a);if(l>0){let b=a.substring(0,l).trim(),v=a.substring(l+1).trim(),E=R(b,t,!0,n);return Sg(E,v,t)}let c=qs(a);if(c!==null){n?.({expression:a,rule:c});return}try{let b=Object.keys(t),v=Object.values(t);return d(a,b)(...v)}catch{return u(a,t)}}catch(a){if(a instanceof ReferenceError){let l=/(\b\w+)\s+is not defined/.exec(a.message);if(l){let c=l[1],b=lc(c,Object.keys(t));if(b&&b!==c)a.message=`${a.message} \u2014 did you mean '${b}'?`}}if(!i)console.error(`Error evaluating expression: ${e}`,a);throw a}}function lc(e,t){let i=null;for(let a of t){if(a===e)continue;let l=uc(e,a);if(i===null||l<i.dist)i={key:a,dist:l}}if(!i)return null;let n=Math.max(e.length,i.key.length);if(i.dist<=2||i.dist/n<=0.35)return i.key;return null}function uc(e,t){if(e===t)return 0;if(e.length===0)return t.length;if(t.length===0)return e.length;let[i,n]=e.length<t.length?[e,t]:[t,e],a=Array(i.length+1),l=Array(i.length+1);for(let c=0;c<=i.length;c++)a[c]=c;for(let c=1;c<=n.length;c++){l[0]=c;for(let b=1;b<=i.length;b++){let v=i[b-1]===n[c-1]?0:1;l[b]=Math.min(l[b-1]+1,a[b]+1,a[b-1]+v)}for(let b=0;b<=i.length;b++)a[b]=l[b]}return a[i.length]}function ry(e){if(!e)return"";return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}import fc from"process";function C(e="STX_PUBLIC_"){let t={},i={};for(let[n,a]of Object.entries(fc.env)){if(!n.startsWith(e)||a===void 0)continue;t[`import.meta.env.${n}`]=JSON.stringify(a),i[n]=a}return t["import.meta.env"]=JSON.stringify(i),t}function ji(e,t=""){let i=`${e}${t}`,n=0;for(let a=0;a<i.length;a++){let l=i.charCodeAt(a);n=(n<<5)-n+l,n=n&n}return`stx-${Math.abs(n).toString(36)}`}function Di(e,t,i={}){let{prefix:n="",preserveHost:a=!0,scopeKeyframes:l=!0,scopeCustomProperties:c=!1}=i;if(!e.trim())return"";let b=$s(e),v=[],E=new Map;if(l)for(let A of b){let O=A.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(O){let H=O[1],j=`${t}_${H}`;E.set(H,j)}}for(let A of b){let O=Ni(A,t,n,a,E,c);v.push(O)}return v.join(`
|
|
219
219
|
|
|
220
|
-
`)}function $s(e){let t=[],i=e.replace(/\/\*[\s\S]*?\*\//g,""),n=0,a="",l=!1,c="";for(let b=0;b<i.length;b++){let v=i[b];if(v==="@"&&n===0)l=!0;if(v==="{")n++;else if(v==="}"){if(n--,n===0){if(l){c+=v;let E=c.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(E){let[,A,
|
|
221
|
-
`)})}else t.push({selector:`@${A} ${
|
|
220
|
+
`)}function $s(e){let t=[],i=e.replace(/\/\*[\s\S]*?\*\//g,""),n=0,a="",l=!1,c="";for(let b=0;b<i.length;b++){let v=i[b];if(v==="@"&&n===0)l=!0;if(v==="{")n++;else if(v==="}"){if(n--,n===0){if(l){c+=v;let E=c.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(E){let[,A,O,H]=E;if(A==="keyframes")t.push({selector:`@keyframes ${O.trim()}`,declarations:H.trim()});else if(A==="media"||A==="supports"||A==="container"){let j=$s(H);t.push({selector:`@${A} ${O.trim()}`,declarations:j.map((P)=>`${P.selector} { ${P.declarations} }`).join(`
|
|
221
|
+
`)})}else t.push({selector:`@${A} ${O.trim()}`,declarations:H.trim()})}c="",l=!1}else if(a.trim()){a+=v;let E=a.match(/([^{]+)\{([^}]*)\}/);if(E)t.push({selector:E[1].trim(),declarations:E[2].trim()});a=""}continue}}if(l)c+=v;else a+=v}return t}function Ni(e,t,i,n,a,l){let{selector:c,declarations:b}=e;if(c.startsWith("@")){if(c.startsWith("@keyframes")){let A=c.replace("@keyframes ","").trim();return`@keyframes ${a.get(A)||A} { ${b} }`}if(c.startsWith("@media")||c.startsWith("@supports")||c.startsWith("@container")){let O=$s(`x { ${b} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((H)=>Ni(H,t,i,n,a,l)).join(`
|
|
222
222
|
`);return`${c} {
|
|
223
|
-
${
|
|
224
|
-
}`}return`${c} { ${b} }`}let v=pc(c,t,i,n),E=b;for(let[A,
|
|
223
|
+
${O}
|
|
224
|
+
}`}return`${c} { ${b} }`}let v=pc(c,t,i,n),E=b;for(let[A,O]of a)E=E.replace(new RegExp(`\\b${A}\\b`,"g"),O);if(l)E=E.replace(/--([a-z-]+)/gi,`--${t}-$1`);return`${v} { ${E} }`}function pc(e,t,i,n){let a=e.split(",").map((c)=>c.trim()),l=[];for(let c of a){if(c.startsWith(":host")){if(n)l.push(c);else{let E=c.replace(/:host(\([^)]*\))?/,`.${t}$1`);l.push(E)}continue}if(c.includes("::slotted")){l.push(c);continue}if(c===":root"){l.push(`:root .${t}`);continue}let b=i?`${i} .${t}`:`.${t}`;l.push(`${b} ${c}`);let v=dc(c,t);if(v)l.push(i?`${i} ${v}`:v)}return l.join(", ")}function dc(e,t){let i=0,n=e.length;for(let v=0;v<e.length;v++){let E=e[v];if(E==="["||E==="(")i++;else if(E==="]"||E===")")i--;else if(i===0&&(E===" "||E===">"||E==="+"||E==="~")){n=v;break}}let a=e.slice(0,n),l=e.slice(n);if(!a)return"";let c=a.length,b=0;for(let v=0;v<a.length;v++){let E=a[v];if(E==="["||E==="(")b++;else if(E==="]"||E===")")b--;else if(i===0&&b===0&&E===":"){c=v;break}}return`${a.slice(0,c)}.${t}${a.slice(c)}${l}`}var Bi=String.raw`(?<![\w-])scoped(?![\w-])`,vs=/<style\s+([^>]*)>/gi,Li=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,Wi=new RegExp(Bi,"i"),gc=new RegExp(Bi,"gi"),Es=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function mc(e){vs.lastIndex=0;let t=vs.exec(e);while(t!==null){if(Wi.test(t[1]))return!0;t=vs.exec(e)}return!1}function gi(e){let t=new Set,i=[];Es.lastIndex=0;let n=Es.exec(e);while(n!==null){let a=n[0].trim();if(t.has(a))i.push({start:n.index,end:n.index+n[0].length});else t.add(a);n=Es.exec(e)}return i}function gn(e){let t=gi(e);if(t.length===0)return e;let i=Array(t.length+1),n=0;for(let a=0;a<t.length;a++){let l=t[a];i[a]=e.slice(n,l.start),n=l.end}return i[t.length]=e.slice(n),i.join("")}function Bs(e,t){if(!mc(e))return{html:e,hasScoped:!1};let i=ji(t),n=`data-v-${i}`,a=e,l=!1;if(Li.lastIndex=0,a=a.replace(Li,(c,b,v)=>{if(!Wi.test(b))return c;l=!0;let E=hc(v,n),A=b.replace(gc,"").trim(),O=A?` ${A}`:"";return`<style data-stx-scoped="${i}"${O}>${E}</style>`}),!l)return{html:e,hasScoped:!1};return a=bc(a,n),{html:a,hasScoped:!0}}function hc(e,t){return Di(e,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${t}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${t}]`)}var xc=(e)=>`\x00stx-scope-mask-${e}\x00`,zi=/\u0000stx-scope-mask-(\d+)\u0000/g;function bc(e,t){let i=fe(e,(a,l)=>{let c=q(a,l);return c>l?c:fn(a,l)},(a,l)=>xc(l)),n=yc(i.output,t);return zi.lastIndex=0,n.replace(zi,(a,l)=>i.tokens[Number(l)])}function yc(e,t){let i=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,(n,a,l)=>{if(i.has(a.toLowerCase()))return n;if(n.includes(t))return n;if(a.toLowerCase()==="style"||a.toLowerCase()==="script")return n;if(l)return n.replace(`<${a}${l}`,`<${a} ${t}${l}`);if(n.endsWith("/>"))return`<${a} ${t} />`;return`<${a} ${t}>`})}var Gt=/<\/?template\b[^>]*>/gi,_c=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function wc(e){let t=e.replace(/^<template\b/i,"").replace(/>$/,"");return _c.test(t)}function pe(e){Gt.lastIndex=0;let t;while((t=Gt.exec(e))!==null){if(t[0].startsWith("</")||wc(t[0]))continue;let i=t.index,n=Gt.lastIndex,a=1,l;while((l=Gt.exec(e))!==null)if(l[0].startsWith("</")){if(a--,a===0){let c=l.index;return{start:i,openEnd:n,closeStart:c,end:Gt.lastIndex,content:e.slice(n,c)}}}else a++;return null}return null}var Sc=0,$c=0;function Un(e,t){let i=/(?:^|\s)([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g;for(let n of e.matchAll(i))if(n[1].toLowerCase()===t.toLowerCase())return n[2]??n[3]??n[4]??null;return null}function Vi(e){let t=[],i=/<([a-z][a-z0-9-]*)\b((?:"[^"]*"|'[^']*'|[^>"'])*)>/iy;return y(e,(n,a)=>{i.lastIndex=a;let l=i.exec(n);if(!l||!Un(l[2],"x-data"))return-1;return t.push({fullMatch:l[0],tagName:l[1],attributes:l[2],startIndex:a,endIndex:i.lastIndex}),i.lastIndex}),t}function vc(e){let t=[];for(let{fullMatch:i,tagName:n,attributes:a,startIndex:l}of Vi(e)){let c=Un(a,"x-data");if(!c)continue;let b=`__stx_scope_${Sc++}`,v=Un(a,"x-init"),E=Ec(e,n,l+i.length),A=e.slice(l,E.endIndex),O=kc(A);t.push({id:b,selector:`[data-stx-scope="${b}"]`,stateExpr:c,initExpr:v,bindings:[],refs:O})}return t}function Ec(e,t,i){let n=1,a=i,l=new RegExp(`<${t}(?:\\s|>)`,"gi"),c=new RegExp(`</${t}>`,"gi"),b=new RegExp(`<${t}[^>]*/\\s*>`,"gi");while(n>0&&a<e.length){l.lastIndex=a,c.lastIndex=a,b.lastIndex=a;let v=l.exec(e),E=c.exec(e),A=b.exec(e);if(A&&A.index<(v?.index??1/0)){a=A.index+A[0].length;continue}if(!E)return{endIndex:e.length};if(v&&v.index<E.index)n++,a=v.index+v[0].length;else{if(n--,n===0)return{endIndex:E.index+E[0].length};a=E.index+E[0].length}}return{endIndex:e.length}}function kc(e){let t=new Map,i=e.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),n=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,a;while((a=n.exec(i))!==null){let[,l,c]=a,b=Rc(l);t.set(c,b)}return t}function Rc(e){let t=e.match(/\bid\s*=\s*["']([^"']*)["']/);if(t)return t[1];return`__stx_el_${$c++}`}function Cc(){return`
|
|
225
225
|
// STX Reactive Runtime - x-cloak and transition CSS
|
|
226
226
|
(function() {
|
|
227
227
|
var style = document.createElement('style');
|
|
@@ -493,7 +493,7 @@ window.__stx_reactive = (function() {
|
|
|
493
493
|
|
|
494
494
|
return { initScope: initScope, reactive: reactive };
|
|
495
495
|
})();
|
|
496
|
-
`}function Fi(e,t){let i=e.replace(/\{!!([\s\S]*?)!!\}/g,(b,v)=>{try{let E=R(v,t,!0);if(E===void 0)return b;return String(E)}catch{return b}}),n="",a=0,l=null;while(a<i.length){let b=i[a];if(l&&b==="\\"){n+=b+(i[a+1]??""),a+=2;continue}if(b==="{"&&i[a+1]==="{"){let v=i.indexOf("}}",a+2);if(v!==-1){let E=i.slice(a,v+2);n+=c(i.slice(a+2,v),E,l),a=v+2;continue}}if(l){if(b===l)l=null}else if(b==="'"||b==='"'||b==="`")l=b;n+=b,a++}return n;function c(b,v,E){let A;try{A=R(b,t,!0)}catch{return v}if(A===void 0)return v;if(E){let
|
|
496
|
+
`}function Fi(e,t){let i=e.replace(/\{!!([\s\S]*?)!!\}/g,(b,v)=>{try{let E=R(v,t,!0);if(E===void 0)return b;return String(E)}catch{return b}}),n="",a=0,l=null;while(a<i.length){let b=i[a];if(l&&b==="\\"){n+=b+(i[a+1]??""),a+=2;continue}if(b==="{"&&i[a+1]==="{"){let v=i.indexOf("}}",a+2);if(v!==-1){let E=i.slice(a,v+2);n+=c(i.slice(a+2,v),E,l),a=v+2;continue}}if(l){if(b===l)l=null}else if(b==="'"||b==='"'||b==="`")l=b;n+=b,a++}return n;function c(b,v,E){let A;try{A=R(b,t,!0)}catch{return v}if(A===void 0)return v;if(E){let O=String(A).replace(/\\/g,"\\\\").replace(new RegExp(E==="`"?"`":E,"g"),`\\${E}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return E==="`"?O.replace(/\$\{/g,"\\${"):O}if(typeof A==="string"){let O=A.trim();if(O.startsWith("{")&&O.endsWith("}")||O.startsWith("[")&&O.endsWith("]"))try{return JSON.parse(O),O}catch{}}return JSON.stringify(A)}}function Tc(e,t,i){if(e.length===0)return"";let n=e.map((a)=>{let l=JSON.stringify(Object.fromEntries(a.refs)),c=Fi(a.stateExpr,t),b=a.initExpr?Fi(a.initExpr,t):null,v=JSON.stringify(c),E=b?JSON.stringify(b):"null";return`
|
|
497
497
|
(function() {
|
|
498
498
|
var scopeEl = document.querySelector('${a.selector}');
|
|
499
499
|
if (!scopeEl) return;
|
|
@@ -502,10 +502,10 @@ window.__stx_reactive = (function() {
|
|
|
502
502
|
})();`}).join(`
|
|
503
503
|
`);return`
|
|
504
504
|
<script data-stx-scoped data-stx-reactive data-stx-run="always">
|
|
505
|
-
${
|
|
505
|
+
${Cc()}
|
|
506
506
|
${n}
|
|
507
|
-
</script>`}function
|
|
508
|
-
`+l.slice(b);else l+=c;return l}function sl(e,t){let i=[],n=0;for(let[l,c]of Vi(e).entries()){let b=t[l];if(!b)break;i.push(e.slice(n,c.startIndex));let v=Un(c.attributes,"data-stx-scope");if(v)b.id=v,b.selector=`[data-stx-scope="${b.id}"]`,i.push(c.fullMatch);else i.push(`<${c.tagName} data-stx-scope="${b.id}"${c.attributes}>`);n=c.endIndex}i.push(e.slice(n));let a=i.join("");return a=a.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),a=a.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),a=a.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),a=a.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),a=a.replace(/\s*x-destroy\s*=\s*"([^"]*)"/g,' data-stx-xdestroy="$1"'),a=a.replace(/\s*x-destroy\s*=\s*'([^']*)'/g," data-stx-xdestroy='$1'"),a}function ks(e){return/x-data\s*=\s*["']/.test(e)}function zs(e,t){let i=e,n=/@json\s*\(/g,a;while((a=n.exec(i))!==null){let l=a.index,c=l+a[0].length-1,b=1,v=c+1,E=null,A=!1;while(v<i.length&&b>0){let D=i[v];if(A){A=!1,v++;continue}if(D==="\\"&&E){A=!0,v++;continue}if(E){if(D===E)E=null;v++;continue}if(D==='"'||D==="'"||D==="`"){E=D,v++;continue}if(D==="(")b++;else if(D===")"){if(b--,b===0)break}v++}if(b!==0)break;let
|
|
507
|
+
</script>`}function zc(e,t,i,n=!1){if(!ks(e))return e;let a=vc(e);if(a.length===0)return e;let l=sl(e,a),c=Tc(a,t,n),b=l.lastIndexOf("</body>");if(b!==-1)l=l.slice(0,b)+c+`
|
|
508
|
+
`+l.slice(b);else l+=c;return l}function sl(e,t){let i=[],n=0;for(let[l,c]of Vi(e).entries()){let b=t[l];if(!b)break;i.push(e.slice(n,c.startIndex));let v=Un(c.attributes,"data-stx-scope");if(v)b.id=v,b.selector=`[data-stx-scope="${b.id}"]`,i.push(c.fullMatch);else i.push(`<${c.tagName} data-stx-scope="${b.id}"${c.attributes}>`);n=c.endIndex}i.push(e.slice(n));let a=i.join("");return a=a.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),a=a.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),a=a.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),a=a.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),a=a.replace(/\s*x-destroy\s*=\s*"([^"]*)"/g,' data-stx-xdestroy="$1"'),a=a.replace(/\s*x-destroy\s*=\s*'([^']*)'/g," data-stx-xdestroy='$1'"),a}function ks(e){return/x-data\s*=\s*["']/.test(e)}function zs(e,t){let i=e,n=/@json\s*\(/g,a;while((a=n.exec(i))!==null){let l=a.index,c=l+a[0].length-1,b=1,v=c+1,E=null,A=!1;while(v<i.length&&b>0){let D=i[v];if(A){A=!1,v++;continue}if(D==="\\"&&E){A=!0,v++;continue}if(E){if(D===E)E=null;v++;continue}if(D==='"'||D==="'"||D==="`"){E=D,v++;continue}if(D==="(")b++;else if(D===")"){if(b--,b===0)break}v++}if(b!==0)break;let O=i.substring(c+1,v).trim(),H=i.substring(l,v+1),j=-1,P=0,B=null,L=!1;for(let D=0;D<O.length;D++){let ee=O[D];if(L){L=!1;continue}if(ee==="\\"&&B){L=!0;continue}if(B){if(ee===B)B=null;continue}if(ee==='"'||ee==="'"||ee==="`"){B=ee;continue}if(ee==="("||ee==="["||ee==="{")P++;else if(ee===")"||ee==="]"||ee==="}")P--;if(ee===","&&P===0){j=D;break}}let F=j>=0?O.substring(0,j).trim():O,G=j>=0?O.substring(j+1).trim():void 0;try{let D=F.trim(),ee;if(f(D))ee=d(D,Object.keys(t))(...Object.values(t));else ee=void 0;let ne;if(G==="true")ne=JSON.stringify(ee,null,2);else ne=JSON.stringify(ee);let te=ne.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");i=i.substring(0,l)+te+i.substring(v+1),n.lastIndex=l+te.length}catch(D){z.log(D instanceof Error?D:Error(String(D)),{directive:"@json"},"error"),n.lastIndex=l+H.length}}return i}function Hs(e){return e.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function Hc(e){let t=e,i=/@memo\s*\(/g,n,a=[];while((n=i.exec(t))!==null){let l=n.index,c=l+n[0].length,b=1,v=c;while(v<t.length&&b>0){if(t[v]==="(")b++;else if(t[v]===")")b--;v++}if(b!==0)continue;let E=t.slice(c,v-1).trim(),A=v,O=t.slice(A),H=O.indexOf("@endmemo");if(H===-1)continue;let j=O.slice(0,H),P=A+H+8,B=j.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),L=B?B[0].length:0,F=j.slice(L),G=j.match(/(\s*)$/),D=G?G[0].length:0,ee=F.slice(0,F.length-D),ne=ee.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),te;if(ne){let[le,he,ue="",Ee]=ne,Ae=`<${he}${ue} data-stx-memo="${E}"${Ee}>`;te=j.slice(0,L)+Ae+ee.slice(le.length)+j.slice(L+ee.length)}else te=`${j.slice(0,L)}<div data-stx-memo="${E}">${ee}</div>${j.slice(L+ee.length)}`;a.push({start:l,end:P,replacement:te}),i.lastIndex=P}for(let l=a.length-1;l>=0;l--){let c=a[l];t=t.slice(0,c.start)+c.replacement+t.slice(c.end)}return t.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function mi(e){let t=e.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return t=t.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),t}function Zi(e,t){let i=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,n=y(e,(b,v)=>{i.lastIndex=v;let E=i.exec(b);if(!E||/^(?:script|style)$/i.test(E[1]))return-1;return i.lastIndex}),a=[],l=0,c=[];for(let{start:b,end:v,token:E}of n){let A=/^<\/?([\w-]+)/.exec(E)[1].toLowerCase();if(E.startsWith("</")){while(a.length&&a.pop()!==A);continue}if(!a.length&&!/\sdata-stx-slot-owner\s*=/.test(E))c.push(e.slice(l,b),E.replace(/\s*\/?>$/,(O)=>` data-stx-slot-owner="${t}"${O}`)),l=v;if(!Rs.has(A)&&!/\/>$/.test(E))a.push(A)}return c.push(e.slice(l)),c.join("")}function Ki(e,t){if(!/\bref\s*=/.test(e))return e;let i=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,n=y(e,(v,E)=>{i.lastIndex=E;let A=i.exec(v);if(!A||/^(?:script|style)$/i.test(A[1]))return-1;return i.lastIndex}),a=[],l=0,c=0,b=[];for(let{start:v,end:E,token:A}of n){let O=/^<\/?([\w-]+)/.exec(A)[1].toLowerCase();if(A.startsWith("</")){let B;while(B=a.pop()){if(B.scoped)l--;if(B.name===O)break}continue}let H=/\sdata-stx-scope\s*=/.test(A),j=/\sdata-stx-ref-caller\s*=\s*(["'])(.*?)\1/.exec(A),P=a.find((B)=>B.scoped)?.scopeId;if(j&&P&&j[2]===P)b.push(e.slice(c,v),A.replace(j[0],` data-stx-ref-caller="${t}"`)),c=E;else if(!l&&!H&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(A)&&!/\sdata-stx-ref-caller\s*=/.test(A))b.push(e.slice(c,v),A.replace(/\s*\/?>$/,(B)=>` data-stx-ref-caller="${t}"${B}`)),c=E;if(!Rs.has(O)&&!/\/>$/.test(A)){let B=/\sdata-stx-scope\s*=\s*(?:"([^"]*)"|'([^']*)')/.exec(A);if(a.push({name:O,scoped:H,scopeId:B?.[1]??B?.[2]}),H)l++}}return b.push(e.slice(c)),b.join("")}var Rs=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Xi=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,Ui=/<\/?\s*([a-z][\w-]*)/iy,rl=/\s/;function il(e,t){let i=t-1;while(i>=0&&rl.test(e[i]))i--;return i>=0&&e[i]==="/"}function ol(e,t){let i=!1,n=!1;for(let a=t;a<e.length;a++){let l=e[a];if(i){if(l==="'")i=!1}else if(n){if(l==='"')n=!1}else if(l==="'")i=!0;else if(l==='"')n=!0;else if(l===">")return a}return-1}function al(e,t){if(e.indexOf("{",t)===-1||e.indexOf("}",t)===-1)return!1;let i=0,n=t,a=!1,l=!1,c=!1;while(n<e.length){let b=e.indexOf("<",n),v=b===-1?e.length:b;if(v>n){if(i===0)while(n<v){let O=e.indexOf(l?"}":"{",n);if(O===-1||O>=v){if(l)c=!1;else a=!1;break}if(O>n)if(l)c=!1;else a=!1;if(l){if(c)return!0;c=!0}else if(a)l=!0,c=!1;else a=!0;n=O+1}n=v;continue}if(e.startsWith("<!--",n)){let O=e.indexOf("-->",n);n=O===-1?e.length:O+3;continue}let E=ol(e,n);if(E===-1)break;Ui.lastIndex=n;let A=Ui.exec(e)?.[1]?.toLowerCase()??"";if(e[n+1]==="/"){if(i===0)break;i--}else if(!il(e,E)&&!Rs.has(A))i++;n=E+1}return!1}var Hi=w(256);function Vc(e){if(e.length<1024)return qi(e);let t=S(e),i=Hi.get(t);if(i!==void 0)return i;let n=qi(e);return Hi.set(t,n),n}function qi(e){if(e.length>=32768&&!Gr(e))return e;let i=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"),n="",a=0,l;while((l=i.exec(e))!==null){let c=l.index,b=c+l[0].length,v=!1,E=!1,A=-1;while(b<e.length){let H=e[b];if(v){if(H==="'")v=!1}else if(E){if(H==='"')E=!1}else if(H==="'")v=!0;else if(H==='"')E=!0;else if(H===">"){A=b;break}b++}if(A===-1)continue;let O=e.slice(c,A+1);if(Xi.test(O))continue;if(O.includes("x-cloak"))continue;if(al(e,A+1))n+=e.slice(a,A)+" x-cloak>",a=A+1}return n+=e.slice(a),n}var cl=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,ll=/<\/script>/gi,ul=/<\/style>/gi;function Uc(e){let t=/<[a-z][\w-]*/gi,i="",n=0,a;while((a=t.exec(e))!==null){let l=a.index,c=a[0].slice(1).toLowerCase();if(c==="script"||c==="style"){let P=c==="script"?ll:ul;P.lastIndex=l;let B=P.exec(e);if(B!==null)t.lastIndex=B.index+B[0].length;continue}let b=l+a[0].length,v=!1,E=!1,A=-1;while(b<e.length){let P=e[b];if(v){if(P==="'")v=!1}else if(E){if(P==='"')E=!1}else if(P==="'")v=!0;else if(P==='"')E=!0;else if(P===">"){A=b;break}b++}if(A===-1)continue;let O=e.slice(l+a[0].length,A);if(Xi.test(O))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(O))continue;if(!cl.test(O))continue;let H=e[A-1]==="/",j=H?A-1:A;i+=`${e.slice(n,j)} x-cloak${H?" ":""}`,n=j}return i+=e.slice(n),i}import uo from"path";import As from"fs";import Yt from"path";function Ji(e,t,i,n){let a=0;for(let l=t;l<e.length;l++)if(e[l]===i)a++;else if(e[l]===n&&!(n===">"&&e[l-1]==="=")){if(--a===0)return l}return-1}function dl(e){let t=r(e),i=0,n=0,a=[];for(let l=0;l<t.length;l++)if("([{".includes(t[l]))i++;else if(")]}".includes(t[l]))i--;else if(t[l]===","&&i===0)a.push(e.slice(n,l).trim()),n=l+1;return a.push(e.slice(n).trim()),a}function Cs(e,t){let i=r(e),n=new RegExp(`\\b(?:${t.map((a)=>a.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let a of i.matchAll(n)){let l=a.index+a[0].length,c="";if(i[l]==="<"){let v=Ji(i,l,"<",">");if(v<0)continue;c=e.slice(l+1,v),l=v+1;while(/\s/.test(i[l]||"")&&l<i.length)l++}if(i[l]!=="(")continue;let b=Ji(i,l,"(",")");if(b>=0)return{type:c,args:dl(e.slice(l+1,b))}}return null}var Gi=`
|
|
509
509
|
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;
|
|
510
510
|
type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
|
|
511
511
|
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>;
|
|
@@ -513,92 +513,92 @@ type __StxRequired<O> = { [K in keyof O]-?: O[K] extends { required: true } ? K
|
|
|
513
513
|
type __StxDefaulted<O> = { [K in keyof O]-?: O[K] extends { default: unknown } ? K : never }[keyof O];
|
|
514
514
|
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]> };
|
|
515
515
|
type __StxDefaults<P, K> = Omit<P, Extract<keyof P, K>> & Partial<Pick<P, Extract<keyof P, K>>>;
|
|
516
|
-
`;function Yi(e,t){let i=[],n={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},a=r(e),l=e.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(
|
|
517
|
-
`)}),c=Cs(e,n.defineProps),b=Cs(e,n.defineEmits),v=Cs(e,n.withDefaults);if(!c&&!b)return{declarations:"",props:null,events:null};let E=[],A=null,
|
|
516
|
+
`;function Yi(e,t){let i=[],n={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},a=r(e),l=e.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(H,j,P,B,L)=>{if(a.slice(L,L+6)!=="import")return H;if(B.endsWith(".stx"))return"";let F=`${t}Import${i.length}`;if(i.push(`import * as ${F} from ${JSON.stringify(B)};`),j.startsWith("*"))return`import ${j.replace(/^\*\s+as\s+/,"")} = ${F};`;if(!j.startsWith("{"))return`import ${j} = ${F}.default;`;return j.slice(1,-1).split(",").map((G)=>{let[D,ee=D]=G.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!D)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(B)&&D in n)n[D].push(ee);return`import ${ee} = ${F}.${D};`}).join(`
|
|
517
|
+
`)}),c=Cs(e,n.defineProps),b=Cs(e,n.defineEmits),v=Cs(e,n.withDefaults);if(!c&&!b)return{declarations:"",props:null,events:null};let E=[],A=null,O=null;if(c){E.push(`const __options = (${c.args[0]||"{}"}) as const;`),E.push(`const __defaults = (${v?.args[1]||"{}"});`);let H=c.type||"__StxOptions<typeof __options>";E.push(`export type __StxProps = __StxDefaults<${H}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),A=`${t}.__StxProps`}if(b)E.push(`const __events = (${b.args[0]||"[]"}) as const;`),E.push(`export type __StxEvents = ${b.type||"Record<(typeof __events)[number], any[]>"};`),O=`${t}.__StxEvents`;return{declarations:`${i.join(`
|
|
518
518
|
`)}
|
|
519
519
|
namespace ${t} {
|
|
520
520
|
${l}
|
|
521
521
|
${E.join(`
|
|
522
522
|
`)}
|
|
523
|
-
}`,props:A,events:
|
|
524
|
-
`).length,column:
|
|
525
|
-
`)}},j=(
|
|
526
|
-
`):"",checks:n,events:l,dependencies:c}}var eo=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function ml(e){let t=(i)=>i.replace(/[^\n]/g," ");return e.replace(/<!--[\s\S]*?-->/g,t).replace(/\{\{--[\s\S]*?--\}\}/g,t)}function
|
|
523
|
+
}`,props:A,events:O}}var Sr=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 kr(e){if(e.includes("-")||e==="component")return!1;if(/^[A-Z]/.test(e))return!/[a-z]/.test(e)&&[...Sr].some((t)=>t.toLowerCase()===e.toLowerCase());return Sr.has(e)||/[A-Z]/.test(e)}function*gl(e){let t=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,i;while(i=t.exec(e)){let n=t.lastIndex,a=[];while(n<e.length){while(/\s/.test(e[n]||""))n++;if(e[n]===">"||e.slice(n,n+2)==="/>"){n+=e[n]===">"?1:2;break}let l=/^[^\s=/>]+/.exec(e.slice(n))?.[0];if(!l){n++;continue}let c=n;n+=l.length;while(/\s/.test(e[n]||""))n++;if(e[n]!=="="){a.push({name:l,value:!0,offset:c,braced:!1});continue}n++;while(/\s/.test(e[n]||""))n++;let b=e[n],v=b==="{",E=b==='"'||b==="'";if(E||v)n++;let A=n;if(v){let O=r(e.slice(n)),H=1,j=0;for(;j<O.length;j++){if(O[j]==="{")H++;if(O[j]==="}"&&--H===0)break}n+=j}else if(E)while(n<e.length&&e[n]!==b)n++;else while(n<e.length&&!/[\s/>]/.test(e[n]))n++;if(a.push({name:l,value:e.slice(A,n),offset:A,braced:v}),E||v)n++}t.lastIndex=n,yield{name:i[1],offset:i.index,attributes:a}}}function Qi(e,t,i){let n=[],a=[Gi,"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 __StxStaticProp<P, K> = __StxProp<P, K> extends infer T ? boolean extends T ? T | "true" | "false" : T : never;','type __StxEvent<E, K> = K extends keyof E ? E[K] extends readonly unknown[] ? number extends E[K]["length"] ? E[K][0] : Exclude<E[K]["length"], 0 | 1> extends never ? E[K][0] : E[K] : E[K] : any;'],l=new Map,c=new Map,b=new Map,v=i.scriptCode(e,i.filePath),E=r(v);for(let P of v.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(E.slice(P.index,P.index+6)!=="import")continue;let B=P[2],L=Yt.isAbsolute(B)||B.startsWith(".")?Yt.resolve(Yt.dirname(i.filePath),B):Os(B,Yt.dirname(i.filePath));if(!L)continue;let F=L.endsWith(".stx")?L:As.existsSync(`${L}.stx`)?`${L}.stx`:void 0,G=F?null:yr(L,!1),D=P[1].startsWith("{")?P[1].slice(1,-1).split(","):[P[1]];for(let ee of D){let[ne,te=ne]=ee.trim().split(/\s+as\s+/),le=F||G?.get(ne)||G?.get(ne.toLowerCase());if(le)b.set(te,le),b.set(te.toLowerCase(),le),b.set(te.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),le)}}for(let P of t.matchAll(/@import\s*\(([^)]+)\)/g))for(let B of P[1].matchAll(/['"]([^'"]+)['"]/g)){let L=Ns(B[1],i.filePath,i).find((F)=>As.statSync(F,{throwIfNoEntry:!1})?.isFile());if(L)b.set(Yt.basename(B[1]).replace(/\.stx$/,""),L)}let A={__importedComponents:b},O=new Map,H=(P,B,L)=>{let F=e.slice(0,P);return{code:B,offset:P,attribute:L,anchor:!0,kind:"directive",line:F.split(`
|
|
524
|
+
`).length,column:P-F.lastIndexOf(`
|
|
525
|
+
`)}},j=(P,B,L)=>n.push({expression:P,statement:{text:B+P.code+L,prefixLength:B.length}});for(let P of gl(t)){if(kr(P.name)||P.name==="component")continue;let B=Ar(P.name,i.filePath,i,A);if(!B)continue;let L=O.get(B);if(!L){let G;try{G=i.readComponent?i.readComponent(B):As.readFileSync(B,"utf8")}catch{continue}if(G===void 0)continue;c.set(B,G),L=Yi(i.scriptCode(G,B),`__StxComponent${O.size}`),O.set(B,L),a.push(L.declarations)}let F=[];for(let G of P.attributes){let{name:D,offset:ee}=G,ne=G.value===!0?"true":G.value;if(D.startsWith("@")||D.startsWith("v-on:")){if(L.events&&G.value!==!0)l.set(ee,`__StxEvent<${L.events}, ${JSON.stringify(D.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let te=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(D);if(D.startsWith("v-")&&!D.startsWith("v-bind:")&&!te)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(D))continue;let le=(te?te[1]||"modelValue":D.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(Ae,We)=>We.toUpperCase());if(F.push(le),!L.props)continue;let he=D.startsWith(":")||D.startsWith("v-bind:")||!!te||G.braced,ue=he?ne:G.value!==!0?JSON.stringify(ne):"true",Ee=!he&&G.value!==!0&&(ne==="true"||ne==="false");j(H(ee,ue,D),";void ((",`) satisfies ${Ee?"__StxStaticProp":"__StxProp"}<${L.props}, ${JSON.stringify(le)}>);`)}if(L.props){let G=[...new Set(F)].map((ee)=>`${JSON.stringify(ee)}: undefined as any`).join(", "),D=H(P.offset,`<${P.name}>`);n.push({expression:D,statement:{text:`;void ({ ${G} } satisfies ${L.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:O.size?a.join(`
|
|
526
|
+
`):"",checks:n,events:l,dependencies:c}}var eo=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function ml(e){let t=(i)=>i.replace(/[^\n]/g," ");return e.replace(/<!--[\s\S]*?-->/g,t).replace(/\{\{--[\s\S]*?--\}\}/g,t)}function It(e){let t=[],i=ml(e);eo.lastIndex=0;let n;while((n=eo.exec(i))!==null){let a=(n[1]||"").trim(),l=(n[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,c=(n[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,b=n.index+l,v=n.index+n[0].length-c,E=e.slice(b,v);if(/\bsrc\s*=/.test(a))continue;let A=a.match(/\btype\s*=\s*["']([^"']+)["']/i);if(A&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(A[1]))continue;let O=/\bserver\b/.test(a)?"server":/\bclient\b/.test(a)?"client":"plain",H=Qt(e,b);t.push({kind:O,code:E,startLine:H,startColumn:en(e,b),offset:b,attrs:a})}return t}function Qt(e,t){let i=1;for(let n=0;n<t&&n<e.length;n++)if(e.charCodeAt(n)===10)i++;return i}function en(e,t){let i=e.lastIndexOf(`
|
|
527
527
|
`,t-1)+1;return t-i+1}function Hn(e){let t=e.split(""),i=(a,l)=>{for(let c=a;c<l&&c<t.length;c++)if(t[c]!==`
|
|
528
|
-
`)t[c]=" "},n=[/<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 n){a.lastIndex=0;let l;while((l=a.exec(e))!==null)i(l.index,l.index+l[0].length)}return t.join("")}function fo(e){let t=0,i="";for(let n=0;n<e.length;n++){let a=e[n];if(i){if(a==="\\"){n++;continue}if(a===i)i="";continue}if(a==='"'||a==="'"||a==="`"){i=a;continue}if(a==="("||a==="["||a==="{"){t++;continue}if(a===")"||a==="]"||a==="}"){t--;continue}if(a==="|"&&t===0){if(e[n+1]==="|"){n++;continue}if(e[n-1]==="|")continue;return e.slice(0,n)}}return e}var po=new Set([":for","x-for","v-for"]),qn=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,Ts="__stx_interpolated",to="__StxElement",go="__StxTemplateValue",hl=`type ${go}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function no(e){return e.replace(/\{\{[\s\S]*?\}\}/g,Ts).replace(/\{!![\s\S]*?!!\}/g,Ts)}function xl(e,t,i){let n=0;for(let a=t;a<e.length;a++){let l=e[a];if(l==="{"){n++;continue}if(l!=="}"&&l!=="!")continue;if(e.startsWith(i,a)&&n===0)return a;if(l==="}"&&n>0)n--}return-1}function
|
|
529
|
-
`),Ke=
|
|
530
|
-
`)),A=ne+te.length}E.push(e.slice(A));let
|
|
531
|
-
${
|
|
528
|
+
`)t[c]=" "},n=[/<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 n){a.lastIndex=0;let l;while((l=a.exec(e))!==null)i(l.index,l.index+l[0].length)}return t.join("")}function fo(e){let t=0,i="";for(let n=0;n<e.length;n++){let a=e[n];if(i){if(a==="\\"){n++;continue}if(a===i)i="";continue}if(a==='"'||a==="'"||a==="`"){i=a;continue}if(a==="("||a==="["||a==="{"){t++;continue}if(a===")"||a==="]"||a==="}"){t--;continue}if(a==="|"&&t===0){if(e[n+1]==="|"){n++;continue}if(e[n-1]==="|")continue;return e.slice(0,n)}}return e}var po=new Set([":for","x-for","v-for"]),qn=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,Ts="__stx_interpolated",to="__StxElement",go="__StxTemplateValue",hl=`type ${go}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function no(e){return e.replace(/\{\{[\s\S]*?\}\}/g,Ts).replace(/\{!![\s\S]*?!!\}/g,Ts)}function xl(e,t,i){let n=0;for(let a=t;a<e.length;a++){let l=e[a];if(l==="{"){n++;continue}if(l!=="}"&&l!=="!")continue;if(e.startsWith(i,a)&&n===0)return a;if(l==="}"&&n>0)n--}return-1}function ui(e,t,i="0"){let n=`__stxScript${i}`;while((e+t).includes(n))n+="_";let a=new Map,l=[],c=[],b=r(e),v=yo(e),E=[],A=0;for(let L=0;L<b.length;L++){let F=b.startsWith("{{",L);if(!F&&!b.startsWith("{!!",L))continue;let G=F?2:3,D=F?"}}":"!!}",ee=xl(b,L+G,D);if(ee<0)continue;let ne=L,te=e.slice(ne,ee+D.length),le=te.slice(G,-D.length);L=ee+D.length-1;let he=c.length,ue=Ks(v,ne),Ee=Ks(v,ne+(F?2:3));c.push({code:fo(le),...Ee});let Ae=`${n}_${he}`,We=te.split(`
|
|
529
|
+
`),Ke=We[0].length;We[0]=Ae+" ".repeat(Math.max(0,Ke-Ae.length));for(let Je=1;Je<We.length;Je++)We[Je]=We[Je].replace(/[^\r]/g," ");let Ye=a.get(ue.line)??[],Xe=Ye.at(-1),et=ue.column+(Xe?Xe.generatedEnd-Xe.sourceEnd:0);Ye.push({sourceStart:ue.column,sourceEnd:ue.column+Ke,generatedStart:et,generatedEnd:et+We[0].length}),a.set(ue.line,Ye),E.push(e.slice(A,ne),We.join(`
|
|
530
|
+
`)),A=ne+te.length}E.push(e.slice(A));let O=E.join("");if(!c.length)return{code:O,columns:a,declarations:l};let{imports:H,body:j}=ho(t),P=[],B=0;for(let L of H.split(/\n(?=import\b)/)){if(!L.trim())continue;let F=/^import\s+(?:type\s+)?([\s\S]+?)\s+from\s*(['"][^'"]+['"])/.exec(L);if(!F){l.push({text:L});continue}let G=`${n}Module${B++}`;l.push({text:`import * as ${G} from ${F[2]}`});let D=F[1],ee=/\{([\s\S]*?)\}/.exec(D);for(let he of ee?.[1].split(",")??[]){let[ue,Ee=ue]=he.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(ue==="default")P.push(`const ${Ee} = ${G}.default; type ${Ee} = import(${F[2]}).default`);else if(ue)P.push(`import ${Ee} = ${G}.${ue}`)}let ne=D.replace(/\{[\s\S]*?\}/,""),te=/\*\s+as\s+(\w+)/.exec(ne);if(te)P.push(`import ${te[1]} = ${G}`);let le=/^\s*([\w$]+)/.exec(ne)?.[1];if(le)P.push(`const ${le} = ${G}.default; type ${le} = import(${F[2]}).default`)}l.push({text:`namespace ${n}Scope {
|
|
531
|
+
${P.join(`
|
|
532
532
|
`)}
|
|
533
533
|
export async function read() {
|
|
534
534
|
${Ls(j).replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class|interface|type)\b)/gm,"")}
|
|
535
|
-
return {`});for(let[L,
|
|
535
|
+
return {`});for(let[L,F]of c.entries())l.push({text:`value${L}: (`}),l.push({text:F.code,origin:{line:F.line,column:F.column}}),l.push({text:"),"});l.push({text:`}
|
|
536
536
|
}
|
|
537
|
-
}`});for(let L=0;L<c.length;L++)l.push({text:`declare var ${n}_${L}: Awaited<ReturnType<typeof ${n}Scope.read>>['value${L}']`});return{code:
|
|
538
|
-
`)}function
|
|
537
|
+
}`});for(let L=0;L<c.length;L++)l.push({text:`declare var ${n}_${L}: Awaited<ReturnType<typeof ${n}Scope.read>>['value${L}']`});return{code:O,columns:a,declarations:l}}function so(e,t){let i=0;for(let n of e){if(t<n.generatedStart)break;if(t<n.generatedEnd)return n.sourceStart+Math.min(t-n.generatedStart,n.sourceEnd-n.sourceStart);i=n.sourceEnd-n.generatedEnd}return t+i}var bl=["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"],yl=new RegExp(String.raw`^[ \t]*@(?:${bl.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function Ls(e){return e.replace(yl,(t)=>t.replace(/[^\n]/g," "))}var ro=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function eg(e){let t=Hn(e),i=[],n=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,a;while((a=n.exec(t))!==null){if(a[1]||a[3])continue;let b=a[2]??a[4]??"",v=a[2]!==void 0?2:3,E=fo(b);if(!E.trim())continue;let A=a.index+v+(E.length-E.trimStart().length);i.push({code:E.trim(),line:Qt(t,A),column:en(t,A),offset:A,kind:"interpolation"})}let l=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((a=l.exec(t))!==null){let c=a.index+a[0].length-1,b=0,v=c;for(;v<t.length;v++){let H=t[v];if(H==="(")b++;else if(H===")"){if(b--,b===0)break}}if(b!==0)continue;let E=t.slice(c+1,v),A=E.trim();if(l.lastIndex=v+1,!A)continue;let O=c+1+(E.length-E.trimStart().length);i.push({code:A,line:Qt(t,O),column:en(t,O),offset:a.index,kind:"condition"})}qn.lastIndex=0;while((a=qn.exec(t))!==null){let c=a[1],b=a[3]??"",v=c.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(ro.has(v)||ro.has(c))continue;if(!b.trim())continue;let E=a.index+a[0].indexOf(a[2],a[0].indexOf(c)+c.length)+1;if(po.has(v)){let O=b.match(/\s+(?:in|of)\s+/);if(!O||O.index===void 0)continue;let H=b.slice(O.index+O[0].length),j=O.index+O[0].length+(H.length-H.trimStart().length);i.push({code:no(H.trim()),line:Qt(t,E+j),column:en(t,E+j),offset:E+j,kind:"directive",attribute:v});continue}let A=b.length-b.trimStart().length;i.push({code:no(b.trim()),line:Qt(t,E+A),column:en(t,E+A),offset:E+A,kind:"directive",attribute:v})}return i.sort((c,b)=>c.line-b.line||c.column-b.column),i}var _l=2000;function wl(e,t){let i=0,n=Math.min(e.length,t+_l);for(let a=t;a<n;a++){let l=e[a];if(l==="(")i++;else if(l===")"){if(i--,i===0)return e.slice(t+1,a)}}return null}function Sl(e){let t=new Map,i=(b,v)=>{let E=b.split(/[,[\]{}()\s]+/).filter(Boolean);for(let A of E){let O=A.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(O))continue;let H=E.length===1?v:void 0,j=t.get(O);if(!j)t.set(O,{name:O,iterable:H});else if(j.iterable!==H)j.iterable=void 0}},n=/^\$?[A-Z_$][\w$]*$/i,a=(b)=>{let v=b.trim();return n.test(v)?v:void 0};for(let b of e.matchAll(/@for(?:each|else)\s*\(/g)){let v=wl(e,b.index+b[0].length-1);if(v===null)continue;let E=Pt(v);if(!E)continue;i(E.itemVar.replace(/=>/g," "),a(E.arrayExpr))}for(let b of e.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))i(b[1],b[2]==="of"?a(b[3]):void 0);for(let b of e.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))i(b[1]);let l=Hn(e);qn.lastIndex=0;let c;while((c=qn.exec(l))!==null){let b=c[1].replace(/\..*$/,"");if(!po.has(b))continue;let v=c[3].match(/\s+(?:in|of)\s+/);if(!v||v.index===void 0)continue;i(c[3].slice(0,v.index),a(c[3].slice(v.index+v[0].length)))}for(let b of e.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let v of b[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))i(v[1]);return[...t.values()].sort((b,v)=>b.name.localeCompare(v.name))}function De(e){let t=new Set;for(let i of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))t.add(i[1]);for(let i of e.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))t.add(i[1]);for(let i of e.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))t.add(i[1]);for(let i of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let n of i[1].split(",")){let a=n.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(a))t.add(a)}return[...t].sort()}var Zs=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],$l={$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 Oc(e=new Set){return[...Zs.filter((t)=>!e.has(t)).map((t)=>`declare var ${t}: any`),...Object.entries($l).filter(([t])=>!e.has(t)).map(([,t])=>t)].join(`
|
|
538
|
+
`)}function Nc(e){return new Set([...e.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((t)=>t[1]))}function mo(e){let t=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,i,n=!1,a=new Set,l=r(e);while((i=t.exec(l))!==null){n=!0;for(let c of vl(i[1])){let b=c.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(b))a.add(b)}}return n?[...a]:null}function vl(e){let t=[],i=0,n="";for(let a of e){if(a===","&&i===0){t.push(n),n="";continue}if(a==="("||a==="["||a==="{")i++;else if(a===")"||a==="]"||a==="}")i--;n+=a}return t.push(n),t.filter((a)=>a.trim().length>0)}function ho(e){let t=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,i=[],n=e.replace(t,(a)=>(i.push(a.trim()),a.split(`
|
|
539
539
|
`).map(()=>"").join(`
|
|
540
540
|
`)));return{imports:i.join(`
|
|
541
|
-
`),body:n}}function xo(e){let t=r(e),i=Array(t.length),n=0;for(let b=0;b<t.length;b++){let v=t[b];if(v==="}"||v===")"||v==="]")n=Math.max(0,n-1);if(i[b]=n,v==="{"||v==="("||v==="[")n++}let a=[],l=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,c;while((c=l.exec(t))!==null){if(i[c.index]!==0)continue;let b=c[1],v=c[2],E;if(b==="interface"){let A=t.indexOf("{",c.index);if(A===-1)continue;let
|
|
542
|
-
`&&!/[=|&,<([{]\s*$/.test(t.slice(Math.max(0,
|
|
541
|
+
`),body:n}}function xo(e){let t=r(e),i=Array(t.length),n=0;for(let b=0;b<t.length;b++){let v=t[b];if(v==="}"||v===")"||v==="]")n=Math.max(0,n-1);if(i[b]=n,v==="{"||v==="("||v==="[")n++}let a=[],l=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,c;while((c=l.exec(t))!==null){if(i[c.index]!==0)continue;let b=c[1],v=c[2],E;if(b==="interface"){let A=t.indexOf("{",c.index);if(A===-1)continue;let O=0;E=-1;for(let H=A;H<t.length;H++)if(t[H]==="{")O++;else if(t[H]==="}"&&--O===0){E=H+1;break}if(E===-1)continue}else{let A=0;E=t.length;for(let O=t.indexOf("=",c.index)+1;O<t.length;O++){let H=t[O];if(H==="{"||H==="["||H==="("||H==="<")A++;else if(H==="}"||H==="]"||H===")"||H===">")A--;else if(A<=0&&(H===";"||H===`
|
|
542
|
+
`&&!/[=|&,<([{]\s*$/.test(t.slice(Math.max(0,O-40),O)))){E=H===";"?O+1:O;break}}}a.push({name:v,text:e.slice(c.index,E).replace(/^[ \t]*export[ \t]+/,"")}),l.lastIndex=E}return a}function El(e){return new Set(xo(e).map((t)=>t.name))}function Mc(e,t=""){let i=mo(e),n=El(t),a=xo(e).filter((E)=>!n.has(E.name)).map((E)=>E.text);if(!i){let E=De(e).filter((A)=>!At(t,A));if(E.length===0&&a.length===0)return"";return["",`// ${kl}`,...a,...E.map((A)=>`declare var ${A}: any`)].join(`
|
|
543
543
|
`)}if(i.length===0)return a.length>0?["",`// ${io}`,...a].join(`
|
|
544
544
|
`):"";let{imports:l,body:c}=ho(e),b=c.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),v=["",`// ${io}`];if(l)v.push(l);return v.push(...a),v.push(`async function ${oo}() {`,b,` return { ${i.join(", ")} }`,"}",`type ${ao} = Awaited<ReturnType<typeof ${oo}>>`,...i.map((E)=>`declare var ${E}: ${ao}[${JSON.stringify(E)}]`)),v.join(`
|
|
545
|
-
`)}function
|
|
546
|
-
`)i[a]=" "}return
|
|
547
|
-
`))continue;let
|
|
548
|
-
`),a=Array.from({length:n.length},()=>""),l=new Map,c=new Map,b=new Map,v=[],E=i.filter((
|
|
549
|
-
`),A=t.filePath&&t.templateExpressions!==!1?Qi(e,Hn(e),{filePath:t.filePath,componentsDir:t.componentsDir,projectRoot:t.projectRoot,readComponent:t.readComponent,scriptCode:(
|
|
550
|
-
`)}):void 0,
|
|
551
|
-
`);ee.forEach((ne,te)=>{let le=L.startLine-1+te;if(le<a.length)a[le]=ne,
|
|
552
|
-
`).entries())if(a.push(
|
|
553
|
-
`))j(L);let
|
|
554
|
-
`),lineMap:l,sourceLineCount:n.length,componentDependencies:A?.dependencies,referenced:
|
|
545
|
+
`)}function di(e){let i=r(e).split(""),n=0;for(let a=0;a<i.length;a++){let l=i[a];if(l==="{"||l==="("||l==="["){n++;continue}if(l==="}"||l===")"||l==="]"){n=Math.max(0,n-1);continue}if(n>0&&l!==`
|
|
546
|
+
`)i[a]=" "}return De(i.join(""))}function Dc(e,t){if(mo(e)!==null)return[];let i=di(e),n=Oe(t,new Set(i)),a=new Set(k);return i.filter((l)=>{if(a.has(l))return!1;if(At(t,l))return!1;return n.has(l)})}var io="stx: types for the declared client payload (#1868)",kl="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",oo="__stxServerScope",ao="__StxClientPayload";var co=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","$native","props","slot"];var Rl=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function Cl(e){let t=new Map,i=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let n of e){let a=r(n),{depths:l,balanced:c}=me(a);if(!c)continue;let b=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let v of a.matchAll(b)){let E=v.index??0;if(l[E+v[1].length]!==0)continue;let A=v[2],O=E+v[0].length-v[3].length,H=n.slice(O,E+v[0].length).trim().replace(/;$/,"").trim(),j=v[3],P=i.test(j)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(j)&&!/[,+\-*/%&|?:=]$/.test(H)&&me(j).balanced;t.set(A,t.has(A)||!P?null:H)}}return new Map([...t].filter((n)=>n[1]!==null))}function bo(e,t,i=0,n=new Set){if(t.size===0||i>=5)return e;let a=r(e),l="",c=0;for(let b of a.matchAll(/[A-Za-z_$][\w$]*/g)){let v=b.index??0,E=b[0],A=t.get(E);if(!A||n.has(E))continue;let O=a.slice(0,v).trimEnd(),H=a.slice(v+E.length).trimStart();if(O.endsWith(".")||/^:(?!:)/.test(H)&&/[{,]$/.test(O))continue;if(v>0&&/[\w$]/.test(a[v-1]))continue;l+=`${e.slice(c,v)}(${bo(A,t,i+1,new Set([...n,E]))})`,c=v+E.length}return l+e.slice(c)}function Al(e,t){let i=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,n=[],a;while((a=i.exec(e))!==null){if(a.index>t)break;let l=a[1];if(a.index===t){if(l==="elseif"){let b=n[n.length-1];if(b?.current)b.seen.push(b.current);if(b)b.current=null}break}if(l==="endif"||l==="endunless"){n.pop();continue}let c="";if(a[2]==="("){let b=0,v=a.index+a[0].length-1,E=v+1;for(;v<e.length;v++){let A=e[v];if(A==="(")b++;else if(A===")"){if(b--,b===0)break}}c=e.slice(E,v).trim(),i.lastIndex=v+1}if(l==="if")n.push({seen:[],current:c});else if(l==="unless")n.push({seen:[],current:`!(${c})`});else if(l==="elseif"||l==="else"){let b=n[n.length-1];if(!b)continue;if(b.current)b.seen.push(b.current);b.current=l==="elseif"?c:null}}return n.flatMap((l)=>[...l.seen.map((c)=>`!(${c})`),...l.current?[l.current]:[]]).filter(Boolean)}function Tl(e){let t=e.code.trim();if(!t)return null;if(e.attribute?.startsWith("@")){if(Rl.test(t))return null;let n=";(($event: any): void => { ";return{text:`${n}${t} });`,prefixLength:n.length}}let i=";void ((";return{text:`${i}${t}));`,prefixLength:i.length}}var Il=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function lo(e,t){return js(e,t).code}function js(e,t){let i=new Map;if(!t)return{code:e,columns:i};let n=yo(e),a=[],l=0;for(let c of e.matchAll(Il)){let b=c.index,[v,E,A,O]=c,H=uo.resolve(t,O).replace(/\\/g,"/"),j=`${E}${A}${H}${A}`;if(a.push(e.slice(l,b),j),l=b+v.length,v.includes(`
|
|
547
|
+
`))continue;let P=Ks(n,b),B=i.get(P.line)??[],L=B.at(-1),F=P.column+(L?L.generatedEnd-L.sourceEnd:0);B.push({sourceStart:P.column,sourceEnd:P.column+v.length,generatedStart:F,generatedEnd:F+j.length}),i.set(P.line,B)}return a.push(e.slice(l)),{code:a.join(""),columns:i}}function Pl(e,t,i){let n=so(e.importColumns?.get(t)??[],i);return so(e.scriptColumns?.get(t)??[],n)}function pi(e){return" ".repeat(Math.max(0,(e.startColumn??1)-1))}function Ol(e){let t=new Set,i=r(e);for(let n of i.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let a=n[1],l=/\{([^}]*)\}/.exec(a);for(let E of l?.[1].split(",")??[]){let A=E.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(A&&/^[A-Z_$][\w$]*$/i.test(A))t.add(A)}let c=a.replace(/\{[^}]*\}/,""),b=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(c);if(b)t.add(b[1]);let v=/^\s*([A-Z_$][\w$]*)/i.exec(c);if(v&&v[1]!=="type")t.add(v[1])}return[...t].sort()}function Lc(e,t={}){let i=It(e),n=e.split(`
|
|
548
|
+
`),a=Array.from({length:n.length},()=>""),l=new Map,c=new Map,b=new Map,v=[],E=i.filter((B)=>B.kind==="server").map((B)=>B.code).join(`
|
|
549
|
+
`),A=t.filePath&&t.templateExpressions!==!1?Qi(e,Hn(e),{filePath:t.filePath,componentsDir:t.componentsDir,projectRoot:t.projectRoot,readComponent:t.readComponent,scriptCode:(B,L)=>It(B).map((F)=>lo(F.code,uo.dirname(L))).join(`
|
|
550
|
+
`)}):void 0,O=new Set,H=[];for(let[B,L]of i.entries()){let F=ui(pi(L)+L.code,E,String(B));for(let[ne,te]of F.columns)c.set(L.startLine+ne-1,te);for(let ne of F.declarations)v.push({text:lo(ne.text,t.originDir??""),origin:ne.origin?{...ne.origin,line:ne.origin.line+L.startLine-1}:void 0});let G=Ls(F.code),D=js(G,t.originDir??"");for(let[ne,te]of D.columns)b.set(L.startLine+ne-1,te);let ee=D.code.split(`
|
|
551
|
+
`);ee.forEach((ne,te)=>{let le=L.startLine-1+te;if(le<a.length)a[le]=ne,O.add(le)}),H.push(L.startLine-1+ee.length-1)}for(let B of H){let L=a[B]?.trim()===""?B:B+1;if(L<a.length&&a[L].trim()===""&&(L===B||!O.has(L)))a[L]=";"}let j=(B,L)=>{for(let[F,G]of B.split(`
|
|
552
|
+
`).entries())if(a.push(G),L)l.set(a.length,F===0?L:{...L,line:L.line+F,column:1,prefixLength:0})};for(let B of v)j(B.text,B.origin);if(t.globals!==!1){j("");let B=new Set([...i.flatMap((D)=>De(D.code)),...i.flatMap((D)=>Ol(D.code))]),L=(D)=>{if(!B.has(D))j(`declare var ${D}: any`)};if(t.runtimeGlobals!==!1){if(!B.has("window"))j("declare var window: any");for(let D of k)L(D)}let F=[...new Set([...Zs,...Se,...co])].filter((D)=>t.runtimeGlobals!==!1||!k.includes(D));if(t.contextScope==="global"){j("declare global {");for(let D of F)j(` var ${D}: any`);j("}")}else{for(let D of Zs)L(D);for(let D of Se)L(D);for(let D of co)L(D)}j(`declare var ${Ts}: any`);let G=new Set(i.flatMap((D)=>De(D.code)));j(`type ${to}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let D of Sl(e)){if(G.has(D.name))continue;let ee=D.iterable&&G.has(D.iterable)?`${to}<typeof ${D.iterable}>`:"any";j(`declare var ${D.name}: ${ee}`)}}if(t.templateExpressions!==!1){if(A?.declarations)for(let L of A.declarations.split(`
|
|
553
|
+
`))j(L);let B=eg(e).map((L)=>{let F=A?.events.get(L.offset??-1);if(F){L.anchor=!0;let G=L.code.trim(),D=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(G),ee=D?`void ((${D[2]}) satisfies __StxAssignedValue<typeof ${D[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(G)?`${G} satisfies (($event: ${F}) => unknown)`:G,ne=`;(($event: ${F}): void => { `;return{expression:L,statement:{text:`${ne}${ee} });`,prefixLength:ne.length}}}return{expression:L,statement:Tl(L)}}).filter((L)=>L.statement!==null);if(B.push(...A?.checks||[]),B.length>0){let L=Hn(e),F=Vn(L),G=Cl(i.map((te)=>te.code)),ee=[...new Set(i.flatMap((te)=>De(te.code)))].filter((te)=>/^[A-Z_$][\w$]*$/i.test(te)),ne=0;if(ee.length>0){j(hl);for(let te of ee)j(`function __StxRead_${te}() { return ${te} }`),j(`type __StxT_${te} = ${go}<ReturnType<typeof __StxRead_${te}>>`);j(`;((${ee.map((te)=>`${te}: __StxT_${te}`).join(", ")}) => {`),ne=1}for(let{expression:te,statement:le}of B){let he=" ".repeat(ne),ue=te.offset===void 0?[]:F.filter((Xe)=>te.offset>=Xe.start&&te.offset<Xe.end),Ee=ue.map((Xe)=>`;((${Xe.binding.replace(/[\r\n]/g," ")}: any) => { `).join(""),Ae=" });".repeat(ue.length),We=te.offset===void 0?[]:Al(L,te.offset),Ke=We.length>0?`${We.map((Xe)=>`if (${bo(Xe,G)}) `).join("")}{ `:"",Ye=We.length>0?" }":"";j(he+Ee+Ke+le.text+Ye+Ae,{line:te.line,column:te.column,expression:te,prefixLength:le.prefixLength+he.length+Ee.length+Ke.length,guardPrefixLength:he.length+Ee.length+Ke.length})}if(ne>0)j("});")}}let P=!1;if(t.reference&&a[0]!==void 0&&a[0].trim()==="")a[0]=`/// <reference path=${JSON.stringify(t.reference.replace(/\\/g,"/"))} />`,P=!0;return j("export {}"),{text:a.join(`
|
|
554
|
+
`),lineMap:l,sourceLineCount:n.length,componentDependencies:A?.dependencies,referenced:P,scriptColumns:c,importColumns:b}}function yo(e){let t=[0];for(let i=0;i<e.length;i++)if(e.charCodeAt(i)===10)t.push(i+1);return t}function Ks(e,t){let i=0,n=e.length-1;while(i<n){let a=Math.ceil((i+n)/2);if(e[a]<=t)i=a;else n=a-1}return{line:i+1,column:t-e[i]+1}}function jc(e,t){if(!e.expression)return!1;return e.inGuard===!0||t===2774}function fi(e,t,i){let n=e.lineMap.get(t);if(!n)return t<=e.sourceLineCount?{line:t,column:Pl(e,t,i)}:null;let a=n.expression?.anchor?0:Math.max(0,i-1-(n.prefixLength??0));return{line:n.line,column:n.column+a,expression:n.expression,inGuard:i<=(n.guardPrefixLength??0)}}var Xs=w(256),Ml=[{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"}],_o=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function jl(e){let t=Array.from(e,(a)=>a===`
|
|
555
555
|
`?`
|
|
556
556
|
`:" "),i=0,n="";while(i<e.length){let a=e[i],l=e[i+1];if(n){if(a==="\\"){i+=2;continue}if(a===n)n="";i++;continue}if(a==='"'||a==="'"||a==="`"){n=a,i++;continue}if(a==="/"&&l==="/"){while(i<e.length&&e[i]!==`
|
|
557
557
|
`)t[i]=e[i],i++;continue}if(a==="/"&&l==="*"){let c=e.indexOf("*/",i+2),b=c===-1?e.length:c+2;for(;i<b;i++)t[i]=e[i];continue}if(a==="{"&&l==="{"&&e.slice(i,i+4)==="{{--"){let c=e.indexOf("--}}",i+4),b=c===-1?e.length:c+4;for(;i<b;i++)t[i]=e[i];continue}i++}return t.join("")}function Dl(e){let t=new Map,i=jl(e).split(`
|
|
558
558
|
`),n=e.split(`
|
|
559
|
-
`);return i.forEach((a,l)=>{_o.lastIndex=0;for(let c of a.matchAll(_o)){let b=c[1]==="-next-line",v=(n[l]??"").slice(0,c.index).trim(),E=b||v===""?l+2:l+1,
|
|
559
|
+
`);return i.forEach((a,l)=>{_o.lastIndex=0;for(let c of a.matchAll(_o)){let b=c[1]==="-next-line",v=(n[l]??"").slice(0,c.index).trim(),E=b||v===""?l+2:l+1,O=(c[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),H=O.filter((P)=>/\w/.test(P));if(O.length>0&&H.length===0)continue;let j=t.get(E);if(j&&j.size===0)continue;if(H.length===0){t.set(E,new Set);continue}if(j)H.forEach((P)=>j.add(P));else t.set(E,new Set(H))}}),t}function Nl(e,t,i){let n=e.get(t);if(!n)return!1;if(n.size===0)return!0;return[...n].some((a)=>i.includes(a))}function Ne(e,t,i,n){let a=typeof i==="boolean"?{enabled:i,failOnViolation:i}:i??{enabled:!1};if(!a.enabled)return;let l=S(e,t,n,JSON.stringify(a)),c=Xs.get(l);if(c!==void 0){if(c&&a.failOnViolation)throw new K(c,n??t);return}let b=a.allowPatterns??[],v=Dl(e),E=[],A=r(e.replace(/\{\{--[\s\S]*?--\}\}/g,(P)=>P.replace(/[^\n]/g," ")));for(let{pattern:P,message:B,suggestion:L}of Ml){if(b.some((G)=>/\w/.test(G)&&B.includes(G)))continue;P.lastIndex=0;let F=A.match(P);if(F&&F.length>0){let G=A.split(`
|
|
560
560
|
`),D=e.split(`
|
|
561
|
-
`),ee=[];if(
|
|
561
|
+
`),ee=[];if(G.forEach((he,ue)=>{if(P.lastIndex=0,P.test(he)&&!Nl(v,ue+1,B))ee.push(ue+1)}),ee.length===0&&G.some((he)=>(P.lastIndex=0,P.test(he))))continue;let ne=ee.length>0?` (script line${ee.length>1?"s":""} ${ee.join(", ")})`:"",te=ee.slice(0,3).map((he)=>` ${he} | ${(D[he-1]??"").trim().slice(0,100)}`).join(`
|
|
562
562
|
`),le=te?`
|
|
563
|
-
${te}`:"";E.push(` \u2717 ${
|
|
564
|
-
\u2192 ${L}${le}`)}}if(E.length===0){Xs.set(l,"");return}let
|
|
563
|
+
${te}`:"";E.push(` \u2717 ${B}${ne}
|
|
564
|
+
\u2192 ${L}${le}`)}}if(E.length===0){Xs.set(l,"");return}let O=(P)=>{let B=`${process.cwd()}/`;return P.startsWith(B)?P.slice(B.length):P},j=`[STX] DOM API violation in ${n&&n!==t?`${O(n)} (composed into ${O(t)})`:O(t)}:
|
|
565
565
|
${E.join(`
|
|
566
566
|
`)}
|
|
567
|
-
Tip: prefer useRef(), navigate(), and composables for component code`;if(Xs.set(l,j),console.warn(j),a.failOnViolation)throw new
|
|
568
|
-
`);return{line:i.length,column:i[i.length-1].length+1}}function
|
|
569
|
-
`)a++;return!0}if(e[a]==="/"&&e[a+1]==="*"){a+=2;while(a<l-1&&!(e[a]==="*"&&e[a+1]==="/"))a++;return a+=2,!0}return!1},E=new Set(["return","typeof","instanceof","in","of","new","delete","void","throw","case","do","else","yield","await"]),A=()=>{let j=a-1;while(j>=0&&/\s/.test(e[j]))j--;if(j<0)return!0;let
|
|
570
|
-
`){let
|
|
567
|
+
Tip: prefer useRef(), navigate(), and composables for component code`;if(Xs.set(l,j),console.warn(j),a.failOnViolation)throw new K(j,n??t)}var Ll=[{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"}],zl=[{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')"}],Bl=[{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 ug(e){let t=[],i=[];return Wl(e,t),Fl(e,t,i),Vl(e,i),Ul(e,t),{valid:t.length===0,errors:t,warnings:i}}function Wl(e,t){let i=(e.match(/\{\{/g)||[]).length,n=(e.match(/\}\}/g)||[]).length;if(i!==n)t.push({type:"expression",message:`Unclosed expression brackets: found ${i} opening '{{' and ${n} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function Fl(e,t,i){for(let n of Ll){let a=new RegExp(`${n.open}(?:\\s|\\()`,"g"),l=new RegExp(n.close,"g"),c=(e.match(a)||[]).length,b=(e.match(l)||[]).length;if(n.altClose){let v=new RegExp(n.altClose,"g");b+=(e.match(v)||[]).length}if(c>b)t.push({type:"directive",message:`Unclosed @${n.name} directive: found ${c} opening and ${b} closing`,suggestion:`Add ${c-b} missing ${n.close} tag(s)`});else if(b>c)i.push({type:"directive",message:`Extra ${n.close} found: ${b-c} more closing than opening`,suggestion:`Check for orphaned ${n.close} tags`})}}function Vl(e,t){for(let i of zl)if(i.pattern.test(e))t.push({type:"syntax",message:i.message,suggestion:i.suggestion})}function Ul(e,t){for(let i of Bl)if(i.pattern.test(e))t.push({type:"expression",message:`Security warning: ${i.message}`,suggestion:"Remove dangerous code from template expressions"})}function dg(e,t){let i=e.slice(0,t).split(`
|
|
568
|
+
`);return{line:i.length,column:i[i.length-1].length+1}}function pg(e,t,i){let n=[];switch(e){case"if":case"elseif":case"unless":if(i.length===0)n.push({type:"syntax",message:`@${e} requires a condition`,suggestion:`Use @${e}(condition)`});break;case"foreach":if(i.length===0||!i[0].includes(" as "))n.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(i.length===0)n.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(i.length===0)n.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(i.length===0)n.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(i.length===0)n.push({type:"syntax",message:`@${e} requires a path`,suggestion:`Use @${e}('path/to/template')`});break}return n}function fg(e){return/@[a-z]+/i.test(e)||/\{\{/.test(e)}function gg(e){let t=e.matchAll(/@([a-z]+)/gi),i=new Set;for(let n of t){let a=n[1].toLowerCase();if(!a.startsWith("end"))i.add(a)}return Array.from(i)}function wo(e,t,i){let n=/^<script\b([^>]*)>/i.exec(e);if(!n||!/(?:^|\s)src\s*=/i.test(n[1]??""))return null;return _(n[0],t,i)+e.slice(n[0].length)}var tn=new T(500),er=new Map;function So(e){try{let t=Jn.statSync(e);return`${t.size}:${t.mtimeMs}`}catch{return""}}var Kn=new T(1000),tr=new T(2000),nr=new T(500),Io=33554432,sr=Io;function Hl(e){let t=e.componentRenderCacheBytes;if(typeof t!=="number"||t<0||t===sr)return;sr=t,Xn.setMaxBytes(t)}var Xn=new T(2000,{maxBytes:Io,sizeOf:(e)=>e.output.length});function ql(e){let t=new WeakSet;try{let i=(n)=>{if(n===void 0)return{__stxType:"undefined"};if(typeof n==="bigint")return{__stxType:"bigint",value:n.toString()};if(typeof n==="function"||typeof n==="symbol")throw TypeError("Non-serializable component input");if(n===null||typeof n!=="object")return n;if(t.has(n))throw TypeError("Circular component input");t.add(n);try{if(n instanceof Date)return{__stxType:"date",value:n.toISOString()};if(Array.isArray(n))return n.map(i);let a=Object.getPrototypeOf(n);if(a!==Object.prototype&&a!==null)throw TypeError("Non-plain component input");let l={};for(let c of Object.keys(n).sort())l[c]=i(n[c]);return l}finally{t.delete(n)}};return JSON.stringify(i(e))}catch{return null}}function Zl(e){let t={};for(let[i,n]of Object.entries(e))if(!i.startsWith("__")||i==="__stxServeContext")t[i]=n;return t}function Gs(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Vs(e){let t=process.cwd(),i=`${t}\x00${e}`,n=$o.get(i);if(n===void 0)n=Bun.hash(Po(e,t).split(ae.sep).join("/")).toString(36).slice(0,6),$o.set(i,n);return n}var $o=new Map;function Po(e,t){if(!ae.isAbsolute(e))return e;let i=(n)=>{try{return Jn.realpathSync(n)}catch{return n}};return ae.relative(i(t),i(e))}function mg(e){return/\bjs\b/.test(e)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(e)}function Be(e){return!mg(e)}var Zn=new Map;function Z(e){let t;try{t=JSON.stringify(e)}catch{return new Bun.Transpiler(e)}let i=Zn.get(t);if(i)return i;if(Zn.size>=16)Zn.clear();let n=new Bun.Transpiler(e);return Zn.set(t,n),n}var vo=new WeakMap,Kl=256;function Fe(e){try{let t=Z({loader:"ts",target:"browser",define:C()}),i=vo.get(t);if(!i)i=new Map,vo.set(t,i);let n=i.get(e);if(n!==void 0)return n;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 l=[];a=a.replace(/\{!![\s\S]*?!!\}/g,(b)=>{let v=l.length;return l.push(b),`"__STX_EXPR_${v}__"`}),a=a.replace(/\{\{\{[\s\S]*?\}\}\}/g,(b)=>{let v=l.length;return l.push(b),`"__STX_EXPR_${v}__"`}),a=a.replace(/\{\{[\s\S]*?\}\}/g,(b)=>{let v=l.length;return l.push(b),`"__STX_EXPR_${v}__"`});let c=t.transformSync(a);for(let b=0;b<l.length;b++)c=c.replace(`"__STX_EXPR_${b}__"`,l[b]),c=c.replace(`'__STX_EXPR_${b}__'`,l[b]);if(i.size>=Kl){let b=i.keys().next();if(!b.done)i.delete(b.value)}return i.set(e,c),c}catch(t){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",t);return e}}function Xl(e){let t=[],i=new Set,n=0,a=0,l=e.length,c=(j)=>{a++;while(a<l){if(e[a]==="\\"){a+=2;continue}if(e[a]===j){a++;return}a++}},b=()=>{a++;while(a<l){if(e[a]==="\\"){a+=2;continue}if(e[a]==="`"){a++;return}if(e[a]==="$"&&e[a+1]==="{"){a+=2;let j=1;while(a<l&&j>0)if(e[a]==="{")j++,a++;else if(e[a]==="}")j--,a++;else if(e[a]==="'"||e[a]==='"')c(e[a]);else if(e[a]==="`")b();else a++;continue}a++}},v=()=>{if(e[a]==="/"&&e[a+1]==="/"){while(a<l&&e[a]!==`
|
|
569
|
+
`)a++;return!0}if(e[a]==="/"&&e[a+1]==="*"){a+=2;while(a<l-1&&!(e[a]==="*"&&e[a+1]==="/"))a++;return a+=2,!0}return!1},E=new Set(["return","typeof","instanceof","in","of","new","delete","void","throw","case","do","else","yield","await"]),A=()=>{let j=a-1;while(j>=0&&/\s/.test(e[j]))j--;if(j<0)return!0;let P=e[j];if("(,=:[!&|?{};+-*%<>~^".includes(P))return!0;if(!/[\w$]/.test(P))return!1;let B=j;while(B>0&&/[\w$]/.test(e[B-1]))B--;return E.has(e.slice(B,j+1))},O=()=>{a++;let j=!1;while(a<l&&e[a]!==`
|
|
570
|
+
`){let P=e[a];if(P==="\\"){a+=2;continue}if(P==="[")j=!0;else if(P==="]")j=!1;else if(P==="/"&&!j){a++;while(a<l&&/[a-z]/i.test(e[a]))a++;return}a++}},H=()=>{if(n!==0)return;let j=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(j){let F=j[2].split(",").map((G)=>{let D=G.trim().split(":");return D[D.length-1].trim()});for(let G of F)if(G&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(G)&&!i.has(G))t.push(G),i.add(G);return}let P=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(P){let F=P[2];if(!i.has(F))t.push(F),i.add(F);return}let B=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let F=B[1];if(!i.has(F))t.push(F),i.add(F);return}let L=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let F=L[1];if(!i.has(F))t.push(F),i.add(F)}};while(a<l){if(v())continue;if(e[a]==="'"||e[a]==='"'){c(e[a]);continue}if(e[a]==="`"){b();continue}if(e[a]==="/"&&A()){O();continue}if(e[a]==="{"){n++,a++;continue}if(e[a]==="}"){n--,a++;continue}if(n===0&&/[a-z]/i.test(e[a])&&(a===0||/\s|[;{}()]/.test(e[a-1])))H();a++}return t}function Jl(e){let t=[],i=0,n=0,a=null;for(let l=0;l<e.length;l++){let c=e[l];if(a){if(c==="\\"){l++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="("||c==="["||c==="{")i++;else if(c===")"||c==="]"||c==="}")i--;else if(c===","&&i===0)t.push(e.slice(n,l)),n=l+1}if(n<e.length)t.push(e.slice(n));return t}function Gl(e){let t=0,i=null;for(let n=0;n<e.length;n++){let a=e[n];if(i){if(a==="\\"){n++;continue}if(a===i)i=null;continue}if(a==='"'||a==="'"||a==="`"){i=a;continue}if(a==="("||a==="["||a==="{")t++;else if(a===")"||a==="]"||a==="}")t--;else if(a==="="&&t===0){let l=e[n-1],c=e[n+1];if(l==="!"||l==="<"||l===">"||l==="=")continue;if(c==="="||c===">")continue;return n}}return-1}function Yl(e,t){try{let i=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!i)return;let n=i.index-1;while(n>=0&&/\s/.test(e[n]))n--;if(e[n]!=="}")return;let a=n,l=0,c=-1;for(;n>=0;n--){let v=e[n];if(v==="}")l++;else if(v==="{"){if(l--,l===0){c=n;break}}}if(c===-1)return;let b=e.slice(c+1,a);for(let v of Jl(b)){let E=v.trim();if(!E||E.startsWith("..."))continue;let A=Gl(E);if(A===-1)continue;let O=E.slice(0,A).trim();if(!/^[A-Z_$][\w$]*$/i.test(O))continue;if(t[O]!==void 0)continue;let H=E.slice(A+1).trim();if(!H)continue;try{let j=Object.keys(t).filter(Bt),P=Function(...j,`"use strict"; return (${H});`);t[O]=P(...j.map((B)=>t[B]))}catch{}}}catch{}}var Ql=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function hg(e,t){let i=e.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!i)return null;let n=i[2].toLowerCase();if(!Ql.has(n))return null;let a=new RegExp(`<\\/?${n}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),l=y(e,(E,A)=>(a.lastIndex=A,a.exec(E)?.index===A?a.lastIndex:-1));if(n==="span"&&/\sdata-stx-scope\s*=/.test(l[0]?.token||""))return null;let c=0,b=!1;for(let E of l){if(c+=E.token.startsWith("</")?-1:1,c<0)return null;if(c===0){if(e.slice(E.end).trim())return null;b=!0;break}}if(!b)return null;let v=i[0].length;return e.slice(0,v)+t+e.slice(v)}function Oo(e,t){if(!e)return!1;return[...t.additionalComponentsDirs??[],...t.fallbackComponentsDir?[t.fallbackComponentsDir]:[]].some((n)=>{let a=ae.relative(ae.resolve(n),ae.resolve(e));return!a.startsWith("..")&&!ae.isAbsolute(a)})}async function Cr(e,t,i,n,a){let l=e.endsWith(".stx")?e.slice(0,-4):e,c=(te)=>te.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""),b=i.__importedComponents;if(b){for(let te of[l,l.toLowerCase(),c(l),U(l)])if(b.has(te))return!0}let v=[...new Set([`${l}.stx`,`${c(l)}.stx`,`${U(l)}.stx`])],E=typeof a.root==="string"?ae.resolve(a.root):void 0,A=E??ae.dirname(n),O=[],H=(te)=>{if(te&&!O.includes(te))O.push(te)};for(let te of us(n,E))H(te);let j=i.__originalFilePath;if(j)H(ae.join(ae.dirname(j),"components"));if(Oo(t,a))H(a._rootComponentsDir);H(t),H(a._rootComponentsDir),H(ae.join(ae.dirname(n),"components")),H(a.componentsDir);for(let te of a.additionalComponentsDirs??[])H(te);let P=a._targetComponentFallbackNames?.some((te)=>te.toLowerCase()===l.toLowerCase());if(!P)for(let te of a._targetComponentDirs??[])H(te);if(E)H(ae.resolve(E,"resources/views/components")),H(ae.resolve(E,"resources/components")),H(ae.resolve(E,"src/components")),H(ae.resolve(E,"components"));for(let te of a._layerComponentDirs??[])H(te);let B=a._pluginComponentDirs;if(Array.isArray(B))for(let te of B)H(typeof te==="string"?te:null);if(H(a.fallbackComponentsDir),P)for(let te of a._targetComponentDirs??[])H(te);let L=a._nativePrimitivesFallback;if(L&&!L.except.some((te)=>te.toLowerCase()===l.toLowerCase()))H(L.dir);if(l.startsWith("./")||l.startsWith("../"))return s(ae.resolve(ae.dirname(n),`${l}.stx`));let F=Eo(ae.resolve(import.meta.dir,"components")),G=O.map((te)=>ae.isAbsolute(te)?te:ae.resolve(A,te)),D=`${v.join("\x00")}\x00\x00${G.join("\x00")}`,ee=tr.get(D);if(ee!==void 0)return ee;let ne=!1;e:for(let te of G){if(Eo(te)===F)continue;for(let le of v)if(await s(ae.join(te,le))){ne=!0;break e}}return tr.set(D,ne),ne}function Eo(e){let t=nr.get(e);if(t!==void 0)return t;let i=e;try{i=Jn.realpathSync(e)}catch{}return nr.set(e,i),i}function yg(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function Yc(e){if(!e)return!1;let t=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(t)}function eu(e,t,i){if(!e.includes("{{")&&!e.includes("{!!"))return e;let n=(a,l)=>{let c;try{c=R(a,t)}catch{return l}if(c===void 0||c===null)return"";let b=String(c);if(/<\/style/i.test(b))return console.warn(`[stx] a <style> expression in ${i??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return b};return e.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>n(l,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,l)=>n(l,a))}var ko=new Set;function Ro(e,t,i,n){let a=`${e}\x00${t}\x00${n??""}`;if(!process.env.STX_DEBUG&&ko.has(a))return;ko.add(a);let l=t?` used in ${t}`:"",c=n?` Cause: ${n}.`:"",b=i.length>0?`
|
|
571
571
|
searched:
|
|
572
572
|
${i.map((v)=>` - ${v}`).join(`
|
|
573
|
-
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${c}${b}`)}function Co(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var tu=new Set(["for","if","show","key","ref","class","className","style"]),Ao=new Set,Mo="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",Yc=new RegExp(`\\b(?:${Mo})\\s*(?:<[^>]*>)?\\s*\\(`);function bi(e){let t=new Set,i=new RegExp(`\\b(?:const|let|var)\\s+([a-zA-Z_$][\\w$]*)\\s*=\\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue|${Mo})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let n of e){let a;while((a=i.exec(n))!==null)t.add(a[1]);i.lastIndex=0}return[...t]}async function Fe(e,t,i,n,a,l,c,b=new Set,v,E=rt(a),A,M=e){let{extractVariables:X}=await o("stx/variable-extractor",()=>import("./chunk-030tgwve.js")),j=b??new Set;if(j.has(e))return`[Circular component reference: ${e}]`;let I=new Set(j);I.add(e);let z=typeof t.client==="string"?t.client.trim():"";if("client"in t)delete t.client;let L=z&&z!=="load"&&mg(z)?z:"";try{let B=(re)=>re.split("-").map((ce)=>ce.charAt(0).toUpperCase()+ce.slice(1)).join(""),Q=M.endsWith(".stx")?M.slice(0,-4):M,D=null,ee=a.__importedComponents;if(ee){let re=[Q,Q.toLowerCase(),B(Q),V(Q)];for(let ce of re)if(ee.has(ce)){D=ee.get(ce);break}}let ne=[];if(!D){let re=[`${Q}.stx`,`${B(Q)}.stx`,`${V(Q)}.stx`],ce=[...new Set(re)],we=a.__originalFilePath,be=[];if(be.push(...c._layerComponentDirs??[]),we){let ye=ae.join(ae.dirname(we),"components");be.push(ye)}let He=c._rootComponentsDir;if(typeof He==="string"&&Oo(n,c)&&!be.includes(He))be.push(He);if(n&&!be.includes(n))be.push(n);if(typeof He==="string"&&!be.includes(He))be.push(He);let Te=ae.join(ae.dirname(l),"components");if(!be.includes(Te))be.push(Te);if(c.componentsDir&&c.componentsDir!==n&&!be.includes(c.componentsDir))be.push(c.componentsDir);for(let ye of c.additionalComponentsDirs??[])if(ye&&!be.includes(ye))be.push(ye);let ft=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(Q),pt=(A?.events??[]).map((ye)=>ye.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),yt=Object.hasOwn(t,"checked")||Boolean(A?.reactiveProps?.includes("checked")),ss=Object.hasOwn(t,"value")||Boolean(A?.reactiveProps?.includes("value")),rs=!pt.includes("valuechange")&&(yt||pt.includes("change")&&!ss),mt=c._nativeHostAttrs&&/^textinput$/i.test(Q),_t=pt.includes("update:value")&&!pt.includes("input"),qt=c._nativeHostAttrs&&/^video$/i.test(Q),is=c._nativeHostAttrs&&/^image$/i.test(Q),ln=Ms([...Object.keys(t),...A?.reactiveProps??[]],A?.events,t),wt=Object.hasOwn(t,"src")||Boolean(A?.reactiveProps?.includes("src")),un=Object.hasOwn(t,"source")||Boolean(A?.reactiveProps?.includes("source")),_n=qt&&(wt||un)&&(A?.events??[]).every((ye)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(ye.replace(/^@/,"").split(".")[0])),Sn=new Set(["","primary","secondary","outline","ghost","danger"]),$n=typeof t.variant==="string"?t.variant.trim().toLowerCase():"",En=c._nativeHostAttrs&&/^button$/i.test(Q)&&!Sn.has($n),ur=c._targetComponentFallbackNames?.some((ye)=>ye.toLowerCase()===Q.toLowerCase())&&(!ft||rs)&&(!mt||_t)&&(!qt||_n)&&(!is||ln)&&!En;for(let ye of ur?[]:c._targetComponentDirs??[])if(ye&&!be.includes(ye))be.push(ye);let St=typeof c.root==="string"?ae.resolve(c.root):void 0,Ko=St??ae.dirname(l),$t=[];if(St)$t.push(ae.resolve(St,"resources/views/components")),$t.push(ae.resolve(St,"resources/components")),$t.push(ae.resolve(St,"src/components")),$t.push(ae.resolve(St,"components"));$t.push(ae.resolve(import.meta.dir,"components"));for(let ye of $t)if(!be.includes(ye))be.push(ye);let fr=c._pluginComponentDirs;if(Array.isArray(fr)){for(let ye of fr)if(typeof ye==="string"&&!be.includes(ye))be.push(ye)}if(c.fallbackComponentsDir&&!be.includes(c.fallbackComponentsDir))be.push(c.fallbackComponentsDir);if(ur){for(let ye of c._targetComponentDirs??[])if(ye&&!be.includes(ye))be.push(ye)}let kn=c._nativePrimitivesFallback;if(kn&&!kn.except.some((ye)=>ye.toLowerCase()===Q.toLowerCase())&&!be.includes(kn.dir))be.push(kn.dir);let pr=[...new Set(be.map((ye)=>{if(!ye)return ye;return ae.isAbsolute(ye)?ye:ae.resolve(Ko,ye)}))];be.length=0,be.push(...pr);let os=`${Q}\x00${l}\x00${pr.join("\x00")}`,as=Kn.get(os);if(as)if(await s(as))D=as;else Kn.delete(os);if(!D&&(Q.startsWith("./")||Q.startsWith("../")))D=ae.resolve(ae.dirname(l),`${Q}.stx`),ne.push(D);else if(!D)for(let ye of be){if(!ye)continue;for(let Rn of ce){let Cn=ae.join(ye,Rn);if(ne.push(Cn),await s(Cn)){D=Cn;break}}if(D)break;if(!D)try{let Rn=await import("fs");if(!Rn.statSync(ye,{throwIfNoEntry:!1})?.isDirectory())continue;let Xo=8,cs=[{path:ye,depth:0}];while(cs.length>0&&!D){let An=cs.pop();if(An.depth>=Xo)continue;let dr;try{dr=Rn.readdirSync(An.path,{withFileTypes:!0})}catch{continue}for(let Tn of dr){if(!Tn.isDirectory())continue;if(Tn.name==="node_modules"||Tn.name.startsWith("."))continue;let gr=ae.join(An.path,Tn.name);for(let Jo of ce){let ls=ae.join(gr,Jo);if(ne.push(ls),await s(ls)){D=ls;break}}if(D)break;cs.push({path:gr,depth:An.depth+1})}}}catch{}if(D)break}if(D)Kn.set(os,D)}if(!D||!await s(D))return Ro(e,l,ne),Co(e);v.add(D);let te;if(tn.has(D)&&er.get(D)===So(D))te=tn.get(D);else try{let re=So(D);te=await Bun.file(D).text(),tn.set(D,te),er.set(D,re)}catch(re){let ce=re instanceof Error?re.message:String(re);return Ro(e,l,[D],ce),Co(e)}if(A)for(let re of new Set([...Object.keys(t),...A.reactiveProps??[]])){let ce=re.toLowerCase();if(ce.startsWith("aria-")||ce.startsWith("data-"))continue;let we=re.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${we}\\b`).test(te))A.declaredProps.add(re);if(new RegExp(`\\$props\\s*(?:\\.\\s*${we}\\b|\\[\\s*['"]${we}['"]\\s*\\])`).test(te)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${we}['"]`).test(te))A.consumedProps?.add(re)}if(A?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(te))for(let re of A.reactiveProps){if(tu.has(re)||A.consumedProps?.has(re))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${re.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(te))continue;let ce=`${D}\x00${re}`;if(Ao.has(ce))continue;Ao.add(ce),console.warn(`[stx] ${ae.basename(D)} reads \`${re}\` with defineProps(), which is not live, but ${ae.basename(l)} binds it (:${re}): the value can arrive empty or stale (on a native screen, and for a :for's rows, it does not arrive at all). Read it with useReactiveProp('${re}').`)}let le=new Set(["__originalFilePath","__importedComponents",Dn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),he={};for(let[re,ce]of Object.entries(a))if(!re.startsWith("__")||le.has(re))he[re]=ce;let ue=E.length>0?{[Fn]:[...E]}:{},Re=i;if(i.includes("@include")){let{processIncludes:re}=await o("stx/includes",()=>import("./chunk-7mw1yc6j.js"));Re=await re(i,a,l,c,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Re)){let{processComponents:re}=await o("stx/component-renderer",()=>import("./chunk-3bny2583.js")),ce={...a,__processedComponents:j,...ue};Re=await re(Re,ce,l,c,v);let we=ce.__stx_preserved_client_expressions;if(Array.isArray(we)&&we.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...we])]}let Ae=[];if(Jc(Re)){let{processExpressions:re}=await o("stx/expressions",()=>import("./chunk-3e7t4qzd.js")),ce=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...ue}:E.length>0?{...a,...ue}:a;Re=re(Re,ce,l);for(let we of Re.matchAll(/\{\{([\s\S]*?)\}\}/g))Ae.push(we[1].trim())}let Ue=G(Re),Ke=[],Ye=Ue.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(re,ce)=>{let we=Ue.scripts[Number(ce)]||"",be=we.match(/^<script\b([^>]*)>/i)?.[1]||"",He=be.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Te=!He||["module","text/javascript","application/javascript"].includes(He),ft=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${be}`);if(!/\bserver\b/i.test(be)&&Te&&!ft)return Ke.push(we),"";return we}),{extractSlotContent:Xe}=await o("stx/slots",()=>import("./chunk-1qwb0pyb.js")),et=Xe(Ye),Je={};if(et.defaultSlot?.trim())Je.default=et.defaultSlot;for(let[re,ce]of et.namedSlots)Je[re]=ce.content;let gt=a.__stx_scope_seq??={n:0,key:Vs(String(a.__filename??l))},Tt=Po(e,process.cwd()),it=`stx_${(Tt.endsWith(".stx")?Tt.slice(0,-4):Tt).replace(/[^a-zA-Z0-9]/g,"_")}_${++gt.n}_${gt.key}`,We={...he,$uid:it,$native:c._nativeHostAttrs===!0,...t,props:t,slot:Ye,$slots:Je,__processedComponents:I,__sections:{},__stx_signals_gate:Se(te)||Jc(i),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Ae]};if(/import\s/.test(te)){We.__importedComponents=new Map(We.__importedComponents);let{processESImports:re}=await o("stx/component-renderer",()=>import("./chunk-3bny2583.js"));te=await re(te,We,D,c,v)}Yl(te,We);let Dt=te,sn=de(Dt);if(sn)Dt=sn.content.trim();let Yn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Lt=[...te.matchAll(Yn)];for(let[,re,ce]of Lt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(re))Oe(ce,D,c.strict);let Ge=[],zt=null,Qn=Lt.some((re)=>/\bserver\b/.test(re[1]||"")&&/\bcache\b/.test(re[1]||"")),bt=null,ot=null,Bt=null,rn=0,Wt=null;if(Hl(c),Qn&&sr>0){let re=ql({props:t,slot:Re,slotContext:i.trim()?Zl(he):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...E].sort(),layers:c._layerGraph?.layers.map((ce)=>ce.configFile),uid:it});if(re!==null){bt=`${D}\x00${S(te)}\x00${re}`;let ce=Xn.get(bt);if(ce){for(let we of ce.dependencies)v.add(we);if(ti(a,ce.clientFactories),gt.n+=ce.uidsConsumed,ce.preservedClientExpressions.length>0){let we=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let be of ce.preservedClientExpressions)we.add(be);a.__stx_preserved_client_expressions=[...we]}return ce.output}ot=new Set(v),Bt=Qr(a),rn=gt.n,Wt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Ft=new Set;for(let re of Lt){let ce=re[1]||"",we=re[2]||"",be=ce.includes("server");if(je(ce)&&we.trim())we=Be(we);if(be&&we){for(let Te of Me(we))Ft.add(Te);try{await X(we,We,D,{onFailure:(Te)=>{if(Te.kind!=="unknown")zt=Te.kind}})}catch(Te){}}if(!be){let Te=we.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),ft=Te.includes("{{")&&Te.includes("}}"),pt=Te.includes("{!!")&&Te.includes("!!}");if(ft||pt)Te=vi(Te,We,D);let yt=ce.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Ge.push(`<script${yt}>${Te}</script>`)}}let Qe=G(te).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Vt=Qe?Qe[1]:"",es=Qe?Qe[2]:"",ct="",se=Vt&&/\bscoped\b/i.test(Vt);if(Qe)ct=`<style${Vt}>${eu(es,We,D)}</style>`;let ie=Dt;if(ie=ie.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Qe)ie=ie.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let re=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ce=[];if(ie=ie.replace(re,(we,be)=>{let He=be.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(He)ce.push(`<style${He[1]}>${He[2]}</style>`);return""}),ie=ie.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ce.length>0)ct=`${ct}${ce.join(`
|
|
574
|
-
`)}`}if(i&&
|
|
573
|
+
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${c}${b}`)}function Co(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var tu=new Set(["for","if","show","key","ref","class","className","style"]),Ao=new Set,Mo="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",Zc=new RegExp(`\\b(?:${Mo})\\s*(?:<[^>]*>)?\\s*\\(`);function wi(e){let t=new Set,i=new RegExp(`\\b(?:const|let|var)\\s+([a-zA-Z_$][\\w$]*)\\s*=\\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue|${Mo})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let n of e){let a;while((a=i.exec(n))!==null)t.add(a[1]);i.lastIndex=0}return[...t]}async function ze(e,t,i,n,a,l,c,b=new Set,v,E=st(a),A,O=e){let{extractVariables:H}=await o("stx/variable-extractor",()=>import("./chunk-bh7v78je.js")),j=b??new Set;if(j.has(e))return`[Circular component reference: ${e}]`;let P=new Set(j);P.add(e);let B=typeof t.client==="string"?t.client.trim():"";if("client"in t)delete t.client;let L=B&&B!=="load"&&yg(B)?B:"";try{let F=(re)=>re.split("-").map((ce)=>ce.charAt(0).toUpperCase()+ce.slice(1)).join(""),G=O.endsWith(".stx")?O.slice(0,-4):O,D=null,ee=a.__importedComponents;if(ee){let re=[G,G.toLowerCase(),F(G),U(G)];for(let ce of re)if(ee.has(ce)){D=ee.get(ce);break}}let ne=[];if(!D){let re=[`${G}.stx`,`${F(G)}.stx`,`${U(G)}.stx`],ce=[...new Set(re)],_e=a.__originalFilePath,be=[];if(be.push(...c._layerComponentDirs??[]),_e){let ye=ae.join(ae.dirname(_e),"components");be.push(ye)}let Ve=c._rootComponentsDir;if(typeof Ve==="string"&&Oo(n,c)&&!be.includes(Ve))be.push(Ve);if(n&&!be.includes(n))be.push(n);if(typeof Ve==="string"&&!be.includes(Ve))be.push(Ve);let Te=ae.join(ae.dirname(l),"components");if(!be.includes(Te))be.push(Te);if(c.componentsDir&&c.componentsDir!==n&&!be.includes(c.componentsDir))be.push(c.componentsDir);for(let ye of c.additionalComponentsDirs??[])if(ye&&!be.includes(ye))be.push(ye);let ft=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(G),pt=(A?.events??[]).map((ye)=>ye.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),yt=Object.hasOwn(t,"checked")||Boolean(A?.reactiveProps?.includes("checked")),ss=Object.hasOwn(t,"value")||Boolean(A?.reactiveProps?.includes("value")),rs=!pt.includes("valuechange")&&(yt||pt.includes("change")&&!ss),mt=c._nativeHostAttrs&&/^textinput$/i.test(G),_t=pt.includes("update:value")&&!pt.includes("input"),qt=c._nativeHostAttrs&&/^video$/i.test(G),is=c._nativeHostAttrs&&/^image$/i.test(G),ln=Ms([...Object.keys(t),...A?.reactiveProps??[]],A?.events,t),wt=Object.hasOwn(t,"src")||Boolean(A?.reactiveProps?.includes("src")),un=Object.hasOwn(t,"source")||Boolean(A?.reactiveProps?.includes("source")),dn=qt&&(wt||un)&&(A?.events??[]).every((ye)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(ye.replace(/^@/,"").split(".")[0])),_n=new Set(["","primary","secondary","outline","ghost","danger"]),$n=typeof t.variant==="string"?t.variant.trim().toLowerCase():"",En=c._nativeHostAttrs&&/^button$/i.test(G)&&!_n.has($n),ur=c._targetComponentFallbackNames?.some((ye)=>ye.toLowerCase()===G.toLowerCase())&&(!ft||rs)&&(!mt||_t)&&(!qt||dn)&&(!is||ln)&&!En;for(let ye of ur?[]:c._targetComponentDirs??[])if(ye&&!be.includes(ye))be.push(ye);let St=typeof c.root==="string"?ae.resolve(c.root):void 0,Ko=St??ae.dirname(l),$t=[];if(St)$t.push(ae.resolve(St,"resources/views/components")),$t.push(ae.resolve(St,"resources/components")),$t.push(ae.resolve(St,"src/components")),$t.push(ae.resolve(St,"components"));$t.push(ae.resolve(import.meta.dir,"components"));for(let ye of $t)if(!be.includes(ye))be.push(ye);let fr=c._pluginComponentDirs;if(Array.isArray(fr)){for(let ye of fr)if(typeof ye==="string"&&!be.includes(ye))be.push(ye)}if(c.fallbackComponentsDir&&!be.includes(c.fallbackComponentsDir))be.push(c.fallbackComponentsDir);if(ur){for(let ye of c._targetComponentDirs??[])if(ye&&!be.includes(ye))be.push(ye)}let kn=c._nativePrimitivesFallback;if(kn&&!kn.except.some((ye)=>ye.toLowerCase()===G.toLowerCase())&&!be.includes(kn.dir))be.push(kn.dir);let pr=[...new Set(be.map((ye)=>{if(!ye)return ye;return ae.isAbsolute(ye)?ye:ae.resolve(Ko,ye)}))];be.length=0,be.push(...pr);let os=`${G}\x00${l}\x00${pr.join("\x00")}`,as=Kn.get(os);if(as)if(await s(as))D=as;else Kn.delete(os);if(!D&&(G.startsWith("./")||G.startsWith("../")))D=ae.resolve(ae.dirname(l),`${G}.stx`),ne.push(D);else if(!D)for(let ye of be){if(!ye)continue;for(let Rn of ce){let Cn=ae.join(ye,Rn);if(ne.push(Cn),await s(Cn)){D=Cn;break}}if(D)break;if(!D)try{let Rn=await import("fs");if(!Rn.statSync(ye,{throwIfNoEntry:!1})?.isDirectory())continue;let Xo=8,cs=[{path:ye,depth:0}];while(cs.length>0&&!D){let An=cs.pop();if(An.depth>=Xo)continue;let dr;try{dr=Rn.readdirSync(An.path,{withFileTypes:!0})}catch{continue}for(let Tn of dr){if(!Tn.isDirectory())continue;if(Tn.name==="node_modules"||Tn.name.startsWith("."))continue;let gr=ae.join(An.path,Tn.name);for(let Jo of ce){let ls=ae.join(gr,Jo);if(ne.push(ls),await s(ls)){D=ls;break}}if(D)break;cs.push({path:gr,depth:An.depth+1})}}}catch{}if(D)break}if(D)Kn.set(os,D)}if(!D||!await s(D))return Ro(e,l,ne),Co(e);v.add(D);let te;if(tn.has(D)&&er.get(D)===So(D))te=tn.get(D);else try{let re=So(D);te=await Bun.file(D).text(),tn.set(D,te),er.set(D,re)}catch(re){let ce=re instanceof Error?re.message:String(re);return Ro(e,l,[D],ce),Co(e)}if(A)for(let re of new Set([...Object.keys(t),...A.reactiveProps??[]])){let ce=re.toLowerCase();if(ce.startsWith("aria-")||ce.startsWith("data-"))continue;let _e=re.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${_e}\\b`).test(te))A.declaredProps.add(re);if(new RegExp(`\\$props\\s*(?:\\.\\s*${_e}\\b|\\[\\s*['"]${_e}['"]\\s*\\])`).test(te)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${_e}['"]`).test(te))A.consumedProps?.add(re)}if(A?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(te))for(let re of A.reactiveProps){if(tu.has(re)||A.consumedProps?.has(re))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${re.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(te))continue;let ce=`${D}\x00${re}`;if(Ao.has(ce))continue;Ao.add(ce),console.warn(`[stx] ${ae.basename(D)} reads \`${re}\` with defineProps(), which is not live, but ${ae.basename(l)} binds it (:${re}): the value can arrive empty or stale (on a native screen, and for a :for's rows, it does not arrive at all). Read it with useReactiveProp('${re}').`)}let le=new Set(["__originalFilePath","__importedComponents",Dn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),he={};for(let[re,ce]of Object.entries(a))if(!re.startsWith("__")||le.has(re))he[re]=ce;let ue=E.length>0?{[Fn]:[...E]}:{},Ee=i;if(i.includes("@include")){let{processIncludes:re}=await o("stx/includes",()=>import("./chunk-rbq4dn2a.js"));Ee=await re(i,a,l,c,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ee)){let{processComponents:re}=await o("stx/component-renderer",()=>import("./chunk-s6399qe7.js")),ce={...a,__processedComponents:j,...ue};Ee=await re(Ee,ce,l,c,v);let _e=ce.__stx_preserved_client_expressions;if(Array.isArray(_e)&&_e.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],..._e])]}let Ae=[];if(Yc(Ee)){let{processExpressions:re}=await o("stx/expressions",()=>import("./chunk-7amk61bt.js")),ce=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...ue}:E.length>0?{...a,...ue}:a;Ee=re(Ee,ce,l);for(let _e of Ee.matchAll(/\{\{([\s\S]*?)\}\}/g))Ae.push(_e[1].trim())}let We=J(Ee),Ke=[],Ye=We.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(re,ce)=>{let _e=We.scripts[Number(ce)]||"",be=_e.match(/^<script\b([^>]*)>/i)?.[1]||"",Ve=be.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Te=!Ve||["module","text/javascript","application/javascript"].includes(Ve),ft=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${be}`);if(!/\bserver\b/i.test(be)&&Te&&!ft)return Ke.push(_e),"";return _e}),{extractSlotContent:Xe}=await o("stx/slots",()=>import("./chunk-12m1qwzd.js")),et=Xe(Ye),Je={};if(et.defaultSlot?.trim())Je.default=et.defaultSlot;for(let[re,ce]of et.namedSlots)Je[re]=ce.content;let gt=a.__stx_scope_seq??={n:0,key:Vs(String(a.__filename??l))},Ct=Po(e,process.cwd()),it=`stx_${(Ct.endsWith(".stx")?Ct.slice(0,-4):Ct).replace(/[^a-zA-Z0-9]/g,"_")}_${++gt.n}_${gt.key}`,Pe={...he,$uid:it,$native:c._nativeHostAttrs===!0,...t,props:t,slot:Ye,$slots:Je,__processedComponents:P,__sections:{},__stx_signals_gate:ke(te)||Yc(i),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Ae]};if(/import\s/.test(te)){Pe.__importedComponents=new Map(Pe.__importedComponents);let{processESImports:re}=await o("stx/component-renderer",()=>import("./chunk-s6399qe7.js"));te=await re(te,Pe,D,c,v)}Yl(te,Pe);let Tt=te,sn=pe(Tt);if(sn)Tt=sn.content.trim();let Yn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,jt=[...te.matchAll(Yn)];for(let[,re,ce]of jt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(re))Ne(ce,D,c.strict);let Ge=[],Lt=null,Qn=jt.some((re)=>/\bserver\b/.test(re[1]||"")&&/\bcache\b/.test(re[1]||"")),bt=null,ot=null,zt=null,rn=0,Wt=null;if(Hl(c),Qn&&sr>0){let re=ql({props:t,slot:Ee,slotContext:i.trim()?Zl(he):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...E].sort(),layers:c._layerGraph?.layers.map((ce)=>ce.configFile),uid:it});if(re!==null){bt=`${D}\x00${S(te)}\x00${re}`;let ce=Xn.get(bt);if(ce){for(let _e of ce.dependencies)v.add(_e);if(ti(a,ce.clientFactories),gt.n+=ce.uidsConsumed,ce.preservedClientExpressions.length>0){let _e=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let be of ce.preservedClientExpressions)_e.add(be);a.__stx_preserved_client_expressions=[..._e]}return ce.output}ot=new Set(v),zt=Qr(a),rn=gt.n,Wt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Ft=new Set;for(let re of jt){let ce=re[1]||"",_e=re[2]||"",be=ce.includes("server");if(Be(ce)&&_e.trim())_e=Fe(_e);if(be&&_e){for(let Te of De(_e))Ft.add(Te);try{await H(_e,Pe,D,{onFailure:(Te)=>{if(Te.kind!=="unknown")Lt=Te.kind}})}catch(Te){}}if(!be){let Te=_e.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),ft=Te.includes("{{")&&Te.includes("}}"),pt=Te.includes("{!!")&&Te.includes("!!}");if(ft||pt)Te=xi(Te,Pe,D);let yt=ce.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Ge.push(`<script${yt}>${Te}</script>`)}}let Qe=J(te).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Vt=Qe?Qe[1]:"",es=Qe?Qe[2]:"",at="",se=Vt&&/\bscoped\b/i.test(Vt);if(Qe)at=`<style${Vt}>${eu(es,Pe,D)}</style>`;let oe=Tt;if(oe=oe.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Qe)oe=oe.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let re=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ce=[];if(oe=oe.replace(re,(_e,be)=>{let Ve=be.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Ve)ce.push(`<style${Ve[1]}>${Ve[2]}</style>`);return""}),oe=oe.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ce.length>0)at=`${at}${ce.join(`
|
|
574
|
+
`)}`}if(i&&oe.includes("{{ text || slot }}"))oe=oe.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>i);let{applySlots:de}=await o("stx/slots",()=>import("./chunk-12m1qwzd.js")),{defaultSlot:we,namedSlots:Re}=et,qe=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(Ye),tt=Ge.length>0&&ks(oe)||c._nativeHostAttrs===!0&&Ge.length>0||qe&&Ge.length>0||Ge.some((re)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(re)),ts=(re)=>tt?Ki(re,it):re,ns=new Map([...Re].map(([re,ce])=>[re,{...ce,content:ts(ce.content)}]));oe=await de(oe,tt?Zi(ts(we),it):we,ns,Pe,tt?it:"");let on=wi(Ge),Ut=(Array.isArray(Pe.__stx_client_signal_names)?Pe.__stx_client_signal_names:[]).filter((re)=>!Ft.has(re));if(on.length>0||Ut.length>0)Pe.__stx_client_signal_names=[...new Set([...Ut,...on])];else delete Pe.__stx_client_signal_names;let Ht=E.filter((re)=>!Ft.has(re)&&!(re in t));if(Ht.length>0)Pe[Fn]=Ht;let an={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:ae.dirname(D),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||tt||Ge.length===0,defaultLayout:void 0};Pe.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:cn}=await o("stx/process",()=>import("./chunk-3vsz0vrk.js")),nt=await cn(oe,Pe,D,an,v),ut=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let re of nt.matchAll(/\{\{([\s\S]*?)\}\}/g))ut.add(re[1].trim());if(ut.size>0)a.__stx_preserved_client_expressions=[...ut];let lt=it,Ze=nt;if(tt){let re="";if(Object.keys(t).length>0)try{re=` data-stx-props="${Gs(JSON.stringify(t))}"`}catch{}let ce=L?` stx-hydrate="${Gs(L)}"`:"",_e=Object.fromEntries(Object.entries(Je).map(([mt,_t])=>[mt,Boolean(_t)])),be=Object.keys(_e).length>0?` data-stx-slots="${Gs(JSON.stringify(_e))}"`:"",Ve=` data-stx-scope="${lt}"${re}${be}${ce}`,Te=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(nt),ft=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(nt),pt=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(nt),yt=Te?"span":"div",ss=ft&&c._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':pt&&c._nativeHostAttrs?' style="width:100%;height:100%"':Te||ft?' style="display:contents"':"";Ze=hg(nt,Ve)??`<${yt}${Ve} data-stx-component-wrapper${ss}>${nt}</${yt}>`;let rs=await Promise.all(Ge.map(async(mt)=>{let _t=mt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!_t)return mt;let[,qt,is]=_t,ln=wo(mt,Pe,D);if(ln!==null)return ln;let wt=await su(is,D,c.buildMode==="compile"),un=bn(wt.clientCode,Le(Pe)),{vendorStyleTags:dn}=wt,_n=un?`function(__scopeId) {
|
|
575
575
|
${un}
|
|
576
576
|
return (${wt.factoryBody})(__scopeId);
|
|
577
|
-
}`:wt.factoryBody,$n=L?null:ys(a,
|
|
577
|
+
}`:wt.factoryBody,$n=L?null:ys(a,_n),En=$n?`window.__stxComponentFactories[${JSON.stringify($n)}](${JSON.stringify(lt)});`:`(${_n})(${JSON.stringify(lt)});`;if(L)return`${dn}<script type="stx/island" data-stx-island="${lt}" data-stx-scoped data-stx-owner="${lt}"${qt}>${En}</script>`;return`${dn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${lt}"${qt}>${En}</script>`}));if(Ze=Ze+`
|
|
578
578
|
`+rs.join(`
|
|
579
|
-
`),
|
|
580
|
-
`+
|
|
581
|
-
`+
|
|
582
|
-
`+
|
|
583
|
-
`),
|
|
579
|
+
`),at)Ze+=`
|
|
580
|
+
`+at}else{if(at)Ze+=`
|
|
581
|
+
`+at;if(Ge.length>0){let re=Pe.__stx_event_bindings||[],ce=Le(Pe),_e=await Promise.all(Ge.map(async(be)=>{let Ve=wo(be,Pe,D);if(Ve!==null)return Ve;let Te=be.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Te)return be;return await je(Te[1],{eventBindings:re,templateContent:Ze,filePath:D,projectRoot:process.cwd(),serverData:ce,instanceId:it})}));Ze+=`
|
|
582
|
+
`+_e.join(`
|
|
583
|
+
`),Pe.__stx_event_bindings=[]}}if(se){let re=Bs(Ze,D);if(re.hasScoped)Ze=re.html}if(bt&&ot){let re=Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[];Xn.set(bt,{output:Ze,dependencies:[...v].filter((ce)=>!ot.has(ce)),clientFactories:zt?ei(a,zt):[],uidsConsumed:gt.n-rn,preservedClientExpressions:Wt?re.filter((ce)=>!Wt.has(ce)):[]})}if(Lt)Ze=`<!--stx-render-failed:${Lt}-->${Ze}`;return Ke.length>0?`${Ze}
|
|
584
584
|
${Ke.join(`
|
|
585
|
-
`)}`:Ze}catch(
|
|
586
|
-
`),b=0;for(let v=0;v<c.length;v++)if(b+=c[v].length+1,b>=t){n=v+1,a=c[v].trim();let E=Math.max(0,v-2),A=Math.min(c.length,v+3);l=c.slice(E,A).map((
|
|
587
|
-
`);break}}else if(i){let c=e.indexOf(i);if(c>=0)return
|
|
588
|
-
`,Math.max(0,a-1));E=a-(
|
|
585
|
+
`)}`:Ze}catch(F){if(F instanceof K)throw F;return`[Error processing component: ${F instanceof Error?F.message:String(F)}]`}finally{j.delete(e)}}async function s(e){return Bun.file(e).exists()}function rr(e,t){let i=ae.resolve(t),n=ae.resolve(e),a=i.endsWith(ae.sep)?i:i+ae.sep;if(n===i||n.startsWith(a))return n;return null}async function To(e,t,i,n){let a=t.startsWith("layouts/")?t.slice(8):t,l=ae.join(e,a);for(let c of l.endsWith(".stx")?[l]:[l,`${l}.stx`])if(await s(c)){if(n)console.log(`Found layout in ${e}: ${c}`);return i?.add(c),c}return null}async function wn(e,t,i,n){let a=await nu(e,t,i,n);if(a===null)return null;let l=rr(a,process.cwd());if(l)return l;let c=[i.root,i.layoutsDir,i.fallbackLayoutsDir,i.componentsDir,i.partialsDir,i.pagesDir,...i._layerLayoutDirs??[]].filter((b)=>typeof b==="string"&&b.length>0);for(let b of c){let v=ae.isAbsolute(b)?b:ae.resolve(process.cwd(),b);if(rr(a,v))return ae.resolve(a)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${a} (template: ${e}, from: ${t})`),null}async function nu(e,t,i,n){if(i.debug)console.log(`Resolving template path: ${e} from ${t}`);let a=ae.dirname(t),l=process.cwd();if(e.startsWith("/")){let j=ae.join(l,e),P=rr(j,l);if(!P)return console.warn(`[stx] rejected template path that escapes project root: ${e} (from ${t})`),null;if(i.debug)console.log(`Checking absolute path: ${P}`);if(await s(P)&&n)n.add(P);return P}let c=async(j)=>{if(!i.layoutsDir||!i.fallbackLayoutsDir)return j;let P=ae.relative(ae.resolve(l,i.fallbackLayoutsDir),j);if(P.startsWith("..")||ae.isAbsolute(P))return j;return await To(ae.resolve(l,i.layoutsDir),e,n,i.debug)??j},b=ae.join(a,e);if(await s(b)){if(i.debug)console.log(`Found direct path: ${b}`);let j=await c(b);if(n)n.add(j);return j}if(!e.endsWith(".stx")&&!e.endsWith(".jsx")&&!e.endsWith(".tsx"))for(let j of[".stx",".tsx",".jsx"]){let P=`${b}${j}`;if(await s(P)){if(i.debug)console.log(`Found direct path with extension: ${P}`);let B=await c(P);if(n)n.add(B);return B}}let v=[];if(v.push(...i._layerLayoutDirs??[]),i.layoutsDir)v.push(ae.isAbsolute(i.layoutsDir)?i.layoutsDir:ae.resolve(process.cwd(),i.layoutsDir));let E=ae.resolve(a),A=process.cwd();for(let j=0;j<10;j++){let P=ae.join(E,"layouts"),B=!1;try{B=Jn.statSync(P,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){v.push(P);break}let L=ae.dirname(E);if(L===E||L.length<A.length)break;E=L}for(let j of v){let P=await To(j,e,n,i.debug);if(P)return P}if(i.fallbackLayoutsDir){let j=ae.isAbsolute(i.fallbackLayoutsDir)?i.fallbackLayoutsDir:ae.resolve(process.cwd(),i.fallbackLayoutsDir),P=e.startsWith("layouts/")?e.slice(8):e,B=[ae.join(j,P)];if(!e.endsWith(".stx"))B.push(`${B[0]}.stx`);for(let L of B)if(await s(L)){if(i.debug)console.log(`Found in options.fallbackLayoutsDir: ${L}`);if(n)n.add(L);return L}}if(e.startsWith("layouts/")||e.includes("/layouts/")){let j=e.split("layouts/"),P=ae.join(i.partialsDir||a,"layouts",j[1]);if(await s(P)){if(i.debug)console.log(`Found in layouts path: ${P}`);if(n)n.add(P);return P}if(!P.endsWith(".stx")){let B=`${P}.stx`;if(await s(B)){if(i.debug)console.log(`Found in layouts path with extension: ${B}`);if(n)n.add(B);return B}}}if(i.partialsDir){let j=ae.join(i.partialsDir,"layouts");if(await s(j)){let P=ae.join(j,e);if(await s(P)){if(i.debug)console.log(`Found in partials layouts dir: ${P}`);if(n)n.add(P);return P}if(!e.endsWith(".stx")){let B=`${P}.stx`;if(await s(B)){if(i.debug)console.log(`Found in partials layouts dir with extension: ${B}`);if(n)n.add(B);return B}}}}let O=i.partialsDir||ae.join(process.cwd(),"views"),H=ae.join(O,e);if(await s(H)){if(i.debug)console.log(`Found in views path: ${H}`);if(n)n.add(H);return H}if(!e.endsWith(".stx")){let j=`${H}.stx`;if(await s(j)){if(i.debug)console.log(`Found in views path with extension: ${j}`);if(n)n.add(j);return j}}if(a.includes("temp")){let j=ae.join(ae.dirname(a),"layouts",e);if(await s(j)){if(i.debug)console.log(`Found in temp layouts dir: ${j}`);if(n)n.add(j);return j}if(!e.endsWith(".stx")){let P=`${j}.stx`;if(await s(P)){if(i.debug)console.log(`Found in temp layouts dir with extension: ${P}`);if(n)n.add(P);return P}}}if(i.debug)console.warn(`Template not found after trying all paths: ${e} (referenced from ${t})`);else console.warn(`Template not found: ${e} (referenced from ${t})`);return null}function Qc(e,t,i){let n=0,a="",l="";try{if(typeof t==="number"&&t>=0){let c=e.split(`
|
|
586
|
+
`),b=0;for(let v=0;v<c.length;v++)if(b+=c[v].length+1,b>=t){n=v+1,a=c[v].trim();let E=Math.max(0,v-2),A=Math.min(c.length,v+3);l=c.slice(E,A).map((O,H)=>{let j=E+H+1;return`${j===n?"> ":" "}${j}: ${O}`}).join(`
|
|
587
|
+
`);break}}else if(i){let c=e.indexOf(i);if(c>=0)return Qc(e,c)}}catch{}return{lineNumber:n,lineContent:a,context:l}}var ve={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 h(e,t,i,n,a,l){let{lineNumber:c,context:b}=Qc(n,a,l),v=i.split("/").pop(),E=0;if(typeof a==="number"&&a>=0&&n){let O=n.lastIndexOf(`
|
|
588
|
+
`,Math.max(0,a-1));E=a-(O+1)+1}let A="";if(c>0)A+=`
|
|
589
589
|
${i}:${c}${E>0?`:${E}`:""}: ${e.toLowerCase()} error: ${t}
|
|
590
590
|
`;if(A+=`
|
|
591
|
-
${
|
|
592
|
-
`,A+=`${
|
|
593
|
-
`,A+=`${
|
|
591
|
+
${ve.bold}${ve.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${ve.reset}
|
|
592
|
+
`,A+=`${ve.bold}${ve.red}\u2502${ve.reset} ${ve.bold}${ve.bgRed} ERROR ${ve.reset} ${ve.red}${e} Error${ve.reset}${" ".repeat(Math.max(0,43-e.length))}${ve.bold}${ve.red}\u2502${ve.reset}
|
|
593
|
+
`,A+=`${ve.bold}${ve.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${ve.reset}
|
|
594
594
|
`,A+=`
|
|
595
|
-
${
|
|
596
|
-
${
|
|
595
|
+
${ve.cyan}${ve.bold}File:${ve.reset} ${ve.dim}${v}${ve.reset}`,c>0)A+=` ${ve.gray}(line ${c}${E>0?`, col ${E}`:""})${ve.reset}`;if(A+=`
|
|
596
|
+
${ve.yellow}${ve.bold}Message:${ve.reset} ${t}
|
|
597
597
|
`,b)A+=`
|
|
598
|
-
${
|
|
599
|
-
${
|
|
600
|
-
`;return A}function
|
|
601
|
-
${
|
|
598
|
+
${ve.blue}${ve.bold}Context:${ve.reset}
|
|
599
|
+
${ve.dim}${b}${ve.reset}
|
|
600
|
+
`;return A}function ge(){tn.clear(),er.clear(),Kn.clear(),tr.clear(),nr.clear(),Xn.clear()}function Zh(){return{size:tn.size,maxSize:500}}var Qs=w(128);async function su(e,t,i){let n=S(e,t,i),a=Qs.get(n);if(a){if(Ds(a.deps))return a;Qs.delete(n)}let l=yi(e,{filePath:t,projectRoot:process.cwd()}),c=l.code,b=bi(l.styles);c=Mt(c).code;let{hasUserImports:v,bundleClientScript:E}=await o("stx/client-script-bundler",()=>import("./chunk-a7ewznxk.js")),A=[],O=!1;if(v(c)){let G=c;c=await E(G,t,{projectRoot:process.cwd(),minify:i,collectInputs:A}),O=c===G}let{stripStxRuntimeImports:H}=await o("stx/signal-processing",()=>import("./chunk-w9gpscjf.js"));c=H(c);let j=I(c),P=Xl(j),B=new Set(V(j,!0).split(",").map((G)=>G.trim())),L=`function(__scopeId) {
|
|
601
|
+
${ct("const",[...pl,...P],j)}
|
|
602
602
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
603
603
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
604
604
|
__scopeVars.$refs = __scopeVars.$refs || {};
|
|
@@ -667,7 +667,7 @@ ${j}
|
|
|
667
667
|
// Register all defined signals and functions in this scope
|
|
668
668
|
const __localVars = {};
|
|
669
669
|
try {
|
|
670
|
-
${
|
|
670
|
+
${P.map((G)=>B.has(G)?`Object.defineProperty(__localVars, '${G}', ${Ps(G)});`:`if (typeof ${G} !== 'undefined') __localVars['${G}'] = ${G};`).join(`
|
|
671
671
|
`)}
|
|
672
672
|
}
|
|
673
673
|
catch (e) {}
|
|
@@ -686,24 +686,24 @@ finally {
|
|
|
686
686
|
window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
|
|
687
687
|
window.__STX_CURRENT_PROPS__ = __previousCurrentProps;
|
|
688
688
|
}
|
|
689
|
-
}`,
|
|
690
|
-
`);for(let a of n){let l=i,c=null,b=!1;for(let v=0;v<a.length;v++){let E=a[v];if(b){b=!1;continue}if(E==="\\"){b=!0;continue}if(c){if(E===c)c=null;continue}if(E==="'"||E==='"'||E==="`"){c=E;continue}if(E==="/"&&v+1<a.length&&a[v+1]==="/")break;if(E==="{")i++;else if(E==="}")i--}if(l===0){let v=a.match(/(?:const|let|var)\s+(\w+)\s*=/);if(v)t.push(v[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(a)){let E=a.match(/(?:const|let|var)\s+(\w+)/);if(E)t.push(E[1])}else{let E=a.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(E){let
|
|
689
|
+
}`,F={vendorStyleTags:b,factoryBody:L,clientCode:j,deps:br([...A,...l.styles.map((G)=>G.resolvedPath)])};if(!O&&l.unresolved.length===0)Qs.set(n,F);return F}var yn=["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 ru=100,iu=599,or="__stxResponseStatus",nn="__stxResponseHeaders";function Gn(e){return typeof e==="number"&&Number.isInteger(e)&&e>=ru&&e<=iu}function mn(e){for(let t of e.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let i=t[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!i)continue;let n=Number(i[1]);if(Gn(n))return n}return}function ir(e,t){if(!e||typeof e!=="object")return!1;let i=typeof t==="string"&&/^\d+$/.test(t.trim())?Number(t.trim()):t;if(!Gn(i))return!1;return e[or]=i,!0}function ou(e,t,i){if(!e||typeof e!=="object")return;let n=String(t??"").trim();if(!n)return;e[nn]={...e[nn],[n]:String(i)}}function Ot(e){let t=e?.[or];return Gn(t)?t:void 0}function Nt(e){let t=e?.[nn];if(!t||typeof t!=="object")return;let i=Object.entries(t).map(([n,a])=>[n,String(a)]);return i.length>0?Object.fromEntries(i):void 0}function Bc(e,t){if(!e||!t||e===t||typeof t!=="object")return;let i=Ot(e);if(i!==void 0)t[or]=i;let n=Nt(e);if(n)t[nn]={...t[nn],...n}}function Fs(e){return{setResponseStatus:(t)=>{ir(e,t)},notFound:(t=404)=>{let i=Gn(t)&&t>=400?t:404;ir(e,i)},setResponseHeader:(t,i)=>{ou(e,t,i)}}}function Fc(e,t,i={}){if(!e.includes("@status"))return e;let{filePath:n,buildMode:a}=i,l=a==="compile",c="",b=0,v=/@status\s*\(/g,E;while((E=v.exec(e))!==null){let A=au(e,E.index+E[0].length-1);if(A<0)break;let O=e.slice(E.index+E[0].length,A).trim(),H=/^\d+$/.test(O)?Number(O):u(O,t),j=n?` in ${n}`:"";if(l)console.warn(`[stx] @status(${O})${j} 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(!ir(t,H))console.warn(`[stx] @status(${O})${j} is not an HTTP status (100-599) \u2014 ignoring it.`);c+=e.slice(b,E.index),b=A+1+(e.slice(A+1).match(/^[^\S\n]*\n?/)?.[0].length??0),v.lastIndex=b}return b===0?e:c+e.slice(b)}function au(e,t){let i=1,n=null,a=!1;for(let l=t+1;l<e.length;l++){let c=e[l];if(a){a=!1;continue}if(n){if(c==="\\")a=!0;else if(c===n)n=null;continue}if(c==='"'||c==="'"||c==="`"){n=c;continue}if(c==="(")i++;else if(c===")"&&--i===0)return l}return-1}var jo=new Set(yn),cu=new Set(["props","$props","defineProps"]),lu=new Set(["stx","@stacksjs/stx"]),Do=w(128),No=w(64);function uu(e){let t=[],i=0,n=e.split(`
|
|
690
|
+
`);for(let a of n){let l=i,c=null,b=!1;for(let v=0;v<a.length;v++){let E=a[v];if(b){b=!1;continue}if(E==="\\"){b=!0;continue}if(c){if(E===c)c=null;continue}if(E==="'"||E==='"'||E==="`"){c=E;continue}if(E==="/"&&v+1<a.length&&a[v+1]==="/")break;if(E==="{")i++;else if(E==="}")i--}if(l===0){let v=a.match(/(?:const|let|var)\s+(\w+)\s*=/);if(v)t.push(v[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(a)){let E=a.match(/(?:const|let|var)\s+(\w+)/);if(E)t.push(E[1])}else{let E=a.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(E){let O=E[1].slice(1,-1).split(",").map((H)=>{let j=H.split(":");return(j.length>1?j[1]:j[0]).trim()}).filter((H)=>/^\w+$/.test(H));t.push(...O)}}}}return[...new Set(t)]}function tg(e){let t=e;t=t.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),t=t.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),t=t.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),t=t.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),t=t.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function i(n){if(!n.includes(":"))return n;let a=[],l="",c=0,b=0,v=null;for(let E=0;E<n.length;E++){let A=n[E];if(v){if(l+=A,A===v)v=null;continue}if(A==='"'||A==="'"||A==="`"){v=A,l+=A;continue}if(A==="<")c++;else if(A===">"&&c>0)c--;else if(A==="(")b++;else if(A===")")b--;if(A===","&&c===0&&b===0){a.push(l),l="";continue}l+=A}if(l)a.push(l);return a.map((E)=>{let A=E.trim(),O=A.startsWith("..."),H=O?A.slice(3):A,j=-1,P=0;for(let ne=0;ne<H.length;ne++)if(H[ne]==="<")P++;else if(H[ne]===">")P--;else if(H[ne]===":"&&P===0){j=ne;break}if(j===-1)return E;let L=H.substring(0,j).trim().replace(/\?$/,""),F=H.substring(j+1),G=-1,D=0;for(let ne=0;ne<F.length;ne++)if(F[ne]==="<")D++;else if(F[ne]===">")D--;else if(F[ne]==="="&&D===0){G=ne;break}let ee=O?"...":"";if(G!==-1)return`${ee}${L} = ${F.substring(G+1).trim()}`;return`${ee}${L}`}).join(", ")}t=t.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(n,a,l)=>{if(!l.includes(":"))return n;return`${a}(${i(l)})`});{let n=/\b(function\s+\w*\s*)\(/g,a,l=[];while((a=n.exec(t))!==null){let c=a.index+a[0].length-1,b=1,v=c+1,E=0,A=null;while(v<t.length&&b>0){let j=t[v];if(A){if(j===A)A=null;v++;continue}if(j==='"'||j==="'"||j==="`"){A=j,v++;continue}if(j==="<")E++;else if(j===">"&&E>0)E--;else if(E===0){if(j==="(")b++;else if(j===")")b--}if(b>0)v++}if(b!==0)continue;let O=t.substring(c+1,v);if(!O.includes(":"))continue;let H=i(O);l.push({start:c+1,end:v,replacement:H})}for(let c=l.length-1;c>=0;c--){let{start:b,end:v,replacement:E}=l[c];t=t.substring(0,b)+E+t.substring(v)}}return t=t.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(n,a)=>{if(!a.includes(":"))return n;if(a.includes("{")||a.includes("}"))return n;return`(${a.split(",").map((c)=>{let[b,...v]=c.split("="),E=b.split(":")[0].trim();if(v.length>0)return`${E} = ${v.join("=").trim()}`;return E}).join(", ")}) =>`}),t=t.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"),t=t.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),t=t.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),t=t.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),t=t.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),t=t.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),t=t.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),t=t.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),t=t.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),t=t.replace(/\n\s*\n\s*\n/g,`
|
|
691
691
|
|
|
692
|
-
`),t}function
|
|
693
|
-
`),on=t.params??{},Ut=[],Ht=[];for(let re=0;re<
|
|
692
|
+
`),t}function ng(e){return e.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(t,...i)=>{let[,n,a]=i,l=n??a;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(l)?"":t})}function rg(e){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(e)}function sg(e){if(e instanceof SyntaxError)return!0;let t=e instanceof Error?e.message:String(e);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(t)}function og(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 Lo=new Set;async function m(e,t,i,n={}){if(!e.trim())return;let a=C(),l=S(e,JSON.stringify(a)),c=Do.get(l);if(c===void 0){try{let se=Z({loader:"ts",target:"browser",define:a}),oe=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");oe=oe.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),c=se.transformSync(oe)}catch{c=tg(e)}Do.set(l,c)}let b={exports:{}},v=b.exports,E=Rt.cwd(),A={},O=[...c.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((se)=>se[1]).filter((se)=>!se.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(se)),H=new Map;for(let se of O)try{if(se.startsWith(".")){A[se]=await import(rt.resolve(rt.dirname(i),se));continue}let oe=rt.resolve(E,"node_modules",se),de=rt.join(oe,"package.json"),we=JSON.parse(g("fs").readFileSync(de,"utf8")),Re=we.main||"index.js";if(we.exports){let qe=typeof we.exports==="string"?we.exports:we.exports["."];if(typeof qe==="string")Re=qe;else if(qe?.bun)Re=qe.bun;else if(qe?.import)Re=qe.import;else if(qe?.default)Re=qe.default}A[se]=await import(rt.resolve(oe,Re))}catch(oe){if(se.startsWith("."))H.set(se,oe instanceof Error?oe.message:String(oe))}let j=(se)=>{if(A[se])return A[se];let oe=H.get(se);if(oe!==void 0)throw Error(`Cannot require '${se}' from ${i}: ${oe}`);return g(se)},P=t.props||{},B=(se)=>{if(!se)return P;let oe={};for(let[de,we]of Object.entries(se)){let Re=P[de];if(Re!==void 0)oe[de]=Re;else if(typeof we==="function")oe[de]=we();else oe[de]=we}return oe};for(let[se,oe]of Object.entries(P))Object.defineProperty(B,se,{value:oe,enumerable:!0,configurable:!0,writable:!0});let L=(se,oe=!1)=>{if(se===void 0||se===null)return oe;if(typeof se==="string"){let de=se.trim().toLowerCase();if(de===""||de==="true"||de==="1"||de==="on"||de==="yes")return!0;if(de==="false"||de==="0"||de==="off"||de==="no")return!1;return!0}return Boolean(se)},F=(se,oe=0)=>{if(se===void 0||se===null)return oe;if(typeof se==="string"){let we=se.trim();if(we==="")return oe;let Re=Number(we);return Number.isFinite(Re)?Re:oe}let de=Number(se);return Number.isFinite(de)?de:oe};for(let se of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(P,se))continue;try{Object.defineProperty(B,se,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let G=(se)=>{if(!se)return P;let oe={...P};for(let[de,we]of Object.entries(se)){let Re=we&&typeof we==="object"&&!Array.isArray(we)?we:{type:we};if(oe[de]===void 0&&Re.default!==void 0)oe[de]=typeof Re.default==="function"?Re.default():Re.default}return oe},D=()=>t.slots||{},ee=(se,oe)=>{let de={...se};for(let[we,Re]of Object.entries(oe))if(de[we]===void 0)if(typeof Re==="function")de[we]=Re();else de[we]=Re;return de},ne=(se)=>{let oe=()=>se;return oe.set=(de)=>{},oe.update=(de)=>{},oe},te=(se)=>{let oe,de=!1;return()=>{if(!de)try{oe=se(),de=!0}catch{oe=void 0}return oe}},le=(se)=>{},he=(se)=>se(),ue=(se)=>{},Ee=(se)=>{},Ae=Fs(t);function We(se){let oe=se||{};if(oe.title!==void 0||oe.description!==void 0)Je({title:oe.title,description:oe.description})}function Ke(se){if(!se||typeof se!=="object")return;let oe=t.__stxClientPayload??{};Object.assign(oe,se),t.__stxClientPayload=oe}let Ye=()=>{let se=t.__stxServeContext,oe=t.__stxServeSearch??se?.search??"",de=se?.path??"",we=Object.fromEntries(new URLSearchParams(oe)),Re=t.query,qe=Object.keys(we).length>0?we:Re??{},tt=oe||(Object.keys(qe).length>0?`?${new URLSearchParams(qe).toString()}`:"");return{params:t.params??{},query:qe,path:de,name:"",fullPath:de+tt,hash:"",matched:[]}},Xe=()=>({push:(se)=>{},replace:(se)=>{},back:()=>{},forward:()=>{},go:(se)=>{}}),et=(se)=>{let oe=t.__stx_runtime_head||{};t.__stx_runtime_head=Ue(oe,Ce(se||{},{known:Js,source:"useHead()"}))},Je=(se)=>{et(Ys(se||{}))},gt=(se)=>({value:se}),Ct=(se)=>se,cr=(se)=>({value:typeof se==="function"?se():se}),it=(se,oe)=>{},Pe=(se)=>{},Tt=(se)=>{},sn=(se)=>se?se():Promise.resolve(),Yn=(se)=>(oe,...de)=>{},jt=(se)=>{},Ge=(se,oe)=>{},Lt=(se,oe)=>oe,Qn=()=>({value:"light"}),bt=()=>ne(!1),ot=(se)=>ne(!1),zt=()=>ne(!1),rn=()=>ot("(prefers-color-scheme: dark)"),Wt=()=>ot("(prefers-color-scheme: light)"),Ft=()=>ot("(prefers-reduced-motion: reduce)"),lr=()=>ot("(prefers-contrast: more)"),Qe={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:{}},Vt=new Proxy(Qe,{get(se,oe){if(oe in se)return se[oe];return},set(se,oe,de){return se[oe]=de,!0}}),es={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},at=console;try{let se=hi(c,i),oe=new Set(Object.keys(P)),de=Object.keys(t).filter((re)=>!oe.has(re)&&!cu.has(re)&&Bt(re)),we=de.map((re)=>t[re]);if(!de.includes("__stxServeContext"))de.push("__stxServeContext"),we.push(void 0);if(!oe.has("cookies")){let re=t.cookies??t.__stxServeContext?.cookies??{},ce=de.indexOf("cookies");if(ce<0)de.push("cookies"),we.push(re);else we[ce]=re}let Re=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),qe=[],tt=[];for(let[re,ce]of Object.entries(P)){if(!Bt(re))continue;if(Re.has(re))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${re}\\b`).test(se))continue;qe.push(re),tt.push(ce)}let ns=uu(se).map((re)=>`module.exports.${re} = typeof ${re} !== 'undefined' ? ${re} : module.exports.${re};`).join(`
|
|
693
|
+
`),on=t.params??{},Ut=[],Ht=[];for(let re=0;re<de.length;re++){if(de[re]==="params")continue;Ut.push(de[re]),Ht.push(we[re])}let an=[...yn,...qe,...Ut],cn=`return (async () => {
|
|
694
694
|
${se}
|
|
695
695
|
${ns}
|
|
696
696
|
return module.exports
|
|
697
|
-
})()`,nt=S(cn,an.join("\x00")),ut=No.get(nt);if(!ut)ut=Function(...an,cn),No.set(nt,ut);let lt=t.__stx_options?.runtimeConfig;if(lt||/\buse(?:Server)?RuntimeConfig\b/.test(c))await
|
|
698
|
-
`),l=[],c=0;while(c<a.length){let b=a[c].trim();if(b.startsWith("interface ")||b.startsWith("export interface ")||b.startsWith("type ")||b.startsWith("export type ")){if(b.includes("{")&&!b.includes("}")){let v=0;for(;c<a.length;c++){for(let E of a[c])if(E==="{")v++;else if(E==="}")v--;if(v<=0)break}}c++;continue}if(b.startsWith("definePageMeta(")){let v=0,E=!1,A=c;for(let j=c;j<a.length&&!E;j++){let
|
|
699
|
-
`),
|
|
700
|
-
`+j;if(
|
|
701
|
-
`),i,n)}function pu(e,t,i){let n=e.length,a="",l=0,c=null,b=!1,v=!1,E=0;while(l<n){let A=e[l],
|
|
702
|
-
`)b=!1;l++;continue}if(v){if(a+=A,A==="*"&&
|
|
703
|
-
`);return{type:
|
|
697
|
+
})()`,nt=S(cn,an.join("\x00")),ut=No.get(nt);if(!ut)ut=Function(...an,cn),No.set(nt,ut);let lt=t.__stx_options?.runtimeConfig;if(lt||/\buse(?:Server)?RuntimeConfig\b/.test(c))await xn(t,i,lt);let Ze=await He(t.__stx_runtime_config??Sn()??M(),()=>hr(t,()=>ut(b,v,j,P,B,L,F,G,ee,Ke,$r,ki,Ws,ne,te,le,he,ue,Ee,We,Ye,Xe,et,Je,Ae.setResponseStatus,Ae.setResponseHeader,Ae.notFound,gt,Ct,cr,it,Pe,Tt,sn,Yn,jt,D,Ge,Lt,Qn,bt,ot,zt,rn,Wt,Ft,lr,Vt,es,at,Qe.confirm,Qe.alert,Qe.fetch,on,...tt,...Ht)));if(n.preserveExisting){for(let[re,ce]of Object.entries(Ze))if(!(re in t)||t[re]===void 0)t[re]=ce}else Object.assign(t,Ze);for(let[re,ce]of Object.entries(P))if(!(re in t))t[re]=ce}catch(se){if(t.__stx_strict_hydration)throw se;let oe=ng(se instanceof Error?se.message:String(se));if(rg(oe))console.warn(`[stx] server <script> in ${i??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${oe}`),n.onFailure?.({kind:"module-resolution",message:oe,error:se});else if(sg(se))console.warn(`[stx] server <script> in ${i??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${oe}`),n.onFailure?.({kind:"syntax",message:oe,error:se});else if(og(oe))console.warn(`[stx] server <script> in ${i??"<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: ${oe}`),n.onFailure?.({kind:"missing-binding",message:oe,error:se});else{let de=`${i??"<unknown>"}\x00${oe}`;if(Rt.env.STX_DEBUG||!Lo.has(de))Lo.add(de),console.warn(`[stx] server <script> in ${i??"<unknown>"} threw, so every variable in that script is undefined and anything that reads one renders empty. Cause: ${oe}`);n.onFailure?.({kind:"unknown",message:oe,error:se})}try{await hu(c,t,i)}catch(de){if(Rt.env.STX_DEBUG){let we=de instanceof Error?de.message:String(de);console.warn(`[stx] fallback extraction also failed in ${i??"<unknown>"}: ${we}`)}}}}function ig(e){let t=0,i=null,n=!1,a=!1;for(let l=0;l<e.length;l++){let c=e[l];if(i){if(c===i){if(i=null,n||t===0)a=!0}continue}if(c==="'"||c==='"'||c==="`"){i=c;continue}if(c==="{")t++;else if(c==="}")t--;else if(e.startsWith("from",l)&&t===0)n=!0}return i===null&&t===0&&a}var fu=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function hi(e,t){let i=t?rt.dirname(t):Rt.cwd(),n=Rt.cwd(),a=e.split(`
|
|
698
|
+
`),l=[],c=0;while(c<a.length){let b=a[c].trim();if(b.startsWith("interface ")||b.startsWith("export interface ")||b.startsWith("type ")||b.startsWith("export type ")){if(b.includes("{")&&!b.includes("}")){let v=0;for(;c<a.length;c++){for(let E of a[c])if(E==="{")v++;else if(E==="}")v--;if(v<=0)break}}c++;continue}if(b.startsWith("definePageMeta(")){let v=0,E=!1,A=c;for(let j=c;j<a.length&&!E;j++){let P=null,B=!1,L=a[j];for(let F=0;F<L.length;F++){let G=L[F];if(B){B=!1;continue}if(G==="\\"){B=!0;continue}if(P){if(G===P)P=null;continue}if(G==='"'||G==="'"||G==="`"){P=G;continue}if(G==="(")v++;else if(G===")"){if(v--,v===0){c=j+1,E=!0;break}}}}if(!E)c=a.length;let O=a.slice(A,c).join(`
|
|
699
|
+
`),H=[];for(let j of["title","description"]){let P=new RegExp(`\\b${j}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(O);if(P)H.push(`${j}: ${JSON.stringify(P[2])}`)}if(H.length>0)l.push(`useSeoMeta({ ${H.join(", ")} });`);continue}if(b.startsWith("import ")||b==="import"||b.startsWith("import{")||/^import['"]/.test(b)){let v=b,E=0;while(!ig(v)&&c+E+1<a.length)E++,v=`${v} ${a[c+E].trim()}`;c+=E;let A=v.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),O=v.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),H=v.match(/^import\s*['"](.+?)['"]/),j=v,P=(B)=>{if(B.startsWith("."))return rt.resolve(i,B);if(B.startsWith("~/")||B.startsWith("@/"))return rt.resolve(n,B.slice(2));try{return Bun.resolveSync(B,i)}catch{return B}};if(A){let[,B,L]=A,F=P(L);l.push(`const ${B} = (await import('${F}')).default`),l.push(`module.exports.${B} = ${B};`)}else if(O){let[,B,L]=O,F=P(L),G=[],D=[],ee=lu.has(L);for(let ne of B.split(",")){let te=ne.trim();if(!te)continue;let le=te.split(/\s+as\s+/);if(le.length===2){let[he,ue]=[le[0].trim(),le[1].trim()];if(ee&&jo.has(he)){l.push(`const ${ue} = ${he};`);continue}G.push(`${he}: ${ue}`),D.push(ue)}else{if(ee&&jo.has(te))continue;G.push(te),D.push(te)}}if(G.length>0)l.push(`const { ${G.join(", ")} } = await import('${F}')`);for(let ne of D)l.push(`module.exports.${ne} = ${ne};`)}else if(H){let B=P(H[1]);l.push(`await import('${B}')`)}else l.push(j);c++;continue}if(fu.test(b))l.push(a[c]),c++;else if(b.startsWith("export const ")||b.startsWith("export let ")||b.startsWith("export var ")){let v=Bo(a,c),{type:E,name:A,value:O}=v;l.push(`${E} ${A} = ${O};`),l.push(`module.exports.${A} = ${A};`),c=v.nextIndex}else if(b.startsWith("export function ")||b.startsWith("export async function ")){let v=ar(a,c);l.push(v.functionCode),l.push(`module.exports.${v.name} = ${v.name};`),c=v.nextIndex}else if(b.startsWith("const ")||b.startsWith("let ")||b.startsWith("var ")){let v=Bo(a,c),{type:E,name:A,value:O}=v;l.push(`${E} ${A} = ${O};`),l.push(`module.exports.${A} = ${A};`),c=v.nextIndex}else if(b.startsWith("function ")||b.startsWith("async function ")){let v=ar(a,c);l.push(v.functionCode),l.push(`module.exports.${v.name} = ${v.name};`),c=v.nextIndex}else if(b.startsWith("export default function ")||b.startsWith("export default async function ")){let v=a[c].replace(/^(\s*)export\s+default\s+/,"$1"),E=[...a];E[c]=v;let A=ar(E,c);if(l.push(A.functionCode),A.name)l.push(`module.exports.default = ${A.name};`);c=A.nextIndex}else if(b.startsWith("export default ")){let v=b.replace(/^export\s+default\s+/,"").replace(/;$/,"");l.push(`module.exports.default = ${v};`),c++}else if(b.startsWith("class ")||b.startsWith("export class ")){let v=b.match(/(?:export\s+)?class\s+(\w+)/);if(v){let E=v[1],A=a[c].replace(/^export\s+/,""),O=0,H=c;for(;H<a.length;H++){let j=a[H];for(let P of j)if(P==="{")O++;else if(P==="}")O--;if(H>c)A+=`
|
|
700
|
+
`+j;if(O<=0&&H>=c)break}l.push(A),l.push(`module.exports.${E} = ${E};`),c=H+1}else l.push(b),c++}else if(b.includes("module.exports"))l.push(b),c++;else if(b.trim()&&!b.startsWith("//"))l.push(b),c++;else c++}return pu(l.join(`
|
|
701
|
+
`),i,n)}function pu(e,t,i){let n=e.length,a="",l=0,c=null,b=!1,v=!1,E=0;while(l<n){let A=e[l],O=e[l+1];if(b){if(a+=A,A===`
|
|
702
|
+
`)b=!1;l++;continue}if(v){if(a+=A,A==="*"&&O==="/"){a+=O,l+=2,v=!1;continue}l++;continue}if(!c&&A==="/"&&O==="/"){b=!0,a+=A,l++;continue}if(!c&&A==="/"&&O==="*"){v=!0,a+=A,l++;continue}if(c){if(a+=A,A==="\\"){a+=O,l+=2;continue}if(A===c&&c!=="`"){c=null,l++;continue}if(c==="`"){if(A==="$"&&O==="{"){E++,a+=O,l+=2;continue}if(A==="`"){c=null,l++;continue}}l++;continue}if(E>0){if(A==="{")E++;else if(A==="}")E--}if(A==='"'||A==="'"||A==="`"){c=A,a+=A,l++;continue}if(A==="a"&&e.startsWith("await",l)){let H=du(e,l);if(H){let{quote:j,path:P,end:B}=H;if(P.startsWith(".")||P.startsWith("~/")||P.startsWith("@/")){let L=P.startsWith(".")?rt.resolve(t,P):rt.resolve(i,P.slice(2));a+=`await import(${j}${L}${j})`,l=B;continue}}}a+=A,l++}return a}function du(e,t){let i=t+5;if(i>=e.length)return null;if(!/\s/.test(e[i]))return null;while(i<e.length&&/\s/.test(e[i]))i++;if(!e.startsWith("import",i))return null;i+=6;while(i<e.length&&/\s/.test(e[i]))i++;if(e[i]!=="(")return null;i++;while(i<e.length&&/\s/.test(e[i]))i++;let n=e[i];if(n!=="'"&&n!=='"')return null;i++;let a=i;while(i<e.length&&e[i]!==n)if(e[i]==="\\")i+=2;else i++;if(i>=e.length)return null;let l=e.slice(a,i);i++;while(i<e.length&&/\s/.test(e[i]))i++;if(e[i]!==")")return null;return{quote:n,path:l,end:i+1}}function Uo(e,t){let i=e[t];if(i!=="{"&&i!=="[")return null;let a=x(e,i,i==="{"?"}":"]",t);if(a===-1)return null;return{pattern:e.slice(t,a+1),endPos:a+1}}function Ho(e){let t=[],i=e.slice(1,-1).trim();if(!i)return t;let n=0,a=0,l="";while(n<i.length){let c=i[n];if(c==="{"||c==="["){let b=a===0?Uo(i,n):null;if(b){t.push(...Ho(b.pattern)),n=b.endPos,l="";continue}a++}else if(c==="}"||c==="]")a--;if(a>0){n++;continue}if(c===","){if(l.trim())t.push(l.trim());l="",n++;continue}if(c===":"){l="",n++;continue}if(c==="="){if(l.trim())t.push(l.trim());l="",n++;while(n<i.length&&i[n]!==","&&a===0){if(i[n]==="{"||i[n]==="[")a++;else if(i[n]==="}"||i[n]==="]")a--;n++}continue}if(/[\w$]/.test(c))l+=c;n++}if(l.trim())t.push(l.trim());return t}function ag(e){let t=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(e);if(!t)return null;let i=t[0].length,n=(a)=>a===" "||a==="\t";while(i<e.length&&n(e[i]))i++;if(e[i]===":"){let a=0,l=null;i++;for(;i<e.length;i++){let c=e[i];if(l){if(c==="\\"){i++;continue}if(c===l)l=null;continue}if(c==="'"||c==='"'||c==="`"){l=c;continue}if(c==="("||c==="["||c==="{"||c==="<"){a++;continue}if(c===")"||c==="]"||c==="}"||c===">"){a--;continue}if(c==="="&&a<=0){let b=e[i+1],v=e[i-1];if(b!=="="&&b!==">"&&v!=="="&&v!=="!"&&v!=="<"&&v!==">")break}}if(e[i]!=="=")return null}while(i<e.length&&n(e[i]))i++;if(e[i]!=="=")return null;return{type:t[1],name:t[2],value:e.slice(i+1).trim()}}function zo(e,t,i,n){let a=null,l=!1;for(let c of e){if(l){l=!1;continue}if(c==="\\"){l=!0;continue}if(a){if(c===a)a=null;continue}if(c==="'"||c==='"'||c==="`"){a=c;continue}if(c===t)n++;else if(c===i)n--}return n}function Bo(e,t){let i=e[t].trim(),n=ag(i),a=n?[i,n.type,n.name,n.value]:null;if(!a){let A=i.match(/^(?:export\s+)?(const|let|var)\s+/);if(A){let O=i.slice(A[0].length),H=t;if(O.startsWith("{")||O.startsWith("[")){let P=O[0],B=P==="{"?"}":"]",L=zo(O,P,B,0),F=O;for(let G=t+1;G<e.length&&L>0;G++)F+=` ${e[G].trim()}`,H=G,L=zo(e[G],P,B,L);if(L>0)F=O,H=t;O=F}let j=Uo(O,0);if(j){let P=A[1],B=j.pattern,L=O.slice(j.endPos).trim();if(L.startsWith("=")){let F=L.slice(1).trim(),G=F,D=Math.max(H,t);if(Wo(F)){let le=Fo(e,D,F);G=le.value,D=le.nextIndex}else D=D+1;G=G.trim().replace(/;$/,"");let ee=Ho(B),ne=`__stx_src_${t}`,te=ee.map((le)=>`module.exports.${le} = ${le};`).join(`
|
|
703
|
+
`);return{type:P,name:ne,value:`${G}; ${P} ${B} = ${ne};
|
|
704
704
|
${te}`,nextIndex:D}}}}throw Error(`Failed to parse variable declaration: ${i}`)}let[,l,c,b]=a,v=b,E=t;if(Wo(b)){let A=Fo(e,t,b);v=A.value,E=A.nextIndex}else E=t+1;while(E<e.length){let A=e[E].trim();if(A.startsWith(".")||A.startsWith("?."))v+=`
|
|
705
705
|
${e[E]}`,E++;else break}return v=v.trim().replace(/;$/,""),{type:l,name:c,value:v,nextIndex:E}}function ar(e,t){let i=e[t].trim(),n=i.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!n)throw Error(`Failed to parse function declaration: ${i}`);let[,a]=n,l=i.replace(/^export\s+/,""),c=t;if(gu(i)){let b=mu(e,t,l);l=b.functionCode,c=b.nextIndex}else c=t+1;return{name:a,functionCode:l,nextIndex:c}}function Wo(e){let t=e.trim();if(t.startsWith("{"))return x(t,"{","}",0)===-1;if(t.startsWith("["))return x(t,"[","]",0)===-1;return!qo(t)}function qo(e){let t={paren:0,bracket:0,brace:0},i=null,n=0;for(let a=0;a<e.length;a++){let l=e[a];if((a>0?e[a-1]:"")==="\\"&&i)continue;if((l==='"'||l==="'")&&!i){i=l;continue}if(l===i&&i!=="`"){i=null;continue}if(l==="`"&&!i){i="`";continue}if(l==="`"&&i==="`"&&n===0){i=null;continue}if(i==="`"&&l==="$"&&e[a+1]==="{"){n++,a++;continue}if(n>0&&l==="{"){n++;continue}if(n>0&&l==="}"){n--;continue}if(i)continue;if(l==="(")t.paren++;else if(l===")")t.paren--;else if(l==="[")t.bracket++;else if(l==="]")t.bracket--;else if(l==="{")t.brace++;else if(l==="}")t.brace--}return t.paren===0&&t.bracket===0&&t.brace===0&&i===null}function Zo(e){let t=e.indexOf("(");if(t===-1)return e.indexOf("{");let i=x(e,"(",")",t);if(i===-1)return-1;return e.indexOf("{",i)}function gu(e){let t=Zo(e);if(t===-1)return!0;return x(e,"{","}",t)===-1}function Fo(e,t,i){let n=i,a=t+1;while(a<e.length&&!qo(n)){let l=e[a];n+=`
|
|
706
706
|
${l}`,a++}while(a<e.length){let l=e[a].trim();if(l.startsWith(".")||l.startsWith("?."))n+=`
|
|
707
707
|
${e[a]}`,a++;else break}return{value:n,nextIndex:a}}function mu(e,t,i){let n=i,a=t+1;while(a<e.length){let l=Zo(n);if(l!==-1){if(x(n,"{","}",l)!==-1)break}let c=e[a];n+=`
|
|
708
|
-
${c}`,a++}return{functionCode:n,nextIndex:a}}function Vo(e,t){let i=u(e,t)??u(`(${e})`,t);if(i!==void 0)return i;if(!/\bprocess\b/.test(e))return;let n={...t,process:Object.freeze({env:{...
|
|
709
|
-
export{
|
|
708
|
+
${c}`,a++}return{functionCode:n,nextIndex:a}}function Vo(e,t){let i=u(e,t)??u(`(${e})`,t);if(i!==void 0)return i;if(!/\bprocess\b/.test(e))return;let n={...t,process:Object.freeze({env:{...Rt.env}})},a=Object.keys(n).filter(Bt),l=a.map((c)=>n[c]);try{return Function(...a,`'use strict'; return (${e});`)(...l)}catch{try{return Function(...a,`'use strict'; return ${e};`)(...l)}catch{return}}}async function hu(e,t,i){let n=e.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let l of n){let[,,c,b]=l;try{let v=b.trim().replace(/;$/,""),E=Vo(v,t);if(E!==void 0)t[c]=E}catch(v){console.warn(`Failed to parse export ${c} in fallback:`,v)}}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 l of a){let[,,c,b]=l;if(!(c in t))try{let v=b.trim().replace(/;$/,""),E=Vo(v,t);if(E!==void 0)t[c]=E}catch{}}}function Kc(e){let t=e.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),i=t?t[1]:"",n=t?e.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):e;return{scriptContent:i,templateWithoutScript:n}}function Xc(e){let t=e.trim();if(!t)return!1;return/(?:const|let|var|function)\s+\w+/.test(t)}
|
|
709
|
+
export{Ie,xe,V,Ps,Is,U,yr,Os,Ns,ii,ai,Ms,ci,Ac,At,Oe,o,pn,w,Pc,S,br,Ds,Se,C,Ne,pe,wr,li,q,fn,Me,y,Ic,fe,J,vr,xr,ie,Pt,Y,N,st,Sr,kr,It,ui,Ls,eg,De,Oc,Nc,Mc,di,Dc,js,pi,Lc,jc,fi,gi,gn,Bs,mn,Ot,Nt,Bc,Fs,Fc,zc,hn,_r,zs,Hs,Hc,mi,Vc,Uc,Wc,qc,yn,tg,ng,rg,sg,og,m,ig,hi,ag,Kc,Xc,yi,bi,cg,Mt,Gc,lg,Jc,Yh,Le,bn,je,ug,dg,pg,fg,gg,Vs,mg,Be,Z,Fe,hg,Cr,yg,Yc,Zc,wi,ze,s,wn,Qc,h,ge,Zh,el,tl,nl,vi,Us,bg,Qh,wg,ey,Dt,p,W,Q,vn,ke,vg,xi,xg,ty,_,Sg,ny,R,ry};
|