@stacksjs/stx 0.2.824 → 0.2.826
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-vvvaf66t.js → chunk-0scyzg9r.js} +3 -1
- package/dist/chunk-19gk9k01.js +2 -0
- package/dist/{chunk-x4pzwbns.js → chunk-1d67wtj4.js} +1 -1
- package/dist/{chunk-kqbkvfmg.js → chunk-21syn2j5.js} +1 -1
- package/dist/{chunk-fr1585t7.js → chunk-2c5bwrnh.js} +1 -1
- package/dist/{chunk-skh6pwy7.js → chunk-2fwssv2z.js} +1 -1
- package/dist/chunk-2v3r330m.js +3 -0
- package/dist/{chunk-hgwkrd4d.js → chunk-2vk7dtvs.js} +1 -1
- package/dist/{chunk-ejr5k9np.js → chunk-4amybnpc.js} +1 -1
- package/dist/{chunk-5rxd1r60.js → chunk-4qhz8q0d.js} +1 -1
- package/dist/{chunk-281eg1pf.js → chunk-4zjxj8ex.js} +1 -1
- package/dist/chunk-58e92xts.js +2 -0
- package/dist/{chunk-ccvcq9ve.js → chunk-82v1egn6.js} +1 -1
- package/dist/{chunk-phs7n6tk.js → chunk-897gqcby.js} +1 -1
- package/dist/{chunk-nx6kvnhw.js → chunk-8p86mpfv.js} +1 -1
- package/dist/{chunk-8nb1z4af.js → chunk-8qy616yt.js} +1 -1
- package/dist/{chunk-a2xy4z6q.js → chunk-8ycrmsba.js} +1 -1
- package/dist/{chunk-36ga0q0r.js → chunk-928y0wer.js} +6 -6
- package/dist/{chunk-9r0cx3k4.js → chunk-9kj5p5jq.js} +1 -1
- package/dist/{chunk-d6jcyxad.js → chunk-9z9c025j.js} +1 -1
- package/dist/{chunk-n2zger20.js → chunk-b64y3yh0.js} +1 -1
- package/dist/{chunk-0vtdhckb.js → chunk-bq7cfqk3.js} +1 -1
- package/dist/{chunk-56brw839.js → chunk-bwsz6sv4.js} +1 -1
- package/dist/{chunk-97d46jvh.js → chunk-cgtpbr01.js} +5 -5
- package/dist/{chunk-k5s6ngaf.js → chunk-cmf6ar8v.js} +2 -2
- package/dist/chunk-d0jcw9h6.js +2 -0
- package/dist/{chunk-w992as39.js → chunk-d9yjpdyn.js} +4 -4
- package/dist/{chunk-kfvbd9c9.js → chunk-e648sx8w.js} +1 -1
- package/dist/chunk-erf2g5b2.js +2 -0
- package/dist/{chunk-zxnfpy6r.js → chunk-exke928x.js} +1 -1
- package/dist/{chunk-z73wddy9.js → chunk-eycaj8mk.js} +1 -1
- package/dist/{chunk-kgjtq6fb.js → chunk-f05tmz4z.js} +2 -2
- package/dist/{chunk-3smq9j5a.js → chunk-fwk0gjbq.js} +1 -1
- package/dist/{chunk-jntc0v38.js → chunk-g25rz48g.js} +1 -1
- package/dist/{chunk-jbv8197c.js → chunk-gnt36wgk.js} +1 -1
- package/dist/{chunk-jkyw0xmt.js → chunk-h864en4b.js} +1 -1
- package/dist/{chunk-12g7me4m.js → chunk-he5njpsd.js} +1 -1
- package/dist/{chunk-jy0tvbtg.js → chunk-hhats9b3.js} +1 -1
- package/dist/{chunk-xjtm9gde.js → chunk-htdbm0sd.js} +1 -1
- package/dist/chunk-jzc3rw49.js +2 -0
- package/dist/{chunk-0hs4nee7.js → chunk-kep17bvj.js} +1 -1
- package/dist/{chunk-7vvhdrby.js → chunk-kfn7g24h.js} +1 -1
- package/dist/{chunk-akd4f3pg.js → chunk-kq5k2qbz.js} +1 -1
- package/dist/chunk-ksxtrmy2.js +2 -0
- package/dist/{chunk-cqq026d3.js → chunk-mfc5d181.js} +1 -1
- package/dist/{chunk-01d9sd40.js → chunk-mfy2ayv0.js} +1 -1
- package/dist/{chunk-aq5xxevm.js → chunk-p1sfwzmb.js} +1 -1
- package/dist/chunk-p9dma8k0.js +2 -0
- package/dist/{chunk-ct4qnbtn.js → chunk-pby6dxnc.js} +1 -1
- package/dist/chunk-q2ynwst2.js +2 -0
- package/dist/{chunk-9cpg01sv.js → chunk-q45xwvf6.js} +1 -1
- package/dist/{chunk-qsdwmymw.js → chunk-qp7dajd2.js} +1 -1
- package/dist/{chunk-n5kg8njw.js → chunk-rptnx3s6.js} +2 -2
- package/dist/{chunk-h1djr7rt.js → chunk-s8b6re34.js} +1 -1
- package/dist/{chunk-q5vej1ft.js → chunk-sk0tmtd3.js} +4 -4
- package/dist/{chunk-c9dywwkx.js → chunk-t9vwggkw.js} +3 -3
- package/dist/{chunk-wfh3g5w4.js → chunk-tgk2hcxv.js} +2 -2
- package/dist/{chunk-t9hrbrw0.js → chunk-tjhcrj3z.js} +4 -4
- package/dist/chunk-v2ps4gnx.js +2 -0
- package/dist/{chunk-zb3g4qvd.js → chunk-vwtejkb5.js} +27 -27
- package/dist/{chunk-pxm90y95.js → chunk-w45njn1r.js} +1 -1
- package/dist/chunk-x5r1cty7.js +2 -0
- package/dist/{chunk-caz5a61p.js → chunk-x5vxkypk.js} +1 -1
- package/dist/{chunk-nfzm71pr.js → chunk-x6863pzd.js} +2 -2
- package/dist/{chunk-w01f9n4r.js → chunk-y2bf32vg.js} +2 -2
- package/dist/{chunk-dd74gjmv.js → chunk-zd3dsp6p.js} +1 -1
- package/dist/cli.js +8 -8
- package/dist/client/signals-component-props-runtime.js +3 -1
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/process.js +8 -0
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-4ka2g6bp.js +0 -2
- package/dist/chunk-88th2wz6.js +0 -2
- package/dist/chunk-9cp6whxd.js +0 -2
- package/dist/chunk-aqesy5ac.js +0 -2
- package/dist/chunk-cknd3nb7.js +0 -2
- package/dist/chunk-crxtxw1d.js +0 -2
- package/dist/chunk-ezm9jzz1.js +0 -2
- package/dist/chunk-f6dm5a98.js +0 -2
- package/dist/chunk-kd8w41p2.js +0 -3
- package/dist/chunk-stp2hgag.js +0 -2
- package/dist/chunk-y9ak2xcy.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ze,xn,Ws,Si,N}from"./chunk-2vqpz4qv.js";import{vn}from"./chunk-kfvbd9c9.js";import{Or,k,dl,at,Ai,pl}from"./chunk-bt0amey5.js";import{P}from"./chunk-r9e0r6jx.js";import{T,qs,u,f,jt,d,q,F,x,Js,_e,Ve,Ys}from"./chunk-8ttmzcxb.js";import{r,ge}from"./chunk-b4x5ndt9.js";import{g}from"./chunk-0dve54ne.js";import{K}from"./chunk-wpendr22.js";import st from"path";import Ct from"process";import{AsyncLocalStorage as Go}from"async_hooks";var mr=new Go;function mn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function hr(e,t){return mr.run(mn(e),t)}async function $r(e,t){let i=mr.getStore();if(!i)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let n=i.pending.get(e);if(n)return n;let a=Promise.resolve().then(t).then((l)=>{let c=JSON.stringify(l,(v,E)=>{if(E===void 0||typeof E==="function"||typeof E==="symbol"||typeof E==="bigint"||typeof E==="number"&&!Number.isFinite(E))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(E&&typeof E==="object"&&!Array.isArray(E)&&Object.getPrototypeOf(E)!==Object.prototype&&Object.getPrototypeOf(E)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return E}),b=JSON.parse(c);return i.values.set(e,b),b}).catch((l)=>{throw i.pending.delete(e),l});return i.pending.set(e,a),a}function _r(e){let t=e.__stx_server_data;if(!t?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(t.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function H(e,t=!1){let i=r(e),n=[],a=new Set,l=0,c=0,b=i.length,v=()=>{if(l!==0)return;let E=i.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(E){if(t&&E[1]==="const")return;let I=E[2];if(!a.has(I))n.push(I),a.add(I);return}let A=i.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){if(t&&i.slice(c).startsWith("const"))return;A[1].split(",").forEach((I)=>{let z=I.trim();if(!z)return;let L=z.indexOf(":"),Q=(L>=0?z.slice(L+1).trim():z).split(/[\s=]/)[0];if(Q&&!a.has(Q))n.push(Q),a.add(Q)});return}let M=i.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(M){if(t&&i.slice(c).startsWith("const"))return;M[1].split(",").forEach((I)=>{let z=I.trim().replace(/^\.\.\./,"");if(!z)return;let L=z.split(/[\s=]/)[0];if(L&&!a.has(L))n.push(L),a.add(L)});return}if(t)return;let X=i.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(X){let I=X[1];if(!a.has(I))n.push(I),a.add(I);return}let j=i.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let I=j[1];if(!a.has(I))n.push(I),a.add(I)}};while(c<b){if(i[c]==="{"){l++,c++;continue}if(i[c]==="}"){l--,c++;continue}if(l===0&&/[a-z]/i.test(i[c])&&(c===0||/\s|[;{}()]/.test(i[c-1])))v();c++}return n.join(", ")}function Ps(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function Yo(e,t=H(e).split(",").map((i)=>i.trim()).filter(Boolean)){let i=new Set(H(e,!0).split(",").map((n)=>n.trim()));return t.map((n)=>i.has(n)?`get ${n}() { return ${n} }, set ${n}(__stxValue_${n}) { ${n} = __stxValue_${n} }`:n).join(", ")}function Is(e,t){let i=`{ ${Yo(e,t)} }`;return H(e).split(",").some((n)=>n.trim()==="__stxLiveBindings")?`Object.defineProperties(${i}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:i}import vt from"fs";import Ee from"path";function V(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Er=new Map;function yr(e,t=!0){let i=Er.get(e);if(t&&i)return i;let n=new Map,a=[Ee.join(e,"src"),Ee.join(e,"dist"),e];function l(c,b){if(b>6)return;let v;try{v=vt.readdirSync(c,{withFileTypes:!0})}catch{return}for(let E of v){let A=Ee.join(c,E.name);if(E.isDirectory()){if(E.name==="node_modules"||E.name.startsWith("."))continue;l(A,b+1)}else if(E.isFile()&&E.name.endsWith(".stx")){let M=E.name.slice(0,-4);if(!n.has(M))n.set(M,A);let X=M.toLowerCase();if(!n.has(X))n.set(X,A);let j=V(M);if(!n.has(j))n.set(j,A)}}}for(let c of a)if(l(c,0),n.size>0)break;if(t)Er.set(e,n);return n}function Os(e,t){if(e.startsWith(".")||e.startsWith("/"))return null;let i=t;while(!0){let n=Ee.join(i,"node_modules",e);try{if(vt.statSync(n).isDirectory())return n}catch{}let a=Ee.dirname(i);if(a===i)return null;i=a}}function Ns(e,t,i={}){return[Ee.resolve(Ee.dirname(t),`${e}.stx`),Ee.resolve(Ee.dirname(t),e),Ee.resolve(i.componentsDir||"components",`${e}.stx`),Ee.resolve(i.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function Rr(e){let t=e.endsWith(".stx")?e.slice(0,-4):e,i=t.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),n=V(t);return[t,i,n]}function oi(e,t){let[i,n,a]=Rr(e);for(let l of[i,i.toLowerCase(),n,a]){let c=t?.__importedComponents?.get(l);if(c!==void 0)return c}}function Qo(e,t){let i=t?Ee.resolve(t):void 0,n=Ee.dirname(Ee.resolve(e));for(;;){if(vt.existsSync(Ee.join(n,"package.json")))return i&&n===i?void 0:n;let a=Ee.dirname(n);if(a===n)return;n=a}}var ea=["src/ui","src/components","components","dist"];function us(e,t){let i=Ee.resolve(e);if(!t&&!i.split(Ee.sep).includes("node_modules"))return[];let n=Qo(i,t);if(!n)return[];let a=[];try{let b=JSON.parse(vt.readFileSync(Ee.join(n,"package.json"),"utf8")).stx?.components;if(Array.isArray(b))a=b.filter((v)=>typeof v==="string")}catch{}let l=a.length?a:ea;return[Ee.dirname(Ee.resolve(e)),...l.map((c)=>Ee.resolve(n,c))]}function*ii(e,t,i={},n){let a=Rr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield Ee.resolve(Ee.dirname(t),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],c=i.projectRoot||process.cwd(),b=[...us(t,i.projectRoot),...n?.__originalFilePath?[Ee.join(Ee.dirname(n.__originalFilePath),"components")]:[],...i.componentsDir?[i.componentsDir]:[],Ee.join(Ee.dirname(t),"components"),Ee.resolve(c,"src/components"),Ee.resolve(c,"components"),...import.meta.dir?[Ee.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(b)){for(let E of l)yield Ee.join(v,E);try{for(let E of vt.readdirSync(v,{withFileTypes:!0}))if(E.isDirectory())for(let A of l)yield Ee.join(v,E.name,A)}catch{}}}function Ar(e,t,i={},n){let a=oi(e,n);if(a!==void 0)return a;for(let l of ii(e,t,i,n))try{if(vt.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Ms(e,t=[],i={}){let n=new Set([...e].map((E)=>E.replace(/[-_]/g,"").toLowerCase()));if(!n.has("src")||!n.has("alt")&&!n.has("decorative"))return!1;let a=new Map(Object.entries(i).map(([E,A])=>[E.replace(/[-_]/g,"").toLowerCase(),A])),l=a.get("alt"),c=a.get("decorative"),b=typeof l==="string"&&!!l.trim(),v=typeof c==="string"?!["false","0","off","no"].includes(c.trim().toLowerCase()):Boolean(c);if(!b&&!v)return!1;if(["source","resizemode","defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((E)=>n.has(E)))return!1;if([...t].some((E)=>!["load","error"].includes(E.replace(/^@/,"").split(".")[0].toLowerCase())))return!1;return["fit","objectfit","position","objectposition","rounded","aspectratio","zoomonhover","sources","webpsrc","webpsrcset"].some((E)=>n.has(E))}import Jn from"fs";import ae from"path";import ht from"path";import Kt from"fs";var ta=new Set(["touchstart","touchmove","wheel","mousewheel"]);function fs(e,t){if(t.passive)return!0;if(t.prevent||t.nonpassive)return!1;return ta.has(e.toLowerCase())}var Tr=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),Ir={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},na=new Set(["ctrl","alt","shift","meta"]),jr={left:0,middle:1,right:2};function Pr(e){let t={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let i of e){let n=i.toLowerCase();if(n==="prevent")t.prevent=!0;else if(n==="stop")t.stop=!0;else if(n==="once")t.once=!0;else if(n==="capture")t.capture=!0;else if(n==="self")t.self=!0;else if(n==="passive")t.passive=!0;else if(n==="nonpassive")t.nonpassive=!0;else if(na.has(n))t.systemKeys.push(n);else if(n in jr)t.mouse=n;else if(n in Ir||/^[a-z]$/.test(n))t.keys.push(Ir[n]||n.toUpperCase());else if(n.startsWith("debounce")){let a=n.match(/debounce(?:\.(\d+))?/);t.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(n.startsWith("throttle")){let a=n.match(/throttle(?:\.(\d+))?/);t.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return t}function Dr(e,t=""){let i=[],n=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[c,b,v]=l,E=l.index,A=E+c.length,M=`__stx_evt_${t}${n++}`,X=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,I;while((I=j.exec(v))!==null){let[,L,B]=I,Q=L.split("."),D=Q[0];if(!Tr.has(D))continue;X.push({attribute:`@${L}`,event:D,handler:B,modifiers:Pr(Q.slice(1)),elementId:M})}let z=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((I=z.exec(v))!==null){let[,L,B]=I,Q=L.split("."),D=Q[0];if(!Tr.has(D))continue;X.push({attribute:`@${L}`,event:D,handler:B,modifiers:Pr(Q.slice(1)),elementId:M})}if(X.length>0)i.push({originalTag:c,elementId:M,events:X,startIndex:E,endIndex:A})}return i}function sa(e){let t=[],{modifiers:i}=e;if(i.self)t.push("if ($event.target !== $el) return");for(let n of i.systemKeys)t.push(`if (!$event.${n}Key) return`);if(i.keys.length>0){let n=i.keys.map((a)=>`$event.key === '${a}'`).join(" || ");t.push(`if (!(${n})) return`)}if(i.mouse!==null){let n=jr[i.mouse];t.push(`if ($event.button !== ${n}) return`)}if(i.prevent)t.push("$event.preventDefault()");if(i.stop)t.push("$event.stopPropagation()");return t.join("; ")}function ra(e,t){let i=e;if(t.debounce!==null)i=`__stx_debounce(() => { ${i} }, ${t.debounce})`;else if(t.throttle!==null)i=`__stx_throttle(() => { ${i} }, ${t.throttle})`;return i}function ps(e){let t=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(t))return e;return`if (typeof ${t} === 'function' && !${t}._isSignal) ${t}($event);`}function ia(e){let{modifiers:t}=e,i=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),n=sa(e),a=ra(ps(e.handler),t),l=[];if(t.once)l.push("once: true");if(t.capture)l.push("capture: true");if(fs(e.event,t))l.push("passive: true");let c=l.length>0?`, { ${l.join(", ")} }`:"",b=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
|
|
2
|
+
import{ze,xn,Ws,Si,N}from"./chunk-2vqpz4qv.js";import{vn}from"./chunk-e648sx8w.js";import{Or,k,dl,at,Ai,pl}from"./chunk-bt0amey5.js";import{P}from"./chunk-r9e0r6jx.js";import{T,qs,u,f,jt,d,q,F,x,Js,_e,Ve,Ys}from"./chunk-8ttmzcxb.js";import{r,ge}from"./chunk-b4x5ndt9.js";import{g}from"./chunk-0dve54ne.js";import{K}from"./chunk-wpendr22.js";import st from"path";import Ct from"process";import{AsyncLocalStorage as Go}from"async_hooks";var mr=new Go;function mn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function hr(e,t){return mr.run(mn(e),t)}async function $r(e,t){let i=mr.getStore();if(!i)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let n=i.pending.get(e);if(n)return n;let a=Promise.resolve().then(t).then((l)=>{let c=JSON.stringify(l,(v,E)=>{if(E===void 0||typeof E==="function"||typeof E==="symbol"||typeof E==="bigint"||typeof E==="number"&&!Number.isFinite(E))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(E&&typeof E==="object"&&!Array.isArray(E)&&Object.getPrototypeOf(E)!==Object.prototype&&Object.getPrototypeOf(E)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return E}),b=JSON.parse(c);return i.values.set(e,b),b}).catch((l)=>{throw i.pending.delete(e),l});return i.pending.set(e,a),a}function _r(e){let t=e.__stx_server_data;if(!t?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(t.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function H(e,t=!1){let i=r(e),n=[],a=new Set,l=0,c=0,b=i.length,v=()=>{if(l!==0)return;let E=i.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(E){if(t&&E[1]==="const")return;let I=E[2];if(!a.has(I))n.push(I),a.add(I);return}let A=i.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){if(t&&i.slice(c).startsWith("const"))return;A[1].split(",").forEach((I)=>{let z=I.trim();if(!z)return;let L=z.indexOf(":"),Q=(L>=0?z.slice(L+1).trim():z).split(/[\s=]/)[0];if(Q&&!a.has(Q))n.push(Q),a.add(Q)});return}let M=i.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(M){if(t&&i.slice(c).startsWith("const"))return;M[1].split(",").forEach((I)=>{let z=I.trim().replace(/^\.\.\./,"");if(!z)return;let L=z.split(/[\s=]/)[0];if(L&&!a.has(L))n.push(L),a.add(L)});return}if(t)return;let X=i.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(X){let I=X[1];if(!a.has(I))n.push(I),a.add(I);return}let j=i.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let I=j[1];if(!a.has(I))n.push(I),a.add(I)}};while(c<b){if(i[c]==="{"){l++,c++;continue}if(i[c]==="}"){l--,c++;continue}if(l===0&&/[a-z]/i.test(i[c])&&(c===0||/\s|[;{}()]/.test(i[c-1])))v();c++}return n.join(", ")}function Ps(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function Yo(e,t=H(e).split(",").map((i)=>i.trim()).filter(Boolean)){let i=new Set(H(e,!0).split(",").map((n)=>n.trim()));return t.map((n)=>i.has(n)?`get ${n}() { return ${n} }, set ${n}(__stxValue_${n}) { ${n} = __stxValue_${n} }`:n).join(", ")}function Is(e,t){let i=`{ ${Yo(e,t)} }`;return H(e).split(",").some((n)=>n.trim()==="__stxLiveBindings")?`Object.defineProperties(${i}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:i}import vt from"fs";import Ee from"path";function V(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Er=new Map;function yr(e,t=!0){let i=Er.get(e);if(t&&i)return i;let n=new Map,a=[Ee.join(e,"src"),Ee.join(e,"dist"),e];function l(c,b){if(b>6)return;let v;try{v=vt.readdirSync(c,{withFileTypes:!0})}catch{return}for(let E of v){let A=Ee.join(c,E.name);if(E.isDirectory()){if(E.name==="node_modules"||E.name.startsWith("."))continue;l(A,b+1)}else if(E.isFile()&&E.name.endsWith(".stx")){let M=E.name.slice(0,-4);if(!n.has(M))n.set(M,A);let X=M.toLowerCase();if(!n.has(X))n.set(X,A);let j=V(M);if(!n.has(j))n.set(j,A)}}}for(let c of a)if(l(c,0),n.size>0)break;if(t)Er.set(e,n);return n}function Os(e,t){if(e.startsWith(".")||e.startsWith("/"))return null;let i=t;while(!0){let n=Ee.join(i,"node_modules",e);try{if(vt.statSync(n).isDirectory())return n}catch{}let a=Ee.dirname(i);if(a===i)return null;i=a}}function Ns(e,t,i={}){return[Ee.resolve(Ee.dirname(t),`${e}.stx`),Ee.resolve(Ee.dirname(t),e),Ee.resolve(i.componentsDir||"components",`${e}.stx`),Ee.resolve(i.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function Rr(e){let t=e.endsWith(".stx")?e.slice(0,-4):e,i=t.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),n=V(t);return[t,i,n]}function oi(e,t){let[i,n,a]=Rr(e);for(let l of[i,i.toLowerCase(),n,a]){let c=t?.__importedComponents?.get(l);if(c!==void 0)return c}}function Qo(e,t){let i=t?Ee.resolve(t):void 0,n=Ee.dirname(Ee.resolve(e));for(;;){if(vt.existsSync(Ee.join(n,"package.json")))return i&&n===i?void 0:n;let a=Ee.dirname(n);if(a===n)return;n=a}}var ea=["src/ui","src/components","components","dist"];function us(e,t){let i=Ee.resolve(e);if(!t&&!i.split(Ee.sep).includes("node_modules"))return[];let n=Qo(i,t);if(!n)return[];let a=[];try{let b=JSON.parse(vt.readFileSync(Ee.join(n,"package.json"),"utf8")).stx?.components;if(Array.isArray(b))a=b.filter((v)=>typeof v==="string")}catch{}let l=a.length?a:ea;return[Ee.dirname(Ee.resolve(e)),...l.map((c)=>Ee.resolve(n,c))]}function*ii(e,t,i={},n){let a=Rr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield Ee.resolve(Ee.dirname(t),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],c=i.projectRoot||process.cwd(),b=[...us(t,i.projectRoot),...n?.__originalFilePath?[Ee.join(Ee.dirname(n.__originalFilePath),"components")]:[],...i.componentsDir?[i.componentsDir]:[],Ee.join(Ee.dirname(t),"components"),Ee.resolve(c,"src/components"),Ee.resolve(c,"components"),...import.meta.dir?[Ee.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(b)){for(let E of l)yield Ee.join(v,E);try{for(let E of vt.readdirSync(v,{withFileTypes:!0}))if(E.isDirectory())for(let A of l)yield Ee.join(v,E.name,A)}catch{}}}function Ar(e,t,i={},n){let a=oi(e,n);if(a!==void 0)return a;for(let l of ii(e,t,i,n))try{if(vt.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Ms(e,t=[],i={}){let n=new Set([...e].map((E)=>E.replace(/[-_]/g,"").toLowerCase()));if(!n.has("src")||!n.has("alt")&&!n.has("decorative"))return!1;let a=new Map(Object.entries(i).map(([E,A])=>[E.replace(/[-_]/g,"").toLowerCase(),A])),l=a.get("alt"),c=a.get("decorative"),b=typeof l==="string"&&!!l.trim(),v=typeof c==="string"?!["false","0","off","no"].includes(c.trim().toLowerCase()):Boolean(c);if(!b&&!v)return!1;if(["source","resizemode","defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((E)=>n.has(E)))return!1;if([...t].some((E)=>!["load","error"].includes(E.replace(/^@/,"").split(".")[0].toLowerCase())))return!1;return["fit","objectfit","position","objectposition","rounded","aspectratio","zoomonhover","sources","webpsrc","webpsrcset"].some((E)=>n.has(E))}import Jn from"fs";import ae from"path";import ht from"path";import Kt from"fs";var ta=new Set(["touchstart","touchmove","wheel","mousewheel"]);function fs(e,t){if(t.passive)return!0;if(t.prevent||t.nonpassive)return!1;return ta.has(e.toLowerCase())}var Tr=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),Ir={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},na=new Set(["ctrl","alt","shift","meta"]),jr={left:0,middle:1,right:2};function Pr(e){let t={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let i of e){let n=i.toLowerCase();if(n==="prevent")t.prevent=!0;else if(n==="stop")t.stop=!0;else if(n==="once")t.once=!0;else if(n==="capture")t.capture=!0;else if(n==="self")t.self=!0;else if(n==="passive")t.passive=!0;else if(n==="nonpassive")t.nonpassive=!0;else if(na.has(n))t.systemKeys.push(n);else if(n in jr)t.mouse=n;else if(n in Ir||/^[a-z]$/.test(n))t.keys.push(Ir[n]||n.toUpperCase());else if(n.startsWith("debounce")){let a=n.match(/debounce(?:\.(\d+))?/);t.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(n.startsWith("throttle")){let a=n.match(/throttle(?:\.(\d+))?/);t.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return t}function Dr(e,t=""){let i=[],n=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[c,b,v]=l,E=l.index,A=E+c.length,M=`__stx_evt_${t}${n++}`,X=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,I;while((I=j.exec(v))!==null){let[,L,B]=I,Q=L.split("."),D=Q[0];if(!Tr.has(D))continue;X.push({attribute:`@${L}`,event:D,handler:B,modifiers:Pr(Q.slice(1)),elementId:M})}let z=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((I=z.exec(v))!==null){let[,L,B]=I,Q=L.split("."),D=Q[0];if(!Tr.has(D))continue;X.push({attribute:`@${L}`,event:D,handler:B,modifiers:Pr(Q.slice(1)),elementId:M})}if(X.length>0)i.push({originalTag:c,elementId:M,events:X,startIndex:E,endIndex:A})}return i}function sa(e){let t=[],{modifiers:i}=e;if(i.self)t.push("if ($event.target !== $el) return");for(let n of i.systemKeys)t.push(`if (!$event.${n}Key) return`);if(i.keys.length>0){let n=i.keys.map((a)=>`$event.key === '${a}'`).join(" || ");t.push(`if (!(${n})) return`)}if(i.mouse!==null){let n=jr[i.mouse];t.push(`if ($event.button !== ${n}) return`)}if(i.prevent)t.push("$event.preventDefault()");if(i.stop)t.push("$event.stopPropagation()");return t.join("; ")}function ra(e,t){let i=e;if(t.debounce!==null)i=`__stx_debounce(() => { ${i} }, ${t.debounce})`;else if(t.throttle!==null)i=`__stx_throttle(() => { ${i} }, ${t.throttle})`;return i}function ps(e){let t=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(t))return e;return`if (typeof ${t} === 'function' && !${t}._isSignal) ${t}($event);`}function ia(e){let{modifiers:t}=e,i=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),n=sa(e),a=ra(ps(e.handler),t),l=[];if(t.once)l.push("once: true");if(t.capture)l.push("capture: true");if(fs(e.event,t))l.push("passive: true");let c=l.length>0?`, { ${l.join(", ")} }`:"",b=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
|
|
3
3
|
(function() {
|
|
4
4
|
var $el = document.getElementById('${i}');
|
|
5
5
|
if (!$el) return;
|
|
@@ -112,7 +112,7 @@ else {
|
|
|
112
112
|
`)}
|
|
113
113
|
})();
|
|
114
114
|
</script>`}function oa(e,t=""){let i=Dr(e,t);if(i.length===0)return{template:e,bindings:[]};let n=e,a=[];for(let l=i.length-1;l>=0;l--){let c=i[l],b=c.originalTag;if(!b.includes(" id="))b=b.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${c.elementId}"`);else{let v=b.match(/id=["']([^"']+)["']/);if(v)for(let E of c.events)E.elementId=v[1]}for(let v of c.events){let E=v.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),A=new RegExp(`\\s*${E}\\s*=\\s*"[^"]*"`,"g"),M=new RegExp(`\\s*${E}\\s*=\\s*'[^']*'`,"g");b=b.replace(A,""),b=b.replace(M,"")}n=n.slice(0,c.startIndex)+b+n.slice(c.endIndex),a.push(...c.events)}return{template:n,bindings:a}}function Mr(e){let t=e.$uid;return typeof t==="string"&&t?`${t}_`:""}function Rc(e,t,i){if(pl(e))return e;if(t.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:b,bindings:v}=oa(e,Mr(t)),E=t.__stx_event_bindings||[];return t.__stx_event_bindings=[...E,...v],b}let n=Dr(e,Mr(t));if(n.length===0)return e;let a=e;for(let b=n.length-1;b>=0;b--){let v=n[b],E=v.originalTag;if(!E.includes(" id="))E=E.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${v.elementId}"`);else{let A=E.match(/id=["']([^"']+)["']/);if(A)for(let M of v.events)M.elementId=A[1]}for(let A of v.events){let M=A.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`\\s*${M}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${M}\\s*=\\s*'[^']*'`,"g");E=E.replace(X,""),E=E.replace(j,"")}a=a.slice(0,v.startIndex)+E+a.slice(v.endIndex)}let l=ai(n.flatMap((b)=>b.events)),c=a.lastIndexOf("</body>");if(c!==-1)a=a.slice(0,c)+l+`
|
|
115
|
-
`+a.slice(c);else a+=l;return a}function Nr(e,t){let i=new Set;for(let n of e.split(",")){let a=n.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(t){let l=a.lastIndexOf(":");if(l!==-1)a=a.slice(l+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))i.add(a)}return i}function Rt(e,t){let i=r(e),{depths:n,balanced:a}=ge(i),l=(b)=>!a||n[b]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${t}\\b)`,"g");for(let b of i.matchAll(c)){let v=(b.index??0)+b[0].length-b[1].length;if(l(v))return!0}for(let b of i.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(b.index??0)&&Nr(b[1],!0).has(t))return!0;for(let b of i.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(b.index??0)&&Nr(b[1],!1).has(t))return!0;return!1}var Lr=new T(32,{maxBytes:2097152,sizeOf:(e)=>e.code.length*4}),dt=/^[A-Za-z_$][\w$]*$/,aa=new Set(["if","for","while","switch","with"]),zr=["(","[","{"],Br=[")","]","}"],ca=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function la(e){let t=r(e),i=[];for(let n of t.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=n.index??0;i.push({text:n[0],start:a,end:a+n[0].length})}return{code:t,tokens:i}}function ds(e){let t=Lr.get(e);if(t)return t;let{code:i,tokens:n}=la(e),a=new Map,l=[];for(let L=0;L<n.length;L++){let B=n[L].text;if(["(","[","{"].includes(B))l.push(L);else if([")","]","}"].includes(B)){let Q=l.at(-1);if(Q!==void 0&&["()","[]","{}"].includes(n[Q].text+B))l.pop(),a.set(Q,L),a.set(L,Q)}}function c(L,B){let Q=[],D=L;for(let ee=L;ee<B;ee++){if(["(","[","{"].includes(n[ee].text)&&(a.get(ee)??B)<B){ee=a.get(ee);continue}if(n[ee].text===",")Q.push([D,ee]),D=ee+1}return Q.push([D,B]),Q}let b=[];function v(L,B,Q,D=!1){if(n[L]?.text==="...")L++;if(L>=B)return;let ee=n[L].text;if(dt.test(ee)){if(Q.add(ee),Q===M)b.push({name:ee,token:L,functionScoped:D});return}if(ee!=="{"&&ee!=="[")return;let ne=a.get(L);if(ne===void 0||ne>=B)return;for(let[te,le]of c(L+1,ne)){let he=te;if(ee==="{")for(let ue=te;ue<le;ue++){if(n[ue].text===":"){he=ue+1;break}if(n[ue].text==="=")break;if(["(","[","{"].includes(n[ue].text)&&a.has(ue))ue=a.get(ue)}v(he,le,Q,D)}}function E(L,B){let Q=new Set;for(let[D,ee]of c(L,B))v(D,ee,Q);return Q}function A(L){let B=L;for(;B<n.length;B++){let Q=n[B].text;if(["(","[","{"].includes(Q)&&a.has(B)){B=a.get(B);continue}if([",",";",")","]","}"].includes(Q))break}return n[Math.max(L,B-1)]?.end??i.length}let M=new Set,X=[];for(let L=0;L<n.length;L++)if(n[L].text==="=>"){let B=L-1,Q=B,D;if(n[B]?.text===")"&&a.has(B))Q=a.get(B),D=E(Q+1,B);else if(n[B]&&dt.test(n[B].text))D=new Set([n[B].text]);else continue;let ee=L+1,ne=n[ee]?.text==="{"&&a.has(ee)?n[a.get(ee)].end:A(ee);X.push({start:n[Q].start,end:ne,bodyStart:n[ee]?.start??ne,functionBody:!0,names:D})}else if(n[L].text==="("&&a.has(L)){let B=n[L-1]?.text;if(!B||aa.has(B)||!dt.test(B)&&B!=="*"&&B!=="]")continue;let Q=a.get(L),D=Q+1;if(n[D]?.text===":"){D++;while(D<n.length&&!["{","=>",";","="].includes(n[D].text))D++}if(n[D]?.text!=="{"||!a.has(D))continue;X.push({start:n[L].start,end:n[a.get(D)].end,bodyStart:n[D].start,functionBody:B!=="catch",names:E(L+1,Q)})}function j(L){let B=L;for(;B<n.length;B++){let Q=n[B].text;if(zr.includes(Q)&&a.has(B)){B=a.get(B);continue}if(Q===";"||Br.includes(Q))break;let D=n[B-1];if(B>L&&ca.has(Q)&&D.text!==".")break;if(B>L&&/[\n\r]/.test(i.slice(D.end,n[B].start))&&(/^[\w$]+$/.test(D.text)||Br.includes(D.text)||['"',"'","`"].includes(D.text))&&dt.test(Q)&&!["in","of","instanceof"].includes(Q))break}return B}let I=[];for(let L=0;L<n.length;L++){if(n[L].text!=="for")continue;let B=n[L+1]?.text==="await"?L+2:L+1;if(n[B]?.text!=="("||!a.has(B))continue;let Q=a.get(B),D=Q+1,ee=n[D]?.text==="{"&&a.has(D)?a.get(D):j(D),ne=n[ee]?.text===";"||n[ee]?.text==="}"?n[ee].end:n[Math.max(D,ee-1)]?.end??i.length;I.push({headStart:B,headEnd:Q,start:n[B].start,end:ne})}for(let L=0;L<n.length;L++){let B=n[L].text,Q=n[L-1]?.text;if(Q==="."||n[L+1]?.text===":")continue;if(Q==="as"||Q==="<")continue;if(B==="const"||B==="let"||B==="var"){let D=j(L+1),ee=L+1,ne=!1,te=!1,le=0;for(let he=L+1;he<=D;he++){let ue=n[he]?.text;if(he<D&&zr.includes(ue)&&a.has(he)&&a.get(he)<D){he=a.get(he);continue}if(he<D&&ue===":"&&!te)ne=!0;else if(he<D&&ue==="="&&le===0)ne=!1,te=!0;else if(he<D&&ne&&ue==="<")le++;else if(he<D&&ne&&ue===">"&&le>0)le--;else if(he===D||ue===","&&le===0)v(ee,he,M,B==="var"),ee=he+1,ne=!1,te=!1}}else if(B==="function"||B==="class"){let D=L+1;if(n[D]?.text==="*")D++;if(n[D]&&dt.test(n[D].text)&&n[D].text!=="extends")M.add(n[D].text),b.push({name:n[D].text,token:D})}else if(B==="import"){let D=L+1;if(n[D]?.text==="*"&&n[D+1]?.text==="as")D+=2;let ee=n[D]?.text;if(ee&&dt.test(ee)&&ee!=="type"&&n[D+1]?.text!=="("&&n[D+1]?.text!==".")M.add(ee),b.push({name:ee,token:D,file:!0});let ne=n[D]?.text==="{"?D:n[D+1]?.text===","&&n[D+2]?.text==="{"?D+2:-1;if(ne!==-1&&a.has(ne)){let te=a.get(ne);for(let[le,he]of c(ne+1,te)){let ue=he-1;while(ue>=le&&!dt.test(n[ue].text))ue--;if(ue>=le&&n[ue].text!=="type")b.push({name:n[ue].text,token:ue,file:!0})}}}}let z={code:i,scopes:X,loops:I,declarations:M,sites:b,tokens:n,pairs:a};return Lr.set(e,z),z}function Zt(e){let t=ds(e);return{code:t.code,shadows:(i,n)=>t.scopes.some((a)=>n>=a.start&&n<a.end&&a.names.has(i))}}function In(e){return new Set(ds(e).declarations)}function Ie(e,t){let{scopes:i,loops:n,sites:a,tokens:l,pairs:c}=ds(e),b=Array.from({length:l.length},()=>-1),v=[];for(let j=0;j<l.length;j++){b[j]=v.length?v[v.length-1]:-1;let I=l[j].text;if(I==="{"&&c.has(j))v.push(j);else if(I==="}"&&v.length&&c.get(j)===v[v.length-1])v.pop()}let E=new Set,A=new Map;for(let j of a){if(!t.has(j.name))continue;E.add(j.token);let I=j.file?-1:b[j.token],z=I===-1?[0,Number.POSITIVE_INFINITY]:[l[I].start,l[c.get(I)].end];if(j.functionScoped){let B=l[j.token].start,Q=i.filter((D)=>D.functionBody&&B>=D.bodyStart&&B<D.end).sort((D,ee)=>D.end-D.bodyStart-(ee.end-ee.bodyStart))[0];z=Q?[Q.bodyStart,Q.end]:[0,Number.POSITIVE_INFINITY]}else if(!j.file){let B=n.filter((Q)=>j.token>Q.headStart&&j.token<Q.headEnd).sort((Q,D)=>Q.headEnd-Q.headStart-(D.headEnd-D.headStart))[0];if(B)z=[B.start,B.end]}let L=A.get(j.name);if(L)L.push(z);else A.set(j.name,[z])}let M=new Set;for(let j=0;j<l.length;j++){if(l[j].text!=="import"||l[j-1]?.text===".")continue;let I=j+1;if(l[I]?.text==="type")I++;if(l[I]&&dt.test(l[I].text)&&l[I+1]?.text===",")I+=2;if(l[I]?.text==="{"&&c.has(I))for(let z=I+1;z<c.get(I);z++)M.add(z)}let X=new Set;for(let j=0;j<l.length;j++){let I=l[j].text;if(!t.has(I)||X.has(I)||E.has(j)||M.has(j))continue;let z=l[j-1]?.text;if(z==="#"||z==="."&&l[j-2]?.text!=="..")continue;if(l[j+1]?.text===":"&&(z==="{"||z===","))continue;let L=l[j].start;if(A.get(I)?.some(([B,Q])=>L>=B&&L<Q))continue;if(i.some((B)=>L>=B.start&&L<B.end&&B.names.has(I)))continue;X.add(I)}return X}var Pe="0.2.824";var Wr=Symbol.for(`stx.lazy-module-promises.${Pe}`);function fa(){let e=globalThis;return e[Wr]??=new Map,e[Wr]}function o(e,t){let i=fa(),n=`${import.meta.url}\x00${e}`,a=i.get(n);if(a)return a;let l=t();return i.set(n,l),l.catch(()=>{if(i.get(n)===l)i.delete(n)}),l}var pa=/<\/(script)/gi;function dn(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(pa,"<\\/$1")}import Fr from"fs";var Vr=[];function w(e){let t=new T(e);return Vr.push(t),t}function Ac(){for(let e of Vr)e.clear()}function S(e,...t){return`${t.map((i)=>String(i??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function br(e){let t=[];for(let i of new Set(e))try{t.push({path:i,mtimeMs:Fr.statSync(i).mtimeMs})}catch{}return t}function Ds(e){for(let t of e)try{if(Fr.statSync(t.path).mtimeMs!==t.mtimeMs)return!1}catch{return!1}return!0}var xe=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl"];var da=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function ga(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let i=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!i)return null;return{pkg:i[1],subpath:i[2]||""}}let t=e.match(/^([^/]+)(\/.*)?$/);if(!t)return null;return{pkg:t[1],subpath:t[2]||""}}function ma(e,t){let i=t;while(!0){let n=ht.join(i,"node_modules",e,"package.json");if(Kt.existsSync(n))return ht.dirname(n);let a=ht.dirname(i);if(a===i)return null;i=a}}function ha(e,t){if(!e||typeof e!=="object")return null;let i=(a)=>{if(typeof a==="string")return a;if(a&&typeof a==="object"){if(typeof a.import==="string")return a.import;if(typeof a.default==="string")return a.default;if(typeof a.import==="object")return i(a.import);if(typeof a.default==="object")return i(a.default)}return null};if(Object.prototype.hasOwnProperty.call(e,t))return i(e[t]);let n=null;for(let a of Object.keys(e)){let l=a.indexOf("*");if(l===-1)continue;let c=a.slice(0,l),b=a.slice(l+1);if(!t.startsWith(c)||!t.endsWith(b))continue;if(t.length<c.length+b.length)continue;if(!n||c.length>n.prefix.length)n={pattern:a,prefix:c,suffix:b}}if(n){let a=t.slice(n.prefix.length,t.length-n.suffix.length),l=i(e[n.pattern]);if(l)return l.replace("*",a)}return null}function xa(e,t){let i=ga(e);if(!i||!i.subpath)return null;let n=ma(i.pkg,t);if(!n)return null;let a;try{a=JSON.parse(Kt.readFileSync(ht.join(n,"package.json"),"utf8"))}catch{return null}let l=`.${i.subpath}`,c=ha(a.exports,l);if(!c)return null;let b=ht.resolve(n,c);return Kt.existsSync(b)?b:null}function hi(e,t){let i=t.filePath?ht.dirname(t.filePath):t.projectRoot||process.cwd(),n=t.projectRoot||process.cwd(),a=new Set,l=[],c=[];return{code:e.replace(da,(v,E)=>{let A;try{if(E.startsWith("./")||E.startsWith("../")||E.startsWith("/")){if(A=E.startsWith("/")?E:ht.resolve(i,E),!Kt.existsSync(A))throw Error(`file not found: ${A}`)}else{let M=null;try{M=Bun.resolveSync(E,n)}catch{M=xa(E,n)}if(!M)throw Error(`could not resolve ${E} (Bun.resolveSync + exports fallback both failed)`);A=M}}catch(M){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(E)} (from ${t.filePath||"<unknown>"}): ${M?.message||M}`),c.push(E),""}if(a.has(A))return"";a.add(A);try{let M=Kt.readFileSync(A,"utf8");l.push({source:E,resolvedPath:A,contents:M})}catch(M){console.warn(`[stx:vendor-css] could not read ${A}: ${M?.message||M}`),c.push(E)}return""}),styles:l,unresolved:c}}function ba(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function yi(e){if(e.length===0)return"";return`${e.map((t)=>`<style data-stx-vendor="${ba(t.source)}" data-stx-layer="vendor">
|
|
115
|
+
`+a.slice(c);else a+=l;return a}function Nr(e,t){let i=new Set;for(let n of e.split(",")){let a=n.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(t){let l=a.lastIndexOf(":");if(l!==-1)a=a.slice(l+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))i.add(a)}return i}function Rt(e,t){let i=r(e),{depths:n,balanced:a}=ge(i),l=(b)=>!a||n[b]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${t}\\b)`,"g");for(let b of i.matchAll(c)){let v=(b.index??0)+b[0].length-b[1].length;if(l(v))return!0}for(let b of i.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(b.index??0)&&Nr(b[1],!0).has(t))return!0;for(let b of i.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(b.index??0)&&Nr(b[1],!1).has(t))return!0;return!1}var Lr=new T(32,{maxBytes:2097152,sizeOf:(e)=>e.code.length*4}),dt=/^[A-Za-z_$][\w$]*$/,aa=new Set(["if","for","while","switch","with"]),zr=["(","[","{"],Br=[")","]","}"],ca=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function la(e){let t=r(e),i=[];for(let n of t.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=n.index??0;i.push({text:n[0],start:a,end:a+n[0].length})}return{code:t,tokens:i}}function ds(e){let t=Lr.get(e);if(t)return t;let{code:i,tokens:n}=la(e),a=new Map,l=[];for(let L=0;L<n.length;L++){let B=n[L].text;if(["(","[","{"].includes(B))l.push(L);else if([")","]","}"].includes(B)){let Q=l.at(-1);if(Q!==void 0&&["()","[]","{}"].includes(n[Q].text+B))l.pop(),a.set(Q,L),a.set(L,Q)}}function c(L,B){let Q=[],D=L;for(let ee=L;ee<B;ee++){if(["(","[","{"].includes(n[ee].text)&&(a.get(ee)??B)<B){ee=a.get(ee);continue}if(n[ee].text===",")Q.push([D,ee]),D=ee+1}return Q.push([D,B]),Q}let b=[];function v(L,B,Q,D=!1){if(n[L]?.text==="...")L++;if(L>=B)return;let ee=n[L].text;if(dt.test(ee)){if(Q.add(ee),Q===M)b.push({name:ee,token:L,functionScoped:D});return}if(ee!=="{"&&ee!=="[")return;let ne=a.get(L);if(ne===void 0||ne>=B)return;for(let[te,le]of c(L+1,ne)){let he=te;if(ee==="{")for(let ue=te;ue<le;ue++){if(n[ue].text===":"){he=ue+1;break}if(n[ue].text==="=")break;if(["(","[","{"].includes(n[ue].text)&&a.has(ue))ue=a.get(ue)}v(he,le,Q,D)}}function E(L,B){let Q=new Set;for(let[D,ee]of c(L,B))v(D,ee,Q);return Q}function A(L){let B=L;for(;B<n.length;B++){let Q=n[B].text;if(["(","[","{"].includes(Q)&&a.has(B)){B=a.get(B);continue}if([",",";",")","]","}"].includes(Q))break}return n[Math.max(L,B-1)]?.end??i.length}let M=new Set,X=[];for(let L=0;L<n.length;L++)if(n[L].text==="=>"){let B=L-1,Q=B,D;if(n[B]?.text===")"&&a.has(B))Q=a.get(B),D=E(Q+1,B);else if(n[B]&&dt.test(n[B].text))D=new Set([n[B].text]);else continue;let ee=L+1,ne=n[ee]?.text==="{"&&a.has(ee)?n[a.get(ee)].end:A(ee);X.push({start:n[Q].start,end:ne,bodyStart:n[ee]?.start??ne,functionBody:!0,names:D})}else if(n[L].text==="("&&a.has(L)){let B=n[L-1]?.text;if(!B||aa.has(B)||!dt.test(B)&&B!=="*"&&B!=="]")continue;let Q=a.get(L),D=Q+1;if(n[D]?.text===":"){D++;while(D<n.length&&!["{","=>",";","="].includes(n[D].text))D++}if(n[D]?.text!=="{"||!a.has(D))continue;X.push({start:n[L].start,end:n[a.get(D)].end,bodyStart:n[D].start,functionBody:B!=="catch",names:E(L+1,Q)})}function j(L){let B=L;for(;B<n.length;B++){let Q=n[B].text;if(zr.includes(Q)&&a.has(B)){B=a.get(B);continue}if(Q===";"||Br.includes(Q))break;let D=n[B-1];if(B>L&&ca.has(Q)&&D.text!==".")break;if(B>L&&/[\n\r]/.test(i.slice(D.end,n[B].start))&&(/^[\w$]+$/.test(D.text)||Br.includes(D.text)||['"',"'","`"].includes(D.text))&&dt.test(Q)&&!["in","of","instanceof"].includes(Q))break}return B}let I=[];for(let L=0;L<n.length;L++){if(n[L].text!=="for")continue;let B=n[L+1]?.text==="await"?L+2:L+1;if(n[B]?.text!=="("||!a.has(B))continue;let Q=a.get(B),D=Q+1,ee=n[D]?.text==="{"&&a.has(D)?a.get(D):j(D),ne=n[ee]?.text===";"||n[ee]?.text==="}"?n[ee].end:n[Math.max(D,ee-1)]?.end??i.length;I.push({headStart:B,headEnd:Q,start:n[B].start,end:ne})}for(let L=0;L<n.length;L++){let B=n[L].text,Q=n[L-1]?.text;if(Q==="."||n[L+1]?.text===":")continue;if(Q==="as"||Q==="<")continue;if(B==="const"||B==="let"||B==="var"){let D=j(L+1),ee=L+1,ne=!1,te=!1,le=0;for(let he=L+1;he<=D;he++){let ue=n[he]?.text;if(he<D&&zr.includes(ue)&&a.has(he)&&a.get(he)<D){he=a.get(he);continue}if(he<D&&ue===":"&&!te)ne=!0;else if(he<D&&ue==="="&&le===0)ne=!1,te=!0;else if(he<D&&ne&&ue==="<")le++;else if(he<D&&ne&&ue===">"&&le>0)le--;else if(he===D||ue===","&&le===0)v(ee,he,M,B==="var"),ee=he+1,ne=!1,te=!1}}else if(B==="function"||B==="class"){let D=L+1;if(n[D]?.text==="*")D++;if(n[D]&&dt.test(n[D].text)&&n[D].text!=="extends")M.add(n[D].text),b.push({name:n[D].text,token:D})}else if(B==="import"){let D=L+1;if(n[D]?.text==="*"&&n[D+1]?.text==="as")D+=2;let ee=n[D]?.text;if(ee&&dt.test(ee)&&ee!=="type"&&n[D+1]?.text!=="("&&n[D+1]?.text!==".")M.add(ee),b.push({name:ee,token:D,file:!0});let ne=n[D]?.text==="{"?D:n[D+1]?.text===","&&n[D+2]?.text==="{"?D+2:-1;if(ne!==-1&&a.has(ne)){let te=a.get(ne);for(let[le,he]of c(ne+1,te)){let ue=he-1;while(ue>=le&&!dt.test(n[ue].text))ue--;if(ue>=le&&n[ue].text!=="type")b.push({name:n[ue].text,token:ue,file:!0})}}}}let z={code:i,scopes:X,loops:I,declarations:M,sites:b,tokens:n,pairs:a};return Lr.set(e,z),z}function Zt(e){let t=ds(e);return{code:t.code,shadows:(i,n)=>t.scopes.some((a)=>n>=a.start&&n<a.end&&a.names.has(i))}}function In(e){return new Set(ds(e).declarations)}function Ie(e,t){let{scopes:i,loops:n,sites:a,tokens:l,pairs:c}=ds(e),b=Array.from({length:l.length},()=>-1),v=[];for(let j=0;j<l.length;j++){b[j]=v.length?v[v.length-1]:-1;let I=l[j].text;if(I==="{"&&c.has(j))v.push(j);else if(I==="}"&&v.length&&c.get(j)===v[v.length-1])v.pop()}let E=new Set,A=new Map;for(let j of a){if(!t.has(j.name))continue;E.add(j.token);let I=j.file?-1:b[j.token],z=I===-1?[0,Number.POSITIVE_INFINITY]:[l[I].start,l[c.get(I)].end];if(j.functionScoped){let B=l[j.token].start,Q=i.filter((D)=>D.functionBody&&B>=D.bodyStart&&B<D.end).sort((D,ee)=>D.end-D.bodyStart-(ee.end-ee.bodyStart))[0];z=Q?[Q.bodyStart,Q.end]:[0,Number.POSITIVE_INFINITY]}else if(!j.file){let B=n.filter((Q)=>j.token>Q.headStart&&j.token<Q.headEnd).sort((Q,D)=>Q.headEnd-Q.headStart-(D.headEnd-D.headStart))[0];if(B)z=[B.start,B.end]}let L=A.get(j.name);if(L)L.push(z);else A.set(j.name,[z])}let M=new Set;for(let j=0;j<l.length;j++){if(l[j].text!=="import"||l[j-1]?.text===".")continue;let I=j+1;if(l[I]?.text==="type")I++;if(l[I]&&dt.test(l[I].text)&&l[I+1]?.text===",")I+=2;if(l[I]?.text==="{"&&c.has(I))for(let z=I+1;z<c.get(I);z++)M.add(z)}let X=new Set;for(let j=0;j<l.length;j++){let I=l[j].text;if(!t.has(I)||X.has(I)||E.has(j)||M.has(j))continue;let z=l[j-1]?.text;if(z==="#"||z==="."&&l[j-2]?.text!=="..")continue;if(l[j+1]?.text===":"&&(z==="{"||z===","))continue;let L=l[j].start;if(A.get(I)?.some(([B,Q])=>L>=B&&L<Q))continue;if(i.some((B)=>L>=B.start&&L<B.end&&B.names.has(I)))continue;X.add(I)}return X}var Pe="0.2.826";var Wr=Symbol.for(`stx.lazy-module-promises.${Pe}`);function fa(){let e=globalThis;return e[Wr]??=new Map,e[Wr]}function o(e,t){let i=fa(),n=`${import.meta.url}\x00${e}`,a=i.get(n);if(a)return a;let l=t();return i.set(n,l),l.catch(()=>{if(i.get(n)===l)i.delete(n)}),l}var pa=/<\/(script)/gi;function dn(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(pa,"<\\/$1")}import Fr from"fs";var Vr=[];function w(e){let t=new T(e);return Vr.push(t),t}function Ac(){for(let e of Vr)e.clear()}function S(e,...t){return`${t.map((i)=>String(i??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function br(e){let t=[];for(let i of new Set(e))try{t.push({path:i,mtimeMs:Fr.statSync(i).mtimeMs})}catch{}return t}function Ds(e){for(let t of e)try{if(Fr.statSync(t.path).mtimeMs!==t.mtimeMs)return!1}catch{return!1}return!0}var xe=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl"];var da=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function ga(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let i=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!i)return null;return{pkg:i[1],subpath:i[2]||""}}let t=e.match(/^([^/]+)(\/.*)?$/);if(!t)return null;return{pkg:t[1],subpath:t[2]||""}}function ma(e,t){let i=t;while(!0){let n=ht.join(i,"node_modules",e,"package.json");if(Kt.existsSync(n))return ht.dirname(n);let a=ht.dirname(i);if(a===i)return null;i=a}}function ha(e,t){if(!e||typeof e!=="object")return null;let i=(a)=>{if(typeof a==="string")return a;if(a&&typeof a==="object"){if(typeof a.import==="string")return a.import;if(typeof a.default==="string")return a.default;if(typeof a.import==="object")return i(a.import);if(typeof a.default==="object")return i(a.default)}return null};if(Object.prototype.hasOwnProperty.call(e,t))return i(e[t]);let n=null;for(let a of Object.keys(e)){let l=a.indexOf("*");if(l===-1)continue;let c=a.slice(0,l),b=a.slice(l+1);if(!t.startsWith(c)||!t.endsWith(b))continue;if(t.length<c.length+b.length)continue;if(!n||c.length>n.prefix.length)n={pattern:a,prefix:c,suffix:b}}if(n){let a=t.slice(n.prefix.length,t.length-n.suffix.length),l=i(e[n.pattern]);if(l)return l.replace("*",a)}return null}function xa(e,t){let i=ga(e);if(!i||!i.subpath)return null;let n=ma(i.pkg,t);if(!n)return null;let a;try{a=JSON.parse(Kt.readFileSync(ht.join(n,"package.json"),"utf8"))}catch{return null}let l=`.${i.subpath}`,c=ha(a.exports,l);if(!c)return null;let b=ht.resolve(n,c);return Kt.existsSync(b)?b:null}function hi(e,t){let i=t.filePath?ht.dirname(t.filePath):t.projectRoot||process.cwd(),n=t.projectRoot||process.cwd(),a=new Set,l=[],c=[];return{code:e.replace(da,(v,E)=>{let A;try{if(E.startsWith("./")||E.startsWith("../")||E.startsWith("/")){if(A=E.startsWith("/")?E:ht.resolve(i,E),!Kt.existsSync(A))throw Error(`file not found: ${A}`)}else{let M=null;try{M=Bun.resolveSync(E,n)}catch{M=xa(E,n)}if(!M)throw Error(`could not resolve ${E} (Bun.resolveSync + exports fallback both failed)`);A=M}}catch(M){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(E)} (from ${t.filePath||"<unknown>"}): ${M?.message||M}`),c.push(E),""}if(a.has(A))return"";a.add(A);try{let M=Kt.readFileSync(A,"utf8");l.push({source:E,resolvedPath:A,contents:M})}catch(M){console.warn(`[stx:vendor-css] could not read ${A}: ${M?.message||M}`),c.push(E)}return""}),styles:l,unresolved:c}}function ba(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function yi(e){if(e.length===0)return"";return`${e.map((t)=>`<style data-stx-vendor="${ba(t.source)}" data-stx-layer="vendor">
|
|
116
116
|
@layer vendor {
|
|
117
117
|
${t.contents}
|
|
118
118
|
}
|
|
@@ -182,7 +182,7 @@ else {
|
|
|
182
182
|
// STX: auto-generated event bindings
|
|
183
183
|
${e.map((i,n)=>Aa(i,n)).join(`
|
|
184
184
|
`)}`}function Zr(e){let t=[],i=new Set,n=e.replace(/^\s*import\s+.*$/gm,""),a=0,l=n.length,c=0;while(c<l){let b=n[c];if(b==="'"||b==='"'||b==="`"){let v=b;if(c++,v==="`"){let E=0;while(c<l){if(n[c]==="\\"){c+=2;continue}if(n[c]==="`"&&E===0){c++;break}if(n[c]==="$"&&n[c+1]==="{"){E++,c+=2;continue}if(n[c]==="}"&&E>0){E--,c++;continue}c++}}else while(c<l){if(n[c]==="\\"){c+=2;continue}if(n[c]===v){c++;break}c++}continue}if(b==="/"&&n[c+1]==="/"){while(c<l&&n[c]!==`
|
|
185
|
-
`)c++;continue}if(b==="/"&&n[c+1]==="*"){c+=2;while(c<l-1&&!(n[c]==="*"&&n[c+1]==="/"))c++;c+=2;continue}if(b==="{"){a++,c++;continue}if(b==="}"){a--,c++;continue}if(a===0){let v=n.slice(c),E=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(E){let X=E[1];if(!X.startsWith("_")&&!i.has(X))t.push(X),i.add(X);c+=E[0].length;continue}let A=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){A[1].split(",").forEach((X)=>{let j=X.trim(),I=j.indexOf(":"),z=I>=0?j.slice(I+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(z&&!z.startsWith("_")&&!i.has(z))t.push(z),i.add(z)}),c+=A[0].length;continue}let M=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(M){let X=M[1];if(!X.startsWith("_")&&!i.has(X))t.push(X),i.add(X);c+=M[0].length;continue}}c++}return t}var Ia=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function Pa(e){let t=new Set,i=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function n(X){let j;while((j=i.exec(X))!==null){let I=j[0];if(!Ia.has(I))t.add(I)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)n(l[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=c.exec(e))!==null)n(l[1]);let b=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=b.exec(e))!==null)n(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)n(l[1]);let E=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=E.exec(e))!==null)n(l[1]);let A=/@model\s*=\s*["']([^"']*)["']/gi;while((l=A.exec(e))!==null)n(l[1]);let M=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=M.exec(e))!==null)n(l[1]);return t}async function Le(e,t={}){let i=e,n="",a=!1,l=[],c=hi(i,{filePath:t.filePath,projectRoot:t.projectRoot});i=c.code;let b=yi(c.styles),v=Nt(i);i=v.code,l=[...v.imports,...v.models];let{hasUserImports:E,bundleClientScript:A}=await o("stx/client-script-bundler",()=>import("./chunk-
|
|
185
|
+
`)c++;continue}if(b==="/"&&n[c+1]==="*"){c+=2;while(c<l-1&&!(n[c]==="*"&&n[c+1]==="/"))c++;c+=2;continue}if(b==="{"){a++,c++;continue}if(b==="}"){a--,c++;continue}if(a===0){let v=n.slice(c),E=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(E){let X=E[1];if(!X.startsWith("_")&&!i.has(X))t.push(X),i.add(X);c+=E[0].length;continue}let A=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){A[1].split(",").forEach((X)=>{let j=X.trim(),I=j.indexOf(":"),z=I>=0?j.slice(I+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(z&&!z.startsWith("_")&&!i.has(z))t.push(z),i.add(z)}),c+=A[0].length;continue}let M=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(M){let X=M[1];if(!X.startsWith("_")&&!i.has(X))t.push(X),i.add(X);c+=M[0].length;continue}}c++}return t}var Ia=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function Pa(e){let t=new Set,i=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function n(X){let j;while((j=i.exec(X))!==null){let I=j[0];if(!Ia.has(I))t.add(I)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)n(l[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=c.exec(e))!==null)n(l[1]);let b=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=b.exec(e))!==null)n(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)n(l[1]);let E=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=E.exec(e))!==null)n(l[1]);let A=/@model\s*=\s*["']([^"']*)["']/gi;while((l=A.exec(e))!==null)n(l[1]);let M=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=M.exec(e))!==null)n(l[1]);return t}async function Le(e,t={}){let i=e,n="",a=!1,l=[],c=hi(i,{filePath:t.filePath,projectRoot:t.projectRoot});i=c.code;let b=yi(c.styles),v=Nt(i);i=v.code,l=[...v.imports,...v.models];let{hasUserImports:E,bundleClientScript:A}=await o("stx/client-script-bundler",()=>import("./chunk-897gqcby.js"));if(E(i))i=await A(i,t.filePath||"",{projectRoot:t.projectRoot,minify:t.production}),a=!0;if(t.autoImports!==!1){let D=Xc(i);i=D.code,n=Gc(D.stxImports,D.browserImports.filter((ee)=>!l.includes(ee)))}if(n=`${yn(i,t.serverData)}${n}`,i=P(i),!a&&je(t.attrs||""))i=Be(i);let M=Ta(t.eventBindings||[]),X=(t.attrs||"").trim(),j=/\btype\s*=\s*["']module["']/i.test(X),I=t.instanceId?` data-stx-instance="${t.instanceId}"`:"";if(j){let D=X.replace(/\btype\s*=\s*["']module["']/i,"").trim(),ee=`type="module" data-stx-scoped${I}${D?` ${D}`:""}`;return`${b}<script ${ee}>
|
|
186
186
|
${dn(`${n}${i}
|
|
187
187
|
${M}`)}
|
|
188
188
|
</script>`}let z=Ai(e),L=/function __stx_setup_/.test(i),B=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function Q(D){let ee=D.length>0?`
|
|
@@ -570,8 +570,8 @@ ${E.join(`
|
|
|
570
570
|
`){let I=e[a];if(I==="\\"){a+=2;continue}if(I==="[")j=!0;else if(I==="]")j=!1;else if(I==="/"&&!j){a++;while(a<l&&/[a-z]/i.test(e[a]))a++;return}a++}},X=()=>{if(n!==0)return;let j=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(j){let B=j[2].split(",").map((Q)=>{let D=Q.trim().split(":");return D[D.length-1].trim()});for(let Q of B)if(Q&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(Q)&&!i.has(Q))t.push(Q),i.add(Q);return}let I=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(I){let B=I[2];if(!i.has(B))t.push(B),i.add(B);return}let z=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let B=z[1];if(!i.has(B))t.push(B),i.add(B);return}let L=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let B=L[1];if(!i.has(B))t.push(B),i.add(B)}};while(a<l){if(v())continue;if(e[a]==="'"||e[a]==='"'){c(e[a]);continue}if(e[a]==="`"){b();continue}if(e[a]==="/"&&A()){M();continue}if(e[a]==="{"){n++,a++;continue}if(e[a]==="}"){n--,a++;continue}if(n===0&&/[a-z]/i.test(e[a])&&(a===0||/\s|[;{}()]/.test(e[a-1])))X();a++}return t}function Jl(e){let t=[],i=0,n=0,a=null;for(let l=0;l<e.length;l++){let c=e[l];if(a){if(c==="\\"){l++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="("||c==="["||c==="{")i++;else if(c===")"||c==="]"||c==="}")i--;else if(c===","&&i===0)t.push(e.slice(n,l)),n=l+1}if(n<e.length)t.push(e.slice(n));return t}function Gl(e){let t=0,i=null;for(let n=0;n<e.length;n++){let a=e[n];if(i){if(a==="\\"){n++;continue}if(a===i)i=null;continue}if(a==='"'||a==="'"||a==="`"){i=a;continue}if(a==="("||a==="["||a==="{")t++;else if(a===")"||a==="]"||a==="}")t--;else if(a==="="&&t===0){let l=e[n-1],c=e[n+1];if(l==="!"||l==="<"||l===">"||l==="=")continue;if(c==="="||c===">")continue;return n}}return-1}function Yl(e,t){try{let i=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!i)return;let n=i.index-1;while(n>=0&&/\s/.test(e[n]))n--;if(e[n]!=="}")return;let a=n,l=0,c=-1;for(;n>=0;n--){let v=e[n];if(v==="}")l++;else if(v==="{"){if(l--,l===0){c=n;break}}}if(c===-1)return;let b=e.slice(c+1,a);for(let v of Jl(b)){let E=v.trim();if(!E||E.startsWith("..."))continue;let A=Gl(E);if(A===-1)continue;let M=E.slice(0,A).trim();if(!/^[A-Z_$][\w$]*$/i.test(M))continue;if(t[M]!==void 0)continue;let X=E.slice(A+1).trim();if(!X)continue;try{let j=Object.keys(t).filter(jt),I=Function(...j,`"use strict"; return (${X});`);t[M]=I(...j.map((z)=>t[z]))}catch{}}}catch{}}var Ql=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function gg(e,t){let i=e.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!i)return null;let n=i[2].toLowerCase();if(!Ql.has(n))return null;let a=new RegExp(`<\\/?${n}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),l=y(e,(E,A)=>(a.lastIndex=A,a.exec(E)?.index===A?a.lastIndex:-1));if(n==="span"&&/\sdata-stx-scope\s*=/.test(l[0]?.token||""))return null;let c=0,b=!1;for(let E of l){if(c+=E.token.startsWith("</")?-1:1,c<0)return null;if(c===0){if(e.slice(E.end).trim())return null;b=!0;break}}if(!b)return null;let v=i[0].length;return e.slice(0,v)+t+e.slice(v)}function Oo(e,t){if(!e)return!1;return[...t.additionalComponentsDirs??[],...t.fallbackComponentsDir?[t.fallbackComponentsDir]:[]].some((n)=>{let a=ae.relative(ae.resolve(n),ae.resolve(e));return!a.startsWith("..")&&!ae.isAbsolute(a)})}async function Cr(e,t,i,n,a){let l=e.endsWith(".stx")?e.slice(0,-4):e,c=(te)=>te.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""),b=i.__importedComponents;if(b){for(let te of[l,l.toLowerCase(),c(l),V(l)])if(b.has(te))return!0}let v=[...new Set([`${l}.stx`,`${c(l)}.stx`,`${V(l)}.stx`])],E=typeof a.root==="string"?ae.resolve(a.root):void 0,A=E??ae.dirname(n),M=[],X=(te)=>{if(te&&!M.includes(te))M.push(te)};for(let te of us(n,E))X(te);let j=i.__originalFilePath;if(j)X(ae.join(ae.dirname(j),"components"));if(Oo(t,a))X(a._rootComponentsDir);X(t),X(a._rootComponentsDir),X(ae.join(ae.dirname(n),"components")),X(a.componentsDir);for(let te of a.additionalComponentsDirs??[])X(te);let I=a._targetComponentFallbackNames?.some((te)=>te.toLowerCase()===l.toLowerCase());if(!I)for(let te of a._targetComponentDirs??[])X(te);if(E)X(ae.resolve(E,"resources/views/components")),X(ae.resolve(E,"resources/components")),X(ae.resolve(E,"src/components")),X(ae.resolve(E,"components"));for(let te of a._layerComponentDirs??[])X(te);let z=a._pluginComponentDirs;if(Array.isArray(z))for(let te of z)X(typeof te==="string"?te:null);if(X(a.fallbackComponentsDir),I)for(let te of a._targetComponentDirs??[])X(te);let L=a._nativePrimitivesFallback;if(L&&!L.except.some((te)=>te.toLowerCase()===l.toLowerCase()))X(L.dir);if(l.startsWith("./")||l.startsWith("../"))return s(ae.resolve(ae.dirname(n),`${l}.stx`));let B=Eo(ae.resolve(import.meta.dir,"components")),Q=M.map((te)=>ae.isAbsolute(te)?te:ae.resolve(A,te)),D=`${v.join("\x00")}\x00\x00${Q.join("\x00")}`,ee=tr.get(D);if(ee!==void 0)return ee;let ne=!1;e:for(let te of Q){if(Eo(te)===B)continue;for(let le of v)if(await s(ae.join(te,le))){ne=!0;break e}}return tr.set(D,ne),ne}function Eo(e){let t=nr.get(e);if(t!==void 0)return t;let i=e;try{i=Jn.realpathSync(e)}catch{}return nr.set(e,i),i}function mg(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function Jc(e){if(!e)return!1;let t=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(t)}function eu(e,t,i){if(!e.includes("{{")&&!e.includes("{!!"))return e;let n=(a,l)=>{let c;try{c=R(a,t)}catch{return l}if(c===void 0||c===null)return"";let b=String(c);if(/<\/style/i.test(b))return console.warn(`[stx] a <style> expression in ${i??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return b};return e.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>n(l,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,l)=>n(l,a))}var ko=new Set;function Ro(e,t,i,n){let a=`${e}\x00${t}\x00${n??""}`;if(!process.env.STX_DEBUG&&ko.has(a))return;ko.add(a);let l=t?` used in ${t}`:"",c=n?` Cause: ${n}.`:"",b=i.length>0?`
|
|
571
571
|
searched:
|
|
572
572
|
${i.map((v)=>` - ${v}`).join(`
|
|
573
|
-
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${c}${b}`)}function Co(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var tu=new Set(["for","if","show","key","ref","class","className","style"]),Ao=new Set,Mo="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",Yc=new RegExp(`\\b(?:${Mo})\\s*(?:<[^>]*>)?\\s*\\(`);function bi(e){let t=new Set,i=new RegExp(`\\b(?:const|let|var)\\s+([a-zA-Z_$][\\w$]*)\\s*=\\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue|${Mo})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let n of e){let a;while((a=i.exec(n))!==null)t.add(a[1]);i.lastIndex=0}return[...t]}async function Fe(e,t,i,n,a,l,c,b=new Set,v,E=rt(a),A,M=e){let{extractVariables:X}=await o("stx/variable-extractor",()=>import("./chunk-zxnfpy6r.js")),j=b??new Set;if(j.has(e))return`[Circular component reference: ${e}]`;let I=new Set(j);I.add(e);let z=typeof t.client==="string"?t.client.trim():"";if("client"in t)delete t.client;let L=z&&z!=="load"&&mg(z)?z:"";try{let B=(re)=>re.split("-").map((ce)=>ce.charAt(0).toUpperCase()+ce.slice(1)).join(""),Q=M.endsWith(".stx")?M.slice(0,-4):M,D=null,ee=a.__importedComponents;if(ee){let re=[Q,Q.toLowerCase(),B(Q),V(Q)];for(let ce of re)if(ee.has(ce)){D=ee.get(ce);break}}let ne=[];if(!D){let re=[`${Q}.stx`,`${B(Q)}.stx`,`${V(Q)}.stx`],ce=[...new Set(re)],we=a.__originalFilePath,be=[];if(be.push(...c._layerComponentDirs??[]),we){let ye=ae.join(ae.dirname(we),"components");be.push(ye)}let He=c._rootComponentsDir;if(typeof He==="string"&&Oo(n,c)&&!be.includes(He))be.push(He);if(n&&!be.includes(n))be.push(n);if(typeof He==="string"&&!be.includes(He))be.push(He);let Te=ae.join(ae.dirname(l),"components");if(!be.includes(Te))be.push(Te);if(c.componentsDir&&c.componentsDir!==n&&!be.includes(c.componentsDir))be.push(c.componentsDir);for(let ye of c.additionalComponentsDirs??[])if(ye&&!be.includes(ye))be.push(ye);let ft=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(Q),pt=(A?.events??[]).map((ye)=>ye.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),yt=Object.hasOwn(t,"checked")||Boolean(A?.reactiveProps?.includes("checked")),ss=Object.hasOwn(t,"value")||Boolean(A?.reactiveProps?.includes("value")),rs=!pt.includes("valuechange")&&(yt||pt.includes("change")&&!ss),mt=c._nativeHostAttrs&&/^textinput$/i.test(Q),_t=pt.includes("update:value")&&!pt.includes("input"),qt=c._nativeHostAttrs&&/^video$/i.test(Q),is=c._nativeHostAttrs&&/^image$/i.test(Q),ln=Ms([...Object.keys(t),...A?.reactiveProps??[]],A?.events,t),wt=Object.hasOwn(t,"src")||Boolean(A?.reactiveProps?.includes("src")),un=Object.hasOwn(t,"source")||Boolean(A?.reactiveProps?.includes("source")),_n=qt&&(wt||un)&&(A?.events??[]).every((ye)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(ye.replace(/^@/,"").split(".")[0])),Sn=new Set(["","primary","secondary","outline","ghost","danger"]),$n=typeof t.variant==="string"?t.variant.trim().toLowerCase():"",En=c._nativeHostAttrs&&/^button$/i.test(Q)&&!Sn.has($n),ur=c._targetComponentFallbackNames?.some((ye)=>ye.toLowerCase()===Q.toLowerCase())&&(!ft||rs)&&(!mt||_t)&&(!qt||_n)&&(!is||ln)&&!En;for(let ye of ur?[]:c._targetComponentDirs??[])if(ye&&!be.includes(ye))be.push(ye);let St=typeof c.root==="string"?ae.resolve(c.root):void 0,Ko=St??ae.dirname(l),$t=[];if(St)$t.push(ae.resolve(St,"resources/views/components")),$t.push(ae.resolve(St,"resources/components")),$t.push(ae.resolve(St,"src/components")),$t.push(ae.resolve(St,"components"));$t.push(ae.resolve(import.meta.dir,"components"));for(let ye of $t)if(!be.includes(ye))be.push(ye);let fr=c._pluginComponentDirs;if(Array.isArray(fr)){for(let ye of fr)if(typeof ye==="string"&&!be.includes(ye))be.push(ye)}if(c.fallbackComponentsDir&&!be.includes(c.fallbackComponentsDir))be.push(c.fallbackComponentsDir);if(ur){for(let ye of c._targetComponentDirs??[])if(ye&&!be.includes(ye))be.push(ye)}let kn=c._nativePrimitivesFallback;if(kn&&!kn.except.some((ye)=>ye.toLowerCase()===Q.toLowerCase())&&!be.includes(kn.dir))be.push(kn.dir);let pr=[...new Set(be.map((ye)=>{if(!ye)return ye;return ae.isAbsolute(ye)?ye:ae.resolve(Ko,ye)}))];be.length=0,be.push(...pr);let os=`${Q}\x00${l}\x00${pr.join("\x00")}`,as=Kn.get(os);if(as)if(await s(as))D=as;else Kn.delete(os);if(!D&&(Q.startsWith("./")||Q.startsWith("../")))D=ae.resolve(ae.dirname(l),`${Q}.stx`),ne.push(D);else if(!D)for(let ye of be){if(!ye)continue;for(let Rn of ce){let Cn=ae.join(ye,Rn);if(ne.push(Cn),await s(Cn)){D=Cn;break}}if(D)break;if(!D)try{let Rn=await import("fs");if(!Rn.statSync(ye,{throwIfNoEntry:!1})?.isDirectory())continue;let Xo=8,cs=[{path:ye,depth:0}];while(cs.length>0&&!D){let An=cs.pop();if(An.depth>=Xo)continue;let dr;try{dr=Rn.readdirSync(An.path,{withFileTypes:!0})}catch{continue}for(let Tn of dr){if(!Tn.isDirectory())continue;if(Tn.name==="node_modules"||Tn.name.startsWith("."))continue;let gr=ae.join(An.path,Tn.name);for(let Jo of ce){let ls=ae.join(gr,Jo);if(ne.push(ls),await s(ls)){D=ls;break}}if(D)break;cs.push({path:gr,depth:An.depth+1})}}}catch{}if(D)break}if(D)Kn.set(os,D)}if(!D||!await s(D))return Ro(e,l,ne),Co(e);v.add(D);let te;if(tn.has(D)&&er.get(D)===So(D))te=tn.get(D);else try{let re=So(D);te=await Bun.file(D).text(),tn.set(D,te),er.set(D,re)}catch(re){let ce=re instanceof Error?re.message:String(re);return Ro(e,l,[D],ce),Co(e)}if(A)for(let re of new Set([...Object.keys(t),...A.reactiveProps??[]])){let ce=re.toLowerCase();if(ce.startsWith("aria-")||ce.startsWith("data-"))continue;let we=re.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${we}\\b`).test(te))A.declaredProps.add(re);if(new RegExp(`\\$props\\s*(?:\\.\\s*${we}\\b|\\[\\s*['"]${we}['"]\\s*\\])`).test(te)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${we}['"]`).test(te))A.consumedProps?.add(re)}if(A?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(te))for(let re of A.reactiveProps){if(tu.has(re)||A.consumedProps?.has(re))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${re.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(te))continue;let ce=`${D}\x00${re}`;if(Ao.has(ce))continue;Ao.add(ce),console.warn(`[stx] ${ae.basename(D)} reads \`${re}\` with defineProps(), which is not live, but ${ae.basename(l)} binds it (:${re}): the value can arrive empty or stale (on a native screen, and for a :for's rows, it does not arrive at all). Read it with useReactiveProp('${re}').`)}let le=new Set(["__originalFilePath","__importedComponents",Dn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),he={};for(let[re,ce]of Object.entries(a))if(!re.startsWith("__")||le.has(re))he[re]=ce;let ue=E.length>0?{[Fn]:[...E]}:{},Re=i;if(i.includes("@include")){let{processIncludes:re}=await o("stx/includes",()=>import("./chunk-ct4qnbtn.js"));Re=await re(i,a,l,c,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Re)){let{processComponents:re}=await o("stx/component-renderer",()=>import("./chunk-hgwkrd4d.js")),ce={...a,__processedComponents:j,...ue};Re=await re(Re,ce,l,c,v);let we=ce.__stx_preserved_client_expressions;if(Array.isArray(we)&&we.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...we])]}let Ae=[];if(Jc(Re)){let{processExpressions:re}=await o("stx/expressions",()=>import("./chunk-cqq026d3.js")),ce=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...ue}:E.length>0?{...a,...ue}:a;Re=re(Re,ce,l);for(let we of Re.matchAll(/\{\{([\s\S]*?)\}\}/g))Ae.push(we[1].trim())}let Ue=G(Re),Ke=[],Ye=Ue.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(re,ce)=>{let we=Ue.scripts[Number(ce)]||"",be=we.match(/^<script\b([^>]*)>/i)?.[1]||"",He=be.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Te=!He||["module","text/javascript","application/javascript"].includes(He),ft=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${be}`);if(!/\bserver\b/i.test(be)&&Te&&!ft)return Ke.push(we),"";return we}),{extractSlotContent:Xe}=await o("stx/slots",()=>import("./chunk-ccvcq9ve.js")),et=Xe(Ye),Je={};if(et.defaultSlot?.trim())Je.default=et.defaultSlot;for(let[re,ce]of et.namedSlots)Je[re]=ce.content;let gt=a.__stx_scope_seq??={n:0,key:Vs(String(a.__filename??l))},Tt=Po(e,process.cwd()),it=`stx_${(Tt.endsWith(".stx")?Tt.slice(0,-4):Tt).replace(/[^a-zA-Z0-9]/g,"_")}_${++gt.n}_${gt.key}`,We={...he,$uid:it,$native:c._nativeHostAttrs===!0,...t,props:t,slot:Ye,$slots:Je,__processedComponents:I,__sections:{},__stx_signals_gate:Se(te)||Jc(i),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Ae]};if(/import\s/.test(te)){We.__importedComponents=new Map(We.__importedComponents);let{processESImports:re}=await o("stx/component-renderer",()=>import("./chunk-hgwkrd4d.js"));te=await re(te,We,D,c,v)}Yl(te,We);let Dt=te,sn=de(Dt);if(sn)Dt=sn.content.trim();let Yn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Lt=[...te.matchAll(Yn)];for(let[,re,ce]of Lt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(re))Oe(ce,D,c.strict);let Ge=[],zt=null,Qn=Lt.some((re)=>/\bserver\b/.test(re[1]||"")&&/\bcache\b/.test(re[1]||"")),bt=null,ot=null,Bt=null,rn=0,Wt=null;if(Hl(c),Qn&&sr>0){let re=ql({props:t,slot:Re,slotContext:i.trim()?Zl(he):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...E].sort(),layers:c._layerGraph?.layers.map((ce)=>ce.configFile),uid:it});if(re!==null){bt=`${D}\x00${S(te)}\x00${re}`;let ce=Xn.get(bt);if(ce){for(let we of ce.dependencies)v.add(we);if(ti(a,ce.clientFactories),gt.n+=ce.uidsConsumed,ce.preservedClientExpressions.length>0){let we=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let be of ce.preservedClientExpressions)we.add(be);a.__stx_preserved_client_expressions=[...we]}return ce.output}ot=new Set(v),Bt=Qr(a),rn=gt.n,Wt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Ft=new Set;for(let re of Lt){let ce=re[1]||"",we=re[2]||"",be=ce.includes("server");if(je(ce)&&we.trim())we=Be(we);if(be&&we){for(let Te of Me(we))Ft.add(Te);try{await X(we,We,D,{onFailure:(Te)=>{if(Te.kind!=="unknown")zt=Te.kind}})}catch(Te){}}if(!be){let Te=we.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),ft=Te.includes("{{")&&Te.includes("}}"),pt=Te.includes("{!!")&&Te.includes("!!}");if(ft||pt)Te=vi(Te,We,D);let yt=ce.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Ge.push(`<script${yt}>${Te}</script>`)}}let Qe=G(te).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Vt=Qe?Qe[1]:"",es=Qe?Qe[2]:"",ct="",se=Vt&&/\bscoped\b/i.test(Vt);if(Qe)ct=`<style${Vt}>${eu(es,We,D)}</style>`;let ie=Dt;if(ie=ie.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Qe)ie=ie.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let re=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ce=[];if(ie=ie.replace(re,(we,be)=>{let He=be.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(He)ce.push(`<style${He[1]}>${He[2]}</style>`);return""}),ie=ie.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ce.length>0)ct=`${ct}${ce.join(`
|
|
574
|
-
`)}`}if(i&&ie.includes("{{ text || slot }}"))ie=ie.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>i);let{applySlots:me}=await o("stx/slots",()=>import("./chunk-
|
|
573
|
+
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${c}${b}`)}function Co(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var tu=new Set(["for","if","show","key","ref","class","className","style"]),Ao=new Set,Mo="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",Yc=new RegExp(`\\b(?:${Mo})\\s*(?:<[^>]*>)?\\s*\\(`);function bi(e){let t=new Set,i=new RegExp(`\\b(?:const|let|var)\\s+([a-zA-Z_$][\\w$]*)\\s*=\\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue|${Mo})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let n of e){let a;while((a=i.exec(n))!==null)t.add(a[1]);i.lastIndex=0}return[...t]}async function Fe(e,t,i,n,a,l,c,b=new Set,v,E=rt(a),A,M=e){let{extractVariables:X}=await o("stx/variable-extractor",()=>import("./chunk-exke928x.js")),j=b??new Set;if(j.has(e))return`[Circular component reference: ${e}]`;let I=new Set(j);I.add(e);let z=typeof t.client==="string"?t.client.trim():"";if("client"in t)delete t.client;let L=z&&z!=="load"&&mg(z)?z:"";try{let B=(re)=>re.split("-").map((ce)=>ce.charAt(0).toUpperCase()+ce.slice(1)).join(""),Q=M.endsWith(".stx")?M.slice(0,-4):M,D=null,ee=a.__importedComponents;if(ee){let re=[Q,Q.toLowerCase(),B(Q),V(Q)];for(let ce of re)if(ee.has(ce)){D=ee.get(ce);break}}let ne=[];if(!D){let re=[`${Q}.stx`,`${B(Q)}.stx`,`${V(Q)}.stx`],ce=[...new Set(re)],we=a.__originalFilePath,be=[];if(be.push(...c._layerComponentDirs??[]),we){let ye=ae.join(ae.dirname(we),"components");be.push(ye)}let He=c._rootComponentsDir;if(typeof He==="string"&&Oo(n,c)&&!be.includes(He))be.push(He);if(n&&!be.includes(n))be.push(n);if(typeof He==="string"&&!be.includes(He))be.push(He);let Te=ae.join(ae.dirname(l),"components");if(!be.includes(Te))be.push(Te);if(c.componentsDir&&c.componentsDir!==n&&!be.includes(c.componentsDir))be.push(c.componentsDir);for(let ye of c.additionalComponentsDirs??[])if(ye&&!be.includes(ye))be.push(ye);let ft=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(Q),pt=(A?.events??[]).map((ye)=>ye.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),yt=Object.hasOwn(t,"checked")||Boolean(A?.reactiveProps?.includes("checked")),ss=Object.hasOwn(t,"value")||Boolean(A?.reactiveProps?.includes("value")),rs=!pt.includes("valuechange")&&(yt||pt.includes("change")&&!ss),mt=c._nativeHostAttrs&&/^textinput$/i.test(Q),_t=pt.includes("update:value")&&!pt.includes("input"),qt=c._nativeHostAttrs&&/^video$/i.test(Q),is=c._nativeHostAttrs&&/^image$/i.test(Q),ln=Ms([...Object.keys(t),...A?.reactiveProps??[]],A?.events,t),wt=Object.hasOwn(t,"src")||Boolean(A?.reactiveProps?.includes("src")),un=Object.hasOwn(t,"source")||Boolean(A?.reactiveProps?.includes("source")),_n=qt&&(wt||un)&&(A?.events??[]).every((ye)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(ye.replace(/^@/,"").split(".")[0])),Sn=new Set(["","primary","secondary","outline","ghost","danger"]),$n=typeof t.variant==="string"?t.variant.trim().toLowerCase():"",En=c._nativeHostAttrs&&/^button$/i.test(Q)&&!Sn.has($n),ur=c._targetComponentFallbackNames?.some((ye)=>ye.toLowerCase()===Q.toLowerCase())&&(!ft||rs)&&(!mt||_t)&&(!qt||_n)&&(!is||ln)&&!En;for(let ye of ur?[]:c._targetComponentDirs??[])if(ye&&!be.includes(ye))be.push(ye);let St=typeof c.root==="string"?ae.resolve(c.root):void 0,Ko=St??ae.dirname(l),$t=[];if(St)$t.push(ae.resolve(St,"resources/views/components")),$t.push(ae.resolve(St,"resources/components")),$t.push(ae.resolve(St,"src/components")),$t.push(ae.resolve(St,"components"));$t.push(ae.resolve(import.meta.dir,"components"));for(let ye of $t)if(!be.includes(ye))be.push(ye);let fr=c._pluginComponentDirs;if(Array.isArray(fr)){for(let ye of fr)if(typeof ye==="string"&&!be.includes(ye))be.push(ye)}if(c.fallbackComponentsDir&&!be.includes(c.fallbackComponentsDir))be.push(c.fallbackComponentsDir);if(ur){for(let ye of c._targetComponentDirs??[])if(ye&&!be.includes(ye))be.push(ye)}let kn=c._nativePrimitivesFallback;if(kn&&!kn.except.some((ye)=>ye.toLowerCase()===Q.toLowerCase())&&!be.includes(kn.dir))be.push(kn.dir);let pr=[...new Set(be.map((ye)=>{if(!ye)return ye;return ae.isAbsolute(ye)?ye:ae.resolve(Ko,ye)}))];be.length=0,be.push(...pr);let os=`${Q}\x00${l}\x00${pr.join("\x00")}`,as=Kn.get(os);if(as)if(await s(as))D=as;else Kn.delete(os);if(!D&&(Q.startsWith("./")||Q.startsWith("../")))D=ae.resolve(ae.dirname(l),`${Q}.stx`),ne.push(D);else if(!D)for(let ye of be){if(!ye)continue;for(let Rn of ce){let Cn=ae.join(ye,Rn);if(ne.push(Cn),await s(Cn)){D=Cn;break}}if(D)break;if(!D)try{let Rn=await import("fs");if(!Rn.statSync(ye,{throwIfNoEntry:!1})?.isDirectory())continue;let Xo=8,cs=[{path:ye,depth:0}];while(cs.length>0&&!D){let An=cs.pop();if(An.depth>=Xo)continue;let dr;try{dr=Rn.readdirSync(An.path,{withFileTypes:!0})}catch{continue}for(let Tn of dr){if(!Tn.isDirectory())continue;if(Tn.name==="node_modules"||Tn.name.startsWith("."))continue;let gr=ae.join(An.path,Tn.name);for(let Jo of ce){let ls=ae.join(gr,Jo);if(ne.push(ls),await s(ls)){D=ls;break}}if(D)break;cs.push({path:gr,depth:An.depth+1})}}}catch{}if(D)break}if(D)Kn.set(os,D)}if(!D||!await s(D))return Ro(e,l,ne),Co(e);v.add(D);let te;if(tn.has(D)&&er.get(D)===So(D))te=tn.get(D);else try{let re=So(D);te=await Bun.file(D).text(),tn.set(D,te),er.set(D,re)}catch(re){let ce=re instanceof Error?re.message:String(re);return Ro(e,l,[D],ce),Co(e)}if(A)for(let re of new Set([...Object.keys(t),...A.reactiveProps??[]])){let ce=re.toLowerCase();if(ce.startsWith("aria-")||ce.startsWith("data-"))continue;let we=re.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${we}\\b`).test(te))A.declaredProps.add(re);if(new RegExp(`\\$props\\s*(?:\\.\\s*${we}\\b|\\[\\s*['"]${we}['"]\\s*\\])`).test(te)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${we}['"]`).test(te))A.consumedProps?.add(re)}if(A?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(te))for(let re of A.reactiveProps){if(tu.has(re)||A.consumedProps?.has(re))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${re.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(te))continue;let ce=`${D}\x00${re}`;if(Ao.has(ce))continue;Ao.add(ce),console.warn(`[stx] ${ae.basename(D)} reads \`${re}\` with defineProps(), which is not live, but ${ae.basename(l)} binds it (:${re}): the value can arrive empty or stale (on a native screen, and for a :for's rows, it does not arrive at all). Read it with useReactiveProp('${re}').`)}let le=new Set(["__originalFilePath","__importedComponents",Dn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),he={};for(let[re,ce]of Object.entries(a))if(!re.startsWith("__")||le.has(re))he[re]=ce;let ue=E.length>0?{[Fn]:[...E]}:{},Re=i;if(i.includes("@include")){let{processIncludes:re}=await o("stx/includes",()=>import("./chunk-pby6dxnc.js"));Re=await re(i,a,l,c,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Re)){let{processComponents:re}=await o("stx/component-renderer",()=>import("./chunk-2vk7dtvs.js")),ce={...a,__processedComponents:j,...ue};Re=await re(Re,ce,l,c,v);let we=ce.__stx_preserved_client_expressions;if(Array.isArray(we)&&we.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...we])]}let Ae=[];if(Jc(Re)){let{processExpressions:re}=await o("stx/expressions",()=>import("./chunk-mfc5d181.js")),ce=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...ue}:E.length>0?{...a,...ue}:a;Re=re(Re,ce,l);for(let we of Re.matchAll(/\{\{([\s\S]*?)\}\}/g))Ae.push(we[1].trim())}let Ue=G(Re),Ke=[],Ye=Ue.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(re,ce)=>{let we=Ue.scripts[Number(ce)]||"",be=we.match(/^<script\b([^>]*)>/i)?.[1]||"",He=be.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Te=!He||["module","text/javascript","application/javascript"].includes(He),ft=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${be}`);if(!/\bserver\b/i.test(be)&&Te&&!ft)return Ke.push(we),"";return we}),{extractSlotContent:Xe}=await o("stx/slots",()=>import("./chunk-82v1egn6.js")),et=Xe(Ye),Je={};if(et.defaultSlot?.trim())Je.default=et.defaultSlot;for(let[re,ce]of et.namedSlots)Je[re]=ce.content;let gt=a.__stx_scope_seq??={n:0,key:Vs(String(a.__filename??l))},Tt=Po(e,process.cwd()),it=`stx_${(Tt.endsWith(".stx")?Tt.slice(0,-4):Tt).replace(/[^a-zA-Z0-9]/g,"_")}_${++gt.n}_${gt.key}`,We={...he,$uid:it,$native:c._nativeHostAttrs===!0,...t,props:t,slot:Ye,$slots:Je,__processedComponents:I,__sections:{},__stx_signals_gate:Se(te)||Jc(i),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Ae]};if(/import\s/.test(te)){We.__importedComponents=new Map(We.__importedComponents);let{processESImports:re}=await o("stx/component-renderer",()=>import("./chunk-2vk7dtvs.js"));te=await re(te,We,D,c,v)}Yl(te,We);let Dt=te,sn=de(Dt);if(sn)Dt=sn.content.trim();let Yn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Lt=[...te.matchAll(Yn)];for(let[,re,ce]of Lt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(re))Oe(ce,D,c.strict);let Ge=[],zt=null,Qn=Lt.some((re)=>/\bserver\b/.test(re[1]||"")&&/\bcache\b/.test(re[1]||"")),bt=null,ot=null,Bt=null,rn=0,Wt=null;if(Hl(c),Qn&&sr>0){let re=ql({props:t,slot:Re,slotContext:i.trim()?Zl(he):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...E].sort(),layers:c._layerGraph?.layers.map((ce)=>ce.configFile),uid:it});if(re!==null){bt=`${D}\x00${S(te)}\x00${re}`;let ce=Xn.get(bt);if(ce){for(let we of ce.dependencies)v.add(we);if(ti(a,ce.clientFactories),gt.n+=ce.uidsConsumed,ce.preservedClientExpressions.length>0){let we=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let be of ce.preservedClientExpressions)we.add(be);a.__stx_preserved_client_expressions=[...we]}return ce.output}ot=new Set(v),Bt=Qr(a),rn=gt.n,Wt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Ft=new Set;for(let re of Lt){let ce=re[1]||"",we=re[2]||"",be=ce.includes("server");if(je(ce)&&we.trim())we=Be(we);if(be&&we){for(let Te of Me(we))Ft.add(Te);try{await X(we,We,D,{onFailure:(Te)=>{if(Te.kind!=="unknown")zt=Te.kind}})}catch(Te){}}if(!be){let Te=we.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),ft=Te.includes("{{")&&Te.includes("}}"),pt=Te.includes("{!!")&&Te.includes("!!}");if(ft||pt)Te=vi(Te,We,D);let yt=ce.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Ge.push(`<script${yt}>${Te}</script>`)}}let Qe=G(te).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Vt=Qe?Qe[1]:"",es=Qe?Qe[2]:"",ct="",se=Vt&&/\bscoped\b/i.test(Vt);if(Qe)ct=`<style${Vt}>${eu(es,We,D)}</style>`;let ie=Dt;if(ie=ie.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Qe)ie=ie.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let re=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ce=[];if(ie=ie.replace(re,(we,be)=>{let He=be.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(He)ce.push(`<style${He[1]}>${He[2]}</style>`);return""}),ie=ie.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ce.length>0)ct=`${ct}${ce.join(`
|
|
574
|
+
`)}`}if(i&&ie.includes("{{ text || slot }}"))ie=ie.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>i);let{applySlots:me}=await o("stx/slots",()=>import("./chunk-82v1egn6.js")),{defaultSlot:$e,namedSlots:Ce}=et,qe=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(Ye),tt=Ge.length>0&&ks(ie)||c._nativeHostAttrs===!0&&Ge.length>0||qe&&Ge.length>0||Ge.some((re)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(re)),ts=(re)=>tt?Ki(re,it):re,ns=new Map([...Ce].map(([re,ce])=>[re,{...ce,content:ts(ce.content)}]));ie=await me(ie,tt?Zi(ts($e),it):$e,ns,We,tt?it:"");let on=bi(Ge),Ut=(Array.isArray(We.__stx_client_signal_names)?We.__stx_client_signal_names:[]).filter((re)=>!Ft.has(re));if(on.length>0||Ut.length>0)We.__stx_client_signal_names=[...new Set([...Ut,...on])];else delete We.__stx_client_signal_names;let Ht=E.filter((re)=>!Ft.has(re)&&!(re in t));if(Ht.length>0)We[Fn]=Ht;let an={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:ae.dirname(D),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||tt||Ge.length===0,defaultLayout:void 0};We.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:cn}=await o("stx/process",()=>import("./chunk-x5r1cty7.js")),nt=await cn(ie,We,D,an,v),ut=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let re of nt.matchAll(/\{\{([\s\S]*?)\}\}/g))ut.add(re[1].trim());if(ut.size>0)a.__stx_preserved_client_expressions=[...ut];let lt=it,Ze=nt;if(tt){let re="";if(Object.keys(t).length>0)try{re=` data-stx-props="${Gs(JSON.stringify(t))}"`}catch{}let ce=L?` stx-hydrate="${Gs(L)}"`:"",we=Object.fromEntries(Object.entries(Je).map(([mt,_t])=>[mt,Boolean(_t)])),be=Object.keys(we).length>0?` data-stx-slots="${Gs(JSON.stringify(we))}"`:"",He=` data-stx-scope="${lt}"${re}${be}${ce}`,Te=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(nt),ft=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(nt),pt=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(nt),yt=Te?"span":"div",ss=ft&&c._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':pt&&c._nativeHostAttrs?' style="width:100%;height:100%"':Te||ft?' style="display:contents"':"";Ze=gg(nt,He)??`<${yt}${He} data-stx-component-wrapper${ss}>${nt}</${yt}>`;let rs=await Promise.all(Ge.map(async(mt)=>{let _t=mt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!_t)return mt;let[,qt,is]=_t,ln=wo(mt,We,D);if(ln!==null)return ln;let wt=await su(is,D,c.buildMode==="compile"),un=yn(wt.clientCode,De(We)),{vendorStyleTags:_n}=wt,Sn=un?`function(__scopeId) {
|
|
575
575
|
${un}
|
|
576
576
|
return (${wt.factoryBody})(__scopeId);
|
|
577
577
|
}`:wt.factoryBody,$n=L?null:ys(a,Sn),En=$n?`window.__stxComponentFactories[${JSON.stringify($n)}](${JSON.stringify(lt)});`:`(${Sn})(${JSON.stringify(lt)});`;if(L)return`${_n}<script type="stx/island" data-stx-island="${lt}" data-stx-scoped data-stx-owner="${lt}"${qt}>${En}</script>`;return`${_n}<script data-stx-scoped data-stx-run="always" data-stx-owner="${lt}"${qt}>${En}</script>`}));if(Ze=Ze+`
|
|
@@ -597,7 +597,7 @@ ${ke.yellow}${ke.bold}Message:${ke.reset} ${t}
|
|
|
597
597
|
`,b)A+=`
|
|
598
598
|
${ke.blue}${ke.bold}Context:${ke.reset}
|
|
599
599
|
${ke.dim}${b}${ke.reset}
|
|
600
|
-
`;return A}function fe(){tn.clear(),er.clear(),Kn.clear(),tr.clear(),nr.clear(),Xn.clear()}function Jh(){return{size:tn.size,maxSize:500}}var Qs=w(128);async function su(e,t,i){let n=S(e,t,i),a=Qs.get(n);if(a){if(Ds(a.deps))return a;Qs.delete(n)}let l=hi(e,{filePath:t,projectRoot:process.cwd()}),c=l.code,b=yi(l.styles);c=Nt(c).code;let{hasUserImports:v,bundleClientScript:E}=await o("stx/client-script-bundler",()=>import("./chunk-
|
|
600
|
+
`;return A}function fe(){tn.clear(),er.clear(),Kn.clear(),tr.clear(),nr.clear(),Xn.clear()}function Jh(){return{size:tn.size,maxSize:500}}var Qs=w(128);async function su(e,t,i){let n=S(e,t,i),a=Qs.get(n);if(a){if(Ds(a.deps))return a;Qs.delete(n)}let l=hi(e,{filePath:t,projectRoot:process.cwd()}),c=l.code,b=yi(l.styles);c=Nt(c).code;let{hasUserImports:v,bundleClientScript:E}=await o("stx/client-script-bundler",()=>import("./chunk-897gqcby.js")),A=[],M=!1;if(v(c)){let Q=c;c=await E(Q,t,{projectRoot:process.cwd(),minify:i,collectInputs:A}),M=c===Q}let{stripStxRuntimeImports:X}=await o("stx/signal-processing",()=>import("./chunk-htdbm0sd.js"));c=X(c);let j=P(c),I=Xl(j),z=new Set(H(j,!0).split(",").map((Q)=>Q.trim())),L=`function(__scopeId) {
|
|
601
601
|
${at("const",[...dl,...I],j)}
|
|
602
602
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
603
603
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{er,$e}from"./chunk-7sh9fa3q.js";import{H,w,br,Ds,C}from"./chunk-36ga0q0r.js";import{a,I}from"./chunk-n5kg8njw.js";import{Oo}from"./chunk-56brw839.js";import{nt}from"./chunk-5emrarpf.js";import{c}from"./chunk-brhas9mp.js";import{r,ge}from"./chunk-b4x5ndt9.js";import p from"path";import B from"fs";import{AsyncLocalStorage as xt}from"async_hooks";import{randomUUID as yt}from"crypto";var $t=11;function W(t,e,n){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(p.basename(t))||Oo(t,e,n)}var at=2;function xf(t){let e=process.env.STX_BUNDLE_CACHE_DIR?.trim();return e?p.resolve(e):c(t,"bundle-cache")}function st(t,e){let n=t;for(let i of wt(e))if(i!==p.sep)n=n.split(i).join("\x00root");return n}var rt=new Map;function wt(t){let e=p.resolve(t),n=rt.get(e);if(!n){let i=e;try{i=B.realpathSync(e)}catch{}n=[...new Set([e,i])].sort((l,d)=>d.length-l.length),rt.set(e,n)}return n}function bt(t,e){try{let n=B.statSync(t),i=p.resolve(e),l=t.startsWith(`${i}${p.sep}`);return{path:l?p.relative(i,t):t,...l?{inRoot:!0}:{},mtimeMs:n.mtimeMs,size:n.size,hash:Bun.hash(B.readFileSync(t)).toString(36)}}catch{return null}}function ct(t,e){return t.inRoot?p.join(p.resolve(e),t.path):t.path}function St(t,e){for(let n of t){let i=ct(n,e);try{let l=B.statSync(i);if(l.size!==n.size)return!1;if(l.mtimeMs!==n.mtimeMs&&Bun.hash(B.readFileSync(i)).toString(36)!==n.hash)return!1}catch{return!1}}return!0}var lt=new Map,vt=100;function Sf(t=process.env){let e=Number(t.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(e)&&e>=1?Math.floor(e):2000}var G=new Map;async function jt(t){let e=G.get(t)??0;if(e>0&&e<vt){G.set(t,e+1);return}G.set(t,1);try{let n=(await B.promises.readdir(t)).filter((o)=>o.endsWith(".js")),i=Sf();if(n.length<=i)return;let d=(await Promise.all(n.map(async(o)=>{try{return{name:o,at:(await B.promises.stat(p.join(t,o))).mtimeMs}}catch{return null}}))).filter((o)=>o!==null);d.sort((o,b)=>b.at-o.at);for(let o of d.slice(i)){let b=o.name.slice(0,-3);await B.promises.rm(p.join(t,`${b}.js`),{force:!0}),await B.promises.rm(p.join(t,`${b}.deps.json`),{force:!0})}A("pruned bundle cache to",i,"entries")}catch{}}function he(t){return lt.get(t)??[]}function Z(t,e){if(t)lt.set(t,e)}function kf(t=process.env){return t.STX_DEBUG==="true"||t.STX_DEBUG==="1"}function A(...t){if(kf())console.log("[stx:bundler]",...t)}var K=[];function tc(t,e,n){K.push({filePath:t||"<inline>",message:e,details:n})}function en(){return K.slice()}function tn(){K.length=0}var Q;function _h(t){Q=t}function nc(){if(Q)return Q;try{let t=I.strict;return typeof t==="object"&&t!==null?t.bundlerFallback??"warn":"warn"}catch{return"warn"}}var Y=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function nn(t){let e=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,n;while((n=e.exec(t))!==null){let l=n[1];if(!Y.some((o)=>o.test(l)))return A("detected user import:",l),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((n=i.exec(t))!==null){let l=n[1];if(/\.css(?:\?.*)?$/.test(l))continue;if(!Y.some((o)=>o.test(l)))return A("detected side-effect import:",l),!0}return!1}var Qn="stx-module:",Bt=/\.(?:[cm]?[jt]sx?|json)$/i;function _f(t,e){return p.relative(t,e).split(p.sep).join("/")}function Cf(t,e){if(e.size===0)return t;return t.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(n,i,l,d)=>{let o=e.get(d);return o&&!d.startsWith(Qn)?`${i}${l}${o}${l}`:n})}function Ef(t,e){let n=0,i=(d)=>{let o=`__stxMod${n++}`,b=JSON.stringify(d);return e.push(`var ${o} = globalThis.__stxModules && globalThis.__stxModules[${b}];`,`if (${o} === undefined) throw new Error("[stx] module " + ${JSON.stringify(b)} + " is not registered on this page (#1957)");`),o},l=(d,o)=>{for(let b of d.split(",")){let D=b.trim();if(!D)continue;let M=D.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!M)continue;let S=M[1].startsWith('"')?JSON.parse(M[1]):M[1],f=M[2]??S;e.push(`var ${f} = ${o}[${JSON.stringify(S)}];`)}};return t=t.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(d,o,b)=>{let D=b.slice(Qn.length),M=i(D),S=o.trim(),f=S.match(/^([\w$]+)\s*(?:,\s*|$)/);if(f&&!S.startsWith("{")&&!S.startsWith("*"))e.push(`var ${f[1]} = ${M}.default;`),S=S.slice(f[0].length).trim();let v=S.match(/^\*\s*as\s+([\w$]+)$/);if(v)e.push(`var ${v[1]} = ${M};`);else if(S.startsWith("{"))l(S.replace(/^\{|\}$/g,""),M);return""}),t=t.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(d,o)=>(i(o.slice(Qn.length)),"")),t}function it(t){let e=[t,`${t}.ts`,`${t}.tsx`,`${t}.js`,`${t}.mjs`,`${t}.jsx`,p.join(t,"index.ts"),p.join(t,"index.tsx"),p.join(t,"index.js"),p.join(t,"index.mjs")];for(let n of e)try{if(B.existsSync(n)&&B.statSync(n,{throwIfNoEntry:!1})?.isFile())return n}catch{}return}var X=new xt;function ss(t,e){let n=new Bun.CryptoHasher("md5");for(let[i,l]of[...t].sort(([d],[o])=>d<o?-1:d>o?1:0))n.update(`${i}\x00${l}\x00`);return X.run({modules:t,key:n.digest("hex").slice(0,12)},e)}function rn(){return X.getStore()?.key??""}function ut(t,e,n,i,l,d,o=new Map,b,D,M){let S=new Map([[n,i],...M??[]]),f=(j)=>j!==void 0&&S.has(j),v=(j,s,u)=>{if(W(s,t,b))return null;if(!d||!f(j)||!Bt.test(s))return null;try{if(!B.statSync(s,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}l.add(s);let E=`${Qn}${_f(process.cwd(),s)}`;return o.set(u,E),{path:E,external:!0}},y=(j,s)=>{let u=f(j)?e:p.dirname(j),E=p.resolve(u,s);return it(E)??E};return{name:"stx-client-bundle",setup(j){if(j.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(s)=>({path:s.path,external:!0})),j.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(s)=>({path:s.path,external:!0})),j.onResolve({filter:/^\//},(s)=>{if(f(s.path))return{path:s.path};let u=it(s.path);if(u){let E=v(s.importer,u,s.path);if(E)return E;if(!f(u))l.add(u);return{path:u}}return{path:s.path,external:!0}}),j.onResolve({filter:/^\.\.?\//},(s)=>{let u=y(s.importer,s.path),E=v(s.importer,u,s.path);if(E)return E;return l.add(u),{path:u}}),j.onResolve({filter:/^[@~]\//},(s)=>{let u=p.resolve(t,s.path.slice(2)),E=[u,`${u}.ts`,`${u}.tsx`,`${u}.js`,`${u}.mjs`,`${u}.jsx`,p.join(u,"index.ts"),p.join(u,"index.tsx"),p.join(u,"index.js"),p.join(u,"index.mjs")];for(let h of E)if(B.existsSync(h)&&B.statSync(h,{throwIfNoEntry:!1})?.isFile()){let O=v(s.importer,h,s.path);if(O)return O;return A(`resolved ${s.path[0]}/ import:`,s.path,"\u2192",h),l.add(h),{path:h}}return console.warn(`[stx:bundler] could not resolve ${s.path[0]}/ import:`,s.path),{path:u}}),d)j.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(s)=>{if(!f(s.importer))return;let u=`${Qn}npm:${s.path}`;return o.set(s.path,u),{path:u,external:!0}});j.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(s)=>{if(S.has(s.path))return{contents:S.get(s.path),loader:"ts"};if(W(s.path,t,b))throw Error(`Server-only API source cannot be imported by a client script: ${s.path}`);let u=p.extname(s.path).toLowerCase(),E=u===".json"?"json":u===".tsx"?"tsx":u===".jsx"?"jsx":u===".ts"||u===".mts"||u===".cts"?"ts":"js";if(!f(s.path))l.add(s.path);let h=D?.get(s.path);if(h!==void 0)return{contents:h,loader:"js"};return{contents:B.readFileSync(s.path,"utf8"),loader:E}})}}}var q=new Map,P=w(64),ot=Symbol.for("stx.client-bundle-build-queue");function Tf(t){let e=globalThis,i=(e[ot]??Promise.resolve()).then(t,t);return e[ot]=i.then(()=>{return},()=>{return}),i}async function sn(t,e,n={}){let i=n.projectRoot||process.cwd(),l=(await a(i)).serverApi,d=n.minify??!1,o=n.externalizeUserModules??!0,b=n.expose?.length?[...new Set(n.expose)].sort():void 0,D=n.cacheDir||xf(i),M=X.getStore(),S=new Bun.CryptoHasher("md5");S.update(`${$t}\x00${nt()}\x00${JSON.stringify(l??!1)}\x00${o?"registry":"inline"}\x00${b?b.join(","):"*"}\x00${d?"minified":"readable"}\x00${M?.key??""}\x00${st(t,i)}\x00${st(e,i)}`);let f=S.digest("hex").slice(0,12),v=p.join(D,`${f}.js`),y=P.get(v);if(y){if(Ds(y.files)&&y.files.every((h)=>!W(h.path,i,l))){A("memo hit:",f);let h=y.files.map((O)=>O.path);return Z(e,h),n.collectInputs?.push(...h),y.code}P.delete(v),A("memo invalidated by dep change:",f)}let j=p.join(D,`${f}.deps.json`),s=Bun.file(v);if(await s.exists()){let h=Bun.file(j),O=!1,k=null;if(await h.exists())try{let N=JSON.parse(await h.text());if(N.metadataVersion===at&&Array.isArray(N.files)&&St(N.files,i))k=br(N.files.map((g)=>ct(g,i))),O=k.length===N.files.length&&!k.some((g)=>W(g.path,i,l))}catch{O=!1}if(O){if(A("cache hit:",f),k)Z(e,k.map((U)=>U.path)),n.collectInputs?.push(...k.map((U)=>U.path));let N=await s.text(),g=new Date;if(B.promises.utimes(v,g,g).catch(()=>{}),k)P.set(v,{code:N,files:k});return N}A("cache invalidated by dep change:",f)}let u=q.get(f);if(u){let h=await u;if(n.collectInputs)n.collectInputs.push(...(P.get(v)?.files??[]).map((O)=>O.path));return h}let E=Tf(()=>Et(t,e,{projectRoot:i,minify:d,cacheDir:D,hash:f,cachePath:v,depsPath:j,collectInputs:n.collectInputs,externalizeUserModules:o,serverApi:l,expose:b,throwOnFailure:n.throwOnFailure,substitutes:M?.modules}));q.set(f,E);try{return await E}finally{q.delete(f)}}function rc(t){return`${t}-${process.pid}-${yt()}`}async function Ch(t,e){let{projectRoot:n}=e,i=rc(new Bun.CryptoHasher("md5").update([...t.keys()].join("\x00")).digest("hex").slice(0,12)),l=p.join(c(n,"bundle-tmp"),"out",i);B.mkdirSync(l,{recursive:!0});let d=new Map,o=new Map,b=0;for(let[f,v]of t){let y=p.join(n,`.stx-split-${i}-${b++}.ts`);d.set(y,v),o.set(p.basename(y).replace(/\.ts$/,""),f)}let[D,M]=[...d][0],S=new Set;try{let f=await Bun.build({entrypoints:[...d.keys()],outdir:l,target:"browser",format:"esm",splitting:!0,minify:!1,naming:{entry:"[name].js",chunk:"chunk-[hash].js"},plugins:[ut(n,p.dirname(e.filePath),D,M,S,!1,new Map,void 0,X.getStore()?.modules,d)],define:{"process.env.NODE_ENV":'"development"',...C()},root:n});if(!f.success)throw Error(f.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ")||"Unable to bundle the entries");let v={entries:new Map,chunks:new Map};for(let y of f.outputs){let j=p.basename(y.path);if(y.kind==="entry-point"){let s=o.get(j.replace(/\.js$/,""));if(s!==void 0)v.entries.set(s,await y.text())}else if(y.kind==="chunk")v.chunks.set(j.replace(/\.js$/,""),await y.text())}return e.collectInputs?.push(...S),v}finally{try{B.rmSync(l,{recursive:!0,force:!0})}catch{}}}async function Et(t,e,n){let{projectRoot:i,minify:l,cacheDir:d,hash:o,cachePath:b,depsPath:D,externalizeUserModules:M}=n,S=c(i,"bundle-tmp"),f=rc(o),v=p.join(i,`.stx-client-${f}.ts`),y=p.join(S,"out",f);B.mkdirSync(y,{recursive:!0});let j=p.dirname(e),s=new Set,u=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,E=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,h=r(t),{depths:O,balanced:k}=ge(h),N=(R)=>!k||O[R]===0,g;while((g=u.exec(h))!==null){if(g[1])continue;if(!N(g.index))continue;if(g[2])g[2].split(",").forEach((R)=>{let m=_t(R);if(m)s.add(m)});else if(g[3])s.add(g[3])}while((g=E.exec(h))!==null){if(g[1])continue;if(!N(g.index))continue;s.add(g[2])}let U=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=U.exec(h))!==null){if(!N(g.index))continue;let R=/^\s*['"]([^'"]+)['"]/.exec(t.slice(g.index+g[0].length))?.[1];if(R&&Y.some((m)=>m.test(R)))continue;if(g[1])s.add(g[1]);if(g[2])s.add(g[2]);for(let m of(g[3]??"").split(",")){let _=m.trim();if(!_||/^type\s/.test(_))continue;let L=/\bas\s+(\w+)\s*$/.exec(_)?.[1]??/^\w+$/.exec(_)?.[0];if(L)s.add(L)}}for(let R of h.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let m of R[1].split(",")){let _=/\bas\s+(\w+)\s*$/.exec(m)?.[1]??/^\s*(\w+)\s*$/.exec(m)?.[1];if(_)s.delete(_)}let pt=s.size>0?`
|
|
2
|
+
import{er,$e}from"./chunk-7sh9fa3q.js";import{H,w,br,Ds,C}from"./chunk-928y0wer.js";import{a,I}from"./chunk-rptnx3s6.js";import{Oo}from"./chunk-bwsz6sv4.js";import{nt}from"./chunk-5emrarpf.js";import{c}from"./chunk-brhas9mp.js";import{r,ge}from"./chunk-b4x5ndt9.js";import p from"path";import B from"fs";import{AsyncLocalStorage as xt}from"async_hooks";import{randomUUID as yt}from"crypto";var $t=11;function W(t,e,n){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(p.basename(t))||Oo(t,e,n)}var at=2;function xf(t){let e=process.env.STX_BUNDLE_CACHE_DIR?.trim();return e?p.resolve(e):c(t,"bundle-cache")}function st(t,e){let n=t;for(let i of wt(e))if(i!==p.sep)n=n.split(i).join("\x00root");return n}var rt=new Map;function wt(t){let e=p.resolve(t),n=rt.get(e);if(!n){let i=e;try{i=B.realpathSync(e)}catch{}n=[...new Set([e,i])].sort((l,d)=>d.length-l.length),rt.set(e,n)}return n}function bt(t,e){try{let n=B.statSync(t),i=p.resolve(e),l=t.startsWith(`${i}${p.sep}`);return{path:l?p.relative(i,t):t,...l?{inRoot:!0}:{},mtimeMs:n.mtimeMs,size:n.size,hash:Bun.hash(B.readFileSync(t)).toString(36)}}catch{return null}}function ct(t,e){return t.inRoot?p.join(p.resolve(e),t.path):t.path}function St(t,e){for(let n of t){let i=ct(n,e);try{let l=B.statSync(i);if(l.size!==n.size)return!1;if(l.mtimeMs!==n.mtimeMs&&Bun.hash(B.readFileSync(i)).toString(36)!==n.hash)return!1}catch{return!1}}return!0}var lt=new Map,vt=100;function Sf(t=process.env){let e=Number(t.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(e)&&e>=1?Math.floor(e):2000}var G=new Map;async function jt(t){let e=G.get(t)??0;if(e>0&&e<vt){G.set(t,e+1);return}G.set(t,1);try{let n=(await B.promises.readdir(t)).filter((o)=>o.endsWith(".js")),i=Sf();if(n.length<=i)return;let d=(await Promise.all(n.map(async(o)=>{try{return{name:o,at:(await B.promises.stat(p.join(t,o))).mtimeMs}}catch{return null}}))).filter((o)=>o!==null);d.sort((o,b)=>b.at-o.at);for(let o of d.slice(i)){let b=o.name.slice(0,-3);await B.promises.rm(p.join(t,`${b}.js`),{force:!0}),await B.promises.rm(p.join(t,`${b}.deps.json`),{force:!0})}A("pruned bundle cache to",i,"entries")}catch{}}function he(t){return lt.get(t)??[]}function Z(t,e){if(t)lt.set(t,e)}function kf(t=process.env){return t.STX_DEBUG==="true"||t.STX_DEBUG==="1"}function A(...t){if(kf())console.log("[stx:bundler]",...t)}var K=[];function tc(t,e,n){K.push({filePath:t||"<inline>",message:e,details:n})}function en(){return K.slice()}function tn(){K.length=0}var Q;function _h(t){Q=t}function nc(){if(Q)return Q;try{let t=I.strict;return typeof t==="object"&&t!==null?t.bundlerFallback??"warn":"warn"}catch{return"warn"}}var Y=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function nn(t){let e=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,n;while((n=e.exec(t))!==null){let l=n[1];if(!Y.some((o)=>o.test(l)))return A("detected user import:",l),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((n=i.exec(t))!==null){let l=n[1];if(/\.css(?:\?.*)?$/.test(l))continue;if(!Y.some((o)=>o.test(l)))return A("detected side-effect import:",l),!0}return!1}var Qn="stx-module:",Bt=/\.(?:[cm]?[jt]sx?|json)$/i;function _f(t,e){return p.relative(t,e).split(p.sep).join("/")}function Cf(t,e){if(e.size===0)return t;return t.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(n,i,l,d)=>{let o=e.get(d);return o&&!d.startsWith(Qn)?`${i}${l}${o}${l}`:n})}function Ef(t,e){let n=0,i=(d)=>{let o=`__stxMod${n++}`,b=JSON.stringify(d);return e.push(`var ${o} = globalThis.__stxModules && globalThis.__stxModules[${b}];`,`if (${o} === undefined) throw new Error("[stx] module " + ${JSON.stringify(b)} + " is not registered on this page (#1957)");`),o},l=(d,o)=>{for(let b of d.split(",")){let D=b.trim();if(!D)continue;let M=D.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!M)continue;let S=M[1].startsWith('"')?JSON.parse(M[1]):M[1],f=M[2]??S;e.push(`var ${f} = ${o}[${JSON.stringify(S)}];`)}};return t=t.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(d,o,b)=>{let D=b.slice(Qn.length),M=i(D),S=o.trim(),f=S.match(/^([\w$]+)\s*(?:,\s*|$)/);if(f&&!S.startsWith("{")&&!S.startsWith("*"))e.push(`var ${f[1]} = ${M}.default;`),S=S.slice(f[0].length).trim();let v=S.match(/^\*\s*as\s+([\w$]+)$/);if(v)e.push(`var ${v[1]} = ${M};`);else if(S.startsWith("{"))l(S.replace(/^\{|\}$/g,""),M);return""}),t=t.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(d,o)=>(i(o.slice(Qn.length)),"")),t}function it(t){let e=[t,`${t}.ts`,`${t}.tsx`,`${t}.js`,`${t}.mjs`,`${t}.jsx`,p.join(t,"index.ts"),p.join(t,"index.tsx"),p.join(t,"index.js"),p.join(t,"index.mjs")];for(let n of e)try{if(B.existsSync(n)&&B.statSync(n,{throwIfNoEntry:!1})?.isFile())return n}catch{}return}var X=new xt;function ss(t,e){let n=new Bun.CryptoHasher("md5");for(let[i,l]of[...t].sort(([d],[o])=>d<o?-1:d>o?1:0))n.update(`${i}\x00${l}\x00`);return X.run({modules:t,key:n.digest("hex").slice(0,12)},e)}function rn(){return X.getStore()?.key??""}function ut(t,e,n,i,l,d,o=new Map,b,D,M){let S=new Map([[n,i],...M??[]]),f=(j)=>j!==void 0&&S.has(j),v=(j,s,u)=>{if(W(s,t,b))return null;if(!d||!f(j)||!Bt.test(s))return null;try{if(!B.statSync(s,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}l.add(s);let E=`${Qn}${_f(process.cwd(),s)}`;return o.set(u,E),{path:E,external:!0}},y=(j,s)=>{let u=f(j)?e:p.dirname(j),E=p.resolve(u,s);return it(E)??E};return{name:"stx-client-bundle",setup(j){if(j.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(s)=>({path:s.path,external:!0})),j.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(s)=>({path:s.path,external:!0})),j.onResolve({filter:/^\//},(s)=>{if(f(s.path))return{path:s.path};let u=it(s.path);if(u){let E=v(s.importer,u,s.path);if(E)return E;if(!f(u))l.add(u);return{path:u}}return{path:s.path,external:!0}}),j.onResolve({filter:/^\.\.?\//},(s)=>{let u=y(s.importer,s.path),E=v(s.importer,u,s.path);if(E)return E;return l.add(u),{path:u}}),j.onResolve({filter:/^[@~]\//},(s)=>{let u=p.resolve(t,s.path.slice(2)),E=[u,`${u}.ts`,`${u}.tsx`,`${u}.js`,`${u}.mjs`,`${u}.jsx`,p.join(u,"index.ts"),p.join(u,"index.tsx"),p.join(u,"index.js"),p.join(u,"index.mjs")];for(let h of E)if(B.existsSync(h)&&B.statSync(h,{throwIfNoEntry:!1})?.isFile()){let O=v(s.importer,h,s.path);if(O)return O;return A(`resolved ${s.path[0]}/ import:`,s.path,"\u2192",h),l.add(h),{path:h}}return console.warn(`[stx:bundler] could not resolve ${s.path[0]}/ import:`,s.path),{path:u}}),d)j.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(s)=>{if(!f(s.importer))return;let u=`${Qn}npm:${s.path}`;return o.set(s.path,u),{path:u,external:!0}});j.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(s)=>{if(S.has(s.path))return{contents:S.get(s.path),loader:"ts"};if(W(s.path,t,b))throw Error(`Server-only API source cannot be imported by a client script: ${s.path}`);let u=p.extname(s.path).toLowerCase(),E=u===".json"?"json":u===".tsx"?"tsx":u===".jsx"?"jsx":u===".ts"||u===".mts"||u===".cts"?"ts":"js";if(!f(s.path))l.add(s.path);let h=D?.get(s.path);if(h!==void 0)return{contents:h,loader:"js"};return{contents:B.readFileSync(s.path,"utf8"),loader:E}})}}}var q=new Map,P=w(64),ot=Symbol.for("stx.client-bundle-build-queue");function Tf(t){let e=globalThis,i=(e[ot]??Promise.resolve()).then(t,t);return e[ot]=i.then(()=>{return},()=>{return}),i}async function sn(t,e,n={}){let i=n.projectRoot||process.cwd(),l=(await a(i)).serverApi,d=n.minify??!1,o=n.externalizeUserModules??!0,b=n.expose?.length?[...new Set(n.expose)].sort():void 0,D=n.cacheDir||xf(i),M=X.getStore(),S=new Bun.CryptoHasher("md5");S.update(`${$t}\x00${nt()}\x00${JSON.stringify(l??!1)}\x00${o?"registry":"inline"}\x00${b?b.join(","):"*"}\x00${d?"minified":"readable"}\x00${M?.key??""}\x00${st(t,i)}\x00${st(e,i)}`);let f=S.digest("hex").slice(0,12),v=p.join(D,`${f}.js`),y=P.get(v);if(y){if(Ds(y.files)&&y.files.every((h)=>!W(h.path,i,l))){A("memo hit:",f);let h=y.files.map((O)=>O.path);return Z(e,h),n.collectInputs?.push(...h),y.code}P.delete(v),A("memo invalidated by dep change:",f)}let j=p.join(D,`${f}.deps.json`),s=Bun.file(v);if(await s.exists()){let h=Bun.file(j),O=!1,k=null;if(await h.exists())try{let N=JSON.parse(await h.text());if(N.metadataVersion===at&&Array.isArray(N.files)&&St(N.files,i))k=br(N.files.map((g)=>ct(g,i))),O=k.length===N.files.length&&!k.some((g)=>W(g.path,i,l))}catch{O=!1}if(O){if(A("cache hit:",f),k)Z(e,k.map((U)=>U.path)),n.collectInputs?.push(...k.map((U)=>U.path));let N=await s.text(),g=new Date;if(B.promises.utimes(v,g,g).catch(()=>{}),k)P.set(v,{code:N,files:k});return N}A("cache invalidated by dep change:",f)}let u=q.get(f);if(u){let h=await u;if(n.collectInputs)n.collectInputs.push(...(P.get(v)?.files??[]).map((O)=>O.path));return h}let E=Tf(()=>Et(t,e,{projectRoot:i,minify:d,cacheDir:D,hash:f,cachePath:v,depsPath:j,collectInputs:n.collectInputs,externalizeUserModules:o,serverApi:l,expose:b,throwOnFailure:n.throwOnFailure,substitutes:M?.modules}));q.set(f,E);try{return await E}finally{q.delete(f)}}function rc(t){return`${t}-${process.pid}-${yt()}`}async function Ch(t,e){let{projectRoot:n}=e,i=rc(new Bun.CryptoHasher("md5").update([...t.keys()].join("\x00")).digest("hex").slice(0,12)),l=p.join(c(n,"bundle-tmp"),"out",i);B.mkdirSync(l,{recursive:!0});let d=new Map,o=new Map,b=0;for(let[f,v]of t){let y=p.join(n,`.stx-split-${i}-${b++}.ts`);d.set(y,v),o.set(p.basename(y).replace(/\.ts$/,""),f)}let[D,M]=[...d][0],S=new Set;try{let f=await Bun.build({entrypoints:[...d.keys()],outdir:l,target:"browser",format:"esm",splitting:!0,minify:!1,naming:{entry:"[name].js",chunk:"chunk-[hash].js"},plugins:[ut(n,p.dirname(e.filePath),D,M,S,!1,new Map,void 0,X.getStore()?.modules,d)],define:{"process.env.NODE_ENV":'"development"',...C()},root:n});if(!f.success)throw Error(f.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ")||"Unable to bundle the entries");let v={entries:new Map,chunks:new Map};for(let y of f.outputs){let j=p.basename(y.path);if(y.kind==="entry-point"){let s=o.get(j.replace(/\.js$/,""));if(s!==void 0)v.entries.set(s,await y.text())}else if(y.kind==="chunk")v.chunks.set(j.replace(/\.js$/,""),await y.text())}return e.collectInputs?.push(...S),v}finally{try{B.rmSync(l,{recursive:!0,force:!0})}catch{}}}async function Et(t,e,n){let{projectRoot:i,minify:l,cacheDir:d,hash:o,cachePath:b,depsPath:D,externalizeUserModules:M}=n,S=c(i,"bundle-tmp"),f=rc(o),v=p.join(i,`.stx-client-${f}.ts`),y=p.join(S,"out",f);B.mkdirSync(y,{recursive:!0});let j=p.dirname(e),s=new Set,u=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,E=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,h=r(t),{depths:O,balanced:k}=ge(h),N=(R)=>!k||O[R]===0,g;while((g=u.exec(h))!==null){if(g[1])continue;if(!N(g.index))continue;if(g[2])g[2].split(",").forEach((R)=>{let m=_t(R);if(m)s.add(m)});else if(g[3])s.add(g[3])}while((g=E.exec(h))!==null){if(g[1])continue;if(!N(g.index))continue;s.add(g[2])}let U=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=U.exec(h))!==null){if(!N(g.index))continue;let R=/^\s*['"]([^'"]+)['"]/.exec(t.slice(g.index+g[0].length))?.[1];if(R&&Y.some((m)=>m.test(R)))continue;if(g[1])s.add(g[1]);if(g[2])s.add(g[2]);for(let m of(g[3]??"").split(",")){let _=m.trim();if(!_||/^type\s/.test(_))continue;let L=/\bas\s+(\w+)\s*$/.exec(_)?.[1]??/^\w+$/.exec(_)?.[0];if(L)s.add(L)}}for(let R of h.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let m of R[1].split(",")){let _=/\bas\s+(\w+)\s*$/.exec(m)?.[1]??/^\s*(\w+)\s*$/.exec(m)?.[1];if(_)s.delete(_)}let pt=s.size>0?`
|
|
3
3
|
export { ${[...s].join(", ")} }`:"";A("bundling:",o,"from:",p.basename(e));let tt=new Set,et=new Map;try{let R=await Bun.build({entrypoints:[v],outdir:y,target:"browser",format:"esm",minify:l?{whitespace:!1,identifiers:!0,syntax:!0}:!1,plugins:[ut(i,j,v,t+pt,tt,M,et,n.serverApi,n.substitutes)],define:{"process.env.NODE_ENV":l?'"production"':'"development"',...C()},root:i});if(!R.success){let F=R.logs.filter((T)=>T.level==="error").map((T)=>T.message).join(", ")||`Unable to bundle ${p.basename(e)}`,z=er(R.logs,e||void 0);if(console.warn("[stx:bundler] build failed:",F),tc(e||"",F,z),n.throwOnFailure||nc()==="error")throw Error(F);return t}let m="";for(let x of R.outputs){m=await x.text();break}let _=[];for(let x of m.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let F of x[1].split(",")){let z=F.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(z){_.push([z[2],z[1]]);continue}let T=F.trim();if(/^[A-Za-z_$][\w$]*$/.test(T))_.push([T,T])}if(n.expose){let x=new Set(n.expose);for(let F=_.length-1;F>=0;F--)if(!x.has(_[F][0]))_.splice(F,1)}let L=[];m=Ef(Cf(m,et),L);let dt=m.match(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm)||[];if(m=m.replace(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),l&&m)try{m=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(m)}catch{}let V=`__stxBundle_${o}`,ft=new Set(H(t,!0).split(",").map((x)=>x.trim())),mt=_.map(([x,F])=>`get ${JSON.stringify(x)}() { return ${F} }${ft.has(x)?`, set ${JSON.stringify(x)}(__stxValue_${F}) { ${F} = __stxValue_${F} }`:""}`).join(", "),gt=_.map(([x])=>`var ${x} = undefined;`).join(`
|
|
4
4
|
`),ht=_.map(([x])=>`${x} = ${V}[${JSON.stringify(x)}];`).join(`
|
|
5
5
|
`);if(m=`${dt.join(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Mm,wa,du,Dm,Lm,jm,Bm,Fm,pu,fu,zm,Hm,Vm,Um}from"./chunk-
|
|
2
|
+
import{Mm,wa,du,Dm,Lm,jm,Bm,Fm,pu,fu,zm,Hm,Vm,Um}from"./chunk-x5vxkypk.js";import"./chunk-vwtejkb5.js";import"./chunk-y2bf32vg.js";import"./chunk-tjhcrj3z.js";import"./chunk-c84pxd2k.js";import"./chunk-8qy616yt.js";import"./chunk-2v3r330m.js";import"./chunk-gnt36wgk.js";import"./chunk-wceg59n0.js";import"./chunk-f05tmz4z.js";import"./chunk-d9yjpdyn.js";import"./chunk-2nj9aewf.js";import"./chunk-8p86mpfv.js";import"./chunk-rptnx3s6.js";import"./chunk-1d67wtj4.js";import"./chunk-k81trehg.js";import"./chunk-wf0n9gpj.js";import"./chunk-xpy9yjyx.js";import"./chunk-qj4r08jb.js";import"./chunk-928y0wer.js";import"./chunk-e648sx8w.js";import"./chunk-2vqpz4qv.js";import"./chunk-8ttmzcxb.js";import"./chunk-r9e0r6jx.js";import"./chunk-bt0amey5.js";export{du as SUSPENSE_RESOLVER_RUNTIME,wa as buildSuspenseResolveScript,Fm as createStreamRenderer,jm as extractStreamBoundaries,Um as generateHydrationRuntime,fu as islandDirective,Hm as processSectionDirectives,Lm as processStreamDirectives,zm as registerStreamingDirectives,Dm as renderStreamingPage,Mm as streamTemplate,Bm as streamTemplateSimple,Vm as streamToResponse,pu as streamingSuspenseDirective};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{xe,Pt,li,Ls,Ic,Oc,Nc,Mc,js,di,Dc,Lc,pi,hn}from"./chunk-
|
|
2
|
+
import{xe,Pt,li,Ls,Ic,Oc,Nc,Mc,js,di,Dc,Lc,pi,hn}from"./chunk-928y0wer.js";import{k}from"./chunk-bt0amey5.js";import{a}from"./chunk-rptnx3s6.js";import{wo}from"./chunk-h864en4b.js";import{c}from"./chunk-brhas9mp.js";import{existsSync as B,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(),he=[...new Set([...ee,...te])].sort(),be=new Set(ee),ye=new Set(te),Se=new Set(he),Y=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function ke(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 f of t){if(f.offset===void 0)continue;let i=f.kind==="server"?be:ye;Y.lastIndex=0;for(let p of f.code.matchAll(Y)){let g=p.index+p[0].indexOf("{")+1;for(let d of p[1].matchAll(/[^,]+/g)){let y=d[0];if(/^\s*type\s/.test(y))continue;let b=/^\s*([A-Za-z_$][\w$]*)/.exec(y);if(!b)continue;let r=b[1];if(!Se.has(r)||i.has(r))continue;let o=f.offset+g+d.index+b[0].length-r.length,u=e.slice(0,o),S=u.split(`
|
|
3
3
|
`).length;s.push({line:S,column:o-(u.lastIndexOf(`
|
|
4
4
|
`)+1)+1,offset:o,length:r.length,name:r,kind:f.kind,message:ke(r,f.kind)})}}}return s}import E from"path";var we="@stacksjs/stx-typescript-plugin";function $e(e,t){let s=E.resolve(e);for(;;){let f=E.join(s,"tsconfig.json");if(t(f))return f;let i=E.dirname(s);if(i===s)return;s=i}}function ie(e,t,s){let f=$e(e,s);if(!f)return;let i=new Set,p=(g)=>{if(i.has(g))return;i.add(g);let d=t(g);if(!d)return;let y=d.compilerOptions?.plugins;if(Array.isArray(y)){let r=y.find((u)=>u?.name===we),o=Array.isArray(r?.libs)?r.libs.filter((u)=>typeof u==="string"):[];return r?{configPath:g,libs:o.map((u)=>E.resolve(E.dirname(g),u))}:null}let b=typeof d.extends==="string"?[d.extends]:Array.isArray(d.extends)?d.extends:[];for(let r of[...b].reverse()){if(typeof r!=="string"||!r.startsWith("."))continue;let o=E.resolve(E.dirname(g),r.endsWith(".json")?r:`${r}.json`),u=p(o);if(u!==void 0)return u}return};return p(f)??void 0}function ia(e,t="",s=""){let f=e.startLine>1?`
|
|
5
5
|
`.repeat(e.startLine-1):"",i=li(di(e)+e.code,t),p=Ls(i.code),g=e.kind==="client"||e.kind==="plain"?Nc(t,e.code):"",d=(f+p).split(`
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{W,Ne}from"./chunk-
|
|
2
|
+
import{W,Ne}from"./chunk-928y0wer.js";var o=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function u(t,e,r){let i={fullTag:r,content:e,attrs:t};if(/\bserver\b/.test(t))return{...i,type:"server"};if(/\bdata-stx-scoped\b/.test(t))return{...i,type:"client"};if(o.test(e))return{...i,type:"signals"};if(/\bclient\b/.test(t)||/\btype\s*=\s*["']module["']/.test(t)||/\bsrc\s*=/.test(t))return{...i,type:"client"};return{...i,type:"server"}}var S=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function Qt(t){let e=[],r=[],i=[],c=0;while(c<t.length){let s=t.indexOf("<",c);if(s===-1)break;let p=Ne(t,s);if(p>s){c=p;continue}let a=W(t,s);if(a>s){let f=t.slice(s,a),l=S.exec(f);if(l){let n=u(l[1],l[2],f);switch(n.type){case"signals":e.push(n);break;case"client":r.push(n);break;case"server":i.push(n);break}}c=a;continue}c=s+(t.startsWith("<!--",s)?4:1)}return{signals:e,client:r,server:i}}
|
|
3
3
|
export{Qt};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import{ue}from"./chunk-qj4r08jb.js";import{ze,N}from"./chunk-2vqpz4qv.js";import{xc}from"./chunk-wf0n9gpj.js";import{c}from"./chunk-brhas9mp.js";import v from"fs";import m from"path";import{pathToFileURL as I}from"url";var P=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],R=new Set;function on(s,l={}){let o=m.resolve(s,l.dir??"server/api"),i=[],f=new Map;if(!v.existsSync(o))return i;let t=Array.from(new Bun.Glob("**/*.{ts,js,mts,mjs}").scanSync({cwd:o})).sort();for(let e of t){if(e.endsWith(".d.ts"))continue;let p=e.replace(/\.(?:ts|js|mts|mjs)$/,"").split("/"),n=p.pop(),u=n.lastIndexOf("."),d=u>=0?n.slice(u+1):"get",g=d.toUpperCase();if(!P.includes(g)||d!==d.toLowerCase())throw Error(`Unsupported API method suffix in ${e}; use ${P.map((A)=>A.toLowerCase()).join(", ")}`);if(u>=0)n=n.slice(0,u);if(n!=="index")p.push(n);let r=new Set,h=p.map((A,j)=>{let y=/^\[(\.\.\.)?([A-Za-z_]\w*)\]$/.exec(A);if(y){if(r.has(y[2])||y[1]&&j!==p.length-1)throw Error(`Invalid API parameter in ${e}`);return r.add(y[2]),`:${y[2]}${y[1]?"*":""}`}if(!/^[\w-]+$/.test(A))throw Error(`Unsupported API path segment ${A} in ${e}`);return A}),w=`/api${h.length?`/${h.join("/")}`:""}`,S=`${g} ${w.replace(/:\w+/g,":param")}`;if(f.has(S))throw Error(`Ambiguous API route ${g} ${w}: ${f.get(S)} and ${e}`);f.set(S,e);let x=m.join(o,e);R.add(m.resolve(x)),R.add(v.realpathSync(x)),i.push({pattern:w,method:g,filePath:x})}return i.sort((e,a)=>{let p=e.pattern.split("/"),n=a.pattern.split("/"),u=(d)=>d?.endsWith("*")?0:d?.startsWith(":")?1:2;for(let d=0;d<Math.max(p.length,n.length);d++){let g=u(n[d])-u(p[d]);if(g)return g}return e.pattern.localeCompare(a.pattern)||e.method.localeCompare(a.method)})}async function Ao(s,l){let o=c(s,"api-types.d.ts"),i=["// Generated by stx. Include this file in tsconfig.json.","declare module '@stacksjs/stx/api-client' {"," interface KnownApiRoutes {"];for(let t of l){let e=`./${m.relative(m.dirname(o),t.filePath).replace(/\\/g,"/")}`,{params:a}=ue(t.pattern);i.push(` ${JSON.stringify(`${t.method} ${t.pattern}`)}: { params: { ${a.map((p)=>`${JSON.stringify(p)}: string`).join("; ")} }; response: Awaited<ReturnType<typeof import(${JSON.stringify(e)}).default>> }`)}i.push(" }","}","export {}","");let f=i.join(`
|
|
3
3
|
`);if(!await Bun.file(o).exists()||await Bun.file(o).text()!==f)await Bun.write(o,f);return o}async function Po(s,l,o={}){let i=on(s,o);await Ao(s,i);let f=[];for(let t of i){let e=await Bun.build({entrypoints:[t.filePath],target:"bun",format:"esm",minify:!1,splitting:!1});if(!e.success)throw Error(`API build failed for ${t.filePath}: ${e.logs.join(`
|
|
4
|
-
`)}`);let a=e.outputs.find((u)=>u.kind==="entry-point");if(!a)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await a.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(l,n),a),f.push({...t,filePath:n})}return f}function E(s,l){let o=s.map((i)=>({route:i,...ue(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,a=(r)=>r.replace(/:\w+/g,":param"),p=t.filter((r)=>a(r.route.pattern)===a(e)),n=i.method,u=p.find((r)=>r.route.method===n)??(n==="HEAD"?p.find((r)=>r.route.method==="GET"):void 0);if(!u){let r=new Set(p.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=u.regex.exec(f),g=Object.create(null);try{u.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await l(u.route);if(typeof r!=="function")throw Error(`API endpoint ${u.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function Io(s,l){return E(l,async(o)=>(await import(I(m.resolve(s,o.filePath)).href)).default)}async function Eh(s,l){if(!l)return async()=>null;let o=l===!0?{}:l,i=on(s,o);return await Ao(s,i),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=on(s,o);await Ao(s,t);let{loadStxConfig:e}=await import("./chunk-
|
|
4
|
+
`)}`);let a=e.outputs.find((u)=>u.kind==="entry-point");if(!a)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await a.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(l,n),a),f.push({...t,filePath:n})}return f}function E(s,l){let o=s.map((i)=>({route:i,...ue(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,a=(r)=>r.replace(/:\w+/g,":param"),p=t.filter((r)=>a(r.route.pattern)===a(e)),n=i.method,u=p.find((r)=>r.route.method===n)??(n==="HEAD"?p.find((r)=>r.route.method==="GET"):void 0);if(!u){let r=new Set(p.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=u.regex.exec(f),g=Object.create(null);try{u.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await l(u.route);if(typeof r!=="function")throw Error(`API endpoint ${u.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function Io(s,l){return E(l,async(o)=>(await import(I(m.resolve(s,o.filePath)).href)).default)}async function Eh(s,l){if(!l)return async()=>null;let o=l===!0?{}:l,i=on(s,o);return await Ao(s,i),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=on(s,o);await Ao(s,t);let{loadStxConfig:e}=await import("./chunk-kfn7g24h.js"),a=N((await e(s)).runtimeConfig);return await ze(a,()=>E(t,async(p)=>{let n=await Bun.build({entrypoints:[p.filePath],target:"bun",format:"esm",splitting:!1});if(!n.success)throw Error(n.logs.join(`
|
|
5
5
|
`));let u=n.outputs.find((d)=>d.kind==="entry-point");if(!u||n.outputs.length!==1)throw Error(`Unsupported API bundle output: ${p.filePath}`);return(await import(`data:text/javascript;base64,${Buffer.from(await u.text()).toString("base64")}`)).default})(f))}catch(t){return console.error("[stx] API discovery failed:",t),Response.json({error:"API discovery failed; check the server log"},{status:500})}}}function Oo(s,l,o){if(xc(s))return!0;let i=/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/;if(i.test(m.basename(s)))return!0;try{if(i.test(m.basename(v.realpathSync(s))))return!0}catch{}if(R.has(m.resolve(s)))return!0;if(!o)return!1;let f=m.resolve(l,typeof o==="object"?o.dir??"server/api":"server/api"),t=(a)=>{try{return v.realpathSync(a)}catch{return m.resolve(a)}},e=t(s);return[f,m.resolve(l,"server"),m.resolve(l,".output/server")].some((a)=>{let p=t(a);return e===p||e.startsWith(`${p}${m.sep}`)})}
|
|
6
6
|
export{on,Ao,Po,Io,Eh,Oo};
|