@stacksjs/stx 0.2.854 → 0.2.855
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-krnp1bae.js → chunk-0vg0j7xa.js} +1 -1
- package/dist/{chunk-kdhgvfxw.js → chunk-11y3106w.js} +1 -1
- package/dist/chunk-161ksm7f.js +2 -0
- package/dist/{chunk-ga0e15n5.js → chunk-1qybwj8k.js} +2 -2
- package/dist/{chunk-m2srr0pz.js → chunk-279n7sde.js} +1 -1
- package/dist/chunk-2y20dvab.js +2 -0
- package/dist/{chunk-djte6zvt.js → chunk-3pm6d9zj.js} +1 -1
- package/dist/{chunk-8vs6xk89.js → chunk-463zkecq.js} +1 -1
- package/dist/{chunk-5t4k477c.js → chunk-4cd94cd5.js} +1 -1
- package/dist/{chunk-1wczdwv6.js → chunk-4dfz7cdr.js} +2 -2
- package/dist/{chunk-ht550m3c.js → chunk-4wrddn8m.js} +2 -2
- package/dist/{chunk-w525ymys.js → chunk-5dykcrnv.js} +1 -1
- package/dist/{chunk-7zhtnnzk.js → chunk-5xcxc9f8.js} +1 -1
- package/dist/{chunk-h8bqgjw4.js → chunk-6w3gv9d6.js} +1 -1
- package/dist/{chunk-3gbexkdv.js → chunk-77kanny8.js} +4 -4
- package/dist/{chunk-y3gajdr9.js → chunk-7hp50cpd.js} +4 -4
- package/dist/{chunk-tks9wec7.js → chunk-7tteg9bn.js} +1 -1
- package/dist/{chunk-cj923dqv.js → chunk-81z64a84.js} +1 -1
- package/dist/{chunk-hn1c3te7.js → chunk-8gsd2n0j.js} +1 -1
- package/dist/{chunk-xk113s55.js → chunk-8kqqxqyp.js} +1 -1
- package/dist/chunk-8qe34jb8.js +3 -0
- package/dist/{chunk-txg0pp28.js → chunk-9hvfmqs1.js} +2 -2
- package/dist/{chunk-1026xh3q.js → chunk-9n3584wt.js} +1 -1
- package/dist/{chunk-j05z0m3r.js → chunk-bk0arddt.js} +1 -1
- package/dist/chunk-c557w9e6.js +2 -0
- package/dist/chunk-ck9zengd.js +2 -0
- package/dist/{chunk-dak3fb0d.js → chunk-cy60hmv2.js} +1 -1
- package/dist/chunk-dbag44ta.js +2 -0
- package/dist/{chunk-5wct6n72.js → chunk-dfcnaaym.js} +1 -1
- package/dist/{chunk-njj4mmdc.js → chunk-e8zpzt9s.js} +1 -1
- package/dist/{chunk-qndtva3r.js → chunk-eegs2at0.js} +1 -1
- package/dist/{chunk-kdc0xsds.js → chunk-f858fazq.js} +1 -1
- package/dist/{chunk-xsc8pksj.js → chunk-fba71th7.js} +3 -3
- package/dist/{chunk-vpqr2td2.js → chunk-fbpqkrvb.js} +1 -1
- package/dist/{chunk-9f1p4y5e.js → chunk-fzkyk5j4.js} +1 -1
- package/dist/{chunk-dq41v6hy.js → chunk-ggthncvg.js} +1 -1
- package/dist/{chunk-7bt73vzq.js → chunk-gxqtbbz0.js} +2 -2
- package/dist/{chunk-xt6gss6f.js → chunk-hfcagm39.js} +1 -1
- package/dist/{chunk-fgxagxde.js → chunk-hfe2byfx.js} +1 -1
- package/dist/{chunk-59br2agx.js → chunk-hgy98n76.js} +2 -2
- package/dist/chunk-j3s5y2k5.js +2 -0
- package/dist/{chunk-r8vx6aw7.js → chunk-jn6mdfrs.js} +1 -1
- package/dist/{chunk-wsz9vajc.js → chunk-k0arm18k.js} +1 -1
- package/dist/{chunk-2f2rxpm9.js → chunk-mhjxx64x.js} +5 -5
- package/dist/{chunk-5c5nr9sf.js → chunk-mv48q1p4.js} +6 -6
- package/dist/chunk-p91288ce.js +2 -0
- package/dist/{chunk-r4r1fydy.js → chunk-pesgcwrj.js} +1 -1
- package/dist/{chunk-41vnkj8n.js → chunk-pw6n7a9k.js} +1 -1
- package/dist/{chunk-16tghnfh.js → chunk-pwem4sed.js} +1 -1
- package/dist/{chunk-df71jdb5.js → chunk-q0jmc3m4.js} +1 -1
- package/dist/{chunk-spnq5xjw.js → chunk-qccpfn5x.js} +1 -1
- package/dist/{chunk-5mjsx45g.js → chunk-qxk9grjm.js} +1 -1
- package/dist/{chunk-pyc91z27.js → chunk-vbsr76qe.js} +1 -1
- package/dist/chunk-vgaqznwt.js +2 -0
- package/dist/chunk-w165qe5q.js +2 -0
- package/dist/{chunk-97qv554b.js → chunk-w835crjw.js} +1 -1
- package/dist/{chunk-rpk744cn.js → chunk-wz54wsm7.js} +1 -1
- package/dist/{chunk-3fjdwr6s.js → chunk-xfb7fdeq.js} +4 -4
- package/dist/{chunk-4qf5qh20.js → chunk-xn2gyhes.js} +1 -1
- package/dist/{chunk-f61153pm.js → chunk-ynd2nfvs.js} +4 -4
- package/dist/{chunk-4ekpj06v.js → chunk-yscys65t.js} +1 -1
- package/dist/{chunk-6ygjr05v.js → chunk-yzvp90yk.js} +1 -1
- package/dist/{chunk-6gt2br9n.js → chunk-zme05d1n.js} +1 -1
- package/dist/{chunk-9tbghxd0.js → chunk-zqb294v2.js} +1 -1
- package/dist/cli.js +7 -7
- 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-0x4j65b0.js +0 -2
- package/dist/chunk-5k8n17b4.js +0 -2
- package/dist/chunk-cddvc63n.js +0 -2
- package/dist/chunk-dxgjmdnx.js +0 -2
- package/dist/chunk-ec54y5py.js +0 -2
- package/dist/chunk-g39txgtx.js +0 -2
- package/dist/chunk-hxz5cd52.js +0 -3
- package/dist/chunk-k4swzkyq.js +0 -2
- package/dist/chunk-vz0t4mnc.js +0 -2
- package/dist/chunk-wa06df5a.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{He,Cn,Xs,$i,M}from"./chunk-v4bqmzj9.js";import{_n}from"./chunk-njj4mmdc.js";import{Lr,k,bl,lt,Di,wl}from"./chunk-ngnvyqk3.js";import{I}from"./chunk-xppm4cs4.js";import{R,_,Js,u,f,Ft,d,K,z,x,eo,Ce,Ue,to}from"./chunk-0dmpc70r.js";import{r,me}from"./chunk-7kc9xwht.js";import{h}from"./chunk-kgrvvtcy.js";import{G}from"./chunk-ym5qgw03.js";import ct from"path";import Wt from"process";import{AsyncLocalStorage as da}from"async_hooks";var Or=new da;function bn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function Dr(e,t){return Or.run(bn(e),t)}async function Mr(e,t){let n=Or.getStore();if(!n)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=n.pending.get(e);if(i)return i;let a=Promise.resolve().then(t).then((l)=>{let c=JSON.stringify(l,(v,T)=>{if(T===void 0||typeof T==="function"||typeof T==="symbol"||typeof T==="bigint"||typeof T==="number"&&!Number.isFinite(T))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(T&&typeof T==="object"&&!Array.isArray(T)&&Object.getPrototypeOf(T)!==Object.prototype&&Object.getPrototypeOf(T)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return T}),b=JSON.parse(c);return n.values.set(e,b),b}).catch((l)=>{throw n.pending.delete(e),l});return n.pending.set(e,a),a}function $r(e){let t=e.__stx_server_data;if(!t?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(t.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function V(e,t=!1){let n=r(e),i=[],a=new Set,l=0,c=0,b=n.length,v=()=>{if(l!==0)return;let T=n.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(T){if(t&&T[1]==="const")return;let L=T[2];if(!a.has(L))i.push(L),a.add(L);return}let P=n.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(P){if(t&&n.slice(c).startsWith("const"))return;P[1].split(",").forEach((L)=>{let F=L.trim();if(!F)return;let B=F.indexOf(":"),X=(B>=0?F.slice(B+1).trim():F).split(/[\s=]/)[0];if(X&&!a.has(X))i.push(X),a.add(X)});return}let D=n.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(D){if(t&&n.slice(c).startsWith("const"))return;D[1].split(",").forEach((L)=>{let F=L.trim().replace(/^\.\.\./,"");if(!F)return;let B=F.split(/[\s=]/)[0];if(B&&!a.has(B))i.push(B),a.add(B)});return}if(t)return;let H=n.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let L=H[1];if(!a.has(L))i.push(L),a.add(L);return}let O=n.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let L=O[1];if(!a.has(L))i.push(L),a.add(L)}};while(c<b){if(n[c]==="{"){l++,c++;continue}if(n[c]==="}"){l--,c++;continue}if(l===0&&/[a-z]/i.test(n[c])&&(c===0||/\s|[;{}()]/.test(n[c-1])))v();c++}return i.join(", ")}function Ms(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function ga(e,t=V(e).split(",").map((n)=>n.trim()).filter(Boolean)){let n=new Set(V(e,!0).split(",").map((i)=>i.trim()));return t.map((i)=>n.has(i)?`get ${i}() { return ${i} }, set ${i}(__stxValue_${i}) { ${i} = __stxValue_${i} }`:i).join(", ")}function Ds(e,t){let n=`{ ${ga(e,t)} }`;return V(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${n}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:n}import jt from"fs";import ve from"path";function U(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var jr=new Map;function xr(e,t=!0){let n=jr.get(e);if(t&&n)return n;let i=new Map,a=[ve.join(e,"src"),ve.join(e,"dist"),e];function l(c,b){if(b>6)return;let v;try{v=jt.readdirSync(c,{withFileTypes:!0})}catch{return}for(let T of v){let P=ve.join(c,T.name);if(T.isDirectory()){if(T.name==="node_modules"||T.name.startsWith("."))continue;l(P,b+1)}else if(T.isFile()&&T.name.endsWith(".stx")){let D=T.name.slice(0,-4);if(!i.has(D))i.set(D,P);let H=D.toLowerCase();if(!i.has(H))i.set(H,P);let O=U(D);if(!i.has(O))i.set(O,P)}}}for(let c of a)if(l(c,0),i.size>0)break;if(t)jr.set(e,i);return i}function Ls(e,t){if(e.startsWith(".")||e.startsWith("/"))return null;let n=t;while(!0){let i=ve.join(n,"node_modules",e);try{if(jt.statSync(i).isDirectory())return i}catch{}let a=ve.dirname(n);if(a===n)return null;n=a}}function js(e,t,n={}){return[ve.resolve(ve.dirname(t),`${e}.stx`),ve.resolve(ve.dirname(t),e),ve.resolve(n.componentsDir||"components",`${e}.stx`),ve.resolve(n.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function Nr(e){let t=e.endsWith(".stx")?e.slice(0,-4):e,n=t.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),i=U(t);return[t,n,i]}function ui(e,t){let[n,i,a]=Nr(e);for(let l of[n,n.toLowerCase(),i,a]){let c=t?.__importedComponents?.get(l);if(c!==void 0)return c}}function ma(e,t){let n=t?ve.resolve(t):void 0,i=ve.dirname(ve.resolve(e));for(;;){if(jt.existsSync(ve.join(i,"package.json")))return n&&i===n?void 0:i;let a=ve.dirname(i);if(a===i)return;i=a}}var ha=["src/ui","src/components","components","dist"];function Ln(e,t){let n=ve.resolve(e);if(!t&&!n.split(ve.sep).includes("node_modules"))return[];let i=ma(n,t);if(!i)return[];let a=[];try{let b=JSON.parse(jt.readFileSync(ve.join(i,"package.json"),"utf8")).stx?.components;if(Array.isArray(b))a=b.filter((v)=>typeof v==="string")}catch{}let l=a.length?a:ha;return[ve.dirname(ve.resolve(e)),...l.map((c)=>ve.resolve(i,c))]}function*di(e,t,n={},i){let a=Nr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield ve.resolve(ve.dirname(t),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],c=n.projectRoot||process.cwd(),b=[...Ln(t,n.projectRoot),...i?.__originalFilePath?[ve.join(ve.dirname(i.__originalFilePath),"components")]:[],...n.componentsDir?[n.componentsDir]:[],ve.join(ve.dirname(t),"components"),ve.resolve(c,"src/components"),ve.resolve(c,"components"),...import.meta.dir?[ve.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(b)){for(let T of l)yield ve.join(v,T);try{for(let T of jt.readdirSync(v,{withFileTypes:!0}))if(T.isDirectory())for(let P of l)yield ve.join(v,T.name,P)}catch{}}}function zr(e,t,n={},i){let a=ui(e,i);if(a!==void 0)return a;for(let l of di(e,t,n,i))try{if(jt.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Bs(e,t=[],n={}){let i=new Set([...e].map((T)=>T.replace(/[-_]/g,"").toLowerCase()));if(!i.has("src")&&!i.has("source")||!i.has("alt")&&!i.has("decorative"))return!1;let a=new Map(Object.entries(n).map(([T,P])=>[T.replace(/[-_]/g,"").toLowerCase(),P])),l=a.get("alt"),c=a.get("decorative"),b=typeof l==="string"&&!!l.trim(),v=typeof c==="string"?!["false","0","off","no"].includes(c.trim().toLowerCase()):Boolean(c);if(!b&&!v)return!1;if(["defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((T)=>i.has(T)))return!1;if([...t].some((T)=>!["load","error"].includes(T.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((T)=>i.has(T))}import rs from"fs";import ce from"path";import $t from"path";import tn from"fs";var xa=new Set(["touchstart","touchmove","wheel","mousewheel"]);function bs(e,t){if(t.passive)return!0;if(t.prevent||t.nonpassive)return!1;return xa.has(e.toLowerCase())}var Br=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"]),Wr={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"},ba=new Set(["ctrl","alt","shift","meta"]),Ur={left:0,middle:1,right:2};function Fr(e){let t={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let n of e){let i=n.toLowerCase();if(i==="prevent")t.prevent=!0;else if(i==="stop")t.stop=!0;else if(i==="once")t.once=!0;else if(i==="capture")t.capture=!0;else if(i==="self")t.self=!0;else if(i==="passive")t.passive=!0;else if(i==="nonpassive")t.nonpassive=!0;else if(ba.has(i))t.systemKeys.push(i);else if(i in Ur)t.mouse=i;else if(i in Wr||/^[a-z]$/.test(i))t.keys.push(Wr[i]||i.toUpperCase());else if(i.startsWith("debounce")){let a=i.match(/debounce(?:\.(\d+))?/);t.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(i.startsWith("throttle")){let a=i.match(/throttle(?:\.(\d+))?/);t.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return t}function Hr(e,t=""){let n=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[c,b,v]=l,T=l.index,P=T+c.length,D=`__stx_evt_${t}${i++}`,H=[],O=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,L;while((L=O.exec(v))!==null){let[,B,ee]=L,X=B.split("."),j=X[0];if(!Br.has(j))continue;H.push({attribute:`@${B}`,event:j,handler:ee,modifiers:Fr(X.slice(1)),elementId:D})}let F=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((L=F.exec(v))!==null){let[,B,ee]=L,X=B.split("."),j=X[0];if(!Br.has(j))continue;H.push({attribute:`@${B}`,event:j,handler:ee,modifiers:Fr(X.slice(1)),elementId:D})}if(H.length>0)n.push({originalTag:c,elementId:D,events:H,startIndex:T,endIndex:P})}return n}function ya(e){let t=[],{modifiers:n}=e;if(n.self)t.push("if ($event.target !== $el) return");for(let i of n.systemKeys)t.push(`if (!$event.${i}Key) return`);if(n.keys.length>0){let i=n.keys.map((a)=>`$event.key === '${a}'`).join(" || ");t.push(`if (!(${i})) return`)}if(n.mouse!==null){let i=Ur[n.mouse];t.push(`if ($event.button !== ${i}) return`)}if(n.prevent)t.push("$event.preventDefault()");if(n.stop)t.push("$event.stopPropagation()");return t.join("; ")}function _a(e,t){let n=e;if(t.debounce!==null)n=`__stx_debounce(() => { ${n} }, ${t.debounce})`;else if(t.throttle!==null)n=`__stx_throttle(() => { ${n} }, ${t.throttle})`;return n}function ys(e){let t=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(t))return e;return`if (typeof ${t} === 'function' && !${t}._isSignal) ${t}($event);`}function wa(e){let{modifiers:t}=e,n=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=ya(e),a=_a(ys(e.handler),t),l=[];if(t.once)l.push("once: true");if(t.capture)l.push("capture: true");if(bs(e.event,t))l.push("passive: true");let c=l.length>0?`, { ${l.join(", ")} }`:"",b=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
|
|
2
|
+
import{He,Cn,Xs,$i,M}from"./chunk-v4bqmzj9.js";import{_n}from"./chunk-e8zpzt9s.js";import{Lr,k,bl,lt,Di,wl}from"./chunk-ngnvyqk3.js";import{I}from"./chunk-xppm4cs4.js";import{R,_,Js,u,f,Ft,d,K,z,x,eo,Ce,Ue,to}from"./chunk-0dmpc70r.js";import{r,me}from"./chunk-7kc9xwht.js";import{h}from"./chunk-kgrvvtcy.js";import{G}from"./chunk-ym5qgw03.js";import ct from"path";import Wt from"process";import{AsyncLocalStorage as da}from"async_hooks";var Or=new da;function bn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function Dr(e,t){return Or.run(bn(e),t)}async function Mr(e,t){let n=Or.getStore();if(!n)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=n.pending.get(e);if(i)return i;let a=Promise.resolve().then(t).then((l)=>{let c=JSON.stringify(l,(v,T)=>{if(T===void 0||typeof T==="function"||typeof T==="symbol"||typeof T==="bigint"||typeof T==="number"&&!Number.isFinite(T))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(T&&typeof T==="object"&&!Array.isArray(T)&&Object.getPrototypeOf(T)!==Object.prototype&&Object.getPrototypeOf(T)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return T}),b=JSON.parse(c);return n.values.set(e,b),b}).catch((l)=>{throw n.pending.delete(e),l});return n.pending.set(e,a),a}function $r(e){let t=e.__stx_server_data;if(!t?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(t.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function V(e,t=!1){let n=r(e),i=[],a=new Set,l=0,c=0,b=n.length,v=()=>{if(l!==0)return;let T=n.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(T){if(t&&T[1]==="const")return;let L=T[2];if(!a.has(L))i.push(L),a.add(L);return}let P=n.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(P){if(t&&n.slice(c).startsWith("const"))return;P[1].split(",").forEach((L)=>{let F=L.trim();if(!F)return;let B=F.indexOf(":"),X=(B>=0?F.slice(B+1).trim():F).split(/[\s=]/)[0];if(X&&!a.has(X))i.push(X),a.add(X)});return}let D=n.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(D){if(t&&n.slice(c).startsWith("const"))return;D[1].split(",").forEach((L)=>{let F=L.trim().replace(/^\.\.\./,"");if(!F)return;let B=F.split(/[\s=]/)[0];if(B&&!a.has(B))i.push(B),a.add(B)});return}if(t)return;let H=n.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let L=H[1];if(!a.has(L))i.push(L),a.add(L);return}let O=n.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let L=O[1];if(!a.has(L))i.push(L),a.add(L)}};while(c<b){if(n[c]==="{"){l++,c++;continue}if(n[c]==="}"){l--,c++;continue}if(l===0&&/[a-z]/i.test(n[c])&&(c===0||/\s|[;{}()]/.test(n[c-1])))v();c++}return i.join(", ")}function Ms(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function ga(e,t=V(e).split(",").map((n)=>n.trim()).filter(Boolean)){let n=new Set(V(e,!0).split(",").map((i)=>i.trim()));return t.map((i)=>n.has(i)?`get ${i}() { return ${i} }, set ${i}(__stxValue_${i}) { ${i} = __stxValue_${i} }`:i).join(", ")}function Ds(e,t){let n=`{ ${ga(e,t)} }`;return V(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${n}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:n}import jt from"fs";import ve from"path";function U(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var jr=new Map;function xr(e,t=!0){let n=jr.get(e);if(t&&n)return n;let i=new Map,a=[ve.join(e,"src"),ve.join(e,"dist"),e];function l(c,b){if(b>6)return;let v;try{v=jt.readdirSync(c,{withFileTypes:!0})}catch{return}for(let T of v){let P=ve.join(c,T.name);if(T.isDirectory()){if(T.name==="node_modules"||T.name.startsWith("."))continue;l(P,b+1)}else if(T.isFile()&&T.name.endsWith(".stx")){let D=T.name.slice(0,-4);if(!i.has(D))i.set(D,P);let H=D.toLowerCase();if(!i.has(H))i.set(H,P);let O=U(D);if(!i.has(O))i.set(O,P)}}}for(let c of a)if(l(c,0),i.size>0)break;if(t)jr.set(e,i);return i}function Ls(e,t){if(e.startsWith(".")||e.startsWith("/"))return null;let n=t;while(!0){let i=ve.join(n,"node_modules",e);try{if(jt.statSync(i).isDirectory())return i}catch{}let a=ve.dirname(n);if(a===n)return null;n=a}}function js(e,t,n={}){return[ve.resolve(ve.dirname(t),`${e}.stx`),ve.resolve(ve.dirname(t),e),ve.resolve(n.componentsDir||"components",`${e}.stx`),ve.resolve(n.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function Nr(e){let t=e.endsWith(".stx")?e.slice(0,-4):e,n=t.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),i=U(t);return[t,n,i]}function ui(e,t){let[n,i,a]=Nr(e);for(let l of[n,n.toLowerCase(),i,a]){let c=t?.__importedComponents?.get(l);if(c!==void 0)return c}}function ma(e,t){let n=t?ve.resolve(t):void 0,i=ve.dirname(ve.resolve(e));for(;;){if(jt.existsSync(ve.join(i,"package.json")))return n&&i===n?void 0:i;let a=ve.dirname(i);if(a===i)return;i=a}}var ha=["src/ui","src/components","components","dist"];function Ln(e,t){let n=ve.resolve(e);if(!t&&!n.split(ve.sep).includes("node_modules"))return[];let i=ma(n,t);if(!i)return[];let a=[];try{let b=JSON.parse(jt.readFileSync(ve.join(i,"package.json"),"utf8")).stx?.components;if(Array.isArray(b))a=b.filter((v)=>typeof v==="string")}catch{}let l=a.length?a:ha;return[ve.dirname(ve.resolve(e)),...l.map((c)=>ve.resolve(i,c))]}function*di(e,t,n={},i){let a=Nr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield ve.resolve(ve.dirname(t),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],c=n.projectRoot||process.cwd(),b=[...Ln(t,n.projectRoot),...i?.__originalFilePath?[ve.join(ve.dirname(i.__originalFilePath),"components")]:[],...n.componentsDir?[n.componentsDir]:[],ve.join(ve.dirname(t),"components"),ve.resolve(c,"src/components"),ve.resolve(c,"components"),...import.meta.dir?[ve.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(b)){for(let T of l)yield ve.join(v,T);try{for(let T of jt.readdirSync(v,{withFileTypes:!0}))if(T.isDirectory())for(let P of l)yield ve.join(v,T.name,P)}catch{}}}function zr(e,t,n={},i){let a=ui(e,i);if(a!==void 0)return a;for(let l of di(e,t,n,i))try{if(jt.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Bs(e,t=[],n={}){let i=new Set([...e].map((T)=>T.replace(/[-_]/g,"").toLowerCase()));if(!i.has("src")&&!i.has("source")||!i.has("alt")&&!i.has("decorative"))return!1;let a=new Map(Object.entries(n).map(([T,P])=>[T.replace(/[-_]/g,"").toLowerCase(),P])),l=a.get("alt"),c=a.get("decorative"),b=typeof l==="string"&&!!l.trim(),v=typeof c==="string"?!["false","0","off","no"].includes(c.trim().toLowerCase()):Boolean(c);if(!b&&!v)return!1;if(["defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((T)=>i.has(T)))return!1;if([...t].some((T)=>!["load","error"].includes(T.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((T)=>i.has(T))}import rs from"fs";import ce from"path";import $t from"path";import tn from"fs";var xa=new Set(["touchstart","touchmove","wheel","mousewheel"]);function bs(e,t){if(t.passive)return!0;if(t.prevent||t.nonpassive)return!1;return xa.has(e.toLowerCase())}var Br=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"]),Wr={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"},ba=new Set(["ctrl","alt","shift","meta"]),Ur={left:0,middle:1,right:2};function Fr(e){let t={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let n of e){let i=n.toLowerCase();if(i==="prevent")t.prevent=!0;else if(i==="stop")t.stop=!0;else if(i==="once")t.once=!0;else if(i==="capture")t.capture=!0;else if(i==="self")t.self=!0;else if(i==="passive")t.passive=!0;else if(i==="nonpassive")t.nonpassive=!0;else if(ba.has(i))t.systemKeys.push(i);else if(i in Ur)t.mouse=i;else if(i in Wr||/^[a-z]$/.test(i))t.keys.push(Wr[i]||i.toUpperCase());else if(i.startsWith("debounce")){let a=i.match(/debounce(?:\.(\d+))?/);t.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(i.startsWith("throttle")){let a=i.match(/throttle(?:\.(\d+))?/);t.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return t}function Hr(e,t=""){let n=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[c,b,v]=l,T=l.index,P=T+c.length,D=`__stx_evt_${t}${i++}`,H=[],O=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,L;while((L=O.exec(v))!==null){let[,B,ee]=L,X=B.split("."),j=X[0];if(!Br.has(j))continue;H.push({attribute:`@${B}`,event:j,handler:ee,modifiers:Fr(X.slice(1)),elementId:D})}let F=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((L=F.exec(v))!==null){let[,B,ee]=L,X=B.split("."),j=X[0];if(!Br.has(j))continue;H.push({attribute:`@${B}`,event:j,handler:ee,modifiers:Fr(X.slice(1)),elementId:D})}if(H.length>0)n.push({originalTag:c,elementId:D,events:H,startIndex:T,endIndex:P})}return n}function ya(e){let t=[],{modifiers:n}=e;if(n.self)t.push("if ($event.target !== $el) return");for(let i of n.systemKeys)t.push(`if (!$event.${i}Key) return`);if(n.keys.length>0){let i=n.keys.map((a)=>`$event.key === '${a}'`).join(" || ");t.push(`if (!(${i})) return`)}if(n.mouse!==null){let i=Ur[n.mouse];t.push(`if ($event.button !== ${i}) return`)}if(n.prevent)t.push("$event.preventDefault()");if(n.stop)t.push("$event.stopPropagation()");return t.join("; ")}function _a(e,t){let n=e;if(t.debounce!==null)n=`__stx_debounce(() => { ${n} }, ${t.debounce})`;else if(t.throttle!==null)n=`__stx_throttle(() => { ${n} }, ${t.throttle})`;return n}function ys(e){let t=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(t))return e;return`if (typeof ${t} === 'function' && !${t}._isSignal) ${t}($event);`}function wa(e){let{modifiers:t}=e,n=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=ya(e),a=_a(ys(e.handler),t),l=[];if(t.once)l.push("once: true");if(t.capture)l.push("capture: true");if(bs(e.event,t))l.push("passive: true");let c=l.length>0?`, { ${l.join(", ")} }`:"",b=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
|
|
3
3
|
(function() {
|
|
4
4
|
var $el = document.getElementById('${n}');
|
|
5
5
|
if (!$el) return;
|
|
@@ -112,7 +112,7 @@ else {
|
|
|
112
112
|
`)}
|
|
113
113
|
})();
|
|
114
114
|
</script>`}function Sa(e,t=""){let n=Hr(e,t);if(n.length===0)return{template:e,bindings:[]};let i=e,a=[];for(let l=n.length-1;l>=0;l--){let c=n[l],b=c.originalTag;if(!b.includes(" id="))b=b.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${c.elementId}"`);else{let v=b.match(/id=["']([^"']+)["']/);if(v)for(let T of c.events)T.elementId=v[1]}for(let v of c.events){let T=v.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),P=new RegExp(`\\s*${T}\\s*=\\s*"[^"]*"`,"g"),D=new RegExp(`\\s*${T}\\s*=\\s*'[^']*'`,"g");b=b.replace(P,""),b=b.replace(D,"")}i=i.slice(0,c.startIndex)+b+i.slice(c.endIndex),a.push(...c.events)}return{template:i,bindings:a}}function Vr(e){let t=e.$uid;return typeof t==="string"&&t?`${t}_`:""}function Dc(e,t,n){if(wl(e))return e;if(t.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:b,bindings:v}=Sa(e,Vr(t)),T=t.__stx_event_bindings||[];return t.__stx_event_bindings=[...T,...v],b}let i=Hr(e,Vr(t));if(i.length===0)return e;let a=e;for(let b=i.length-1;b>=0;b--){let v=i[b],T=v.originalTag;if(!T.includes(" id="))T=T.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${v.elementId}"`);else{let P=T.match(/id=["']([^"']+)["']/);if(P)for(let D of v.events)D.elementId=P[1]}for(let P of v.events){let D=P.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),H=new RegExp(`\\s*${D}\\s*=\\s*"[^"]*"`,"g"),O=new RegExp(`\\s*${D}\\s*=\\s*'[^']*'`,"g");T=T.replace(H,""),T=T.replace(O,"")}a=a.slice(0,v.startIndex)+T+a.slice(v.endIndex)}let l=pi(i.flatMap((b)=>b.events)),c=a.lastIndexOf("</body>");if(c!==-1)a=a.slice(0,c)+l+`
|
|
115
|
-
`+a.slice(c);else a+=l;return a}function qr(e,t){let n=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(t){let l=a.lastIndexOf(":");if(l!==-1)a=a.slice(l+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))n.add(a)}return n}function Pt(e,t){let n=r(e),{depths:i,balanced:a}=me(n),l=(b)=>!a||i[b]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${t}\\b)`,"g");for(let b of n.matchAll(c)){let v=(b.index??0)+b[0].length-b[1].length;if(l(v))return!0}for(let b of n.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(b.index??0)&&qr(b[1],!0).has(t))return!0;for(let b of n.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(b.index??0)&&qr(b[1],!1).has(t))return!0;return!1}var Zr=new R(32,{maxBytes:2097152,sizeOf:(e)=>e.code.length*4}),yt=/^[A-Za-z_$][\w$]*$/,$a=new Set(["if","for","while","switch","with"]),Kr=["(","[","{"],Xr=[")","]","}"],va=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function Ea(e){let t=r(e),n=[];for(let i of t.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=i.index??0;n.push({text:i[0],start:a,end:a+i[0].length})}return{code:t,tokens:n}}function _s(e){let t=Zr.get(e);if(t)return t;let{code:n,tokens:i}=Ea(e),a=new Map,l=[];for(let B=0;B<i.length;B++){let ee=i[B].text;if(["(","[","{"].includes(ee))l.push(B);else if([")","]","}"].includes(ee)){let X=l.at(-1);if(X!==void 0&&["()","[]","{}"].includes(i[X].text+ee))l.pop(),a.set(X,B),a.set(B,X)}}function c(B,ee){let X=[],j=B;for(let te=B;te<ee;te++){if(["(","[","{"].includes(i[te].text)&&(a.get(te)??ee)<ee){te=a.get(te);continue}if(i[te].text===",")X.push([j,te]),j=te+1}return X.push([j,ee]),X}let b=[];function v(B,ee,X,j=!1){if(i[B]?.text==="...")B++;if(B>=ee)return;let te=i[B].text;if(yt.test(te)){if(X.add(te),X===D)b.push({name:te,token:B,functionScoped:j});return}if(te!=="{"&&te!=="[")return;let se=a.get(B);if(se===void 0||se>=ee)return;for(let[ne,ue]of c(B+1,se)){let ye=ne;if(te==="{")for(let de=ne;de<ue;de++){if(i[de].text===":"){ye=de+1;break}if(i[de].text==="=")break;if(["(","[","{"].includes(i[de].text)&&a.has(de))de=a.get(de)}v(ye,ue,X,j)}}function T(B,ee){let X=new Set;for(let[j,te]of c(B,ee))v(j,te,X);return X}function P(B){let ee=B;for(;ee<i.length;ee++){let X=i[ee].text;if(["(","[","{"].includes(X)&&a.has(ee)){ee=a.get(ee);continue}if([",",";",")","]","}"].includes(X))break}return i[Math.max(B,ee-1)]?.end??n.length}let D=new Set,H=[];for(let B=0;B<i.length;B++)if(i[B].text==="=>"){let ee=B-1,X=ee,j;if(i[ee]?.text===")"&&a.has(ee))X=a.get(ee),j=T(X+1,ee);else if(i[ee]&&yt.test(i[ee].text))j=new Set([i[ee].text]);else continue;let te=B+1,se=i[te]?.text==="{"&&a.has(te)?i[a.get(te)].end:P(te);H.push({start:i[X].start,end:se,bodyStart:i[te]?.start??se,functionBody:!0,names:j})}else if(i[B].text==="("&&a.has(B)){let ee=i[B-1]?.text;if(!ee||$a.has(ee)||!yt.test(ee)&&ee!=="*"&&ee!=="]")continue;let X=a.get(B),j=X+1;if(i[j]?.text===":"){j++;while(j<i.length&&!["{","=>",";","="].includes(i[j].text))j++}if(i[j]?.text!=="{"||!a.has(j))continue;H.push({start:i[B].start,end:i[a.get(j)].end,bodyStart:i[j].start,functionBody:ee!=="catch",names:T(B+1,X)})}function O(B){let ee=B;for(;ee<i.length;ee++){let X=i[ee].text;if(Kr.includes(X)&&a.has(ee)){ee=a.get(ee);continue}if(X===";"||Xr.includes(X))break;let j=i[ee-1];if(ee>B&&va.has(X)&&j.text!==".")break;if(ee>B&&/[\n\r]/.test(n.slice(j.end,i[ee].start))&&(/^[\w$]+$/.test(j.text)||Xr.includes(j.text)||['"',"'","`"].includes(j.text))&&yt.test(X)&&!["in","of","instanceof"].includes(X))break}return ee}let L=[];for(let B=0;B<i.length;B++){if(i[B].text!=="for")continue;let ee=i[B+1]?.text==="await"?B+2:B+1;if(i[ee]?.text!=="("||!a.has(ee))continue;let X=a.get(ee),j=X+1,te=i[j]?.text==="{"&&a.has(j)?a.get(j):O(j),se=i[te]?.text===";"||i[te]?.text==="}"?i[te].end:i[Math.max(j,te-1)]?.end??n.length;L.push({headStart:ee,headEnd:X,start:i[ee].start,end:se})}for(let B=0;B<i.length;B++){let ee=i[B].text,X=i[B-1]?.text;if(X==="."||i[B+1]?.text===":")continue;if(X==="as"||X==="<")continue;if(ee==="const"||ee==="let"||ee==="var"){let j=O(B+1),te=B+1,se=!1,ne=!1,ue=0;for(let ye=B+1;ye<=j;ye++){let de=i[ye]?.text;if(ye<j&&Kr.includes(de)&&a.has(ye)&&a.get(ye)<j){ye=a.get(ye);continue}if(ye<j&&de===":"&&!ne)se=!0;else if(ye<j&&de==="="&&ue===0)se=!1,ne=!0;else if(ye<j&&se&&de==="<")ue++;else if(ye<j&&se&&de===">"&&ue>0)ue--;else if(ye===j||de===","&&ue===0)v(te,ye,D,ee==="var"),te=ye+1,se=!1,ne=!1}}else if(ee==="function"||ee==="class"){let j=B+1;if(i[j]?.text==="*")j++;if(i[j]&&yt.test(i[j].text)&&i[j].text!=="extends")D.add(i[j].text),b.push({name:i[j].text,token:j})}else if(ee==="import"){let j=B+1;if(i[j]?.text==="*"&&i[j+1]?.text==="as")j+=2;let te=i[j]?.text;if(te&&yt.test(te)&&te!=="type"&&i[j+1]?.text!=="("&&i[j+1]?.text!==".")D.add(te),b.push({name:te,token:j,file:!0});let se=i[j]?.text==="{"?j:i[j+1]?.text===","&&i[j+2]?.text==="{"?j+2:-1;if(se!==-1&&a.has(se)){let ne=a.get(se);for(let[ue,ye]of c(se+1,ne)){let de=ye-1;while(de>=ue&&!yt.test(i[de].text))de--;if(de>=ue&&i[de].text!=="type")b.push({name:i[de].text,token:de,file:!0})}}}}let F={code:n,scopes:H,loops:L,declarations:D,sites:b,tokens:i,pairs:a};return Zr.set(e,F),F}function en(e){let t=_s(e);return{code:t.code,shadows:(n,i)=>t.scopes.some((a)=>i>=a.start&&i<a.end&&a.names.has(n))}}function zn(e){return new Set(_s(e).declarations)}function Oe(e,t){let{scopes:n,loops:i,sites:a,tokens:l,pairs:c}=_s(e),b=Array.from({length:l.length},()=>-1),v=[];for(let O=0;O<l.length;O++){b[O]=v.length?v[v.length-1]:-1;let L=l[O].text;if(L==="{"&&c.has(O))v.push(O);else if(L==="}"&&v.length&&c.get(O)===v[v.length-1])v.pop()}let T=new Set,P=new Map;for(let O of a){if(!t.has(O.name))continue;T.add(O.token);let L=O.file?-1:b[O.token],F=L===-1?[0,Number.POSITIVE_INFINITY]:[l[L].start,l[c.get(L)].end];if(O.functionScoped){let ee=l[O.token].start,X=n.filter((j)=>j.functionBody&&ee>=j.bodyStart&&ee<j.end).sort((j,te)=>j.end-j.bodyStart-(te.end-te.bodyStart))[0];F=X?[X.bodyStart,X.end]:[0,Number.POSITIVE_INFINITY]}else if(!O.file){let ee=i.filter((X)=>O.token>X.headStart&&O.token<X.headEnd).sort((X,j)=>X.headEnd-X.headStart-(j.headEnd-j.headStart))[0];if(ee)F=[ee.start,ee.end]}let B=P.get(O.name);if(B)B.push(F);else P.set(O.name,[F])}let D=new Set;for(let O=0;O<l.length;O++){if(l[O].text!=="import"||l[O-1]?.text===".")continue;let L=O+1;if(l[L]?.text==="type")L++;if(l[L]&&yt.test(l[L].text)&&l[L+1]?.text===",")L+=2;if(l[L]?.text==="{"&&c.has(L))for(let F=L+1;F<c.get(L);F++)D.add(F)}let H=new Set;for(let O=0;O<l.length;O++){let L=l[O].text;if(!t.has(L)||H.has(L)||T.has(O)||D.has(O))continue;let F=l[O-1]?.text;if(F==="#"||F==="."&&l[O-2]?.text!=="..")continue;if(l[O+1]?.text===":"&&(F==="{"||F===","))continue;let B=l[O].start;if(P.get(L)?.some(([ee,X])=>B>=ee&&B<X))continue;if(n.some((ee)=>B>=ee.start&&B<ee.end&&ee.names.has(L)))continue;H.add(L)}return H}var Ie="0.2.854";var Jr=Symbol.for(`stx.lazy-module-promises.${Ie}`);function Ca(){let e=globalThis;return e[Jr]??=new Map,e[Jr]}function o(e,t){let n=Ca(),i=`${import.meta.url}\x00${e}`,a=n.get(i);if(a)return a;let l=t();return n.set(i,l),l.catch(()=>{if(n.get(i)===l)n.delete(i)}),l}var Ra=/<\/(script)/gi;function gn(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(Ra,"<\\/$1")}import Gr from"fs";var Yr=[];function w(e){let t=new R(e);return Yr.push(t),t}function Lc(){for(let e of Yr)e.clear()}function S(e,...t){return`${t.map((n)=>String(n??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function Sr(e){let t=[];for(let n of new Set(e))try{t.push({path:n,mtimeMs:Gr.statSync(n).mtimeMs})}catch{}return t}function Fs(e){for(let t of e)try{if(Gr.statSync(t.path).mtimeMs!==t.mtimeMs)return!1}catch{return!1}return!0}var Se=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl"];var Ta=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function Aa(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let n=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!n)return null;return{pkg:n[1],subpath:n[2]||""}}let t=e.match(/^([^/]+)(\/.*)?$/);if(!t)return null;return{pkg:t[1],subpath:t[2]||""}}function Ia(e,t){let n=t;while(!0){let i=$t.join(n,"node_modules",e,"package.json");if(tn.existsSync(i))return $t.dirname(i);let a=$t.dirname(n);if(a===n)return null;n=a}}function Pa(e,t){if(!e||typeof e!=="object")return null;let n=(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 n(a.import);if(typeof a.default==="object")return n(a.default)}return null};if(Object.prototype.hasOwnProperty.call(e,t))return n(e[t]);let i=null;for(let a of Object.keys(e)){let l=a.indexOf("*");if(l===-1)continue;let c=a.slice(0,l),b=a.slice(l+1);if(!t.startsWith(c)||!t.endsWith(b))continue;if(t.length<c.length+b.length)continue;if(!i||c.length>i.prefix.length)i={pattern:a,prefix:c,suffix:b}}if(i){let a=t.slice(i.prefix.length,t.length-i.suffix.length),l=n(e[i.pattern]);if(l)return l.replace("*",a)}return null}function Oa(e,t){let n=Aa(e);if(!n||!n.subpath)return null;let i=Ia(n.pkg,t);if(!i)return null;let a;try{a=JSON.parse(tn.readFileSync($t.join(i,"package.json"),"utf8"))}catch{return null}let l=`.${n.subpath}`,c=Pa(a.exports,l);if(!c)return null;let b=$t.resolve(i,c);return tn.existsSync(b)?b:null}function xi(e,t){let n=t.filePath?$t.dirname(t.filePath):t.projectRoot||process.cwd(),i=t.projectRoot||process.cwd(),a=new Set,l=[],c=[];return{code:e.replace(Ta,(v,T)=>{let P;try{if(T.startsWith("./")||T.startsWith("../")||T.startsWith("/")){if(P=T.startsWith("/")?T:$t.resolve(n,T),!tn.existsSync(P))throw Error(`file not found: ${P}`)}else{let D=null;try{D=Bun.resolveSync(T,i)}catch{D=Oa(T,i)}if(!D)throw Error(`could not resolve ${T} (Bun.resolveSync + exports fallback both failed)`);P=D}}catch(D){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(T)} (from ${t.filePath||"<unknown>"}): ${D?.message||D}`),c.push(T),""}if(a.has(P))return"";a.add(P);try{let D=tn.readFileSync(P,"utf8");l.push({source:T,resolvedPath:P,contents:D})}catch(D){console.warn(`[stx:vendor-css] could not read ${P}: ${D?.message||D}`),c.push(T)}return""}),styles:l,unresolved:c}}function Da(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Si(e){if(e.length===0)return"";return`${e.map((t)=>`<style data-stx-vendor="${Da(t.source)}" data-stx-layer="vendor">
|
|
115
|
+
`+a.slice(c);else a+=l;return a}function qr(e,t){let n=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(t){let l=a.lastIndexOf(":");if(l!==-1)a=a.slice(l+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))n.add(a)}return n}function Pt(e,t){let n=r(e),{depths:i,balanced:a}=me(n),l=(b)=>!a||i[b]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${t}\\b)`,"g");for(let b of n.matchAll(c)){let v=(b.index??0)+b[0].length-b[1].length;if(l(v))return!0}for(let b of n.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(b.index??0)&&qr(b[1],!0).has(t))return!0;for(let b of n.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(b.index??0)&&qr(b[1],!1).has(t))return!0;return!1}var Zr=new R(32,{maxBytes:2097152,sizeOf:(e)=>e.code.length*4}),yt=/^[A-Za-z_$][\w$]*$/,$a=new Set(["if","for","while","switch","with"]),Kr=["(","[","{"],Xr=[")","]","}"],va=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function Ea(e){let t=r(e),n=[];for(let i of t.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=i.index??0;n.push({text:i[0],start:a,end:a+i[0].length})}return{code:t,tokens:n}}function _s(e){let t=Zr.get(e);if(t)return t;let{code:n,tokens:i}=Ea(e),a=new Map,l=[];for(let B=0;B<i.length;B++){let ee=i[B].text;if(["(","[","{"].includes(ee))l.push(B);else if([")","]","}"].includes(ee)){let X=l.at(-1);if(X!==void 0&&["()","[]","{}"].includes(i[X].text+ee))l.pop(),a.set(X,B),a.set(B,X)}}function c(B,ee){let X=[],j=B;for(let te=B;te<ee;te++){if(["(","[","{"].includes(i[te].text)&&(a.get(te)??ee)<ee){te=a.get(te);continue}if(i[te].text===",")X.push([j,te]),j=te+1}return X.push([j,ee]),X}let b=[];function v(B,ee,X,j=!1){if(i[B]?.text==="...")B++;if(B>=ee)return;let te=i[B].text;if(yt.test(te)){if(X.add(te),X===D)b.push({name:te,token:B,functionScoped:j});return}if(te!=="{"&&te!=="[")return;let se=a.get(B);if(se===void 0||se>=ee)return;for(let[ne,ue]of c(B+1,se)){let ye=ne;if(te==="{")for(let de=ne;de<ue;de++){if(i[de].text===":"){ye=de+1;break}if(i[de].text==="=")break;if(["(","[","{"].includes(i[de].text)&&a.has(de))de=a.get(de)}v(ye,ue,X,j)}}function T(B,ee){let X=new Set;for(let[j,te]of c(B,ee))v(j,te,X);return X}function P(B){let ee=B;for(;ee<i.length;ee++){let X=i[ee].text;if(["(","[","{"].includes(X)&&a.has(ee)){ee=a.get(ee);continue}if([",",";",")","]","}"].includes(X))break}return i[Math.max(B,ee-1)]?.end??n.length}let D=new Set,H=[];for(let B=0;B<i.length;B++)if(i[B].text==="=>"){let ee=B-1,X=ee,j;if(i[ee]?.text===")"&&a.has(ee))X=a.get(ee),j=T(X+1,ee);else if(i[ee]&&yt.test(i[ee].text))j=new Set([i[ee].text]);else continue;let te=B+1,se=i[te]?.text==="{"&&a.has(te)?i[a.get(te)].end:P(te);H.push({start:i[X].start,end:se,bodyStart:i[te]?.start??se,functionBody:!0,names:j})}else if(i[B].text==="("&&a.has(B)){let ee=i[B-1]?.text;if(!ee||$a.has(ee)||!yt.test(ee)&&ee!=="*"&&ee!=="]")continue;let X=a.get(B),j=X+1;if(i[j]?.text===":"){j++;while(j<i.length&&!["{","=>",";","="].includes(i[j].text))j++}if(i[j]?.text!=="{"||!a.has(j))continue;H.push({start:i[B].start,end:i[a.get(j)].end,bodyStart:i[j].start,functionBody:ee!=="catch",names:T(B+1,X)})}function O(B){let ee=B;for(;ee<i.length;ee++){let X=i[ee].text;if(Kr.includes(X)&&a.has(ee)){ee=a.get(ee);continue}if(X===";"||Xr.includes(X))break;let j=i[ee-1];if(ee>B&&va.has(X)&&j.text!==".")break;if(ee>B&&/[\n\r]/.test(n.slice(j.end,i[ee].start))&&(/^[\w$]+$/.test(j.text)||Xr.includes(j.text)||['"',"'","`"].includes(j.text))&&yt.test(X)&&!["in","of","instanceof"].includes(X))break}return ee}let L=[];for(let B=0;B<i.length;B++){if(i[B].text!=="for")continue;let ee=i[B+1]?.text==="await"?B+2:B+1;if(i[ee]?.text!=="("||!a.has(ee))continue;let X=a.get(ee),j=X+1,te=i[j]?.text==="{"&&a.has(j)?a.get(j):O(j),se=i[te]?.text===";"||i[te]?.text==="}"?i[te].end:i[Math.max(j,te-1)]?.end??n.length;L.push({headStart:ee,headEnd:X,start:i[ee].start,end:se})}for(let B=0;B<i.length;B++){let ee=i[B].text,X=i[B-1]?.text;if(X==="."||i[B+1]?.text===":")continue;if(X==="as"||X==="<")continue;if(ee==="const"||ee==="let"||ee==="var"){let j=O(B+1),te=B+1,se=!1,ne=!1,ue=0;for(let ye=B+1;ye<=j;ye++){let de=i[ye]?.text;if(ye<j&&Kr.includes(de)&&a.has(ye)&&a.get(ye)<j){ye=a.get(ye);continue}if(ye<j&&de===":"&&!ne)se=!0;else if(ye<j&&de==="="&&ue===0)se=!1,ne=!0;else if(ye<j&&se&&de==="<")ue++;else if(ye<j&&se&&de===">"&&ue>0)ue--;else if(ye===j||de===","&&ue===0)v(te,ye,D,ee==="var"),te=ye+1,se=!1,ne=!1}}else if(ee==="function"||ee==="class"){let j=B+1;if(i[j]?.text==="*")j++;if(i[j]&&yt.test(i[j].text)&&i[j].text!=="extends")D.add(i[j].text),b.push({name:i[j].text,token:j})}else if(ee==="import"){let j=B+1;if(i[j]?.text==="*"&&i[j+1]?.text==="as")j+=2;let te=i[j]?.text;if(te&&yt.test(te)&&te!=="type"&&i[j+1]?.text!=="("&&i[j+1]?.text!==".")D.add(te),b.push({name:te,token:j,file:!0});let se=i[j]?.text==="{"?j:i[j+1]?.text===","&&i[j+2]?.text==="{"?j+2:-1;if(se!==-1&&a.has(se)){let ne=a.get(se);for(let[ue,ye]of c(se+1,ne)){let de=ye-1;while(de>=ue&&!yt.test(i[de].text))de--;if(de>=ue&&i[de].text!=="type")b.push({name:i[de].text,token:de,file:!0})}}}}let F={code:n,scopes:H,loops:L,declarations:D,sites:b,tokens:i,pairs:a};return Zr.set(e,F),F}function en(e){let t=_s(e);return{code:t.code,shadows:(n,i)=>t.scopes.some((a)=>i>=a.start&&i<a.end&&a.names.has(n))}}function zn(e){return new Set(_s(e).declarations)}function Oe(e,t){let{scopes:n,loops:i,sites:a,tokens:l,pairs:c}=_s(e),b=Array.from({length:l.length},()=>-1),v=[];for(let O=0;O<l.length;O++){b[O]=v.length?v[v.length-1]:-1;let L=l[O].text;if(L==="{"&&c.has(O))v.push(O);else if(L==="}"&&v.length&&c.get(O)===v[v.length-1])v.pop()}let T=new Set,P=new Map;for(let O of a){if(!t.has(O.name))continue;T.add(O.token);let L=O.file?-1:b[O.token],F=L===-1?[0,Number.POSITIVE_INFINITY]:[l[L].start,l[c.get(L)].end];if(O.functionScoped){let ee=l[O.token].start,X=n.filter((j)=>j.functionBody&&ee>=j.bodyStart&&ee<j.end).sort((j,te)=>j.end-j.bodyStart-(te.end-te.bodyStart))[0];F=X?[X.bodyStart,X.end]:[0,Number.POSITIVE_INFINITY]}else if(!O.file){let ee=i.filter((X)=>O.token>X.headStart&&O.token<X.headEnd).sort((X,j)=>X.headEnd-X.headStart-(j.headEnd-j.headStart))[0];if(ee)F=[ee.start,ee.end]}let B=P.get(O.name);if(B)B.push(F);else P.set(O.name,[F])}let D=new Set;for(let O=0;O<l.length;O++){if(l[O].text!=="import"||l[O-1]?.text===".")continue;let L=O+1;if(l[L]?.text==="type")L++;if(l[L]&&yt.test(l[L].text)&&l[L+1]?.text===",")L+=2;if(l[L]?.text==="{"&&c.has(L))for(let F=L+1;F<c.get(L);F++)D.add(F)}let H=new Set;for(let O=0;O<l.length;O++){let L=l[O].text;if(!t.has(L)||H.has(L)||T.has(O)||D.has(O))continue;let F=l[O-1]?.text;if(F==="#"||F==="."&&l[O-2]?.text!=="..")continue;if(l[O+1]?.text===":"&&(F==="{"||F===","))continue;let B=l[O].start;if(P.get(L)?.some(([ee,X])=>B>=ee&&B<X))continue;if(n.some((ee)=>B>=ee.start&&B<ee.end&&ee.names.has(L)))continue;H.add(L)}return H}var Ie="0.2.855";var Jr=Symbol.for(`stx.lazy-module-promises.${Ie}`);function Ca(){let e=globalThis;return e[Jr]??=new Map,e[Jr]}function o(e,t){let n=Ca(),i=`${import.meta.url}\x00${e}`,a=n.get(i);if(a)return a;let l=t();return n.set(i,l),l.catch(()=>{if(n.get(i)===l)n.delete(i)}),l}var Ra=/<\/(script)/gi;function gn(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(Ra,"<\\/$1")}import Gr from"fs";var Yr=[];function w(e){let t=new R(e);return Yr.push(t),t}function Lc(){for(let e of Yr)e.clear()}function S(e,...t){return`${t.map((n)=>String(n??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function Sr(e){let t=[];for(let n of new Set(e))try{t.push({path:n,mtimeMs:Gr.statSync(n).mtimeMs})}catch{}return t}function Fs(e){for(let t of e)try{if(Gr.statSync(t.path).mtimeMs!==t.mtimeMs)return!1}catch{return!1}return!0}var Se=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl"];var Ta=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function Aa(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let n=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!n)return null;return{pkg:n[1],subpath:n[2]||""}}let t=e.match(/^([^/]+)(\/.*)?$/);if(!t)return null;return{pkg:t[1],subpath:t[2]||""}}function Ia(e,t){let n=t;while(!0){let i=$t.join(n,"node_modules",e,"package.json");if(tn.existsSync(i))return $t.dirname(i);let a=$t.dirname(n);if(a===n)return null;n=a}}function Pa(e,t){if(!e||typeof e!=="object")return null;let n=(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 n(a.import);if(typeof a.default==="object")return n(a.default)}return null};if(Object.prototype.hasOwnProperty.call(e,t))return n(e[t]);let i=null;for(let a of Object.keys(e)){let l=a.indexOf("*");if(l===-1)continue;let c=a.slice(0,l),b=a.slice(l+1);if(!t.startsWith(c)||!t.endsWith(b))continue;if(t.length<c.length+b.length)continue;if(!i||c.length>i.prefix.length)i={pattern:a,prefix:c,suffix:b}}if(i){let a=t.slice(i.prefix.length,t.length-i.suffix.length),l=n(e[i.pattern]);if(l)return l.replace("*",a)}return null}function Oa(e,t){let n=Aa(e);if(!n||!n.subpath)return null;let i=Ia(n.pkg,t);if(!i)return null;let a;try{a=JSON.parse(tn.readFileSync($t.join(i,"package.json"),"utf8"))}catch{return null}let l=`.${n.subpath}`,c=Pa(a.exports,l);if(!c)return null;let b=$t.resolve(i,c);return tn.existsSync(b)?b:null}function xi(e,t){let n=t.filePath?$t.dirname(t.filePath):t.projectRoot||process.cwd(),i=t.projectRoot||process.cwd(),a=new Set,l=[],c=[];return{code:e.replace(Ta,(v,T)=>{let P;try{if(T.startsWith("./")||T.startsWith("../")||T.startsWith("/")){if(P=T.startsWith("/")?T:$t.resolve(n,T),!tn.existsSync(P))throw Error(`file not found: ${P}`)}else{let D=null;try{D=Bun.resolveSync(T,i)}catch{D=Oa(T,i)}if(!D)throw Error(`could not resolve ${T} (Bun.resolveSync + exports fallback both failed)`);P=D}}catch(D){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(T)} (from ${t.filePath||"<unknown>"}): ${D?.message||D}`),c.push(T),""}if(a.has(P))return"";a.add(P);try{let D=tn.readFileSync(P,"utf8");l.push({source:T,resolvedPath:P,contents:D})}catch(D){console.warn(`[stx:vendor-css] could not read ${P}: ${D?.message||D}`),c.push(T)}return""}),styles:l,unresolved:c}}function Da(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Si(e){if(e.length===0)return"";return`${e.map((t)=>`<style data-stx-vendor="${Da(t.source)}" data-stx-layer="vendor">
|
|
116
116
|
@layer vendor {
|
|
117
117
|
${t.contents}
|
|
118
118
|
}
|
|
@@ -182,7 +182,7 @@ else {
|
|
|
182
182
|
// STX: auto-generated event bindings
|
|
183
183
|
${e.map((n,i)=>Ha(n,i)).join(`
|
|
184
184
|
`)}`}function ni(e){let t=[],n=new Set,i=e.replace(/^\s*import\s+.*$/gm,""),a=0,l=i.length,c=0;while(c<l){let b=i[c];if(b==="'"||b==='"'||b==="`"){let v=b;if(c++,v==="`"){let T=0;while(c<l){if(i[c]==="\\"){c+=2;continue}if(i[c]==="`"&&T===0){c++;break}if(i[c]==="$"&&i[c+1]==="{"){T++,c+=2;continue}if(i[c]==="}"&&T>0){T--,c++;continue}c++}}else while(c<l){if(i[c]==="\\"){c+=2;continue}if(i[c]===v){c++;break}c++}continue}if(b==="/"&&i[c+1]==="/"){while(c<l&&i[c]!==`
|
|
185
|
-
`)c++;continue}if(b==="/"&&i[c+1]==="*"){c+=2;while(c<l-1&&!(i[c]==="*"&&i[c+1]==="/"))c++;c+=2;continue}if(b==="{"){a++,c++;continue}if(b==="}"){a--,c++;continue}if(a===0){let v=i.slice(c),T=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(T){let H=T[1];if(!H.startsWith("_")&&!n.has(H))t.push(H),n.add(H);c+=T[0].length;continue}let P=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(P){P[1].split(",").forEach((H)=>{let O=H.trim(),L=O.indexOf(":"),F=L>=0?O.slice(L+1).trim().split(/[\s=]/)[0]:O.split(/[\s=]/)[0];if(F&&!F.startsWith("_")&&!n.has(F))t.push(F),n.add(F)}),c+=P[0].length;continue}let D=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(D){let H=D[1];if(!H.startsWith("_")&&!n.has(H))t.push(H),n.add(H);c+=D[0].length;continue}}c++}return t}var Za=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 Ka(e){let t=new Set,n=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(H){let O;while((O=n.exec(H))!==null){let L=O[0];if(!Za.has(L))t.add(L)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)i(l[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=c.exec(e))!==null)i(l[1]);let b=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=b.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 T=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=T.exec(e))!==null)i(l[1]);let P=/@model\s*=\s*["']([^"']*)["']/gi;while((l=P.exec(e))!==null)i(l[1]);let D=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=D.exec(e))!==null)i(l[1]);return t}async function je(e,t={}){let n=e,i="",a=!1,l=[],c=xi(n,{filePath:t.filePath,projectRoot:t.projectRoot});n=c.code;let b=Si(c.styles),v=Lt(n);n=v.code,l=[...v.imports,...v.models];let{hasUserImports:T,bundleClientScript:P}=await o("stx/client-script-bundler",()=>import("./chunk-
|
|
185
|
+
`)c++;continue}if(b==="/"&&i[c+1]==="*"){c+=2;while(c<l-1&&!(i[c]==="*"&&i[c+1]==="/"))c++;c+=2;continue}if(b==="{"){a++,c++;continue}if(b==="}"){a--,c++;continue}if(a===0){let v=i.slice(c),T=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(T){let H=T[1];if(!H.startsWith("_")&&!n.has(H))t.push(H),n.add(H);c+=T[0].length;continue}let P=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(P){P[1].split(",").forEach((H)=>{let O=H.trim(),L=O.indexOf(":"),F=L>=0?O.slice(L+1).trim().split(/[\s=]/)[0]:O.split(/[\s=]/)[0];if(F&&!F.startsWith("_")&&!n.has(F))t.push(F),n.add(F)}),c+=P[0].length;continue}let D=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(D){let H=D[1];if(!H.startsWith("_")&&!n.has(H))t.push(H),n.add(H);c+=D[0].length;continue}}c++}return t}var Za=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 Ka(e){let t=new Set,n=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(H){let O;while((O=n.exec(H))!==null){let L=O[0];if(!Za.has(L))t.add(L)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)i(l[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=c.exec(e))!==null)i(l[1]);let b=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=b.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 T=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=T.exec(e))!==null)i(l[1]);let P=/@model\s*=\s*["']([^"']*)["']/gi;while((l=P.exec(e))!==null)i(l[1]);let D=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=D.exec(e))!==null)i(l[1]);return t}async function je(e,t={}){let n=e,i="",a=!1,l=[],c=xi(n,{filePath:t.filePath,projectRoot:t.projectRoot});n=c.code;let b=Si(c.styles),v=Lt(n);n=v.code,l=[...v.imports,...v.models];let{hasUserImports:T,bundleClientScript:P}=await o("stx/client-script-bundler",()=>import("./chunk-qccpfn5x.js"));if(T(n))n=await P(n,t.filePath||"",{projectRoot:t.projectRoot,minify:t.production}),a=!0;if(t.autoImports!==!1){let j=tl(n);n=j.code,i=nl(j.stxImports,j.browserImports.filter((te)=>!l.includes(te)))}if(i=`${vn(n,t.serverData)}${i}`,n=I(n),!a&&Be(t.attrs||""))n=Fe(n);let D=qa(t.eventBindings||[]),H=(t.attrs||"").trim(),O=/\btype\s*=\s*["']module["']/i.test(H),L=t.instanceId?` data-stx-instance="${t.instanceId}"`:"";if(O){let j=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),te=`type="module" data-stx-scoped${L}${j?` ${j}`:""}`;return`${b}<script ${te}>
|
|
186
186
|
${gn(`${i}${n}
|
|
187
187
|
${D}`)}
|
|
188
188
|
</script>`}let F=Di(e),B=/function __stx_setup_/.test(n),ee=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function X(j){let te=j.length>0?`
|
|
@@ -573,8 +573,8 @@ ${T.join(`
|
|
|
573
573
|
`){let L=e[a];if(L==="\\"){a+=2;continue}if(L==="[")O=!0;else if(L==="]")O=!1;else if(L==="/"&&!O){a++;while(a<l&&/[a-z]/i.test(e[a]))a++;return}a++}},H=()=>{if(i!==0)return;let O=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(O){let ee=O[2].split(",").map((X)=>{let j=X.trim().split(":");return j[j.length-1].trim()});for(let X of ee)if(X&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(X)&&!n.has(X))t.push(X),n.add(X);return}let L=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(L){let ee=L[2];if(!n.has(ee))t.push(ee),n.add(ee);return}let F=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let ee=F[1];if(!n.has(ee))t.push(ee),n.add(ee);return}let B=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let ee=B[1];if(!n.has(ee))t.push(ee),n.add(ee)}};while(a<l){if(v())continue;if(e[a]==="'"||e[a]==='"'){c(e[a]);continue}if(e[a]==="`"){b();continue}if(e[a]==="/"&&P()){D();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])))H();a++}return t}function hu(e){let t=[],n=0,i=0,a=null;for(let l=0;l<e.length;l++){let c=e[l];if(a){if(c==="\\"){l++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="("||c==="["||c==="{")n++;else if(c===")"||c==="]"||c==="}")n--;else if(c===","&&n===0)t.push(e.slice(i,l)),i=l+1}if(i<e.length)t.push(e.slice(i));return t}function xu(e){let t=0,n=null;for(let i=0;i<e.length;i++){let a=e[i];if(n){if(a==="\\"){i++;continue}if(a===n)n=null;continue}if(a==='"'||a==="'"||a==="`"){n=a;continue}if(a==="("||a==="["||a==="{")t++;else if(a===")"||a==="]"||a==="}")t--;else if(a==="="&&t===0){let l=e[i-1],c=e[i+1];if(l==="!"||l==="<"||l===">"||l==="=")continue;if(c==="="||c===">")continue;return i}}return-1}function bu(e,t){try{let n=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!n)return;let i=n.index-1;while(i>=0&&/\s/.test(e[i]))i--;if(e[i]!=="}")return;let a=i,l=0,c=-1;for(;i>=0;i--){let v=e[i];if(v==="}")l++;else if(v==="{"){if(l--,l===0){c=i;break}}}if(c===-1)return;let b=e.slice(c+1,a);for(let v of hu(b)){let T=v.trim();if(!T||T.startsWith("..."))continue;let P=xu(T);if(P===-1)continue;let D=T.slice(0,P).trim();if(!/^[A-Z_$][\w$]*$/i.test(D))continue;if(t[D]!==void 0)continue;let H=T.slice(P+1).trim();if(!H)continue;try{let O=Object.keys(t).filter(Ft),L=Function(...O,`"use strict"; return (${H});`);t[D]=L(...O.map((F)=>t[F]))}catch{}}}catch{}}var yu=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function Sg(e,t){let n=It(e),i=e.slice(n).match(/^<([a-zA-Z][a-zA-Z0-9-]*)/);if(!i)return null;let a=i[1].toLowerCase();if(!yu.has(a))return null;let l=new RegExp(`<\\/?${a}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),c=y(e,(P,D)=>(l.lastIndex=D,l.exec(P)?.index===D?l.lastIndex:-1));if(a==="span"&&/\sdata-stx-scope\s*=/.test(c[0]?.token||""))return null;let b=0,v=!1;for(let P of c){if(b+=P.token.startsWith("</")?-1:1,b<0)return null;if(b===0){if(e.slice(P.end).trim())return null;v=!0;break}}if(!v)return null;let T=n+i[0].length;return e.slice(0,T)+t+e.slice(T)}function Go(e,t){if(!e)return!1;return[...t.additionalComponentsDirs??[],...t.fallbackComponentsDir?[t.fallbackComponentsDir]:[]].some((i)=>{let a=ce.relative(ce.resolve(i),ce.resolve(e));return!a.startsWith("..")&&!ce.isAbsolute(a)})}async function Rr(e,t,n,i,a){let l=e.endsWith(".stx")?e.slice(0,-4):e,c=(ne)=>ne.split("-").map((ue)=>ue.charAt(0).toUpperCase()+ue.slice(1)).join(""),b=n.__importedComponents;if(b){for(let ne of[l,l.toLowerCase(),c(l),U(l)])if(b.has(ne))return!0}let v=[...new Set([`${l}.stx`,`${c(l)}.stx`,`${U(l)}.stx`])],T=typeof a.root==="string"?ce.resolve(a.root):void 0,P=T??ce.dirname(i),D=[],H=(ne)=>{if(ne&&!D.includes(ne))D.push(ne)};for(let ne of Ln(i,T))H(ne);let O=n.__originalFilePath;if(O)H(ce.join(ce.dirname(O),"components"));if(Go(t,a))H(a._rootComponentsDir);H(t),H(a._rootComponentsDir),H(ce.join(ce.dirname(i),"components")),H(a.componentsDir);for(let ne of a.additionalComponentsDirs??[])H(ne);let L=a._targetComponentFallbackNames?.some((ne)=>ne.toLowerCase()===l.toLowerCase());if(!L)for(let ne of a._targetComponentDirs??[])H(ne);if(T)H(ce.resolve(T,"resources/views/components")),H(ce.resolve(T,"resources/components")),H(ce.resolve(T,"src/components")),H(ce.resolve(T,"components"));for(let ne of a._layerComponentDirs??[])H(ne);let F=a._pluginComponentDirs;if(Array.isArray(F))for(let ne of F)H(typeof ne==="string"?ne:null);if(H(a.fallbackComponentsDir),L)for(let ne of a._targetComponentDirs??[])H(ne);let B=a._nativePrimitivesFallback;if(B&&!B.except.some((ne)=>ne.toLowerCase()===l.toLowerCase()))H(B.dir);if(l.startsWith("./")||l.startsWith("../"))return s(ce.resolve(ce.dirname(i),`${l}.stx`));let ee=Vo(ce.resolve(import.meta.dir,"components")),X=D.map((ne)=>ce.isAbsolute(ne)?ne:ce.resolve(P,ne)),j=`${v.join("\x00")}\x00\x00${X.join("\x00")}`,te=ur.get(j);if(te!==void 0)return te;let se=!1;e:for(let ne of X){if(Vo(ne)===ee)continue;for(let ue of v)if(await s(ce.join(ne,ue))){se=!0;break e}}return ur.set(j,se),se}function Vo(e){let t=fr.get(e);if(t!==void 0)return t;let n=e;try{n=rs.realpathSync(e)}catch{}return fr.set(e,n),n}function kg(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function rl(e){if(!e)return!1;let t=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(t)}function _u(e,t,n){if(!e.includes("{{")&&!e.includes("{!!"))return e;let i=(a,l)=>{let c;try{c=A(a,t)}catch{return l}if(c===void 0||c===null)return"";let b=String(c);if(/<\/style/i.test(b))return console.warn(`[stx] a <style> expression in ${n??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return b};return e.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>i(l,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,l)=>i(l,a))}var Uo=new Set;function Ho(e,t,n,i){let a=`${e}\x00${t}\x00${i??""}`;if(!process.env.STX_DEBUG&&Uo.has(a))return;Uo.add(a);let l=t?` used in ${t}`:"",c=i?` Cause: ${i}.`:"",b=n.length>0?`
|
|
574
574
|
searched:
|
|
575
575
|
${n.map((v)=>` - ${v}`).join(`
|
|
576
|
-
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${c}${b}`)}function qo(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var wu=new Set(["for","if","show","key","ref","class","className","style"]),Zo=new Set,Yo="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",sl=new RegExp(`\\b(?:${Yo})\\s*(?:<[^>]*>)?\\s*\\(`);function ki(e){let t=new Set,n=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|${Yo})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let i of e){let a;while((a=n.exec(i))!==null)t.add(a[1]);n.lastIndex=0}return[...t]}async function ze(e,t,n,i,a,l,c,b=new Set,v,T=st(a),P,D=e){let{extractVariables:H}=await o("stx/variable-extractor",()=>import("./chunk-qndtva3r.js")),O=b??new Set;if(O.has(e))return`[Circular component reference: ${e}]`;let L=new Set(O);L.add(e);let F=typeof t.client==="string"?t.client.trim():"";if("client"in t)delete t.client;let B=F&&F!=="load"&&kg(F)?F:"";try{let ee=(ie)=>ie.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""),X=D.endsWith(".stx")?D.slice(0,-4):D,j=null,te=a.__importedComponents;if(te){let ie=[X,X.toLowerCase(),ee(X),U(X)];for(let le of ie)if(te.has(le)){j=te.get(le);break}}let se=[];if(!j){let ie=[`${X}.stx`,`${ee(X)}.stx`,`${U(X)}.stx`],le=[...new Set(ie)],we=a.__originalFilePath,be=[];for(let _e of Ln(l))if(!be.includes(_e))be.push(_e);let Xe=be.length;for(let _e of c._layerComponentDirs??[])if(!be.includes(_e))be.push(_e);if(we){let _e=ce.join(ce.dirname(we),"components");be.push(_e)}let Te=c._rootComponentsDir;if(typeof Te==="string"&&Go(i,c)&&!be.includes(Te))be.push(Te);if(i&&!be.includes(i))be.push(i);if(typeof Te==="string"&&!be.includes(Te))be.push(Te);let mt=ce.join(ce.dirname(l),"components");if(!be.includes(mt))be.push(mt);if(c.componentsDir&&c.componentsDir!==i&&!be.includes(c.componentsDir))be.push(c.componentsDir);for(let _e of c.additionalComponentsDirs??[])if(_e&&!be.includes(_e))be.push(_e);let kt=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(X),bt=(P?.events??[]).map((_e)=>_e.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Rn=Object.hasOwn(t,"checked")||Boolean(P?.reactiveProps?.includes("checked")),fs=Object.hasOwn(t,"value")||Boolean(P?.reactiveProps?.includes("value")),ps=!bt.includes("valuechange")&&(Rn||bt.includes("change")&&!fs),wt=c._nativeHostAttrs&&/^textinput$/i.test(X),Ct=bt.includes("update:value")&&!bt.includes("input"),Qt=c._nativeHostAttrs&&/^video$/i.test(X),ds=c._nativeHostAttrs&&/^image$/i.test(X),Tn=Bs([...Object.keys(t),...P?.reactiveProps??[]],P?.events,t),Rt=Object.hasOwn(t,"src")||Boolean(P?.reactiveProps?.includes("src")),An=Object.hasOwn(t,"source")||Boolean(P?.reactiveProps?.includes("source")),In=Qt&&(Rt||An)&&(P?.events??[]).every((_e)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(_e.replace(/^@/,"").split(".")[0])),Pn=new Set(["","primary","secondary","outline","ghost","danger"]),On=typeof t.variant==="string"?t.variant.trim().toLowerCase():"",Dn=c._nativeHostAttrs&&/^button$/i.test(X)&&!Pn.has(On),wr=c._targetComponentFallbackNames?.some((_e)=>_e.toLowerCase()===X.toLowerCase())??!1,gs=wr&&(!kt||ps)&&(!wt||Ct)&&(!Qt||In)&&(!ds||Tn)&&!Dn;for(let _e of gs?[]:c._targetComponentDirs??[])if(_e&&!be.includes(_e))be.push(_e);let Tt=typeof c.root==="string"?ce.resolve(c.root):void 0,vr=Tt??ce.dirname(l),At=[];if(Tt)At.push(ce.resolve(Tt,"resources/views/components")),At.push(ce.resolve(Tt,"resources/components")),At.push(ce.resolve(Tt,"src/components")),At.push(ce.resolve(Tt,"components"));At.push(ce.resolve(import.meta.dir,"components"));for(let _e of At)if(!be.includes(_e))be.push(_e);if(wr){let _e=(c._componentPackageDirs??[]).filter((Qe)=>typeof Qe==="string"&&Qe.length>0),ht=(gs?_e.length?_e:c._pluginComponentDirs??[]:c._targetComponentDirs??[]).filter((Qe)=>typeof Qe==="string"&&Qe.length>0);if(ht.length){let Qe=be.slice(Xe).map((Ge)=>ce.isAbsolute(Ge)?Ge:ce.resolve(vr,Ge)).filter((Ge)=>!ht.includes(Ge)),jn=`${X}\x00${Qe.join("\x00")}`,at=lr.get(jn);if(at===void 0){at=!1;for(let Ge of Qe){for(let St of le)if(await s(ce.join(Ge,St))){at=!0;break}if(at)break}lr.set(jn,at)}if(!at){for(let Ge of ht){let St=be.indexOf(Ge);if(St>=0)be.splice(St,1)}be.splice(Xe,0,...ht)}}}let Ar=c._pluginComponentDirs;if(Array.isArray(Ar)){for(let _e of Ar)if(typeof _e==="string"&&!be.includes(_e))be.push(_e)}if(c.fallbackComponentsDir&&!be.includes(c.fallbackComponentsDir))be.push(c.fallbackComponentsDir);if(gs){for(let _e of c._targetComponentDirs??[])if(_e&&!be.includes(_e))be.push(_e)}let Mn=c._nativePrimitivesFallback;if(Mn&&!Mn.except.some((_e)=>_e.toLowerCase()===X.toLowerCase())&&!be.includes(Mn.dir))be.push(Mn.dir);let Ir=[...new Set(be.map((_e)=>{if(!_e)return _e;return ce.isAbsolute(_e)?_e:ce.resolve(vr,_e)}))];be.length=0,be.push(...Ir);let ms=`${X}\x00${l}\x00${Ir.join("\x00")}`,hs=ns.get(ms);if(hs)if(await s(hs))j=hs;else ns.delete(ms);if(!j&&(X.startsWith("./")||X.startsWith("../")))j=ce.resolve(ce.dirname(l),`${X}.stx`),se.push(j);else if(!j)for(let _e of be){if(!_e)continue;for(let ht of le){let Qe=ce.join(_e,ht);if(se.push(Qe),await s(Qe)){j=Qe;break}}if(j)break;if(!j)try{let ht=await import("fs");if(!ht.statSync(_e,{throwIfNoEntry:!1})?.isDirectory())continue;let jn=8,at=[{path:_e,depth:0}];while(at.length>0&&!j){let Ge=at.pop();if(Ge.depth>=jn)continue;let St;try{St=ht.readdirSync(Ge.path,{withFileTypes:!0})}catch{continue}for(let Nn of St){if(!Nn.isDirectory())continue;if(Nn.name==="node_modules"||Nn.name.startsWith("."))continue;let Pr=ce.join(Ge.path,Nn.name);for(let pa of le){let xs=ce.join(Pr,pa);if(se.push(xs),await s(xs)){j=xs;break}}if(j)break;at.push({path:Pr,depth:Ge.depth+1})}}}catch{}if(j)break}if(j)ns.set(ms,j)}if(!j||!await s(j))return Ho(e,l,se),qo(e);v.add(j);let ne;if(ln.has(j)&&cr.get(j)===Bo(j))ne=ln.get(j);else try{let ie=Bo(j);ne=await Bun.file(j).text(),ln.set(j,ne),cr.set(j,ie)}catch(ie){let le=ie instanceof Error?ie.message:String(ie);return Ho(e,l,[j],le),qo(e)}if(P)for(let ie of new Set([...Object.keys(t),...P.reactiveProps??[]])){let le=ie.toLowerCase();if(le.startsWith("aria-")||le.startsWith("data-"))continue;let we=ie.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${we}\\b`).test(ne))P.declaredProps.add(ie);if(new RegExp(`\\$props\\s*(?:\\.\\s*${we}\\b|\\[\\s*['"]${we}['"]\\s*\\])`).test(ne)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${we}['"]`).test(ne))P.consumedProps?.add(ie)}if(P?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(ne))for(let ie of P.reactiveProps){if(wu.has(ie)||P.consumedProps?.has(ie))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${ie.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(ne))continue;let le=`${j}\x00${ie}`;if(Zo.has(le))continue;Zo.add(le),console.warn(`[stx] ${ce.basename(j)} reads \`${ie}\` with defineProps(), which is not live, but ${ce.basename(l)} binds it (:${ie}): 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('${ie}').`)}let ue=new Set(["__originalFilePath","__importedComponents",Un,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),ye={};for(let[ie,le]of Object.entries(a))if(!ie.startsWith("__")||ue.has(ie))ye[ie]=le;let de=T.length>0?{[Jn]:[...T]}:{},Ae=n;if(n.includes("@include")){let{processIncludes:ie}=await o("stx/includes",()=>import("./chunk-7zhtnnzk.js"));Ae=await ie(n,a,l,c,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ae)){let{processComponents:ie}=await o("stx/component-renderer",()=>import("./chunk-w525ymys.js")),le={...a,__processedComponents:O,...de};Ae=await ie(Ae,le,l,c,v);let we=le.__stx_preserved_client_expressions;if(Array.isArray(we)&&we.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...we])]}let Ze=[];if(rl(Ae)){let{processExpressions:ie}=await o("stx/expressions",()=>import("./chunk-h8bqgjw4.js")),le=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...de}:T.length>0?{...a,...de}:a;Ae=ie(Ae,le,l);for(let we of Ae.matchAll(/\{\{([\s\S]*?)\}\}/g))Ze.push(we[1].trim())}let Re=J(Ae),Ke=[],Ye=Re.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(ie,le)=>{let we=Re.scripts[Number(le)]||"",be=we.match(/^<script\b([^>]*)>/i)?.[1]||"",Xe=be.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Te=!Xe||["module","text/javascript","application/javascript"].includes(Xe),mt=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${be}`);if(!/\bserver\b/i.test(be)&&Te&&!mt)return Ke.push(we),"";return we}),{extractSlotContent:Je}=await o("stx/slots",()=>import("./chunk-pyc91z27.js")),rt=Je(Ye),et={};if(rt.defaultSlot?.trim())et.default=rt.defaultSlot;for(let[ie,le]of rt.namedSlots)et[ie]=le.content;let _t=a.__stx_scope_seq??={n:0,key:Ks(String(a.__filename??l))},Vt=Jo(e,process.cwd()),ut=`stx_${(Vt.endsWith(".stx")?Vt.slice(0,-4):Vt).replace(/[^a-zA-Z0-9]/g,"_")}_${++_t.n}_${_t.key}`,We={...ye,$uid:ut,$native:c._nativeHostAttrs===!0,...t,props:t,slot:Ye,$slots:et,__processedComponents:L,__sections:{},__stx_signals_gate:ke(ne)||rl(n),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Ze]};if(/import\s/.test(ne)){We.__importedComponents=new Map(We.__importedComponents);let{processESImports:ie}=await o("stx/component-renderer",()=>import("./chunk-w525ymys.js"));ne=await ie(ne,We,j,c,v)}bu(ne,We);let Ut=ne,fn=pe(Ut);if(fn)Ut=fn.content.trim();let os=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Ht=[...ne.matchAll(os)];for(let[,ie,le]of Ht)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(ie))Ne(le,j,c.strict);let tt=[],qt=null,as=Ht.some((ie)=>/\bserver\b/.test(ie[1]||"")&&/\bcache\b/.test(ie[1]||"")),Et=null,ft=null,Zt=null,pn=0,Kt=null;if(fu(c),as&&pr>0){let ie=pu({props:t,slot:Ae,slotContext:n.trim()?du(ye):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...T].sort(),layers:c._layerGraph?.layers.map((le)=>le.configFile),uid:ut});if(ie!==null){Et=`${j}\x00${S(ne)}\x00${ie}`;let le=ss.get(Et);if(le){for(let we of le.dependencies)v.add(we);if(Ri(a,le.clientFactories),_t.n+=le.uidsConsumed,le.preservedClientExpressions.length>0){let we=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let be of le.preservedClientExpressions)we.add(be);a.__stx_preserved_client_expressions=[...we]}return le.output}ft=new Set(v),Zt=ci(a),pn=_t.n,Kt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Xt=new Set;for(let ie of Ht){let le=ie[1]||"",we=ie[2]||"",be=le.includes("server");if(Be(le)&&we.trim())we=Fe(we);if(be&&we){for(let Te of De(we))Xt.add(Te);try{await H(we,We,j,{onFailure:(Te)=>{if(Te.kind!=="unknown")qt=Te.kind}})}catch(Te){}}if(!be){let Te=we.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),mt=Te.includes("{{")&&Te.includes("}}"),kt=Te.includes("{!!")&&Te.includes("!!}");if(mt||kt)Te=Ci(Te,We,j);let bt=le.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");tt.push(`<script${bt}>${Te}</script>`)}}let nt=J(ne).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Jt=nt?nt[1]:"",cs=nt?nt[2]:"",pt="",re=Jt&&/\bscoped\b/i.test(Jt);if(nt)pt=`<style${Jt}>${_u(cs,We,j)}</style>`;let oe=Ut;if(oe=oe.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),nt)oe=oe.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let ie=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,le=[];if(oe=oe.replace(ie,(we,be)=>{let Xe=be.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Xe)le.push(`<style${Xe[1]}>${Xe[2]}</style>`);return""}),oe=oe.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),le.length>0)pt=`${pt}${le.join(`
|
|
577
|
-
`)}`}if(n&&oe.includes("{{ text || slot }}"))oe=oe.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>n);let{applySlots:he}=await o("stx/slots",()=>import("./chunk-
|
|
576
|
+
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${c}${b}`)}function qo(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var wu=new Set(["for","if","show","key","ref","class","className","style"]),Zo=new Set,Yo="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",sl=new RegExp(`\\b(?:${Yo})\\s*(?:<[^>]*>)?\\s*\\(`);function ki(e){let t=new Set,n=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|${Yo})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let i of e){let a;while((a=n.exec(i))!==null)t.add(a[1]);n.lastIndex=0}return[...t]}async function ze(e,t,n,i,a,l,c,b=new Set,v,T=st(a),P,D=e){let{extractVariables:H}=await o("stx/variable-extractor",()=>import("./chunk-eegs2at0.js")),O=b??new Set;if(O.has(e))return`[Circular component reference: ${e}]`;let L=new Set(O);L.add(e);let F=typeof t.client==="string"?t.client.trim():"";if("client"in t)delete t.client;let B=F&&F!=="load"&&kg(F)?F:"";try{let ee=(ie)=>ie.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""),X=D.endsWith(".stx")?D.slice(0,-4):D,j=null,te=a.__importedComponents;if(te){let ie=[X,X.toLowerCase(),ee(X),U(X)];for(let le of ie)if(te.has(le)){j=te.get(le);break}}let se=[];if(!j){let ie=[`${X}.stx`,`${ee(X)}.stx`,`${U(X)}.stx`],le=[...new Set(ie)],we=a.__originalFilePath,be=[];for(let _e of Ln(l))if(!be.includes(_e))be.push(_e);let Xe=be.length;for(let _e of c._layerComponentDirs??[])if(!be.includes(_e))be.push(_e);if(we){let _e=ce.join(ce.dirname(we),"components");be.push(_e)}let Te=c._rootComponentsDir;if(typeof Te==="string"&&Go(i,c)&&!be.includes(Te))be.push(Te);if(i&&!be.includes(i))be.push(i);if(typeof Te==="string"&&!be.includes(Te))be.push(Te);let mt=ce.join(ce.dirname(l),"components");if(!be.includes(mt))be.push(mt);if(c.componentsDir&&c.componentsDir!==i&&!be.includes(c.componentsDir))be.push(c.componentsDir);for(let _e of c.additionalComponentsDirs??[])if(_e&&!be.includes(_e))be.push(_e);let kt=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(X),bt=(P?.events??[]).map((_e)=>_e.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Rn=Object.hasOwn(t,"checked")||Boolean(P?.reactiveProps?.includes("checked")),fs=Object.hasOwn(t,"value")||Boolean(P?.reactiveProps?.includes("value")),ps=!bt.includes("valuechange")&&(Rn||bt.includes("change")&&!fs),wt=c._nativeHostAttrs&&/^textinput$/i.test(X),Ct=bt.includes("update:value")&&!bt.includes("input"),Qt=c._nativeHostAttrs&&/^video$/i.test(X),ds=c._nativeHostAttrs&&/^image$/i.test(X),Tn=Bs([...Object.keys(t),...P?.reactiveProps??[]],P?.events,t),Rt=Object.hasOwn(t,"src")||Boolean(P?.reactiveProps?.includes("src")),An=Object.hasOwn(t,"source")||Boolean(P?.reactiveProps?.includes("source")),In=Qt&&(Rt||An)&&(P?.events??[]).every((_e)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(_e.replace(/^@/,"").split(".")[0])),Pn=new Set(["","primary","secondary","outline","ghost","danger"]),On=typeof t.variant==="string"?t.variant.trim().toLowerCase():"",Dn=c._nativeHostAttrs&&/^button$/i.test(X)&&!Pn.has(On),wr=c._targetComponentFallbackNames?.some((_e)=>_e.toLowerCase()===X.toLowerCase())??!1,gs=wr&&(!kt||ps)&&(!wt||Ct)&&(!Qt||In)&&(!ds||Tn)&&!Dn;for(let _e of gs?[]:c._targetComponentDirs??[])if(_e&&!be.includes(_e))be.push(_e);let Tt=typeof c.root==="string"?ce.resolve(c.root):void 0,vr=Tt??ce.dirname(l),At=[];if(Tt)At.push(ce.resolve(Tt,"resources/views/components")),At.push(ce.resolve(Tt,"resources/components")),At.push(ce.resolve(Tt,"src/components")),At.push(ce.resolve(Tt,"components"));At.push(ce.resolve(import.meta.dir,"components"));for(let _e of At)if(!be.includes(_e))be.push(_e);if(wr){let _e=(c._componentPackageDirs??[]).filter((Qe)=>typeof Qe==="string"&&Qe.length>0),ht=(gs?_e.length?_e:c._pluginComponentDirs??[]:c._targetComponentDirs??[]).filter((Qe)=>typeof Qe==="string"&&Qe.length>0);if(ht.length){let Qe=be.slice(Xe).map((Ge)=>ce.isAbsolute(Ge)?Ge:ce.resolve(vr,Ge)).filter((Ge)=>!ht.includes(Ge)),jn=`${X}\x00${Qe.join("\x00")}`,at=lr.get(jn);if(at===void 0){at=!1;for(let Ge of Qe){for(let St of le)if(await s(ce.join(Ge,St))){at=!0;break}if(at)break}lr.set(jn,at)}if(!at){for(let Ge of ht){let St=be.indexOf(Ge);if(St>=0)be.splice(St,1)}be.splice(Xe,0,...ht)}}}let Ar=c._pluginComponentDirs;if(Array.isArray(Ar)){for(let _e of Ar)if(typeof _e==="string"&&!be.includes(_e))be.push(_e)}if(c.fallbackComponentsDir&&!be.includes(c.fallbackComponentsDir))be.push(c.fallbackComponentsDir);if(gs){for(let _e of c._targetComponentDirs??[])if(_e&&!be.includes(_e))be.push(_e)}let Mn=c._nativePrimitivesFallback;if(Mn&&!Mn.except.some((_e)=>_e.toLowerCase()===X.toLowerCase())&&!be.includes(Mn.dir))be.push(Mn.dir);let Ir=[...new Set(be.map((_e)=>{if(!_e)return _e;return ce.isAbsolute(_e)?_e:ce.resolve(vr,_e)}))];be.length=0,be.push(...Ir);let ms=`${X}\x00${l}\x00${Ir.join("\x00")}`,hs=ns.get(ms);if(hs)if(await s(hs))j=hs;else ns.delete(ms);if(!j&&(X.startsWith("./")||X.startsWith("../")))j=ce.resolve(ce.dirname(l),`${X}.stx`),se.push(j);else if(!j)for(let _e of be){if(!_e)continue;for(let ht of le){let Qe=ce.join(_e,ht);if(se.push(Qe),await s(Qe)){j=Qe;break}}if(j)break;if(!j)try{let ht=await import("fs");if(!ht.statSync(_e,{throwIfNoEntry:!1})?.isDirectory())continue;let jn=8,at=[{path:_e,depth:0}];while(at.length>0&&!j){let Ge=at.pop();if(Ge.depth>=jn)continue;let St;try{St=ht.readdirSync(Ge.path,{withFileTypes:!0})}catch{continue}for(let Nn of St){if(!Nn.isDirectory())continue;if(Nn.name==="node_modules"||Nn.name.startsWith("."))continue;let Pr=ce.join(Ge.path,Nn.name);for(let pa of le){let xs=ce.join(Pr,pa);if(se.push(xs),await s(xs)){j=xs;break}}if(j)break;at.push({path:Pr,depth:Ge.depth+1})}}}catch{}if(j)break}if(j)ns.set(ms,j)}if(!j||!await s(j))return Ho(e,l,se),qo(e);v.add(j);let ne;if(ln.has(j)&&cr.get(j)===Bo(j))ne=ln.get(j);else try{let ie=Bo(j);ne=await Bun.file(j).text(),ln.set(j,ne),cr.set(j,ie)}catch(ie){let le=ie instanceof Error?ie.message:String(ie);return Ho(e,l,[j],le),qo(e)}if(P)for(let ie of new Set([...Object.keys(t),...P.reactiveProps??[]])){let le=ie.toLowerCase();if(le.startsWith("aria-")||le.startsWith("data-"))continue;let we=ie.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${we}\\b`).test(ne))P.declaredProps.add(ie);if(new RegExp(`\\$props\\s*(?:\\.\\s*${we}\\b|\\[\\s*['"]${we}['"]\\s*\\])`).test(ne)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${we}['"]`).test(ne))P.consumedProps?.add(ie)}if(P?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(ne))for(let ie of P.reactiveProps){if(wu.has(ie)||P.consumedProps?.has(ie))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${ie.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(ne))continue;let le=`${j}\x00${ie}`;if(Zo.has(le))continue;Zo.add(le),console.warn(`[stx] ${ce.basename(j)} reads \`${ie}\` with defineProps(), which is not live, but ${ce.basename(l)} binds it (:${ie}): 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('${ie}').`)}let ue=new Set(["__originalFilePath","__importedComponents",Un,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),ye={};for(let[ie,le]of Object.entries(a))if(!ie.startsWith("__")||ue.has(ie))ye[ie]=le;let de=T.length>0?{[Jn]:[...T]}:{},Ae=n;if(n.includes("@include")){let{processIncludes:ie}=await o("stx/includes",()=>import("./chunk-5xcxc9f8.js"));Ae=await ie(n,a,l,c,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ae)){let{processComponents:ie}=await o("stx/component-renderer",()=>import("./chunk-5dykcrnv.js")),le={...a,__processedComponents:O,...de};Ae=await ie(Ae,le,l,c,v);let we=le.__stx_preserved_client_expressions;if(Array.isArray(we)&&we.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...we])]}let Ze=[];if(rl(Ae)){let{processExpressions:ie}=await o("stx/expressions",()=>import("./chunk-6w3gv9d6.js")),le=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...de}:T.length>0?{...a,...de}:a;Ae=ie(Ae,le,l);for(let we of Ae.matchAll(/\{\{([\s\S]*?)\}\}/g))Ze.push(we[1].trim())}let Re=J(Ae),Ke=[],Ye=Re.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(ie,le)=>{let we=Re.scripts[Number(le)]||"",be=we.match(/^<script\b([^>]*)>/i)?.[1]||"",Xe=be.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Te=!Xe||["module","text/javascript","application/javascript"].includes(Xe),mt=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${be}`);if(!/\bserver\b/i.test(be)&&Te&&!mt)return Ke.push(we),"";return we}),{extractSlotContent:Je}=await o("stx/slots",()=>import("./chunk-vbsr76qe.js")),rt=Je(Ye),et={};if(rt.defaultSlot?.trim())et.default=rt.defaultSlot;for(let[ie,le]of rt.namedSlots)et[ie]=le.content;let _t=a.__stx_scope_seq??={n:0,key:Ks(String(a.__filename??l))},Vt=Jo(e,process.cwd()),ut=`stx_${(Vt.endsWith(".stx")?Vt.slice(0,-4):Vt).replace(/[^a-zA-Z0-9]/g,"_")}_${++_t.n}_${_t.key}`,We={...ye,$uid:ut,$native:c._nativeHostAttrs===!0,...t,props:t,slot:Ye,$slots:et,__processedComponents:L,__sections:{},__stx_signals_gate:ke(ne)||rl(n),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Ze]};if(/import\s/.test(ne)){We.__importedComponents=new Map(We.__importedComponents);let{processESImports:ie}=await o("stx/component-renderer",()=>import("./chunk-5dykcrnv.js"));ne=await ie(ne,We,j,c,v)}bu(ne,We);let Ut=ne,fn=pe(Ut);if(fn)Ut=fn.content.trim();let os=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Ht=[...ne.matchAll(os)];for(let[,ie,le]of Ht)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(ie))Ne(le,j,c.strict);let tt=[],qt=null,as=Ht.some((ie)=>/\bserver\b/.test(ie[1]||"")&&/\bcache\b/.test(ie[1]||"")),Et=null,ft=null,Zt=null,pn=0,Kt=null;if(fu(c),as&&pr>0){let ie=pu({props:t,slot:Ae,slotContext:n.trim()?du(ye):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...T].sort(),layers:c._layerGraph?.layers.map((le)=>le.configFile),uid:ut});if(ie!==null){Et=`${j}\x00${S(ne)}\x00${ie}`;let le=ss.get(Et);if(le){for(let we of le.dependencies)v.add(we);if(Ri(a,le.clientFactories),_t.n+=le.uidsConsumed,le.preservedClientExpressions.length>0){let we=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let be of le.preservedClientExpressions)we.add(be);a.__stx_preserved_client_expressions=[...we]}return le.output}ft=new Set(v),Zt=ci(a),pn=_t.n,Kt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Xt=new Set;for(let ie of Ht){let le=ie[1]||"",we=ie[2]||"",be=le.includes("server");if(Be(le)&&we.trim())we=Fe(we);if(be&&we){for(let Te of De(we))Xt.add(Te);try{await H(we,We,j,{onFailure:(Te)=>{if(Te.kind!=="unknown")qt=Te.kind}})}catch(Te){}}if(!be){let Te=we.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),mt=Te.includes("{{")&&Te.includes("}}"),kt=Te.includes("{!!")&&Te.includes("!!}");if(mt||kt)Te=Ci(Te,We,j);let bt=le.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");tt.push(`<script${bt}>${Te}</script>`)}}let nt=J(ne).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Jt=nt?nt[1]:"",cs=nt?nt[2]:"",pt="",re=Jt&&/\bscoped\b/i.test(Jt);if(nt)pt=`<style${Jt}>${_u(cs,We,j)}</style>`;let oe=Ut;if(oe=oe.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),nt)oe=oe.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let ie=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,le=[];if(oe=oe.replace(ie,(we,be)=>{let Xe=be.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Xe)le.push(`<style${Xe[1]}>${Xe[2]}</style>`);return""}),oe=oe.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),le.length>0)pt=`${pt}${le.join(`
|
|
577
|
+
`)}`}if(n&&oe.includes("{{ text || slot }}"))oe=oe.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>n);let{applySlots:he}=await o("stx/slots",()=>import("./chunk-vbsr76qe.js")),{defaultSlot:$e,namedSlots:Pe}=rt,Ve=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(Ye),it=tt.length>0&&Zs(oe)||c._nativeHostAttrs===!0&&tt.length>0||Ve&&tt.length>0||tt.some((ie)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(ie)),ls=(ie)=>it?lo(ie,ut):ie,us=new Map([...Pe].map(([ie,le])=>[ie,{...le,content:ls(le.content)}]));oe=await he(oe,it?co(ls($e),ut):$e,us,We,it?ut:"");let dn=ki(tt),Gt=(Array.isArray(We.__stx_client_signal_names)?We.__stx_client_signal_names:[]).filter((ie)=>!Xt.has(ie));if(dn.length>0||Gt.length>0)We.__stx_client_signal_names=[...new Set([...Gt,...dn])];else delete We.__stx_client_signal_names;let Yt=T.filter((ie)=>!Xt.has(ie)&&!(ie in t));if(Yt.length>0)We[Jn]=Yt;let $n={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:ce.dirname(j),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||it||tt.length===0,defaultLayout:void 0};We.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:En}=await o("stx/process",()=>import("./chunk-vgaqznwt.js")),dt=await En(oe,We,j,$n,v),xt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let ie of dt.matchAll(/\{\{([\s\S]*?)\}\}/g))xt.add(ie[1].trim());if(xt.size>0)a.__stx_preserved_client_expressions=[...xt];let gt=ut,qe=dt;if(it){let ie="";if(Object.keys(t).length>0)try{ie=` data-stx-props="${or(JSON.stringify(t))}"`}catch{}let le=B?` stx-hydrate="${or(B)}"`:"",we=Object.fromEntries(Object.entries(et).map(([wt,Ct])=>[wt,Boolean(Ct)])),be=Object.keys(we).length>0?` data-stx-slots="${or(JSON.stringify(we))}"`:"",Xe=` data-stx-scope="${gt}"${ie}${be}${le}`,Te=dt.slice(It(dt)),mt=/^<span(?=[\s/>])/i.test(Te),kt=/^<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(Te),bt=/^<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(Te),Rn=mt?"span":"div",fs=kt&&c._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':bt&&c._nativeHostAttrs?' style="width:100%;height:100%"':mt||kt?' style="display:contents"':"";qe=Sg(dt,Xe)??`<${Rn}${Xe} data-stx-component-wrapper${fs}>${dt}</${Rn}>`;let ps=await Promise.all(tt.map(async(wt)=>{let Ct=wt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Ct)return wt;let[,Qt,ds]=Ct,Tn=zo(wt,We,j);if(Tn!==null)return Tn;let Rt=await $u(ds,j,c.buildMode==="compile"),An=vn(Rt.clientCode,Le(We)),{vendorStyleTags:In}=Rt,Pn=An?`function(__scopeId) {
|
|
578
578
|
${An}
|
|
579
579
|
return (${Rt.factoryBody})(__scopeId);
|
|
580
580
|
}`:Rt.factoryBody,On=B?null:Rs(a,Pn),Dn=On?`window.__stxComponentFactories[${JSON.stringify(On)}](${JSON.stringify(gt)});`:`(${Pn})(${JSON.stringify(gt)});`;if(B)return`${In}<script type="stx/island" data-stx-island="${gt}" data-stx-scoped data-stx-owner="${gt}"${Qt}>${Dn}</script>`;return`${In}<script data-stx-scoped data-stx-run="always" data-stx-owner="${gt}"${Qt}>${Dn}</script>`}));if(qe=qe+`
|
|
@@ -600,7 +600,7 @@ ${Ee.yellow}${Ee.bold}Message:${Ee.reset} ${t}
|
|
|
600
600
|
`,b)P+=`
|
|
601
601
|
${Ee.blue}${Ee.bold}Context:${Ee.reset}
|
|
602
602
|
${Ee.dim}${b}${Ee.reset}
|
|
603
|
-
`;return P}function ge(){ln.clear(),cr.clear(),ns.clear(),lr.clear(),ur.clear(),fr.clear(),ss.clear()}function iy(){return{size:ln.size,maxSize:500}}var ar=w(128);async function $u(e,t,n){let i=S(e,t,n),a=ar.get(i);if(a){if(Fs(a.deps))return a;ar.delete(i)}let l=xi(e,{filePath:t,projectRoot:process.cwd()}),c=l.code,b=Si(l.styles);c=Lt(c).code;let{hasUserImports:v,bundleClientScript:T}=await o("stx/client-script-bundler",()=>import("./chunk-
|
|
603
|
+
`;return P}function ge(){ln.clear(),cr.clear(),ns.clear(),lr.clear(),ur.clear(),fr.clear(),ss.clear()}function iy(){return{size:ln.size,maxSize:500}}var ar=w(128);async function $u(e,t,n){let i=S(e,t,n),a=ar.get(i);if(a){if(Fs(a.deps))return a;ar.delete(i)}let l=xi(e,{filePath:t,projectRoot:process.cwd()}),c=l.code,b=Si(l.styles);c=Lt(c).code;let{hasUserImports:v,bundleClientScript:T}=await o("stx/client-script-bundler",()=>import("./chunk-qccpfn5x.js")),P=[],D=!1;if(v(c)){let X=c;c=await T(X,t,{projectRoot:process.cwd(),minify:n,collectInputs:P}),D=c===X}let{stripStxRuntimeImports:H}=await o("stx/signal-processing",()=>import("./chunk-bk0arddt.js"));c=H(c);let O=I(c),L=mu(O),F=new Set(V(O,!0).split(",").map((X)=>X.trim())),B=`function(__scopeId) {
|
|
604
604
|
${lt("const",[...bl,...L],O)}
|
|
605
605
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
606
606
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{pa,am,fa,cm,Wl,ql,lm,um}from"./chunk-xn2gyhes.js";import"./chunk-pwem4sed.js";import"./chunk-pesgcwrj.js";import"./chunk-4cd94cd5.js";import"./chunk-hpwtjb4a.js";import"./chunk-4wrddn8m.js";import"./chunk-7hp50cpd.js";import"./chunk-zswtgwxg.js";import"./chunk-1qybwj8k.js";import"./chunk-qxk9grjm.js";import"./chunk-kvafq9gy.js";import"./chunk-tm8a2b69.js";import"./chunk-vw73gsxx.js";import"./chunk-9r999ees.js";import{ot,ig}from"./chunk-mv48q1p4.js";import"./chunk-e8zpzt9s.js";import"./chunk-v4bqmzj9.js";import"./chunk-0dmpc70r.js";import"./chunk-xppm4cs4.js";import"./chunk-ngnvyqk3.js";export{pa as buildScriptVirtualFile,am as buildVirtualSource,ot as extractScriptBlocks,ig as extractTemplateExpressions,Wl as findRuntimeTypeDeclarations,ql as findStxModuleDeclarations,um as formatTypecheckDiagnostics,cm as sourcePathFor,lm as typecheckStxFiles,fa as virtualPathFor};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{sr,Re}from"./chunk-hpwtjb4a.js";import{V,w,Sr,Fs,C}from"./chunk-5c5nr9sf.js";import{a,O}from"./chunk-ga0e15n5.js";import{Lo}from"./chunk-5t4k477c.js";import{rt}from"./chunk-car6nhfe.js";import{c}from"./chunk-ehp792dy.js";import{r,me}from"./chunk-7kc9xwht.js";import p from"path";import B from"fs";import{AsyncLocalStorage as xt}from"async_hooks";import{randomUUID as yt}from"crypto";var $t=11;function X(t,e,n){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(p.basename(t))||Lo(t,e,n)}var at=2;function $f(t){let e=process.env.STX_BUNDLE_CACHE_DIR?.trim();return e?p.resolve(e):c(t,"bundle-cache")}function nt(t,e){let n=t;for(let i of wt(e))if(i!==p.sep)n=n.split(i).join("\x00root");return n}var st=new Map;function wt(t){let e=p.resolve(t),n=st.get(e);if(!n){let i=e;try{i=B.realpathSync(e)}catch{}n=[...new Set([e,i])].sort((l,d)=>d.length-l.length),st.set(e,n)}return n}function bt(t,e){try{let n=B.statSync(t),i=p.resolve(e),l=t.startsWith(`${i}${p.sep}`);return{path:l?p.relative(i,t):t,...l?{inRoot:!0}:{},mtimeMs:n.mtimeMs,size:n.size,hash:Bun.hash(B.readFileSync(t)).toString(36)}}catch{return null}}function ct(t,e){return t.inRoot?p.join(p.resolve(e),t.path):t.path}function St(t,e){for(let n of t){let i=ct(n,e);try{let l=B.statSync(i);if(l.size!==n.size)return!1;if(l.mtimeMs!==n.mtimeMs&&Bun.hash(B.readFileSync(i)).toString(36)!==n.hash)return!1}catch{return!1}}return!0}var lt=new Map,vt=100;function Rf(t=process.env){let e=Number(t.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(e)&&e>=1?Math.floor(e):2000}var H=new Map;async function jt(t){let e=H.get(t)??0;if(e>0&&e<vt){H.set(t,e+1);return}H.set(t,1);try{let n=(await B.promises.readdir(t)).filter((o)=>o.endsWith(".js")),i=Rf();if(n.length<=i)return;let d=(await Promise.all(n.map(async(o)=>{try{return{name:o,at:(await B.promises.stat(p.join(t,o))).mtimeMs}}catch{return null}}))).filter((o)=>o!==null);d.sort((o,b)=>b.at-o.at);for(let o of d.slice(i)){let b=o.name.slice(0,-3);await B.promises.rm(p.join(t,`${b}.js`),{force:!0}),await B.promises.rm(p.join(t,`${b}.deps.json`),{force:!0})}A("pruned bundle cache to",i,"entries")}catch{}}function ye(t){return lt.get(t)??[]}function Z(t,e){if(t)lt.set(t,e)}function Af(t=process.env){return t.STX_DEBUG==="true"||t.STX_DEBUG==="1"}function A(...t){if(Af())console.log("[stx:bundler]",...t)}var K=[];function ac(t,e,n){K.push({filePath:t||"<inline>",message:e,details:n})}function rn(){return K.slice()}function sn(){K.length=0}var Q;function Ih(t){Q=t}function cc(){if(Q)return Q;try{let t=O.strict;return typeof t==="object"&&t!==null?t.bundlerFallback??"warn":"warn"}catch{return"warn"}}var Y=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function on(t){let e=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,n;while((n=e.exec(t))!==null){let l=n[1];if(!Y.some((o)=>o.test(l)))return A("detected user import:",l),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((n=i.exec(t))!==null){let l=n[1];if(/\.css(?:\?.*)?$/.test(l))continue;if(!Y.some((o)=>o.test(l)))return A("detected side-effect import:",l),!0}return!1}var rr="stx-module:",Bt=/\.(?:[cm]?[jt]sx?|json)$/i;function Pf(t,e){return p.relative(t,e).split(p.sep).join("/")}function If(t,e){if(e.size===0)return t;return t.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(n,i,l,d)=>{let o=e.get(d);return o&&!d.startsWith(rr)?`${i}${l}${o}${l}`:n})}function Of(t,e){let n=0,i=(d)=>{let o=`__stxMod${n++}`,b=JSON.stringify(d);return e.push(`var ${o} = globalThis.__stxModules && globalThis.__stxModules[${b}];`,`if (${o} === undefined) throw new Error("[stx] module " + ${JSON.stringify(b)} + " is not registered on this page (#1957)");`),o},l=(d,o)=>{for(let b of d.split(",")){let I=b.trim();if(!I)continue;let M=I.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!M)continue;let S=M[1].startsWith('"')?JSON.parse(M[1]):M[1],f=M[2]??S;e.push(`var ${f} = ${o}[${JSON.stringify(S)}];`)}};return t=t.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(d,o,b)=>{let I=b.slice(rr.length),M=i(I),S=o.trim(),f=S.match(/^([\w$]+)\s*(?:,\s*|$)/);if(f&&!S.startsWith("{")&&!S.startsWith("*"))e.push(`var ${f[1]} = ${M}.default;`),S=S.slice(f[0].length).trim();let v=S.match(/^\*\s*as\s+([\w$]+)$/);if(v)e.push(`var ${v[1]} = ${M};`);else if(S.startsWith("{"))l(S.replace(/^\{|\}$/g,""),M);return""}),t=t.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(d,o)=>(i(o.slice(rr.length)),"")),t}function it(t){let e=[t,`${t}.ts`,`${t}.tsx`,`${t}.js`,`${t}.mjs`,`${t}.jsx`,p.join(t,"index.ts"),p.join(t,"index.tsx"),p.join(t,"index.js"),p.join(t,"index.mjs")];for(let n of e)try{if(B.existsSync(n)&&B.statSync(n,{throwIfNoEntry:!1})?.isFile())return n}catch{}return}var G=new xt;function cs(t,e){let n=new Bun.CryptoHasher("md5");for(let[i,l]of[...t].sort(([d],[o])=>d<o?-1:d>o?1:0))n.update(`${i}\x00${l}\x00`);return G.run({modules:t,key:n.digest("hex").slice(0,12)},e)}function an(){return G.getStore()?.key??""}function ut(t,e,n,i,l,d,o=new Map,b,I,M){let S=new Map([[n,i],...M??[]]),f=(j)=>j!==void 0&&S.has(j),v=(j,s,u)=>{if(X(s,t,b))return null;if(!d||!f(j)||!Bt.test(s))return null;try{if(!B.statSync(s,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}l.add(s);let E=`${rr}${Pf(process.cwd(),s)}`;return o.set(u,E),{path:E,external:!0}},y=(j,s)=>{let u=f(j)?e:p.dirname(j),E=p.resolve(u,s);return it(E)??E};return{name:"stx-client-bundle",setup(j){if(j.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(s)=>({path:s.path,external:!0})),j.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(s)=>({path:s.path,external:!0})),j.onResolve({filter:/^\//},(s)=>{if(f(s.path))return{path:s.path};let u=it(s.path);if(u){let E=v(s.importer,u,s.path);if(E)return E;if(!f(u))l.add(u);return{path:u}}return{path:s.path,external:!0}}),j.onResolve({filter:/^\.\.?\//},(s)=>{let u=y(s.importer,s.path),E=v(s.importer,u,s.path);if(E)return E;return l.add(u),{path:u}}),j.onResolve({filter:/^[@~]\//},(s)=>{let u=p.resolve(t,s.path.slice(2)),E=[u,`${u}.ts`,`${u}.tsx`,`${u}.js`,`${u}.mjs`,`${u}.jsx`,p.join(u,"index.ts"),p.join(u,"index.tsx"),p.join(u,"index.js"),p.join(u,"index.mjs")];for(let h of E)if(B.existsSync(h)&&B.statSync(h,{throwIfNoEntry:!1})?.isFile()){let D=v(s.importer,h,s.path);if(D)return D;return A(`resolved ${s.path[0]}/ import:`,s.path,"\u2192",h),l.add(h),{path:h}}return console.warn(`[stx:bundler] could not resolve ${s.path[0]}/ import:`,s.path),{path:u}}),d)j.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(s)=>{if(!f(s.importer))return;let u=`${rr}npm:${s.path}`;return o.set(s.path,u),{path:u,external:!0}});j.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(s)=>{if(S.has(s.path))return{contents:S.get(s.path),loader:"ts"};if(X(s.path,t,b))throw Error(`Server-only API source cannot be imported by a client script: ${s.path}`);let u=p.extname(s.path).toLowerCase(),E=u===".json"?"json":u===".tsx"?"tsx":u===".jsx"?"jsx":u===".ts"||u===".mts"||u===".cts"?"ts":"js";if(!f(s.path))l.add(s.path);let h=I?.get(s.path);if(h!==void 0)return{contents:h,loader:"js"};return{contents:B.readFileSync(s.path,"utf8"),loader:E}})}}}var q=new Map,P=w(64),ot=Symbol.for("stx.client-bundle-build-queue");function Nf(t){let e=globalThis,i=(e[ot]??Promise.resolve()).then(t,t);return e[ot]=i.then(()=>{return},()=>{return}),i}async function cn(t,e,n={}){let i=n.projectRoot||process.cwd(),l=(await a(i)).serverApi,d=n.minify??!1,o=n.externalizeUserModules??!0,b=n.expose?.length?[...new Set(n.expose)].sort():void 0,I=n.cacheDir||$f(i),M=G.getStore(),S=new Bun.CryptoHasher("md5");S.update(`${$t}\x00${rt()}\x00${JSON.stringify(l??!1)}\x00${o?"registry":"inline"}\x00${b?b.join(","):"*"}\x00${d?"minified":"readable"}\x00${M?.key??""}\x00${nt(t,i)}\x00${nt(e,i)}`);let f=S.digest("hex").slice(0,12),v=p.join(I,`${f}.js`),y=P.get(v);if(y){if(Fs(y.files)&&y.files.every((h)=>!X(h.path,i,l))){A("memo hit:",f);let h=y.files.map((D)=>D.path);return Z(e,h),n.collectInputs?.push(...h),y.code}P.delete(v),A("memo invalidated by dep change:",f)}let j=p.join(I,`${f}.deps.json`),s=Bun.file(v);if(await s.exists()){let h=Bun.file(j),D=!1,k=null;if(await h.exists())try{let N=JSON.parse(await h.text());if(N.metadataVersion===at&&Array.isArray(N.files)&&St(N.files,i))k=Sr(N.files.map((g)=>ct(g,i))),D=k.length===N.files.length&&!k.some((g)=>X(g.path,i,l))}catch{D=!1}if(D){if(A("cache hit:",f),k)Z(e,k.map((U)=>U.path)),n.collectInputs?.push(...k.map((U)=>U.path));let N=await s.text(),g=new Date;if(B.promises.utimes(v,g,g).catch(()=>{}),k)P.set(v,{code:N,files:k});return N}A("cache invalidated by dep change:",f)}let u=q.get(f);if(u){let h=await u;if(n.collectInputs)n.collectInputs.push(...(P.get(v)?.files??[]).map((D)=>D.path));return h}let E=Nf(()=>Et(t,e,{projectRoot:i,minify:d,cacheDir:I,hash:f,cachePath:v,depsPath:j,collectInputs:n.collectInputs,externalizeUserModules:o,serverApi:l,expose:b,throwOnFailure:n.throwOnFailure,substitutes:M?.modules}));q.set(f,E);try{return await E}finally{q.delete(f)}}function lc(t){return`${t}-${process.pid}-${yt()}`}async function Oh(t,e){let{projectRoot:n}=e,i=lc(new Bun.CryptoHasher("md5").update([...t.keys()].join("\x00")).digest("hex").slice(0,12)),l=p.join(c(n,"bundle-tmp"),"out",i);B.mkdirSync(l,{recursive:!0});let d=new Map,o=new Map,b=0;for(let[f,v]of t){let y=p.join(n,`.stx-split-${i}-${b++}.ts`);d.set(y,v),o.set(p.basename(y).replace(/\.ts$/,""),f)}let[I,M]=[...d][0],S=new Set;try{let f=await Bun.build({entrypoints:[...d.keys()],outdir:l,target:"browser",format:"esm",splitting:!0,minify:!1,naming:{entry:"[name].js",chunk:"chunk-[hash].js"},plugins:[ut(n,p.dirname(e.filePath),I,M,S,!1,new Map,void 0,G.getStore()?.modules,d)],define:{"process.env.NODE_ENV":'"development"',...C()},root:n});if(!f.success)throw Error(f.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ")||"Unable to bundle the entries");let v={entries:new Map,chunks:new Map};for(let y of f.outputs){let j=p.basename(y.path);if(y.kind==="entry-point"){let s=o.get(j.replace(/\.js$/,""));if(s!==void 0)v.entries.set(s,await y.text())}else if(y.kind==="chunk")v.chunks.set(j.replace(/\.js$/,""),await y.text())}return e.collectInputs?.push(...S),v}finally{try{B.rmSync(l,{recursive:!0,force:!0})}catch{}}}async function Et(t,e,n){let{projectRoot:i,minify:l,cacheDir:d,hash:o,cachePath:b,depsPath:I,externalizeUserModules:M}=n,S=c(i,"bundle-tmp"),f=lc(o),v=p.join(i,`.stx-client-${f}.ts`),y=p.join(S,"out",f);B.mkdirSync(y,{recursive:!0});let j=p.dirname(e),s=new Set,u=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,E=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,h=r(t),{depths:D,balanced:k}=me(h),N=(R)=>!k||D[R]===0,g;while((g=u.exec(h))!==null){if(g[1])continue;if(!N(g.index))continue;if(g[2])g[2].split(",").forEach((R)=>{let m=_t(R);if(m)s.add(m)});else if(g[3])s.add(g[3])}while((g=E.exec(h))!==null){if(g[1])continue;if(!N(g.index))continue;s.add(g[2])}let U=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=U.exec(h))!==null){if(!N(g.index))continue;let R=/^\s*['"]([^'"]+)['"]/.exec(t.slice(g.index+g[0].length))?.[1];if(R&&Y.some((m)=>m.test(R)))continue;if(g[1])s.add(g[1]);if(g[2])s.add(g[2]);for(let m of(g[3]??"").split(",")){let _=m.trim();if(!_||/^type\s/.test(_))continue;let L=/\bas\s+(\w+)\s*$/.exec(_)?.[1]??/^\w+$/.exec(_)?.[0];if(L)s.add(L)}}for(let R of h.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let m of R[1].split(",")){let _=/\bas\s+(\w+)\s*$/.exec(m)?.[1]??/^\s*(\w+)\s*$/.exec(m)?.[1];if(_)s.delete(_)}let pt=s.size>0?`
|
|
2
|
+
import{sr,Re}from"./chunk-hpwtjb4a.js";import{V,w,Sr,Fs,C}from"./chunk-mv48q1p4.js";import{a,O}from"./chunk-1qybwj8k.js";import{Lo}from"./chunk-4cd94cd5.js";import{rt}from"./chunk-car6nhfe.js";import{c}from"./chunk-ehp792dy.js";import{r,me}from"./chunk-7kc9xwht.js";import p from"path";import B from"fs";import{AsyncLocalStorage as xt}from"async_hooks";import{randomUUID as yt}from"crypto";var $t=11;function X(t,e,n){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(p.basename(t))||Lo(t,e,n)}var at=2;function $f(t){let e=process.env.STX_BUNDLE_CACHE_DIR?.trim();return e?p.resolve(e):c(t,"bundle-cache")}function nt(t,e){let n=t;for(let i of wt(e))if(i!==p.sep)n=n.split(i).join("\x00root");return n}var st=new Map;function wt(t){let e=p.resolve(t),n=st.get(e);if(!n){let i=e;try{i=B.realpathSync(e)}catch{}n=[...new Set([e,i])].sort((l,d)=>d.length-l.length),st.set(e,n)}return n}function bt(t,e){try{let n=B.statSync(t),i=p.resolve(e),l=t.startsWith(`${i}${p.sep}`);return{path:l?p.relative(i,t):t,...l?{inRoot:!0}:{},mtimeMs:n.mtimeMs,size:n.size,hash:Bun.hash(B.readFileSync(t)).toString(36)}}catch{return null}}function ct(t,e){return t.inRoot?p.join(p.resolve(e),t.path):t.path}function St(t,e){for(let n of t){let i=ct(n,e);try{let l=B.statSync(i);if(l.size!==n.size)return!1;if(l.mtimeMs!==n.mtimeMs&&Bun.hash(B.readFileSync(i)).toString(36)!==n.hash)return!1}catch{return!1}}return!0}var lt=new Map,vt=100;function Rf(t=process.env){let e=Number(t.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(e)&&e>=1?Math.floor(e):2000}var H=new Map;async function jt(t){let e=H.get(t)??0;if(e>0&&e<vt){H.set(t,e+1);return}H.set(t,1);try{let n=(await B.promises.readdir(t)).filter((o)=>o.endsWith(".js")),i=Rf();if(n.length<=i)return;let d=(await Promise.all(n.map(async(o)=>{try{return{name:o,at:(await B.promises.stat(p.join(t,o))).mtimeMs}}catch{return null}}))).filter((o)=>o!==null);d.sort((o,b)=>b.at-o.at);for(let o of d.slice(i)){let b=o.name.slice(0,-3);await B.promises.rm(p.join(t,`${b}.js`),{force:!0}),await B.promises.rm(p.join(t,`${b}.deps.json`),{force:!0})}A("pruned bundle cache to",i,"entries")}catch{}}function ye(t){return lt.get(t)??[]}function Z(t,e){if(t)lt.set(t,e)}function Af(t=process.env){return t.STX_DEBUG==="true"||t.STX_DEBUG==="1"}function A(...t){if(Af())console.log("[stx:bundler]",...t)}var K=[];function ac(t,e,n){K.push({filePath:t||"<inline>",message:e,details:n})}function rn(){return K.slice()}function sn(){K.length=0}var Q;function Ih(t){Q=t}function cc(){if(Q)return Q;try{let t=O.strict;return typeof t==="object"&&t!==null?t.bundlerFallback??"warn":"warn"}catch{return"warn"}}var Y=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function on(t){let e=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,n;while((n=e.exec(t))!==null){let l=n[1];if(!Y.some((o)=>o.test(l)))return A("detected user import:",l),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((n=i.exec(t))!==null){let l=n[1];if(/\.css(?:\?.*)?$/.test(l))continue;if(!Y.some((o)=>o.test(l)))return A("detected side-effect import:",l),!0}return!1}var rr="stx-module:",Bt=/\.(?:[cm]?[jt]sx?|json)$/i;function Pf(t,e){return p.relative(t,e).split(p.sep).join("/")}function If(t,e){if(e.size===0)return t;return t.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(n,i,l,d)=>{let o=e.get(d);return o&&!d.startsWith(rr)?`${i}${l}${o}${l}`:n})}function Of(t,e){let n=0,i=(d)=>{let o=`__stxMod${n++}`,b=JSON.stringify(d);return e.push(`var ${o} = globalThis.__stxModules && globalThis.__stxModules[${b}];`,`if (${o} === undefined) throw new Error("[stx] module " + ${JSON.stringify(b)} + " is not registered on this page (#1957)");`),o},l=(d,o)=>{for(let b of d.split(",")){let I=b.trim();if(!I)continue;let M=I.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!M)continue;let S=M[1].startsWith('"')?JSON.parse(M[1]):M[1],f=M[2]??S;e.push(`var ${f} = ${o}[${JSON.stringify(S)}];`)}};return t=t.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(d,o,b)=>{let I=b.slice(rr.length),M=i(I),S=o.trim(),f=S.match(/^([\w$]+)\s*(?:,\s*|$)/);if(f&&!S.startsWith("{")&&!S.startsWith("*"))e.push(`var ${f[1]} = ${M}.default;`),S=S.slice(f[0].length).trim();let v=S.match(/^\*\s*as\s+([\w$]+)$/);if(v)e.push(`var ${v[1]} = ${M};`);else if(S.startsWith("{"))l(S.replace(/^\{|\}$/g,""),M);return""}),t=t.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(d,o)=>(i(o.slice(rr.length)),"")),t}function it(t){let e=[t,`${t}.ts`,`${t}.tsx`,`${t}.js`,`${t}.mjs`,`${t}.jsx`,p.join(t,"index.ts"),p.join(t,"index.tsx"),p.join(t,"index.js"),p.join(t,"index.mjs")];for(let n of e)try{if(B.existsSync(n)&&B.statSync(n,{throwIfNoEntry:!1})?.isFile())return n}catch{}return}var G=new xt;function cs(t,e){let n=new Bun.CryptoHasher("md5");for(let[i,l]of[...t].sort(([d],[o])=>d<o?-1:d>o?1:0))n.update(`${i}\x00${l}\x00`);return G.run({modules:t,key:n.digest("hex").slice(0,12)},e)}function an(){return G.getStore()?.key??""}function ut(t,e,n,i,l,d,o=new Map,b,I,M){let S=new Map([[n,i],...M??[]]),f=(j)=>j!==void 0&&S.has(j),v=(j,s,u)=>{if(X(s,t,b))return null;if(!d||!f(j)||!Bt.test(s))return null;try{if(!B.statSync(s,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}l.add(s);let E=`${rr}${Pf(process.cwd(),s)}`;return o.set(u,E),{path:E,external:!0}},y=(j,s)=>{let u=f(j)?e:p.dirname(j),E=p.resolve(u,s);return it(E)??E};return{name:"stx-client-bundle",setup(j){if(j.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(s)=>({path:s.path,external:!0})),j.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(s)=>({path:s.path,external:!0})),j.onResolve({filter:/^\//},(s)=>{if(f(s.path))return{path:s.path};let u=it(s.path);if(u){let E=v(s.importer,u,s.path);if(E)return E;if(!f(u))l.add(u);return{path:u}}return{path:s.path,external:!0}}),j.onResolve({filter:/^\.\.?\//},(s)=>{let u=y(s.importer,s.path),E=v(s.importer,u,s.path);if(E)return E;return l.add(u),{path:u}}),j.onResolve({filter:/^[@~]\//},(s)=>{let u=p.resolve(t,s.path.slice(2)),E=[u,`${u}.ts`,`${u}.tsx`,`${u}.js`,`${u}.mjs`,`${u}.jsx`,p.join(u,"index.ts"),p.join(u,"index.tsx"),p.join(u,"index.js"),p.join(u,"index.mjs")];for(let h of E)if(B.existsSync(h)&&B.statSync(h,{throwIfNoEntry:!1})?.isFile()){let D=v(s.importer,h,s.path);if(D)return D;return A(`resolved ${s.path[0]}/ import:`,s.path,"\u2192",h),l.add(h),{path:h}}return console.warn(`[stx:bundler] could not resolve ${s.path[0]}/ import:`,s.path),{path:u}}),d)j.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(s)=>{if(!f(s.importer))return;let u=`${rr}npm:${s.path}`;return o.set(s.path,u),{path:u,external:!0}});j.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(s)=>{if(S.has(s.path))return{contents:S.get(s.path),loader:"ts"};if(X(s.path,t,b))throw Error(`Server-only API source cannot be imported by a client script: ${s.path}`);let u=p.extname(s.path).toLowerCase(),E=u===".json"?"json":u===".tsx"?"tsx":u===".jsx"?"jsx":u===".ts"||u===".mts"||u===".cts"?"ts":"js";if(!f(s.path))l.add(s.path);let h=I?.get(s.path);if(h!==void 0)return{contents:h,loader:"js"};return{contents:B.readFileSync(s.path,"utf8"),loader:E}})}}}var q=new Map,P=w(64),ot=Symbol.for("stx.client-bundle-build-queue");function Nf(t){let e=globalThis,i=(e[ot]??Promise.resolve()).then(t,t);return e[ot]=i.then(()=>{return},()=>{return}),i}async function cn(t,e,n={}){let i=n.projectRoot||process.cwd(),l=(await a(i)).serverApi,d=n.minify??!1,o=n.externalizeUserModules??!0,b=n.expose?.length?[...new Set(n.expose)].sort():void 0,I=n.cacheDir||$f(i),M=G.getStore(),S=new Bun.CryptoHasher("md5");S.update(`${$t}\x00${rt()}\x00${JSON.stringify(l??!1)}\x00${o?"registry":"inline"}\x00${b?b.join(","):"*"}\x00${d?"minified":"readable"}\x00${M?.key??""}\x00${nt(t,i)}\x00${nt(e,i)}`);let f=S.digest("hex").slice(0,12),v=p.join(I,`${f}.js`),y=P.get(v);if(y){if(Fs(y.files)&&y.files.every((h)=>!X(h.path,i,l))){A("memo hit:",f);let h=y.files.map((D)=>D.path);return Z(e,h),n.collectInputs?.push(...h),y.code}P.delete(v),A("memo invalidated by dep change:",f)}let j=p.join(I,`${f}.deps.json`),s=Bun.file(v);if(await s.exists()){let h=Bun.file(j),D=!1,k=null;if(await h.exists())try{let N=JSON.parse(await h.text());if(N.metadataVersion===at&&Array.isArray(N.files)&&St(N.files,i))k=Sr(N.files.map((g)=>ct(g,i))),D=k.length===N.files.length&&!k.some((g)=>X(g.path,i,l))}catch{D=!1}if(D){if(A("cache hit:",f),k)Z(e,k.map((U)=>U.path)),n.collectInputs?.push(...k.map((U)=>U.path));let N=await s.text(),g=new Date;if(B.promises.utimes(v,g,g).catch(()=>{}),k)P.set(v,{code:N,files:k});return N}A("cache invalidated by dep change:",f)}let u=q.get(f);if(u){let h=await u;if(n.collectInputs)n.collectInputs.push(...(P.get(v)?.files??[]).map((D)=>D.path));return h}let E=Nf(()=>Et(t,e,{projectRoot:i,minify:d,cacheDir:I,hash:f,cachePath:v,depsPath:j,collectInputs:n.collectInputs,externalizeUserModules:o,serverApi:l,expose:b,throwOnFailure:n.throwOnFailure,substitutes:M?.modules}));q.set(f,E);try{return await E}finally{q.delete(f)}}function lc(t){return`${t}-${process.pid}-${yt()}`}async function Oh(t,e){let{projectRoot:n}=e,i=lc(new Bun.CryptoHasher("md5").update([...t.keys()].join("\x00")).digest("hex").slice(0,12)),l=p.join(c(n,"bundle-tmp"),"out",i);B.mkdirSync(l,{recursive:!0});let d=new Map,o=new Map,b=0;for(let[f,v]of t){let y=p.join(n,`.stx-split-${i}-${b++}.ts`);d.set(y,v),o.set(p.basename(y).replace(/\.ts$/,""),f)}let[I,M]=[...d][0],S=new Set;try{let f=await Bun.build({entrypoints:[...d.keys()],outdir:l,target:"browser",format:"esm",splitting:!0,minify:!1,naming:{entry:"[name].js",chunk:"chunk-[hash].js"},plugins:[ut(n,p.dirname(e.filePath),I,M,S,!1,new Map,void 0,G.getStore()?.modules,d)],define:{"process.env.NODE_ENV":'"development"',...C()},root:n});if(!f.success)throw Error(f.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ")||"Unable to bundle the entries");let v={entries:new Map,chunks:new Map};for(let y of f.outputs){let j=p.basename(y.path);if(y.kind==="entry-point"){let s=o.get(j.replace(/\.js$/,""));if(s!==void 0)v.entries.set(s,await y.text())}else if(y.kind==="chunk")v.chunks.set(j.replace(/\.js$/,""),await y.text())}return e.collectInputs?.push(...S),v}finally{try{B.rmSync(l,{recursive:!0,force:!0})}catch{}}}async function Et(t,e,n){let{projectRoot:i,minify:l,cacheDir:d,hash:o,cachePath:b,depsPath:I,externalizeUserModules:M}=n,S=c(i,"bundle-tmp"),f=lc(o),v=p.join(i,`.stx-client-${f}.ts`),y=p.join(S,"out",f);B.mkdirSync(y,{recursive:!0});let j=p.dirname(e),s=new Set,u=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,E=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,h=r(t),{depths:D,balanced:k}=me(h),N=(R)=>!k||D[R]===0,g;while((g=u.exec(h))!==null){if(g[1])continue;if(!N(g.index))continue;if(g[2])g[2].split(",").forEach((R)=>{let m=_t(R);if(m)s.add(m)});else if(g[3])s.add(g[3])}while((g=E.exec(h))!==null){if(g[1])continue;if(!N(g.index))continue;s.add(g[2])}let U=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=U.exec(h))!==null){if(!N(g.index))continue;let R=/^\s*['"]([^'"]+)['"]/.exec(t.slice(g.index+g[0].length))?.[1];if(R&&Y.some((m)=>m.test(R)))continue;if(g[1])s.add(g[1]);if(g[2])s.add(g[2]);for(let m of(g[3]??"").split(",")){let _=m.trim();if(!_||/^type\s/.test(_))continue;let L=/\bas\s+(\w+)\s*$/.exec(_)?.[1]??/^\w+$/.exec(_)?.[0];if(L)s.add(L)}}for(let R of h.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let m of R[1].split(",")){let _=/\bas\s+(\w+)\s*$/.exec(m)?.[1]??/^\s*(\w+)\s*$/.exec(m)?.[1];if(_)s.delete(_)}let pt=s.size>0?`
|
|
3
3
|
export { ${[...s].join(", ")} }`:"";A("bundling:",o,"from:",p.basename(e));let tt=new Set,et=new Map;try{let R=await Bun.build({entrypoints:[v],outdir:y,target:"browser",format:"esm",minify:l?{whitespace:!1,identifiers:!0,syntax:!0}:!1,plugins:[ut(i,j,v,t+pt,tt,M,et,n.serverApi,n.substitutes)],define:{"process.env.NODE_ENV":l?'"production"':'"development"',...C()},root:i});if(!R.success){let F=R.logs.filter((T)=>T.level==="error").map((T)=>T.message).join(", ")||`Unable to bundle ${p.basename(e)}`,z=sr(R.logs,e||void 0);if(console.warn("[stx:bundler] build failed:",F),ac(e||"",F,z),n.throwOnFailure||cc()==="error")throw Error(F);return t}let m="";for(let x of R.outputs){m=await x.text();break}let _=[];for(let x of m.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let F of x[1].split(",")){let z=F.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(z){_.push([z[2],z[1]]);continue}let T=F.trim();if(/^[A-Za-z_$][\w$]*$/.test(T))_.push([T,T])}if(n.expose){let x=new Set(n.expose);for(let F=_.length-1;F>=0;F--)if(!x.has(_[F][0]))_.splice(F,1)}let L=[];m=Of(If(m,et),L);let dt=m.match(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm)||[];if(m=m.replace(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),l&&m)try{m=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(m)}catch{}let J=`__stxBundle_${o}`,ft=new Set(V(t,!0).split(",").map((x)=>x.trim())),mt=_.map(([x,F])=>`get ${JSON.stringify(x)}() { return ${F} }${ft.has(x)?`, set ${JSON.stringify(x)}(__stxValue_${F}) { ${F} = __stxValue_${F} }`:""}`).join(", "),gt=_.map(([x])=>`var ${x} = undefined;`).join(`
|
|
4
4
|
`),ht=_.map(([x])=>`${x} = ${J}[${JSON.stringify(x)}];`).join(`
|
|
5
5
|
`);if(m=`${dt.join(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{hs,Hf,Uo,Vf}from"./chunk-
|
|
2
|
+
import{hs,Hf,Uo,Vf}from"./chunk-279n7sde.js";import"./chunk-v8p8t3t4.js";import"./chunk-4wrddn8m.js";import"./chunk-7hp50cpd.js";import"./chunk-zswtgwxg.js";import"./chunk-1qybwj8k.js";import"./chunk-qxk9grjm.js";import"./chunk-kvafq9gy.js";import"./chunk-tm8a2b69.js";import"./chunk-vw73gsxx.js";import"./chunk-9r999ees.js";import{Nt}from"./chunk-mv48q1p4.js";import"./chunk-e8zpzt9s.js";import"./chunk-v4bqmzj9.js";import"./chunk-0dmpc70r.js";import"./chunk-xppm4cs4.js";import"./chunk-ngnvyqk3.js";export{Vf as declareBareLoopHead,Nt as parseLoopBinding,Hf as processLoops,Uo as processLoopsAsync,hs as reportDeferredLoopWarnings};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Oe,w,S,C,Z}from"./chunk-
|
|
2
|
+
import{Oe,w,S,C,Z}from"./chunk-mv48q1p4.js";import{k}from"./chunk-ngnvyqk3.js";import{I,An}from"./chunk-xppm4cs4.js";import{a}from"./chunk-1qybwj8k.js";import{ye,on,an,cn}from"./chunk-pesgcwrj.js";import{xt}from"./chunk-4wrddn8m.js";import{yt,Wn,Zt,le}from"./chunk-z0qfspzg.js";import{T,Rn}from"./chunk-ym5qgw03.js";import h from"path";var v=new Map,A=new Map,E=w(64),F=new Map,Y=["composables","functions"];function H(e){let s=h.basename(e,".ts");return s==="index"||s==="types"||e.endsWith(".d.ts")}async function ee(e){if(e)return h.resolve(e);let s=`<default>:${process.cwd()}`,r=F.get(s);if(r!==void 0)return r;let t=await te();if(t!==null)F.set(s,t);return t}async function te(){let e=await a(),s=e.root||process.cwd(),r=e.composablesDir;if(r)return h.resolve(s,r);for(let t of Y){let n=h.resolve(s,t);try{let c=new Bun.Glob("**/*.ts");for await(let i of c.scan({cwd:n,absolute:!0}))if(!H(i))return n}catch{}}return null}async function W(e){let s=Array.isArray(e)?e:e?[h.resolve(e)]:(await a())._layerComposableDirs??[await ee()].filter((t)=>!!t),r=new Map;for(let t of s){let n=new Bun.Glob("**/*.ts");try{for await(let c of n.scan({cwd:t,absolute:!0})){let i=h.relative(t,c);if(!H(c)&&!r.has(i))r.set(i,c)}}catch{}}return{key:s.join("\x00"),files:[...r.values()].sort()}}async function ko(e){let{files:s}=await W(e),r=Z({loader:"ts",target:"browser",define:C()}),t=[];for(let n of s)try{let c=await Bun.file(n).text(),i=r.scan(c).exports.filter((u)=>u!=="default");if(i.length>0)t.push({file:n,names:i})}catch{}return t}function ne(e,s){return new RegExp(`\\b${s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(e)}function R(e,s){let r=new Set(e.match(/\w+/g)),t=new Set;for(let n of s)if(/^\w+$/.test(n)?r.has(n):ne(e,n))t.add(n);return t}var J=w(64);function X(e,s){let r=S(e,s.size),t=J.get(r);if(t)return t;let n;try{n=Oe(e,s)}catch{n=R(e,s)}let c=[...e.matchAll(/(?:const|let|var)\s*\{([^}]*)\}\s*=\s*window\.__composables\u0008/g),...e.matchAll(/import\s*\{([^}]*)\}\s*from\s*['"]@composables['"]/g)];for(let i of c)for(let u of i[1].split(",")){let f=u.trim().split(/\s*(?::|\u0008as\u0008)\s*/)[0];if(f&&s.has(f))n.add(f)}return J.set(r,n),n}function se(e){return!e||/^(?:module|(?:text|application)\/(?:java|ecma)script|application\/stx-[\w-]+)$/i.test(e)}var L=w(256);function oe(e,s){let r=new Set(s),t="",n=0,c=new Set;for(let i of e.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi)){t+=e.slice(n,i.index),n=i.index+i[0].length;let u=i[1]??"",f=i[2]??"",d=/\btype\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i.exec(u),m=d?(d[1]??d[2]??d[3]??"").trim():void 0;if(!se(m)){if(!/json/i.test(m??""))t+=` ${f} `;continue}let y=R(f,r);if(y.size===0)continue;let _=S(f,[...y].sort().join(",")),b=L.get(_);if(!b)b=X(f,y),L.set(_,b);for(let B of b)c.add(B)}t+=e.slice(n);for(let i of R(t,r))c.add(i);return c}function ie(e,s,r){let t=new Map;for(let{file:f,names:d}of e)for(let m of d)if(!t.has(m))t.set(m,f);let n=new Set(t.keys()),c=(f)=>{let d=[];for(let m of X(f,n))d.push(t.get(m));return d},i=new Set,u=r.flatMap((f,d)=>d===0?[...oe(f,t.keys())].map((m)=>t.get(m)):c(f));while(u.length>0){let f=[];for(let d of u){if(i.has(d))continue;i.add(d);for(let m of c(s.get(d)??""))if(!i.has(m))f.push(m)}u=f}return i}async function bh(e,s,r,t){let{key:n,files:c}=await W(e);if(!n)return null;let i=()=>[...new Set([...c,...c.flatMap((o)=>ye(o))])],u=yt(i());if(c.length===0)return le(v,n,u,""),null;c.sort();let f=Z({loader:"ts",target:"browser",define:C()}),d=Zt(A,n,u);if(!d){let o=new Map,l=[];for(let p of c)try{let x=await Bun.file(p).text();o.set(p,x);let g=f.scan(x).exports.filter((V)=>V!=="default");if(g.length>0)l.push({file:p,names:g})}catch{o.set(p,"")}d=le(A,n,u,{codeByFile:o,modules:l})}let{codeByFile:m,modules:y}=d,_;if(s===void 0)_=new Set(c);else{let o=r?[s,...r]:[s],l=S(o.join("\x00"),n,o.length,u),p=E.get(l);if(_=p??ie(y,m,o),!p)E.set(l,_)}if(_.size===0)return null;let b=c.filter((o)=>_.has(o)),B=()=>{if(!t)return;for(let o of b)t.push(o,...ye(o))},N=`${n}\x00${b.join("\x00")}\x00${an()}`,P=Zt(v,N,u);if(P!==void 0)return B(),P||null;let D=[],M=new Set,U=new Set;for(let o of b)try{let l=m.get(o)??await Bun.file(o).text(),p=h.basename(o,".ts");for(let g of l.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(g[1])U.add(g[1]);let x=[];try{for(let g of f.scan(l).exports)if(g!=="default")M.add(g),x.push(g)}catch{}if(l=I(l),on(l))l=await cn(l,o,{projectRoot:process.cwd(),externalizeUserModules:!1,expose:x}),l=xt(l);l=An(l),l=l.replace(/^export\s+(default\s+)?/gm,""),l=f.transformSync(l),D.push(`// Composable: ${p}
|
|
3
3
|
${l.trim()}`)}catch(l){console.warn(`[stx] Failed to load composable ${o}:`,l)}if(D.length===0||M.size===0)return le(v,N,u,""),null;let q=[...M].map((o)=>` try { if (!(${JSON.stringify(o)} in __c)) __c[${JSON.stringify(o)}] = ${o}; } catch (e) {}`).join(`
|
|
4
4
|
`),z=JSON.stringify([...M]),j=D.join(`
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{xl,Sl}from"./chunk-ngnvyqk3.js";import{f,P,it,d}from"./chunk-0dmpc70r.js";import{U,xr,Ls,js,ui,di,Bs,Ot,Me,fe,J,_r,Cr,ae,Y,N,st,Er,mi,Rr,ze,s,p,W,kn}from"./chunk-5c5nr9sf.js";import{n}from"./chunk-hxz5cd52.js";import{ie}from"./chunk-v8p8t3t4.js";import{lr}from"./chunk-14cvwsy1.js";import{r}from"./chunk-7kc9xwht.js";import{h}from"./chunk-kgrvvtcy.js";import{createHash as kt}from"crypto";import ee from"fs";import K from"path";import Le from"fs";function Ae(e,i,t){let o=Buffer.alloc(t),a=Le.readSync(e,o,0,t,i);return o.subarray(0,a)}function Ue(e){if(e.length<25)return!1;let i=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(i(0,4)!=="RIFF"||i(8,12)!=="WEBP")return!1;let t=i(12,16);if(t==="VP8X")return(e[20]&16)!==0;if(t==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Fe(e){let i;try{i=Le.openSync(e,"r");let t=Ae(i,0,33);if(t.length>=3&&t[0]===255&&t[1]===216&&t[2]===255)return"none";if(t.length>=26&&t[0]===137&&t.toString("latin1",1,4)==="PNG"){let o=t[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ae(i,a,8);if(l.length<8)return"unknown";let u=l.toString("latin1",4,8);if(u==="tRNS")return"possible";if(u==="IDAT"||u==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(t.length>=25&&t.toString("latin1",0,4)==="RIFF"&&t.toString("latin1",8,12)==="WEBP"){if(Ue(t))return"possible";let o=t.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(i!==void 0)Le.closeSync(i)}}import rn from"fs";import We from"os";import{fileURLToPath as yt}from"url";var _e=Symbol("stx.image-worker.unavailable");function sn(e=typeof We.availableParallelism==="function"?We.availableParallelism():We.cpus().length){return Math.max(1,Math.min(2,e-1))}var Pe=0,xt=[];async function on(){if(Pe<sn()){Pe++;return}await new Promise((e)=>xt.push(e)),Pe++}function an(){Pe--,xt.shift()?.()}var cn="@stacksjs/stx/builtins/image-warmup-worker";function ln(e=process.cwd()){let i=import.meta.url.endsWith(".ts")?"ts":"js";try{let t=new URL(`./image-warmup-worker.${i}`,import.meta.url);if(t.protocol==="file:"&&rn.existsSync(yt(t)))return yt(t)}catch{}return lr(cn,e)}var bt=!1;function ge(e){if(!bt)bt=!0,console.warn(`[stx] image worker unavailable (${e}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return _e}function Ie(e){return e instanceof Error?e.message:String(e)}async function He(e,i){let t;try{t=(await import("worker_threads")).Worker}catch(a){return ge(`could not load node:worker_threads: ${Ie(a)}`)}if(typeof t!=="function")return ge("node:worker_threads has no Worker in this runtime");let o=ln();if(!o)return ge("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await on();try{return await new Promise((a,c)=>{let l;try{l=new t(o)}catch(y){a(ge(`could not start ${o}: ${Ie(y)}`));return}let u=!1,g=!1,x=(y)=>{if(g)return;g=!0,y(),l.terminate()};l.on("message",(y)=>{if(y.type==="ready"){u=!0,l.postMessage({task:e,args:i});return}if(y.type==="result"){x(()=>a(y.value));return}let m=Error(y.error?.message??"image worker failed");if(y.error?.name)m.name=y.error.name;if(y.error?.stack)m.stack=y.error.stack;x(()=>c(m))}),l.on("error",(y)=>{x(()=>u?c(y instanceof Error?y:Error(Ie(y)||"image worker crashed")):a(ge(`the worker failed before it was ready: ${Ie(y)}`)))}),l.on("exit",(y)=>{x(()=>u?c(Error("image worker exited before it finished")):a(ge(`the worker exited with code ${y} before it was ready`)))})})}finally{an()}}var un=new Set([".avif",".jpeg",".jpg",".png",".webp"]),fn=[320,640,960,1280,1920],ve="/_stx/images",dn=`stx:${ve}:alpha-1`,gn=`stx:${ve}:opaque-1`,pn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Ee;function mn(e,i){let t=K.dirname(Bun.resolveSync(e,i));while(t!==K.dirname(t)){let o=K.join(t,"package.json");if(ee.existsSync(o)){let a=JSON.parse(ee.readFileSync(o,"utf8"));if(a.name===e)return a.version}t=K.dirname(t)}return}function vt(){if(Ee!==void 0)return Ee;let e;try{e=K.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Ee=pn.map((i)=>{let t;try{t=e?mn(i,e):void 0}catch{}return`${i.replace("@stacksjs/","")}@${t??"unknown"}`}).join("+"),Ee}var wt=Symbol.for("stx.image-delivery");function we(){let e=globalThis;return e[wt]??={catalog:new Map,transparent:new Set},e[wt]}var $t=new Set;function hn(e){return`/${e.split(K.sep).map(encodeURIComponent).join("/")}`}function yn(e){let i=K.extname(e),t=e.slice(0,-i.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=kt("sha256").update(e).digest("hex").slice(0,8);return`${t||"image"}-${o}`}function St(e,i=`stx:${ve}`){let t=(o)=>`${ve}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:i,async stat(o){let a=K.join(e,o);try{let c=await ee.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:t(o)}:null}catch{return null}},async write(o,a){let c=K.join(e,o);await ee.promises.mkdir(K.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await ee.promises.writeFile(l,a),await ee.promises.rename(l,c),{bytes:a.byteLength,path:c,url:t(o)}},url:t}}async function At(e,i=e){let t=await ee.promises.readdir(i,{withFileTypes:!0});t.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of t){let c=K.join(i,a.name);if(a.isDirectory()){o.push(...await At(e,c));continue}if(!a.isFile()||!un.has(K.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:K.relative(e,c)})}return o}function Ct(e,i){return e.map((t)=>({key:hn(t.relativePath),input:t.absolutePath,name:yn(t.relativePath),...bn(t.absolutePath)?{options:{storage:i}}:{}}))}function bn(e){return Fe(e)==="possible"}function xn(e){for(let i=3;i<e.length;i+=4)if(e[i]!==255)return!0;return!1}async function vn(e){let i=Object.entries(e).filter(([,c])=>c.fallback.format==="png"),t=new Set,o=8;if(i.length===0)return t;let{decode:a}=await import("ts-images");for(let c=0;c<i.length;c+=8)await Promise.all(i.slice(c,c+8).map(async([l,u])=>{let g=u.variants.filter((x)=>x.format==="png").sort((x,y)=>x.width-y.width)[0];try{let x=await a(new Uint8Array(await ee.promises.readFile(g?.path??u.fallback.path)));if(xn(x.data))t.add(l)}catch{t.add(l)}}));return t}function wn(e,i){let t=[];for(let o of i){let a=e[o],c=a?.variants.filter((u)=>u.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((u)=>{let g;try{return g=ee.openSync(u.path,"r"),!Ue(Ae(g,0,32))}catch{return!0}finally{if(g!==void 0)ee.closeSync(g)}}))continue;if(a.variants=a.variants.filter((u)=>u.format!=="webp"),delete a.sources.webp,t.push(o),!$t.has(o))$t.add(o),console.warn(`[stx-images] ${o} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return t}async function $n(e){let i=[],t=8;if(e.length===0)return i;let{generateThumbHash:o}=await import("ts-images");for(let a=0;a<e.length;a+=8){let c=e.slice(a,a+8),l=await Promise.all(c.map(async(u)=>{try{return await o(u.absolutePath),u}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${u.relativePath}`),null}}));i.push(...l.filter((u)=>u!==null))}return i}function qe(e){return K.join(e,"undecodable.json")}function Sn(e){try{let i=ee.readFileSync(qe(e),"utf-8"),t=JSON.parse(i);return t&&typeof t==="object"?t:{}}catch{return{}}}function Cn(e,i){try{ee.mkdirSync(K.dirname(qe(e)),{recursive:!0}),ee.writeFileSync(qe(e),JSON.stringify(i))}catch{}}function Rt(e){try{let i=ee.statSync(e);return{mtimeMs:i.mtimeMs,size:i.size}}catch{return}}function It(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let i=e.split(/[?#]/,1)[0];if(!i)return;try{return`/${i.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function zo(e){let i=It(e);return i?we().catalog.get(i):void 0}function Ho(e){let i=It(e);return i?we().transparent.has(i):!1}function Vo(e){let i=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),t=i(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:i(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<t).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function Fh(e){let i=zo(e);if(!i)return;return{src:i.fallback.url,srcset:i.sources[i.fallback.format]||"",sources:Vo(i).map(({format:t,srcset:o})=>({type:`image/${t}`,srcset:o})),width:i.source.width,height:i.source.height,placeholder:Ho(e)?void 0:i.placeholder?.dataUrl}}function gs(){let e=we();e.catalog=new Map,e.transparent=new Set}function Rn(e){let i=we();i.catalog=new Map(e.entries),i.transparent=new Set(e.transparent)}async function zh(e,i,t={}){if(!e||!ee.existsSync(e))return gs(),{count:0,fingerprint:""};if(t.offThread){let b=await He("delivery",{publicDir:e,outputDir:i});if(b!==_e)return Rn(b.state),b.result}let o=await At(e);if(o.length===0)return gs(),{count:0,fingerprint:""};let a=Sn(i),c=o.filter((b)=>{let w=a[b.relativePath];if(!w)return!0;let A=Rt(b.absolutePath);return!A||A.mtimeMs!==w.mtimeMs||A.size!==w.size});if(c.length===0)return gs(),{count:0,fingerprint:""};let l=St(K.join(i,"_stx","images"),`${dn}:${vt()}`),u={outDir:K.join(i,"_stx","images"),storage:St(K.join(i,"_stx","images"),`${gn}:${vt()}`),baseUrl:ve,widths:fn,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},{createImageDeliveryCatalog:g}=await import("ts-images/delivery"),x=c,y;try{y=await g({...u,entries:Ct(c,l)})}catch(b){if(x=await $n(c),x.length===c.length)throw b;let w=new Set(x.map((k)=>k.relativePath)),A=!1;for(let k of c){if(w.has(k.relativePath))continue;let R=Rt(k.absolutePath);if(!R)continue;a[k.relativePath]=R,A=!0}if(A)Cn(i,a);if(x.length===0)return gs(),{count:0,fingerprint:""};y=await g({...u,entries:Ct(x,l)})}let m=await vn(y.entries),C=wn(y.entries,m),v=we();v.catalog=new Map(Object.entries(y.entries)),v.transparent=m;let S=m.size===0&&C.length===0?y.fingerprint:kt("sha256").update(y.fingerprint).update(JSON.stringify({transparent:[...m].sort(),droppedWebp:C.sort()})).digest("hex");return{count:x.length,fingerprint:S}}class Pt{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let i of e.aliases)this.builtins.set(i.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,i,t,o){let a=ui(e,o);if(a!==void 0)return a;for(let c of di(e,i,t,o))if(await s(c))return c;return null}}var pe=new Pt;var se="\x00stx-boolean-attribute";function Xe(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var An=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function Ve(e){let i=e.toLowerCase();return i.startsWith("aria-")||i.startsWith("data-")||An.has(i)}function oe(e,i){let t=[];for(let[o,a]of Object.entries(e.static)){if(i.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)t.push(p(c));continue}if(a===se){t.push(p(c));continue}t.push(`${p(c)}="${kn(c,Xe(String(a)))}"`)}return t}function ce(e,i){let t=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(i.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){t.push(p(c));continue}if(typeof a==="object")continue;t.push(`${p(c)}="${kn(c,Xe(String(a)))}"`)}return t}function In(e){if(e.clientReactive.to)return{value:e.clientReactive.to,reactive:!0};if(e.serverDynamic.to!==void 0)return{value:String(e.serverDynamic.to),reactive:!1};if(typeof e.static.to==="string")return{value:e.static.to,reactive:!1};return{value:"#",reactive:!1}}var Ze={name:"StxLink",aliases:["stx-link"],render(e,i,t){let o=In(e),a=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),c=typeof e.static.activeClass==="string"?e.static.activeClass:"active",l=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",u=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,g=[];if(o.reactive)g.push(`:href="${n(o.value)}"`);else g.push(`href="${n(_r(o.value,"navigable"))}"`);if(a)g.push(`class="${n(a)}"`);if(g.push("data-stx-link"),g.push(`data-stx-active-class="${n(c)}"`),g.push(`data-stx-exact-active-class="${n(l)}"`),u)g.push("data-stx-prefetch");let x=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(x)g.push(`data-stx-active-match="${n(x)}"`);let y=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return g.push(...oe(e,y)),g.push(...ce(e,y)),`<a ${g.join(" ")}>${i}</a>`}};var Pn=new Map;function Ge(e){if(!e)return;let i=e.split("?")[0].split("#")[0];return Pn.get(i)}var _n={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Ke=[320,640,768,1024,1280,1536,1920];function X(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let t=e.static[i];if(typeof t==="string")return t;return}function Ne(e,i,t=!1){let o=e.serverDynamic[i];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[i];if(a!==void 0)return a!=="false"&&a!==!1;return t}function Je(e){if(e.includes("(")||e.includes(","))return e;let i=e.trim().split(/\s+/),t=[];for(let o of i)if(o.includes(":")){let[a,c]=o.split(":"),l=_n[a];if(l)t.push(`(max-width: ${l}px) ${c}`);else{let u=Number.parseInt(a);if(!Number.isNaN(u))t.push(`(max-width: ${u}px) ${c}`)}}else t.push(o);return t.join(", ")}function Ye(e,i,t,o){return i.map((a)=>`${$e(e,a,void 0,t,o)} ${a}w`).join(", ")}function En(e,i,t,o,a){return i.map((c)=>{let l=t?t*c:void 0;return`${$e(e,l,void 0,o,a)} ${c}x`}).join(", ")}function $e(e,i,t,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(i)c.push(`w_${i}`);if(t)c.push(`h_${t}`);if(a)c.push(`f_${a}`);c.push("q_auto");let l=c.join(",");return e.replace("/upload/",`/upload/${l}/`)}if(o==="imgix"){let c=new URLSearchParams;if(i)c.set("w",String(i));if(t)c.set("h",String(t));if(a)c.set("fm",a);c.set("auto","format");let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}if(o==="bunny"){let c=new URLSearchParams;if(i)c.set("width",String(i));if(t)c.set("height",String(t));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function Nn(e){return`var s=this.style;${e.map((i)=>`s.${i}=''`).join(";")}`}function On(e,i,t="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${i}"><rect width="100%" height="100%" fill="${t}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var Qe={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,i,t){let o=X(e,"src")||"",a=zo(o),c=X(e,"alt")||"",l=X(e,"width")||(a?String(a.source.width):void 0),u=X(e,"height")||(a?String(a.source.height):void 0),g=X(e,"sizes"),x=X(e,"srcset"),y=X(e,"densities"),m=X(e,"format"),C=Ho(o)||Ge(o)?.transparent===!0,v=X(e,"placeholder")||(a&&!C?"thumbhash":void 0),S=X(e,"placeholderColor")||"#e5e7eb",b=X(e,"provider"),w=X(e,"class")||X(e,"className")||"",A=X(e,"style")||"",k=X(e,"objectFit")||X(e,"fit"),R=X(e,"objectPosition")||X(e,"position"),O=X(e,"quality"),Q=Ne(e,"lazy",!0),L=Ne(e,"preload",!1),F=Ne(e,"priority",!1),z=X(e,"loading"),B=X(e,"decoding")||"async",V=!!a||Ne(e,"picture",!1)||!!m,I=l?Number.parseInt(l):void 0,E=u?Number.parseInt(u):void 0,D=x||"",H="";if(a)D=a.sources[a.fallback.format]||"",H=g?Je(g):"100vw";else if(!D&&g&&b&&b!=="local"&&b!=="static")D=Ye(o,Ke,b,m),H=Je(g);else if(!D&&y){let G=y.split(/\s+/).map((_)=>Number.parseFloat(_.replace("x","")));D=En(o,G,I,b,m)}else if(g)H=Je(g);let j=[];if(A)j.push(A);if(k)j.push(`object-fit:${k}`);if(R)j.push(`object-position:${R}`);if(I&&E)j.push(`aspect-ratio:${I}/${E}`);let re=[],le=v==="blur"||v==="color"||v==="thumbhash";if(le&&!C){let G=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:S}:Ge(o);if(G&&v==="color")j.push(`background-color:${G.color}`),re.push("backgroundColor");else if(G)j.push(`background-color:${G.color}`),j.push(`background-image:url(${G.dataUrl})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),re.push("backgroundColor","backgroundImage");else{let _=On(I||16,E||9,S);j.push(`background-image:url(${_})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),re.push("backgroundImage")}}else if(!le&&v&&v!=="empty"&&v!=="none")j.push(`background-image:url(${n(v)})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),re.push("backgroundImage");let M=a?.fallback.url||$e(o,I,E,b,m),Z=[];if(Z.push(`src="${n(_r(M,"fetched"))}"`),Z.push(`alt="${n(c)}"`),l)Z.push(`width="${n(l)}"`);if(u)Z.push(`height="${n(u)}"`);let Re=z||(F||L?"eager":Q?"lazy":"");if(Re)Z.push(`loading="${n(Re)}"`);if(F)Z.push('fetchpriority="high"');if(Z.push(`decoding="${n(B)}"`),w)Z.push(`class="${n(w)}"`);if(j.length>0)Z.push(`style="${n(j.join(";"))}"`);if(D)Z.push(`srcset="${n(_r(D,"fetched"))}"`);if(H)Z.push(`sizes="${n(H)}"`);let xe=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","objectFit","objectPosition","fit","position","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(re.length>0){let G=typeof e.static.onload==="string"?e.static.onload:"",_=Nn(re)+(G?`;${G}`:"");Z.push(`onload="${n(_)}"`),xe.add("onload")}Z.push(...oe(e,xe)),Z.push(...ce(e,xe));let de=`<img ${Z.join(" ")} />`,te="";if(L){let _=m==="webp"?"image/webp":m==="avif"?"image/avif":"";te=`<link rel="preload" as="image" href="${n(M)}"${_?` type="${_}"`:""}${D?` imagesrcset="${n(D)}"`:""}${H?` imagesizes="${n(H)}"`:""} />
|
|
2
|
+
import{xl,Sl}from"./chunk-ngnvyqk3.js";import{f,P,it,d}from"./chunk-0dmpc70r.js";import{U,xr,Ls,js,ui,di,Bs,Ot,Me,fe,J,_r,Cr,ae,Y,N,st,Er,mi,Rr,ze,s,p,W,kn}from"./chunk-mv48q1p4.js";import{n}from"./chunk-8qe34jb8.js";import{ie}from"./chunk-v8p8t3t4.js";import{lr}from"./chunk-14cvwsy1.js";import{r}from"./chunk-7kc9xwht.js";import{h}from"./chunk-kgrvvtcy.js";import{createHash as kt}from"crypto";import ee from"fs";import K from"path";import Le from"fs";function Ae(e,i,t){let o=Buffer.alloc(t),a=Le.readSync(e,o,0,t,i);return o.subarray(0,a)}function Ue(e){if(e.length<25)return!1;let i=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(i(0,4)!=="RIFF"||i(8,12)!=="WEBP")return!1;let t=i(12,16);if(t==="VP8X")return(e[20]&16)!==0;if(t==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Fe(e){let i;try{i=Le.openSync(e,"r");let t=Ae(i,0,33);if(t.length>=3&&t[0]===255&&t[1]===216&&t[2]===255)return"none";if(t.length>=26&&t[0]===137&&t.toString("latin1",1,4)==="PNG"){let o=t[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ae(i,a,8);if(l.length<8)return"unknown";let u=l.toString("latin1",4,8);if(u==="tRNS")return"possible";if(u==="IDAT"||u==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(t.length>=25&&t.toString("latin1",0,4)==="RIFF"&&t.toString("latin1",8,12)==="WEBP"){if(Ue(t))return"possible";let o=t.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(i!==void 0)Le.closeSync(i)}}import rn from"fs";import We from"os";import{fileURLToPath as yt}from"url";var _e=Symbol("stx.image-worker.unavailable");function sn(e=typeof We.availableParallelism==="function"?We.availableParallelism():We.cpus().length){return Math.max(1,Math.min(2,e-1))}var Pe=0,xt=[];async function on(){if(Pe<sn()){Pe++;return}await new Promise((e)=>xt.push(e)),Pe++}function an(){Pe--,xt.shift()?.()}var cn="@stacksjs/stx/builtins/image-warmup-worker";function ln(e=process.cwd()){let i=import.meta.url.endsWith(".ts")?"ts":"js";try{let t=new URL(`./image-warmup-worker.${i}`,import.meta.url);if(t.protocol==="file:"&&rn.existsSync(yt(t)))return yt(t)}catch{}return lr(cn,e)}var bt=!1;function ge(e){if(!bt)bt=!0,console.warn(`[stx] image worker unavailable (${e}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return _e}function Ie(e){return e instanceof Error?e.message:String(e)}async function He(e,i){let t;try{t=(await import("worker_threads")).Worker}catch(a){return ge(`could not load node:worker_threads: ${Ie(a)}`)}if(typeof t!=="function")return ge("node:worker_threads has no Worker in this runtime");let o=ln();if(!o)return ge("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await on();try{return await new Promise((a,c)=>{let l;try{l=new t(o)}catch(y){a(ge(`could not start ${o}: ${Ie(y)}`));return}let u=!1,g=!1,x=(y)=>{if(g)return;g=!0,y(),l.terminate()};l.on("message",(y)=>{if(y.type==="ready"){u=!0,l.postMessage({task:e,args:i});return}if(y.type==="result"){x(()=>a(y.value));return}let m=Error(y.error?.message??"image worker failed");if(y.error?.name)m.name=y.error.name;if(y.error?.stack)m.stack=y.error.stack;x(()=>c(m))}),l.on("error",(y)=>{x(()=>u?c(y instanceof Error?y:Error(Ie(y)||"image worker crashed")):a(ge(`the worker failed before it was ready: ${Ie(y)}`)))}),l.on("exit",(y)=>{x(()=>u?c(Error("image worker exited before it finished")):a(ge(`the worker exited with code ${y} before it was ready`)))})})}finally{an()}}var un=new Set([".avif",".jpeg",".jpg",".png",".webp"]),fn=[320,640,960,1280,1920],ve="/_stx/images",dn=`stx:${ve}:alpha-1`,gn=`stx:${ve}:opaque-1`,pn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Ee;function mn(e,i){let t=K.dirname(Bun.resolveSync(e,i));while(t!==K.dirname(t)){let o=K.join(t,"package.json");if(ee.existsSync(o)){let a=JSON.parse(ee.readFileSync(o,"utf8"));if(a.name===e)return a.version}t=K.dirname(t)}return}function vt(){if(Ee!==void 0)return Ee;let e;try{e=K.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Ee=pn.map((i)=>{let t;try{t=e?mn(i,e):void 0}catch{}return`${i.replace("@stacksjs/","")}@${t??"unknown"}`}).join("+"),Ee}var wt=Symbol.for("stx.image-delivery");function we(){let e=globalThis;return e[wt]??={catalog:new Map,transparent:new Set},e[wt]}var $t=new Set;function hn(e){return`/${e.split(K.sep).map(encodeURIComponent).join("/")}`}function yn(e){let i=K.extname(e),t=e.slice(0,-i.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=kt("sha256").update(e).digest("hex").slice(0,8);return`${t||"image"}-${o}`}function St(e,i=`stx:${ve}`){let t=(o)=>`${ve}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:i,async stat(o){let a=K.join(e,o);try{let c=await ee.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:t(o)}:null}catch{return null}},async write(o,a){let c=K.join(e,o);await ee.promises.mkdir(K.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await ee.promises.writeFile(l,a),await ee.promises.rename(l,c),{bytes:a.byteLength,path:c,url:t(o)}},url:t}}async function At(e,i=e){let t=await ee.promises.readdir(i,{withFileTypes:!0});t.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of t){let c=K.join(i,a.name);if(a.isDirectory()){o.push(...await At(e,c));continue}if(!a.isFile()||!un.has(K.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:K.relative(e,c)})}return o}function Ct(e,i){return e.map((t)=>({key:hn(t.relativePath),input:t.absolutePath,name:yn(t.relativePath),...bn(t.absolutePath)?{options:{storage:i}}:{}}))}function bn(e){return Fe(e)==="possible"}function xn(e){for(let i=3;i<e.length;i+=4)if(e[i]!==255)return!0;return!1}async function vn(e){let i=Object.entries(e).filter(([,c])=>c.fallback.format==="png"),t=new Set,o=8;if(i.length===0)return t;let{decode:a}=await import("ts-images");for(let c=0;c<i.length;c+=8)await Promise.all(i.slice(c,c+8).map(async([l,u])=>{let g=u.variants.filter((x)=>x.format==="png").sort((x,y)=>x.width-y.width)[0];try{let x=await a(new Uint8Array(await ee.promises.readFile(g?.path??u.fallback.path)));if(xn(x.data))t.add(l)}catch{t.add(l)}}));return t}function wn(e,i){let t=[];for(let o of i){let a=e[o],c=a?.variants.filter((u)=>u.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((u)=>{let g;try{return g=ee.openSync(u.path,"r"),!Ue(Ae(g,0,32))}catch{return!0}finally{if(g!==void 0)ee.closeSync(g)}}))continue;if(a.variants=a.variants.filter((u)=>u.format!=="webp"),delete a.sources.webp,t.push(o),!$t.has(o))$t.add(o),console.warn(`[stx-images] ${o} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return t}async function $n(e){let i=[],t=8;if(e.length===0)return i;let{generateThumbHash:o}=await import("ts-images");for(let a=0;a<e.length;a+=8){let c=e.slice(a,a+8),l=await Promise.all(c.map(async(u)=>{try{return await o(u.absolutePath),u}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${u.relativePath}`),null}}));i.push(...l.filter((u)=>u!==null))}return i}function qe(e){return K.join(e,"undecodable.json")}function Sn(e){try{let i=ee.readFileSync(qe(e),"utf-8"),t=JSON.parse(i);return t&&typeof t==="object"?t:{}}catch{return{}}}function Cn(e,i){try{ee.mkdirSync(K.dirname(qe(e)),{recursive:!0}),ee.writeFileSync(qe(e),JSON.stringify(i))}catch{}}function Rt(e){try{let i=ee.statSync(e);return{mtimeMs:i.mtimeMs,size:i.size}}catch{return}}function It(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let i=e.split(/[?#]/,1)[0];if(!i)return;try{return`/${i.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function zo(e){let i=It(e);return i?we().catalog.get(i):void 0}function Ho(e){let i=It(e);return i?we().transparent.has(i):!1}function Vo(e){let i=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),t=i(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:i(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<t).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function Fh(e){let i=zo(e);if(!i)return;return{src:i.fallback.url,srcset:i.sources[i.fallback.format]||"",sources:Vo(i).map(({format:t,srcset:o})=>({type:`image/${t}`,srcset:o})),width:i.source.width,height:i.source.height,placeholder:Ho(e)?void 0:i.placeholder?.dataUrl}}function gs(){let e=we();e.catalog=new Map,e.transparent=new Set}function Rn(e){let i=we();i.catalog=new Map(e.entries),i.transparent=new Set(e.transparent)}async function zh(e,i,t={}){if(!e||!ee.existsSync(e))return gs(),{count:0,fingerprint:""};if(t.offThread){let b=await He("delivery",{publicDir:e,outputDir:i});if(b!==_e)return Rn(b.state),b.result}let o=await At(e);if(o.length===0)return gs(),{count:0,fingerprint:""};let a=Sn(i),c=o.filter((b)=>{let w=a[b.relativePath];if(!w)return!0;let A=Rt(b.absolutePath);return!A||A.mtimeMs!==w.mtimeMs||A.size!==w.size});if(c.length===0)return gs(),{count:0,fingerprint:""};let l=St(K.join(i,"_stx","images"),`${dn}:${vt()}`),u={outDir:K.join(i,"_stx","images"),storage:St(K.join(i,"_stx","images"),`${gn}:${vt()}`),baseUrl:ve,widths:fn,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},{createImageDeliveryCatalog:g}=await import("ts-images/delivery"),x=c,y;try{y=await g({...u,entries:Ct(c,l)})}catch(b){if(x=await $n(c),x.length===c.length)throw b;let w=new Set(x.map((k)=>k.relativePath)),A=!1;for(let k of c){if(w.has(k.relativePath))continue;let R=Rt(k.absolutePath);if(!R)continue;a[k.relativePath]=R,A=!0}if(A)Cn(i,a);if(x.length===0)return gs(),{count:0,fingerprint:""};y=await g({...u,entries:Ct(x,l)})}let m=await vn(y.entries),C=wn(y.entries,m),v=we();v.catalog=new Map(Object.entries(y.entries)),v.transparent=m;let S=m.size===0&&C.length===0?y.fingerprint:kt("sha256").update(y.fingerprint).update(JSON.stringify({transparent:[...m].sort(),droppedWebp:C.sort()})).digest("hex");return{count:x.length,fingerprint:S}}class Pt{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let i of e.aliases)this.builtins.set(i.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,i,t,o){let a=ui(e,o);if(a!==void 0)return a;for(let c of di(e,i,t,o))if(await s(c))return c;return null}}var pe=new Pt;var se="\x00stx-boolean-attribute";function Xe(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var An=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function Ve(e){let i=e.toLowerCase();return i.startsWith("aria-")||i.startsWith("data-")||An.has(i)}function oe(e,i){let t=[];for(let[o,a]of Object.entries(e.static)){if(i.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)t.push(p(c));continue}if(a===se){t.push(p(c));continue}t.push(`${p(c)}="${kn(c,Xe(String(a)))}"`)}return t}function ce(e,i){let t=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(i.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){t.push(p(c));continue}if(typeof a==="object")continue;t.push(`${p(c)}="${kn(c,Xe(String(a)))}"`)}return t}function In(e){if(e.clientReactive.to)return{value:e.clientReactive.to,reactive:!0};if(e.serverDynamic.to!==void 0)return{value:String(e.serverDynamic.to),reactive:!1};if(typeof e.static.to==="string")return{value:e.static.to,reactive:!1};return{value:"#",reactive:!1}}var Ze={name:"StxLink",aliases:["stx-link"],render(e,i,t){let o=In(e),a=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),c=typeof e.static.activeClass==="string"?e.static.activeClass:"active",l=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",u=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,g=[];if(o.reactive)g.push(`:href="${n(o.value)}"`);else g.push(`href="${n(_r(o.value,"navigable"))}"`);if(a)g.push(`class="${n(a)}"`);if(g.push("data-stx-link"),g.push(`data-stx-active-class="${n(c)}"`),g.push(`data-stx-exact-active-class="${n(l)}"`),u)g.push("data-stx-prefetch");let x=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(x)g.push(`data-stx-active-match="${n(x)}"`);let y=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return g.push(...oe(e,y)),g.push(...ce(e,y)),`<a ${g.join(" ")}>${i}</a>`}};var Pn=new Map;function Ge(e){if(!e)return;let i=e.split("?")[0].split("#")[0];return Pn.get(i)}var _n={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Ke=[320,640,768,1024,1280,1536,1920];function X(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let t=e.static[i];if(typeof t==="string")return t;return}function Ne(e,i,t=!1){let o=e.serverDynamic[i];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[i];if(a!==void 0)return a!=="false"&&a!==!1;return t}function Je(e){if(e.includes("(")||e.includes(","))return e;let i=e.trim().split(/\s+/),t=[];for(let o of i)if(o.includes(":")){let[a,c]=o.split(":"),l=_n[a];if(l)t.push(`(max-width: ${l}px) ${c}`);else{let u=Number.parseInt(a);if(!Number.isNaN(u))t.push(`(max-width: ${u}px) ${c}`)}}else t.push(o);return t.join(", ")}function Ye(e,i,t,o){return i.map((a)=>`${$e(e,a,void 0,t,o)} ${a}w`).join(", ")}function En(e,i,t,o,a){return i.map((c)=>{let l=t?t*c:void 0;return`${$e(e,l,void 0,o,a)} ${c}x`}).join(", ")}function $e(e,i,t,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(i)c.push(`w_${i}`);if(t)c.push(`h_${t}`);if(a)c.push(`f_${a}`);c.push("q_auto");let l=c.join(",");return e.replace("/upload/",`/upload/${l}/`)}if(o==="imgix"){let c=new URLSearchParams;if(i)c.set("w",String(i));if(t)c.set("h",String(t));if(a)c.set("fm",a);c.set("auto","format");let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}if(o==="bunny"){let c=new URLSearchParams;if(i)c.set("width",String(i));if(t)c.set("height",String(t));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function Nn(e){return`var s=this.style;${e.map((i)=>`s.${i}=''`).join(";")}`}function On(e,i,t="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${i}"><rect width="100%" height="100%" fill="${t}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var Qe={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,i,t){let o=X(e,"src")||"",a=zo(o),c=X(e,"alt")||"",l=X(e,"width")||(a?String(a.source.width):void 0),u=X(e,"height")||(a?String(a.source.height):void 0),g=X(e,"sizes"),x=X(e,"srcset"),y=X(e,"densities"),m=X(e,"format"),C=Ho(o)||Ge(o)?.transparent===!0,v=X(e,"placeholder")||(a&&!C?"thumbhash":void 0),S=X(e,"placeholderColor")||"#e5e7eb",b=X(e,"provider"),w=X(e,"class")||X(e,"className")||"",A=X(e,"style")||"",k=X(e,"objectFit")||X(e,"fit"),R=X(e,"objectPosition")||X(e,"position"),O=X(e,"quality"),Q=Ne(e,"lazy",!0),L=Ne(e,"preload",!1),F=Ne(e,"priority",!1),z=X(e,"loading"),B=X(e,"decoding")||"async",V=!!a||Ne(e,"picture",!1)||!!m,I=l?Number.parseInt(l):void 0,E=u?Number.parseInt(u):void 0,D=x||"",H="";if(a)D=a.sources[a.fallback.format]||"",H=g?Je(g):"100vw";else if(!D&&g&&b&&b!=="local"&&b!=="static")D=Ye(o,Ke,b,m),H=Je(g);else if(!D&&y){let G=y.split(/\s+/).map((_)=>Number.parseFloat(_.replace("x","")));D=En(o,G,I,b,m)}else if(g)H=Je(g);let j=[];if(A)j.push(A);if(k)j.push(`object-fit:${k}`);if(R)j.push(`object-position:${R}`);if(I&&E)j.push(`aspect-ratio:${I}/${E}`);let re=[],le=v==="blur"||v==="color"||v==="thumbhash";if(le&&!C){let G=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:S}:Ge(o);if(G&&v==="color")j.push(`background-color:${G.color}`),re.push("backgroundColor");else if(G)j.push(`background-color:${G.color}`),j.push(`background-image:url(${G.dataUrl})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),re.push("backgroundColor","backgroundImage");else{let _=On(I||16,E||9,S);j.push(`background-image:url(${_})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),re.push("backgroundImage")}}else if(!le&&v&&v!=="empty"&&v!=="none")j.push(`background-image:url(${n(v)})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),re.push("backgroundImage");let M=a?.fallback.url||$e(o,I,E,b,m),Z=[];if(Z.push(`src="${n(_r(M,"fetched"))}"`),Z.push(`alt="${n(c)}"`),l)Z.push(`width="${n(l)}"`);if(u)Z.push(`height="${n(u)}"`);let Re=z||(F||L?"eager":Q?"lazy":"");if(Re)Z.push(`loading="${n(Re)}"`);if(F)Z.push('fetchpriority="high"');if(Z.push(`decoding="${n(B)}"`),w)Z.push(`class="${n(w)}"`);if(j.length>0)Z.push(`style="${n(j.join(";"))}"`);if(D)Z.push(`srcset="${n(_r(D,"fetched"))}"`);if(H)Z.push(`sizes="${n(H)}"`);let xe=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","objectFit","objectPosition","fit","position","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(re.length>0){let G=typeof e.static.onload==="string"?e.static.onload:"",_=Nn(re)+(G?`;${G}`:"");Z.push(`onload="${n(_)}"`),xe.add("onload")}Z.push(...oe(e,xe)),Z.push(...ce(e,xe));let de=`<img ${Z.join(" ")} />`,te="";if(L){let _=m==="webp"?"image/webp":m==="avif"?"image/avif":"";te=`<link rel="preload" as="image" href="${n(M)}"${_?` type="${_}"`:""}${D?` imagesrcset="${n(D)}"`:""}${H?` imagesizes="${n(H)}"`:""} />
|
|
3
3
|
`}if(V){let G=[];if(a)for(let _ of Vo(a))G.push(`<source type="image/${_.format}" srcset="${n(_.srcset)}"${H?` sizes="${n(H)}"`:""} />`);if(!a&&(m==="avif"||m==="auto")){let _=$e(o,I,E,b,"avif"),T=D?Ye(o,Ke,b,"avif"):`${_}`;G.push(`<source type="image/avif" srcset="${n(T)}"${H?` sizes="${n(H)}"`:""} />`)}if(!a&&(m==="webp"||m==="auto")){let _=$e(o,I,E,b,"webp"),T=D?Ye(o,Ke,b,"webp"):`${_}`;G.push(`<source type="image/webp" srcset="${n(T)}"${H?` sizes="${n(H)}"`:""} />`)}return`${te}<picture>
|
|
4
4
|
${G.join(`
|
|
5
5
|
`)}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$f,Rf,ye,Af,ac,rn,sn,Ih,cc,on,rr,Pf,If,Of,cs,an,Nf,cn,lc,Oh}from"./chunk-
|
|
2
|
+
import{$f,Rf,ye,Af,ac,rn,sn,Ih,cc,on,rr,Pf,If,Of,cs,an,Nf,cn,lc,Oh}from"./chunk-pesgcwrj.js";import"./chunk-4cd94cd5.js";import"./chunk-hpwtjb4a.js";import"./chunk-1qybwj8k.js";import"./chunk-qxk9grjm.js";import"./chunk-kvafq9gy.js";import"./chunk-tm8a2b69.js";import"./chunk-vw73gsxx.js";import"./chunk-9r999ees.js";import"./chunk-mv48q1p4.js";import"./chunk-e8zpzt9s.js";import"./chunk-v4bqmzj9.js";import"./chunk-0dmpc70r.js";import"./chunk-xppm4cs4.js";import"./chunk-ngnvyqk3.js";export{rr as MODULE_SPECIFIER_PREFIX,$f as bundleCacheDir,Rf as bundleCacheEntryLimit,Oh as bundleClientEntriesSplit,cn as bundleClientScript,sn as clearBundleFailures,ye as clientBundleDependencies,rn as getBundleFailures,on as hasUserImports,an as moduleSubstitutionKey,If as normalizeRegistrySpecifiers,Nf as queueClientBundleBuild,ac as recordBundleFailure,Pf as registryIdForPath,cc as resolveBundlerFallback,Of as rewriteRegistryImports,Ih as setBundlerFallbackMode,Af as shouldLogBundlerDiagnostics,lc as tempBuildName,cs as withModuleSubstitutes};
|