@stacksjs/stx 0.2.782 → 0.2.784
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-fj7tedrt.js → chunk-03zdbm2r.js} +1 -1
- package/dist/chunk-0d8vq9dz.js +2 -0
- package/dist/{chunk-7r1tcffk.js → chunk-10az8e1m.js} +2 -2
- package/dist/{chunk-qgy1w573.js → chunk-1165h1nv.js} +1 -1
- package/dist/{chunk-gpt1v08p.js → chunk-16yv309r.js} +1 -1
- package/dist/{chunk-mx0a1ax8.js → chunk-1gt56hdz.js} +1 -1
- package/dist/{chunk-m60qqnt6.js → chunk-1kxj9mh7.js} +1 -1
- package/dist/chunk-1p8rbjf9.js +2 -0
- package/dist/{chunk-djqx359s.js → chunk-2303xycv.js} +1 -1
- package/dist/chunk-32s07ych.js +2 -0
- package/dist/{chunk-dd12079e.js → chunk-3q807nyz.js} +1 -1
- package/dist/{chunk-41gq8324.js → chunk-5hy66mfn.js} +4 -4
- package/dist/{chunk-t6z2ty9v.js → chunk-5r1rdpeg.js} +2 -2
- package/dist/{chunk-p5qtdqdt.js → chunk-5rf2j30w.js} +1 -1
- package/dist/{chunk-1dp83080.js → chunk-64gbacyk.js} +1 -1
- package/dist/{chunk-dfn9cp6v.js → chunk-7k27y6z1.js} +1 -1
- package/dist/{chunk-f9rtfd58.js → chunk-7v0psycp.js} +1 -1
- package/dist/chunk-7xh512ta.js +2 -0
- package/dist/chunk-8ge4x4yx.js +2 -0
- package/dist/{chunk-dnk3ahmm.js → chunk-8rn1m9d1.js} +1 -1
- package/dist/{chunk-ay2by639.js → chunk-9j4xbeqs.js} +1 -1
- package/dist/{chunk-zbeaatev.js → chunk-asbpp9m0.js} +1 -1
- package/dist/{chunk-rvvc4twc.js → chunk-bc91m8x8.js} +1 -1
- package/dist/{chunk-311q3pa2.js → chunk-dqpqc5ps.js} +1 -1
- package/dist/{chunk-3xzzzrhw.js → chunk-e22v0ad2.js} +1 -1
- package/dist/{chunk-x2c3mjey.js → chunk-ert36h3v.js} +2 -2
- package/dist/{chunk-mhmphbve.js → chunk-fs0nrg7g.js} +5 -5
- package/dist/chunk-g2gk5qen.js +3 -0
- package/dist/chunk-ghn1y4ky.js +2 -0
- package/dist/chunk-ghxsmeh8.js +2 -0
- package/dist/chunk-gt8n286r.js +2 -0
- package/dist/{chunk-1p8r3w08.js → chunk-h5tjm191.js} +1 -1
- package/dist/chunk-hp44x2dq.js +2 -0
- package/dist/{chunk-p23rgrsc.js → chunk-j288z01t.js} +2 -2
- package/dist/{chunk-yewd8836.js → chunk-j2qv5ra2.js} +9 -4
- package/dist/{chunk-xqa9ze06.js → chunk-jqnkcekm.js} +1 -1
- package/dist/{chunk-4q4vexpc.js → chunk-k86mzdbd.js} +1 -1
- package/dist/{chunk-kkkpgnj3.js → chunk-kcfvdw3r.js} +1 -1
- package/dist/chunk-kv9qbqr9.js +2 -0
- package/dist/{chunk-avwsq94a.js → chunk-kzn32p5w.js} +1 -1
- package/dist/{chunk-a623wybr.js → chunk-mcxk1ajm.js} +16 -16
- package/dist/{chunk-km0tqwx1.js → chunk-n70ry0hg.js} +4 -4
- package/dist/{chunk-smsjcnvm.js → chunk-ne3hamzf.js} +1 -1
- package/dist/{chunk-q9w8rfve.js → chunk-nw355jn6.js} +1 -1
- package/dist/{chunk-fkn08jb3.js → chunk-nzec39ym.js} +1 -1
- package/dist/{chunk-axs1wrkr.js → chunk-p3t400qx.js} +3 -3
- package/dist/{chunk-de9dkzwy.js → chunk-p8185yw2.js} +1 -1
- package/dist/{chunk-ry7w14ax.js → chunk-p9gkz451.js} +4 -4
- package/dist/{chunk-xcrrsq09.js → chunk-pagra8jv.js} +1 -1
- package/dist/{chunk-v1eakek3.js → chunk-qbtb9pwe.js} +1 -1
- package/dist/{chunk-7086efsc.js → chunk-rn9m8bmc.js} +1 -1
- package/dist/{chunk-ppnc68ta.js → chunk-rtam1h61.js} +1 -1
- package/dist/{chunk-5smaktgt.js → chunk-s2cj9jq6.js} +1 -1
- package/dist/{chunk-y2q9f262.js → chunk-sckd8v0d.js} +1 -1
- package/dist/{chunk-13zfxwej.js → chunk-skn2n8jt.js} +2 -2
- package/dist/{chunk-qtcxy3y3.js → chunk-t619ap22.js} +1 -1
- package/dist/{chunk-abzp0cp9.js → chunk-tshgbpwy.js} +1 -1
- package/dist/{chunk-187s3a84.js → chunk-v4a9dv4h.js} +1 -1
- package/dist/chunk-vasw2fn4.js +2 -0
- package/dist/{chunk-209674ms.js → chunk-wfefjm2x.js} +2 -2
- package/dist/{chunk-267wdqtr.js → chunk-wphv66vs.js} +2 -2
- package/dist/{chunk-2skv6cr7.js → chunk-ww636tcm.js} +1 -1
- package/dist/{chunk-r0g70zrf.js → chunk-wx6h1xs3.js} +6 -6
- package/dist/{chunk-2kztshb4.js → chunk-x5a7sm43.js} +1 -1
- package/dist/{chunk-6mdpttxy.js → chunk-xzb6gaq4.js} +1 -1
- package/dist/chunk-z9wzmdvp.js +2 -0
- package/dist/cli.js +7 -7
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/native/compiler/headwind-to-style.d.ts +6 -1
- package/dist/native/compiler/headwind-to-style.js +17 -0
- package/dist/native/compiler/style-variables.js +3 -0
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-02z88h3r.js +0 -2
- package/dist/chunk-62xcwhfd.js +0 -2
- package/dist/chunk-fmzdvgka.js +0 -2
- package/dist/chunk-g9makcfg.js +0 -2
- package/dist/chunk-m68scqz0.js +0 -2
- package/dist/chunk-mpny7cmd.js +0 -2
- package/dist/chunk-pwetf855.js +0 -2
- package/dist/chunk-vdx4zfq1.js +0 -2
- package/dist/chunk-wbhv5137.js +0 -3
- package/dist/chunk-y209b8ch.js +0 -2
- package/dist/chunk-z04f6fy2.js +0 -2
- package/dist/chunk-z5pvmtd7.js +0 -2
- package/dist/chunk-z79s860q.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{de,Mc,js,mn,m,Me,Le}from"./chunk-
|
|
2
|
+
import{de,Mc,js,mn,m,Me,Le}from"./chunk-wx6h1xs3.js";import{dr,Qe,j}from"./chunk-skn2n8jt.js";import{tr,i}from"./chunk-5hy66mfn.js";import{we}from"./chunk-p9gkz451.js";function b(s){return s.endsWith(".md")||s.endsWith(".markdown")}function k(s){let e=[];g(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];g(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function g(n,p){let u;while((u=n.exec(s))!==null){let t=u.index,o=t+u[0].length;if(p?.some((l)=>t>=l.start&&o<=l.end))continue;e.push({start:t,end:o})}}if(e.length===0)return s;e.sort((n,p)=>n.start-p.start);let c="",a=0;for(let n of e){if(n.start<a)continue;c+=s.slice(a,n.start),c+=`@raw${s.slice(n.start,n.end)}@endraw`,a=n.end}return c+=s.slice(a),c}async function R(s,e={}){let{data:r,content:g}=dr(s),a=await(e.renderer??((n)=>Qe(n)))(g);return{html:k(a),frontmatter:r??{}}}import{dirname as v,resolve as _}from"path";function M(s){let e=s,r=de(s);if(r)e=r.content.trim();let g=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,c=[],a=[],n=[],p=(o)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(o),u;while((u=g.exec(s))!==null){let o=u[1],l=u[2],d=u[0],f=o.includes("server");if(p(l))n.push(d);else if(f)a.push(l);else c.push(d)}let t=e;{let o=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,d=[];while((l=o.exec(t))!==null){let f=l.index+l[0].length,x=t.indexOf("</script>",f);if(x===-1)continue;d.push({start:l.index,end:x+9}),o.lastIndex=x+9}for(let f=d.length-1;f>=0;f--)t=t.substring(0,d[f].start)+t.substring(d[f].end)}for(let o of c)t=t.replace(o,"");return{templateContent:t,serverScripts:a,clientScripts:c,signalsScripts:n}}function E(s,e){return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -14,5 +14,5 @@ ${a.join(`
|
|
|
14
14
|
`)}`}else{if(r.processClientScripts!==!1&&a.length>0){let o=p.__stx_event_bindings||[],l=Me(p),d=await Promise.all(a.map(async(w)=>{let C=w.match(/<script\b([^>]*)>/i)?.[1]||"";if(/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(C))return w;let h=w.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!h)return w;return await Le(h[1],{eventBindings:o,templateContent:t,serverData:l,filePath:e})})),x=[await tr(d,{...n,buildMode:"compile"}),...d].filter(Boolean).join(`
|
|
15
15
|
`);if(t.match(/(<\/body>)/i))t=t.replace(/(<\/body>)/i,`${x}
|
|
16
16
|
$1`);else t+=`
|
|
17
|
-
${x}`}t=await we(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=E(t,r.title)}if(r.injectCSS)try{let{injectCss:o}=await import("./chunk-
|
|
17
|
+
${x}`}t=await we(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=E(t,r.title)}if(r.injectCSS)try{let{injectCss:o}=await import("./chunk-7k27y6z1.js");t=await o(t)}catch{}return t}
|
|
18
18
|
export{Ka};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{f,d}from"./chunk-bq9xf8nq.js";import{J,I,p}from"./chunk-
|
|
2
|
+
import{f,d}from"./chunk-bq9xf8nq.js";import{J,I,p}from"./chunk-wx6h1xs3.js";function z(t,o){let i=1,r=o,e="<template",n="</template";while(r<t.length&&i>0){let s=t.indexOf("<",r);if(s===-1)break;if(r=s,t.startsWith(e,r)&&(r+e.length>=t.length||/[\s>\/]/.test(t[r+e.length]))){i++,r+=e.length;continue}if(t.startsWith(n,r)){let a=t.indexOf(">",r+n.length);if(a!==-1){if(i--,i===0)return a+1;r=a+1;continue}}r++}return i===0?r:-1}var N=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function k(t,o){let i=null;for(let r=o;r<t.length;r++){let e=t[r];if(i){if(e==="\\"){r++;continue}if(e===i)i=null;continue}if(e==='"'||e==="'"){i=e;continue}if(e===">")return r+1}return-1}function B(t,o,i){let r=o.toLowerCase(),e=1,n=i;while(n<t.length){let s=t.indexOf("<",n);if(s===-1)return-1;if(t.startsWith("<!--",s)){let g=t.indexOf("-->",s+4);n=g===-1?t.length:g+3;continue}let a=k(t,s+1);if(a===-1)return-1;let u=t.slice(s,a),c=u.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(c&&c[2].toLowerCase()===r){if(c[1]==="/"){if(e--,e===0)return a}else if(!/\/\s*>$/.test(u))e++}n=a}return-1}function Z(t){let o=[],i=[],r=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=k(t,n+1);if(s===-1)break;let a=t.slice(n,s),u=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!u){e=s;continue}let c=u[2].toLowerCase();if(u[1]==="/"){let l=i.lastIndexOf(c);if(l!==-1)i.splice(l);e=s;continue}let g=/\/\s*>$/.test(a),m=i.length===0?a.match(r):null;if(m){let l=m[1]||m[2],h=a.replace(r,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),S=g||N.has(c)?-1:B(t,c,s);if(S===-1)o.push({start:n,end:s,slotName:l,element:h}),e=s;else o.push({start:n,end:S,slotName:l,element:h+t.slice(s,S)}),e=S;continue}if(!g&&!N.has(c)){if(i.push(c),c==="script"||c==="style"){let l=t.toLowerCase().indexOf(`</${c}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function L(t){let o=[],i=[],r=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=k(t,n+1);if(s===-1)break;let a=t.slice(n,s),u=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!u){e=s;continue}let c=u[1]==="/",g=u[2].toLowerCase();if(c){let l=i.lastIndexOf(g);if(l!==-1)i.splice(l);e=s;continue}if(g==="template"&&i.length===0){let l=a.match(r);if(l){let h=z(t,s);if(h!==-1){let S=l[1]||l[2]||l[3];o.push({start:n,end:h,slotName:S,content:t.slice(s,h-11).trim(),propsBinding:l[4]||void 0}),e=h;continue}}}if(!/\/\s*>$/.test(a)&&!N.has(g)){if(i.push(g),g==="script"||g==="style"){let l=t.toLowerCase().indexOf(`</${g}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function Bl(t){let o={default:"",named:new Map},i=t,r=L(t);for(let n of r)o.named.set(n.slotName,{name:n.slotName,content:n.content,propsBinding:n.propsBinding});r.sort((n,s)=>s.start-n.start);for(let n of r)i=i.slice(0,n.start)+i.slice(n.end);let e=Z(i);for(let n of e){let s=o.named.get(n.slotName);if(s)s.content+=n.element;else o.named.set(n.slotName,{name:n.slotName,content:n.element})}for(let n=e.length-1;n>=0;n--){let s=e[n];i=i.slice(0,s.start)+i.slice(s.end)}return o.default=i.trim(),o}function um(t){let o=t.match(/name\s*=\s*["']([^"']+)["']/),i=o?o[1]:"",r={},e=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,n;while((n=e.exec(t))!==null)r[n[1]]=n[2];let s=t.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),a=s?s[1].trim():"";return{name:i,props:r,defaultContent:a}}async function Fl(t,o,i,r){if(!t)return i;let e=t.content;if(t.propsBinding&&Object.keys(o).length>0){let n=t.propsBinding.trim(),s={...r},a=new Set,u=new Set;if(n.startsWith("{")&&n.endsWith("}")){let c=n.slice(1,-1).split(",").map((g)=>g.trim()).filter(Boolean);for(let g of c){let[m,l]=g.split(":").map((S)=>S.trim()),h=l||m;if(s[h]=o[m],o[m]!==void 0)u.add(h);else a.add(h)}}else if(s[n]=o,Object.values(o).some((c)=>c===void 0))a.add(n);else u.add(n);e=j(e,s,a,u)}return e}function j(t,o,i,r){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(e,n)=>{try{let s=n.trim();if(I(s,i))return e;if(Array.isArray(o.__stx_preserved_client_expressions)&&o.__stx_preserved_client_expressions.includes(s)&&!I(s,r))return e;let a=_(s,o);if(a===void 0)return e;return p(String(a??""))}catch{return`{{ ${n} }}`}})}function _(t,o){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(t)){let r=t.split("."),e=o;for(let n of r)if(e&&typeof e==="object"&&n in e)e=e[n];else return;return e}let i=t.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(i){let[,r,e,n]=i,s=o[r],a=parseInt(n,10);if(typeof s==="number")switch(e){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":return s/a}}try{if(!f(t))return;return d(t,Object.keys(o))(...Object.values(o))}catch{return}}async function zl(t,o,i,r){let e=t;e=await W(e,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(a,u,c,g)=>{let m=o.named.get(u),l=g?.trim()||"",h=c||"",S={},E=[],C=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,b;while((b=C.exec(h))!==null){let w=b[1],x=b[2];S[w]=_(x,i),E.push([w,x])}if(r!==void 0&&m?.propsBinding&&Object.values(S).some((w)=>w===void 0)){let w=m.propsBinding.trim(),x=J(`${w} in []`),y="__stx_slot_props";while(x.includes(y))y+="_";let M=E.map(([A,P])=>{let O=S[A],R;try{R=O===void 0?void 0:JSON.stringify(O)}catch{}return`${JSON.stringify(A)}:(${R??P})`}).join(","),v=p(JSON.stringify({binding:w,names:x,owner:r}));return`<template :for="${p(`${y} in [{${M}}]`)}" data-stx-slot-binding="${encodeURIComponent(w)}" data-stx-slot-scope="${v}">${m.content}</template>`}return await Fl(m,S,l,i)});let s=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return e=e.replace(s,(a,u,c)=>{if(/\bname\s*=/.test(u||""))return a;let g=c?.trim()||"";return o.default||g}),e}async function W(t,o,i){let r=[],e=[];t.replace(o,(a,...u)=>{let c=u[u.length-2];return e.push({match:a,index:c}),r.push(i(a,...u.slice(0,-2))),a});let n=await Promise.all(r),s=t;for(let a=e.length-1;a>=0;a--){let{match:u,index:c}=e[a];s=s.slice(0,c)+n[a]+s.slice(c+u.length)}return s}function dm(t){let o=Bl(t);return{defaultSlot:o.default,namedSlots:o.named}}async function pm(t,o,i,r,e){return await zl(t,{default:o,named:i},r,e)}
|
|
3
3
|
export{Bl,um,Fl,zl,dm,pm};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ze,xn,Vs,vi,O}from"./chunk-27rzdq3n.js";import{vn}from"./chunk-1dp83080.js";import{Or,k,al,at,$i,cl}from"./chunk-9f6qx8b9.js";import{A}from"./chunk-2yxva96k.js";import{Us,u,f,jt,d,q,B,w,Xs,_e,Ve,Gs}from"./chunk-bq9xf8nq.js";import{s,ge}from"./chunk-m4mpyq3d.js";import{g}from"./chunk-0dve54ne.js";import{K}from"./chunk-bmfk3b29.js";import Ge from"path";import kt from"process";import{AsyncLocalStorage as zo}from"async_hooks";var fr=new zo;function mn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function dr(e,n){return fr.run(mn(e),n)}async function pr(e,n){let t=fr.getStore();if(!t)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let i=t.pending.get(e);if(i)return i;let a=Promise.resolve().then(n).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}),y=JSON.parse(c);return t.values.set(e,y),y}).catch((l)=>{throw t.pending.delete(e),l});return t.pending.set(e,a),a}function _r(e){let n=e.__stx_server_data;if(!n?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(n.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function z(e,n=!1){let t=s(e),i=[],a=new Set,l=0,c=0,y=t.length,v=()=>{if(l!==0)return;let E=t.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(E){if(n&&E[1]==="const")return;let P=E[2];if(!a.has(P))i.push(P),a.add(P);return}let R=t.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(R){if(n&&t.slice(c).startsWith("const"))return;R[1].split(",").forEach((P)=>{let D=P.trim();if(!D)return;let X=D.indexOf(":"),L=(X>=0?D.slice(X+1).trim():D).split(/[\s=]/)[0];if(L&&!a.has(L))i.push(L),a.add(L)});return}let M=t.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(M){if(n&&t.slice(c).startsWith("const"))return;M[1].split(",").forEach((P)=>{let D=P.trim().replace(/^\.\.\./,"");if(!D)return;let X=D.split(/[\s=]/)[0];if(X&&!a.has(X))i.push(X),a.add(X)});return}if(n)return;let N=t.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(N){let P=N[1];if(!a.has(P))i.push(P),a.add(P);return}let j=t.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))i.push(P),a.add(P)}};while(c<y){if(t[c]==="{"){l++,c++;continue}if(t[c]==="}"){l--,c++;continue}if(l===0&&/[a-z]/i.test(t[c])&&(c===0||/\s|[;{}()]/.test(t[c-1])))v();c++}return i.join(", ")}function As(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function Wo(e,n=z(e).split(",").map((t)=>t.trim()).filter(Boolean)){let t=new Set(z(e,!0).split(",").map((i)=>i.trim()));return n.map((i)=>t.has(i)?`get ${i}() { return ${i} }, set ${i}(__stxValue_${i}) { ${i} = __stxValue_${i} }`:i).join(", ")}function Ps(e,n){let t=`{ ${Wo(e,n)} }`;return z(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${t}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:t}import On from"fs";import We from"path";function H(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var gr=new Map;function yr(e,n=!0){let t=gr.get(e);if(n&&t)return t;let i=new Map,a=[We.join(e,"src"),We.join(e,"dist"),e];function l(c,y){if(y>6)return;let v;try{v=On.readdirSync(c,{withFileTypes:!0})}catch{return}for(let E of v){let R=We.join(c,E.name);if(E.isDirectory()){if(E.name==="node_modules"||E.name.startsWith("."))continue;l(R,y+1)}else if(E.isFile()&&E.name.endsWith(".stx")){let M=E.name.slice(0,-4);if(!i.has(M))i.set(M,R);let N=M.toLowerCase();if(!i.has(N))i.set(N,R);let j=H(M);if(!i.has(j))i.set(j,R)}}}for(let c of a)if(l(c,0),i.size>0)break;if(n)gr.set(e,i);return i}function Is(e,n){if(e.startsWith(".")||e.startsWith("/"))return null;let t=n;while(!0){let i=We.join(t,"node_modules",e);try{if(On.statSync(i).isDirectory())return i}catch{}let a=We.dirname(t);if(a===t)return null;t=a}}function Os(e,n,t={}){return[We.resolve(We.dirname(n),`${e}.stx`),We.resolve(We.dirname(n),e),We.resolve(t.componentsDir||"components",`${e}.stx`),We.resolve(t.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function mr(e){let n=e.endsWith(".stx")?e.slice(0,-4):e,t=n.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),i=H(n);return[n,t,i]}function ri(e,n){let[t,i,a]=mr(e);for(let l of[t,t.toLowerCase(),i,a]){let c=n?.__importedComponents?.get(l);if(c!==void 0)return c}}function*si(e,n,t={},i){let a=mr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield We.resolve(We.dirname(n),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],c=t.projectRoot||process.cwd(),y=[...i?.__originalFilePath?[We.join(We.dirname(i.__originalFilePath),"components")]:[],...t.componentsDir?[t.componentsDir]:[],We.join(We.dirname(n),"components"),We.resolve(c,"src/components"),We.resolve(c,"components"),...import.meta.dir?[We.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(y)){for(let E of l)yield We.join(v,E);try{for(let E of On.readdirSync(v,{withFileTypes:!0}))if(E.isDirectory())for(let R of l)yield We.join(v,E.name,R)}catch{}}}function hr(e,n,t={},i){let a=ri(e,i);if(a!==void 0)return a;for(let l of si(e,n,t,i))try{if(On.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Ns(e,n=[],t={}){let i=new Set([...e].map((E)=>E.replace(/[-_]/g,"").toLowerCase()));if(!i.has("src")||!i.has("alt")&&!i.has("decorative"))return!1;let a=new Map(Object.entries(t).map(([E,R])=>[E.replace(/[-_]/g,"").toLowerCase(),R])),l=a.get("alt"),c=a.get("decorative"),y=typeof l==="string"&&!!l.trim(),v=typeof c==="string"?!["false","0","off","no"].includes(c.trim().toLowerCase()):Boolean(c);if(!y&&!v)return!1;if(["source","resizemode","defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((E)=>i.has(E)))return!1;if([...n].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)=>i.has(E))}import Jn from"fs";import ce from"path";import ht from"path";import qt from"fs";var Fo=new Set(["touchstart","touchmove","wheel","mousewheel"]);function ls(e,n){if(n.passive)return!0;if(n.prevent||n.nonpassive)return!1;return Fo.has(e.toLowerCase())}var $r=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"]),Er={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"},Vo=new Set(["ctrl","alt","shift","meta"]),Ar={left:0,middle:1,right:2};function Rr(e){let n={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let t of e){let i=t.toLowerCase();if(i==="prevent")n.prevent=!0;else if(i==="stop")n.stop=!0;else if(i==="once")n.once=!0;else if(i==="capture")n.capture=!0;else if(i==="self")n.self=!0;else if(i==="passive")n.passive=!0;else if(i==="nonpassive")n.nonpassive=!0;else if(Vo.has(i))n.systemKeys.push(i);else if(i in Ar)n.mouse=i;else if(i in Er||/^[a-z]$/.test(i))n.keys.push(Er[i]||i.toUpperCase());else if(i.startsWith("debounce")){let a=i.match(/debounce(?:\.(\d+))?/);n.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(i.startsWith("throttle")){let a=i.match(/throttle(?:\.(\d+))?/);n.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return n}function Ir(e,n=""){let t=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[c,y,v]=l,E=l.index,R=E+c.length,M=`__stx_evt_${n}${i++}`,N=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,P;while((P=j.exec(v))!==null){let[,X,F]=P,L=X.split("."),Q=L[0];if(!$r.has(Q))continue;N.push({attribute:`@${X}`,event:Q,handler:F,modifiers:Rr(L.slice(1)),elementId:M})}let D=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((P=D.exec(v))!==null){let[,X,F]=P,L=X.split("."),Q=L[0];if(!$r.has(Q))continue;N.push({attribute:`@${X}`,event:Q,handler:F,modifiers:Rr(L.slice(1)),elementId:M})}if(N.length>0)t.push({originalTag:c,elementId:M,events:N,startIndex:E,endIndex:R})}return t}function Uo(e){let n=[],{modifiers:t}=e;if(t.self)n.push("if ($event.target !== $el) return");for(let i of t.systemKeys)n.push(`if (!$event.${i}Key) return`);if(t.keys.length>0){let i=t.keys.map((a)=>`$event.key === '${a}'`).join(" || ");n.push(`if (!(${i})) return`)}if(t.mouse!==null){let i=Ar[t.mouse];n.push(`if ($event.button !== ${i}) return`)}if(t.prevent)n.push("$event.preventDefault()");if(t.stop)n.push("$event.stopPropagation()");return n.join("; ")}function Ho(e,n){let t=e;if(n.debounce!==null)t=`__stx_debounce(() => { ${t} }, ${n.debounce})`;else if(n.throttle!==null)t=`__stx_throttle(() => { ${t} }, ${n.throttle})`;return t}function us(e){let n=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(n))return e;return`if (typeof ${n} === 'function' && !${n}._isSignal) ${n}($event);`}function Ko(e){let{modifiers:n}=e,t=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=Uo(e),a=Ho(us(e.handler),n),l=[];if(n.once)l.push("once: true");if(n.capture)l.push("capture: true");if(ls(e.event,n))l.push("passive: true");let c=l.length>0?`, { ${l.join(", ")} }`:"",y=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
|
|
2
|
+
import{ze,xn,Vs,vi,O}from"./chunk-27rzdq3n.js";import{vn}from"./chunk-64gbacyk.js";import{Or,k,al,at,$i,cl}from"./chunk-9f6qx8b9.js";import{A}from"./chunk-2yxva96k.js";import{Us,u,f,jt,d,q,B,w,Xs,_e,Ve,Gs}from"./chunk-bq9xf8nq.js";import{s,ge}from"./chunk-m4mpyq3d.js";import{g}from"./chunk-0dve54ne.js";import{K}from"./chunk-bmfk3b29.js";import Ge from"path";import kt from"process";import{AsyncLocalStorage as zo}from"async_hooks";var fr=new zo;function mn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function dr(e,n){return fr.run(mn(e),n)}async function pr(e,n){let t=fr.getStore();if(!t)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let i=t.pending.get(e);if(i)return i;let a=Promise.resolve().then(n).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}),y=JSON.parse(c);return t.values.set(e,y),y}).catch((l)=>{throw t.pending.delete(e),l});return t.pending.set(e,a),a}function _r(e){let n=e.__stx_server_data;if(!n?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(n.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function z(e,n=!1){let t=s(e),i=[],a=new Set,l=0,c=0,y=t.length,v=()=>{if(l!==0)return;let E=t.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(E){if(n&&E[1]==="const")return;let P=E[2];if(!a.has(P))i.push(P),a.add(P);return}let R=t.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(R){if(n&&t.slice(c).startsWith("const"))return;R[1].split(",").forEach((P)=>{let D=P.trim();if(!D)return;let X=D.indexOf(":"),L=(X>=0?D.slice(X+1).trim():D).split(/[\s=]/)[0];if(L&&!a.has(L))i.push(L),a.add(L)});return}let M=t.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(M){if(n&&t.slice(c).startsWith("const"))return;M[1].split(",").forEach((P)=>{let D=P.trim().replace(/^\.\.\./,"");if(!D)return;let X=D.split(/[\s=]/)[0];if(X&&!a.has(X))i.push(X),a.add(X)});return}if(n)return;let N=t.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(N){let P=N[1];if(!a.has(P))i.push(P),a.add(P);return}let j=t.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))i.push(P),a.add(P)}};while(c<y){if(t[c]==="{"){l++,c++;continue}if(t[c]==="}"){l--,c++;continue}if(l===0&&/[a-z]/i.test(t[c])&&(c===0||/\s|[;{}()]/.test(t[c-1])))v();c++}return i.join(", ")}function As(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function Wo(e,n=z(e).split(",").map((t)=>t.trim()).filter(Boolean)){let t=new Set(z(e,!0).split(",").map((i)=>i.trim()));return n.map((i)=>t.has(i)?`get ${i}() { return ${i} }, set ${i}(__stxValue_${i}) { ${i} = __stxValue_${i} }`:i).join(", ")}function Ps(e,n){let t=`{ ${Wo(e,n)} }`;return z(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${t}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:t}import On from"fs";import We from"path";function H(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var gr=new Map;function yr(e,n=!0){let t=gr.get(e);if(n&&t)return t;let i=new Map,a=[We.join(e,"src"),We.join(e,"dist"),e];function l(c,y){if(y>6)return;let v;try{v=On.readdirSync(c,{withFileTypes:!0})}catch{return}for(let E of v){let R=We.join(c,E.name);if(E.isDirectory()){if(E.name==="node_modules"||E.name.startsWith("."))continue;l(R,y+1)}else if(E.isFile()&&E.name.endsWith(".stx")){let M=E.name.slice(0,-4);if(!i.has(M))i.set(M,R);let N=M.toLowerCase();if(!i.has(N))i.set(N,R);let j=H(M);if(!i.has(j))i.set(j,R)}}}for(let c of a)if(l(c,0),i.size>0)break;if(n)gr.set(e,i);return i}function Is(e,n){if(e.startsWith(".")||e.startsWith("/"))return null;let t=n;while(!0){let i=We.join(t,"node_modules",e);try{if(On.statSync(i).isDirectory())return i}catch{}let a=We.dirname(t);if(a===t)return null;t=a}}function Os(e,n,t={}){return[We.resolve(We.dirname(n),`${e}.stx`),We.resolve(We.dirname(n),e),We.resolve(t.componentsDir||"components",`${e}.stx`),We.resolve(t.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function mr(e){let n=e.endsWith(".stx")?e.slice(0,-4):e,t=n.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),i=H(n);return[n,t,i]}function ri(e,n){let[t,i,a]=mr(e);for(let l of[t,t.toLowerCase(),i,a]){let c=n?.__importedComponents?.get(l);if(c!==void 0)return c}}function*si(e,n,t={},i){let a=mr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield We.resolve(We.dirname(n),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],c=t.projectRoot||process.cwd(),y=[...i?.__originalFilePath?[We.join(We.dirname(i.__originalFilePath),"components")]:[],...t.componentsDir?[t.componentsDir]:[],We.join(We.dirname(n),"components"),We.resolve(c,"src/components"),We.resolve(c,"components"),...import.meta.dir?[We.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(y)){for(let E of l)yield We.join(v,E);try{for(let E of On.readdirSync(v,{withFileTypes:!0}))if(E.isDirectory())for(let R of l)yield We.join(v,E.name,R)}catch{}}}function hr(e,n,t={},i){let a=ri(e,i);if(a!==void 0)return a;for(let l of si(e,n,t,i))try{if(On.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Ns(e,n=[],t={}){let i=new Set([...e].map((E)=>E.replace(/[-_]/g,"").toLowerCase()));if(!i.has("src")||!i.has("alt")&&!i.has("decorative"))return!1;let a=new Map(Object.entries(t).map(([E,R])=>[E.replace(/[-_]/g,"").toLowerCase(),R])),l=a.get("alt"),c=a.get("decorative"),y=typeof l==="string"&&!!l.trim(),v=typeof c==="string"?!["false","0","off","no"].includes(c.trim().toLowerCase()):Boolean(c);if(!y&&!v)return!1;if(["source","resizemode","defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((E)=>i.has(E)))return!1;if([...n].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)=>i.has(E))}import Jn from"fs";import ce from"path";import ht from"path";import qt from"fs";var Fo=new Set(["touchstart","touchmove","wheel","mousewheel"]);function ls(e,n){if(n.passive)return!0;if(n.prevent||n.nonpassive)return!1;return Fo.has(e.toLowerCase())}var $r=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"]),Er={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"},Vo=new Set(["ctrl","alt","shift","meta"]),Ar={left:0,middle:1,right:2};function Rr(e){let n={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let t of e){let i=t.toLowerCase();if(i==="prevent")n.prevent=!0;else if(i==="stop")n.stop=!0;else if(i==="once")n.once=!0;else if(i==="capture")n.capture=!0;else if(i==="self")n.self=!0;else if(i==="passive")n.passive=!0;else if(i==="nonpassive")n.nonpassive=!0;else if(Vo.has(i))n.systemKeys.push(i);else if(i in Ar)n.mouse=i;else if(i in Er||/^[a-z]$/.test(i))n.keys.push(Er[i]||i.toUpperCase());else if(i.startsWith("debounce")){let a=i.match(/debounce(?:\.(\d+))?/);n.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(i.startsWith("throttle")){let a=i.match(/throttle(?:\.(\d+))?/);n.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return n}function Ir(e,n=""){let t=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[c,y,v]=l,E=l.index,R=E+c.length,M=`__stx_evt_${n}${i++}`,N=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,P;while((P=j.exec(v))!==null){let[,X,F]=P,L=X.split("."),Q=L[0];if(!$r.has(Q))continue;N.push({attribute:`@${X}`,event:Q,handler:F,modifiers:Rr(L.slice(1)),elementId:M})}let D=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((P=D.exec(v))!==null){let[,X,F]=P,L=X.split("."),Q=L[0];if(!$r.has(Q))continue;N.push({attribute:`@${X}`,event:Q,handler:F,modifiers:Rr(L.slice(1)),elementId:M})}if(N.length>0)t.push({originalTag:c,elementId:M,events:N,startIndex:E,endIndex:R})}return t}function Uo(e){let n=[],{modifiers:t}=e;if(t.self)n.push("if ($event.target !== $el) return");for(let i of t.systemKeys)n.push(`if (!$event.${i}Key) return`);if(t.keys.length>0){let i=t.keys.map((a)=>`$event.key === '${a}'`).join(" || ");n.push(`if (!(${i})) return`)}if(t.mouse!==null){let i=Ar[t.mouse];n.push(`if ($event.button !== ${i}) return`)}if(t.prevent)n.push("$event.preventDefault()");if(t.stop)n.push("$event.stopPropagation()");return n.join("; ")}function Ho(e,n){let t=e;if(n.debounce!==null)t=`__stx_debounce(() => { ${t} }, ${n.debounce})`;else if(n.throttle!==null)t=`__stx_throttle(() => { ${t} }, ${n.throttle})`;return t}function us(e){let n=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(n))return e;return`if (typeof ${n} === 'function' && !${n}._isSignal) ${n}($event);`}function Ko(e){let{modifiers:n}=e,t=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=Uo(e),a=Ho(us(e.handler),n),l=[];if(n.once)l.push("once: true");if(n.capture)l.push("capture: true");if(ls(e.event,n))l.push("passive: true");let c=l.length>0?`, { ${l.join(", ")} }`:"",y=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('${t}');
|
|
5
5
|
if (!$el) return;
|
|
@@ -112,7 +112,7 @@ else {
|
|
|
112
112
|
`)}
|
|
113
113
|
})();
|
|
114
114
|
</script>`}function Zo(e,n=""){let t=Ir(e,n);if(t.length===0)return{template:e,bindings:[]};let i=e,a=[];for(let l=t.length-1;l>=0;l--){let c=t[l],y=c.originalTag;if(!y.includes(" id="))y=y.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${c.elementId}"`);else{let v=y.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,"\\$&"),R=new RegExp(`\\s*${E}\\s*=\\s*"[^"]*"`,"g"),M=new RegExp(`\\s*${E}\\s*=\\s*'[^']*'`,"g");y=y.replace(R,""),y=y.replace(M,"")}i=i.slice(0,c.startIndex)+y+i.slice(c.endIndex),a.push(...c.events)}return{template:i,bindings:a}}function Tr(e){let n=e.$uid;return typeof n==="string"&&n?`${n}_`:""}function Ec(e,n,t){if(cl(e))return e;if(n.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:y,bindings:v}=Zo(e,Tr(n)),E=n.__stx_event_bindings||[];return n.__stx_event_bindings=[...E,...v],y}let i=Ir(e,Tr(n));if(i.length===0)return e;let a=e;for(let y=i.length-1;y>=0;y--){let v=i[y],E=v.originalTag;if(!E.includes(" id="))E=E.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${v.elementId}"`);else{let R=E.match(/id=["']([^"']+)["']/);if(R)for(let M of v.events)M.elementId=R[1]}for(let R of v.events){let M=R.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),N=new RegExp(`\\s*${M}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${M}\\s*=\\s*'[^']*'`,"g");E=E.replace(N,""),E=E.replace(j,"")}a=a.slice(0,v.startIndex)+E+a.slice(v.endIndex)}let l=oi(i.flatMap((y)=>y.events)),c=a.lastIndexOf("</body>");if(c!==-1)a=a.slice(0,c)+l+`
|
|
115
|
-
`+a.slice(c);else a+=l;return a}function Pr(e,n){let t=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(n){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))t.add(a)}return t}function Rt(e,n){let t=s(e),{depths:i,balanced:a}=ge(t),l=(y)=>!a||i[y]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${n}\\b)`,"g");for(let y of t.matchAll(c)){let v=(y.index??0)+y[0].length-y[1].length;if(l(v))return!0}for(let y of t.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(y.index??0)&&Pr(y[1],!0).has(n))return!0;for(let y of t.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(y.index??0)&&Pr(y[1],!1).has(n))return!0;return!1}var Mr="",Pn,lt=/^[A-Za-z_$][\w$]*$/,qo=new Set(["if","for","while","switch","with"]),Dr=["(","[","{"],jr=[")","]","}"],Xo=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function Jo(e){let n=s(e),t=[];for(let i of n.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=i.index??0;t.push({text:i[0],start:a,end:a+i[0].length})}return{code:n,tokens:t}}function fs(e){if(Pn&&e===Mr)return Pn;let{code:n,tokens:t}=Jo(e),i=new Map,a=[];for(let P=0;P<t.length;P++){let D=t[P].text;if(["(","[","{"].includes(D))a.push(P);else if([")","]","}"].includes(D)){let X=a.at(-1);if(X!==void 0&&["()","[]","{}"].includes(t[X].text+D))a.pop(),i.set(X,P),i.set(P,X)}}function l(P,D){let X=[],F=P;for(let L=P;L<D;L++){if(["(","[","{"].includes(t[L].text)&&(i.get(L)??D)<D){L=i.get(L);continue}if(t[L].text===",")X.push([F,L]),F=L+1}return X.push([F,D]),X}let c=[];function y(P,D,X,F=!1){if(t[P]?.text==="...")P++;if(P>=D)return;let L=t[P].text;if(lt.test(L)){if(X.add(L),X===R)c.push({name:L,token:P,functionScoped:F});return}if(L!=="{"&&L!=="[")return;let Q=i.get(P);if(Q===void 0||Q>=D)return;for(let[te,ae]of l(P+1,Q)){let ne=te;if(L==="{")for(let ue=te;ue<ae;ue++){if(t[ue].text===":"){ne=ue+1;break}if(t[ue].text==="=")break;if(["(","[","{"].includes(t[ue].text)&&i.has(ue))ue=i.get(ue)}y(ne,ae,X,F)}}function v(P,D){let X=new Set;for(let[F,L]of l(P,D))y(F,L,X);return X}function E(P){let D=P;for(;D<t.length;D++){let X=t[D].text;if(["(","[","{"].includes(X)&&i.has(D)){D=i.get(D);continue}if([",",";",")","]","}"].includes(X))break}return t[Math.max(P,D-1)]?.end??n.length}let R=new Set,M=[];for(let P=0;P<t.length;P++)if(t[P].text==="=>"){let D=P-1,X=D,F;if(t[D]?.text===")"&&i.has(D))X=i.get(D),F=v(X+1,D);else if(t[D]&<.test(t[D].text))F=new Set([t[D].text]);else continue;let L=P+1,Q=t[L]?.text==="{"&&i.has(L)?t[i.get(L)].end:E(L);M.push({start:t[X].start,end:Q,bodyStart:t[L]?.start??Q,functionBody:!0,names:F})}else if(t[P].text==="("&&i.has(P)){let D=t[P-1]?.text;if(!D||qo.has(D)||!lt.test(D)&&D!=="*"&&D!=="]")continue;let X=i.get(P),F=X+1;if(t[F]?.text===":"){F++;while(F<t.length&&!["{","=>",";","="].includes(t[F].text))F++}if(t[F]?.text!=="{"||!i.has(F))continue;M.push({start:t[P].start,end:t[i.get(F)].end,bodyStart:t[F].start,functionBody:D!=="catch",names:v(P+1,X)})}function N(P){let D=P;for(;D<t.length;D++){let X=t[D].text;if(Dr.includes(X)&&i.has(D)){D=i.get(D);continue}if(X===";"||jr.includes(X))break;let F=t[D-1];if(D>P&&Xo.has(X)&&F.text!==".")break;if(D>P&&/[\n\r]/.test(n.slice(F.end,t[D].start))&&(/^[\w$]+$/.test(F.text)||jr.includes(F.text)||['"',"'","`"].includes(F.text))&<.test(X)&&!["in","of","instanceof"].includes(X))break}return D}let j=[];for(let P=0;P<t.length;P++){if(t[P].text!=="for")continue;let D=t[P+1]?.text==="await"?P+2:P+1;if(t[D]?.text!=="("||!i.has(D))continue;let X=i.get(D),F=X+1,L=t[F]?.text==="{"&&i.has(F)?i.get(F):N(F),Q=t[L]?.text===";"||t[L]?.text==="}"?t[L].end:t[Math.max(F,L-1)]?.end??n.length;j.push({headStart:D,headEnd:X,start:t[D].start,end:Q})}for(let P=0;P<t.length;P++){let D=t[P].text,X=t[P-1]?.text;if(X==="."||t[P+1]?.text===":")continue;if(X==="as"||X==="<")continue;if(D==="const"||D==="let"||D==="var"){let F=N(P+1),L=P+1,Q=!1,te=!1,ae=0;for(let ne=P+1;ne<=F;ne++){let ue=t[ne]?.text;if(ne<F&&Dr.includes(ue)&&i.has(ne)&&i.get(ne)<F){ne=i.get(ne);continue}if(ne<F&&ue===":"&&!te)Q=!0;else if(ne<F&&ue==="="&&ae===0)Q=!1,te=!0;else if(ne<F&&Q&&ue==="<")ae++;else if(ne<F&&Q&&ue===">"&&ae>0)ae--;else if(ne===F||ue===","&&ae===0)y(L,ne,R,D==="var"),L=ne+1,Q=!1,te=!1}}else if(D==="function"||D==="class"){let F=P+1;if(t[F]?.text==="*")F++;if(t[F]&<.test(t[F].text)&&t[F].text!=="extends")R.add(t[F].text),c.push({name:t[F].text,token:F})}else if(D==="import"){let F=P+1;if(t[F]?.text==="*"&&t[F+1]?.text==="as")F+=2;let L=t[F]?.text;if(L&<.test(L)&&L!=="type"&&t[F+1]?.text!=="("&&t[F+1]?.text!==".")R.add(L),c.push({name:L,token:F,file:!0});let Q=t[F]?.text==="{"?F:t[F+1]?.text===","&&t[F+2]?.text==="{"?F+2:-1;if(Q!==-1&&i.has(Q)){let te=i.get(Q);for(let[ae,ne]of l(Q+1,te)){let ue=ne-1;while(ue>=ae&&!lt.test(t[ue].text))ue--;if(ue>=ae&&t[ue].text!=="type")c.push({name:t[ue].text,token:ue,file:!0})}}}}return Mr=e,Pn={code:n,scopes:M,loops:j,declarations:R,sites:c,tokens:t,pairs:i},Pn}function ds(e){let n=fs(e);return{code:n.code,shadows:(t,i)=>n.scopes.some((a)=>i>=a.start&&i<a.end&&a.names.has(t))}}function Mn(e){return new Set(fs(e).declarations)}function Ie(e,n){let{scopes:t,loops:i,sites:a,tokens:l,pairs:c}=fs(e),y=Array.from({length:l.length},()=>-1),v=[];for(let j=0;j<l.length;j++){y[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,R=new Map;for(let j of a){if(!n.has(j.name))continue;E.add(j.token);let P=j.file?-1:y[j.token],D=P===-1?[0,Number.POSITIVE_INFINITY]:[l[P].start,l[c.get(P)].end];if(j.functionScoped){let F=l[j.token].start,L=t.filter((Q)=>Q.functionBody&&F>=Q.bodyStart&&F<Q.end).sort((Q,te)=>Q.end-Q.bodyStart-(te.end-te.bodyStart))[0];D=L?[L.bodyStart,L.end]:[0,Number.POSITIVE_INFINITY]}else if(!j.file){let F=i.filter((L)=>j.token>L.headStart&&j.token<L.headEnd).sort((L,Q)=>L.headEnd-L.headStart-(Q.headEnd-Q.headStart))[0];if(F)D=[F.start,F.end]}let X=R.get(j.name);if(X)X.push(D);else R.set(j.name,[D])}let M=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]&<.test(l[P].text)&&l[P+1]?.text===",")P+=2;if(l[P]?.text==="{"&&c.has(P))for(let D=P+1;D<c.get(P);D++)M.add(D)}let N=new Set;for(let j=0;j<l.length;j++){let P=l[j].text;if(!n.has(P)||N.has(P)||E.has(j)||M.has(j))continue;let D=l[j-1]?.text;if(D==="#"||D==="."&&l[j-2]?.text!=="..")continue;if(l[j+1]?.text===":"&&(D==="{"||D===","))continue;let X=l[j].start;if(R.get(P)?.some(([F,L])=>X>=F&&X<L))continue;if(t.some((F)=>X>=F.start&&X<F.end&&F.names.has(P)))continue;N.add(P)}return N}var Pe="0.2.
|
|
115
|
+
`+a.slice(c);else a+=l;return a}function Pr(e,n){let t=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(n){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))t.add(a)}return t}function Rt(e,n){let t=s(e),{depths:i,balanced:a}=ge(t),l=(y)=>!a||i[y]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${n}\\b)`,"g");for(let y of t.matchAll(c)){let v=(y.index??0)+y[0].length-y[1].length;if(l(v))return!0}for(let y of t.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(y.index??0)&&Pr(y[1],!0).has(n))return!0;for(let y of t.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(y.index??0)&&Pr(y[1],!1).has(n))return!0;return!1}var Mr="",Pn,lt=/^[A-Za-z_$][\w$]*$/,qo=new Set(["if","for","while","switch","with"]),Dr=["(","[","{"],jr=[")","]","}"],Xo=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function Jo(e){let n=s(e),t=[];for(let i of n.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=i.index??0;t.push({text:i[0],start:a,end:a+i[0].length})}return{code:n,tokens:t}}function fs(e){if(Pn&&e===Mr)return Pn;let{code:n,tokens:t}=Jo(e),i=new Map,a=[];for(let P=0;P<t.length;P++){let D=t[P].text;if(["(","[","{"].includes(D))a.push(P);else if([")","]","}"].includes(D)){let X=a.at(-1);if(X!==void 0&&["()","[]","{}"].includes(t[X].text+D))a.pop(),i.set(X,P),i.set(P,X)}}function l(P,D){let X=[],F=P;for(let L=P;L<D;L++){if(["(","[","{"].includes(t[L].text)&&(i.get(L)??D)<D){L=i.get(L);continue}if(t[L].text===",")X.push([F,L]),F=L+1}return X.push([F,D]),X}let c=[];function y(P,D,X,F=!1){if(t[P]?.text==="...")P++;if(P>=D)return;let L=t[P].text;if(lt.test(L)){if(X.add(L),X===R)c.push({name:L,token:P,functionScoped:F});return}if(L!=="{"&&L!=="[")return;let Q=i.get(P);if(Q===void 0||Q>=D)return;for(let[te,ae]of l(P+1,Q)){let ne=te;if(L==="{")for(let ue=te;ue<ae;ue++){if(t[ue].text===":"){ne=ue+1;break}if(t[ue].text==="=")break;if(["(","[","{"].includes(t[ue].text)&&i.has(ue))ue=i.get(ue)}y(ne,ae,X,F)}}function v(P,D){let X=new Set;for(let[F,L]of l(P,D))y(F,L,X);return X}function E(P){let D=P;for(;D<t.length;D++){let X=t[D].text;if(["(","[","{"].includes(X)&&i.has(D)){D=i.get(D);continue}if([",",";",")","]","}"].includes(X))break}return t[Math.max(P,D-1)]?.end??n.length}let R=new Set,M=[];for(let P=0;P<t.length;P++)if(t[P].text==="=>"){let D=P-1,X=D,F;if(t[D]?.text===")"&&i.has(D))X=i.get(D),F=v(X+1,D);else if(t[D]&<.test(t[D].text))F=new Set([t[D].text]);else continue;let L=P+1,Q=t[L]?.text==="{"&&i.has(L)?t[i.get(L)].end:E(L);M.push({start:t[X].start,end:Q,bodyStart:t[L]?.start??Q,functionBody:!0,names:F})}else if(t[P].text==="("&&i.has(P)){let D=t[P-1]?.text;if(!D||qo.has(D)||!lt.test(D)&&D!=="*"&&D!=="]")continue;let X=i.get(P),F=X+1;if(t[F]?.text===":"){F++;while(F<t.length&&!["{","=>",";","="].includes(t[F].text))F++}if(t[F]?.text!=="{"||!i.has(F))continue;M.push({start:t[P].start,end:t[i.get(F)].end,bodyStart:t[F].start,functionBody:D!=="catch",names:v(P+1,X)})}function N(P){let D=P;for(;D<t.length;D++){let X=t[D].text;if(Dr.includes(X)&&i.has(D)){D=i.get(D);continue}if(X===";"||jr.includes(X))break;let F=t[D-1];if(D>P&&Xo.has(X)&&F.text!==".")break;if(D>P&&/[\n\r]/.test(n.slice(F.end,t[D].start))&&(/^[\w$]+$/.test(F.text)||jr.includes(F.text)||['"',"'","`"].includes(F.text))&<.test(X)&&!["in","of","instanceof"].includes(X))break}return D}let j=[];for(let P=0;P<t.length;P++){if(t[P].text!=="for")continue;let D=t[P+1]?.text==="await"?P+2:P+1;if(t[D]?.text!=="("||!i.has(D))continue;let X=i.get(D),F=X+1,L=t[F]?.text==="{"&&i.has(F)?i.get(F):N(F),Q=t[L]?.text===";"||t[L]?.text==="}"?t[L].end:t[Math.max(F,L-1)]?.end??n.length;j.push({headStart:D,headEnd:X,start:t[D].start,end:Q})}for(let P=0;P<t.length;P++){let D=t[P].text,X=t[P-1]?.text;if(X==="."||t[P+1]?.text===":")continue;if(X==="as"||X==="<")continue;if(D==="const"||D==="let"||D==="var"){let F=N(P+1),L=P+1,Q=!1,te=!1,ae=0;for(let ne=P+1;ne<=F;ne++){let ue=t[ne]?.text;if(ne<F&&Dr.includes(ue)&&i.has(ne)&&i.get(ne)<F){ne=i.get(ne);continue}if(ne<F&&ue===":"&&!te)Q=!0;else if(ne<F&&ue==="="&&ae===0)Q=!1,te=!0;else if(ne<F&&Q&&ue==="<")ae++;else if(ne<F&&Q&&ue===">"&&ae>0)ae--;else if(ne===F||ue===","&&ae===0)y(L,ne,R,D==="var"),L=ne+1,Q=!1,te=!1}}else if(D==="function"||D==="class"){let F=P+1;if(t[F]?.text==="*")F++;if(t[F]&<.test(t[F].text)&&t[F].text!=="extends")R.add(t[F].text),c.push({name:t[F].text,token:F})}else if(D==="import"){let F=P+1;if(t[F]?.text==="*"&&t[F+1]?.text==="as")F+=2;let L=t[F]?.text;if(L&<.test(L)&&L!=="type"&&t[F+1]?.text!=="("&&t[F+1]?.text!==".")R.add(L),c.push({name:L,token:F,file:!0});let Q=t[F]?.text==="{"?F:t[F+1]?.text===","&&t[F+2]?.text==="{"?F+2:-1;if(Q!==-1&&i.has(Q)){let te=i.get(Q);for(let[ae,ne]of l(Q+1,te)){let ue=ne-1;while(ue>=ae&&!lt.test(t[ue].text))ue--;if(ue>=ae&&t[ue].text!=="type")c.push({name:t[ue].text,token:ue,file:!0})}}}}return Mr=e,Pn={code:n,scopes:M,loops:j,declarations:R,sites:c,tokens:t,pairs:i},Pn}function ds(e){let n=fs(e);return{code:n.code,shadows:(t,i)=>n.scopes.some((a)=>i>=a.start&&i<a.end&&a.names.has(t))}}function Mn(e){return new Set(fs(e).declarations)}function Ie(e,n){let{scopes:t,loops:i,sites:a,tokens:l,pairs:c}=fs(e),y=Array.from({length:l.length},()=>-1),v=[];for(let j=0;j<l.length;j++){y[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,R=new Map;for(let j of a){if(!n.has(j.name))continue;E.add(j.token);let P=j.file?-1:y[j.token],D=P===-1?[0,Number.POSITIVE_INFINITY]:[l[P].start,l[c.get(P)].end];if(j.functionScoped){let F=l[j.token].start,L=t.filter((Q)=>Q.functionBody&&F>=Q.bodyStart&&F<Q.end).sort((Q,te)=>Q.end-Q.bodyStart-(te.end-te.bodyStart))[0];D=L?[L.bodyStart,L.end]:[0,Number.POSITIVE_INFINITY]}else if(!j.file){let F=i.filter((L)=>j.token>L.headStart&&j.token<L.headEnd).sort((L,Q)=>L.headEnd-L.headStart-(Q.headEnd-Q.headStart))[0];if(F)D=[F.start,F.end]}let X=R.get(j.name);if(X)X.push(D);else R.set(j.name,[D])}let M=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]&<.test(l[P].text)&&l[P+1]?.text===",")P+=2;if(l[P]?.text==="{"&&c.has(P))for(let D=P+1;D<c.get(P);D++)M.add(D)}let N=new Set;for(let j=0;j<l.length;j++){let P=l[j].text;if(!n.has(P)||N.has(P)||E.has(j)||M.has(j))continue;let D=l[j-1]?.text;if(D==="#"||D==="."&&l[j-2]?.text!=="..")continue;if(l[j+1]?.text===":"&&(D==="{"||D===","))continue;let X=l[j].start;if(R.get(P)?.some(([F,L])=>X>=F&&X<L))continue;if(t.some((F)=>X>=F.start&&X<F.end&&F.names.has(P)))continue;N.add(P)}return N}var Pe="0.2.784";var Nr=Symbol.for(`stx.lazy-module-promises.${Pe}`);function Yo(){let e=globalThis;return e[Nr]??=new Map,e[Nr]}function o(e,n){let t=Yo(),i=`${import.meta.url}\x00${e}`,a=t.get(i);if(a)return a;let l=n();return t.set(i,l),l.catch(()=>{if(t.get(i)===l)t.delete(i)}),l}var Qo=/<\/(script)/gi;function dn(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(Qo,"<\\/$1")}import zr from"fs";class U{cache=new Map;maxSize;options;sizes;bytes=0;constructor(e=100,n){this.maxSize=e,this.options=n??null,this.sizes=n?new Map:null}get byteSize(){return this.bytes}setMaxBytes(e){if(!this.options)return;this.options={...this.options,maxBytes:e};while(this.bytes>e&&this.cache.size>0){let n=this.cache.keys().next().value;if(n===void 0)break;this.delete(n)}}get(e){if(!this.cache.has(e))return;let n=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,n),n}set(e,n){if(this.cache.has(e))this.delete(e);let t=this.options?this.options.sizeOf(n):0;if(this.options&&t>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+t>this.options.maxBytes)){let i=this.cache.keys().next().value;if(i===void 0)break;this.delete(i)}if(this.cache.set(e,n),this.sizes)this.sizes.set(e,t),this.bytes+=t}has(e){return this.cache.has(e)}delete(e){if(this.sizes){let n=this.sizes.get(e);if(n!==void 0)this.bytes-=n,this.sizes.delete(e)}return this.cache.delete(e)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var $t=new Map,ea=500;function At(e,n){if(n?.includes("g"))return new RegExp(e,n);let t=`${e}:${n||""}`;if(!$t.has(t)){if($t.size>=ea){let i=$t.keys().next().value;if(i)$t.delete(i)}$t.set(t,new RegExp(e,n))}return $t.get(t)}class Lr{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(e){let n=Array.from(new Set(e)),t=n.sort().join(","),i=this.pool.find((y)=>y.context.join(",")===t);if(i)return i.func;let a=this.fnCache,l=this.fnCacheMaxSize,c=(...y)=>(v)=>{try{let E=`${t}:${v}`,R=a.get(E);if(!R){if(a.size>=l){let M=a.keys().next().value;if(M)a.delete(M)}R=Function(...n,`
|
|
116
116
|
'use strict';
|
|
117
117
|
try {
|
|
118
118
|
return ${v};
|
|
@@ -193,7 +193,7 @@ else {
|
|
|
193
193
|
// STX: auto-generated event bindings
|
|
194
194
|
${e.map((t,i)=>ba(t,i)).join(`
|
|
195
195
|
`)}`}function Hr(e){let n=[],t=new Set,i=e.replace(/^\s*import\s+.*$/gm,""),a=0,l=i.length,c=0;while(c<l){let y=i[c];if(y==="'"||y==='"'||y==="`"){let v=y;if(c++,v==="`"){let E=0;while(c<l){if(i[c]==="\\"){c+=2;continue}if(i[c]==="`"&&E===0){c++;break}if(i[c]==="$"&&i[c+1]==="{"){E++,c+=2;continue}if(i[c]==="}"&&E>0){E--,c++;continue}c++}}else while(c<l){if(i[c]==="\\"){c+=2;continue}if(i[c]===v){c++;break}c++}continue}if(y==="/"&&i[c+1]==="/"){while(c<l&&i[c]!==`
|
|
196
|
-
`)c++;continue}if(y==="/"&&i[c+1]==="*"){c+=2;while(c<l-1&&!(i[c]==="*"&&i[c+1]==="/"))c++;c+=2;continue}if(y==="{"){a++,c++;continue}if(y==="}"){a--,c++;continue}if(a===0){let v=i.slice(c),E=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(E){let N=E[1];if(!N.startsWith("_")&&!t.has(N))n.push(N),t.add(N);c+=E[0].length;continue}let R=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(R){R[1].split(",").forEach((N)=>{let j=N.trim(),P=j.indexOf(":"),D=P>=0?j.slice(P+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(D&&!D.startsWith("_")&&!t.has(D))n.push(D),t.add(D)}),c+=R[0].length;continue}let M=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(M){let N=M[1];if(!N.startsWith("_")&&!t.has(N))n.push(N),t.add(N);c+=M[0].length;continue}}c++}return n}var _a=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 wa(e){let n=new Set,t=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(N){let j;while((j=t.exec(N))!==null){let P=j[0];if(!_a.has(P))n.add(P)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)i(l[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=c.exec(e))!==null)i(l[1]);let y=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=y.exec(e))!==null)i(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)i(l[1]);let E=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=E.exec(e))!==null)i(l[1]);let R=/@model\s*=\s*["']([^"']*)["']/gi;while((l=R.exec(e))!==null)i(l[1]);let M=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=M.exec(e))!==null)i(l[1]);return n}async function Le(e,n={}){let t=e,i="",a=!1,l=[],c=fi(t,{filePath:n.filePath,projectRoot:n.projectRoot});t=c.code;let y=gi(c.styles),v=Dt(t);t=v.code,l=[...v.imports,...v.models];let{hasUserImports:E,bundleClientScript:R}=await o("stx/client-script-bundler",()=>import("./chunk-
|
|
196
|
+
`)c++;continue}if(y==="/"&&i[c+1]==="*"){c+=2;while(c<l-1&&!(i[c]==="*"&&i[c+1]==="/"))c++;c+=2;continue}if(y==="{"){a++,c++;continue}if(y==="}"){a--,c++;continue}if(a===0){let v=i.slice(c),E=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(E){let N=E[1];if(!N.startsWith("_")&&!t.has(N))n.push(N),t.add(N);c+=E[0].length;continue}let R=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(R){R[1].split(",").forEach((N)=>{let j=N.trim(),P=j.indexOf(":"),D=P>=0?j.slice(P+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(D&&!D.startsWith("_")&&!t.has(D))n.push(D),t.add(D)}),c+=R[0].length;continue}let M=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(M){let N=M[1];if(!N.startsWith("_")&&!t.has(N))n.push(N),t.add(N);c+=M[0].length;continue}}c++}return n}var _a=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 wa(e){let n=new Set,t=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(N){let j;while((j=t.exec(N))!==null){let P=j[0];if(!_a.has(P))n.add(P)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)i(l[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=c.exec(e))!==null)i(l[1]);let y=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=y.exec(e))!==null)i(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)i(l[1]);let E=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=E.exec(e))!==null)i(l[1]);let R=/@model\s*=\s*["']([^"']*)["']/gi;while((l=R.exec(e))!==null)i(l[1]);let M=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=M.exec(e))!==null)i(l[1]);return n}async function Le(e,n={}){let t=e,i="",a=!1,l=[],c=fi(t,{filePath:n.filePath,projectRoot:n.projectRoot});t=c.code;let y=gi(c.styles),v=Dt(t);t=v.code,l=[...v.imports,...v.models];let{hasUserImports:E,bundleClientScript:R}=await o("stx/client-script-bundler",()=>import("./chunk-1gt56hdz.js"));if(E(t))t=await R(t,n.filePath||"",{projectRoot:n.projectRoot,minify:n.production}),a=!0;if(n.autoImports!==!1){let Q=Wc(t);t=Q.code,i=qc(Q.stxImports,Q.browserImports.filter((te)=>!l.includes(te)))}if(i=`${yn(t,n.serverData)}${i}`,t=A(t),!a&&je(n.attrs||""))t=Be(t);let M=ya(n.eventBindings||[]),N=(n.attrs||"").trim(),j=/\btype\s*=\s*["']module["']/i.test(N),P=n.instanceId?` data-stx-instance="${n.instanceId}"`:"";if(j){let Q=N.replace(/\btype\s*=\s*["']module["']/i,"").trim(),te=`type="module" data-stx-scoped${P}${Q?` ${Q}`:""}`;return`${y}<script ${te}>
|
|
197
197
|
${dn(`${i}${t}
|
|
198
198
|
${M}`)}
|
|
199
199
|
</script>`}let D=$i(e),X=/function __stx_setup_/.test(t),F=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function L(Q){let te=Q.length>0?`
|
|
@@ -288,8 +288,8 @@ ${E.join(`
|
|
|
288
288
|
`){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++}},N=()=>{if(i!==0)return;let j=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(j){let F=j[2].split(",").map((L)=>{let Q=L.trim().split(":");return Q[Q.length-1].trim()});for(let L of F)if(L&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(L)&&!t.has(L))n.push(L),t.add(L);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(!t.has(F))n.push(F),t.add(F);return}let D=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(D){let F=D[1];if(!t.has(F))n.push(F),t.add(F);return}let X=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(X){let F=X[1];if(!t.has(F))n.push(F),t.add(F)}};while(a<l){if(v())continue;if(e[a]==="'"||e[a]==='"'){c(e[a]);continue}if(e[a]==="`"){y();continue}if(e[a]==="/"&&R()){M();continue}if(e[a]==="{"){i++,a++;continue}if(e[a]==="}"){i--,a++;continue}if(i===0&&/[a-z]/i.test(e[a])&&(a===0||/\s|[;{}()]/.test(e[a-1])))N();a++}return n}function Tl(e){let n=[],t=0,i=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==="{")t++;else if(c===")"||c==="]"||c==="}")t--;else if(c===","&&t===0)n.push(e.slice(i,l)),i=l+1}if(i<e.length)n.push(e.slice(i));return n}function Al(e){let n=0,t=null;for(let i=0;i<e.length;i++){let a=e[i];if(t){if(a==="\\"){i++;continue}if(a===t)t=null;continue}if(a==='"'||a==="'"||a==="`"){t=a;continue}if(a==="("||a==="["||a==="{")n++;else if(a===")"||a==="]"||a==="}")n--;else if(a==="="&&n===0){let l=e[i-1],c=e[i+1];if(l==="!"||l==="<"||l===">"||l==="=")continue;if(c==="="||c===">")continue;return i}}return-1}function Il(e,n){try{let t=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!t)return;let i=t.index-1;while(i>=0&&/\s/.test(e[i]))i--;if(e[i]!=="}")return;let a=i,l=0,c=-1;for(;i>=0;i--){let v=e[i];if(v==="}")l++;else if(v==="{"){if(l--,l===0){c=i;break}}}if(c===-1)return;let y=e.slice(c+1,a);for(let v of Tl(y)){let E=v.trim();if(!E||E.startsWith("..."))continue;let R=Al(E);if(R===-1)continue;let M=E.slice(0,R).trim();if(!/^[A-Z_$][\w$]*$/i.test(M))continue;if(n[M]!==void 0)continue;let N=E.slice(R+1).trim();if(!N)continue;try{let j=Object.keys(n).filter(jt),P=Function(...j,`"use strict"; return (${N});`);n[M]=P(...j.map((D)=>n[D]))}catch{}}}catch{}}var Ol=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function lg(e,n){let t=e.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!t)return null;let i=t[2].toLowerCase();if(!Ol.has(i))return null;let a=new RegExp(`<\\/?${i}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),l=S(e,(E,R)=>(a.lastIndex=R,a.exec(E)?.index===R?a.lastIndex:-1));if(i==="span"&&/\sdata-stx-scope\s*=/.test(l[0]?.token||""))return null;let c=0,y=!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;y=!0;break}}if(!y)return null;let v=t[0].length;return e.slice(0,v)+n+e.slice(v)}function $o(e,n){if(!e)return!1;return[...n.additionalComponentsDirs??[],...n.fallbackComponentsDir?[n.fallbackComponentsDir]:[]].some((i)=>{let a=ce.relative(ce.resolve(i),ce.resolve(e));return!a.startsWith("..")&&!ce.isAbsolute(a)})}async function Cr(e,n,t,i,a){let l=e.endsWith(".stx")?e.slice(0,-4):e,c=(ne)=>ne.split("-").map((ue)=>ue.charAt(0).toUpperCase()+ue.slice(1)).join(""),y=t.__importedComponents;if(y){for(let ne of[l,l.toLowerCase(),c(l),H(l)])if(y.has(ne))return!0}let v=[...new Set([`${l}.stx`,`${c(l)}.stx`,`${H(l)}.stx`])],E=typeof a.root==="string"?ce.resolve(a.root):void 0,R=E??ce.dirname(i),M=[],N=(ne)=>{if(ne&&!M.includes(ne))M.push(ne)},j=t.__originalFilePath;if(j)N(ce.join(ce.dirname(j),"components"));if($o(n,a))N(a._rootComponentsDir);N(n),N(a._rootComponentsDir),N(ce.join(ce.dirname(i),"components")),N(a.componentsDir);for(let ne of a.additionalComponentsDirs??[])N(ne);let P=a._targetComponentFallbackNames?.some((ne)=>ne.toLowerCase()===l.toLowerCase());if(!P)for(let ne of a._targetComponentDirs??[])N(ne);if(E)N(ce.resolve(E,"resources/views/components")),N(ce.resolve(E,"resources/components")),N(ce.resolve(E,"src/components")),N(ce.resolve(E,"components"));for(let ne of a._layerComponentDirs??[])N(ne);let D=a._pluginComponentDirs;if(Array.isArray(D))for(let ne of D)N(typeof ne==="string"?ne:null);if(N(a.fallbackComponentsDir),P)for(let ne of a._targetComponentDirs??[])N(ne);let X=a._nativePrimitivesFallback;if(X&&!X.except.some((ne)=>ne.toLowerCase()===l.toLowerCase()))N(X.dir);if(l.startsWith("./")||l.startsWith("../"))return r(ce.resolve(ce.dirname(i),`${l}.stx`));let F=ho(ce.resolve(import.meta.dir,"components")),L=M.map((ne)=>ce.isAbsolute(ne)?ne:ce.resolve(R,ne)),Q=`${v.join("\x00")}\x00\x00${L.join("\x00")}`,te=Js.get(Q);if(te!==void 0)return te;let ae=!1;e:for(let ne of L){if(ho(ne)===F)continue;for(let ue of v)if(await r(ce.join(ne,ue))){ae=!0;break e}}return Js.set(Q,ae),ae}function ho(e){let n=Ys.get(e);if(n!==void 0)return n;let t=e;try{t=Jn.realpathSync(e)}catch{}return Ys.set(e,t),t}function ug(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function Kc(e){if(!e)return!1;let n=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(n)}function Pl(e,n,t){if(!e.includes("{{")&&!e.includes("{!!"))return e;let i=(a,l)=>{let c;try{c=T(a,n)}catch{return l}if(c===void 0||c===null)return"";let y=String(c);if(/<\/style/i.test(y))return console.warn(`[stx] a <style> expression in ${t??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return y};return e.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>i(l,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,l)=>i(l,a))}var xo=new Set;function bo(e,n,t,i){let a=`${e}\x00${n}\x00${i??""}`;if(!process.env.STX_DEBUG&&xo.has(a))return;xo.add(a);let l=n?` used in ${n}`:"",c=i?` Cause: ${i}.`:"",y=t.length>0?`
|
|
289
289
|
searched:
|
|
290
290
|
${t.map((v)=>` - ${v}`).join(`
|
|
291
|
-
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${c}${y}`)}function yo(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function hi(e){let n=new Set,t=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let i of e){let a;while((a=t.exec(i))!==null)n.add(a[1]);t.lastIndex=0}return[...n]}async function Fe(e,n,t,i,a,l,c,y=new Set,v,E=rt(a),R,M=e){let{extractVariables:N}=await o("stx/variable-extractor",()=>import("./chunk-abzp0cp9.js")),j=y??new Set;if(j.has(e))return`[Circular component reference: ${e}]`;let P=new Set(j);P.add(e);let D=typeof n.client==="string"?n.client.trim():"";if("client"in n)delete n.client;let X=D&&D!=="load"&&ug(D)?D:"";try{let F=(se)=>se.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""),L=M.endsWith(".stx")?M.slice(0,-4):M,Q=null,te=a.__importedComponents;if(te){let se=[L,L.toLowerCase(),F(L),H(L)];for(let le of se)if(te.has(le)){Q=te.get(le);break}}let ae=[];if(!Q){let se=[`${L}.stx`,`${F(L)}.stx`,`${H(L)}.stx`],le=[...new Set(se)],we=a.__originalFilePath,he=[];if(he.push(...c._layerComponentDirs??[]),we){let be=ce.join(ce.dirname(we),"components");he.push(be)}let He=c._rootComponentsDir;if(typeof He==="string"&&$o(i,c)&&!he.includes(He))he.push(He);if(i&&!he.includes(i))he.push(i);if(typeof He==="string"&&!he.includes(He))he.push(He);let Ce=ce.join(ce.dirname(l),"components");if(!he.includes(Ce))he.push(Ce);if(c.componentsDir&&c.componentsDir!==i&&!he.includes(c.componentsDir))he.push(c.componentsDir);for(let be of c.additionalComponentsDirs??[])if(be&&!he.includes(be))he.push(be);let ct=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(L),st=(R?.events??[]).map((be)=>be.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Zt=Object.hasOwn(n,"checked")||Boolean(R?.reactiveProps?.includes("checked")),rs=Object.hasOwn(n,"value")||Boolean(R?.reactiveProps?.includes("value")),gt=!st.includes("valuechange")&&(Zt||st.includes("change")&&!rs),yt=c._nativeHostAttrs&&/^textinput$/i.test(L),ln=st.includes("update:value")&&!st.includes("input"),un=c._nativeHostAttrs&&/^video$/i.test(L),_n=c._nativeHostAttrs&&/^image$/i.test(L),_t=Ns([...Object.keys(n),...R?.reactiveProps??[]],R?.events,n),Sn=Object.hasOwn(n,"src")||Boolean(R?.reactiveProps?.includes("src")),$n=Object.hasOwn(n,"source")||Boolean(R?.reactiveProps?.includes("source")),En=un&&Sn&&!$n&&(R?.events??[]).every((be)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(be.replace(/^@/,"").split(".")[0])),mt=(be)=>Object.hasOwn(n,be)||Boolean(R?.reactiveProps?.includes(be)),kn=c._nativeHostAttrs&&/^button$/i.test(L)&&(mt("symbol")||mt("iconOnly")||mt("title")&&!mt("label")&&!t.trim()),or=c._targetComponentFallbackNames?.some((be)=>be.toLowerCase()===L.toLowerCase())&&(!ct||gt)&&(!yt||ln)&&(!un||En)&&(!_n||_t)&&!kn;for(let be of or?[]:c._targetComponentDirs??[])if(be&&!he.includes(be))he.push(be);let wt=typeof c.root==="string"?ce.resolve(c.root):void 0,No=wt??ce.dirname(l),St=[];if(wt)St.push(ce.resolve(wt,"resources/views/components")),St.push(ce.resolve(wt,"resources/components")),St.push(ce.resolve(wt,"src/components")),St.push(ce.resolve(wt,"components"));St.push(ce.resolve(import.meta.dir,"components"));for(let be of St)if(!he.includes(be))he.push(be);let ar=c._pluginComponentDirs;if(Array.isArray(ar)){for(let be of ar)if(typeof be==="string"&&!he.includes(be))he.push(be)}if(c.fallbackComponentsDir&&!he.includes(c.fallbackComponentsDir))he.push(c.fallbackComponentsDir);if(or){for(let be of c._targetComponentDirs??[])if(be&&!he.includes(be))he.push(be)}let Rn=c._nativePrimitivesFallback;if(Rn&&!Rn.except.some((be)=>be.toLowerCase()===L.toLowerCase())&&!he.includes(Rn.dir))he.push(Rn.dir);let cr=[...new Set(he.map((be)=>{if(!be)return be;return ce.isAbsolute(be)?be:ce.resolve(No,be)}))];he.length=0,he.push(...cr);let is=`${L}\x00${l}\x00${cr.join("\x00")}`,os=qn.get(is);if(os)if(await r(os))Q=os;else qn.delete(is);if(!Q&&(L.startsWith("./")||L.startsWith("../")))Q=ce.resolve(ce.dirname(l),`${L}.stx`),ae.push(Q);else if(!Q)for(let be of he){if(!be)continue;for(let Cn of le){let Tn=ce.join(be,Cn);if(ae.push(Tn),await r(Tn)){Q=Tn;break}}if(Q)break;if(!Q)try{let Cn=await import("fs");if(!Cn.statSync(be,{throwIfNoEntry:!1})?.isDirectory())continue;let Lo=8,as=[{path:be,depth:0}];while(as.length>0&&!Q){let An=as.pop();if(An.depth>=Lo)continue;let lr;try{lr=Cn.readdirSync(An.path,{withFileTypes:!0})}catch{continue}for(let In of lr){if(!In.isDirectory())continue;if(In.name==="node_modules"||In.name.startsWith("."))continue;let ur=ce.join(An.path,In.name);for(let Bo of le){let cs=ce.join(ur,Bo);if(ae.push(cs),await r(cs)){Q=cs;break}}if(Q)break;as.push({path:ur,depth:An.depth+1})}}}catch{}if(Q)break}if(Q)qn.set(is,Q)}if(!Q||!await r(Q))return bo(e,l,ae),yo(e);v.add(Q);let ne;if(tn.has(Q)&&qs.get(Q)===po(Q))ne=tn.get(Q);else try{let se=po(Q);ne=await Bun.file(Q).text(),tn.set(Q,ne),qs.set(Q,se)}catch(se){let le=se instanceof Error?se.message:String(se);return bo(e,l,[Q],le),yo(e)}if(R)for(let se of new Set([...Object.keys(n),...R.reactiveProps??[]])){let le=se.toLowerCase();if(le.startsWith("aria-")||le.startsWith("data-"))continue;let we=se.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${we}\\b`).test(ne))R.declaredProps.add(se);if(new RegExp(`\\$props\\s*(?:\\.\\s*${we}\\b|\\[\\s*['"]${we}['"]\\s*\\])`).test(ne)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${we}['"]`).test(ne))R.consumedProps?.add(se)}let ue=new Set(["__originalFilePath","__importedComponents",Nn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),Ee={};for(let[se,le]of Object.entries(a))if(!se.startsWith("__")||ue.has(se))Ee[se]=le;let Te=E.length>0?{[Vn]:[...E]}:{},Ae=t;if(t.includes("@include")){let{processIncludes:se}=await o("stx/includes",()=>import("./chunk-kkkpgnj3.js"));Ae=await se(t,a,l,c,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ae)){let{processComponents:se}=await o("stx/component-renderer",()=>import("./chunk-smsjcnvm.js"));Ae=await se(Ae,{...a,__processedComponents:j,...Te},l,c,v)}let ke=[];if(Kc(Ae)){let{processExpressions:se}=await o("stx/expressions",()=>import("./chunk-xcrrsq09.js")),le=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...Te}:E.length>0?{...a,...Te}:a;Ae=se(Ae,le,l);for(let we of Ae.matchAll(/\{\{([\s\S]*?)\}\}/g))ke.push(we[1].trim())}let Je=G(Ae),ut=[],Ct=Je.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(se,le)=>{let we=Je.scripts[Number(le)]||"",he=we.match(/^<script\b([^>]*)>/i)?.[1]||"",He=he.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Ce=!He||["module","text/javascript","application/javascript"].includes(He),ct=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${he}`);if(!/\bserver\b/i.test(he)&&Ce&&!ct)return ut.push(we),"";return we}),{extractSlotContent:Yn}=await o("stx/slots",()=>import("./chunk-ay2by639.js")),ft=Yn(Ct),dt={};if(ft.defaultSlot?.trim())dt.default=ft.defaultSlot;for(let[se,le]of ft.namedSlots)dt[se]=le.content;let pt=a.__stx_scope_seq??={n:0,key:zs(String(a.__filename??l))},Tt=So(e,process.cwd()),it=`stx_${(Tt.endsWith(".stx")?Tt.slice(0,-4):Tt).replace(/[^a-zA-Z0-9]/g,"_")}_${++pt.n}_${pt.key}`,Ue={...Ee,$uid:it,$native:c._nativeHostAttrs===!0,...n,props:n,slot:Ct,$slots:dt,__processedComponents:P,__sections:{},__stx_signals_gate:Se(ne)||Kc(t),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...ke]};Il(ne,Ue);let Lt=ne,sn=de(Lt);if(sn)Lt=sn.content.trim();let Qn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Bt=[...ne.matchAll(Qn)];for(let[,se,le]of Bt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(se))Oe(le,Q,c.strict);let qe=[],zt=null,es=Bt.some((se)=>/\bserver\b/.test(se[1]||"")&&/\bcache\b/.test(se[1]||"")),bt=null,Ye=null,Wt=null,rn=0,Ft=null;if(vl(c),es&&Qs>0){let se=El({props:n,slot:Ae,slotContext:t.trim()?kl(Ee):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...E].sort(),layers:c._layerGraph?.layers.map((le)=>le.configFile),uid:it});if(se!==null){bt=`${Q}\x00${x(ne)}\x00${se}`;let le=Xn.get(bt);if(le){for(let we of le.dependencies)v.add(we);if(Qr(a,le.clientFactories),pt.n+=le.uidsConsumed,le.preservedClientExpressions.length>0){let we=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let he of le.preservedClientExpressions)we.add(he);a.__stx_preserved_client_expressions=[...we]}return le.output}Ye=new Set(v),Wt=Gr(a),rn=pt.n,Ft=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Vt=new Set;for(let se of Bt){let le=se[1]||"",we=se[2]||"",he=le.includes("server");if(je(le)&&we.trim())we=Be(we);if(he&&we){for(let Ce of De(we))Vt.add(Ce);try{await N(we,Ue,Q,{onFailure:(Ce)=>{if(Ce.kind!=="unknown")zt=Ce.kind}})}catch(Ce){}}if(!he){let Ce=we.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),ct=Ce.includes("{{")&&Ce.includes("}}"),st=Ce.includes("{!!")&&Ce.includes("!!}");if(ct||st)Ce=bi(Ce,Ue,Q);let Zt=le.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");qe.push(`<script${Zt}>${Ce}</script>`)}}let Xe=G(ne).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Ut=Xe?Xe[1]:"",ts=Xe?Xe[2]:"",Qe="",ee=Ut&&/\bscoped\b/i.test(Ut);if(Xe)Qe=`<style${Ut}>${Pl(ts,Ue,Q)}</style>`;let re=Lt;if(re=re.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Xe)re=re.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let se=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,le=[];if(re=re.replace(se,(we,he)=>{let He=he.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(He)le.push(`<style${He[1]}>${He[2]}</style>`);return""}),re=re.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),le.length>0)Qe=`${Qe}${le.join(`
|
|
292
|
-
`)}`}if(t&&re.includes("{{ text || slot }}"))re=re.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>t);let{applySlots:me}=await o("stx/slots",()=>import("./chunk-
|
|
291
|
+
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${c}${y}`)}function yo(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function hi(e){let n=new Set,t=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let i of e){let a;while((a=t.exec(i))!==null)n.add(a[1]);t.lastIndex=0}return[...n]}async function Fe(e,n,t,i,a,l,c,y=new Set,v,E=rt(a),R,M=e){let{extractVariables:N}=await o("stx/variable-extractor",()=>import("./chunk-tshgbpwy.js")),j=y??new Set;if(j.has(e))return`[Circular component reference: ${e}]`;let P=new Set(j);P.add(e);let D=typeof n.client==="string"?n.client.trim():"";if("client"in n)delete n.client;let X=D&&D!=="load"&&ug(D)?D:"";try{let F=(se)=>se.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""),L=M.endsWith(".stx")?M.slice(0,-4):M,Q=null,te=a.__importedComponents;if(te){let se=[L,L.toLowerCase(),F(L),H(L)];for(let le of se)if(te.has(le)){Q=te.get(le);break}}let ae=[];if(!Q){let se=[`${L}.stx`,`${F(L)}.stx`,`${H(L)}.stx`],le=[...new Set(se)],we=a.__originalFilePath,he=[];if(he.push(...c._layerComponentDirs??[]),we){let be=ce.join(ce.dirname(we),"components");he.push(be)}let He=c._rootComponentsDir;if(typeof He==="string"&&$o(i,c)&&!he.includes(He))he.push(He);if(i&&!he.includes(i))he.push(i);if(typeof He==="string"&&!he.includes(He))he.push(He);let Ce=ce.join(ce.dirname(l),"components");if(!he.includes(Ce))he.push(Ce);if(c.componentsDir&&c.componentsDir!==i&&!he.includes(c.componentsDir))he.push(c.componentsDir);for(let be of c.additionalComponentsDirs??[])if(be&&!he.includes(be))he.push(be);let ct=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(L),st=(R?.events??[]).map((be)=>be.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Zt=Object.hasOwn(n,"checked")||Boolean(R?.reactiveProps?.includes("checked")),rs=Object.hasOwn(n,"value")||Boolean(R?.reactiveProps?.includes("value")),gt=!st.includes("valuechange")&&(Zt||st.includes("change")&&!rs),yt=c._nativeHostAttrs&&/^textinput$/i.test(L),ln=st.includes("update:value")&&!st.includes("input"),un=c._nativeHostAttrs&&/^video$/i.test(L),_n=c._nativeHostAttrs&&/^image$/i.test(L),_t=Ns([...Object.keys(n),...R?.reactiveProps??[]],R?.events,n),Sn=Object.hasOwn(n,"src")||Boolean(R?.reactiveProps?.includes("src")),$n=Object.hasOwn(n,"source")||Boolean(R?.reactiveProps?.includes("source")),En=un&&Sn&&!$n&&(R?.events??[]).every((be)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(be.replace(/^@/,"").split(".")[0])),mt=(be)=>Object.hasOwn(n,be)||Boolean(R?.reactiveProps?.includes(be)),kn=c._nativeHostAttrs&&/^button$/i.test(L)&&(mt("symbol")||mt("iconOnly")||mt("title")&&!mt("label")&&!t.trim()),or=c._targetComponentFallbackNames?.some((be)=>be.toLowerCase()===L.toLowerCase())&&(!ct||gt)&&(!yt||ln)&&(!un||En)&&(!_n||_t)&&!kn;for(let be of or?[]:c._targetComponentDirs??[])if(be&&!he.includes(be))he.push(be);let wt=typeof c.root==="string"?ce.resolve(c.root):void 0,No=wt??ce.dirname(l),St=[];if(wt)St.push(ce.resolve(wt,"resources/views/components")),St.push(ce.resolve(wt,"resources/components")),St.push(ce.resolve(wt,"src/components")),St.push(ce.resolve(wt,"components"));St.push(ce.resolve(import.meta.dir,"components"));for(let be of St)if(!he.includes(be))he.push(be);let ar=c._pluginComponentDirs;if(Array.isArray(ar)){for(let be of ar)if(typeof be==="string"&&!he.includes(be))he.push(be)}if(c.fallbackComponentsDir&&!he.includes(c.fallbackComponentsDir))he.push(c.fallbackComponentsDir);if(or){for(let be of c._targetComponentDirs??[])if(be&&!he.includes(be))he.push(be)}let Rn=c._nativePrimitivesFallback;if(Rn&&!Rn.except.some((be)=>be.toLowerCase()===L.toLowerCase())&&!he.includes(Rn.dir))he.push(Rn.dir);let cr=[...new Set(he.map((be)=>{if(!be)return be;return ce.isAbsolute(be)?be:ce.resolve(No,be)}))];he.length=0,he.push(...cr);let is=`${L}\x00${l}\x00${cr.join("\x00")}`,os=qn.get(is);if(os)if(await r(os))Q=os;else qn.delete(is);if(!Q&&(L.startsWith("./")||L.startsWith("../")))Q=ce.resolve(ce.dirname(l),`${L}.stx`),ae.push(Q);else if(!Q)for(let be of he){if(!be)continue;for(let Cn of le){let Tn=ce.join(be,Cn);if(ae.push(Tn),await r(Tn)){Q=Tn;break}}if(Q)break;if(!Q)try{let Cn=await import("fs");if(!Cn.statSync(be,{throwIfNoEntry:!1})?.isDirectory())continue;let Lo=8,as=[{path:be,depth:0}];while(as.length>0&&!Q){let An=as.pop();if(An.depth>=Lo)continue;let lr;try{lr=Cn.readdirSync(An.path,{withFileTypes:!0})}catch{continue}for(let In of lr){if(!In.isDirectory())continue;if(In.name==="node_modules"||In.name.startsWith("."))continue;let ur=ce.join(An.path,In.name);for(let Bo of le){let cs=ce.join(ur,Bo);if(ae.push(cs),await r(cs)){Q=cs;break}}if(Q)break;as.push({path:ur,depth:An.depth+1})}}}catch{}if(Q)break}if(Q)qn.set(is,Q)}if(!Q||!await r(Q))return bo(e,l,ae),yo(e);v.add(Q);let ne;if(tn.has(Q)&&qs.get(Q)===po(Q))ne=tn.get(Q);else try{let se=po(Q);ne=await Bun.file(Q).text(),tn.set(Q,ne),qs.set(Q,se)}catch(se){let le=se instanceof Error?se.message:String(se);return bo(e,l,[Q],le),yo(e)}if(R)for(let se of new Set([...Object.keys(n),...R.reactiveProps??[]])){let le=se.toLowerCase();if(le.startsWith("aria-")||le.startsWith("data-"))continue;let we=se.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${we}\\b`).test(ne))R.declaredProps.add(se);if(new RegExp(`\\$props\\s*(?:\\.\\s*${we}\\b|\\[\\s*['"]${we}['"]\\s*\\])`).test(ne)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${we}['"]`).test(ne))R.consumedProps?.add(se)}let ue=new Set(["__originalFilePath","__importedComponents",Nn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),Ee={};for(let[se,le]of Object.entries(a))if(!se.startsWith("__")||ue.has(se))Ee[se]=le;let Te=E.length>0?{[Vn]:[...E]}:{},Ae=t;if(t.includes("@include")){let{processIncludes:se}=await o("stx/includes",()=>import("./chunk-kcfvdw3r.js"));Ae=await se(t,a,l,c,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ae)){let{processComponents:se}=await o("stx/component-renderer",()=>import("./chunk-ne3hamzf.js"));Ae=await se(Ae,{...a,__processedComponents:j,...Te},l,c,v)}let ke=[];if(Kc(Ae)){let{processExpressions:se}=await o("stx/expressions",()=>import("./chunk-pagra8jv.js")),le=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...Te}:E.length>0?{...a,...Te}:a;Ae=se(Ae,le,l);for(let we of Ae.matchAll(/\{\{([\s\S]*?)\}\}/g))ke.push(we[1].trim())}let Je=G(Ae),ut=[],Ct=Je.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(se,le)=>{let we=Je.scripts[Number(le)]||"",he=we.match(/^<script\b([^>]*)>/i)?.[1]||"",He=he.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Ce=!He||["module","text/javascript","application/javascript"].includes(He),ct=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${he}`);if(!/\bserver\b/i.test(he)&&Ce&&!ct)return ut.push(we),"";return we}),{extractSlotContent:Yn}=await o("stx/slots",()=>import("./chunk-9j4xbeqs.js")),ft=Yn(Ct),dt={};if(ft.defaultSlot?.trim())dt.default=ft.defaultSlot;for(let[se,le]of ft.namedSlots)dt[se]=le.content;let pt=a.__stx_scope_seq??={n:0,key:zs(String(a.__filename??l))},Tt=So(e,process.cwd()),it=`stx_${(Tt.endsWith(".stx")?Tt.slice(0,-4):Tt).replace(/[^a-zA-Z0-9]/g,"_")}_${++pt.n}_${pt.key}`,Ue={...Ee,$uid:it,$native:c._nativeHostAttrs===!0,...n,props:n,slot:Ct,$slots:dt,__processedComponents:P,__sections:{},__stx_signals_gate:Se(ne)||Kc(t),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...ke]};Il(ne,Ue);let Lt=ne,sn=de(Lt);if(sn)Lt=sn.content.trim();let Qn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Bt=[...ne.matchAll(Qn)];for(let[,se,le]of Bt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(se))Oe(le,Q,c.strict);let qe=[],zt=null,es=Bt.some((se)=>/\bserver\b/.test(se[1]||"")&&/\bcache\b/.test(se[1]||"")),bt=null,Ye=null,Wt=null,rn=0,Ft=null;if(vl(c),es&&Qs>0){let se=El({props:n,slot:Ae,slotContext:t.trim()?kl(Ee):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...E].sort(),layers:c._layerGraph?.layers.map((le)=>le.configFile),uid:it});if(se!==null){bt=`${Q}\x00${x(ne)}\x00${se}`;let le=Xn.get(bt);if(le){for(let we of le.dependencies)v.add(we);if(Qr(a,le.clientFactories),pt.n+=le.uidsConsumed,le.preservedClientExpressions.length>0){let we=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let he of le.preservedClientExpressions)we.add(he);a.__stx_preserved_client_expressions=[...we]}return le.output}Ye=new Set(v),Wt=Gr(a),rn=pt.n,Ft=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Vt=new Set;for(let se of Bt){let le=se[1]||"",we=se[2]||"",he=le.includes("server");if(je(le)&&we.trim())we=Be(we);if(he&&we){for(let Ce of De(we))Vt.add(Ce);try{await N(we,Ue,Q,{onFailure:(Ce)=>{if(Ce.kind!=="unknown")zt=Ce.kind}})}catch(Ce){}}if(!he){let Ce=we.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),ct=Ce.includes("{{")&&Ce.includes("}}"),st=Ce.includes("{!!")&&Ce.includes("!!}");if(ct||st)Ce=bi(Ce,Ue,Q);let Zt=le.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");qe.push(`<script${Zt}>${Ce}</script>`)}}let Xe=G(ne).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Ut=Xe?Xe[1]:"",ts=Xe?Xe[2]:"",Qe="",ee=Ut&&/\bscoped\b/i.test(Ut);if(Xe)Qe=`<style${Ut}>${Pl(ts,Ue,Q)}</style>`;let re=Lt;if(re=re.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Xe)re=re.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let se=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,le=[];if(re=re.replace(se,(we,he)=>{let He=he.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(He)le.push(`<style${He[1]}>${He[2]}</style>`);return""}),re=re.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),le.length>0)Qe=`${Qe}${le.join(`
|
|
292
|
+
`)}`}if(t&&re.includes("{{ text || slot }}"))re=re.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>t);let{applySlots:me}=await o("stx/slots",()=>import("./chunk-9j4xbeqs.js")),{defaultSlot:ye,namedSlots:Re}=ft,Ke=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(Ct),et=c._nativeHostAttrs===!0&&qe.length>0||Ke&&qe.length>0||qe.some((se)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(se)),ns=(se)=>et?Vi(se,it):se,ss=new Map([...Re].map(([se,le])=>[se,{...le,content:ns(le.content)}]));re=await me(re,ns(ye),ss,Ue,et?it:"");let on=hi(qe),Ht=(Array.isArray(Ue.__stx_client_signal_names)?Ue.__stx_client_signal_names:[]).filter((se)=>!Vt.has(se));if(on.length>0||Ht.length>0)Ue.__stx_client_signal_names=[...new Set([...Ht,...on])];else delete Ue.__stx_client_signal_names;let Kt=E.filter((se)=>!Vt.has(se)&&!(se in n));if(Kt.length>0)Ue[Vn]=Kt;let an={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:ce.dirname(Q),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||et||qe.length===0,defaultLayout:void 0};Ue.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:cn}=await o("stx/process",()=>import("./chunk-hp44x2dq.js")),tt=await cn(re,Ue,Q,an,v),ot=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let se of tt.matchAll(/\{\{([\s\S]*?)\}\}/g))ot.add(se[1].trim());if(ot.size>0)a.__stx_preserved_client_expressions=[...ot];let nt=it,Ze=tt;if(et){let se="";if(Object.keys(n).length>0)try{se=` data-stx-props="${Ks(JSON.stringify(n))}"`}catch{}let le=X?` stx-hydrate="${Ks(X)}"`:"",we=Object.fromEntries(Object.entries(dt).map(([gt,yt])=>[gt,Boolean(yt)])),he=Object.keys(we).length>0?` data-stx-slots="${Ks(JSON.stringify(we))}"`:"",He=` data-stx-scope="${nt}"${se}${he}${le}`,Ce=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(tt),ct=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(tt),st=Ce?"span":"div",Zt=ct&&c._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':Ce||ct?' style="display:contents"':"";Ze=lg(tt,He)??`<${st}${He} data-stx-component-wrapper${Zt}>${tt}</${st}>`;let rs=await Promise.all(qe.map(async(gt)=>{let yt=gt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!yt)return gt;let[,ln,un]=yt,_n=fo(gt,Ue,Q);if(_n!==null)return _n;let _t=await Dl(un,Q,c.buildMode==="compile"),Sn=yn(_t.clientCode,Me(Ue)),{vendorStyleTags:$n}=_t,En=Sn?`function(__scopeId) {
|
|
293
293
|
${Sn}
|
|
294
294
|
return (${_t.factoryBody})(__scopeId);
|
|
295
295
|
}`:_t.factoryBody,mt=X?null:ys(a,En),kn=mt?`window.__stxComponentFactories[${JSON.stringify(mt)}](${JSON.stringify(nt)});`:`(${En})(${JSON.stringify(nt)});`;if(X)return`${$n}<script type="stx/island" data-stx-island="${nt}" data-stx-scoped data-stx-owner="${nt}"${ln}>${kn}</script>`;return`${$n}<script data-stx-scoped data-stx-run="always" data-stx-owner="${nt}"${ln}>${kn}</script>`}));if(Ze=Ze+`
|
|
@@ -315,7 +315,7 @@ ${$e.yellow}${$e.bold}Message:${$e.reset} ${n}
|
|
|
315
315
|
`,y)R+=`
|
|
316
316
|
${$e.blue}${$e.bold}Context:${$e.reset}
|
|
317
317
|
${$e.dim}${y}${$e.reset}
|
|
318
|
-
`;return R}function fe(){tn.clear(),qs.clear(),qn.clear(),Js.clear(),Ys.clear(),Xn.clear()}function Wh(){return{size:tn.size,maxSize:500}}var Zs=b(128);async function Dl(e,n,t){let i=x(e,n,t),a=Zs.get(i);if(a){if(Ds(a.deps))return a;Zs.delete(i)}let l=fi(e,{filePath:n,projectRoot:process.cwd()}),c=l.code,y=gi(l.styles);c=Dt(c).code;let{hasUserImports:v,bundleClientScript:E}=await o("stx/client-script-bundler",()=>import("./chunk-
|
|
318
|
+
`;return R}function fe(){tn.clear(),qs.clear(),qn.clear(),Js.clear(),Ys.clear(),Xn.clear()}function Wh(){return{size:tn.size,maxSize:500}}var Zs=b(128);async function Dl(e,n,t){let i=x(e,n,t),a=Zs.get(i);if(a){if(Ds(a.deps))return a;Zs.delete(i)}let l=fi(e,{filePath:n,projectRoot:process.cwd()}),c=l.code,y=gi(l.styles);c=Dt(c).code;let{hasUserImports:v,bundleClientScript:E}=await o("stx/client-script-bundler",()=>import("./chunk-1gt56hdz.js")),R=[],M=!1;if(v(c)){let L=c;c=await E(L,n,{projectRoot:process.cwd(),minify:t,collectInputs:R}),M=c===L}let{stripStxRuntimeImports:N}=await o("stx/signal-processing",()=>import("./chunk-16yv309r.js"));c=N(c);let j=A(c),P=Cl(j),D=new Set(z(j,!0).split(",").map((L)=>L.trim())),X=`function(__scopeId) {
|
|
319
319
|
${at("const",[...al,...P],j)}
|
|
320
320
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
321
321
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-bq9xf8nq.js";import"./chunk-9f6qx8b9.js";import"./chunk-2yxva96k.js";import"./chunk-
|
|
2
|
+
import"./chunk-bq9xf8nq.js";import"./chunk-9f6qx8b9.js";import"./chunk-2yxva96k.js";import"./chunk-wx6h1xs3.js";import"./chunk-27rzdq3n.js";import"./chunk-64gbacyk.js";import"./chunk-zxfptbac.js";import"./chunk-1165h1nv.js";import{l}from"./chunk-jdj1358b.js";import u from"fs";import m from"path";async function d(e,t={}){let s=Date.now(),n={total:0,passed:0,failed:0,new:0,failures:[],duration:0},i=t.snapshotDir||l(e.root,"story","snapshots");await u.promises.mkdir(i,{recursive:!0});let r=e.storyFiles;if(t.filter&&t.filter.length>0)r=r.filter((a)=>t.filter.some((o)=>a.fileName.toLowerCase().includes(o.toLowerCase())));for(let a of r)await h(a,i,t,n);return n.duration=Date.now()-s,n}async function h(e,t,s,n){let i=e.story;if(!i)return;for(let r of i.variants){n.total++;let a=m.join(t,`${e.id}-${r.id}.snap`),o=g(r.source||""),f=await w(a);if(s.update||!f){let p={storyId:e.id,variantId:r.id,component:e.fileName,timestamp:Date.now(),hash:o};if(await u.promises.writeFile(a,JSON.stringify(p,null,2)),!f)n.new++;n.passed++}else try{let p=await u.promises.readFile(a,"utf-8"),c=JSON.parse(p);if(c.hash===o)n.passed++;else n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:"Snapshot mismatch",difference:y(c.hash,o)})}catch(p){n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:`Error reading snapshot: ${p}`})}}}async function x(e,t={}){return(await d(e,{...t,update:!0})).total}function g(e){let t=0;for(let s=0;s<e.length;s++){let n=e.charCodeAt(s);t=(t<<5)-t+n,t=t&t}return t.toString(16)}function y(e,t){if(e===t)return 0;let s=Math.abs(Number.parseInt(e,16)-Number.parseInt(t,16));return Math.min(s/1e6,1)}async function w(e){try{return await u.promises.access(e),!0}catch{return!1}}function F(e){let t=[];if(t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(" STX Story Visual Regression Tests"),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),e.failures.length>0){t.push(" \u274C Failures:"),t.push("");for(let s of e.failures){if(t.push(` \u2022 ${s.component} / ${s.variantId}`),t.push(` ${s.message}`),s.difference!==void 0)t.push(` Difference: ${(s.difference*100).toFixed(2)}%`);t.push("")}}if(t.push(" Summary:"),t.push(` Total: ${e.total}`),t.push(` Passed: ${e.passed} \u2713`),t.push(` Failed: ${e.failed} \u2717`),e.new>0)t.push(` New: ${e.new} \u26A1`);return t.push(` Time: ${e.duration}ms`),t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),t.join(`
|
|
3
3
|
`)}export{F as formatTestResults,d as runVisualTests,x as updateSnapshots};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{k}from"./chunk-9f6qx8b9.js";import{xe,It,ii,ai,Rc,Ac,Pc,Ic,Ms,li,Oc,Nc,Dc,hn}from"./chunk-
|
|
2
|
+
import{k}from"./chunk-9f6qx8b9.js";import{xe,It,ii,ai,Rc,Ac,Pc,Ic,Ms,li,Oc,Nc,Dc,hn}from"./chunk-wx6h1xs3.js";import{a}from"./chunk-skn2n8jt.js";import{yo}from"./chunk-3q807nyz.js";import{l}from"./chunk-jdj1358b.js";import{existsSync as M,readFileSync as K}from"fs";import h from"path";var ge=new Set(["module","exports","require","$bool","$num","window","document","console","confirm","alert","fetch"]),ee=hn.filter((e)=>!ge.has(e)).sort(),te=[...k].sort(),me=[...new Set([...ee,...te])].sort(),he=new Set(ee),be=new Set(te),ye=new Set(me),Y=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function Se(e,t){if(t==="server")return`'${e}' is not provided by 'stx' in a <script server> block. The engine binds only its own names there (defineProps, state, useHead, ...); any other name becomes \`await import('stx')\`, which does not resolve, so the whole script fails when the page renders. Import it from '@stacksjs/stx' instead.`;return`'${e}' is not provided by 'stx' in a client <script> block. The import is replaced by the window.stx runtime, which has no '${e}', so it is undefined in the browser.`}function ne(e,t){let s=[];for(let u of t){if(u.offset===void 0)continue;let i=u.kind==="server"?he:be;Y.lastIndex=0;for(let c of u.code.matchAll(Y)){let g=c.index+c[0].indexOf("{")+1;for(let m of c[1].matchAll(/[^,]+/g)){let x=m[0];if(/^\s*type\s/.test(x))continue;let y=/^\s*([A-Za-z_$][\w$]*)/.exec(x);if(!y)continue;let r=y[1];if(!ye.has(r)||i.has(r))continue;let f=u.offset+g+m.index+y[0].length-r.length,p=e.slice(0,f),w=p.split(`
|
|
3
3
|
`).length;s.push({line:w,column:f-(p.lastIndexOf(`
|
|
4
4
|
`)+1)+1,offset:f,length:r.length,name:r,kind:u.kind,message:Se(r,u.kind)})}}}return s}import T from"path";var ke="@stacksjs/stx-typescript-plugin";function we(e,t){let s=T.resolve(e);for(;;){let u=T.join(s,"tsconfig.json");if(t(u))return u;let i=T.dirname(s);if(i===s)return;s=i}}function ie(e,t,s){let u=we(e,s);if(!u)return;let i=new Set,c=(g)=>{if(i.has(g))return;i.add(g);let m=t(g);if(!m)return;let x=m.compilerOptions?.plugins;if(Array.isArray(x)){let r=x.find((p)=>p?.name===ke),f=Array.isArray(r?.libs)?r.libs.filter((p)=>typeof p==="string"):[];return r?{configPath:g,libs:f.map((p)=>T.resolve(T.dirname(g),p))}:null}let y=typeof m.extends==="string"?[m.extends]:Array.isArray(m.extends)?m.extends:[];for(let r of[...y].reverse()){if(typeof r!=="string"||!r.startsWith("."))continue;let f=T.resolve(T.dirname(g),r.endsWith(".json")?r:`${r}.json`),p=c(f);if(p!==void 0)return p}return};return c(u)??void 0}function Nl(e,t="",s=""){let u=e.startLine>1?`
|
|
5
5
|
`.repeat(e.startLine-1):"",i=li(e)+ai(ii(e.code)),c=e.kind==="client"||e.kind==="plain"?Pc(t,e.code):"";return Ms(`${u+i}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Yg}from"./chunk-8rn1m9d1.js";import"./chunk-p3t400qx.js";import"./chunk-ra8f8sm2.js";import"./chunk-p8185yw2.js";import"./chunk-ert36h3v.js";import"./chunk-5hy66mfn.js";import"./chunk-10az8e1m.js";import"./chunk-n70ry0hg.js";import"./chunk-2gqhfge6.js";import"./chunk-bc91m8x8.js";import"./chunk-g2gk5qen.js";import"./chunk-dqpqc5ps.js";import"./chunk-he85ksa7.js";import"./chunk-5r1rdpeg.js";import"./chunk-p9gkz451.js";import"./chunk-wj78td69.js";import"./chunk-nw355jn6.js";import"./chunk-skn2n8jt.js";import"./chunk-1165h1nv.js";import"./chunk-zxfptbac.js";import"./chunk-605b93pe.js";import"./chunk-x8js27hd.js";import"./chunk-j2qv5ra2.js";import"./chunk-wx6h1xs3.js";import"./chunk-64gbacyk.js";import"./chunk-27rzdq3n.js";import"./chunk-bq9xf8nq.js";import"./chunk-2yxva96k.js";import"./chunk-9f6qx8b9.js";export{Yg as buildForProduction};
|
package/dist/cli.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
import"./chunk-bq9xf8nq.js";import"./chunk-9f6qx8b9.js";import"./chunk-2yxva96k.js";import{Pe,oe}from"./chunk-
|
|
3
|
+
import"./chunk-bq9xf8nq.js";import"./chunk-9f6qx8b9.js";import"./chunk-2yxva96k.js";import{Pe,oe}from"./chunk-wx6h1xs3.js";import"./chunk-27rzdq3n.js";import"./chunk-64gbacyk.js";import"./chunk-zxfptbac.js";import"./chunk-j2qv5ra2.js";import"./chunk-skn2n8jt.js";import"./chunk-x8js27hd.js";import"./chunk-605b93pe.js";import"./chunk-5hy66mfn.js";import"./chunk-nw355jn6.js";import"./chunk-10az8e1m.js";import"./chunk-bc91m8x8.js";import"./chunk-n70ry0hg.js";import"./chunk-k86mzdbd.js";import"./chunk-yzs2afn7.js";import"./chunk-c0ejyxfj.js";import"./chunk-cfpw4c6b.js";import"./chunk-416jy1m5.js";import"./chunk-vct6dec8.js";import"./chunk-ady8cnpb.js";import"./chunk-p3t400qx.js";import"./chunk-k0aejzg9.js";import"./chunk-rn9m8bmc.js";import"./chunk-ra8f8sm2.js";import"./chunk-cz8mka1b.js";import"./chunk-x8anspa5.js";import"./chunk-qbtb9pwe.js";import"./chunk-9tec9eap.js";import"./chunk-5r1rdpeg.js";import"./chunk-dqpqc5ps.js";import"./chunk-2gqhfge6.js";import"./chunk-h5tjm191.js";import"./chunk-gbx5vw81.js";import"./chunk-ert36h3v.js";import"./chunk-8rn1m9d1.js";import"./chunk-e22v0ad2.js";import"./chunk-5mng4x26.js";import"./chunk-td3qp5my.js";import"./chunk-eapt899m.js";import"./chunk-7sh9fa3q.js";import{en,tn}from"./chunk-7v0psycp.js";import"./chunk-3q807nyz.js";import"./chunk-xzb6gaq4.js";import"./chunk-r1jzbqr3.js";import"./chunk-9ct3gbyv.js";import"./chunk-w9d18r1t.js";import"./chunk-kf8hzvb7.js";import"./chunk-sxwgq49z.js";import"./chunk-rtam1h61.js";import"./chunk-ww636tcm.js";import{qi,Ki,Xi,Gi,so,Ji,Yi,Zi,oo,io,Fr,zr,Hr}from"./chunk-fs0nrg7g.js";import"./chunk-wphv66vs.js";import"./chunk-d18xd9x5.js";import"./chunk-p8185yw2.js";import"./chunk-g2gk5qen.js";import"./chunk-he85ksa7.js";import"./chunk-p9gkz451.js";import"./chunk-wj78td69.js";import{mc}from"./chunk-1165h1nv.js";import{g}from"./chunk-0dve54ne.js";import{spawn as R}from"child_process";import S from"fs";import f from"path";import n from"process";import{CLI as z}from"@stacksjs/clapp";var __dirname="/home/runner/work/stx/stx/packages/stx/bin",y=new z("stx");function E(h){let m=typeof h==="string"?Number.parseInt(h,10):h;if(Number.isNaN(m))return{isValid:!1,error:"Port must be a valid number",suggestion:"Try using a number between 1024 and 65535"};if(m<1024||m>65535)return{isValid:!1,error:"Port must be between 1024 and 65535",suggestion:"Try using a port between 1024 and 65535"};return{isValid:!0}}function A(h){try{if(!S.existsSync(h)){let x=f.dirname(h),t=f.basename(h);if(S.existsSync(x)){let o=S.readdirSync(x).filter((s)=>s.toLowerCase().includes(t.toLowerCase().substring(0,3))||s.endsWith(".stx")||s.endsWith(".md")),r=o.length>0?`File not found. Similar files in ${x}: ${o.slice(0,3).join(", ")}`:`File not found. Directory ${x} exists but doesn't contain the specified file.`;return{isValid:!1,error:`File does not exist: ${h}`,suggestion:r}}return{isValid:!1,error:`File does not exist: ${h}`,suggestion:"Check the file path and try again"}}if(S.statSync(h).isDirectory())return{isValid:!1,error:`Expected file but got directory: ${h}`,suggestion:"Specify a .stx or .md file path"};return{isValid:!0}}catch(m){return{isValid:!1,error:`Cannot access file: ${h}`,suggestion:"Check file permissions and path"}}}function I(h){let m=typeof h==="string"?Number.parseInt(h,10):h;if(Number.isNaN(m))return{isValid:!1,error:"Timeout must be a valid number",suggestion:"Specify timeout in milliseconds (e.g., 5000 for 5 seconds)"};if(m<100)return{isValid:!1,error:"Timeout too short (minimum 100ms)",suggestion:"Use a timeout of at least 100ms"};if(m>300000)return{isValid:!1,error:"Timeout too long (maximum 5 minutes)",suggestion:"Use a timeout of less than 300000ms (5 minutes)"};return{isValid:!0}}var O=(h)=>h.includes("*")||h.includes("?")||h.includes("{")||h.includes("["),W=(h)=>h.endsWith(".stx")||h.endsWith(".md");function F(h,m=1){if(console.error(`\u274C ${h.error}`),h.suggestion)console.error(`\uD83D\uDCA1 suggestion: ${h.suggestion}`);n.exit(m)}function M(h){if(!h)return;let m;try{m=JSON.parse(h)}catch(x){console.error(`\u274C --info-plist is not valid JSON: ${x.message}`),n.exit(1)}if(typeof m!=="object"||m===null||Array.isArray(m))console.error(`\u274C --info-plist must be a JSON object, e.g. '{"NSFocusStatusUsageDescription":"\u2026"}'`),n.exit(1);for(let[x,t]of Object.entries(m))if(typeof t!=="string"&&typeof t!=="number"&&typeof t!=="boolean")console.error(`\u274C --info-plist value for "${x}" must be a string, number or boolean`),n.exit(1);return m}async function V(h,m){try{let x=["test"],t=[];if(h&&h.length>0)for(let c of h)if(O(c))try{let i=await Array.fromAsync(new Bun.Glob(c).scan({onlyFiles:!0,absolute:!0}));if(i.length===0)console.warn(`Warning: No files found matching pattern: ${c}`);else if(t.push(...i),m.verbose)console.log(`Found ${i.length} file(s) matching pattern: ${c}`)}catch(i){return console.error(`Error expanding glob pattern ${c}:`,i),!1}else t.push(c);if(t.length===0)return console.error("Error: No test files found matching the provided patterns."),!1;if(x.push(...t),m.filter)x.push("--pattern",m.filter);if(m.timeout)x.push("--timeout",m.timeout.toString());if(m.reporter&&m.reporter!=="default")if(m.reporter==="junit"){let c=f.resolve("stx-test-report.xml");x.push("--reporter",m.reporter),x.push("--reporter-outfile",c),console.log(`JUnit report: ${c}`)}else console.warn(`Warning: Reporter '${m.reporter}' is not supported. Using default reporter.`);if(m.coverage)x.push("--coverage");if(m.watch)x.push("--watch");x.push("--preload",f.join(__dirname,"../../../test-utils/happy-dom.ts"));let e={...n.env,STX_TEST_MODE:"true",STX_TEST_UI:m.ui?"true":"false",STX_TEST_VERBOSE:m.verbose?"true":"false"},o="bun";if(m.verbose)console.log(`Running: ${o} ${x.join(" ")}`);let r=performance.now(),s=R(o,x,{stdio:"inherit",shell:!1,env:e});return new Promise((c)=>{s.on("close",(i)=>{let d=((performance.now()-r)/1000).toFixed(2);if(i===0)c(!0);else c(!1)}),n.on("SIGINT",()=>{console.log(`
|
|
4
4
|
Test run interrupted`),s.kill("SIGINT"),n.exit(1)})})}catch(x){return console.error("Error running tests:",x instanceof Error?x.message:String(x)),!1}}var U=n.argv.length>=3&&(W(n.argv[2])&&S.existsSync(n.argv[2])||O(n.argv[2]));if(U){let h=n.argv[2],m={port:3000,watch:!0,cache:!0,markdown:{syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}}};for(let x=3;x<n.argv.length;x++){let t=n.argv[x];if(t==="--port"&&x+1<n.argv.length){let e=E(n.argv[++x]);if(!e.isValid)F(e);m.port=Number.parseInt(n.argv[x],10)}else if(t==="--no-watch")m.watch=!1;else if(t==="--highlight-theme"&&x+1<n.argv.length){if(!m.markdown)m.markdown={};if(!m.markdown.syntaxHighlighting)m.markdown.syntaxHighlighting={};m.markdown.syntaxHighlighting.defaultTheme=n.argv[++x]}else if(t==="--no-highlight"){if(!m.markdown)m.markdown={};if(!m.markdown.syntaxHighlighting)m.markdown.syntaxHighlighting={};m.markdown.syntaxHighlighting.enabled=!1}else if(t==="--no-highlight-unknown"){if(!m.markdown)m.markdown={};if(!m.markdown.syntaxHighlighting)m.markdown.syntaxHighlighting={};m.markdown.syntaxHighlighting.highlightUnknownLanguages=!1}else if(t==="--no-cache")m.cache=!1;else if(t==="--native")m.native=!0}if(O(h))try{let x=await Array.fromAsync(new Bun.Glob(h).scan({onlyFiles:!0,absolute:!0})),t=h.endsWith(".stx")?x.filter((s)=>s.endsWith(".stx")):h.endsWith(".md")?x.filter((s)=>s.endsWith(".md")):x.filter((s)=>s.endsWith(".stx")||s.endsWith(".md")),e=h.split("*")[0].replace(/\/$/,"")||".",o=f.resolve(e);try{let s=new Bun.Glob("**/*.stx"),i=(await Array.fromAsync(s.scan({cwd:o,onlyFiles:!0,absolute:!0}))).filter((l)=>/\[.+\]/.test(f.basename(l)));for(let l of i)if(!t.includes(l))t.push(l)}catch{}if(t.length===0)console.error(`Error: No STX or Markdown files found matching pattern: ${h}`),n.exit(1);if(!await zr(t,m))n.exit(1)}catch(x){console.error("Failed to process files:",x),n.exit(1)}else Fr(h,m).catch((x)=>{console.error("Failed to start dev server:",x),n.exit(1)})}else{let h=function(t,e){let o=[];for(let r=0;r<=e.length;r++)o[r]=[r];for(let r=0;r<=t.length;r++)o[0][r]=r;for(let r=1;r<=e.length;r++)for(let s=1;s<=t.length;s++)if(e.charAt(r-1)===t.charAt(s-1))o[r][s]=o[r-1][s-1];else o[r][s]=Math.min(o[r-1][s-1]+1,o[r][s-1]+1,o[r-1][s]+1);return o[e.length][t.length]};y.command("docs","Generate documentation for components, templates, and directives").option("--output <dir>","Output directory for documentation",{default:"docs"}).option("--format <format>","Documentation format (markdown, html, json)",{default:"markdown"}).option("--components-dir <dir>","Components directory",{default:"components"}).option("--templates-dir <dir>","Templates directory",{default:"."}).option("--no-components","Disable components documentation").option("--no-templates","Disable templates documentation").option("--no-directives","Disable directives documentation").option("--extra-content <content>","Extra content to include in documentation").example("stx docs --output docs --format html").action(async(t)=>{try{if(await Gi(t))console.log("Documentation generated successfully."),n.exit(0);else console.error("Documentation generation failed."),n.exit(1)}catch(e){console.error("Error generating documentation:",e),n.exit(1)}}),y.command("iconify <command>","Generate Iconify icon packages").option("--output <dir>","Output directory for generated packages",{default:"packages"}).option("--icons <icons>","Comma-separated list of specific icons to generate").example("stx iconify list").example("stx iconify generate mdi").example("stx iconify generate lucide --icons home,settings,user").action(async(t,e)=>{try{let{fetchCollections:o,generatePackage:r}=await import("./chunk-3wkgd883.js");if(t==="list"){console.log(`
|
|
5
5
|
\uD83D\uDCDA Fetching available icon collections...
|
|
6
6
|
`);let s=await o(),c=Object.entries(s).sort((i,l)=>l[1].total-i[1].total);console.log(`Available collections:
|
|
7
7
|
`);for(let[i,l]of c){let d=l;console.log(` ${i.padEnd(30)} ${d.name} (${d.total} icons)`)}console.log(`
|
|
8
8
|
Total: ${c.length} collections`)}else if(t.startsWith("generate")){let s=t==="generate"?"":t.replace("generate:","").replace("generate-","").replace("generate","").trim();if(!s)console.error("Error: Please specify a collection prefix"),console.error("Usage: stx iconify generate <prefix> [--icons icon1,icon2,...]"),n.exit(1);let c=e.output||f.join(n.cwd(),"packages/collections"),i=e.icons?e.icons.split(",").map((l)=>l.trim()):void 0;await r(s,c,i),console.log(`
|
|
9
9
|
\u2713 Package generated successfully!`),console.log(`
|
|
10
|
-
To use the package:`),console.log(` 1. cd packages/collections/iconify-${s}`),console.log(" 2. bun install"),console.log(" 3. bun run build")}else console.error(`Unknown iconify command: ${t}`),console.error("Available commands: list, generate"),n.exit(1)}catch(o){console.error("Error:",o instanceof Error?o.message:String(o)),n.exit(1)}}),y.command("pwa <command>","PWA tools - audit configuration and build output").option("--output <dir>","Build output directory to audit",{default:"dist"}).example("stx pwa audit").example("stx pwa audit --output build").action(async(t,e)=>{try{if(t==="audit"){let{runPwaAudit:o,formatAuditResult:r}=await import("./chunk-8ds59ttd.js"),{loadConfig:s}=await import("./chunk-
|
|
10
|
+
To use the package:`),console.log(` 1. cd packages/collections/iconify-${s}`),console.log(" 2. bun install"),console.log(" 3. bun run build")}else console.error(`Unknown iconify command: ${t}`),console.error("Available commands: list, generate"),n.exit(1)}catch(o){console.error("Error:",o instanceof Error?o.message:String(o)),n.exit(1)}}),y.command("pwa <command>","PWA tools - audit configuration and build output").option("--output <dir>","Build output directory to audit",{default:"dist"}).example("stx pwa audit").example("stx pwa audit --output build").action(async(t,e)=>{try{if(t==="audit"){let{runPwaAudit:o,formatAuditResult:r}=await import("./chunk-8ds59ttd.js"),{loadConfig:s}=await import("./chunk-1kxj9mh7.js");console.log(`
|
|
11
11
|
\uD83D\uDD0D Running PWA audit...
|
|
12
12
|
`);let c=await s(),i=e.output||"dist",l=o(c,i);if(console.log(r(l)),l.failed>0)n.exit(1)}else console.error(`Unknown pwa command: ${t}`),console.error("Available commands: audit"),n.exit(1)}catch(o){console.error("Error:",o instanceof Error?o.message:String(o)),n.exit(1)}}),y.command("dev [file]","Start a development server for an STX app or file").option("--port <port>","Port to use for the dev server",{default:3000}).option("--pages <dir>",'Directory containing page templates (default: pagesDir from stx.config.ts, else "pages")').option("--no-watch","Disable file watching and auto-reload").option("--native","Open in a native desktop window using Zyte").option("--titlebar-hidden","Hide the native titlebar but keep the traffic-light buttons (web content draws under a transparent full-size titlebar). Implies --native.").option("--highlight-theme <theme>","Syntax highlighting theme for Markdown code blocks",{default:"github-dark"}).option("--no-highlight","Disable syntax highlighting for Markdown code blocks").option("--no-highlight-unknown","Disable syntax highlighting for unknown languages in Markdown").option("--no-cache","Disable caching of parsed files").option("--no-hmr","Disable HMR / live-reload script injection (useful for clean network traces)").option("--profile","Print per-directive timing for every page render via performanceMonitor").option("--debug-directives","Log directive ordering and intermediate template state during rendering").example("stx dev").example("stx dev --port 8080").example("stx dev --pages src/pages").example("stx dev template.stx").example("stx dev components/hero.stx --port 8080").example("stx dev **/*.stx").example("stx dev docs/guide.md").example("stx dev template.stx --native").action(async(t,e)=>{try{if(e.port!==void 0){let r=E(e.port);if(!r.isValid)F(r);e.port=Number.parseInt(String(e.port),10)}if(e.timeout!==void 0){let r=I(e.timeout);if(!r.isValid)F(r)}let o={syntaxHighlighting:{enabled:e.highlight!==!1,serverSide:!0,defaultTheme:e.highlightTheme||"github-dark",highlightUnknownLanguages:e.highlightUnknown!==!1}};if(!t){if(!await Hr(".",{port:e.port,watch:e.watch!==!1,native:e.native||e.titlebarHidden||!1,titlebarHidden:e.titlebarHidden===!0,cache:e.cache!==!1,hotReload:e.hmr!==!1,profile:e.profile===!0,debugDirectives:e.debugDirectives===!0,...e.pages&&{pagesDir:e.pages}}))n.exit(1);return}if(!O(t))try{let r=await import("fs");if(r.existsSync(t)&&r.statSync(t).isDirectory()){if(!await Hr(t,{port:e.port,watch:e.watch!==!1,native:e.native||e.titlebarHidden||!1,titlebarHidden:e.titlebarHidden===!0,cache:e.cache!==!1,hotReload:e.hmr!==!1,profile:e.profile===!0,debugDirectives:e.debugDirectives===!0,...e.pages&&{pagesDir:e.pages}}))n.exit(1);return}}catch{}if(O(t)){console.log(`Expanding glob pattern: ${t}`);let r=await oe.timeAsync("glob-expansion",async()=>Array.fromAsync(new Bun.Glob(t).scan({onlyFiles:!0,absolute:!0}))),s=t.endsWith(".stx")?r.filter((d)=>d.endsWith(".stx")):t.endsWith(".md")?r.filter((d)=>d.endsWith(".md")):r.filter((d)=>d.endsWith(".stx")||d.endsWith(".md"));if(s.length===0)console.error(`No STX or Markdown files found matching pattern: ${t}`),console.error("Try using patterns like '*.stx' or 'components/**/*.stx'"),n.exit(1);let c=t.split("*")[0].replace(/\/$/,"")||".",i=f.resolve(c);try{let d=new Bun.Glob("**/*.stx"),u=(await Array.fromAsync(d.scan({cwd:i,onlyFiles:!0,absolute:!0}))).filter((p)=>/\[.+\]/.test(f.basename(p)));for(let p of u)if(!s.includes(p))s.push(p)}catch{}if(console.log(`Found ${s.length} ${s.length===1?"file":"files"} matching ${t}`),!await zr(s,{port:e.port,watch:e.watch!==!1,native:e.native||e.titlebarHidden||!1,titlebarHidden:e.titlebarHidden===!0,markdown:o,cache:e.cache!==!1}))n.exit(1)}else{if(!O(t)){let s=A(t);if(!s.isValid)F(s)}if(!await Fr(t,{port:e.port,watch:e.watch!==!1,native:e.native||e.titlebarHidden||!1,titlebarHidden:e.titlebarHidden===!0,markdown:o,cache:e.cache!==!1}))n.exit(1)}}catch(o){console.error("Error starting dev server:",o),n.exit(1)}}),y.command("a11y [target]","Scan .stx files for accessibility issues (directory, file, or glob)").option("--no-recursive","Disable recursive scanning of directories").option("--ignore <paths>","Comma-separated paths to ignore",{default:""}).option("--json","Output results as JSON").option("--output <file>","Write results to a file instead of stdout").option("--fix","Automatically fix common accessibility issues").example("stx a11y ./templates").example('stx a11y "resources/**/*.stx"').example("stx a11y resources/emails/welcome.stx").example("stx a11y --json --output a11y-report.json").action(async(t=".",e)=>{try{console.log(`Scanning ${t} for accessibility issues...`);let o=e.ignore?e.ignore.split(",").map((l)=>l.trim()):[],{results:r,scannedFiles:s}=await mc(t,{recursive:e.recursive!==!1,ignorePaths:o});if(s.length===0)console.log(`
|
|
13
13
|
No .stx files matched ${t}
|
|
@@ -69,7 +69,7 @@ Total: ${i} issues in ${c} files`),e.output){let l=`
|
|
|
69
69
|
File not found: ${t}`),n.exit(1);if(!t.endsWith(".stx"))console.error(`
|
|
70
70
|
File must have .stx extension: ${t}`),n.exit(1)}let r=f.resolve(e.pages),s=f.resolve(e.out);if(!t&&!S.existsSync(r))console.error(`
|
|
71
71
|
Pages directory not found: ${r}`),console.log(`
|
|
72
|
-
Create a 'pages' directory with .stx files, or use --pages to specify a different directory.`),n.exit(1);let{buildApp:c}=await import("./chunk-
|
|
72
|
+
Create a 'pages' directory with .stx files, or use --pages to specify a different directory.`),n.exit(1);let{buildApp:c}=await import("./chunk-32s07ych.js");tn();let i=await c({root:t?f.dirname(t):void 0,debug:e.verbose,ssg:{pagesDir:e.pages,outputDir:e.out,domain:e.domain,baseUrl:e.base,sitemap:e.sitemap,rss:e.rss,minify:e.minify,cache:e.cache!==!1,cleanOutput:e.clean,concurrency:Number.parseInt(e.concurrency,10)||10,publicDir:e.public,trailingSlash:e.trailingSlash,generate404:!0,hooks:e.verbose?{onPageStart:(d)=>console.log(` Generating: ${d}`),onPageEnd:(d,a)=>console.log(` Generated: ${d} (${a.length} bytes)`),onError:(d,a)=>console.error(` Error in ${a}: ${d.message}`)}:void 0},ssr:{outputDir:e.out==="dist"?".output":e.out,debug:e.verbose}}),l=((performance.now()-o)/1000).toFixed(2);if(i.mode==="ssr"&&i.ssr)console.log(`
|
|
73
73
|
Build complete! (SSR)
|
|
74
74
|
`),console.log(` Pages compiled: ${i.ssr.pageCount}`),console.log(` Output: ${i.ssr.outputDir}`),console.log(` Duration: ${l}s
|
|
75
75
|
`);else if(i.ssg){if(console.log(`
|
|
@@ -84,7 +84,7 @@ Total: ${i} issues in ${c} files`),e.output){let l=`
|
|
|
84
84
|
Build completed with ${i.ssg.failedCount} error(s). Fix the issues above and try again.
|
|
85
85
|
`),n.exit(1);console.log(" To preview locally:"),console.log(` cd ${e.out||"dist"} && npx serve
|
|
86
86
|
`)}}catch(o){console.error(`
|
|
87
|
-
Build failed:`,o instanceof Error?o.message:String(o)),n.exit(1)}}),y.command("start","Start the production server (serves pre-built .output/)").option("--port <number>","Server port",{default:"3000"}).option("--output <dir>","Output directory from stx build",{default:".output"}).example("stx start").example("stx start --port 8080").action(async(t)=>{try{let e=f.resolve(t.output);if(!S.existsSync(f.join(e,"manifest.json")))console.error("\n No production build found. Run `stx build --out .output` first.\n"),n.exit(1);let{startProductionServer:o}=await import("./chunk-
|
|
87
|
+
Build failed:`,o instanceof Error?o.message:String(o)),n.exit(1)}}),y.command("start","Start the production server (serves pre-built .output/)").option("--port <number>","Server port",{default:"3000"}).option("--output <dir>","Output directory from stx build",{default:".output"}).example("stx start").example("stx start --port 8080").action(async(t)=>{try{let e=f.resolve(t.output);if(!S.existsSync(f.join(e,"manifest.json")))console.error("\n No production build found. Run `stx build --out .output` first.\n"),n.exit(1);let{startProductionServer:o}=await import("./chunk-vasw2fn4.js");await o({outputDir:e,port:Number.parseInt(t.port,10)||3000})}catch(e){console.error(`
|
|
88
88
|
Failed to start production server:`,e instanceof Error?e.message:String(e)),n.exit(1)}}),y.command("deploy [directory]","Deploy built site to Netlify").option("--site-id <id>","Netlify site ID (or set NETLIFY_SITE_ID env var)").option("--token <token>","Auth token (or set NETLIFY_AUTH_TOKEN env var)").option("--production","Deploy to production (default: draft preview)").option("--message <msg>","Deploy message/title").option("--no-build","Skip build step before deploy").option("--open","Open deployed URL in browser").option("--dry-run","Preview deployment without uploading").option("--init","Initialize Netlify configuration for this project").example("stx deploy").example("stx deploy --production").example("stx deploy dist --site-id my-site-abc123").example("stx deploy --init").example("stx deploy --dry-run").action(async(t,e)=>{try{let{deploy:o,initNetlify:r,DeployError:s}=await import("./chunk-zh8w0nb6.js");if(console.log(`\x1B[1mstx deploy\x1B[0m \x1B[2mv${Pe}\x1B[0m`),e.init){console.log(`
|
|
89
89
|
\uD83D\uDCDD Initializing Netlify configuration...
|
|
90
90
|
`);let i=await r({directory:t||n.cwd(),siteId:e.siteId});if(console.log(`\u2713 Created ${i.configPath}`),i.siteId)console.log("\u2713 Saved site ID to .env.local");console.log(`
|
|
@@ -124,7 +124,7 @@ To view it in the development server:`),console.log(` stx dev ${t}
|
|
|
124
124
|
\uD83D\uDCDD ${f.relative(n.cwd(),a)}:`),console.log("--- Original"),console.log("+++ Formatted"),console.log(`@@ Changes in ${f.basename(a)} @@`),console.log("+ Formatted content would be applied");else await Bun.write(a,b),console.log(`\u2705 Formatted ${f.relative(n.cwd(),a)}`),l++}catch(u){console.error(`\u274C Error formatting ${f.relative(n.cwd(),a)}:`,u),d++}if(e.check&&d>0)console.log(`
|
|
125
125
|
${d} files need formatting. Run 'stx format' to fix.`),n.exit(1);else if(!e.check&&!e.diff)console.log(`\u2728 Formatted ${l} files successfully`)}catch(o){console.error("Error formatting files:",o),n.exit(1)}}),y.command("perf [command...]","Show performance statistics for STX operations").option("--clear","Clear performance statistics").option("--json","Output as JSON").example("stx perf").example("stx perf --clear").example("stx perf --json").action(async(t,e)=>{try{if(e.clear){oe.clear(),console.log("\u2705 Performance statistics cleared");return}let o=oe.getStats();if(Object.keys(o).length===0){if(e.json){console.log(JSON.stringify({},null,2));return}console.log("No performance data available. Run some STX commands first.");return}if(e.json)console.log(JSON.stringify(o,null,2));else{console.log(`
|
|
126
126
|
\uD83D\uDCCA STX Performance Statistics
|
|
127
|
-
`);for(let[r,s]of Object.entries(o))console.log(`\uD83D\uDD27 ${r}:`),console.log(` Count: ${s.count}`),console.log(` Average: ${s.avgTime.toFixed(2)}ms`),console.log(` Total: ${s.totalTime.toFixed(2)}ms`),console.log(` Min: ${s.minTime.toFixed(2)}ms`),console.log(` Max: ${s.maxTime.toFixed(2)}ms`),console.log("")}}catch(o){console.error("Error showing performance stats:",o),n.exit(1)}}),y.command("typecheck [patterns...]","Type-check the TypeScript inside .stx script blocks").option("--no-client","Skip <script client> and bare <script> blocks").option("--no-server","Skip <script server> blocks").option("--no-templates","Skip {{ }} and directive expressions in the markup").option("--lib <path>","Extra ambient declaration file (repeatable)").example("stx typecheck").example('stx typecheck "resources/views/**/*.stx"').action(async(t,e)=>{let{formatTypecheckDiagnostics:o,typecheckStxFiles:r}=await import("./chunk-
|
|
127
|
+
`);for(let[r,s]of Object.entries(o))console.log(`\uD83D\uDD27 ${r}:`),console.log(` Count: ${s.count}`),console.log(` Average: ${s.avgTime.toFixed(2)}ms`),console.log(` Total: ${s.totalTime.toFixed(2)}ms`),console.log(` Min: ${s.minTime.toFixed(2)}ms`),console.log(` Max: ${s.maxTime.toFixed(2)}ms`),console.log("")}}catch(o){console.error("Error showing performance stats:",o),n.exit(1)}}),y.command("typecheck [patterns...]","Type-check the TypeScript inside .stx script blocks").option("--no-client","Skip <script client> and bare <script> blocks").option("--no-server","Skip <script server> blocks").option("--no-templates","Skip {{ }} and directive expressions in the markup").option("--lib <path>","Extra ambient declaration file (repeatable)").example("stx typecheck").example('stx typecheck "resources/views/**/*.stx"').action(async(t,e)=>{let{formatTypecheckDiagnostics:o,typecheckStxFiles:r}=await import("./chunk-ghxsmeh8.js"),{resolveStxTargets:s}=await import("./chunk-2vnhyter.js"),c=Array.isArray(t)?t:t?[t]:[],i=c.length?c:["**/*.stx"],l=await s(i);if(l.length===0){console.log(`
|
|
128
128
|
No .stx files matched ${i.join(", ")}
|
|
129
129
|
`);return}let d=qi(n.argv,"--lib"),a=d.length>0?d:e.lib?Array.isArray(e.lib)?e.lib:[e.lib]:[],u=await r(l,{client:e.client!==!1,server:e.server!==!1,templates:e.templates!==!1,extraLibs:a});if(u.failure)console.error(`
|
|
130
130
|
Type-check did not run.
|
|
@@ -160,11 +160,11 @@ Press Ctrl+C to stop watching...
|
|
|
160
160
|
\uD83D\uDCC4 Files with issues:`),d.forEach((a)=>{let u=a.issues.filter((p)=>s[p.type]>=c).length;if(u>0)console.log(` ${f.relative(n.cwd(),a.file)} (${u} issues)`)});if(e.saveReport){let a={summary:l,results:d,generatedAt:new Date().toISOString(),commandOptions:e};await Bun.write(e.saveReport,JSON.stringify(a,null,2)),console.log(`
|
|
161
161
|
\uD83D\uDCCB Analysis report saved to: ${e.saveReport}`)}console.log(`
|
|
162
162
|
\u2728 Analysis complete! Use --detailed for more information.`)}catch(o){console.error("Error analyzing templates:",o),n.exit(1)}}),y.command("screenshot [input]","Capture PNG screenshot(s) of page(s) via Bun WebView \u2014 a file, URL, or dist directory").option("--out <dir>","Output directory",{default:"screenshots"}).option("--width <px>","Viewport width",{default:"1440"}).option("--height <px>","Viewport height",{default:"2200"}).option("--wait <ms>","Settle time after navigation before capture",{default:"800"}).option("--timeout <ms>","Hard cap on waiting for navigation",{default:"15000"}).option("--full-page","Capture the entire scrollable page, not just the viewport").option("--wait-selector <sel>","Wait until a CSS selector exists before capturing").option("--format <fmt>","Image format: png | jpeg | webp",{default:"png"}).option("--backend <name>","WebView backend: webkit (macOS, default) | chrome").action(async(t,e)=>{let{captureScreenshots:o}=await import("./chunk-s53psb1j.js"),r=t||"dist";try{let s=await o(r,e.out,{width:Number.parseInt(e.width,10),height:Number.parseInt(e.height,10),waitMs:Number.parseInt(e.wait,10),timeoutMs:Number.parseInt(e.timeout,10),fullPage:Boolean(e.fullPage),waitSelector:e.waitSelector,format:e.format,backend:e.backend});for(let c of s)console.log(`\uD83D\uDCF8 ${c.output} (${(c.bytes/1024).toFixed(0)} KB)`);console.log(`
|
|
163
|
-
\u2728 Captured ${s.length} screenshot(s) to ${e.out}/ via Bun WebView`)}catch(s){console.error(`Screenshot failed: ${s.message}`),n.exit(1)}}),y.command("version","Show the version of the CLI").action(()=>{console.log(Pe)}),y.command("interactive","Start interactive REPL mode for template development").alias("i").option("--context <file>","Load initial context from JSON file").option("--cwd <directory>","Set working directory").option("--verbose","Show verbose output").action(async(t)=>{let{startInteractive:e}=await import("./chunk-
|
|
163
|
+
\u2728 Captured ${s.length} screenshot(s) to ${e.out}/ via Bun WebView`)}catch(s){console.error(`Screenshot failed: ${s.message}`),n.exit(1)}}),y.command("version","Show the version of the CLI").action(()=>{console.log(Pe)}),y.command("interactive","Start interactive REPL mode for template development").alias("i").option("--context <file>","Load initial context from JSON file").option("--cwd <directory>","Set working directory").option("--verbose","Show verbose output").action(async(t)=>{let{startInteractive:e}=await import("./chunk-kv9qbqr9.js"),o={};if(t.context){let r=f.resolve(t.context);if(S.existsSync(r))try{let s=S.readFileSync(r,"utf-8");o=JSON.parse(s)}catch(s){console.error("Error loading context file:",s),n.exit(1)}else console.error(`Context file not found: ${r}`),n.exit(1)}await e({context:o,cwd:t.cwd?f.resolve(t.cwd):n.cwd(),verbose:t.verbose})}),y.command("build:native <input>","Build stx template into a native desktop/mobile app").option("--output <dir>","Output directory",{default:"dist/native"}).option("--target <platform>","Target platform: macos, windows, linux, ios, android").option("--format <format>","Output format: app, dmg, pkg, msi, zip, deb, rpm, appimage, ipa, apk").option("--name <name>","Application name (defaults to filename)").option("--version <version>","Application version",{default:"1.0.0"}).option("--description <desc>","Application description").option("--author <author>","Author/Maintainer name").option("--bundle-id <id>","Bundle identifier (macOS/iOS)").option("--icon <path>","Path to application icon").option("--width <width>","Window width",{default:"1200"}).option("--height <height>","Window height",{default:"800"}).option("--title <title>","Window title").option("--system-tray","Enable system tray/menubar mode").option("--menubar-only","Run without a dock icon (implied by --system-tray)").option("--category <type>","LSApplicationCategoryType (macOS)").option("--copyright <text>","NSHumanReadableCopyright (macOS)").option("--min-system-version <v>","LSMinimumSystemVersion (macOS)").option("--info-plist <json>","Extra Info.plist keys as a JSON object (macOS)").option("--dev-tools","Enable developer tools").option("--frameless","Create frameless window").option("--always-on-top","Keep window always on top").option("--craft-path <path>","Path to Craft binary").option("--verbose","Show verbose output").example("stx build:native app.stx --target macos").example("stx build:native app.stx --target macos --format dmg").example("stx build:native app.stx --target linux --format appimage").example('stx build:native app.stx --name "My App" --icon icon.png').action(async(t,e)=>{try{let{buildNative:o,getAvailableTargets:r,getAvailableFormats:s}=await import("./chunk-gt8n286r.js"),c=f.resolve(t);if(!S.existsSync(c))console.error(`\u274C Input file not found: ${t}`),n.exit(1);let i=r();if(e.target&&!["macos","windows","linux","ios","android"].includes(e.target))console.error(`\u274C Invalid target: ${e.target}`),console.error("\uD83D\uDCA1 Available targets: macos, windows, linux, ios, android"),console.error(`\uD83D\uDCA1 Targets available on this machine: ${i.join(", ")}`),n.exit(1);let l=e.target||i[0],d=s(l);if(e.format&&!d.includes(e.format))console.error(`\u274C Invalid format for ${l}: ${e.format}`),console.error(`\uD83D\uDCA1 Available formats: ${d.join(", ")}`),n.exit(1);console.log(`
|
|
164
164
|
\uD83D\uDD28 Building native app...`),console.log(` Input: ${t}`),console.log(` Target: ${l}`),console.log(` Format: ${e.format||"default"}`),console.log(` Output: ${e.output}
|
|
165
165
|
`);let a=await o({input:c,output:f.resolve(e.output),target:l,format:e.format,name:e.name,version:e.version,description:e.description,author:e.author,bundleId:e.bundleId,icon:e.icon?f.resolve(e.icon):void 0,window:{title:e.title,width:Number.parseInt(e.width,10),height:Number.parseInt(e.height,10),frameless:e.frameless,alwaysOnTop:e.alwaysOnTop},systemTray:e.systemTray,menubarOnly:e.menubarOnly,category:e.category,copyright:e.copyright,minimumSystemVersion:e.minSystemVersion,infoPlist:M(e.infoPlist),devTools:e.devTools,craftPath:e.craftPath,verbose:e.verbose});if(a.success){if(console.log("\u2705 Build successful!"),console.log(` Output: ${a.outputPath}`),a.duration)console.log(` Duration: ${(a.duration/1000).toFixed(2)}s`);if(l==="macos"&&a.format==="app")console.log(`
|
|
166
166
|
\uD83D\uDCA1 To run: open "${a.outputPath}"`);else if(l==="linux"&&a.format==="appimage")console.log(`
|
|
167
|
-
\uD83D\uDCA1 To run: chmod +x "${a.outputPath}" && "${a.outputPath}"`)}else console.error(`\u274C Build failed: ${a.error}`),n.exit(1)}catch(o){console.error(`\u274C Build error: ${o.message}`),n.exit(1)}}),y.command("story","Start component showcase and testing server").option("-p, --port <port>","Server port",{default:"6006"}).option("-o, --open","Open browser automatically",{default:!1}).option("--host <host>","Host to bind to",{default:"localhost"}).example("stx story").example("stx story --port 3000 --open").action(async(t)=>{try{let{devCommand:e}=await import("./chunk-
|
|
167
|
+
\uD83D\uDCA1 To run: chmod +x "${a.outputPath}" && "${a.outputPath}"`)}else console.error(`\u274C Build failed: ${a.error}`),n.exit(1)}catch(o){console.error(`\u274C Build error: ${o.message}`),n.exit(1)}}),y.command("story","Start component showcase and testing server").option("-p, --port <port>","Server port",{default:"6006"}).option("-o, --open","Open browser automatically",{default:!1}).option("--host <host>","Host to bind to",{default:"localhost"}).example("stx story").example("stx story --port 3000 --open").action(async(t)=>{try{let{devCommand:e}=await import("./chunk-j288z01t.js");await e({port:t.port?Number.parseInt(t.port,10):6006,open:t.open,host:t.host})}catch(e){console.error(`\u274C Story error: ${e.message}`),n.exit(1)}}),y.command("story:build","Build static story site").option("-o, --outDir <dir>","Output directory",{default:".stx/dist/story"}).example("stx story:build").example("stx story:build --outDir ./docs/components").action(async(t)=>{try{let{buildCommand:e}=await import("./chunk-fpn4dren.js");await e({outDir:t.outDir})}catch(e){console.error(`\u274C Story build error: ${e.message}`),n.exit(1)}}),y.command("story:test","Run visual regression tests").option("-u, --update","Update snapshots",{default:!1}).option("-f, --filter <name>","Filter components by name").example("stx story:test").example("stx story:test --update").example("stx story:test --filter Button").action(async(t)=>{try{let{createContext:e}=await import("./chunk-cgamtmxv.js"),{runVisualTests:o,updateSnapshots:r,formatTestResults:s}=await import("./chunk-x5a7sm43.js"),c=await e({mode:"build"});if(t.update){let i=await r(c,{filter:t.filter?[t.filter]:void 0});console.log(`Updated ${i} snapshots`)}else{let i=await o(c,{filter:t.filter?[t.filter]:void 0});if(console.log(s(i)),i.failed>0)n.exit(1)}}catch(e){console.error(`\u274C Story test error: ${e.message}`),n.exit(1)}}),y.command("native <action> [file]","Compile .stx screens into the JavaScriptCore bundle Craft renders natively").option("--format <format>","bundle (the JavaScriptCore bundle) or ir (the template as JSON)",{default:"ir"}).option("--output <path>","Write to this file instead of stdout").option("--minify","Minify the bundle",{default:!1}).option("--config <file>","Screens config (default: native.config.json in the working directory)").example("stx native compile Screen.stx --format bundle --output native-screen.js").example("stx native compile --format bundle --output native-screen.js --minify").example("stx native compile Screen.stx").action(async(t,e,o)=>{if(t!=="compile")console.error(`Unknown native command: ${t}`),console.error("Usage: stx native compile [file.stx] --format bundle|ir [--output <file>] [--minify] [--config <file>]"),n.exit(1);try{let{runNativeCompile:r}=await import("./chunk-mcxk1ajm.js"),s=await r(e,{format:o.format,output:o.output,minify:Boolean(o.minify),config:o.config});for(let c of s.diagnostics)console.warn(`${c.level}: ${c.message}`);if(s.written)console.log(`Compiled: ${e??"screens"} \u2192 ${f.relative(n.cwd(),s.written)||s.written}`);else console.log(s.output)}catch(r){console.error(r instanceof Error?r.message:String(r)),n.exit(1)}}),y.command("compile <input>","Compile stx template to native Craft component code").option("--target <platform>","Target platform: macos, windows, linux, ios, android, universal",{default:"universal"}).option("--format <format>","Output format: zig, typescript, json",{default:"zig"}).option("--output <path>","Output directory for compiled files",{default:"./dist"}).option("--optimize","Enable optimizations",{default:!0}).option("--tree-shake","Enable tree shaking",{default:!0}).option("--hot-reload","Enable hot reload support",{default:!1}).option("--sourcemaps","Generate source maps",{default:!1}).option("--bundle","Bundle all dependencies",{default:!0}).option("--minify","Minify output",{default:!1}).option("--verbose","Show detailed output",{default:!1}).example("stx compile app.stx").example("stx compile app.stx --target macos --format zig").example("stx compile app.stx --format typescript --output ./native").example("stx compile app.stx --optimize --tree-shake --minify").action(async(t,e)=>{try{let{compileToNative:o}=await import("./chunk-xq2tfg4v.js"),r=f.resolve(t);if(!S.existsSync(r))console.error(`\u274C Input file not found: ${t}`),n.exit(1);let s=["macos","windows","linux","ios","android","universal"];if(!s.includes(e.target))console.error(`\u274C Invalid target: ${e.target}`),console.error(`\uD83D\uDCA1 Available targets: ${s.join(", ")}`),n.exit(1);let c=["zig","typescript","json"];if(!c.includes(e.format))console.error(`\u274C Invalid format: ${e.format}`),console.error(`\uD83D\uDCA1 Available formats: ${c.join(", ")}`),n.exit(1);console.log(`
|
|
168
168
|
\uD83D\uDD27 Compiling stx template to native code...`),console.log(` Input: ${t}`),console.log(` Target: ${e.target}`),console.log(` Format: ${e.format}`),console.log(` Output: ${e.output}
|
|
169
169
|
`);let i=S.readFileSync(r,"utf-8"),l=await o(i,{target:e.target,format:e.format,optimize:e.optimize,treeShake:e.treeShake,hotReload:e.hotReload,debug:e.verbose,sourceMaps:e.sourcemaps,bundle:e.bundle,minify:e.minify}),d=f.resolve(e.output);if(!S.existsSync(d))S.mkdirSync(d,{recursive:!0});let a=f.basename(t,f.extname(t)),u=e.format==="typescript"?"ts":e.format==="json"?"json":"zig",p=f.join(d,`${a}.${u}`);S.writeFileSync(p,l.code);let b=f.join(d,`${a}.manifest.json`);if(S.writeFileSync(b,JSON.stringify(l.manifest,null,2)),e.sourcemaps&&l.sourceMaps){let w=f.join(d,`${a}.${u}.map`);S.writeFileSync(w,l.sourceMaps)}if(e.target==="universal"&&l.platformCode.size>0)for(let[w,k]of l.platformCode){let v=f.join(d,`${a}.${w}.${u}`);S.writeFileSync(v,k)}if(console.log("\u2705 Compilation successful!"),console.log(` Output: ${p}`),console.log(` Manifest: ${b}`),console.log(`
|
|
170
170
|
\uD83D\uDCCA Statistics:`),console.log(` Compilation time: ${l.stats.compilationTime.toFixed(2)}ms`),console.log(` Total components: ${l.stats.totalComponents}`),console.log(` Native components: ${l.stats.nativeComponents}`),console.log(` Web fallback components: ${l.stats.webComponents}`),console.log(` Bundle size: ${(l.stats.bundleSize/1024).toFixed(2)}KB`),l.stats.warnings.length>0){console.log(`
|
package/dist/craft-entry.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{vo,ya,ba}from"./chunk-z2m9p8xe.js";import"./chunk-qby3e5nm.js";import"./chunk-bq9xf8nq.js";import"./chunk-9f6qx8b9.js";import"./chunk-2yxva96k.js";import"./chunk-
|
|
2
|
+
import{vo,ya,ba}from"./chunk-z2m9p8xe.js";import"./chunk-qby3e5nm.js";import"./chunk-bq9xf8nq.js";import"./chunk-9f6qx8b9.js";import"./chunk-2yxva96k.js";import"./chunk-wx6h1xs3.js";import"./chunk-27rzdq3n.js";import"./chunk-64gbacyk.js";import"./chunk-zxfptbac.js";import"./chunk-j2qv5ra2.js";import"./chunk-skn2n8jt.js";import"./chunk-x8js27hd.js";import"./chunk-605b93pe.js";import"./chunk-nw355jn6.js";import"./chunk-10az8e1m.js";import"./chunk-5hy66mfn.js";import"./chunk-bc91m8x8.js";import"./chunk-n70ry0hg.js";import"./chunk-5r1rdpeg.js";import"./chunk-dqpqc5ps.js";import"./chunk-2gqhfge6.js";import"./chunk-c0ejyxfj.js";import{du,wa,fh,gh,va,xo,Zr,xa,Sa,mh,hh,ka,_a,Ca,Ea}from"./chunk-2303xycv.js";import"./chunk-wphv66vs.js";import"./chunk-g2gk5qen.js";import"./chunk-he85ksa7.js";import"./chunk-p9gkz451.js";import"./chunk-wj78td69.js";import"./chunk-1165h1nv.js";var m=new Map,d=new Map;function R(t,e){let n=e?.id||E(t),r=I(t),a=m.get(n);if(a&&a.hash===r)return a;let i=M(t),s=L(t),o=W(t),c=O(i),{staticParts:p,dynamicParts:l}=A(i),f=_(t),g={id:n,hash:r,tree:i,scripts:s,styles:o,staticParts:p,dynamicParts:l,dependencies:f,metadata:c};return m.set(n,g),g}async function Q(t,e={},n={}){let r=performance.now();if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`,c=d.get(o);if(c&&Date.now()-c.timestamp<(n.cacheTTL||60000))return{html:c.html,styles:t.styles.join(`
|
|
3
3
|
`),scripts:t.scripts.join(`
|
|
4
4
|
`),metadata:{renderTime:0,cacheHit:!0,totalSize:c.html.length,componentCount:t.metadata.componentCount}}}let a;if(n.streaming)a=await H(t.tree,e);else a=h(t.tree,e);let i;if(n.hydrate){let o=j(a,t,e);a=o.html,i=o.data}if(n.minify)a=D(a);if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`;d.set(o,{html:a,timestamp:Date.now()})}let s=performance.now()-r;return{html:a,styles:t.styles.join(`
|
|
5
5
|
`),scripts:t.scripts.join(`
|