@stacksjs/stx 0.2.907 → 0.2.908
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-fds6vvq0.js → chunk-0ek3s3b6.js} +7 -7
- package/dist/{chunk-x39v2ch2.js → chunk-0mxkw6m6.js} +10 -5
- package/dist/{chunk-yt8k715e.js → chunk-14497kj1.js} +1 -1
- package/dist/{chunk-wk6g0b9h.js → chunk-1pdntpwe.js} +1 -1
- package/dist/{chunk-w1pga3s6.js → chunk-1x0wcskp.js} +1 -1
- package/dist/{chunk-vmphrcaa.js → chunk-3npzxjr4.js} +1 -1
- package/dist/{chunk-gjzs6p2v.js → chunk-3qneemwh.js} +1 -1
- package/dist/{chunk-xpcqyzdc.js → chunk-45326z5v.js} +1 -1
- package/dist/{chunk-afmmrqee.js → chunk-4ajsp5dp.js} +1 -1
- package/dist/{chunk-rt6fn071.js → chunk-4ge69wvr.js} +1 -1
- package/dist/{chunk-ab1z38gj.js → chunk-4hrryats.js} +1 -1
- package/dist/{chunk-96wdxfn4.js → chunk-4jmztn9d.js} +1 -1
- package/dist/{chunk-c5cxpkfy.js → chunk-59bbk5gx.js} +2 -2
- package/dist/{chunk-nzqr3w35.js → chunk-5baag5dz.js} +4 -4
- package/dist/{chunk-j90sfypd.js → chunk-6756txp1.js} +1 -1
- package/dist/{chunk-bpx9cys7.js → chunk-69wpv1pr.js} +2 -2
- package/dist/{chunk-vbh5tknp.js → chunk-6mw288vd.js} +1 -1
- package/dist/chunk-7hgqyea0.js +2 -0
- package/dist/chunk-7m5rpqjy.js +2 -0
- package/dist/{chunk-r5xt6vdq.js → chunk-7xpez9tc.js} +1 -1
- package/dist/{chunk-4345d8s9.js → chunk-9343arqn.js} +1 -1
- package/dist/{chunk-3611xczp.js → chunk-a0esj80g.js} +1 -1
- package/dist/{chunk-tszhkmny.js → chunk-am610nan.js} +3 -3
- package/dist/{chunk-gjnxnfrg.js → chunk-amye7vb0.js} +1 -1
- package/dist/{chunk-kcphqn2k.js → chunk-av45fw8a.js} +1 -1
- package/dist/chunk-b25twdd7.js +2 -0
- package/dist/chunk-b7fmkwz2.js +2 -0
- package/dist/{chunk-fwffn130.js → chunk-c0kgwh4k.js} +2 -2
- package/dist/{chunk-6qgrr453.js → chunk-cfbmjgd0.js} +1 -1
- package/dist/{chunk-z0d1asbw.js → chunk-cjntf1jg.js} +1 -1
- package/dist/chunk-cssvev8r.js +2 -0
- package/dist/{chunk-jj78m9k1.js → chunk-d8mnaesb.js} +4 -4
- package/dist/{chunk-p3et6xjr.js → chunk-ddn98yz4.js} +1 -1
- package/dist/{chunk-mkm9drk3.js → chunk-f2yqqpvr.js} +1 -1
- package/dist/{chunk-se0pjx71.js → chunk-f3msm5tk.js} +1 -1
- package/dist/{chunk-exc8y30f.js → chunk-f74qzgp8.js} +1 -1
- package/dist/chunk-g67xjfe6.js +3 -0
- package/dist/{chunk-xahn0h9f.js → chunk-hg4vfrxr.js} +1 -1
- package/dist/{chunk-xfjp5q2m.js → chunk-jg5xc2m1.js} +2 -2
- package/dist/{chunk-sjrx0dj8.js → chunk-kt3f4rpy.js} +1 -1
- package/dist/{chunk-9bc23bv2.js → chunk-kydh790y.js} +1 -1
- package/dist/{chunk-wxk0t61p.js → chunk-mrx20xza.js} +1 -1
- package/dist/chunk-naj7m2av.js +2 -0
- package/dist/{chunk-4nc8vdef.js → chunk-p2b90rz9.js} +1 -1
- package/dist/{chunk-4dh1b9yr.js → chunk-pb2mztar.js} +1 -1
- package/dist/{chunk-zrsrhdxw.js → chunk-q4nk8sq2.js} +1 -1
- package/dist/chunk-qn9rrwp8.js +2 -0
- package/dist/{chunk-4a6mptfc.js → chunk-qpf782pt.js} +1 -1
- package/dist/{chunk-m9cye9t8.js → chunk-rdeje2dd.js} +5 -5
- package/dist/{chunk-20zx1msx.js → chunk-s91tcznf.js} +1 -1
- package/dist/{chunk-3yr0wyc9.js → chunk-skxkqh9a.js} +1 -1
- package/dist/{chunk-zcwx8z8z.js → chunk-sxqha69q.js} +2 -2
- package/dist/{chunk-qvj0bzw5.js → chunk-tpryfx8t.js} +4 -4
- package/dist/{chunk-6bgerbgh.js → chunk-trnw1tg5.js} +1 -1
- package/dist/{chunk-83g4169y.js → chunk-v25gm9d9.js} +4 -4
- package/dist/{chunk-5m4zgt4m.js → chunk-vkxrsy13.js} +1 -1
- package/dist/{chunk-q2jag6wt.js → chunk-vqys4n8f.js} +1 -1
- package/dist/{chunk-9xzej52j.js → chunk-xn8eabng.js} +1 -1
- package/dist/{chunk-42z7zv92.js → chunk-xqe3c7pa.js} +1 -1
- package/dist/{chunk-bcspywrd.js → chunk-xwarwkaw.js} +1 -1
- package/dist/{chunk-yqs88qj4.js → chunk-y9xq82ep.js} +1 -1
- package/dist/{chunk-e4tbq8a0.js → chunk-yjhktn0b.js} +2 -2
- package/dist/{chunk-wna2herj.js → chunk-yvp5tfrz.js} +1 -1
- package/dist/chunk-z8e2m6kz.js +2 -0
- package/dist/{chunk-ta5fpj2a.js → chunk-zk6qmkhb.js} +1 -1
- package/dist/{chunk-nmywrw6v.js → chunk-zkp5awqw.js} +1 -1
- package/dist/cli.js +8 -8
- package/dist/client/signals-loop-conditional-runtime.js +5 -0
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-218pnbaf.js +0 -2
- package/dist/chunk-257msenj.js +0 -3
- package/dist/chunk-291860br.js +0 -2
- package/dist/chunk-3dy3hr8r.js +0 -2
- package/dist/chunk-47ver0g7.js +0 -2
- package/dist/chunk-4b9jx2c1.js +0 -2
- package/dist/chunk-j661q889.js +0 -2
- package/dist/chunk-qq31bcsq.js +0 -2
- package/dist/chunk-wchz1sye.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{et,Ln,go,Yi,z}from"./chunk-w98yt4d4.js";import{Dn}from"./chunk-ab1z38gj.js";import{Zr,C,Ul,vt,oa,Vl}from"./chunk-4b110x6r.js";import{D}from"./chunk-phzhmnnm.js";import{T,R}from"./chunk-0jdz31q1.js";import{Yr,xo,Hn,Fl,je}from"./chunk-ck4ypzet.js";import{mo,d,m,Ee,Ur,p,te,K,be,_,yt,wo,Le,nt,vo}from"./chunk-c08jvjqt.js";import{w}from"./chunk-v6gkjg5f.js";import{ne}from"./chunk-e5rag6rh.js";import{t,h}from"./chunk-ahf9j8wb.js";import{c}from"./chunk-8tfpv6zf.js";import Rt from"path";import gn from"process";import{AsyncLocalStorage as lc}from"async_hooks";var ii=new lc;function Pn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function oi(e,n){return ii.run(Pn(e),n)}async function ai(e,n){let r=ii.getStore();if(!r)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let i=r.pending.get(e);if(i)return i;let a=Promise.resolve().then(n).then((l)=>{let u=JSON.stringify(l,(v,S)=>{if(S===void 0||typeof S==="function"||typeof S==="symbol"||typeof S==="bigint"||typeof S==="number"&&!Number.isFinite(S))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(S&&typeof S==="object"&&!Array.isArray(S)&&Object.getPrototypeOf(S)!==Object.prototype&&Object.getPrototypeOf(S)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return S}),f=JSON.parse(u);return r.values.set(e,f),f}).catch((l)=>{throw r.pending.delete(e),l});return r.pending.set(e,a),a}function zr(e){let n=e.__stx_server_data;if(!n?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(n.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function G(e,n=!1){let r=t(e),i=[],a=new Set,l=0,u=0,f=r.length,v=()=>{if(l!==0)return;let S=r.slice(u).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(S){if(n&&S[1]==="const")return;let V=S[2];if(!a.has(V))i.push(V),a.add(V);return}let I=r.slice(u).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(I){if(n&&r.slice(u).startsWith("const"))return;I[1].split(",").forEach((V)=>{let W=V.trim();if(!W)return;let Z=W.indexOf(":"),X=(Z>=0?W.slice(Z+1).trim():W).split(/[\s=]/)[0];if(X&&!a.has(X))i.push(X),a.add(X)});return}let j=r.slice(u).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(j){if(n&&r.slice(u).startsWith("const"))return;j[1].split(",").forEach((V)=>{let W=V.trim().replace(/^\.\.\./,"");if(!W)return;let Z=W.split(/[\s=]/)[0];if(Z&&!a.has(Z))i.push(Z),a.add(Z)});return}if(n)return;let L=r.slice(u).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let V=L[1];if(!a.has(V))i.push(V),a.add(V);return}let M=r.slice(u).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(M){let V=M[1];if(!a.has(V))i.push(V),a.add(V)}};while(u<f){if(r[u]==="{"){l++,u++;continue}if(r[u]==="}"){l--,u++;continue}if(l===0&&/[a-z]/i.test(r[u])&&(u===0||/\s|[;{}()]/.test(r[u-1])))v();u++}return i.join(", ")}function Js(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function uc(e,n=G(e).split(",").map((r)=>r.trim()).filter(Boolean)){let r=new Set(G(e,!0).split(",").map((i)=>i.trim()));return n.map((i)=>r.has(i)?`get ${i}() { return ${i} }, set ${i}(__stxValue_${i}) { ${i} = __stxValue_${i} }`:i).join(", ")}function Ys(e,n){let r=`{ ${uc(e,n)} }`;return G(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${r}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:r}import cn from"fs";import Ue from"path";function J(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var ci=new Map;function Nr(e,n=!0){let r=ci.get(e);if(n&&r)return r;let i=new Map,a=[Ue.join(e,"src"),Ue.join(e,"dist"),e];function l(u,f){if(f>6)return;let v;try{v=cn.readdirSync(u,{withFileTypes:!0})}catch{return}for(let S of v){let I=Ue.join(u,S.name);if(S.isDirectory()){if(S.name==="node_modules"||S.name.startsWith("."))continue;l(I,f+1)}else if(S.isFile()&&S.name.endsWith(".stx")){let j=S.name.slice(0,-4);if(!i.has(j))i.set(j,I);let L=j.toLowerCase();if(!i.has(L))i.set(L,I);let M=J(j);if(!i.has(M))i.set(M,I)}}}for(let u of a)if(l(u,0),i.size>0)break;if(n)ci.set(e,i);return i}function Zs(e,n){if(e.startsWith(".")||e.startsWith("/"))return null;let r=n;while(!0){let i=Ue.join(r,"node_modules",e);try{if(cn.statSync(i).isDirectory())return i}catch{}let a=Ue.dirname(r);if(a===r)return null;r=a}}function Qs(e,n,r={}){return[Ue.resolve(Ue.dirname(n),`${e}.stx`),Ue.resolve(Ue.dirname(n),e),Ue.resolve(r.componentsDir||"components",`${e}.stx`),Ue.resolve(r.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function li(e){let n=e.endsWith(".stx")?e.slice(0,-4):e,r=n.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),i=J(n);return[n,r,i]}function Ii(e,n){let[r,i,a]=li(e);for(let l of[r,r.toLowerCase(),i,a]){let u=n?.__importedComponents?.get(l);if(u!==void 0)return u}}function Oi(e,n){let r=n?Ue.resolve(n):void 0,i=Ue.dirname(Ue.resolve(e));for(;;){if(cn.existsSync(Ue.join(i,"package.json")))return r&&i===r?void 0:i;let a=Ue.dirname(i);if(a===i)return;i=a}}var pc=["src/ui","src/components","components","dist"];function ps(e,n){let r=Ue.resolve(e);if(!n&&!r.split(Ue.sep).includes("node_modules"))return[];let i=Oi(r,n);if(!i)return[];let a=[];try{let f=JSON.parse(cn.readFileSync(Ue.join(i,"package.json"),"utf8")).stx?.components;if(Array.isArray(f))a=f.filter((v)=>typeof v==="string")}catch{}let l=a.length?a:pc;return[Ue.dirname(Ue.resolve(e)),...l.map((u)=>Ue.resolve(i,u))]}function*Ni(e,n,r={},i){let a=li(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield Ue.resolve(Ue.dirname(n),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],u=r.projectRoot||process.cwd(),f=[...ps(n,r.projectRoot),...i?.__originalFilePath?[Ue.join(Ue.dirname(i.__originalFilePath),"components")]:[],...r.componentsDir?[r.componentsDir]:[],Ue.join(Ue.dirname(n),"components"),Ue.resolve(u,"src/components"),Ue.resolve(u,"components"),...import.meta.dir?[Ue.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(f)){for(let S of l)yield Ue.join(v,S);try{for(let S of cn.readdirSync(v,{withFileTypes:!0}))if(S.isDirectory())for(let I of l)yield Ue.join(v,S.name,I)}catch{}}}function ui(e,n,r={},i){let a=Ii(e,i);if(a!==void 0)return a;for(let l of Ni(e,n,r,i))try{if(cn.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function eo(e,n=[],r={}){let i=new Set([...e].map((S)=>S.replace(/[-_]/g,"").toLowerCase()));if(!i.has("src")&&!i.has("source")||!i.has("alt")&&!i.has("decorative"))return!1;let a=new Map(Object.entries(r).map(([S,I])=>[S.replace(/[-_]/g,"").toLowerCase(),I])),l=a.get("alt"),u=a.get("decorative"),f=typeof l==="string"&&!!l.trim(),v=typeof u==="string"?!["false","0","off","no"].includes(u.trim().toLowerCase()):Boolean(u);if(!f&&!v)return!1;if(["defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((S)=>i.has(S)))return!1;if([...n].some((S)=>!["load","error"].includes(S.replace(/^@/,"").split(".")[0].toLowerCase())))return!1;if(i.has("resizemode")&&(i.has("fit")||i.has("objectfit")))return!1;if(i.has("src")&&i.has("source"))return!1;return["fit","objectfit","resizemode","position","objectposition","rounded","aspectratio","zoomonhover","sources","webpsrc","webpsrcset"].some((S)=>i.has(S))}import Ls from"fs";import xe from"path";import Zt from"path";import Cn from"fs";var fc=new Set(["touchstart","touchmove","wheel","mousewheel"]);function Xs(e,n){if(n.passive)return!0;if(n.prevent||n.nonpassive)return!1;return fc.has(e.toLowerCase())}var pi=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"]),fi={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"},dc=new Set(["ctrl","alt","shift","meta"]),mi={left:0,middle:1,right:2};function di(e){let n={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let r of e){let i=r.toLowerCase();if(i==="prevent")n.prevent=!0;else if(i==="stop")n.stop=!0;else if(i==="once")n.once=!0;else if(i==="capture")n.capture=!0;else if(i==="self")n.self=!0;else if(i==="passive")n.passive=!0;else if(i==="nonpassive")n.nonpassive=!0;else if(dc.has(i))n.systemKeys.push(i);else if(i in mi)n.mouse=i;else if(i in fi||/^[a-z]$/.test(i))n.keys.push(fi[i]||i.toUpperCase());else if(i.startsWith("debounce")){let a=i.match(/debounce(?:\.(\d+))?/);n.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(i.startsWith("throttle")){let a=i.match(/throttle(?:\.(\d+))?/);n.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return n}function hi(e,n=""){let r=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[u,f,v]=l,S=l.index,I=S+u.length,j=`__stx_evt_${n}${i++}`,L=[],M=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,V;while((V=M.exec(v))!==null){let[,Z,q]=V,X=Z.split("."),U=X[0];if(!pi.has(U))continue;L.push({attribute:`@${Z}`,event:U,handler:q,modifiers:di(X.slice(1)),elementId:j})}let W=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((V=W.exec(v))!==null){let[,Z,q]=V,X=Z.split("."),U=X[0];if(!pi.has(U))continue;L.push({attribute:`@${Z}`,event:U,handler:q,modifiers:di(X.slice(1)),elementId:j})}if(L.length>0)r.push({originalTag:u,elementId:j,events:L,startIndex:S,endIndex:I})}return r}function gc(e){let n=[],{modifiers:r}=e;if(r.self)n.push("if ($event.target !== $el) return");for(let i of r.systemKeys)n.push(`if (!$event.${i}Key) return`);if(r.keys.length>0){let i=r.keys.map((a)=>`$event.key === '${a}'`).join(" || ");n.push(`if (!(${i})) return`)}if(r.mouse!==null){let i=mi[r.mouse];n.push(`if ($event.button !== ${i}) return`)}if(r.prevent)n.push("$event.preventDefault()");if(r.stop)n.push("$event.stopPropagation()");return n.join("; ")}function mc(e,n){let r=e;if(n.debounce!==null)r=`__stx_debounce(() => { ${r} }, ${n.debounce})`;else if(n.throttle!==null)r=`__stx_throttle(() => { ${r} }, ${n.throttle})`;return r}function Gs(e){let n=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(n))return e;return`if (typeof ${n} === 'function' && !${n}._isSignal) ${n}($event);`}function hc(e){let{modifiers:n}=e,r=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=gc(e),a=mc(Gs(e.handler),n),l=[];if(n.once)l.push("once: true");if(n.capture)l.push("capture: true");if(Xs(e.event,n))l.push("passive: true");let u=l.length>0?`, { ${l.join(", ")} }`:"",f=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
|
|
2
|
+
import{et,Ln,go,Yi,z}from"./chunk-w98yt4d4.js";import{Dn}from"./chunk-4hrryats.js";import{Zr,C,Ul,vt,oa,Vl}from"./chunk-4b110x6r.js";import{D}from"./chunk-phzhmnnm.js";import{T,R}from"./chunk-0jdz31q1.js";import{Yr,xo,Hn,Fl,je}from"./chunk-ck4ypzet.js";import{mo,d,m,Ee,Ur,p,te,K,be,_,yt,wo,Le,nt,vo}from"./chunk-c08jvjqt.js";import{w}from"./chunk-v6gkjg5f.js";import{ne}from"./chunk-e5rag6rh.js";import{t,h}from"./chunk-ahf9j8wb.js";import{c}from"./chunk-8tfpv6zf.js";import Rt from"path";import gn from"process";import{AsyncLocalStorage as lc}from"async_hooks";var ii=new lc;function Pn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function oi(e,n){return ii.run(Pn(e),n)}async function ai(e,n){let r=ii.getStore();if(!r)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let i=r.pending.get(e);if(i)return i;let a=Promise.resolve().then(n).then((l)=>{let u=JSON.stringify(l,(v,S)=>{if(S===void 0||typeof S==="function"||typeof S==="symbol"||typeof S==="bigint"||typeof S==="number"&&!Number.isFinite(S))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(S&&typeof S==="object"&&!Array.isArray(S)&&Object.getPrototypeOf(S)!==Object.prototype&&Object.getPrototypeOf(S)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return S}),f=JSON.parse(u);return r.values.set(e,f),f}).catch((l)=>{throw r.pending.delete(e),l});return r.pending.set(e,a),a}function zr(e){let n=e.__stx_server_data;if(!n?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(n.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function G(e,n=!1){let r=t(e),i=[],a=new Set,l=0,u=0,f=r.length,v=()=>{if(l!==0)return;let S=r.slice(u).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(S){if(n&&S[1]==="const")return;let V=S[2];if(!a.has(V))i.push(V),a.add(V);return}let I=r.slice(u).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(I){if(n&&r.slice(u).startsWith("const"))return;I[1].split(",").forEach((V)=>{let W=V.trim();if(!W)return;let Z=W.indexOf(":"),X=(Z>=0?W.slice(Z+1).trim():W).split(/[\s=]/)[0];if(X&&!a.has(X))i.push(X),a.add(X)});return}let j=r.slice(u).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(j){if(n&&r.slice(u).startsWith("const"))return;j[1].split(",").forEach((V)=>{let W=V.trim().replace(/^\.\.\./,"");if(!W)return;let Z=W.split(/[\s=]/)[0];if(Z&&!a.has(Z))i.push(Z),a.add(Z)});return}if(n)return;let L=r.slice(u).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let V=L[1];if(!a.has(V))i.push(V),a.add(V);return}let M=r.slice(u).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(M){let V=M[1];if(!a.has(V))i.push(V),a.add(V)}};while(u<f){if(r[u]==="{"){l++,u++;continue}if(r[u]==="}"){l--,u++;continue}if(l===0&&/[a-z]/i.test(r[u])&&(u===0||/\s|[;{}()]/.test(r[u-1])))v();u++}return i.join(", ")}function Js(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function uc(e,n=G(e).split(",").map((r)=>r.trim()).filter(Boolean)){let r=new Set(G(e,!0).split(",").map((i)=>i.trim()));return n.map((i)=>r.has(i)?`get ${i}() { return ${i} }, set ${i}(__stxValue_${i}) { ${i} = __stxValue_${i} }`:i).join(", ")}function Ys(e,n){let r=`{ ${uc(e,n)} }`;return G(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${r}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:r}import cn from"fs";import Ue from"path";function J(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var ci=new Map;function Nr(e,n=!0){let r=ci.get(e);if(n&&r)return r;let i=new Map,a=[Ue.join(e,"src"),Ue.join(e,"dist"),e];function l(u,f){if(f>6)return;let v;try{v=cn.readdirSync(u,{withFileTypes:!0})}catch{return}for(let S of v){let I=Ue.join(u,S.name);if(S.isDirectory()){if(S.name==="node_modules"||S.name.startsWith("."))continue;l(I,f+1)}else if(S.isFile()&&S.name.endsWith(".stx")){let j=S.name.slice(0,-4);if(!i.has(j))i.set(j,I);let L=j.toLowerCase();if(!i.has(L))i.set(L,I);let M=J(j);if(!i.has(M))i.set(M,I)}}}for(let u of a)if(l(u,0),i.size>0)break;if(n)ci.set(e,i);return i}function Zs(e,n){if(e.startsWith(".")||e.startsWith("/"))return null;let r=n;while(!0){let i=Ue.join(r,"node_modules",e);try{if(cn.statSync(i).isDirectory())return i}catch{}let a=Ue.dirname(r);if(a===r)return null;r=a}}function Qs(e,n,r={}){return[Ue.resolve(Ue.dirname(n),`${e}.stx`),Ue.resolve(Ue.dirname(n),e),Ue.resolve(r.componentsDir||"components",`${e}.stx`),Ue.resolve(r.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function li(e){let n=e.endsWith(".stx")?e.slice(0,-4):e,r=n.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),i=J(n);return[n,r,i]}function Ii(e,n){let[r,i,a]=li(e);for(let l of[r,r.toLowerCase(),i,a]){let u=n?.__importedComponents?.get(l);if(u!==void 0)return u}}function Oi(e,n){let r=n?Ue.resolve(n):void 0,i=Ue.dirname(Ue.resolve(e));for(;;){if(cn.existsSync(Ue.join(i,"package.json")))return r&&i===r?void 0:i;let a=Ue.dirname(i);if(a===i)return;i=a}}var pc=["src/ui","src/components","components","dist"];function ps(e,n){let r=Ue.resolve(e);if(!n&&!r.split(Ue.sep).includes("node_modules"))return[];let i=Oi(r,n);if(!i)return[];let a=[];try{let f=JSON.parse(cn.readFileSync(Ue.join(i,"package.json"),"utf8")).stx?.components;if(Array.isArray(f))a=f.filter((v)=>typeof v==="string")}catch{}let l=a.length?a:pc;return[Ue.dirname(Ue.resolve(e)),...l.map((u)=>Ue.resolve(i,u))]}function*Ni(e,n,r={},i){let a=li(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield Ue.resolve(Ue.dirname(n),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],u=r.projectRoot||process.cwd(),f=[...ps(n,r.projectRoot),...i?.__originalFilePath?[Ue.join(Ue.dirname(i.__originalFilePath),"components")]:[],...r.componentsDir?[r.componentsDir]:[],Ue.join(Ue.dirname(n),"components"),Ue.resolve(u,"src/components"),Ue.resolve(u,"components"),...import.meta.dir?[Ue.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(f)){for(let S of l)yield Ue.join(v,S);try{for(let S of cn.readdirSync(v,{withFileTypes:!0}))if(S.isDirectory())for(let I of l)yield Ue.join(v,S.name,I)}catch{}}}function ui(e,n,r={},i){let a=Ii(e,i);if(a!==void 0)return a;for(let l of Ni(e,n,r,i))try{if(cn.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function eo(e,n=[],r={}){let i=new Set([...e].map((S)=>S.replace(/[-_]/g,"").toLowerCase()));if(!i.has("src")&&!i.has("source")||!i.has("alt")&&!i.has("decorative"))return!1;let a=new Map(Object.entries(r).map(([S,I])=>[S.replace(/[-_]/g,"").toLowerCase(),I])),l=a.get("alt"),u=a.get("decorative"),f=typeof l==="string"&&!!l.trim(),v=typeof u==="string"?!["false","0","off","no"].includes(u.trim().toLowerCase()):Boolean(u);if(!f&&!v)return!1;if(["defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((S)=>i.has(S)))return!1;if([...n].some((S)=>!["load","error"].includes(S.replace(/^@/,"").split(".")[0].toLowerCase())))return!1;if(i.has("resizemode")&&(i.has("fit")||i.has("objectfit")))return!1;if(i.has("src")&&i.has("source"))return!1;return["fit","objectfit","resizemode","position","objectposition","rounded","aspectratio","zoomonhover","sources","webpsrc","webpsrcset"].some((S)=>i.has(S))}import Ls from"fs";import xe from"path";import Zt from"path";import Cn from"fs";var fc=new Set(["touchstart","touchmove","wheel","mousewheel"]);function Xs(e,n){if(n.passive)return!0;if(n.prevent||n.nonpassive)return!1;return fc.has(e.toLowerCase())}var pi=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"]),fi={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"},dc=new Set(["ctrl","alt","shift","meta"]),mi={left:0,middle:1,right:2};function di(e){let n={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let r of e){let i=r.toLowerCase();if(i==="prevent")n.prevent=!0;else if(i==="stop")n.stop=!0;else if(i==="once")n.once=!0;else if(i==="capture")n.capture=!0;else if(i==="self")n.self=!0;else if(i==="passive")n.passive=!0;else if(i==="nonpassive")n.nonpassive=!0;else if(dc.has(i))n.systemKeys.push(i);else if(i in mi)n.mouse=i;else if(i in fi||/^[a-z]$/.test(i))n.keys.push(fi[i]||i.toUpperCase());else if(i.startsWith("debounce")){let a=i.match(/debounce(?:\.(\d+))?/);n.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(i.startsWith("throttle")){let a=i.match(/throttle(?:\.(\d+))?/);n.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return n}function hi(e,n=""){let r=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[u,f,v]=l,S=l.index,I=S+u.length,j=`__stx_evt_${n}${i++}`,L=[],M=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,V;while((V=M.exec(v))!==null){let[,Z,q]=V,X=Z.split("."),U=X[0];if(!pi.has(U))continue;L.push({attribute:`@${Z}`,event:U,handler:q,modifiers:di(X.slice(1)),elementId:j})}let W=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((V=W.exec(v))!==null){let[,Z,q]=V,X=Z.split("."),U=X[0];if(!pi.has(U))continue;L.push({attribute:`@${Z}`,event:U,handler:q,modifiers:di(X.slice(1)),elementId:j})}if(L.length>0)r.push({originalTag:u,elementId:j,events:L,startIndex:S,endIndex:I})}return r}function gc(e){let n=[],{modifiers:r}=e;if(r.self)n.push("if ($event.target !== $el) return");for(let i of r.systemKeys)n.push(`if (!$event.${i}Key) return`);if(r.keys.length>0){let i=r.keys.map((a)=>`$event.key === '${a}'`).join(" || ");n.push(`if (!(${i})) return`)}if(r.mouse!==null){let i=mi[r.mouse];n.push(`if ($event.button !== ${i}) return`)}if(r.prevent)n.push("$event.preventDefault()");if(r.stop)n.push("$event.stopPropagation()");return n.join("; ")}function mc(e,n){let r=e;if(n.debounce!==null)r=`__stx_debounce(() => { ${r} }, ${n.debounce})`;else if(n.throttle!==null)r=`__stx_throttle(() => { ${r} }, ${n.throttle})`;return r}function Gs(e){let n=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(n))return e;return`if (typeof ${n} === 'function' && !${n}._isSignal) ${n}($event);`}function hc(e){let{modifiers:n}=e,r=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=gc(e),a=mc(Gs(e.handler),n),l=[];if(n.once)l.push("once: true");if(n.capture)l.push("capture: true");if(Xs(e.event,n))l.push("passive: true");let u=l.length>0?`, { ${l.join(", ")} }`:"",f=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('${r}');
|
|
5
5
|
if (!$el) return;
|
|
@@ -112,7 +112,7 @@ else {
|
|
|
112
112
|
`)}
|
|
113
113
|
})();
|
|
114
114
|
</script>`}function xc(e,n=""){let r=hi(e,n);if(r.length===0)return{template:e,bindings:[]};let i=e,a=[];for(let l=r.length-1;l>=0;l--){let u=r[l],f=u.originalTag;if(!f.includes(" id="))f=f.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${u.elementId}"`);else{let v=f.match(/id=["']([^"']+)["']/);if(v)for(let S of u.events)S.elementId=v[1]}for(let v of u.events){let S=v.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),I=new RegExp(`\\s*${S}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${S}\\s*=\\s*'[^']*'`,"g");f=f.replace(I,""),f=f.replace(j,"")}i=i.slice(0,u.startIndex)+f+i.slice(u.endIndex),a.push(...u.events)}return{template:i,bindings:a}}function gi(e){let n=e.$uid;return typeof n==="string"&&n?`${n}_`:""}function ol(e,n,r){if(Vl(e))return e;if(n.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:f,bindings:v}=xc(e,gi(n)),S=n.__stx_event_bindings||[];return n.__stx_event_bindings=[...S,...v],f}let i=hi(e,gi(n));if(i.length===0)return e;let a=e;for(let f=i.length-1;f>=0;f--){let v=i[f],S=v.originalTag;if(!S.includes(" id="))S=S.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${v.elementId}"`);else{let I=S.match(/id=["']([^"']+)["']/);if(I)for(let j of v.events)j.elementId=I[1]}for(let I of v.events){let j=I.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),L=new RegExp(`\\s*${j}\\s*=\\s*"[^"]*"`,"g"),M=new RegExp(`\\s*${j}\\s*=\\s*'[^']*'`,"g");S=S.replace(L,""),S=S.replace(M,"")}a=a.slice(0,v.startIndex)+S+a.slice(v.endIndex)}let l=Mi(i.flatMap((f)=>f.events)),u=c(a);if(u!==-1)a=a.slice(0,u)+l+`
|
|
115
|
-
`+a.slice(u);else a+=l;return a}function xi(e,n){let r=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(n){let l=a.lastIndexOf(":");if(l!==-1)a=a.slice(l+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))r.add(a)}return r}function Ut(e,n){let r=t(e),{depths:i,balanced:a}=h(r),l=(f)=>!a||i[f]===0,u=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${n}\\b)`,"g");for(let f of r.matchAll(u)){let v=(f.index??0)+f[0].length-f[1].length;if(l(v))return!0}for(let f of r.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(f.index??0)&&xi(f[1],!0).has(n))return!0;for(let f of r.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(f.index??0)&&xi(f[1],!1).has(n))return!0;return!1}var qe="0.2.
|
|
115
|
+
`+a.slice(u);else a+=l;return a}function xi(e,n){let r=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(n){let l=a.lastIndexOf(":");if(l!==-1)a=a.slice(l+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))r.add(a)}return r}function Ut(e,n){let r=t(e),{depths:i,balanced:a}=h(r),l=(f)=>!a||i[f]===0,u=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${n}\\b)`,"g");for(let f of r.matchAll(u)){let v=(f.index??0)+f[0].length-f[1].length;if(l(v))return!0}for(let f of r.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(f.index??0)&&xi(f[1],!0).has(n))return!0;for(let f of r.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(f.index??0)&&xi(f[1],!1).has(n))return!0;return!1}var qe="0.2.908";var bi=Symbol.for(`stx.lazy-module-promises.${qe}`);function yc(){let e=globalThis;return e[bi]??=new Map,e[bi]}function o(e,n){let r=yc(),i=`${import.meta.url}\x00${e}`,a=r.get(i);if(a)return a;let l=n();return r.set(i,l),l.catch(()=>{if(r.get(i)===l)r.delete(i)}),l}var _c=/<\/(script)/gi;function me(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(_c,"<\\/$1")}import yi from"fs";var _i=[];function k(e){let n=new T(e);return _i.push(n),n}function il(){for(let e of _i)e.clear()}function E(e,...n){return`${n.map((r)=>String(r??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function Mr(e){let n=[];for(let r of new Set(e))try{n.push({path:r,mtimeMs:yi.statSync(r).mtimeMs})}catch{}return n}function to(e){for(let n of e)try{if(yi.statSync(n.path).mtimeMs!==n.mtimeMs)return!1}catch{return!1}return!0}var Oe=["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 wc=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function vc(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let r=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!r)return null;return{pkg:r[1],subpath:r[2]||""}}let n=e.match(/^([^/]+)(\/.*)?$/);if(!n)return null;return{pkg:n[1],subpath:n[2]||""}}function Sc(e,n){let r=n;while(!0){let i=Zt.join(r,"node_modules",e,"package.json");if(Cn.existsSync(i))return Zt.dirname(i);let a=Zt.dirname(r);if(a===r)return null;r=a}}function $c(e,n){if(!e||typeof e!=="object")return null;let r=(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 r(a.import);if(typeof a.default==="object")return r(a.default)}return null};if(Object.prototype.hasOwnProperty.call(e,n))return r(e[n]);let i=null;for(let a of Object.keys(e)){let l=a.indexOf("*");if(l===-1)continue;let u=a.slice(0,l),f=a.slice(l+1);if(!n.startsWith(u)||!n.endsWith(f))continue;if(n.length<u.length+f.length)continue;if(!i||u.length>i.prefix.length)i={pattern:a,prefix:u,suffix:f}}if(i){let a=n.slice(i.prefix.length,n.length-i.suffix.length),l=r(e[i.pattern]);if(l)return l.replace("*",a)}return null}function Ec(e,n){let r=vc(e);if(!r||!r.subpath)return null;let i=Sc(r.pkg,n);if(!i)return null;let a;try{a=JSON.parse(Cn.readFileSync(Zt.join(i,"package.json"),"utf8"))}catch{return null}let l=`.${r.subpath}`,u=$c(a.exports,l);if(!u)return null;let f=Zt.resolve(i,u);return Cn.existsSync(f)?f:null}function Vi(e,n){let r=n.filePath?Zt.dirname(n.filePath):n.projectRoot||process.cwd(),i=n.projectRoot||process.cwd(),a=new Set,l=[],u=[];return{code:e.replace(wc,(v,S)=>{let I;try{if(S.startsWith("./")||S.startsWith("../")||S.startsWith("/")){if(I=S.startsWith("/")?S:Zt.resolve(r,S),!Cn.existsSync(I))throw Error(`file not found: ${I}`)}else{let j=null;try{j=Bun.resolveSync(S,i)}catch{j=Ec(S,i)}if(!j)throw Error(`could not resolve ${S} (Bun.resolveSync + exports fallback both failed)`);I=j}}catch(j){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(S)} (from ${n.filePath||"<unknown>"}): ${j?.message||j}`),u.push(S),""}if(a.has(I))return"";a.add(I);try{let j=Cn.readFileSync(I,"utf8");l.push({source:S,resolvedPath:I,contents:j})}catch(j){console.warn(`[stx:vendor-css] could not read ${I}: ${j?.message||j}`),u.push(S)}return""}),styles:l,unresolved:u}}function kc(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Wi(e){if(e.length===0)return"";return`${e.map((n)=>`<style data-stx-vendor="${kc(n.source)}" data-stx-layer="vendor">
|
|
116
116
|
@layer vendor {
|
|
117
117
|
${n.contents}
|
|
118
118
|
}
|
|
@@ -182,7 +182,7 @@ else {
|
|
|
182
182
|
// STX: auto-generated event bindings
|
|
183
183
|
${e.map((r,i)=>Nc(r,i)).join(`
|
|
184
184
|
`)}`}function $i(e){let n=[],r=new Set,i=e.replace(/^\s*import\s+.*$/gm,""),a=0,l=i.length,u=0;while(u<l){let f=i[u];if(f==="'"||f==='"'||f==="`"){let v=f;if(u++,v==="`"){let S=0;while(u<l){if(i[u]==="\\"){u+=2;continue}if(i[u]==="`"&&S===0){u++;break}if(i[u]==="$"&&i[u+1]==="{"){S++,u+=2;continue}if(i[u]==="}"&&S>0){S--,u++;continue}u++}}else while(u<l){if(i[u]==="\\"){u+=2;continue}if(i[u]===v){u++;break}u++}continue}if(f==="/"&&i[u+1]==="/"){while(u<l&&i[u]!==`
|
|
185
|
-
`)u++;continue}if(f==="/"&&i[u+1]==="*"){u+=2;while(u<l-1&&!(i[u]==="*"&&i[u+1]==="/"))u++;u+=2;continue}if(f==="{"){a++,u++;continue}if(f==="}"){a--,u++;continue}if(a===0){let v=i.slice(u),S=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(S){let L=S[1];if(!L.startsWith("_")&&!r.has(L))n.push(L),r.add(L);u+=S[0].length;continue}let I=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(I){I[1].split(",").forEach((L)=>{let M=L.trim(),V=M.indexOf(":"),W=V>=0?M.slice(V+1).trim().split(/[\s=]/)[0]:M.split(/[\s=]/)[0];if(W&&!W.startsWith("_")&&!r.has(W))n.push(W),r.add(W)}),u+=I[0].length;continue}let j=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(j){let L=j[1];if(!L.startsWith("_")&&!r.has(L))n.push(L),r.add(L);u+=j[0].length;continue}}u++}return n}var zc=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 Bc(e){let n=new Set,r=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(L){let M;while((M=r.exec(L))!==null){let V=M[0];if(!zc.has(V))n.add(V)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)i(l[1]);let u=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=u.exec(e))!==null)i(l[1]);let f=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=f.exec(e))!==null)i(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)i(l[1]);let S=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=S.exec(e))!==null)i(l[1]);let I=/@model\s*=\s*["']([^"']*)["']/gi;while((l=I.exec(e))!==null)i(l[1]);let j=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=j.exec(e))!==null)i(l[1]);return n}async function Je(e,n={}){let r=e,i="",a=!1,l=[],u=Vi(r,{filePath:n.filePath,projectRoot:n.projectRoot});r=u.code;let f=Wi(u.styles),v=Gt(r);r=v.code,l=[...v.imports,...v.models];let{hasUserImports:S,bundleClientScript:I}=await o("stx/client-script-bundler",()=>import("./chunk-
|
|
185
|
+
`)u++;continue}if(f==="/"&&i[u+1]==="*"){u+=2;while(u<l-1&&!(i[u]==="*"&&i[u+1]==="/"))u++;u+=2;continue}if(f==="{"){a++,u++;continue}if(f==="}"){a--,u++;continue}if(a===0){let v=i.slice(u),S=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(S){let L=S[1];if(!L.startsWith("_")&&!r.has(L))n.push(L),r.add(L);u+=S[0].length;continue}let I=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(I){I[1].split(",").forEach((L)=>{let M=L.trim(),V=M.indexOf(":"),W=V>=0?M.slice(V+1).trim().split(/[\s=]/)[0]:M.split(/[\s=]/)[0];if(W&&!W.startsWith("_")&&!r.has(W))n.push(W),r.add(W)}),u+=I[0].length;continue}let j=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(j){let L=j[1];if(!L.startsWith("_")&&!r.has(L))n.push(L),r.add(L);u+=j[0].length;continue}}u++}return n}var zc=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 Bc(e){let n=new Set,r=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(L){let M;while((M=r.exec(L))!==null){let V=M[0];if(!zc.has(V))n.add(V)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)i(l[1]);let u=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=u.exec(e))!==null)i(l[1]);let f=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=f.exec(e))!==null)i(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)i(l[1]);let S=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=S.exec(e))!==null)i(l[1]);let I=/@model\s*=\s*["']([^"']*)["']/gi;while((l=I.exec(e))!==null)i(l[1]);let j=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=j.exec(e))!==null)i(l[1]);return n}async function Je(e,n={}){let r=e,i="",a=!1,l=[],u=Vi(r,{filePath:n.filePath,projectRoot:n.projectRoot});r=u.code;let f=Wi(u.styles),v=Gt(r);r=v.code,l=[...v.imports,...v.models];let{hasUserImports:S,bundleClientScript:I}=await o("stx/client-script-bundler",()=>import("./chunk-pb2mztar.js"));if(S(r))r=await I(r,n.filePath||"",{projectRoot:n.projectRoot,minify:n.production}),a=!0;if(n.autoImports!==!1){let U=_l(r);r=U.code,i=Cl(U.stxImports,U.browserImports.filter((H)=>!l.includes(H)))}if(i=`${In(r,n.serverData)}${i}`,r=D(r),!a&&Ye(n.attrs||""))r=Ze(r);let j=Lc(n.eventBindings||[]),L=(n.attrs||"").trim(),M=/\btype\s*=\s*["']module["']/i.test(L),V=n.instanceId?` data-stx-instance="${n.instanceId}"`:"";if(M){let U=L.replace(/\btype\s*=\s*["']module["']/i,"").trim(),H=`type="module" data-stx-scoped${V}${U?` ${U}`:""}`;return`${f}<script ${H}>
|
|
186
186
|
${me(`${i}${r}
|
|
187
187
|
${j}`)}
|
|
188
188
|
</script>`}let W=oa(e),Z=/function __stx_setup_/.test(r),q=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function X(U){let H=U.length>0?`
|
|
@@ -1183,9 +1183,9 @@ ${S.join(`
|
|
|
1183
1183
|
`){let V=e[a];if(V==="\\"){a+=2;continue}if(V==="[")M=!0;else if(V==="]")M=!1;else if(V==="/"&&!M){a++;while(a<l&&/[a-z]/i.test(e[a]))a++;return}a++}},L=()=>{if(i!==0)return;let M=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(M){let q=M[2].split(",").map((X)=>{let U=X.trim().split(":");return U[U.length-1].trim()});for(let X of q)if(X&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(X)&&!r.has(X))n.push(X),r.add(X);return}let V=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(V){let q=V[2];if(!r.has(q))n.push(q),r.add(q);return}let W=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(W){let q=W[1];if(!r.has(q))n.push(q),r.add(q);return}let Z=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Z){let q=Z[1];if(!r.has(q))n.push(q),r.add(q)}};while(a<l){if(v())continue;if(e[a]==="'"||e[a]==='"'){u(e[a]);continue}if(e[a]==="`"){f();continue}if(e[a]==="/"&&I()){j();continue}if(e[a]==="{"){i++,a++;continue}if(e[a]==="}"){i--,a++;continue}if(i===0&&/[a-z]/i.test(e[a])&&(a===0||/\s|[;{}()]/.test(e[a-1])))L();a++}return n}function zp(e,n,r){for(let i of ee(e)){let a=O(i.attrs);if(["server","src","component","stx:component"].some((f)=>a.has(f))||!kt(a))continue;let l=pn(e.slice(i.bodyStart,i.bodyEnd));if(!l)continue;let u=Object.assign(Object.create(null),r);for(let[f,v]of Object.entries(l.defaults))if(u[f]===void 0)u[f]=Rs(v);for(let f of new Set([...l.propNames,...Object.keys(l.defaults)])){let v=l.localBindings[f]??(l.propBindings[f]?void 0:f);if(v)Object.defineProperty(n,v,{value:u[f],writable:!0,enumerable:!0,configurable:!0})}if(l.identifier)Object.defineProperty(n,l.identifier,{value:u,writable:!0,enumerable:!0,configurable:!0})}}var Bp=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function Xg(e,n){let r=Vt(e),i=e.slice(r).match(/^<([a-zA-Z][a-zA-Z0-9-]*)/);if(!i)return null;let a=i[1].toLowerCase();if(!Bp.has(a))return null;let l=new RegExp(`<\\/?${a}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),u=x(e,(I,j)=>(l.lastIndex=j,l.exec(I)?.index===j?l.lastIndex:-1));if(a==="span"&&/\sdata-stx-scope\s*=/.test(u[0]?.token||""))return null;let f=0,v=!1;for(let I of u){if(f+=I.token.startsWith("</")?-1:1,f<0)return null;if(f===0){if(e.slice(I.end).trim())return null;v=!0;break}}if(!v)return null;let S=r+i[0].length;return e.slice(0,S)+n+e.slice(S)}function qa(e,n){if(!e)return!1;return[...n.additionalComponentsDirs??[],...n.fallbackComponentsDir?[n.fallbackComponentsDir]:[]].some((i)=>{let a=xe.relative(xe.resolve(i),xe.resolve(e));return!a.startsWith("..")&&!xe.isAbsolute(a)})}async function Hr(e,n,r,i,a){let l=e.endsWith(".stx")?e.slice(0,-4):e,u=(ce)=>ce.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""),f=r.__importedComponents;if(f){for(let ce of[l,l.toLowerCase(),u(l),J(l)])if(f.has(ce))return!0}let v=[...new Set([`${l}.stx`,`${u(l)}.stx`,`${J(l)}.stx`])],S=typeof a.root==="string"?xe.resolve(a.root):void 0,I=S??xe.dirname(i),j=[],L=(ce)=>{if(ce&&!j.includes(ce))j.push(ce)};for(let ce of ps(i,S))L(ce);let M=r.__originalFilePath;if(M)L(xe.join(xe.dirname(M),"components"));if(qa(n,a))L(a._rootComponentsDir);L(n),L(a._rootComponentsDir),L(xe.join(xe.dirname(i),"components")),L(a.componentsDir);for(let ce of a.additionalComponentsDirs??[])L(ce);let V=a._targetComponentFallbackNames?.some((ce)=>ce.toLowerCase()===l.toLowerCase());if(!V)for(let ce of a._targetComponentDirs??[])L(ce);if(S)L(xe.resolve(S,"resources/views/components")),L(xe.resolve(S,"resources/components")),L(xe.resolve(S,"src/components")),L(xe.resolve(S,"components"));for(let ce of a._layerComponentDirs??[])L(ce);let W=a._pluginComponentDirs;if(Array.isArray(W))for(let ce of W)L(typeof ce==="string"?ce:null);if(L(a.fallbackComponentsDir),V)for(let ce of a._targetComponentDirs??[])L(ce);let Z=a._nativePrimitivesFallback;if(Z&&!Z.except.some((ce)=>ce.toLowerCase()===l.toLowerCase()))L(Z.dir);if(l.startsWith("./")||l.startsWith("../"))return s(xe.resolve(xe.dirname(i),`${l}.stx`));let q=za(xe.resolve(import.meta.dir,"components")),X=j.map((ce)=>xe.isAbsolute(ce)?ce:xe.resolve(I,ce)),U=`${v.join("\x00")}\x00\x00${X.join("\x00")}`,H=Pr.get(U);if(H!==void 0)return H;let re=!1;e:for(let ce of X){if(za(ce)===q)continue;for(let le of v)if(await s(xe.join(ce,le))){re=!0;break e}}return Pr.set(U,re),re}function za(e){let n=Wr.get(e);if(n!==void 0)return n;let r=e;try{r=Ls.realpathSync(e)}catch{}return Wr.set(e,r),r}function Gg(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function El(e){if(!e)return!1;let n=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(n)}function Wp(e,n,r){if(!e.includes("{{")&&!e.includes("{!!"))return e;let i=(a,l)=>{let u;try{u=N(a,n)}catch{return l}if(u===void 0||u===null)return"";let f=String(u);if(/<\/style/i.test(f))return console.warn(`[stx] a <style> expression in ${r??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return f};return e.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>i(l,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,l)=>i(l,a))}var Ba=new Set;function Wa(e,n,r,i){let a=`${e}\x00${n}\x00${i??""}`;if(!process.env.STX_DEBUG&&Ba.has(a))return;Ba.add(a);let l=n?` used in ${n}`:"",u=i?` Cause: ${i}.`:"",f=r.length>0?`
|
|
1184
1184
|
searched:
|
|
1185
1185
|
${r.map((v)=>` - ${v}`).join(`
|
|
1186
|
-
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${u}${f}`)}function Fa(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var Fp=new Set(["for","if","show","key","ref","class","className","style"]),Va=new Set,Za="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",Tl=new RegExp(`\\b(?:${Za})\\s*(?:<[^>]*>)?\\s*\\(`);function qi(e){let n=new Set,r=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|${Za})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let i of e){let a;while((a=r.exec(i))!==null)n.add(a[1]);r.lastIndex=0}return[...n]}async function Qe(e,n,r,i,a,l,u,f=new Set,v,S=mt(a),I,j=e){let{extractVariables:L}=await o("stx/variable-extractor",()=>import("./chunk-gjnxnfrg.js")),M=f??new Set;if(M.has(e))return`[Circular component reference: ${e}]`;let V=new Set(M);V.add(e);let W=typeof n.client==="string"?n.client.trim():"";if("client"in n)delete n.client;let Z=W&&W!=="load"&&Gg(W)?W:"";try{let q=(ge)=>ge.split("-").map((ve)=>ve.charAt(0).toUpperCase()+ve.slice(1)).join(""),X=j.endsWith(".stx")?j.slice(0,-4):j,U=null,H=a.__importedComponents;if(H){let ge=[X,X.toLowerCase(),q(X),J(X)];for(let ve of ge)if(H.has(ve)){U=H.get(ve);break}}let re=[];if(!U){let ge=[`${X}.stx`,`${q(X)}.stx`,`${J(X)}.stx`],ve=[...new Set(ge)],ze=a.__originalFilePath,Se=[];for(let Pe of ps(l))if(!Se.includes(Pe))Se.push(Pe);let pt=Se.length;for(let Pe of u._layerComponentDirs??[])if(!Se.includes(Pe))Se.push(Pe);if(ze){let Pe=xe.join(xe.dirname(ze),"components");Se.push(Pe)}let tt=u._rootComponentsDir;if(typeof tt==="string"&&qa(i,u)&&!Se.includes(tt))Se.push(tt);if(i&&!Se.includes(i))Se.push(i);if(typeof tt==="string"&&!Se.includes(tt))Se.push(tt);let It=xe.join(xe.dirname(l),"components");if(!Se.includes(It))Se.push(It);if(u.componentsDir&&u.componentsDir!==i&&!Se.includes(u.componentsDir))Se.push(u.componentsDir);for(let Pe of u.additionalComponentsDirs??[])if(Pe&&!Se.includes(Pe))Se.push(Pe);let nn=u._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(X),Pt=(I?.events??[]).map((Pe)=>Pe.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),ts=Object.hasOwn(n,"checked")||Boolean(I?.reactiveProps?.includes("checked")),Ws=Object.hasOwn(n,"value")||Boolean(I?.reactiveProps?.includes("value")),Fs=!Pt.includes("valuechange")&&(ts||Pt.includes("change")&&!Ws),Ft=u._nativeHostAttrs&&/^textinput$/i.test(X),sn=Pt.includes("update:value")&&!Pt.includes("input"),kn=u._nativeHostAttrs&&/^video$/i.test(X),Vs=u._nativeHostAttrs&&/^image$/i.test(X),ns=eo([...Object.keys(n),...I?.reactiveProps??[]],I?.events,n),rn=Object.hasOwn(n,"src")||Boolean(I?.reactiveProps?.includes("src")),ss=Object.hasOwn(n,"source")||Boolean(I?.reactiveProps?.includes("source")),rs=kn&&(rn||ss)&&(I?.events??[]).every((Pe)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(Pe.replace(/^@/,"").split(".")[0])),is=new Set(["","primary","secondary","outline","ghost","danger"]),os=typeof n.variant==="string"?n.variant.trim().toLowerCase():"",as=u._nativeHostAttrs&&/^button$/i.test(X)&&!is.has(os),ei=u._targetComponentFallbackNames?.some((Pe)=>Pe.toLowerCase()===X.toLowerCase())??!1,Us=ei&&(!nn||Fs)&&(!Ft||sn)&&(!kn||rs)&&(!Vs||ns)&&!as;for(let Pe of Us?[]:u._targetComponentDirs??[])if(Pe&&!Se.includes(Pe))Se.push(Pe);let on=typeof u.root==="string"?xe.resolve(u.root):void 0,ti=on??xe.dirname(l),an=[];if(on)an.push(xe.resolve(on,"resources/views/components")),an.push(xe.resolve(on,"resources/components")),an.push(xe.resolve(on,"src/components")),an.push(xe.resolve(on,"components"));an.push(xe.resolve(import.meta.dir,"components"));for(let Pe of an)if(!Se.includes(Pe))Se.push(Pe);if(ei){let Pe=(u._componentPackageDirs??[]).filter((bt)=>typeof bt==="string"&&bt.length>0),Ot=(Us?Pe.length?Pe:u._pluginComponentDirs??[]:u._targetComponentDirs??[]).filter((bt)=>typeof bt==="string"&&bt.length>0);if(Ot.length){let bt=Se.slice(pt).map((dt)=>xe.isAbsolute(dt)?dt:xe.resolve(ti,dt)).filter((dt)=>!Ot.includes(dt)),ls=`${X}\x00${bt.join("\x00")}`,Ct=Or.get(ls);if(Ct===void 0){Ct=!1;for(let dt of bt){for(let Ht of ve)if(await s(xe.join(dt,Ht))){Ct=!0;break}if(Ct)break}Or.set(ls,Ct)}if(!Ct){for(let dt of Ot){let Ht=Se.indexOf(dt);if(Ht>=0)Se.splice(Ht,1)}Se.splice(pt,0,...Ot)}}}let ni=u._pluginComponentDirs;if(Array.isArray(ni)){for(let Pe of ni)if(typeof Pe==="string"&&!Se.includes(Pe))Se.push(Pe)}if(u.fallbackComponentsDir&&!Se.includes(u.fallbackComponentsDir))Se.push(u.fallbackComponentsDir);if(Us){for(let Pe of u._targetComponentDirs??[])if(Pe&&!Se.includes(Pe))Se.push(Pe)}let cs=u._nativePrimitivesFallback;if(cs&&!cs.except.some((Pe)=>Pe.toLowerCase()===X.toLowerCase())&&!Se.includes(cs.dir))Se.push(cs.dir);let si=[...new Set(Se.map((Pe)=>{if(!Pe)return Pe;return xe.isAbsolute(Pe)?Pe:xe.resolve(ti,Pe)}))];Se.length=0,Se.push(...si);let Hs=`${X}\x00${l}\x00${si.join("\x00")}`,Ks=Ds.get(Hs);if(Ks)if(await s(Ks))U=Ks;else Ds.delete(Hs);if(!U&&(X.startsWith("./")||X.startsWith("../")))U=xe.resolve(xe.dirname(l),`${X}.stx`),re.push(U);else if(!U)for(let Pe of Se){if(!Pe)continue;for(let Ot of ve){let bt=xe.join(Pe,Ot);if(re.push(bt),await s(bt)){U=bt;break}}if(U)break;if(!U)try{let Ot=await import("fs");if(!Ot.statSync(Pe,{throwIfNoEntry:!1})?.isDirectory())continue;let ls=8,Ct=[{path:Pe,depth:0}];while(Ct.length>0&&!U){let dt=Ct.pop();if(dt.depth>=ls)continue;let Ht;try{Ht=Ot.readdirSync(dt.path,{withFileTypes:!0})}catch{continue}for(let us of Ht){if(!us.isDirectory())continue;if(us.name==="node_modules"||us.name.startsWith("."))continue;let ri=xe.join(dt.path,us.name);for(let cc of ve){let qs=xe.join(ri,cc);if(re.push(qs),await s(qs)){U=qs;break}}if(U)break;Ct.push({path:ri,depth:dt.depth+1})}}}catch{}if(U)break}if(U)Ds.set(Hs,U)}if(!U||!await s(U))return Wa(e,l,re),Fa(e);v.add(U);let ce;if(Zn.has(U)&&Ir.get(U)===Da(U))ce=Zn.get(U);else try{let ge=Da(U);ce=await Bun.file(U).text(),Zn.set(U,ce),Ir.set(U,ge)}catch(ge){let ve=ge instanceof Error?ge.message:String(ge);return Wa(e,l,[U],ve),Fa(e)}if(I)for(let ge of new Set([...Object.keys(n),...I.reactiveProps??[]])){let ve=ge.toLowerCase();if(ve.startsWith("aria-")||ve.startsWith("data-"))continue;let ze=ge.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${ze}\\b`).test(ce))I.declaredProps.add(ge);if(new RegExp(`\\$props\\s*(?:\\.\\s*${ze}\\b|\\[\\s*['"]${ze}['"]\\s*\\])`).test(ce)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${ze}['"]`).test(ce))I.consumedProps?.add(ge)}if(I?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(ce))for(let ge of I.reactiveProps){if(Fp.has(ge)||I.consumedProps?.has(ge))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${ge.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(ce))continue;let ve=`${U}\x00${ge}`;if(Va.has(ve))continue;Va.add(ve),console.warn(`[stx] ${xe.basename(U)} reads \`${ge}\` with defineProps(), which is not live, but ${xe.basename(l)} binds it (:${ge}): 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('${ge}').`)}let le=new Set(["__originalFilePath","__importedComponents",hs,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),pe={};for(let[ge,ve]of Object.entries(a))if(!ge.startsWith("__")||le.has(ge))pe[ge]=ve;let Re=S.length>0?{[vs]:[...S]}:{},Ae=r;if(r.includes("@include")){let{processIncludes:ge}=await o("stx/includes",()=>import("./chunk-sjrx0dj8.js"));Ae=await ge(r,a,l,u,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ae)){let{processComponents:ge}=await o("stx/component-renderer",()=>import("./chunk-20zx1msx.js")),ve={...a,__processedComponents:M,...Re};Ae=await ge(Ae,ve,l,u,v);let ze=ve.__stx_preserved_client_expressions;if(Array.isArray(ze)&&ze.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...ze])]}let we=[];if(El(Ae)){let{processExpressions:ge}=await o("stx/expressions",()=>import("./chunk-96wdxfn4.js")),ve=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...Re}:S.length>0?{...a,...Re}:a;Ae=ge(Ae,ve,l);for(let ze of Ae.matchAll(/\{\{([\s\S]*?)\}\}/g))we.push(ze[1].trim())}let fe=new Set(Array.isArray(a.__stx_client_declared_names)?a.__stx_client_declared_names:[]),We=[];if(fe.size>0&&Ae)for(let ge of Ae.matchAll(/<[A-Z][\w.-]*\b([^>]*)>/g))for(let ve of ge[1].matchAll(/\s(?:v-model(?::[\w-]+)?|:[\w-]+)\s*=\s*"([^"]*)"/g)){let ze=ve[1].trim();try{if(ze&&Ee(ze).some((Se)=>fe.has(Se)))We.push(ze)}catch{}}let Fe=se(Ae),it=[],ot=Fe.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(ge,ve)=>{let ze=Fe.scripts[Number(ve)]||"",Se=ze.match(/^<script\b([^>]*)>/i)?.[1]||"",pt=Se.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),tt=!pt||["module","text/javascript","application/javascript"].includes(pt),It=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${Se}`);if(!/\bserver\b/i.test(Se)&&tt&&!It)return it.push(ze),"";return ze}),{extractSlotContent:At}=await o("stx/slots",()=>import("./chunk-4nc8vdef.js")),St=At(ot),at={};if(St.defaultSlot?.trim())at.default=St.defaultSlot;for(let[ge,ve]of St.namedSlots)at[ge]=ve.content;let $t=a.__stx_scope_seq??={n:0,key:po(String(a.__filename??l))},Ve=Ka(e,process.cwd()),ut=`stx_${(Ve.endsWith(".stx")?Ve.slice(0,-4):Ve).replace(/[^a-zA-Z0-9]/g,"_")}_${++$t.n}_${$t.key}`,De={...pe,$uid:ut,$native:u._nativeHostAttrs===!0,...n,props:n,slot:ot,$slots:at,__processedComponents:V,__sections:{},__stx_signals_gate:Me(ce)||El(r),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...we],__stx_caller_client_bindings:[...Array.isArray(a.__stx_caller_client_bindings)?a.__stx_caller_client_bindings:[],...We]};if(/import\s/.test(ce)){De.__importedComponents=new Map(De.__importedComponents);let{processESImports:ge}=await o("stx/component-renderer",()=>import("./chunk-20zx1msx.js"));ce=await ge(ce,De,U,u,v)}zp(ce,De,n);let Mt=ce,Dt=B(Mt);if(Dt)Mt=Dt.content.trim();let Bs=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,mn=[...ce.matchAll(Bs)];for(let[,ge,ve]of mn)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(ge))Ke(ve,U,u.strict);let xt=[],hn=null,Nt=mn.some((ge)=>/\bserver\b/.test(ge[1]||"")&&/\bcache\b/.test(ge[1]||"")),en=null,xn=null,bn=null,Xn=0,yn=null;if(Pp(u),Nt&&Vr>0){let ge=Mp({props:n,slot:Ae,slotContext:r.trim()?Dp(pe):void 0,buildMode:u.buildMode??"",skipEventDirectives:u.skipEventDirectives===!0,native:u._nativeHostAttrs===!0,clientLoopNames:[...S].sort(),layers:u._layerGraph?.layers.map((ve)=>ve.configFile),uid:ut});if(ge!==null){en=`${U}\x00${E(ce)}\x00${ge}`;let ve=Ns.get(en);if(ve){for(let ze of ve.dependencies)v.add(ze);if(Zi(a,ve.clientFactories),$t.n+=ve.uidsConsumed,ve.preservedClientExpressions.length>0){let ze=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let Se of ve.preservedClientExpressions)ze.add(Se);a.__stx_preserved_client_expressions=[...ze]}return ve.output}xn=new Set(v),bn=Ti(a),Xn=$t.n,yn=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Tt=new Set;for(let ge of mn){let ve=ge[1]||"",ze=ge[2]||"",Se=ve.includes("server");if(Ye(ve)&&ze.trim())ze=Ze(ze);if(Se&&ze){for(let tt of ye(ze))Tt.add(tt);try{await L(ze,De,U,{onFailure:(tt)=>{if(tt.kind!=="unknown")hn=tt.kind}})}catch(tt){}}if(!Se){let tt=ze.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),It=tt.includes("{{")&&tt.includes("}}"),nn=tt.includes("{!!")&&tt.includes("!!}");if(It||nn)tt=Xi(tt,De,U);let Pt=ve.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");xt.push(`<script${Pt}>${tt}</script>`)}}let jt=se(ce).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),_n=jt?jt[1]:"",ue=jt?jt[2]:"",de="",$e=_n&&/\bscoped\b/i.test(_n);if(jt)de=`<style${_n}>${Wp(ue,De,U)}</style>`;let Te=Mt;if(Te=Te.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),jt)Te=Te.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let ge=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ve=[];if(Te=Te.replace(ge,(ze,Se)=>{let pt=Se.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(pt)ve.push(`<style${pt[1]}>${pt[2]}</style>`);return""}),Te=Te.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ve.length>0)de=`${de}${ve.join(`
|
|
1187
|
-
`)}`}if(r&&Te.includes("{{ text || slot }}"))Te=Te.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>r);let{applySlots:st}=await o("stx/slots",()=>import("./chunk-
|
|
1188
|
-
`)),En=(Array.isArray(De.__stx_client_declared_names)?De.__stx_client_declared_names:[]).filter((ge)=>!Tt.has(ge)&&!(ge in n));if(Sn.size>0||En.length>0)De.__stx_client_declared_names=[...new Set([...En,...Sn])];else delete De.__stx_client_declared_names;let zt=S.filter((ge)=>!Tt.has(ge)&&!(ge in n));if(zt.length>0)De[vs]=zt;let Qn={...u,_rootComponentsDir:u._rootComponentsDir||u.componentsDir,componentsDir:xe.dirname(U),skipSignalsRuntime:!0,skipEventDirectives:u._nativeHostAttrs===!0||Lt||xt.length===0,defaultLayout:void 0};De.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:es}=await o("stx/process",()=>import("./chunk-
|
|
1186
|
+
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${u}${f}`)}function Fa(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var Fp=new Set(["for","if","show","key","ref","class","className","style"]),Va=new Set,Za="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",Tl=new RegExp(`\\b(?:${Za})\\s*(?:<[^>]*>)?\\s*\\(`);function qi(e){let n=new Set,r=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|${Za})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let i of e){let a;while((a=r.exec(i))!==null)n.add(a[1]);r.lastIndex=0}return[...n]}async function Qe(e,n,r,i,a,l,u,f=new Set,v,S=mt(a),I,j=e){let{extractVariables:L}=await o("stx/variable-extractor",()=>import("./chunk-amye7vb0.js")),M=f??new Set;if(M.has(e))return`[Circular component reference: ${e}]`;let V=new Set(M);V.add(e);let W=typeof n.client==="string"?n.client.trim():"";if("client"in n)delete n.client;let Z=W&&W!=="load"&&Gg(W)?W:"";try{let q=(ge)=>ge.split("-").map((ve)=>ve.charAt(0).toUpperCase()+ve.slice(1)).join(""),X=j.endsWith(".stx")?j.slice(0,-4):j,U=null,H=a.__importedComponents;if(H){let ge=[X,X.toLowerCase(),q(X),J(X)];for(let ve of ge)if(H.has(ve)){U=H.get(ve);break}}let re=[];if(!U){let ge=[`${X}.stx`,`${q(X)}.stx`,`${J(X)}.stx`],ve=[...new Set(ge)],ze=a.__originalFilePath,Se=[];for(let Pe of ps(l))if(!Se.includes(Pe))Se.push(Pe);let pt=Se.length;for(let Pe of u._layerComponentDirs??[])if(!Se.includes(Pe))Se.push(Pe);if(ze){let Pe=xe.join(xe.dirname(ze),"components");Se.push(Pe)}let tt=u._rootComponentsDir;if(typeof tt==="string"&&qa(i,u)&&!Se.includes(tt))Se.push(tt);if(i&&!Se.includes(i))Se.push(i);if(typeof tt==="string"&&!Se.includes(tt))Se.push(tt);let It=xe.join(xe.dirname(l),"components");if(!Se.includes(It))Se.push(It);if(u.componentsDir&&u.componentsDir!==i&&!Se.includes(u.componentsDir))Se.push(u.componentsDir);for(let Pe of u.additionalComponentsDirs??[])if(Pe&&!Se.includes(Pe))Se.push(Pe);let nn=u._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(X),Pt=(I?.events??[]).map((Pe)=>Pe.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),ts=Object.hasOwn(n,"checked")||Boolean(I?.reactiveProps?.includes("checked")),Ws=Object.hasOwn(n,"value")||Boolean(I?.reactiveProps?.includes("value")),Fs=!Pt.includes("valuechange")&&(ts||Pt.includes("change")&&!Ws),Ft=u._nativeHostAttrs&&/^textinput$/i.test(X),sn=Pt.includes("update:value")&&!Pt.includes("input"),kn=u._nativeHostAttrs&&/^video$/i.test(X),Vs=u._nativeHostAttrs&&/^image$/i.test(X),ns=eo([...Object.keys(n),...I?.reactiveProps??[]],I?.events,n),rn=Object.hasOwn(n,"src")||Boolean(I?.reactiveProps?.includes("src")),ss=Object.hasOwn(n,"source")||Boolean(I?.reactiveProps?.includes("source")),rs=kn&&(rn||ss)&&(I?.events??[]).every((Pe)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(Pe.replace(/^@/,"").split(".")[0])),is=new Set(["","primary","secondary","outline","ghost","danger"]),os=typeof n.variant==="string"?n.variant.trim().toLowerCase():"",as=u._nativeHostAttrs&&/^button$/i.test(X)&&!is.has(os),ei=u._targetComponentFallbackNames?.some((Pe)=>Pe.toLowerCase()===X.toLowerCase())??!1,Us=ei&&(!nn||Fs)&&(!Ft||sn)&&(!kn||rs)&&(!Vs||ns)&&!as;for(let Pe of Us?[]:u._targetComponentDirs??[])if(Pe&&!Se.includes(Pe))Se.push(Pe);let on=typeof u.root==="string"?xe.resolve(u.root):void 0,ti=on??xe.dirname(l),an=[];if(on)an.push(xe.resolve(on,"resources/views/components")),an.push(xe.resolve(on,"resources/components")),an.push(xe.resolve(on,"src/components")),an.push(xe.resolve(on,"components"));an.push(xe.resolve(import.meta.dir,"components"));for(let Pe of an)if(!Se.includes(Pe))Se.push(Pe);if(ei){let Pe=(u._componentPackageDirs??[]).filter((bt)=>typeof bt==="string"&&bt.length>0),Ot=(Us?Pe.length?Pe:u._pluginComponentDirs??[]:u._targetComponentDirs??[]).filter((bt)=>typeof bt==="string"&&bt.length>0);if(Ot.length){let bt=Se.slice(pt).map((dt)=>xe.isAbsolute(dt)?dt:xe.resolve(ti,dt)).filter((dt)=>!Ot.includes(dt)),ls=`${X}\x00${bt.join("\x00")}`,Ct=Or.get(ls);if(Ct===void 0){Ct=!1;for(let dt of bt){for(let Ht of ve)if(await s(xe.join(dt,Ht))){Ct=!0;break}if(Ct)break}Or.set(ls,Ct)}if(!Ct){for(let dt of Ot){let Ht=Se.indexOf(dt);if(Ht>=0)Se.splice(Ht,1)}Se.splice(pt,0,...Ot)}}}let ni=u._pluginComponentDirs;if(Array.isArray(ni)){for(let Pe of ni)if(typeof Pe==="string"&&!Se.includes(Pe))Se.push(Pe)}if(u.fallbackComponentsDir&&!Se.includes(u.fallbackComponentsDir))Se.push(u.fallbackComponentsDir);if(Us){for(let Pe of u._targetComponentDirs??[])if(Pe&&!Se.includes(Pe))Se.push(Pe)}let cs=u._nativePrimitivesFallback;if(cs&&!cs.except.some((Pe)=>Pe.toLowerCase()===X.toLowerCase())&&!Se.includes(cs.dir))Se.push(cs.dir);let si=[...new Set(Se.map((Pe)=>{if(!Pe)return Pe;return xe.isAbsolute(Pe)?Pe:xe.resolve(ti,Pe)}))];Se.length=0,Se.push(...si);let Hs=`${X}\x00${l}\x00${si.join("\x00")}`,Ks=Ds.get(Hs);if(Ks)if(await s(Ks))U=Ks;else Ds.delete(Hs);if(!U&&(X.startsWith("./")||X.startsWith("../")))U=xe.resolve(xe.dirname(l),`${X}.stx`),re.push(U);else if(!U)for(let Pe of Se){if(!Pe)continue;for(let Ot of ve){let bt=xe.join(Pe,Ot);if(re.push(bt),await s(bt)){U=bt;break}}if(U)break;if(!U)try{let Ot=await import("fs");if(!Ot.statSync(Pe,{throwIfNoEntry:!1})?.isDirectory())continue;let ls=8,Ct=[{path:Pe,depth:0}];while(Ct.length>0&&!U){let dt=Ct.pop();if(dt.depth>=ls)continue;let Ht;try{Ht=Ot.readdirSync(dt.path,{withFileTypes:!0})}catch{continue}for(let us of Ht){if(!us.isDirectory())continue;if(us.name==="node_modules"||us.name.startsWith("."))continue;let ri=xe.join(dt.path,us.name);for(let cc of ve){let qs=xe.join(ri,cc);if(re.push(qs),await s(qs)){U=qs;break}}if(U)break;Ct.push({path:ri,depth:dt.depth+1})}}}catch{}if(U)break}if(U)Ds.set(Hs,U)}if(!U||!await s(U))return Wa(e,l,re),Fa(e);v.add(U);let ce;if(Zn.has(U)&&Ir.get(U)===Da(U))ce=Zn.get(U);else try{let ge=Da(U);ce=await Bun.file(U).text(),Zn.set(U,ce),Ir.set(U,ge)}catch(ge){let ve=ge instanceof Error?ge.message:String(ge);return Wa(e,l,[U],ve),Fa(e)}if(I)for(let ge of new Set([...Object.keys(n),...I.reactiveProps??[]])){let ve=ge.toLowerCase();if(ve.startsWith("aria-")||ve.startsWith("data-"))continue;let ze=ge.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${ze}\\b`).test(ce))I.declaredProps.add(ge);if(new RegExp(`\\$props\\s*(?:\\.\\s*${ze}\\b|\\[\\s*['"]${ze}['"]\\s*\\])`).test(ce)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${ze}['"]`).test(ce))I.consumedProps?.add(ge)}if(I?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(ce))for(let ge of I.reactiveProps){if(Fp.has(ge)||I.consumedProps?.has(ge))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${ge.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(ce))continue;let ve=`${U}\x00${ge}`;if(Va.has(ve))continue;Va.add(ve),console.warn(`[stx] ${xe.basename(U)} reads \`${ge}\` with defineProps(), which is not live, but ${xe.basename(l)} binds it (:${ge}): 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('${ge}').`)}let le=new Set(["__originalFilePath","__importedComponents",hs,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),pe={};for(let[ge,ve]of Object.entries(a))if(!ge.startsWith("__")||le.has(ge))pe[ge]=ve;let Re=S.length>0?{[vs]:[...S]}:{},Ae=r;if(r.includes("@include")){let{processIncludes:ge}=await o("stx/includes",()=>import("./chunk-kt3f4rpy.js"));Ae=await ge(r,a,l,u,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ae)){let{processComponents:ge}=await o("stx/component-renderer",()=>import("./chunk-s91tcznf.js")),ve={...a,__processedComponents:M,...Re};Ae=await ge(Ae,ve,l,u,v);let ze=ve.__stx_preserved_client_expressions;if(Array.isArray(ze)&&ze.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...ze])]}let we=[];if(El(Ae)){let{processExpressions:ge}=await o("stx/expressions",()=>import("./chunk-4jmztn9d.js")),ve=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...Re}:S.length>0?{...a,...Re}:a;Ae=ge(Ae,ve,l);for(let ze of Ae.matchAll(/\{\{([\s\S]*?)\}\}/g))we.push(ze[1].trim())}let fe=new Set(Array.isArray(a.__stx_client_declared_names)?a.__stx_client_declared_names:[]),We=[];if(fe.size>0&&Ae)for(let ge of Ae.matchAll(/<[A-Z][\w.-]*\b([^>]*)>/g))for(let ve of ge[1].matchAll(/\s(?:v-model(?::[\w-]+)?|:[\w-]+)\s*=\s*"([^"]*)"/g)){let ze=ve[1].trim();try{if(ze&&Ee(ze).some((Se)=>fe.has(Se)))We.push(ze)}catch{}}let Fe=se(Ae),it=[],ot=Fe.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(ge,ve)=>{let ze=Fe.scripts[Number(ve)]||"",Se=ze.match(/^<script\b([^>]*)>/i)?.[1]||"",pt=Se.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),tt=!pt||["module","text/javascript","application/javascript"].includes(pt),It=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${Se}`);if(!/\bserver\b/i.test(Se)&&tt&&!It)return it.push(ze),"";return ze}),{extractSlotContent:At}=await o("stx/slots",()=>import("./chunk-p2b90rz9.js")),St=At(ot),at={};if(St.defaultSlot?.trim())at.default=St.defaultSlot;for(let[ge,ve]of St.namedSlots)at[ge]=ve.content;let $t=a.__stx_scope_seq??={n:0,key:po(String(a.__filename??l))},Ve=Ka(e,process.cwd()),ut=`stx_${(Ve.endsWith(".stx")?Ve.slice(0,-4):Ve).replace(/[^a-zA-Z0-9]/g,"_")}_${++$t.n}_${$t.key}`,De={...pe,$uid:ut,$native:u._nativeHostAttrs===!0,...n,props:n,slot:ot,$slots:at,__processedComponents:V,__sections:{},__stx_signals_gate:Me(ce)||El(r),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...we],__stx_caller_client_bindings:[...Array.isArray(a.__stx_caller_client_bindings)?a.__stx_caller_client_bindings:[],...We]};if(/import\s/.test(ce)){De.__importedComponents=new Map(De.__importedComponents);let{processESImports:ge}=await o("stx/component-renderer",()=>import("./chunk-s91tcznf.js"));ce=await ge(ce,De,U,u,v)}zp(ce,De,n);let Mt=ce,Dt=B(Mt);if(Dt)Mt=Dt.content.trim();let Bs=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,mn=[...ce.matchAll(Bs)];for(let[,ge,ve]of mn)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(ge))Ke(ve,U,u.strict);let xt=[],hn=null,Nt=mn.some((ge)=>/\bserver\b/.test(ge[1]||"")&&/\bcache\b/.test(ge[1]||"")),en=null,xn=null,bn=null,Xn=0,yn=null;if(Pp(u),Nt&&Vr>0){let ge=Mp({props:n,slot:Ae,slotContext:r.trim()?Dp(pe):void 0,buildMode:u.buildMode??"",skipEventDirectives:u.skipEventDirectives===!0,native:u._nativeHostAttrs===!0,clientLoopNames:[...S].sort(),layers:u._layerGraph?.layers.map((ve)=>ve.configFile),uid:ut});if(ge!==null){en=`${U}\x00${E(ce)}\x00${ge}`;let ve=Ns.get(en);if(ve){for(let ze of ve.dependencies)v.add(ze);if(Zi(a,ve.clientFactories),$t.n+=ve.uidsConsumed,ve.preservedClientExpressions.length>0){let ze=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let Se of ve.preservedClientExpressions)ze.add(Se);a.__stx_preserved_client_expressions=[...ze]}return ve.output}xn=new Set(v),bn=Ti(a),Xn=$t.n,yn=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Tt=new Set;for(let ge of mn){let ve=ge[1]||"",ze=ge[2]||"",Se=ve.includes("server");if(Ye(ve)&&ze.trim())ze=Ze(ze);if(Se&&ze){for(let tt of ye(ze))Tt.add(tt);try{await L(ze,De,U,{onFailure:(tt)=>{if(tt.kind!=="unknown")hn=tt.kind}})}catch(tt){}}if(!Se){let tt=ze.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),It=tt.includes("{{")&&tt.includes("}}"),nn=tt.includes("{!!")&&tt.includes("!!}");if(It||nn)tt=Xi(tt,De,U);let Pt=ve.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");xt.push(`<script${Pt}>${tt}</script>`)}}let jt=se(ce).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),_n=jt?jt[1]:"",ue=jt?jt[2]:"",de="",$e=_n&&/\bscoped\b/i.test(_n);if(jt)de=`<style${_n}>${Wp(ue,De,U)}</style>`;let Te=Mt;if(Te=Te.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),jt)Te=Te.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let ge=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ve=[];if(Te=Te.replace(ge,(ze,Se)=>{let pt=Se.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(pt)ve.push(`<style${pt[1]}>${pt[2]}</style>`);return""}),Te=Te.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ve.length>0)de=`${de}${ve.join(`
|
|
1187
|
+
`)}`}if(r&&Te.includes("{{ text || slot }}"))Te=Te.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>r);let{applySlots:st}=await o("stx/slots",()=>import("./chunk-p2b90rz9.js")),{defaultSlot:ct,namedSlots:tn}=St,Qr=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(ot),Lt=xt.length>0&&gr(Te)||u._nativeHostAttrs===!0&&xt.length>0||Qr&&xt.length>0||xt.some((ge)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(ge)),Gn=(ge)=>Lt?Zo(ge,ut):ge,Yn=new Map([...tn].map(([ge,ve])=>[ge,{...ve,content:Gn(ve.content)}]));Te=await st(Te,Lt?qo(Gn(ct),ut):ct,Yn,De,Lt?ut:"");let wn=qi(xt),vn=(Array.isArray(De.__stx_client_signal_names)?De.__stx_client_signal_names:[]).filter((ge)=>!Tt.has(ge));if(wn.length>0||vn.length>0)De.__stx_client_signal_names=[...new Set([...vn,...wn])];else delete De.__stx_client_signal_names;let Sn=io(xt.join(`
|
|
1188
|
+
`)),En=(Array.isArray(De.__stx_client_declared_names)?De.__stx_client_declared_names:[]).filter((ge)=>!Tt.has(ge)&&!(ge in n));if(Sn.size>0||En.length>0)De.__stx_client_declared_names=[...new Set([...En,...Sn])];else delete De.__stx_client_declared_names;let zt=S.filter((ge)=>!Tt.has(ge)&&!(ge in n));if(zt.length>0)De[vs]=zt;let Qn={...u,_rootComponentsDir:u._rootComponentsDir||u.componentsDir,componentsDir:xe.dirname(U),skipSignalsRuntime:!0,skipEventDirectives:u._nativeHostAttrs===!0||Lt||xt.length===0,defaultLayout:void 0};De.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:es}=await o("stx/process",()=>import("./chunk-cssvev8r.js")),Be=await es(Te,De,U,Qn,v),Et=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let ge of Be.matchAll(/\{\{([\s\S]*?)\}\}/g))Et.add(ge[1].trim());if(Et.size>0)a.__stx_preserved_client_expressions=[...Et];let Bt=ut,ft=Be;if(Lt){let ge="";if(Object.keys(n).length>0)try{ge=` data-stx-props="${Ar(JSON.stringify(n))}"`}catch{}let ve=Z?` stx-hydrate="${Ar(Z)}"`:"",ze=Object.fromEntries(Object.entries(at).map(([Ft,sn])=>[Ft,Boolean(sn)])),Se=Object.keys(ze).length>0?` data-stx-slots="${Ar(JSON.stringify(ze))}"`:"",pt=` data-stx-scope="${Bt}"${ge}${Se}${ve}`,tt=Be.slice(Vt(Be)),It=/^<span(?=[\s/>])/i.test(tt),nn=/^<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(tt),Pt=/^<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(tt),ts=It?"span":"div",Ws=nn&&u._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':Pt&&u._nativeHostAttrs?' style="width:100%;height:100%"':It||nn?' style="display:contents"':"";ft=Xg(Be,pt)??`<${ts}${pt} data-stx-component-wrapper${Ws}>${Be}</${ts}>`;let Fs=await Promise.all(xt.map(async(Ft)=>{let sn=Ft.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!sn)return Ft;let[,kn,Vs]=sn,ns=Ma(Ft,De,U);if(ns!==null)return ns;let rn=await Up(Vs,U,u.buildMode==="compile"),ss=In(rn.clientCode,Ge(De)),{vendorStyleTags:rs}=rn,is=ss?`function(__scopeId) {
|
|
1189
1189
|
${ss}
|
|
1190
1190
|
return (${rn.factoryBody})(__scopeId);
|
|
1191
1191
|
}`:rn.factoryBody,os=Z?null:ar(a,is),as=os?`window.__stxComponentFactories[${JSON.stringify(os)}](${JSON.stringify(Bt)});`:`(${is})(${JSON.stringify(Bt)});`;if(Z)return`${rs}<script type="stx/island" data-stx-island="${Bt}" data-stx-scoped data-stx-owner="${Bt}"${kn}>${me(as)}</script>`;return`${rs}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Bt}"${kn}>${me(as)}</script>`}));if(ft=ft+`
|
|
@@ -1211,7 +1211,7 @@ ${He.yellow}${He.bold}Message:${He.reset} ${n}
|
|
|
1211
1211
|
`,f)I+=`
|
|
1212
1212
|
${He.blue}${He.bold}Context:${He.reset}
|
|
1213
1213
|
${He.dim}${f}${He.reset}
|
|
1214
|
-
`;return I}function Ce(){Zn.clear(),Ir.clear(),Ds.clear(),Or.clear(),Pr.clear(),Wr.clear(),Ns.clear()}function Iy(){return{size:Zn.size,maxSize:500}}var Tr=k(128);async function Up(e,n,r){let i=E(e,n,r),a=Tr.get(i);if(a){if(to(a.deps))return a;Tr.delete(i)}let l=Vi(e,{filePath:n,projectRoot:process.cwd()}),u=l.code,f=Wi(l.styles);u=Gt(u).code;let{hasUserImports:v,bundleClientScript:S}=await o("stx/client-script-bundler",()=>import("./chunk-
|
|
1214
|
+
`;return I}function Ce(){Zn.clear(),Ir.clear(),Ds.clear(),Or.clear(),Pr.clear(),Wr.clear(),Ns.clear()}function Iy(){return{size:Zn.size,maxSize:500}}var Tr=k(128);async function Up(e,n,r){let i=E(e,n,r),a=Tr.get(i);if(a){if(to(a.deps))return a;Tr.delete(i)}let l=Vi(e,{filePath:n,projectRoot:process.cwd()}),u=l.code,f=Wi(l.styles);u=Gt(u).code;let{hasUserImports:v,bundleClientScript:S}=await o("stx/client-script-bundler",()=>import("./chunk-pb2mztar.js")),I=[],j=!1;if(v(u)){let X=u;u=await S(X,n,{projectRoot:process.cwd(),minify:r,collectInputs:I}),j=u===X}let{stripStxRuntimeImports:L}=await o("stx/signal-processing",()=>import("./chunk-zk6qmkhb.js"));u=L(u);let M=D(u),V=Lp(M),W=new Set(G(M,!0).split(",").map((X)=>X.trim())),Z=`function(__scopeId) {
|
|
1215
1215
|
${vt("const",[...Ul,...V],M)}
|
|
1216
1216
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
1217
1217
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Xl,Gl,Jl}from"./chunk-4b110x6r.js";import{xe,ir,ar,Vo,hs,ys,cr,lr,Wo,bs}from"./chunk-kmy34he2.js";function z(e,o,l,r,d,y){let s=!0,u=new Set,f=(p)=>r.get?r.get(p):p,a=()=>f(e());return Object.defineProperty(a,"_isSignal",{value:!0}),Object.defineProperty(a,"modifiers",{get:o}),a.set=(p)=>{if(!s)return;let h=o(),t=r.set?r.set(p,h):p;if(h.trim&&typeof t==="string")t=t.trim();if(h.number&&typeof t==="string"&&t!==""){let i=Number(t);if(!Number.isNaN(i))t=i}if(Object.is(e(),t))return;e.set(t),l(t)},a.update=(p)=>a.set(p(a())),a.input=(p)=>{if(!o().lazy)a.set(p)},a.change=(p)=>{if(o().lazy)a.set(p)},a.subscribe=(p)=>{if(!s)return()=>{};let h=e.subscribe((t,i)=>p(f(t),f(i)));return u.add(h),()=>{h(),u.delete(h)}},Object.defineProperty(a,"value",{get:a,set:a.set}),d(()=>{s=!1,u.forEach((p)=>p()),u.clear()}),y?.(()=>{s=!0}),a}function X(e,o=!0,l){if(!o||!e||typeof window>"u")return;let r=window;if(!r.__STX_DATA__){let y=document.querySelector("script[data-stx-server-data]");try{let s=JSON.parse(y?.textContent||"{}");r.__STX_DATA__=s&&typeof s==="object"&&!Array.isArray(s)?s:{}}catch{r.__STX_DATA__={}}}let d=r.__STX_DATA__;if(d&&Object.prototype.hasOwnProperty.call(d,e))try{return{data:l?l(d[e]):d[e]}}catch(y){return{data:null,error:y instanceof Error?y:Error(String(y))}}return}function Q(e){if(typeof window>"u")return;let o=window;if(e===void 0)o.__STX_DATA__={};else{if(!o.__STX_DATA__)try{let l=JSON.parse(document.querySelector("script[data-stx-server-data]")?.textContent||"{}");o.__STX_DATA__=l&&typeof l==="object"&&!Array.isArray(l)?l:{}}catch{o.__STX_DATA__={}}if(o.__STX_DATA__)delete o.__STX_DATA__[e]}}function Y(e){let o=null;try{o=typeof indexedDB<"u"?indexedDB:null}catch{o=null}if(!o)return null;let l=o,r=e||"stx-kept",d=null,y=()=>{if(!d)d=new Promise((u,f)=>{let a=l.open(r,1);a.onupgradeneeded=()=>{a.result.createObjectStore("kv")},a.onsuccess=()=>u(a.result),a.onerror=()=>f(a.error),a.onblocked=()=>f(Error("blocked"))}),d.catch(()=>{d=null});return d},s=(u,f)=>y().then((a)=>new Promise((p,h)=>{let t=a.transaction("kv",u),i=f(t.objectStore("kv"));t.oncomplete=()=>p(i?i.result:void 0),t.onerror=()=>h(t.error),t.onabort=()=>h(t.error)}));return{get:(u)=>s("readonly",(f)=>f.get(u)),set:(u,f)=>s("readwrite",(a)=>{a.put(f,u)}),remove:(u)=>s("readwrite",(f)=>{f.delete(u)}),removePrefix:(u)=>s("readwrite",(f)=>{f.delete(IDBKeyRange.bound(u,`${u}\uFFFF`))})}}function J(e,o){let l=e||{},r=null;if(l.storage!==void 0)r=l.storage;else try{r=typeof localStorage<"u"?localStorage:null}catch{r=null}let d=null,y=l.backend!==void 0;if(y)d=l.backend||null;let s=()=>{if(y)return d;y=!0;try{d=o?o():null}catch{d=null}if(d){let n=d;n.get("__stx_probe__").catch(()=>{if(d===n)d=null})}return d},u=l.limit||32768,f=l.defer||((n)=>{let c=typeof requestIdleCallback==="function"?requestIdleCallback:null;if(c)c(n,{timeout:200});else setTimeout(n,16)}),a=new Map,p=new Set,h=new Map,t=!1,i=Promise.resolve(),g=(n)=>{try{return JSON.parse(n)}catch{return n}},m=(n,c)=>{if(!r)return!1;try{return r.setItem(n,c),!0}catch{return!1}},_=(n)=>{try{if(r)r.removeItem(n)}catch{}},k=()=>{if(t=!1,!h.size)return i;let n=Array.from(h.entries());return h.clear(),i=i.then(()=>Promise.all(n.map(([c,v])=>{if(!d){p.delete(c);try{m(c,JSON.stringify(v===void 0?null:v))}catch{}return}let x;try{return x={v},d.set(c,x).catch(()=>{let S;try{S=JSON.stringify(v)}catch{return}return d?d.set(c,{j:S}).catch(()=>{m(c,S)}):void 0})}catch{return}}))).then(()=>{}),i},N=(n,c)=>{if(h.set(n,c),p.add(n),t)return;t=!0,f(()=>{k()})},P=(n)=>{if(!n||typeof n!=="object")return;let c=n;if("v"in c)return{value:c.v};if(typeof c.j==="string")return{value:g(c.j)};return},E={peek(n){if(a.has(n))return{value:a.get(n)};let c=null;try{c=r?r.getItem(n):null}catch{c=null}if(c===null||c===void 0)return;let v=g(c);return a.set(n,v),{value:v}},load(n){let c=E.peek(n),v=c?null:s();if(c||!v)return Promise.resolve(c);return v.get(n).then((x)=>{if(a.has(n))return{value:a.get(n)};let S=P(x);if(S)a.set(n,S.value),p.add(n);return S},()=>{return})},set(n,c){if(a.set(n,c),d&&p.has(n)){N(n,c);return}let v;try{v=JSON.stringify(c===void 0?null:c)}catch{return}if(v.length<=u&&m(n,v))return;if(!s()){if(v.length>u)m(n,v);return}_(n),N(n,c)},forget(n){for(let v of Array.from(a.keys()))if(v.indexOf(n)===0)a.delete(v);for(let v of Array.from(h.keys()))if(v.indexOf(n)===0)h.delete(v);for(let v of Array.from(p))if(v.indexOf(n)===0)p.delete(v);try{if(r)for(let v=r.length-1;v>=0;v--){let x=r.key(v);if(x&&x.indexOf(n)===0)r.removeItem(x)}}catch{}let c=s();if(!c)return i;return i=i.then(()=>c.removePrefix(n)).catch(()=>{}),i},flush(){return k()}};try{if(typeof document<"u"&&document.addEventListener)document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden")k()});if(typeof addEventListener==="function")addEventListener("pagehide",()=>{k()})}catch{}return E}function Z(e,o){if(!e)return!1;if(e===o.key)return!0;if(!o.url)return!1;if(e===o.url)return!0;try{let l=typeof location<"u"&&location.origin&&location.origin!=="null"?location.origin:"http://localhost",r=new URL(e,l),d=new URL(o.url,l);if(r.origin!==d.origin||r.pathname!==d.pathname)return!1;return!r.search||r.search===d.search}catch{return!1}}function ee(e){let o=e.prefix||"stx:kept:",l=e.matches||((t,i)=>t===i.key||t===i.url),r=new Set,d=new Map,y,s=(t)=>t===void 0?y:t,u=(t,i)=>{let g=s(i);if(g===!1||g===null||g==="")return null;return`${o}${g===void 0?"":`${g}:`}query:${t}`},f=(t)=>{let i=t&&t.value;if(!i||typeof i!=="object"||!("d"in i))return;return{data:i.d,at:Number(i.at)||0}},a=()=>{let t=globalThis;return t.__stx_outboxes instanceof Map?t.__stx_outboxes:null},p={setScope(t){y=t},scope:()=>y,keyFor:u,seed(t,i){let g=u(t,i);return g?f(e.kept.peek(g)):void 0},restore(t,i){let g=u(t,i);return g?e.kept.load(g).then(f):Promise.resolve(void 0)},persist(t,i,g){let m=u(t,g);if(m)e.kept.set(m,{d:i,at:Date.now()})},overlay(t,i,g){let m=a();if(!m||!m.size)return i;let _=i;return m.forEach((k)=>{try{_=k.overlay(t,_,g)}catch{}}),_},watch(t){return r.add(t),()=>{r.delete(t)}},cachedQuery(t,i){let g=d.get(t);if(g){if(i&&g.__options)g.__options(i);return g}let m=i||{},_=m.initial===void 0?null:m.initial,k=()=>typeof m.scope==="function"?m.scope():m.scope,N=()=>(typeof m.url==="function"?m.url():m.url)||null,P=()=>({key:t,url:N()}),E=k(),n=_,c=0,v=e.sharedRequest(),x=0,S=p.seed(t,E);if(S)n=S.data;let I=e.state(p.overlay(P(),n)),U=e.state(!1),q=e.state(!1),K=e.state(null),M=e.state(S?S.at:0),R=0,j=()=>{I.set(p.overlay(P(),n))},W=(w)=>{let b=R;p.restore(t,w).then((T)=>{if(!T||b!==R||c)return;n=T.data,M.set(T.at),j()})};if(!S)W(E);let _t=()=>{let w=k();if(w===E)return;E=w,R++,x=0,q.set(!1),U.set(!1),c=0;let b=p.seed(t,E);if(n=b?b.data:_,M.set(b?b.at:0),j(),!b)W(E)},xt=(w,b)=>{let T=m.timeoutMs||15000,C=typeof AbortController<"u"?new AbortController:null,O=null,V=new Promise((D,H)=>{O=setTimeout(()=>{if(C)C.abort();H(Error("The request took too long."))},T)}),A;if(m.load)A=m.load({force:w,url:b,signal:C?C.signal:void 0});else if(b){let D=m.fetch||((L,F)=>fetch(L,F)),H={method:"GET",headers:{Accept:"application/json"}};if(w)H.cache="no-cache";if(C)H.signal=C.signal;A=D(b,H).then((L)=>{if(!L.ok)return L.json().catch(()=>null).then((F)=>{throw Error(F&&(F.error||F.message)||`Request failed (${L.status})`)});return L.json()})}else return Promise.resolve(I());return Promise.race([A,V]).then((D)=>{if(O)clearTimeout(O);return m.transform?m.transform(D):D},(D)=>{if(O)clearTimeout(O);throw D})},G=(w)=>{let b=R,T=N(),C=()=>{if(b!==R)return Promise.resolve(I());if(x++,q.set(!0),c===0&&!M())U.set(!0);let V=()=>{if(b!==R)return;if(x=Math.max(0,x-1),!x)q.set(!1),U.set(!1)};return xt(w,T).then((A)=>{if(b!==R||T!==N())return V(),I();return n=A,c=Date.now(),M.set(c),K.set(null),p.persist(t,A,E),j(),V(),I()},(A)=>{if(b===R&&T===N())K.set(A&&A.message?A.message:"Could not load.");return V(),I()})},O=`${b} ${T||""}`;return w?v.fresh(O,C):v.run(O,C)},B={data:I,loading:U,isFetching:q,error:K,updatedAt:M,get key(){return t},load(w){if(_t(),!w&&c&&Date.now()-c<(m.staleTime||0))return Promise.resolve(I());return G(!!w)},refresh(){return B.load(!0)},set(w){n=typeof w==="function"?w(n):w,p.persist(t,n,E),j()},invalidate(){c=0},__options(w){m={...m,...w}}};if(r.add({target:P,updated:()=>{if(c||M())G(!1)},outbox:(w)=>{if(w)n=p.overlay(P(),n,w.id),c=0,G(!0);j()}}),d.set(t,B),m.immediate)B.load();return B}},h=typeof window<"u"?window:typeof addEventListener==="function"?globalThis:null;if(e.listen!==!1&&h&&typeof h.addEventListener==="function")h.addEventListener("stx:updated",(t)=>{let i=t.detail||{};if(i.kind!=="api"||typeof i.url!=="string")return;r.forEach((g)=>{if(l(i.url,g.target()))g.updated()})}),h.addEventListener("stx:outbox",(t)=>{let i=t.detail||{},g=i.sent&&typeof i.sent.id==="string"?i.sent:null;r.forEach((m)=>{if(g){let _=Array.isArray(g.affects)?g.affects:[],k=m.target();if(!_.some((N)=>l(N,k)))return}m.outbox(g)})});return p}function te(e){let o=e&&e.covers||((s,u)=>Object.is(s,u)),l=[],r=[],d=0,y=(s,u)=>{let f;try{f=Promise.resolve(u())}catch(h){f=Promise.reject(h)}let a={key:s,promise:f};l.push(a);let p=()=>{let h=l.indexOf(a);if(h!==-1)l.splice(h,1)};return f.then(p,p),f};return{run(s,u){for(let f of l)if(o(f.key,s))return f.promise;for(let f of r)if(o(f.key,s))return f.promise;return y(s,u)},fresh(s,u){for(let h of r)if(o(h.key,s))return h.promise;let f=l.filter((h)=>o(h.key,s)).map((h)=>h.promise);if(!f.length)return y(s,u);let a={key:s,promise:null},p=()=>{};return a.promise=Promise.all(f.map((h)=>h.then(p,p))).then(()=>{let h=r.indexOf(a);if(h!==-1)r.splice(h,1);return y(s,u)}),r.push(a),a.promise},latest(){let s=++d;return()=>s===d},get busy(){return l.length>0||r.length>0}}}function ne(e){let o=!1,l=null,r=null,d=0;async function y(){if(o)return;l=new AbortController;try{let s=await e.request(e.endpoint,{signal:l.signal,cache:"no-store",headers:{Accept:"text/event-stream"}});if(!s.ok||!s.body||!s.headers.get("content-type")?.includes("text/event-stream"))throw Error("Broadcast stream unavailable");if(o){await s.body.cancel();return}let u=s.body.getReader(),f=new TextDecoder,a="";d=0,e.onStatus?.(!0),e.onConnected?.();try{while(!o){let{done:p,value:h}=await u.read();if(p)break;if(a+=f.decode(h,{stream:!0}).replace(/\r\n/g,`
|
|
2
|
+
import{Xl,Gl,Jl}from"./chunk-4b110x6r.js";import{xe,ir,ar,Vo,hs,ys,cr,lr,Wo,bs}from"./chunk-kmy34he2.js";function z(e,o,l,r,d,y){let s=!0,u=new Set,f=(p)=>r.get?r.get(p):p,a=()=>f(e());return Object.defineProperty(a,"_isSignal",{value:!0}),Object.defineProperty(a,"modifiers",{get:o}),a.set=(p)=>{if(!s)return;let h=o(),t=r.set?r.set(p,h):p;if(h.trim&&typeof t==="string")t=t.trim();if(h.number&&typeof t==="string"&&t!==""){let i=Number(t);if(!Number.isNaN(i))t=i}if(Object.is(e(),t))return;e.set(t),l(t)},a.update=(p)=>a.set(p(a())),a.input=(p)=>{if(!o().lazy)a.set(p)},a.change=(p)=>{if(o().lazy)a.set(p)},a.subscribe=(p)=>{if(!s)return()=>{};let h=e.subscribe((t,i)=>p(f(t),f(i)));return u.add(h),()=>{h(),u.delete(h)}},Object.defineProperty(a,"value",{get:a,set:a.set}),d(()=>{s=!1,u.forEach((p)=>p()),u.clear()}),y?.(()=>{s=!0}),a}function X(e,o=!0,l){if(!o||!e||typeof window>"u")return;let r=window;if(!r.__STX_DATA__){let y=document.querySelector("script[data-stx-server-data]");try{let s=JSON.parse(y?.textContent||"{}");r.__STX_DATA__=s&&typeof s==="object"&&!Array.isArray(s)?s:{}}catch{r.__STX_DATA__={}}}let d=r.__STX_DATA__;if(d&&Object.prototype.hasOwnProperty.call(d,e))try{return{data:l?l(d[e]):d[e]}}catch(y){return{data:null,error:y instanceof Error?y:Error(String(y))}}return}function Q(e){if(typeof window>"u")return;let o=window;if(e===void 0)o.__STX_DATA__={};else{if(!o.__STX_DATA__)try{let l=JSON.parse(document.querySelector("script[data-stx-server-data]")?.textContent||"{}");o.__STX_DATA__=l&&typeof l==="object"&&!Array.isArray(l)?l:{}}catch{o.__STX_DATA__={}}if(o.__STX_DATA__)delete o.__STX_DATA__[e]}}function Y(e){let o=null;try{o=typeof indexedDB<"u"?indexedDB:null}catch{o=null}if(!o)return null;let l=o,r=e||"stx-kept",d=null,y=()=>{if(!d)d=new Promise((u,f)=>{let a=l.open(r,1);a.onupgradeneeded=()=>{a.result.createObjectStore("kv")},a.onsuccess=()=>u(a.result),a.onerror=()=>f(a.error),a.onblocked=()=>f(Error("blocked"))}),d.catch(()=>{d=null});return d},s=(u,f)=>y().then((a)=>new Promise((p,h)=>{let t=a.transaction("kv",u),i=f(t.objectStore("kv"));t.oncomplete=()=>p(i?i.result:void 0),t.onerror=()=>h(t.error),t.onabort=()=>h(t.error)}));return{get:(u)=>s("readonly",(f)=>f.get(u)),set:(u,f)=>s("readwrite",(a)=>{a.put(f,u)}),remove:(u)=>s("readwrite",(f)=>{f.delete(u)}),removePrefix:(u)=>s("readwrite",(f)=>{f.delete(IDBKeyRange.bound(u,`${u}\uFFFF`))})}}function J(e,o){let l=e||{},r=null;if(l.storage!==void 0)r=l.storage;else try{r=typeof localStorage<"u"?localStorage:null}catch{r=null}let d=null,y=l.backend!==void 0;if(y)d=l.backend||null;let s=()=>{if(y)return d;y=!0;try{d=o?o():null}catch{d=null}if(d){let n=d;n.get("__stx_probe__").catch(()=>{if(d===n)d=null})}return d},u=l.limit||32768,f=l.defer||((n)=>{let c=typeof requestIdleCallback==="function"?requestIdleCallback:null;if(c)c(n,{timeout:200});else setTimeout(n,16)}),a=new Map,p=new Set,h=new Map,t=!1,i=Promise.resolve(),g=(n)=>{try{return JSON.parse(n)}catch{return n}},m=(n,c)=>{if(!r)return!1;try{return r.setItem(n,c),!0}catch{return!1}},_=(n)=>{try{if(r)r.removeItem(n)}catch{}},k=()=>{if(t=!1,!h.size)return i;let n=Array.from(h.entries());return h.clear(),i=i.then(()=>Promise.all(n.map(([c,v])=>{if(!d){p.delete(c);try{m(c,JSON.stringify(v===void 0?null:v))}catch{}return}let x;try{return x={v},d.set(c,x).catch(()=>{let S;try{S=JSON.stringify(v)}catch{return}return d?d.set(c,{j:S}).catch(()=>{m(c,S)}):void 0})}catch{return}}))).then(()=>{}),i},N=(n,c)=>{if(h.set(n,c),p.add(n),t)return;t=!0,f(()=>{k()})},P=(n)=>{if(!n||typeof n!=="object")return;let c=n;if("v"in c)return{value:c.v};if(typeof c.j==="string")return{value:g(c.j)};return},E={peek(n){if(a.has(n))return{value:a.get(n)};let c=null;try{c=r?r.getItem(n):null}catch{c=null}if(c===null||c===void 0)return;let v=g(c);return a.set(n,v),{value:v}},load(n){let c=E.peek(n),v=c?null:s();if(c||!v)return Promise.resolve(c);return v.get(n).then((x)=>{if(a.has(n))return{value:a.get(n)};let S=P(x);if(S)a.set(n,S.value),p.add(n);return S},()=>{return})},set(n,c){if(a.set(n,c),d&&p.has(n)){N(n,c);return}let v;try{v=JSON.stringify(c===void 0?null:c)}catch{return}if(v.length<=u&&m(n,v))return;if(!s()){if(v.length>u)m(n,v);return}_(n),N(n,c)},forget(n){for(let v of Array.from(a.keys()))if(v.indexOf(n)===0)a.delete(v);for(let v of Array.from(h.keys()))if(v.indexOf(n)===0)h.delete(v);for(let v of Array.from(p))if(v.indexOf(n)===0)p.delete(v);try{if(r)for(let v=r.length-1;v>=0;v--){let x=r.key(v);if(x&&x.indexOf(n)===0)r.removeItem(x)}}catch{}let c=s();if(!c)return i;return i=i.then(()=>c.removePrefix(n)).catch(()=>{}),i},flush(){return k()}};try{if(typeof document<"u"&&document.addEventListener)document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden")k()});if(typeof addEventListener==="function")addEventListener("pagehide",()=>{k()})}catch{}return E}function Z(e,o){if(!e)return!1;if(e===o.key)return!0;if(!o.url)return!1;if(e===o.url)return!0;try{let l=typeof location<"u"&&location.origin&&location.origin!=="null"?location.origin:"http://localhost",r=new URL(e,l),d=new URL(o.url,l);if(r.origin!==d.origin||r.pathname!==d.pathname)return!1;return!r.search||r.search===d.search}catch{return!1}}function ee(e){let o=e.prefix||"stx:kept:",l=e.matches||((t,i)=>t===i.key||t===i.url),r=new Set,d=new Map,y,s=(t)=>t===void 0?y:t,u=(t,i)=>{let g=s(i);if(g===!1||g===null||g==="")return null;return`${o}${g===void 0?"":`${g}:`}query:${t}`},f=(t)=>{let i=t&&t.value;if(!i||typeof i!=="object"||!("d"in i))return;return{data:i.d,at:Number(i.at)||0}},a=()=>{let t=globalThis;return t.__stx_outboxes instanceof Map?t.__stx_outboxes:null},p={setScope(t){y=t},scope:()=>y,keyFor:u,seed(t,i){let g=u(t,i);return g?f(e.kept.peek(g)):void 0},restore(t,i){let g=u(t,i);return g?e.kept.load(g).then(f):Promise.resolve(void 0)},persist(t,i,g){let m=u(t,g);if(m)e.kept.set(m,{d:i,at:Date.now()})},overlay(t,i,g){let m=a();if(!m||!m.size)return i;let _=i;return m.forEach((k)=>{try{_=k.overlay(t,_,g)}catch{}}),_},watch(t){return r.add(t),()=>{r.delete(t)}},cachedQuery(t,i){let g=d.get(t);if(g){if(i&&g.__options)g.__options(i);return g}let m=i||{},_=m.initial===void 0?null:m.initial,k=()=>typeof m.scope==="function"?m.scope():m.scope,N=()=>(typeof m.url==="function"?m.url():m.url)||null,P=()=>({key:t,url:N()}),E=k(),n=_,c=0,v=e.sharedRequest(),x=0,S=p.seed(t,E);if(S)n=S.data;let C=e.state(p.overlay(P(),n)),U=e.state(!1),q=e.state(!1),K=e.state(null),M=e.state(S?S.at:0),R=0,j=()=>{C.set(p.overlay(P(),n))},W=(w)=>{let b=R;p.restore(t,w).then((T)=>{if(!T||b!==R||c)return;n=T.data,M.set(T.at),j()})};if(!S)W(E);let _t=()=>{let w=k();if(w===E)return;E=w,R++,x=0,q.set(!1),U.set(!1),c=0;let b=p.seed(t,E);if(n=b?b.data:_,M.set(b?b.at:0),j(),!b)W(E)},xt=(w,b)=>{let T=m.timeoutMs||15000,I=typeof AbortController<"u"?new AbortController:null,O=null,V=new Promise((D,H)=>{O=setTimeout(()=>{if(I)I.abort();H(Error("The request took too long."))},T)}),A;if(m.load)A=m.load({force:w,url:b,signal:I?I.signal:void 0});else if(b){let D=m.fetch||((L,F)=>fetch(L,F)),H={method:"GET",headers:{Accept:"application/json"}};if(w)H.cache="no-cache";if(I)H.signal=I.signal;A=D(b,H).then((L)=>{if(!L.ok)return L.json().catch(()=>null).then((F)=>{throw Error(F&&(F.error||F.message)||`Request failed (${L.status})`)});return L.json()})}else return Promise.resolve(C());return Promise.race([A,V]).then((D)=>{if(O)clearTimeout(O);return m.transform?m.transform(D):D},(D)=>{if(O)clearTimeout(O);throw D})},G=(w)=>{let b=R,T=N(),I=()=>{if(b!==R)return Promise.resolve(C());if(x++,q.set(!0),c===0&&!M())U.set(!0);let V=()=>{if(b!==R)return;if(x=Math.max(0,x-1),!x)q.set(!1),U.set(!1)};return xt(w,T).then((A)=>{if(b!==R||T!==N())return V(),C();return n=A,c=Date.now(),M.set(c),K.set(null),p.persist(t,A,E),j(),V(),C()},(A)=>{if(b===R&&T===N())K.set(A&&A.message?A.message:"Could not load.");return V(),C()})},O=`${b} ${T||""}`;return w?v.fresh(O,I):v.run(O,I)},B={data:C,loading:U,isFetching:q,error:K,updatedAt:M,get key(){return t},load(w){if(_t(),!w&&c&&Date.now()-c<(m.staleTime||0))return Promise.resolve(C());return G(!!w)},refresh(){return B.load(!0)},set(w){n=typeof w==="function"?w(n):w,p.persist(t,n,E),j()},invalidate(){c=0},__options(w){m={...m,...w}}};if(r.add({target:P,updated:()=>{if(c||M())G(!1)},outbox:(w)=>{if(w)n=p.overlay(P(),n,w.id),c=0,G(!0);j()}}),d.set(t,B),m.immediate)B.load();return B}},h=typeof window<"u"?window:typeof addEventListener==="function"?globalThis:null;if(e.listen!==!1&&h&&typeof h.addEventListener==="function")h.addEventListener("stx:updated",(t)=>{let i=t.detail||{};if(i.kind!=="api"||typeof i.url!=="string")return;r.forEach((g)=>{if(l(i.url,g.target()))g.updated()})}),h.addEventListener("stx:outbox",(t)=>{let i=t.detail||{},g=i.sent&&typeof i.sent.id==="string"?i.sent:null;r.forEach((m)=>{if(g){let _=Array.isArray(g.affects)?g.affects:[],k=m.target();if(!_.some((N)=>l(N,k)))return}m.outbox(g)})});return p}function te(e){let o=e&&e.covers||((s,u)=>Object.is(s,u)),l=[],r=[],d=0,y=(s,u)=>{let f;try{f=Promise.resolve(u())}catch(h){f=Promise.reject(h)}let a={key:s,promise:f};l.push(a);let p=()=>{let h=l.indexOf(a);if(h!==-1)l.splice(h,1)};return f.then(p,p),f};return{run(s,u){for(let f of l)if(o(f.key,s))return f.promise;for(let f of r)if(o(f.key,s))return f.promise;return y(s,u)},fresh(s,u){for(let h of r)if(o(h.key,s))return h.promise;let f=l.filter((h)=>o(h.key,s)).map((h)=>h.promise);if(!f.length)return y(s,u);let a={key:s,promise:null},p=()=>{};return a.promise=Promise.all(f.map((h)=>h.then(p,p))).then(()=>{let h=r.indexOf(a);if(h!==-1)r.splice(h,1);return y(s,u)}),r.push(a),a.promise},latest(){let s=++d;return()=>s===d},get busy(){return l.length>0||r.length>0}}}function ne(e){let o=!1,l=null,r=null,d=0;async function y(){if(o)return;l=new AbortController;try{let s=await e.request(e.endpoint,{signal:l.signal,cache:"no-store",headers:{Accept:"text/event-stream"}});if(!s.ok||!s.body||!s.headers.get("content-type")?.includes("text/event-stream"))throw Error("Broadcast stream unavailable");if(o){await s.body.cancel();return}let u=s.body.getReader(),f=new TextDecoder,a="";d=0,e.onStatus?.(!0),e.onConnected?.();try{while(!o){let{done:p,value:h}=await u.read();if(p)break;if(a+=f.decode(h,{stream:!0}).replace(/\r\n/g,`
|
|
3
3
|
`),a.length>1048576)throw Error("Broadcast frame too large");let t;while((t=a.indexOf(`
|
|
4
4
|
|
|
5
5
|
`))!==-1){let i=a.slice(0,t);a=a.slice(t+2);let g=i.split(`
|
|
@@ -3972,7 +3972,7 @@ catch (e) {
|
|
|
3972
3972
|
if (tgIsGroup) parent.__stx_tg_init = true;
|
|
3973
3973
|
});
|
|
3974
3974
|
}
|
|
3975
|
-
`;var
|
|
3975
|
+
`;var Ie=` // ==========================================================================
|
|
3976
3976
|
// Native row plans
|
|
3977
3977
|
// ==========================================================================
|
|
3978
3978
|
|
|
@@ -4633,7 +4633,7 @@ catch (e) {
|
|
|
4633
4633
|
var after = row.after.splice(0, row.after.length);
|
|
4634
4634
|
for (var i = 0; i < after.length; i++) after[i]();
|
|
4635
4635
|
}
|
|
4636
|
-
`;var
|
|
4636
|
+
`;var Ce=` // Also expose globally for convenience
|
|
4637
4637
|
window.state = state;
|
|
4638
4638
|
window.derived = derived;
|
|
4639
4639
|
window.memo = memo;
|
|
@@ -6677,6 +6677,11 @@ else if (!value && isInserted) {
|
|
|
6677
6677
|
var next = el.nextElementSibling;
|
|
6678
6678
|
if (next && (getElseAttrInfo(next) || next.tagName === 'SCRIPT')) continue;
|
|
6679
6679
|
if (el.hasAttribute('data-stx-scope') || el.hasAttribute('x-data') || el.querySelector('script')) continue;
|
|
6680
|
+
// An outer loop already emptied this one into a shared branch. It holds
|
|
6681
|
+
// no script now, but only bindIf's own pass fills it: a clone of
|
|
6682
|
+
// template content is bound as it is, and the component stayed an empty
|
|
6683
|
+
// element in every row of the inner loop (stacksjs/stx#2197).
|
|
6684
|
+
if (el.hasAttribute('data-stx-lazy')) continue;
|
|
6680
6685
|
var holder = document.createElement('template');
|
|
6681
6686
|
holder.setAttribute(attr, el.getAttribute(attr));
|
|
6682
6687
|
el.removeAttribute(attr);
|
|
@@ -11853,7 +11858,7 @@ ${qe}
|
|
|
11853
11858
|
${ue}
|
|
11854
11859
|
${Ke}
|
|
11855
11860
|
${Ne}
|
|
11856
|
-
${e.native?
|
|
11861
|
+
${e.native?Ie:""}
|
|
11857
11862
|
${Be}
|
|
11858
11863
|
${he}
|
|
11859
11864
|
${je}
|
|
@@ -11885,7 +11890,7 @@ ${pt}
|
|
|
11885
11890
|
${We}
|
|
11886
11891
|
});
|
|
11887
11892
|
|
|
11888
|
-
${
|
|
11893
|
+
${Ce}
|
|
11889
11894
|
${ye}
|
|
11890
11895
|
${we}
|
|
11891
11896
|
${at}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{vn,ei,ti,ni,iy,ri}from"./chunk-
|
|
2
|
+
import{vn,ei,ti,ni,iy,ri}from"./chunk-ddn98yz4.js";import"./chunk-mpfm5ctr.js";import"./chunk-b234w3mf.js";import"./chunk-w98yt4d4.js";export{ti as buildServerApi,iy as createServerApi,vn as discoverServerApi,ei as generateApiTypes,ri as isServerApiSource,ni as productionApiDispatcher};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Z}from"./chunk-13awnyq0.js";import{yr,He}from"./chunk-cwcmmgvz.js";import{G,k,Mr,to,A}from"./chunk-fds6vvq0.js";import{a,j}from"./chunk-xfjp5q2m.js";import{ri}from"./chunk-p3et6xjr.js";import{gt}from"./chunk-zkwkhesc.js";import{l}from"./chunk-w4177qn3.js";import{t,h}from"./chunk-ahf9j8wb.js";import d from"path";import E from"fs";import{AsyncLocalStorage as lt}from"async_hooks";import{randomUUID as St}from"crypto";var vt=12;function X(e,n,s){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(d.basename(e))||ri(e,n,s)}var ct=2;function Qf(e){let n=process.env.STX_BUNDLE_CACHE_DIR?.trim();return n?d.resolve(n):l(e,"bundle-cache")}function rt(e,n){let s=e;for(let i of Bt(n))if(i!==d.sep)s=s.split(i).join("\x00root");return s}var it=new Map;function Bt(e){let n=d.resolve(e),s=it.get(n);if(!s){let i=n;try{i=E.realpathSync(n)}catch{}s=[...new Set([n,i])].sort((c,p)=>p.length-c.length),it.set(n,s)}return s}function jt(e,n){try{let s=E.statSync(e),i=d.resolve(n),c=e.startsWith(`${i}${d.sep}`);return{path:c?d.relative(i,e):e,...c?{inRoot:!0}:{},mtimeMs:s.mtimeMs,size:s.size,hash:Bun.hash(E.readFileSync(e)).toString(36)}}catch{return null}}function ut(e,n){return e.inRoot?d.join(d.resolve(n),e.path):e.path}function Et(e,n){for(let s of e){let i=ut(s,n);try{let c=E.statSync(i);if(c.size!==s.size)return!1;if(c.mtimeMs!==s.mtimeMs&&Bun.hash(E.readFileSync(i)).toString(36)!==s.hash)return!1}catch{return!1}}return!0}var dt=new Map,_t=100;function eg(e=process.env){let n=Number(e.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(n)&&n>=1?Math.floor(n):2000}var q=new Map;async function Mt(e){let n=q.get(e)??0;if(n>0&&n<_t){q.set(e,n+1);return}q.set(e,1);try{let s=(await E.promises.readdir(e)).filter((o)=>o.endsWith(".js")),i=eg();if(s.length<=i)return;let p=(await Promise.all(s.map(async(o)=>{try{return{name:o,at:(await E.promises.stat(d.join(e,o))).mtimeMs}}catch{return null}}))).filter((o)=>o!==null);p.sort((o,w)=>w.at-o.at);for(let o of p.slice(i)){let w=o.name.slice(0,-3);await E.promises.rm(d.join(e,`${w}.js`),{force:!0}),await E.promises.rm(d.join(e,`${w}.deps.json`),{force:!0})}T("pruned bundle cache to",i,"entries")}catch{}}function $e(e){return dt.get(e)??[]}function Y(e,n){if(e)dt.set(e,n)}function tg(e=process.env){return e.STX_DEBUG==="true"||e.STX_DEBUG==="1"}function T(...e){if(tg())console.log("[stx:bundler]",...e)}var et=[];function Rc(e,n,s){et.push({filePath:e||"<inline>",message:n,details:s})}function mn(){return et.slice()}function hn(){et.length=0}var K;function sy(e){K=e}function Ac(){if(K)return K;try{let e=j.strict;return typeof e==="object"&&e!==null?e.bundlerFallback??"warn":"warn"}catch{return"warn"}}var tt=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function yn(e){let n=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,s;while((s=n.exec(e))!==null){let c=s[1];if(!tt.some((o)=>o.test(c)))return T("detected user import:",c),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((s=i.exec(e))!==null){let c=s[1];if(/\.css(?:\?.*)?$/.test(c))continue;if(!tt.some((o)=>o.test(c)))return T("detected side-effect import:",c),!0}return!1}var hr="stx-module:",Rt=/\.(?:[cm]?[jt]sx?|json)$/i;function ng(e,n){return d.relative(e,n).split(d.sep).join("/")}function rg(e,n){if(n.size===0)return e;return e.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(s,i,c,p)=>{let o=n.get(p);return o&&!p.startsWith(hr)?`${i}${c}${o}${c}`:s})}function sg(e,n){let s=0,i=(p)=>{let o=`__stxMod${s++}`,w=JSON.stringify(p);return n.push(`var ${o} = globalThis.__stxModules && globalThis.__stxModules[${w}];`,`if (${o} === undefined) throw new Error("[stx] module " + ${JSON.stringify(w)} + " is not registered on this page (#1957)");`),o},c=(p,o)=>{for(let w of p.split(",")){let C=w.trim();if(!C)continue;let R=C.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!R)continue;let S=R[1].startsWith('"')?JSON.parse(R[1]):R[1],f=R[2]??S;n.push(`var ${f} = ${o}[${JSON.stringify(S)}];`)}};return e=e.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,o,w)=>{let C=w.slice(hr.length),R=i(C),S=o.trim(),f=S.match(/^([\w$]+)\s*(?:,\s*|$)/);if(f&&!S.startsWith("{")&&!S.startsWith("*"))n.push(`var ${f[1]} = ${R}.default;`),S=S.slice(f[0].length).trim();let v=S.match(/^\*\s*as\s+([\w$]+)$/);if(v)n.push(`var ${v[1]} = ${R};`);else if(S.startsWith("{"))c(S.replace(/^\{|\}$/g,""),R);return""}),e=e.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,o)=>(i(o.slice(hr.length)),"")),e}function ot(e){let n=[e,`${e}.ts`,`${e}.tsx`,`${e}.js`,`${e}.mjs`,`${e}.jsx`,d.join(e,"index.ts"),d.join(e,"index.tsx"),d.join(e,"index.js"),d.join(e,"index.mjs")];for(let s of n)try{if(E.existsSync(s)&&E.statSync(s,{throwIfNoEntry:!1})?.isFile())return s}catch{}return}var H=new lt;function Cs(e,n){let s=new Bun.CryptoHasher("md5");for(let[i,c]of[...e].sort(([p],[o])=>p<o?-1:p>o?1:0))s.update(`${i}\x00${c}\x00`);return H.run({modules:e,key:s.digest("hex").slice(0,12)},n)}var pt=new lt;function og(e){return pt.run(!0,e)}function ig(){return pt.getStore()===!0}function Pc(e){if(!ig())return;throw Error(`The client script of ${e} needs bundling, and it is being rendered inside a Bun.build loader, where Bun never finishes a second build. Make the page an entrypoint of the build (bun-plugin-stx renders entrypoints before the bundler starts), or render it once outside the build so its bundle is cached.`)}function bn(){return H.getStore()?.key??""}function ft(e,n,s,i,c,p,o=new Map,w,C,R){let S=new Map([[s,i],...R??[]]),f=(B)=>B!==void 0&&S.has(B),v=(B,r,u)=>{if(X(r,e,w))return null;if(!p||!f(B)||!Rt.test(r))return null;try{if(!E.statSync(r,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}c.add(r);let _=`${hr}${ng(process.cwd(),r)}`;return o.set(u,_),{path:_,external:!0}},b=(B,r)=>{let u=f(B)?n:d.dirname(B),_=d.resolve(u,r);return ot(_)??_};return{name:"stx-client-bundle",setup(B){if(B.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(r)=>({path:r.path,external:!0})),B.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(r)=>({path:r.path,external:!0})),B.onResolve({filter:/^\//},(r)=>{if(f(r.path))return{path:r.path};let u=ot(r.path);if(u){let _=v(r.importer,u,r.path);if(_)return _;if(!f(u))c.add(u);return{path:u}}return{path:r.path,external:!0}}),B.onResolve({filter:/^\.\.?\//},(r)=>{let u=b(r.importer,r.path),_=v(r.importer,u,r.path);if(_)return _;return c.add(u),{path:u}}),B.onResolve({filter:/^[@~]\//},(r)=>{let u=d.resolve(e,r.path.slice(2)),_=[u,`${u}.ts`,`${u}.tsx`,`${u}.js`,`${u}.mjs`,`${u}.jsx`,d.join(u,"index.ts"),d.join(u,"index.tsx"),d.join(u,"index.js"),d.join(u,"index.mjs")];for(let x of _)if(E.existsSync(x)&&E.statSync(x,{throwIfNoEntry:!1})?.isFile()){let D=v(r.importer,x,r.path);if(D)return D;return T(`resolved ${r.path[0]}/ import:`,r.path,"\u2192",x),c.add(x),{path:x}}return console.warn(`[stx:bundler] could not resolve ${r.path[0]}/ import:`,r.path),{path:u}}),p)B.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(r)=>{if(!f(r.importer))return;let u=`${hr}npm:${r.path}`;return o.set(r.path,u),{path:u,external:!0}});B.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(r)=>{if(S.has(r.path))return{contents:S.get(r.path),loader:"ts"};if(X(r.path,e,w))throw Error(`Server-only API source cannot be imported by a client script: ${r.path}`);let u=d.extname(r.path).toLowerCase(),_=u===".json"?"json":u===".tsx"?"tsx":u===".jsx"?"jsx":u===".ts"||u===".mts"||u===".cts"?"ts":"js";if(!f(r.path))c.add(r.path);let x=C?.get(r.path);if(x!==void 0)return{contents:x,loader:"js"};return{contents:E.readFileSync(r.path,"utf8"),loader:_}})}}}var Q=new Map,V=k(64),at=Symbol.for("stx.client-bundle-build-queue");function ag(e){let n=globalThis,i=(n[at]??Promise.resolve()).then(e,e);return n[at]=i.then(()=>{return},()=>{return}),i}async function wn(e,n,s={}){let i=s.projectRoot||process.cwd(),c=(await a(i)).serverApi,p=s.minify??!1,o=s.externalizeUserModules??!0,w=s.expose?.length?[...new Set(s.expose)].sort():void 0,C=s.cacheDir||Qf(i),R=H.getStore(),S=new Bun.CryptoHasher("md5");S.update(`${vt}\x00${gt()}\x00${JSON.stringify(c??!1)}\x00${o?"registry":"inline"}\x00${w?w.join(","):"*"}\x00${p?"minified":"readable"}\x00${R?.key??""}\x00${rt(e,i)}\x00${rt(n,i)}`);let f=S.digest("hex").slice(0,12),v=d.join(C,`${f}.js`),b=V.get(v);if(b){if(to(b.files)&&b.files.every((x)=>!X(x.path,i,c))){T("memo hit:",f);let x=b.files.map((D)=>D.path);return Y(n,x),s.collectInputs?.push(...x),b.code}V.delete(v),T("memo invalidated by dep change:",f)}let B=d.join(C,`${f}.deps.json`),r=Bun.file(v);if(await r.exists()){let x=Bun.file(B),D=!1,N=null;if(await x.exists())try{let O=JSON.parse(await x.text());if(O.metadataVersion===ct&&Array.isArray(O.files)&&Et(O.files,i))N=Mr(O.files.map((g)=>ut(g,i))),D=N.length===O.files.length&&!N.some((g)=>X(g.path,i,c))}catch{D=!1}if(D){if(T("cache hit:",f),N)Y(n,N.map((L)=>L.path)),s.collectInputs?.push(...N.map((L)=>L.path));let O=await r.text(),g=new Date;if(E.promises.utimes(v,g,g).catch(()=>{}),N)V.set(v,{code:O,files:N});return O}T("cache invalidated by dep change:",f)}let u=Q.get(f);if(u){let x=await u;if(s.collectInputs)s.collectInputs.push(...(V.get(v)?.files??[]).map((D)=>D.path));return x}Pc(n);let _=ag(()=>Ft(e,n,{projectRoot:i,minify:p,cacheDir:C,hash:f,cachePath:v,depsPath:B,collectInputs:s.collectInputs,externalizeUserModules:o,serverApi:c,expose:w,throwOnFailure:s.throwOnFailure,substitutes:R?.modules}));Q.set(f,_);try{return await _}finally{Q.delete(f)}}function Ic(e){return`${e}-${process.pid}-${St()}`}async function oy(e,n){let{projectRoot:s}=n,i=Ic(new Bun.CryptoHasher("md5").update([...e.keys()].join("\x00")).digest("hex").slice(0,12)),c=d.join(l(s,"bundle-tmp"),"out",i);E.mkdirSync(c,{recursive:!0});let p=new Map,o=new Map,w=0;for(let[f,v]of e){let b=d.join(s,`.stx-split-${i}-${w++}.ts`);p.set(b,v),o.set(d.basename(b).replace(/\.ts$/,""),f)}let[C,R]=[...p][0],S=new Set;Pc(n.filePath);try{let f=await Bun.build({entrypoints:[...p.keys()],outdir:c,target:"browser",format:"esm",splitting:!0,minify:!1,naming:{entry:"[name].js",chunk:"chunk-[hash].js"},plugins:[ft(s,d.dirname(n.filePath),C,R,S,!1,new Map,void 0,H.getStore()?.modules,p)],define:{"process.env.NODE_ENV":'"development"',...A()},root:s});if(!f.success)throw Error(f.logs.filter((b)=>b.level==="error").map((b)=>b.message).join(", ")||"Unable to bundle the entries");let v={entries:new Map,chunks:new Map};for(let b of f.outputs){let B=d.basename(b.path);if(b.kind==="entry-point"){let r=o.get(B.replace(/\.js$/,""));if(r!==void 0)v.entries.set(r,await b.text())}else if(b.kind==="chunk")v.chunks.set(B.replace(/\.js$/,""),await b.text())}return n.collectInputs?.push(...S),v}finally{try{E.rmSync(c,{recursive:!0,force:!0})}catch{}}}async function Ft(e,n,s){let{projectRoot:i,minify:c,cacheDir:p,hash:o,cachePath:w,depsPath:C,externalizeUserModules:R}=s,S=l(i,"bundle-tmp"),f=Ic(o),v=d.join(i,`.stx-client-${f}.ts`),b=d.join(S,"out",f);E.mkdirSync(b,{recursive:!0});let B=d.dirname(n),r=new Set,u=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,_=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,x=t(e),{depths:D,balanced:N}=h(x),O=(F)=>!N||D[F]===0,g;while((g=u.exec(x))!==null){if(g[1])continue;if(!O(g.index))continue;if(g[2])g[2].split(",").forEach((F)=>{let m=It(F);if(m)r.add(m)});else if(g[3])r.add(g[3])}while((g=_.exec(x))!==null){if(g[1])continue;if(!O(g.index))continue;r.add(g[2])}let L=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=L.exec(x))!==null){if(!O(g.index))continue;let F=/^\s*['"]([^'"]+)['"]/.exec(e.slice(g.index+g[0].length))?.[1];if(F&&tt.some((m)=>m.test(F)))continue;if(g[1])r.add(g[1]);if(g[2])r.add(g[2]);for(let m of(g[3]??"").split(",")){let M=m.trim();if(!M||/^type\s/.test(M))continue;let P=/\bas\s+(\w+)\s*$/.exec(M)?.[1]??/^\w+$/.exec(M)?.[0];if(P)r.add(P)}}for(let F of x.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let m of F[1].split(",")){let M=/\bas\s+(\w+)\s*$/.exec(m)?.[1]??/^\s*(\w+)\s*$/.exec(m)?.[1];if(M)r.delete(M)}let mt=r.size>0?`
|
|
2
|
+
import{Z}from"./chunk-13awnyq0.js";import{yr,He}from"./chunk-cwcmmgvz.js";import{G,k,Mr,to,A}from"./chunk-0ek3s3b6.js";import{a,j}from"./chunk-jg5xc2m1.js";import{ri}from"./chunk-ddn98yz4.js";import{gt}from"./chunk-zkwkhesc.js";import{l}from"./chunk-w4177qn3.js";import{t,h}from"./chunk-ahf9j8wb.js";import d from"path";import E from"fs";import{AsyncLocalStorage as lt}from"async_hooks";import{randomUUID as St}from"crypto";var vt=12;function X(e,n,s){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(d.basename(e))||ri(e,n,s)}var ct=2;function Qf(e){let n=process.env.STX_BUNDLE_CACHE_DIR?.trim();return n?d.resolve(n):l(e,"bundle-cache")}function rt(e,n){let s=e;for(let i of Bt(n))if(i!==d.sep)s=s.split(i).join("\x00root");return s}var it=new Map;function Bt(e){let n=d.resolve(e),s=it.get(n);if(!s){let i=n;try{i=E.realpathSync(n)}catch{}s=[...new Set([n,i])].sort((c,p)=>p.length-c.length),it.set(n,s)}return s}function jt(e,n){try{let s=E.statSync(e),i=d.resolve(n),c=e.startsWith(`${i}${d.sep}`);return{path:c?d.relative(i,e):e,...c?{inRoot:!0}:{},mtimeMs:s.mtimeMs,size:s.size,hash:Bun.hash(E.readFileSync(e)).toString(36)}}catch{return null}}function ut(e,n){return e.inRoot?d.join(d.resolve(n),e.path):e.path}function Et(e,n){for(let s of e){let i=ut(s,n);try{let c=E.statSync(i);if(c.size!==s.size)return!1;if(c.mtimeMs!==s.mtimeMs&&Bun.hash(E.readFileSync(i)).toString(36)!==s.hash)return!1}catch{return!1}}return!0}var dt=new Map,_t=100;function eg(e=process.env){let n=Number(e.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(n)&&n>=1?Math.floor(n):2000}var q=new Map;async function Mt(e){let n=q.get(e)??0;if(n>0&&n<_t){q.set(e,n+1);return}q.set(e,1);try{let s=(await E.promises.readdir(e)).filter((o)=>o.endsWith(".js")),i=eg();if(s.length<=i)return;let p=(await Promise.all(s.map(async(o)=>{try{return{name:o,at:(await E.promises.stat(d.join(e,o))).mtimeMs}}catch{return null}}))).filter((o)=>o!==null);p.sort((o,w)=>w.at-o.at);for(let o of p.slice(i)){let w=o.name.slice(0,-3);await E.promises.rm(d.join(e,`${w}.js`),{force:!0}),await E.promises.rm(d.join(e,`${w}.deps.json`),{force:!0})}T("pruned bundle cache to",i,"entries")}catch{}}function $e(e){return dt.get(e)??[]}function Y(e,n){if(e)dt.set(e,n)}function tg(e=process.env){return e.STX_DEBUG==="true"||e.STX_DEBUG==="1"}function T(...e){if(tg())console.log("[stx:bundler]",...e)}var et=[];function Rc(e,n,s){et.push({filePath:e||"<inline>",message:n,details:s})}function mn(){return et.slice()}function hn(){et.length=0}var K;function sy(e){K=e}function Ac(){if(K)return K;try{let e=j.strict;return typeof e==="object"&&e!==null?e.bundlerFallback??"warn":"warn"}catch{return"warn"}}var tt=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function yn(e){let n=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,s;while((s=n.exec(e))!==null){let c=s[1];if(!tt.some((o)=>o.test(c)))return T("detected user import:",c),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((s=i.exec(e))!==null){let c=s[1];if(/\.css(?:\?.*)?$/.test(c))continue;if(!tt.some((o)=>o.test(c)))return T("detected side-effect import:",c),!0}return!1}var hr="stx-module:",Rt=/\.(?:[cm]?[jt]sx?|json)$/i;function ng(e,n){return d.relative(e,n).split(d.sep).join("/")}function rg(e,n){if(n.size===0)return e;return e.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(s,i,c,p)=>{let o=n.get(p);return o&&!p.startsWith(hr)?`${i}${c}${o}${c}`:s})}function sg(e,n){let s=0,i=(p)=>{let o=`__stxMod${s++}`,w=JSON.stringify(p);return n.push(`var ${o} = globalThis.__stxModules && globalThis.__stxModules[${w}];`,`if (${o} === undefined) throw new Error("[stx] module " + ${JSON.stringify(w)} + " is not registered on this page (#1957)");`),o},c=(p,o)=>{for(let w of p.split(",")){let C=w.trim();if(!C)continue;let R=C.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!R)continue;let S=R[1].startsWith('"')?JSON.parse(R[1]):R[1],f=R[2]??S;n.push(`var ${f} = ${o}[${JSON.stringify(S)}];`)}};return e=e.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,o,w)=>{let C=w.slice(hr.length),R=i(C),S=o.trim(),f=S.match(/^([\w$]+)\s*(?:,\s*|$)/);if(f&&!S.startsWith("{")&&!S.startsWith("*"))n.push(`var ${f[1]} = ${R}.default;`),S=S.slice(f[0].length).trim();let v=S.match(/^\*\s*as\s+([\w$]+)$/);if(v)n.push(`var ${v[1]} = ${R};`);else if(S.startsWith("{"))c(S.replace(/^\{|\}$/g,""),R);return""}),e=e.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(p,o)=>(i(o.slice(hr.length)),"")),e}function ot(e){let n=[e,`${e}.ts`,`${e}.tsx`,`${e}.js`,`${e}.mjs`,`${e}.jsx`,d.join(e,"index.ts"),d.join(e,"index.tsx"),d.join(e,"index.js"),d.join(e,"index.mjs")];for(let s of n)try{if(E.existsSync(s)&&E.statSync(s,{throwIfNoEntry:!1})?.isFile())return s}catch{}return}var H=new lt;function Cs(e,n){let s=new Bun.CryptoHasher("md5");for(let[i,c]of[...e].sort(([p],[o])=>p<o?-1:p>o?1:0))s.update(`${i}\x00${c}\x00`);return H.run({modules:e,key:s.digest("hex").slice(0,12)},n)}var pt=new lt;function og(e){return pt.run(!0,e)}function ig(){return pt.getStore()===!0}function Pc(e){if(!ig())return;throw Error(`The client script of ${e} needs bundling, and it is being rendered inside a Bun.build loader, where Bun never finishes a second build. Make the page an entrypoint of the build (bun-plugin-stx renders entrypoints before the bundler starts), or render it once outside the build so its bundle is cached.`)}function bn(){return H.getStore()?.key??""}function ft(e,n,s,i,c,p,o=new Map,w,C,R){let S=new Map([[s,i],...R??[]]),f=(B)=>B!==void 0&&S.has(B),v=(B,r,u)=>{if(X(r,e,w))return null;if(!p||!f(B)||!Rt.test(r))return null;try{if(!E.statSync(r,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}c.add(r);let _=`${hr}${ng(process.cwd(),r)}`;return o.set(u,_),{path:_,external:!0}},b=(B,r)=>{let u=f(B)?n:d.dirname(B),_=d.resolve(u,r);return ot(_)??_};return{name:"stx-client-bundle",setup(B){if(B.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(r)=>({path:r.path,external:!0})),B.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(r)=>({path:r.path,external:!0})),B.onResolve({filter:/^\//},(r)=>{if(f(r.path))return{path:r.path};let u=ot(r.path);if(u){let _=v(r.importer,u,r.path);if(_)return _;if(!f(u))c.add(u);return{path:u}}return{path:r.path,external:!0}}),B.onResolve({filter:/^\.\.?\//},(r)=>{let u=b(r.importer,r.path),_=v(r.importer,u,r.path);if(_)return _;return c.add(u),{path:u}}),B.onResolve({filter:/^[@~]\//},(r)=>{let u=d.resolve(e,r.path.slice(2)),_=[u,`${u}.ts`,`${u}.tsx`,`${u}.js`,`${u}.mjs`,`${u}.jsx`,d.join(u,"index.ts"),d.join(u,"index.tsx"),d.join(u,"index.js"),d.join(u,"index.mjs")];for(let x of _)if(E.existsSync(x)&&E.statSync(x,{throwIfNoEntry:!1})?.isFile()){let D=v(r.importer,x,r.path);if(D)return D;return T(`resolved ${r.path[0]}/ import:`,r.path,"\u2192",x),c.add(x),{path:x}}return console.warn(`[stx:bundler] could not resolve ${r.path[0]}/ import:`,r.path),{path:u}}),p)B.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(r)=>{if(!f(r.importer))return;let u=`${hr}npm:${r.path}`;return o.set(r.path,u),{path:u,external:!0}});B.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(r)=>{if(S.has(r.path))return{contents:S.get(r.path),loader:"ts"};if(X(r.path,e,w))throw Error(`Server-only API source cannot be imported by a client script: ${r.path}`);let u=d.extname(r.path).toLowerCase(),_=u===".json"?"json":u===".tsx"?"tsx":u===".jsx"?"jsx":u===".ts"||u===".mts"||u===".cts"?"ts":"js";if(!f(r.path))c.add(r.path);let x=C?.get(r.path);if(x!==void 0)return{contents:x,loader:"js"};return{contents:E.readFileSync(r.path,"utf8"),loader:_}})}}}var Q=new Map,V=k(64),at=Symbol.for("stx.client-bundle-build-queue");function ag(e){let n=globalThis,i=(n[at]??Promise.resolve()).then(e,e);return n[at]=i.then(()=>{return},()=>{return}),i}async function wn(e,n,s={}){let i=s.projectRoot||process.cwd(),c=(await a(i)).serverApi,p=s.minify??!1,o=s.externalizeUserModules??!0,w=s.expose?.length?[...new Set(s.expose)].sort():void 0,C=s.cacheDir||Qf(i),R=H.getStore(),S=new Bun.CryptoHasher("md5");S.update(`${vt}\x00${gt()}\x00${JSON.stringify(c??!1)}\x00${o?"registry":"inline"}\x00${w?w.join(","):"*"}\x00${p?"minified":"readable"}\x00${R?.key??""}\x00${rt(e,i)}\x00${rt(n,i)}`);let f=S.digest("hex").slice(0,12),v=d.join(C,`${f}.js`),b=V.get(v);if(b){if(to(b.files)&&b.files.every((x)=>!X(x.path,i,c))){T("memo hit:",f);let x=b.files.map((D)=>D.path);return Y(n,x),s.collectInputs?.push(...x),b.code}V.delete(v),T("memo invalidated by dep change:",f)}let B=d.join(C,`${f}.deps.json`),r=Bun.file(v);if(await r.exists()){let x=Bun.file(B),D=!1,N=null;if(await x.exists())try{let O=JSON.parse(await x.text());if(O.metadataVersion===ct&&Array.isArray(O.files)&&Et(O.files,i))N=Mr(O.files.map((g)=>ut(g,i))),D=N.length===O.files.length&&!N.some((g)=>X(g.path,i,c))}catch{D=!1}if(D){if(T("cache hit:",f),N)Y(n,N.map((L)=>L.path)),s.collectInputs?.push(...N.map((L)=>L.path));let O=await r.text(),g=new Date;if(E.promises.utimes(v,g,g).catch(()=>{}),N)V.set(v,{code:O,files:N});return O}T("cache invalidated by dep change:",f)}let u=Q.get(f);if(u){let x=await u;if(s.collectInputs)s.collectInputs.push(...(V.get(v)?.files??[]).map((D)=>D.path));return x}Pc(n);let _=ag(()=>Ft(e,n,{projectRoot:i,minify:p,cacheDir:C,hash:f,cachePath:v,depsPath:B,collectInputs:s.collectInputs,externalizeUserModules:o,serverApi:c,expose:w,throwOnFailure:s.throwOnFailure,substitutes:R?.modules}));Q.set(f,_);try{return await _}finally{Q.delete(f)}}function Ic(e){return`${e}-${process.pid}-${St()}`}async function oy(e,n){let{projectRoot:s}=n,i=Ic(new Bun.CryptoHasher("md5").update([...e.keys()].join("\x00")).digest("hex").slice(0,12)),c=d.join(l(s,"bundle-tmp"),"out",i);E.mkdirSync(c,{recursive:!0});let p=new Map,o=new Map,w=0;for(let[f,v]of e){let b=d.join(s,`.stx-split-${i}-${w++}.ts`);p.set(b,v),o.set(d.basename(b).replace(/\.ts$/,""),f)}let[C,R]=[...p][0],S=new Set;Pc(n.filePath);try{let f=await Bun.build({entrypoints:[...p.keys()],outdir:c,target:"browser",format:"esm",splitting:!0,minify:!1,naming:{entry:"[name].js",chunk:"chunk-[hash].js"},plugins:[ft(s,d.dirname(n.filePath),C,R,S,!1,new Map,void 0,H.getStore()?.modules,p)],define:{"process.env.NODE_ENV":'"development"',...A()},root:s});if(!f.success)throw Error(f.logs.filter((b)=>b.level==="error").map((b)=>b.message).join(", ")||"Unable to bundle the entries");let v={entries:new Map,chunks:new Map};for(let b of f.outputs){let B=d.basename(b.path);if(b.kind==="entry-point"){let r=o.get(B.replace(/\.js$/,""));if(r!==void 0)v.entries.set(r,await b.text())}else if(b.kind==="chunk")v.chunks.set(B.replace(/\.js$/,""),await b.text())}return n.collectInputs?.push(...S),v}finally{try{E.rmSync(c,{recursive:!0,force:!0})}catch{}}}async function Ft(e,n,s){let{projectRoot:i,minify:c,cacheDir:p,hash:o,cachePath:w,depsPath:C,externalizeUserModules:R}=s,S=l(i,"bundle-tmp"),f=Ic(o),v=d.join(i,`.stx-client-${f}.ts`),b=d.join(S,"out",f);E.mkdirSync(b,{recursive:!0});let B=d.dirname(n),r=new Set,u=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,_=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,x=t(e),{depths:D,balanced:N}=h(x),O=(F)=>!N||D[F]===0,g;while((g=u.exec(x))!==null){if(g[1])continue;if(!O(g.index))continue;if(g[2])g[2].split(",").forEach((F)=>{let m=It(F);if(m)r.add(m)});else if(g[3])r.add(g[3])}while((g=_.exec(x))!==null){if(g[1])continue;if(!O(g.index))continue;r.add(g[2])}let L=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=L.exec(x))!==null){if(!O(g.index))continue;let F=/^\s*['"]([^'"]+)['"]/.exec(e.slice(g.index+g[0].length))?.[1];if(F&&tt.some((m)=>m.test(F)))continue;if(g[1])r.add(g[1]);if(g[2])r.add(g[2]);for(let m of(g[3]??"").split(",")){let M=m.trim();if(!M||/^type\s/.test(M))continue;let P=/\bas\s+(\w+)\s*$/.exec(M)?.[1]??/^\w+$/.exec(M)?.[0];if(P)r.add(P)}}for(let F of x.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let m of F[1].split(",")){let M=/\bas\s+(\w+)\s*$/.exec(m)?.[1]??/^\s*(\w+)\s*$/.exec(m)?.[1];if(M)r.delete(M)}let mt=r.size>0?`
|
|
3
3
|
export { ${[...r].join(", ")} }`:"";T("bundling:",o,"from:",d.basename(n));let nt=new Set,st=new Map;try{let F=await Bun.build({entrypoints:[v],outdir:b,target:"browser",format:"esm",minify:c?{whitespace:!1,identifiers:!0,syntax:!0}:!1,plugins:[ft(i,B,v,e+mt,nt,R,st,s.serverApi,s.substitutes)],define:{"process.env.NODE_ENV":c?'"production"':'"development"',...A()},root:i});if(!F.success){let I=F.logs.filter((U)=>U.level==="error").map((U)=>U.message).join(", ")||`Unable to bundle ${d.basename(n)}`,z=yr(F.logs,n||void 0);if(console.warn("[stx:bundler] build failed:",I),Rc(n||"",I,z),s.throwOnFailure||Ac()==="error")throw Error(I);return e}let m="";for(let y of F.outputs){m=await y.text();break}let M=[];for(let y of m.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let I of y[1].split(",")){let z=I.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(z){M.push([z[2],z[1]]);continue}let U=I.trim();if(/^[A-Za-z_$][\w$]*$/.test(U))M.push([U,U])}if(s.expose){let y=new Set(s.expose);for(let I=M.length-1;I>=0;I--)if(!y.has(M[I][0]))M.splice(I,1)}let P=[];m=sg(rg(m,st),P);let ht=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(),c&&m)try{m=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(m)}catch{}let xt=Z(m),W=`__stxBundle_${o}`,yt=new Set(G(e,!0).split(",").map((y)=>y.trim())),$t=M.map(([y,I])=>`get ${JSON.stringify(y)}() { return ${I} }${yt.has(y)?`, set ${JSON.stringify(y)}(__stxValue_${I}) { ${I} = __stxValue_${I} }`:""}`).join(", "),bt=M.map(([y])=>`var ${y} = undefined;`).join(`
|
|
4
4
|
`),wt=M.map(([y])=>`${y} = ${W}[${JSON.stringify(y)}];`).join(`
|
|
5
5
|
`);if(m=`${ht.join(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{R}from"./chunk-0jdz31q1.js";import{Ie,Wt,oe,F,Nn,ae,P}from"./chunk-fds6vvq0.js";import{Zi,ho,d,m,M,Ee,p,yo,n,u,_}from"./chunk-c08jvjqt.js";import{kr}from"./chunk-fwffn130.js";import{ge}from"./chunk-9bexzgws.js";import{js}from"./chunk-v0yay1kw.js";var he=1000,me=!1;function xe(t,r){let i=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,e="",o=0,s;while((s=i.exec(t))!==null){let l=s.index+s[0].length,b=s.index+s[0].indexOf("("),x=_(t,"(",")",b);if(x===-1)continue;let f=t.slice(l,x).trim();if(!f)continue;if(!Object.keys(r).some((a)=>new RegExp(`(?:^|[^\\w$.])${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(f)))continue;let h;try{let a=M(f,r);if(!a||typeof a!=="object")continue;h=JSON.stringify(a)}catch{continue}e+=t.slice(o,l)+h,o=x,i.lastIndex=x}return o===0?t:e+t.slice(o)}function be(t,r){let i=/@component\s*\(/g,e=t,o,s=[];while((o=i.exec(e))!==null){let l=o.index,b=l+o[0].length-1,x=1,f=b+1;while(f<e.length&&x>0){if(e[f]==="(")x++;else if(e[f]===")"){if(x--,x===0)break}f++}if(x!==0)continue;let c=e.substring(b+1,f),h=f+1,a=c.match(/^\s*['"]([^'"]+)['"]/);if(!a)continue;let y=a[1],g=c.slice(a[0].length),w=g.match(/^\s*,\s*/);if(!w)continue;let k=g.slice(w[0].length).trim();if(!k)continue;try{let S=M(k,r),B=JSON.stringify(S),I=`@component('${y}', ${B})`;s.push({start:l,end:h,replacement:I})}catch{continue}}for(let l=s.length-1;l>=0;l--){let{start:b,end:x,replacement:f}=s[l];e=e.substring(0,b)+f+e.substring(x)}return e}function se(t,r,i){let e=t,o=new RegExp(`${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),s;while((s=o.exec(e))!==null){let l=s.index,b=l+s[0].length-1,x=1,f=b+1,c=null,h=!1;while(f<e.length&&x>0){let g=e[f];if(h){h=!1,f++;continue}if(g==="\\"&&c){h=!0,f++;continue}if(c){if(g===c)c=null;f++;continue}if(g==='"'||g==="'"||g==="`"){c=g,f++;continue}if(g==="(")x++;else if(g===")"){if(x--,x===0)break}f++}if(x!==0)break;let a=e.substring(b+1,f),y=i(a);e=e.substring(0,l)+y+e.substring(f+1)}return e}function ye(t,r){let i=t;return i=i.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(e,o)=>{if(o in r)return`:${o}="${o}"`;return e}),i=i.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(e,o,s)=>{try{if(F(s,r.__stx_client_signal_names||[]))return e;let l=Object.keys(r),b=Object.values(r);Zi(s);let x=!1,c=p(s,l,()=>{x=!0})(...b);if(x)return e;let h=JSON.stringify(c);if(h===void 0){if(!Ee(s).some((g)=>!(g in r)))return"";return e}let a=Buffer.from(h,"utf8").toString("base64");return`__stx_${o}="${a}"`}catch(l){return e}}),i}var Q="<!--__STX_BREAK__-->",ee="<!--__STX_CONTINUE__-->";function le(t,r){let i=/\{\{\{?|\{!!|@(break|continue)(?![\w$])/g,e="",o=0;for(let s=i.exec(t);s;s=i.exec(t)){if(!s[1]){let f=s[0].length===3&&s[0]==="{{{"?3:2,c=s[0]==="{!!"?t.indexOf("!!}",i.lastIndex):Ie(t,s.index,f);if(c<0)break;i.lastIndex=c+(s[0]==="{!!"?3:f);continue}let l=i.lastIndex,b=!0,x=/^\s*\(/.exec(t.slice(l));if(x){let f=l+x[0].length-1,c=_(t,"(",")",f);if(c<0)break;l=c+1;try{let h=`!!(${t.slice(f+1,c).trim()})`;b=m(h)?Boolean(p(h,Object.keys(r))(...Object.values(r))):Boolean(d(h,r))}catch{b=!1}}if(e+=t.slice(o,s.index),b)return e+(s[1]==="break"?Q:ee);o=l,i.lastIndex=l}return e+t.slice(o)}function ue(t){let r=(o)=>o.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),i="",e=0;return Nn(t,(o,s,l)=>(i+=ie(r(t.slice(e,l))),i+=`\${__stxRenderLoopValue(${l}, (${s}), ${o.length})}`,e=l+o.length,o)),i+ie(r(t.slice(e)))}function fe(t,r,i,e){return ae(t,r,i==null?"":String(i),!1,e)}function ie(t){let r=t;return r=se(r,"@break",(i)=>{let e=i.trim();if(!yo(e))return"";return`\`; if (${e}) { break; } result += \``}),r=se(r,"@continue",(i)=>{let e=i.trim();if(!yo(e))return"";return`\`; if (${e}) { continue; } result += \``}),r=r.replace(/@break(?!\()/g,"`; break; result += `"),r=r.replace(/@continue(?!\()/g,"`; continue; result += `"),r}function _e(t){let r=/@forelse\s*\(/g,i,e=[],o=/@foreach\s*\(/g,s=/@endforeach/g,l;while((l=o.exec(t))!==null)e.push({pos:l.index,delta:1});while((l=s.exec(t))!==null)e.push({pos:l.index,delta:-1});e.sort((c,h)=>c.pos-h.pos);let b=[],x=0;for(let c of e)x+=c.delta,b.push({pos:c.pos,depth:x});function f(c){let h=0,a=b.length-1,y=0;while(h<=a){let g=h+a>>1;if(b[g].pos<=c)y=b[g].depth,h=g+1;else a=g-1}return y}while((i=r.exec(t))!==null){if(f(i.index)>0)continue;let c=i.index,h=i.index+i[0].length-1,a=1,y=h+1,g=-1;while(y<t.length&&a>0){if(t[y]==="(")a++;else if(t[y]===")"){if(a--,a===0){g=y;break}}y++}if(g===-1)continue;let w=t.substring(h+1,g),k=Wt(w);if(!k)continue;let{arrayExpr:S,itemVar:B}=k,I=g+1,A=1,T=I,K=/@forelse\s*\(/g,L=/@endforelse/g,V=-1;while(A>0&&T<t.length){K.lastIndex=T,L.lastIndex=T;let C=K.exec(t),E=L.exec(t);if(!E)break;if(C&&C.index<E.index)A++,T=C.index+C[0].length;else{if(A--,A===0){V=E.index;break}T=E.index+11}}if(V===-1)continue;let O=t.substring(I,V),Z=V+11,z=-1,D=0,N=0;while(N<O.length){let C=O.indexOf("@",N);if(C===-1)break;let E=O.substring(C);if(/^@forelse\s*\(/.test(E))D++,N=C+1;else if(E.startsWith("@endforelse"))D--,N=C+11;else if(D===0&&E.startsWith("@empty")){if(O.length<=C+6||!/[a-z]/i.test(O[C+6])){z=C;break}N=C+1}else N=C+1}if(z===-1)continue;return{start:c,end:Z,arrayExpr:S,itemVar:B,foreachContent:O.substring(0,z),emptyContent:O.substring(z+6)}}return null}function ce(t,r){let i=t;while(!0){let e=_e(i);if(!e)break;let{start:o,end:s,arrayExpr:l,itemVar:b,foreachContent:x,emptyContent:f}=e;try{let c;if(m(l))c=p(l,Object.keys(r))(...Object.values(r));else c=d(l,r);let h;if(!Array.isArray(c)||c.length===0)h=f;else h=`@foreach (${l} as ${b})${x}@endforeach`;i=i.substring(0,o)+h+i.substring(s)}catch(c){let h=c instanceof Error?c.message:String(c),a=u("Forelse",`Error in @forelse(${l} as ${b}): ${h}`,n.EVALUATION_ERROR);i=i.substring(0,o)+a+i.substring(s)}}return i}var de="<!--stx:foreach-not-iterable:",$e=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function Re(t,r){return`${de}${encodeURIComponent(t)}|${encodeURIComponent(r)}-->`}function Ae(t,r){console.warn(`[stx] @foreach(${t}) in ${r}: ${t} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function Is(t){if(!t.includes(de))return t;return t.replace($e,(r,i,e)=>(Ae(decodeURIComponent(i),decodeURIComponent(e)),""))}function mg(t,r,i,e,o=!1){let s=ne(t,r,i,e,o),l=s.next();while(!l.done)l=s.next();return l.value}async function ui(t,r,i,e,o=!1){let s=ne(t,r,i,e,o),l=s.next();while(!l.done)await R(),l=s.next();return l.value}function*ne(t,r,i,e,o=!1){let s=t,l=new Set(r.__stx_client_signal_names||[]);for(let c of kr(t))l.add(c);if(l.size)r={...r,__stx_client_signal_names:[...l]};s=ce(s,r);function b(c){let h=/@foreach\s*\(/g,a;while((a=h.exec(c))!==null){let y=a.index,g=a.index+a[0].length-1,w=1,k=g+1,S=-1;while(k<c.length&&w>0){if(c[k]==="(")w++;else if(c[k]===")"){if(w--,w===0){S=k;break}}k++}if(S===-1)continue;let B=c.substring(g+1,S),I=Wt(B);if(!I)continue;let A=y,{arrayExpr:T,itemVar:K}=I,L=S+1,V=1,O=L,Z=/@foreach\s*\(/g,z=/@endforeach/g;while(V>0&&O<c.length){Z.lastIndex=O,z.lastIndex=O;let D=Z.exec(c),N=z.exec(c);if(!N)break;if(D&&D.index<N.index)V++,O=D.index+D[0].length;else{if(V--,V===0){let C=c.substring(L,N.index),E=N.index+11;return{start:A,end:E,arrayExpr:T,itemVar:K,content:C}}O=N.index+11}}}return null}function*x(c,h){let a=c;while(!0){let y=b(a);if(!y)break;let{start:g,end:w,arrayExpr:k,itemVar:S,content:B}=y;try{let I=k.trim(),A;if(m(I))A=p(I,Object.keys(h))(...Object.values(h));else A=d(I,h);let T=!1;if(!Array.isArray(A))if(A instanceof Map)A=Array.from(A),T=!0;else if(A instanceof Set)A=Array.from(A);else if(typeof A==="string")A=Array.from(A);else if(A&&typeof A==="object"&&!(A instanceof Date)&&!(A instanceof RegExp))A=Object.entries(A),T=!0;else{let E=Re(I,i)+u("Foreach",`Error in @foreach: ${I} is not iterable`,n.TYPE_ERROR);a=a.substring(0,g)+E+a.substring(w);continue}let K=e?.loops?.useAltLoopVariable??me,L=S.trim(),V=null,O,Z=!1;if(L.includes("=>")){let E=L.split("=>").map((W)=>W.trim());if(E.length===2&&E[0]&&E[1])V=E[0],O=E[1];else O=L}else if(!L.startsWith("[")&&!L.startsWith("{")&&L.includes(",")){let E=L.split(",").map((W)=>W.trim());if(E.length===2&&E[0]&&E[1])O=E[0],V=E[1],Z=!0;else O=L}else O=L;let z="",D=new Set(oe(`${k} as ${S}`)),N=A,C=h[ho]??new WeakMap;for(let E=0;E<N.length;E++){if(E%16===0)yield;let W=N[E],te={index:E,iteration:E+1,first:E===0,last:E===N.length-1,count:N.length},j={...h,loop:te,$loop:te,[ho]:C};if(Array.isArray(h.__stx_client_signal_names))j.__stx_client_signal_names=h.__stx_client_signal_names.filter((H)=>!D.has(H));if(O.startsWith("[")&&O.endsWith("]")){let H=O.slice(1,-1).split(",").map((U)=>U.trim());if(Array.isArray(W))H.forEach((U,X)=>{if(U)j[U]=W[X]});else j[O]=W}else if(O.startsWith("{")&&O.endsWith("}")){let H=O.slice(1,-1).split(",").map((U)=>U.trim()).filter(Boolean);if(W!==null&&typeof W==="object")H.forEach((U)=>{let X=U.indexOf(":"),Y=(X===-1?U:U.slice(0,X)).trim(),re=X===-1?Y:U.slice(X+1).trim();if(Y&&re)j[re]=W[Y]});else j[O]=W}else j[O]=W;if(V)if(!Z&&T&&Array.isArray(W)&&W.length===2)j[V]=W[0],j[O]=W[1];else j[V]=E;let v=ce(B,j);v=yield*ne(v,j,i,e,!0),v=ge(v,j,i),v=le(v,j);let J=v.indexOf(Q),G=v.indexOf(ee),q=J<0?G:G<0?J:Math.min(J,G);if(q>=0)v=v.slice(0,q);if(v=P(v,j,i),v=ye(v,j),v=be(v,j),v=xe(v,j),z+=v,q>=0&&q===J)break}a=a.substring(0,g)+z+a.substring(w)}catch(I){let A=u("Foreach",`Error in @foreach(${k.trim()} as ${S.trim()}): ${I instanceof Error?I.message:String(I)}`,n.EVALUATION_ERROR);a=a.substring(0,g)+A+a.substring(w)}}return a}s=yield*x(s,r),s=we(s,r,i,e);let f=e?.loops?.maxWhileIterations??he;return s=Se(s,r,f),o?s:Is(s)}function hg(t){let r=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(t);if(!r||/^(?:const|let|var)$/.test(r[2]))return t;return`${r[1]}let ${t.slice(r[1].length)}`}function pe(t){return yo(t)}function we(t,r,i,e){let o=t,s=!0;while(s){s=!1;let l=o.match(/@for\s*\(/);if(!l||l.index===void 0)break;let b=l.index,x=b+l[0].length-1,f=_(o,"(",")",x);if(f===-1)break;let c=hg(o.slice(x+1,f)),h=f+1,a=js(o.slice(b),"for","endfor");if(a.length===0)break;let y=a[0].content,g=b+a[0].end;if(!pe(c)){let w=u("For",`Unsafe expression in @for: ${c}`,n.UNSAFE_EXPRESSION);o=o.substring(0,b)+w+o.substring(g),s=!0;continue}try{let w=Oe(c),k=/@(?:for|foreach|if|unless)\s*\(/.test(y);if(w.length>0&&k){let K=ke({forExpr:c,content:y,iterVarNames:w,context:r,filePath:i,options:e});o=o.substring(0,b)+K+o.substring(g),s=!0;continue}let S=Object.keys(r),B=Object.values(r),I=ue(y),T=Function(...S,"__stxRenderLoopValue",`
|
|
2
|
+
import{R}from"./chunk-0jdz31q1.js";import{Ie,Wt,oe,F,Nn,ae,P}from"./chunk-0ek3s3b6.js";import{Zi,ho,d,m,M,Ee,p,yo,n,u,_}from"./chunk-c08jvjqt.js";import{kr}from"./chunk-c0kgwh4k.js";import{ge}from"./chunk-9bexzgws.js";import{js}from"./chunk-v0yay1kw.js";var he=1000,me=!1;function xe(t,r){let i=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,e="",o=0,s;while((s=i.exec(t))!==null){let l=s.index+s[0].length,b=s.index+s[0].indexOf("("),x=_(t,"(",")",b);if(x===-1)continue;let f=t.slice(l,x).trim();if(!f)continue;if(!Object.keys(r).some((a)=>new RegExp(`(?:^|[^\\w$.])${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(f)))continue;let h;try{let a=M(f,r);if(!a||typeof a!=="object")continue;h=JSON.stringify(a)}catch{continue}e+=t.slice(o,l)+h,o=x,i.lastIndex=x}return o===0?t:e+t.slice(o)}function be(t,r){let i=/@component\s*\(/g,e=t,o,s=[];while((o=i.exec(e))!==null){let l=o.index,b=l+o[0].length-1,x=1,f=b+1;while(f<e.length&&x>0){if(e[f]==="(")x++;else if(e[f]===")"){if(x--,x===0)break}f++}if(x!==0)continue;let c=e.substring(b+1,f),h=f+1,a=c.match(/^\s*['"]([^'"]+)['"]/);if(!a)continue;let y=a[1],g=c.slice(a[0].length),w=g.match(/^\s*,\s*/);if(!w)continue;let k=g.slice(w[0].length).trim();if(!k)continue;try{let S=M(k,r),B=JSON.stringify(S),I=`@component('${y}', ${B})`;s.push({start:l,end:h,replacement:I})}catch{continue}}for(let l=s.length-1;l>=0;l--){let{start:b,end:x,replacement:f}=s[l];e=e.substring(0,b)+f+e.substring(x)}return e}function se(t,r,i){let e=t,o=new RegExp(`${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),s;while((s=o.exec(e))!==null){let l=s.index,b=l+s[0].length-1,x=1,f=b+1,c=null,h=!1;while(f<e.length&&x>0){let g=e[f];if(h){h=!1,f++;continue}if(g==="\\"&&c){h=!0,f++;continue}if(c){if(g===c)c=null;f++;continue}if(g==='"'||g==="'"||g==="`"){c=g,f++;continue}if(g==="(")x++;else if(g===")"){if(x--,x===0)break}f++}if(x!==0)break;let a=e.substring(b+1,f),y=i(a);e=e.substring(0,l)+y+e.substring(f+1)}return e}function ye(t,r){let i=t;return i=i.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(e,o)=>{if(o in r)return`:${o}="${o}"`;return e}),i=i.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(e,o,s)=>{try{if(F(s,r.__stx_client_signal_names||[]))return e;let l=Object.keys(r),b=Object.values(r);Zi(s);let x=!1,c=p(s,l,()=>{x=!0})(...b);if(x)return e;let h=JSON.stringify(c);if(h===void 0){if(!Ee(s).some((g)=>!(g in r)))return"";return e}let a=Buffer.from(h,"utf8").toString("base64");return`__stx_${o}="${a}"`}catch(l){return e}}),i}var Q="<!--__STX_BREAK__-->",ee="<!--__STX_CONTINUE__-->";function le(t,r){let i=/\{\{\{?|\{!!|@(break|continue)(?![\w$])/g,e="",o=0;for(let s=i.exec(t);s;s=i.exec(t)){if(!s[1]){let f=s[0].length===3&&s[0]==="{{{"?3:2,c=s[0]==="{!!"?t.indexOf("!!}",i.lastIndex):Ie(t,s.index,f);if(c<0)break;i.lastIndex=c+(s[0]==="{!!"?3:f);continue}let l=i.lastIndex,b=!0,x=/^\s*\(/.exec(t.slice(l));if(x){let f=l+x[0].length-1,c=_(t,"(",")",f);if(c<0)break;l=c+1;try{let h=`!!(${t.slice(f+1,c).trim()})`;b=m(h)?Boolean(p(h,Object.keys(r))(...Object.values(r))):Boolean(d(h,r))}catch{b=!1}}if(e+=t.slice(o,s.index),b)return e+(s[1]==="break"?Q:ee);o=l,i.lastIndex=l}return e+t.slice(o)}function ue(t){let r=(o)=>o.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),i="",e=0;return Nn(t,(o,s,l)=>(i+=ie(r(t.slice(e,l))),i+=`\${__stxRenderLoopValue(${l}, (${s}), ${o.length})}`,e=l+o.length,o)),i+ie(r(t.slice(e)))}function fe(t,r,i,e){return ae(t,r,i==null?"":String(i),!1,e)}function ie(t){let r=t;return r=se(r,"@break",(i)=>{let e=i.trim();if(!yo(e))return"";return`\`; if (${e}) { break; } result += \``}),r=se(r,"@continue",(i)=>{let e=i.trim();if(!yo(e))return"";return`\`; if (${e}) { continue; } result += \``}),r=r.replace(/@break(?!\()/g,"`; break; result += `"),r=r.replace(/@continue(?!\()/g,"`; continue; result += `"),r}function _e(t){let r=/@forelse\s*\(/g,i,e=[],o=/@foreach\s*\(/g,s=/@endforeach/g,l;while((l=o.exec(t))!==null)e.push({pos:l.index,delta:1});while((l=s.exec(t))!==null)e.push({pos:l.index,delta:-1});e.sort((c,h)=>c.pos-h.pos);let b=[],x=0;for(let c of e)x+=c.delta,b.push({pos:c.pos,depth:x});function f(c){let h=0,a=b.length-1,y=0;while(h<=a){let g=h+a>>1;if(b[g].pos<=c)y=b[g].depth,h=g+1;else a=g-1}return y}while((i=r.exec(t))!==null){if(f(i.index)>0)continue;let c=i.index,h=i.index+i[0].length-1,a=1,y=h+1,g=-1;while(y<t.length&&a>0){if(t[y]==="(")a++;else if(t[y]===")"){if(a--,a===0){g=y;break}}y++}if(g===-1)continue;let w=t.substring(h+1,g),k=Wt(w);if(!k)continue;let{arrayExpr:S,itemVar:B}=k,I=g+1,A=1,T=I,K=/@forelse\s*\(/g,L=/@endforelse/g,V=-1;while(A>0&&T<t.length){K.lastIndex=T,L.lastIndex=T;let C=K.exec(t),E=L.exec(t);if(!E)break;if(C&&C.index<E.index)A++,T=C.index+C[0].length;else{if(A--,A===0){V=E.index;break}T=E.index+11}}if(V===-1)continue;let O=t.substring(I,V),Z=V+11,z=-1,D=0,N=0;while(N<O.length){let C=O.indexOf("@",N);if(C===-1)break;let E=O.substring(C);if(/^@forelse\s*\(/.test(E))D++,N=C+1;else if(E.startsWith("@endforelse"))D--,N=C+11;else if(D===0&&E.startsWith("@empty")){if(O.length<=C+6||!/[a-z]/i.test(O[C+6])){z=C;break}N=C+1}else N=C+1}if(z===-1)continue;return{start:c,end:Z,arrayExpr:S,itemVar:B,foreachContent:O.substring(0,z),emptyContent:O.substring(z+6)}}return null}function ce(t,r){let i=t;while(!0){let e=_e(i);if(!e)break;let{start:o,end:s,arrayExpr:l,itemVar:b,foreachContent:x,emptyContent:f}=e;try{let c;if(m(l))c=p(l,Object.keys(r))(...Object.values(r));else c=d(l,r);let h;if(!Array.isArray(c)||c.length===0)h=f;else h=`@foreach (${l} as ${b})${x}@endforeach`;i=i.substring(0,o)+h+i.substring(s)}catch(c){let h=c instanceof Error?c.message:String(c),a=u("Forelse",`Error in @forelse(${l} as ${b}): ${h}`,n.EVALUATION_ERROR);i=i.substring(0,o)+a+i.substring(s)}}return i}var de="<!--stx:foreach-not-iterable:",$e=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function Re(t,r){return`${de}${encodeURIComponent(t)}|${encodeURIComponent(r)}-->`}function Ae(t,r){console.warn(`[stx] @foreach(${t}) in ${r}: ${t} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function Is(t){if(!t.includes(de))return t;return t.replace($e,(r,i,e)=>(Ae(decodeURIComponent(i),decodeURIComponent(e)),""))}function mg(t,r,i,e,o=!1){let s=ne(t,r,i,e,o),l=s.next();while(!l.done)l=s.next();return l.value}async function ui(t,r,i,e,o=!1){let s=ne(t,r,i,e,o),l=s.next();while(!l.done)await R(),l=s.next();return l.value}function*ne(t,r,i,e,o=!1){let s=t,l=new Set(r.__stx_client_signal_names||[]);for(let c of kr(t))l.add(c);if(l.size)r={...r,__stx_client_signal_names:[...l]};s=ce(s,r);function b(c){let h=/@foreach\s*\(/g,a;while((a=h.exec(c))!==null){let y=a.index,g=a.index+a[0].length-1,w=1,k=g+1,S=-1;while(k<c.length&&w>0){if(c[k]==="(")w++;else if(c[k]===")"){if(w--,w===0){S=k;break}}k++}if(S===-1)continue;let B=c.substring(g+1,S),I=Wt(B);if(!I)continue;let A=y,{arrayExpr:T,itemVar:K}=I,L=S+1,V=1,O=L,Z=/@foreach\s*\(/g,z=/@endforeach/g;while(V>0&&O<c.length){Z.lastIndex=O,z.lastIndex=O;let D=Z.exec(c),N=z.exec(c);if(!N)break;if(D&&D.index<N.index)V++,O=D.index+D[0].length;else{if(V--,V===0){let C=c.substring(L,N.index),E=N.index+11;return{start:A,end:E,arrayExpr:T,itemVar:K,content:C}}O=N.index+11}}}return null}function*x(c,h){let a=c;while(!0){let y=b(a);if(!y)break;let{start:g,end:w,arrayExpr:k,itemVar:S,content:B}=y;try{let I=k.trim(),A;if(m(I))A=p(I,Object.keys(h))(...Object.values(h));else A=d(I,h);let T=!1;if(!Array.isArray(A))if(A instanceof Map)A=Array.from(A),T=!0;else if(A instanceof Set)A=Array.from(A);else if(typeof A==="string")A=Array.from(A);else if(A&&typeof A==="object"&&!(A instanceof Date)&&!(A instanceof RegExp))A=Object.entries(A),T=!0;else{let E=Re(I,i)+u("Foreach",`Error in @foreach: ${I} is not iterable`,n.TYPE_ERROR);a=a.substring(0,g)+E+a.substring(w);continue}let K=e?.loops?.useAltLoopVariable??me,L=S.trim(),V=null,O,Z=!1;if(L.includes("=>")){let E=L.split("=>").map((W)=>W.trim());if(E.length===2&&E[0]&&E[1])V=E[0],O=E[1];else O=L}else if(!L.startsWith("[")&&!L.startsWith("{")&&L.includes(",")){let E=L.split(",").map((W)=>W.trim());if(E.length===2&&E[0]&&E[1])O=E[0],V=E[1],Z=!0;else O=L}else O=L;let z="",D=new Set(oe(`${k} as ${S}`)),N=A,C=h[ho]??new WeakMap;for(let E=0;E<N.length;E++){if(E%16===0)yield;let W=N[E],te={index:E,iteration:E+1,first:E===0,last:E===N.length-1,count:N.length},j={...h,loop:te,$loop:te,[ho]:C};if(Array.isArray(h.__stx_client_signal_names))j.__stx_client_signal_names=h.__stx_client_signal_names.filter((H)=>!D.has(H));if(O.startsWith("[")&&O.endsWith("]")){let H=O.slice(1,-1).split(",").map((U)=>U.trim());if(Array.isArray(W))H.forEach((U,X)=>{if(U)j[U]=W[X]});else j[O]=W}else if(O.startsWith("{")&&O.endsWith("}")){let H=O.slice(1,-1).split(",").map((U)=>U.trim()).filter(Boolean);if(W!==null&&typeof W==="object")H.forEach((U)=>{let X=U.indexOf(":"),Y=(X===-1?U:U.slice(0,X)).trim(),re=X===-1?Y:U.slice(X+1).trim();if(Y&&re)j[re]=W[Y]});else j[O]=W}else j[O]=W;if(V)if(!Z&&T&&Array.isArray(W)&&W.length===2)j[V]=W[0],j[O]=W[1];else j[V]=E;let v=ce(B,j);v=yield*ne(v,j,i,e,!0),v=ge(v,j,i),v=le(v,j);let J=v.indexOf(Q),G=v.indexOf(ee),q=J<0?G:G<0?J:Math.min(J,G);if(q>=0)v=v.slice(0,q);if(v=P(v,j,i),v=ye(v,j),v=be(v,j),v=xe(v,j),z+=v,q>=0&&q===J)break}a=a.substring(0,g)+z+a.substring(w)}catch(I){let A=u("Foreach",`Error in @foreach(${k.trim()} as ${S.trim()}): ${I instanceof Error?I.message:String(I)}`,n.EVALUATION_ERROR);a=a.substring(0,g)+A+a.substring(w)}}return a}s=yield*x(s,r),s=we(s,r,i,e);let f=e?.loops?.maxWhileIterations??he;return s=Se(s,r,f),o?s:Is(s)}function hg(t){let r=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(t);if(!r||/^(?:const|let|var)$/.test(r[2]))return t;return`${r[1]}let ${t.slice(r[1].length)}`}function pe(t){return yo(t)}function we(t,r,i,e){let o=t,s=!0;while(s){s=!1;let l=o.match(/@for\s*\(/);if(!l||l.index===void 0)break;let b=l.index,x=b+l[0].length-1,f=_(o,"(",")",x);if(f===-1)break;let c=hg(o.slice(x+1,f)),h=f+1,a=js(o.slice(b),"for","endfor");if(a.length===0)break;let y=a[0].content,g=b+a[0].end;if(!pe(c)){let w=u("For",`Unsafe expression in @for: ${c}`,n.UNSAFE_EXPRESSION);o=o.substring(0,b)+w+o.substring(g),s=!0;continue}try{let w=Oe(c),k=/@(?:for|foreach|if|unless)\s*\(/.test(y);if(w.length>0&&k){let K=ke({forExpr:c,content:y,iterVarNames:w,context:r,filePath:i,options:e});o=o.substring(0,b)+K+o.substring(g),s=!0;continue}let S=Object.keys(r),B=Object.values(r),I=ue(y),T=Function(...S,"__stxRenderLoopValue",`
|
|
3
3
|
let result = '';
|
|
4
4
|
for (${c}) {
|
|
5
5
|
result += \`${I}\`;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{a}from"./chunk-
|
|
2
|
+
import{a}from"./chunk-jg5xc2m1.js";import{zo}from"./chunk-fznjm7qt.js";import p from"path";async function $m(t={}){let l=performance.now(),s=t.root||process.cwd(),e=await a(s),o=t.ssr?.routeRules??e.routeRules??{};if(zo(o),!e.ssr&&Object.keys(o).length)throw Error("routeRules require ssr: true and the production server; flat SSG output cannot apply request/cache policies");if(!e.ssr&&(t.ssr?.serverApi??e.serverApi))throw Error("serverApi requires ssr: true; flat SSG output cannot execute API endpoints");let r=e.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${r.toUpperCase()}${e.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let u,n;if(r==="ssg"){let{generateStaticSite:i}=await import("./ssg.js");u=await i({pagesDir:p.join(e.root||".",e.pagesDir||e.build?.pagesDir||"pages"),publicDir:e.publicDir||e.build?.publicDir||"public",outputDir:e.build?.outputDir||"dist",generate404:e.build?.generate404??!0,minify:e.build?.minify??!0,cleanOutput:e.build?.cleanOutput??!0,router:e.router,...t.ssg})}else{let{buildForProduction:i}=await import("./chunk-b7fmkwz2.js");n=await i({root:s,outputDir:".output",debug:t.debug,...t.ssr})}let d=Math.round(performance.now()-l);return{mode:r,ssg:u,ssr:n,duration:d}}
|
|
3
3
|
export{$m};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ai,ci,li,py,As,fy}from"./chunk-
|
|
2
|
+
import{ai,ci,li,py,As,fy}from"./chunk-f74qzgp8.js";export{As as clearImageDeliveryCatalog,py as deliveredImage,li as efficientDeliverySources,ai as getImageDelivery,ci as isTransparentImage,fy as prepareImageDelivery};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{il,s,Ce}from"./chunk-
|
|
2
|
+
import{il,s,Ce}from"./chunk-0ek3s3b6.js";import{gt}from"./chunk-zkwkhesc.js";import{l}from"./chunk-w4177qn3.js";import o from"fs";import u from"path";var wg=new Map,m=new Map;async function yy(e){let n;for(let i=0;i<3;i++)try{let g=(await o.promises.stat(e)).mtime.getTime(),a=m.get(e);if(a&&a.mtime===g)return a.content;let h=await Bun.file(e).text(),w=(await o.promises.stat(e)).mtime.getTime();if(w!==g)continue;return m.set(e,{content:h,mtime:w}),h}catch(r){n=r;break}throw m.delete(e),Error(`File not found: ${e}${n?` (${n.message})`:""}`)}function by(e){m.delete(e)}function wy(e){for(let t of m.keys())if(t.startsWith(e))m.delete(t)}var f=null,B=null,x=null;function vy(e){x=e}async function vg(e=!1){let t=x??await import("./chunk-4ge69wvr.js");if(e)return t.generateSignalsRuntimeDev();if(f===null)f=t.generateSignalsRuntime();return f}var S=null;async function xg(){if(S===null){let{getRouterScript:e}=await import("./chunk-pp89n1et.js");S=e()}return S}var y={};async function xy(e,t=!1){let n=e==="runtime"?await vg(t):await xg(),i=e==="runtime"&&t?"runtime-debug":e,r=y[i];if(!r||r.content!==n)r={content:n,hash:Bun.hash(n).toString(16).padStart(16,"0").slice(0,16)},y[i]=r;return{content:n,hash:r.hash,url:`/_stx/${e}.${r.hash}.js`}}var E=500,T=33554432,c=new Map,p=0;function C(e){return l(process.cwd(),"module-bundles",`${e}.js`)}function Sy(e){let t=Bun.hash(e).toString(16).padStart(16,"0").slice(0,16),n=c.get(t),i=n!==void 0;if(i)c.delete(t),p-=n.length*2;c.set(t,e),p+=e.length*2;while(c.size>1&&(c.size>E||p>T)){let r=c.keys().next().value;p-=c.get(r).length*2,c.delete(r)}if(!i)try{let r=C(t);if(!o.existsSync(r))o.mkdirSync(u.dirname(r),{recursive:!0}),o.writeFileSync(r,e)}catch{}return`/_stx/modules.${t}.js`}function wi(e){if(!/^[0-9a-f]{16}$/.test(e))return;let t=c.get(e);if(t!==void 0)return t;try{return o.readFileSync(C(e),"utf8")}catch{return}}function ky(){m.clear(),Ce(),il(),f=null,B=null,S=null}function v(e){let t={debug:e.debug===!0,middleware:(e.middleware??[]).map((n)=>({name:n.name,timing:n.timing,handler:String(n.handler)})),customDirectives:(e.customDirectives??[]).map((n)=>({name:n.name,hasEndTag:n.hasEndTag===!0,rawParams:n.rawParams===!0,handler:String(n.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(t)).digest("hex")}async function Er(e,t){try{if(!t.cachePath)return null;let n=u.resolve(t.cachePath),i=u.join(n,`${Bs(e)}.html`),r=u.join(n,`${Bs(e)}.meta.json`);if(!await s(i)||!await s(r))return null;let g=await Bun.file(r).text(),a=JSON.parse(g);if(a.cacheVersion!==t.cacheVersion)return null;if(a.engine!==gt())return null;if(a.optionsSignature!==v(t))return null;if((await o.promises.stat(e)).mtime.getTime()>a.mtime)return null;for(let d of a.dependencies)if(await s(d)){if((await o.promises.stat(d)).mtime.getTime()>a.mtime)return null}else return null;return await Bun.file(i).text()}catch(n){return console.warn(`Cache error for ${e}:`,n),null}}async function Tr(e,t,n,i){try{if(!i.cachePath)return;let r=u.resolve(i.cachePath);await o.promises.mkdir(r,{recursive:!0});let g=u.join(r,`${Bs(e)}.html`),a=u.join(r,`${Bs(e)}.meta.json`),h=await o.promises.stat(e);await Bun.write(g,t);let d={sourcePath:e,mtime:h.mtime.getTime(),dependencies:Array.from(n),cacheVersion:i.cacheVersion,engine:gt(),optionsSignature:v(i),generatedAt:Date.now()};await Bun.write(a,JSON.stringify(d,null,2)),wg.set(e,{output:t,mtime:h.mtime.getTime(),dependencies:n})}catch(r){console.warn(`Failed to cache template ${e}:`,r)}}var _=16;function Bs(e){return new Bun.CryptoHasher("sha1").update(e).digest("hex").substring(0,_)}
|
|
3
3
|
export{wg,yy,by,wy,vy,vg,xg,xy,Sy,wi,ky,Er,Tr,Bs};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Oe,ht,qt,no,ro,_e,Di,$n,ll,ul,Li,dl,pl,oo,ji,Bi,fl,Fi}from"./chunk-
|
|
2
|
+
import{Oe,ht,qt,no,ro,_e,Di,$n,ll,ul,Li,dl,pl,oo,ji,Bi,fl,Fi}from"./chunk-0ek3s3b6.js";import{C}from"./chunk-4b110x6r.js";import{a}from"./chunk-jg5xc2m1.js";import{Uo}from"./chunk-yvp5tfrz.js";import{l}from"./chunk-w4177qn3.js";import{existsSync as G,readFileSync as U}from"fs";import h from"path";var we=new Set(["module","exports","require","$bool","$num","window","document","console","confirm","alert","fetch"]),oe=ht.filter((e)=>!we.has(e)).sort(),ce=[...C].sort(),ke=[...new Set([...oe,...ce])].sort(),ve=new Set(oe),$e=new Set(ce),De=new Set(ke),re=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function Te(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 ae(e,t){let o=[];for(let d of t){if(d.offset===void 0)continue;let i=d.kind==="server"?ve:$e;re.lastIndex=0;for(let c of d.code.matchAll(re)){let m=c.index+c[0].indexOf("{")+1;for(let f of c[1].matchAll(/[^,]+/g)){let k=f[0];if(/^\s*type\s/.test(k))continue;let S=/^\s*([A-Za-z_$][\w$]*)/.exec(k);if(!S)continue;let s=S[1];if(!De.has(s)||i.has(s))continue;let u=d.offset+m+f.index+S[0].length-s.length,g=e.slice(0,u),v=g.split(`
|
|
3
3
|
`).length;o.push({line:v,column:u-(g.lastIndexOf(`
|
|
4
4
|
`)+1)+1,offset:u,length:s.length,name:s,kind:d.kind,message:Te(s,d.kind)})}}}return o}import M from"path";var Ce="@stacksjs/stx-typescript-plugin";function Ee(e,t){let o=M.resolve(e);for(;;){let d=M.join(o,"tsconfig.json");if(t(d))return d;let i=M.dirname(o);if(i===o)return;o=i}}function le(e,t,o){let d=Ee(e,o);if(!d)return;let i=new Set,c=(m)=>{if(i.has(m))return;i.add(m);let f=t(m);if(!f)return;let k=f.compilerOptions?.plugins;if(Array.isArray(k)){let s=k.find((g)=>g?.name===Ce),u=Array.isArray(s?.libs)?s.libs.filter((g)=>typeof g==="string"):[];return s?{configPath:m,libs:u.map((g)=>M.resolve(M.dirname(m),g))}:null}let S=typeof f.extends==="string"?[f.extends]:Array.isArray(f.extends)?f.extends:[];for(let s of[...S].reverse()){if(typeof s!=="string"||!s.startsWith("."))continue;let u=M.resolve(M.dirname(m),s.endsWith(".json")?s:`${s}.json`),g=c(u);if(g!==void 0)return g}return};return c(d)??void 0}function Ma(e,t="",o="",d=t,i){let c=e.startLine>1?`
|
|
5
5
|
`.repeat(e.startLine-1):"",m=Di(ji(e)+e.code,d),f=e.kind==="client"&&i?i.project(m.code):void 0,k=$n(f?.code??m.code),S=e.kind==="client"||e.kind==="plain"?dl(t,e.code):"",s=(c+k).split(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{At,or,qh}from"./chunk-
|
|
2
|
+
import{At,or,qh}from"./chunk-0mxkw6m6.js";import{xe,ir,Kh,ar,Vo,hs,ys,Xh,Gh,Jh,cr,lr,Wo,bs,Yh}from"./chunk-kmy34he2.js";import"./chunk-4b110x6r.js";export{Vo as batch,qh as default,ir as derived,ar as effect,At as generateSignalsRuntime,or as generateSignalsRuntimeDev,lr as isDerived,cr as isSignal,Kh as memo,ys as onDestroy,hs as onMount,bs as peek,Jh as pendingLifecycleCounts,Gh as runDestroyCallbacks,Xh as runMountCallbacks,xe as state,Wo as untrack,Yh as useOptimistic};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ln,z}from"./chunk-w98yt4d4.js";import m from"fs";import e from"path";async function Dn(r,o,i){if(r.__stx_runtime_config)return;let n=Ln();if(n||i){r.__stx_runtime_config=n??z(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-
|
|
2
|
+
import{Ln,z}from"./chunk-w98yt4d4.js";import m from"fs";import e from"path";async function Dn(r,o,i){if(r.__stx_runtime_config)return;let n=Ln();if(n||i){r.__stx_runtime_config=n??z(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-kydh790y.js"),c=await f(t);if(c.runtimeConfig)r.__stx_runtime_config=z(c.runtimeConfig);return}let s=e.dirname(t);if(s===t)return;t=s}}async function Ji(r,o){function i(n){if(n===null)return"null";if(Array.isArray(n))return`Array<${n.length?[...new Set(n.map(i))].join(" | "):"unknown"}>`;if(typeof n==="object")return`{ ${Object.entries(n).map(([t,s])=>`readonly ${JSON.stringify(t)}: ${i(s)}`).join("; ")} }`;return typeof n}await Bun.write(e.join(r,".stx/runtime-config.d.ts"),`import '@stacksjs/stx/runtime-config'
|
|
3
3
|
declare module '@stacksjs/stx/runtime-config' { interface PublicRuntimeConfig ${i(o.public??{})} }
|
|
4
4
|
`),await Bun.write(e.join(r,".stx/runtime-config-server.d.ts"),`import '@stacksjs/stx/runtime-config-server'
|
|
5
5
|
declare module '@stacksjs/stx/runtime-config-server' { interface PrivateRuntimeConfig ${i(o.private??{})} }
|