@stacksjs/stx 0.2.853 → 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-5g1jwxny.js → chunk-0dmpc70r.js} +6 -6
- package/dist/{chunk-0wxmmvj0.js → chunk-0vg0j7xa.js} +1 -1
- package/dist/{chunk-7rtvravz.js → chunk-11y3106w.js} +1 -1
- package/dist/chunk-161ksm7f.js +2 -0
- package/dist/{chunk-c54bhqrg.js → chunk-1qybwj8k.js} +2 -2
- package/dist/{chunk-8g0243g1.js → chunk-279n7sde.js} +2 -2
- package/dist/chunk-2y20dvab.js +2 -0
- package/dist/chunk-33yeb861.js +2 -0
- package/dist/{chunk-6c45vx1e.js → chunk-3pm6d9zj.js} +1 -1
- package/dist/{chunk-3b9950gz.js → chunk-463zkecq.js} +1 -1
- package/dist/{chunk-x1w19y3w.js → chunk-4cd94cd5.js} +1 -1
- package/dist/{chunk-83d468me.js → chunk-4dfz7cdr.js} +2 -2
- package/dist/{chunk-trxha300.js → chunk-4wrddn8m.js} +2 -2
- package/dist/chunk-5dykcrnv.js +2 -0
- package/dist/{chunk-76b6m6n0.js → chunk-5ppe8d51.js} +1 -1
- package/dist/chunk-5xcxc9f8.js +2 -0
- package/dist/{chunk-t74qb5ej.js → chunk-68pvvd7v.js} +3 -3
- package/dist/{chunk-e64m5ayt.js → chunk-6w3gv9d6.js} +1 -1
- package/dist/{chunk-xzdjhjz4.js → chunk-77kanny8.js} +4 -4
- package/dist/{chunk-nz202f97.js → chunk-7hp50cpd.js} +4 -4
- package/dist/{chunk-7wwq1btb.js → chunk-7tteg9bn.js} +1 -1
- package/dist/{chunk-x8jsmwhg.js → chunk-81z64a84.js} +1 -1
- package/dist/{chunk-9h1w4py6.js → chunk-8gsd2n0j.js} +1 -1
- package/dist/{chunk-4zkk63v3.js → chunk-8kqqxqyp.js} +1 -1
- package/dist/chunk-8qe34jb8.js +3 -0
- package/dist/{chunk-zqpjqcm8.js → chunk-9hvfmqs1.js} +2 -2
- package/dist/{chunk-mdsc3rz1.js → chunk-9n3584wt.js} +1 -1
- package/dist/{chunk-zzzqnf9k.js → chunk-bk0arddt.js} +1 -1
- package/dist/chunk-c557w9e6.js +2 -0
- package/dist/chunk-ck9zengd.js +2 -0
- package/dist/{chunk-zjfp64v7.js → chunk-cy60hmv2.js} +1 -1
- package/dist/chunk-dbag44ta.js +2 -0
- package/dist/{chunk-6vc1dwqt.js → chunk-dfcnaaym.js} +1 -1
- package/dist/{chunk-bqxrfagh.js → chunk-e8zpzt9s.js} +1 -1
- package/dist/{chunk-g976n4r1.js → chunk-eegs2at0.js} +1 -1
- package/dist/{chunk-xa9mkdn7.js → chunk-enxnw50k.js} +1 -1
- package/dist/{chunk-c2et7w0g.js → chunk-f858fazq.js} +1 -1
- package/dist/{chunk-baxrx1rz.js → chunk-fba71th7.js} +3 -3
- package/dist/{chunk-nyqvtca1.js → chunk-fbpqkrvb.js} +1 -1
- package/dist/{chunk-vtzkqsq1.js → chunk-fzkyk5j4.js} +6 -6
- package/dist/chunk-ggthncvg.js +2 -0
- package/dist/{chunk-rmeey2xa.js → chunk-gxqtbbz0.js} +2 -2
- package/dist/{chunk-0hegjagg.js → chunk-h1f3dpvq.js} +2 -2
- package/dist/{chunk-e5vbwsty.js → chunk-hfcagm39.js} +1 -1
- package/dist/chunk-hfe2byfx.js +2 -0
- package/dist/{chunk-n8qd1n8w.js → chunk-hgy98n76.js} +2 -2
- package/dist/chunk-j3s5y2k5.js +2 -0
- package/dist/{chunk-a0ahcd1g.js → chunk-jn6mdfrs.js} +1 -1
- package/dist/{chunk-m9n3ahsy.js → chunk-k0arm18k.js} +1 -1
- package/dist/{chunk-cxf0rzv6.js → chunk-kez50h8a.js} +1 -1
- package/dist/{chunk-4wx7refk.js → chunk-ma4ftg5p.js} +5 -5
- package/dist/{chunk-rrppkyv0.js → chunk-mhjxx64x.js} +6 -6
- package/dist/{chunk-8cg88x7m.js → chunk-mv48q1p4.js} +14 -14
- package/dist/chunk-ns5epsng.js +2 -0
- package/dist/chunk-p91288ce.js +2 -0
- package/dist/{chunk-txdxfjbj.js → chunk-pesgcwrj.js} +1 -1
- package/dist/chunk-pw6n7a9k.js +2 -0
- package/dist/{chunk-cabdpgxg.js → chunk-pwem4sed.js} +1 -1
- package/dist/{chunk-cf7dk9ev.js → chunk-q0jmc3m4.js} +3 -3
- package/dist/{chunk-prfrqfae.js → chunk-q0ycypnt.js} +1 -1
- package/dist/{chunk-bze3ksvb.js → chunk-qccpfn5x.js} +1 -1
- package/dist/{chunk-9mzskb69.js → chunk-qxk9grjm.js} +1 -1
- package/dist/{chunk-qnyh0m22.js → chunk-v8p8t3t4.js} +2 -2
- package/dist/chunk-vbsr76qe.js +2 -0
- package/dist/chunk-vgaqznwt.js +2 -0
- package/dist/{chunk-j1yjbykm.js → chunk-vw73gsxx.js} +1 -1
- package/dist/chunk-w165qe5q.js +2 -0
- package/dist/{chunk-5pft38qa.js → chunk-w835crjw.js} +1 -1
- package/dist/chunk-wz54wsm7.js +2 -0
- package/dist/{chunk-jtpqqxzb.js → chunk-xfb7fdeq.js} +4 -4
- package/dist/{chunk-rw7q2a3c.js → chunk-xn2gyhes.js} +1 -1
- package/dist/{chunk-fxt9vwdw.js → chunk-ynd2nfvs.js} +37 -37
- package/dist/{chunk-52szcd15.js → chunk-yscys65t.js} +1 -1
- package/dist/{chunk-vpqgg04q.js → chunk-yzvp90yk.js} +1 -1
- package/dist/{chunk-c9k0yhyq.js → chunk-zme05d1n.js} +1 -1
- package/dist/{chunk-agvm20mz.js → chunk-zqb294v2.js} +1 -1
- package/dist/{chunk-rbxbgvkf.js → chunk-zswtgwxg.js} +1 -1
- package/dist/cli.js +11 -11
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/process.js +7 -1
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-0yc4p3y2.js +0 -2
- package/dist/chunk-161p0zcy.js +0 -2
- package/dist/chunk-28r4jyvj.js +0 -2
- package/dist/chunk-46mw2r3k.js +0 -2
- package/dist/chunk-48z6w533.js +0 -3
- package/dist/chunk-5fdpg861.js +0 -2
- package/dist/chunk-5t8xpkwc.js +0 -2
- package/dist/chunk-8fprfzcn.js +0 -2
- package/dist/chunk-aajezypd.js +0 -2
- package/dist/chunk-faf3gh3j.js +0 -2
- package/dist/chunk-fbakngjt.js +0 -2
- package/dist/chunk-fn2cjkp0.js +0 -2
- package/dist/chunk-hwq24mwt.js +0 -2
- package/dist/chunk-jy5fezyr.js +0 -2
- package/dist/chunk-kkk1dtq6.js +0 -2
- package/dist/chunk-pd3wzh2x.js +0 -2
- package/dist/chunk-pj3xwwtg.js +0 -2
- package/dist/chunk-s4c1mq0r.js +0 -2
- package/dist/chunk-sx1prttb.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-bqxrfagh.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-5g1jwxny.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.853";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?`
|
|
@@ -213,8 +213,8 @@ ${l.map(([P,D])=>` try { factories[${JSON.stringify(P)}] = factories[${JSON.str
|
|
|
213
213
|
`)}
|
|
214
214
|
})();
|
|
215
215
|
</script>`,v,T=/<(?:template\b|script\b(?=[^>]*\bdata-stx-scoped\b))/iy;return y(e,(P,D)=>{if(v===void 0){if(T.lastIndex=D,T.test(P))v=D}return-1}),a.push({start:v??0,end:v??0,replacement:`${b}
|
|
216
|
-
`}),ai(e,a)}function ai(e,t){if(t.length===0)return e;t.sort((l,c)=>l.start-c.start||l.end-c.end);let n=Array(t.length*2+1),i=0,a=0;for(let l of t)n[a++]=e.slice(i,l.start),n[a++]=l.replacement,i=l.end;return n[a]=e.slice(i),n.join("")}function ci(e){let t=Hn(e),n=new Map;if(t)for(let[i,a]of t)n.set(i,a.instances);return n}function li(e,t){let n=Hn(e);if(!n)return[];let i=[];for(let[a,l]of n){let c=l.instances-(t.get(a)??0);if(c>0)i.push({body:l.body,count:c})}return i}function Ri(e,t){for(let{body:n,count:i}of t)for(let a=0;a<i;a++)Rs(e,n)}function xe(e,t,n=2){let i=0,a=null;for(let l=t+n;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==="{"){i++;continue}if(c==="}"){if(i>0){i--;continue}let b=0;while(e[l+b]==="}")b++;if(b>=n)return l}}return-1}import Ni from"fs";var Ti=0,Ts=new Map;function il(){Ti=0,Ts.clear()}function qn(e,t){let n=Ti++,i=`<!--__STX_${e.toUpperCase()}_${n}__-->`;return Ts.set(i,{type:e,expression:t}),i}function al(){let e={};for(let[t,n]of Ts)e[t]={type:n.type,expression:n.expression};return e}function cl(e,t){let n=e;for(let[i,a]of t)n=n.split(i).join(a);return n}function _i(e){return e.includes("<!--__STX_")}var sc=/@(?=[a-zA-Z_]\w*\s*\(|end[a-zA-Z]*\b|else(?:if)?\b|empty\b|case\b|default\b|break\b|continue\b|fallback\b)/g;function rc(e){return Array.from({length:e},()=>"{").join("⁠")}function Ai(e){return e.replace(/\{{2,}/g,(t)=>rc(t.length)).replace(/\{(?=!)/g,"{⁠").replace(sc,"@")}function Cr(e,t,n=!1){let{openTag:i,tail:a}=n?ic(e,t):oc(e).at(t);return cc(a,i,n)}function ic(e,t){let n="",i=0;for(let c=0;c<t;c++){if(!e.startsWith("{{",c))continue;let b=xe(e,c);if(b<0||b+2>t)break;n+=e.slice(i,c)+"x",c=b+1,i=b+2}n+=e.slice(i,t);let a=-1,l=null;for(let c=0;c<n.length;c++){let b=n[c];if(l){if(b===l)l=null;continue}if(b==='"'||b==="'"){l=b;continue}if(b===">"){a=-1;continue}if(b==="<")a=c}return{openTag:a,tail:a>=0?n.slice(a+1):n}}var Zn=null;function oc(e){if(Zn&&Zn.source===e)return Zn.scanner;let t=ac(e);return Zn={source:e,scanner:t},t}function ac(e){let t=0,n=-1,i=null,a=-1,l=(b,v)=>{let T=e[b];if(v.quote){if(T===v.quote)v.quote=null;return}if(v.openTag>=0){if(T==='"'||T==="'"){v.quote=T;return}if(T===">"){v.openTag=-1;return}}if(T==="<")v.openTag=b},c=(b,v)=>{if(v.openTag>=0||!e.startsWith("<!--",b))return-1;let T=e.indexOf("-->",b+4);return T<0?e.length:T+3};return{at(b){if(b<t)t=0,n=-1,i=null,a=-1;let v={openTag:n,quote:i},T=!1;while(t<b){if(a<0&&e.startsWith("{{",t)){let F=xe(e,t);if(F<0)a=t;else if(F+2<=b){t=F+2;continue}else break}let L=c(t,v);if(L>=0){if(L>b){T=!0;break}t=L;continue}l(t,v),t++}if(n=v.openTag,i=v.quote,T)return{openTag:-1,tail:""};let P=a>=0?a:t,D={openTag:n,quote:i};for(let L=t;L<b;L++){let F=c(L,D);if(F>=0){if(F>b)return{openTag:-1,tail:""};L=F-1;continue}l(L,D)}if(D.openTag<0)return{openTag:-1,tail:""};let H="",O=D.openTag+1;for(let L=O;L<Math.min(b,P);L++){if(!e.startsWith("{{",L))continue;let F=xe(e,L);H+=e.slice(O,L)+"x",L=F+1,O=F+2}return H+=e.slice(O,b),{openTag:D.openTag,tail:H}}}}function cc(e,t,n){if(t<0&&!n)return null;if(t>=0&&/^\s*[!/?]/.test(e))return/^\s*\/?\s*$/.test(e)?{kind:"tag-name"}:null;if(t>=0&&/^\s*$/.test(e))return{kind:"tag-name"};let i=0;if(t>=0)while(i<e.length&&!/\s/.test(e[i]))i++;while(i<e.length){while(/\s/.test(e[i]??"")&&i<e.length)i++;let a=i;while(i<e.length&&!/[\s=/>]/.test(e[i]))i++;let l=e.slice(a,i);if(!l)break;while(i<e.length&&/\s/.test(e[i]))i++;if(e[i]!=="=")continue;i++;while(i<e.length&&/\s/.test(e[i]))i++;let c=e[i];if(c==='"'||c==="'"){let b=++i,v=e.indexOf(c,i);if(v===-1)return{kind:"attribute",name:l,quote:c,valuePrefix:e.slice(b)};i=v+1}else{let b=i;while(i<e.length&&!/\s/.test(e[i]))i++;if(i===e.length)return{kind:"attribute",name:l,quote:null,valuePrefix:e.slice(b)}}}return{kind:"tag"}}class ie extends Error{attribute;near;constructor(e,t){super(`Unsafe interpolation in ${e}: ${t}`);this.name="UnsafeInterpolationContextError",this.attribute=e}locate(e,t){if(this.near===void 0)this.near=e.slice(Math.max(0,t-160),t).replace(/\s+/g," ").trim(),this.message+=` (after: ${JSON.stringify(this.near)})`;return this}}var Ii="unsafe:";var lc=/^(?:javascript|vbscript|livescript|mocha|view-source):/,uc=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,fc=/^data:(?:text\/html|application\/xhtml\+xml)/,pc=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function dc(e){return e.replace(pc,"").toLowerCase()}function As(e){let t=e.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(t))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(t))return"fetched";return null}function Kn(e,t="navigable"){let n=dc(e);if(lc.test(n))return!0;return t==="navigable"?uc.test(n):fc.test(n)}function _r(e,t="navigable"){return Kn(e,t)?"unsafe:"+e:e}function gc(e){let t=e.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!t)return null;if(t[3].trim()!=="")return null;return As(t[1])}function Pi(e,t,n=256){if(t<=n)return e.slice(0,t);let i=e.slice(t-n,t),a=i.search(/[\s"'`/]/);return a===-1?"":i.slice(a)}function Oi(e,t,n=t){let i=gc(e);return i&&Kn(t,i)?"unsafe:"+n:n}function Nt(e){let t=e.indexOf(" as ");if(t!==-1){let l=e.slice(0,t).trim(),c=e.slice(t+4).trim();return l&&c?{arrayExpr:l,itemVar:c}:null}let n=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(e);if(!n)return null;let i=n[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),a=n[2].trim();return i&&a?{arrayExpr:a,itemVar:i}:null}function Xn(e){let t=[],n=0,i="",a=0;for(let l=0;l<e.length;l++){let c=e[l];if(i){if(c==="\\")l++;else if(c===i)i="";continue}if(c==="'"||c==='"'||c==="`")i=c;else if(c==="("||c==="["||c==="{")n++;else if(c===")"||c==="]"||c==="}")n--;else if(c===","&&n===0)t.push(e.slice(a,l)),a=l+1}return t.push(e.slice(a)),t}function Mi(e,t){let n=0;for(let i=0;i<e.length;i++){let a=e[i];if(a==="("||a==="["||a==="{")n++;else if(a===")"||a==="]"||a==="}")n--;else if(a===t&&n===0)return i}return-1}function ji(e){let t=0;for(let n=0;n<e.length;n++){let i=e[n];if(i==="("||i==="["||i==="{")t++;else if((i===")"||i==="]"||i==="}")&&--t===0)return n}return-1}function vt(e,t){let n=e.trim().replace(/^\.\.\./,"").trim(),i=Mi(n,"=");if(i!==-1&&n[i+1]!==">")n=n.slice(0,i).trim();if(!n)return;if(n.startsWith("{")&&n.endsWith("}")){for(let a of Xn(n.slice(1,-1))){let l=a.trim();if(!l)continue;if(l.startsWith("...")){vt(l,t);continue}let c=Mi(l,":");vt(c===-1?l:l.slice(c+1),t)}return}if(n.startsWith("[")&&n.endsWith("]")){for(let a of Xn(n.slice(1,-1)))vt(a,t);return}if(/^[A-Z_$][\w$]*$/i.test(n))t.push(n)}function Y(e){let t=e.trim(),n=[],i=0;for(let l=0;l<t.length;l++){let c=t[l];if(c==="("||c==="["||c==="{")i++;else if(c===")"||c==="]"||c==="}")i--;else if(i===0&&/\s/.test(c)){if(!/^\s+(?:in|of)\s/.exec(t.slice(l)))continue;let v=t.slice(0,l).trim();if(v.startsWith("(")&&ji(v)===v.length-1)v=v.slice(1,-1);for(let T of Xn(v))vt(T,n);if(n.length>0)return n;break}}let a=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(t);if(a){let l=a[1].trim();if(l.startsWith("(")&&ji(l)===l.length-1)l=l.slice(1,-1);let c=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(l);if(c)vt(c[2],n),vt(c[1],n);else for(let b of Xn(l))vt(b,n)}return n}function N(e,t){let n=t instanceof Set?t:new Set(t);if(n.size===0)return!1;let c=e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g," ").replace(/`(?:[^`\\$]|\\.|\$(?!\{))*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:(?!:))/g,"$1$2");for(let b of c.match(/[a-zA-Z_$][\w$]*/g)||[])if(n.has(b))return!0;return!1}var Jn="__stx_client_loop_names";function st(e){let t=e?.[Jn];return Array.isArray(t)?t:[]}function Gn(e){if(!e.includes("#")&&!e.includes("v-slot:")&&!e.includes("data-stx-slot-binding"))return[];let t=[],n=[],i=/<!--[\s\S]*?-->|<script\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/script\s*>|<style\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/style\s*>|<\/?[a-z][\w:-]*\b(?:"[^"]*"|'[^']*'|[^'">])*>/gi;for(let a of e.matchAll(i)){let l=a[0];if(/^<\/template\s*>$/i.test(l)){let c=n.pop();if(c)c.end=a.index}else if(/^<template\b/i.test(l)&&!/\/\s*>$/.test(l)){let b=[...l.slice(9).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)].find((P)=>/^(?:#[\w-]+|v-slot:[\w-]+|data-stx-slot-binding)$/i.test(P[1])),v=(b?.[2]??b?.[3])?.trim();if(v&&b?.[1]==="data-stx-slot-binding")try{v=decodeURIComponent(v)}catch{v=void 0}let T=v?{start:a.index+l.length,end:e.length,binding:v}:void 0;if(n.push(T),T)t.push(T)}}return t}var sn={},Li=new Map;function mc(e){let t=Li.get(e);if(!t){let n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=new RegExp(`:${n}(?!\\w)`,"g"),Li.set(e,t)}return t.lastIndex=0,t}var Gs={uppercase:(e,t)=>e!==void 0&&e!==null?String(e).toUpperCase():"",lowercase:(e,t)=>e!==void 0&&e!==null?String(e).toLowerCase():"",capitalize:(e,t)=>{if(e===void 0||e===null)return"";let n=String(e);return n.charAt(0).toUpperCase()+n.slice(1)},number:(e,t,n=0)=>{if(e===void 0||e===null)return"";try{let i=Number(e);return Number.isNaN(i)?"":i.toFixed(Number.parseInt(String(n),10))}catch{return""}},fmt:(e,t,n="en-US")=>{if(e===void 0||e===null)return"";try{let i=Number(e);if(Number.isNaN(i))return String(e);return i.toLocaleString(n)}catch{return String(e)}},join:(e,t,n=",")=>{if(!Array.isArray(e))return"";return e.join(String(n))},escape:(e,t)=>{if(e===void 0||e===null)return"";return W(String(e))},translate:(e,t,n={})=>{if(!t||!t.__translations)return e;let i=t.__translations,a=t.__i18nConfig?.fallbackToKey??!0,l=String(e).split("."),c=i;for(let v of l){if(c===void 0||c===null)break;c=c[v]}if(c===void 0||c===null)return a?e:"";let b=String(c);return Object.entries(n).forEach(([v,T])=>{b=b.replace(mc(v),()=>String(T))}),b},t:(e,t,n={})=>Gs.translate(e,t,n),truncate:(e,t,n=50,i="...")=>{if(e===void 0||e===null)return"";let a=String(e);if(a.length<=n)return a;if(n<=i.length)return i.substring(0,n);return a.substring(0,n-i.length)+i},date:(e,t,n="short",i="en-US")=>{if(e===void 0||e===null)return"";try{let a=e instanceof Date?e:new Date(e);if(Number.isNaN(a.getTime()))return String(e);let l={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(n==="iso")return a.toISOString();return new Intl.DateTimeFormat(i,l[n]||l.short).format(a)}catch{return String(e)}},currency:(e,t,n="USD",i="en-US")=>{if(e===void 0||e===null)return"";try{let a=Number(e);if(Number.isNaN(a))return String(e);return new Intl.NumberFormat(i,{style:"currency",currency:n}).format(a)}catch{return String(e)}},pluralize:(e,t,n,i)=>{let a=Number(e);if(Number.isNaN(a))return n;let l=i||`${n}s`;return a===1?n:l},first:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[0];return String(e).charAt(0)},last:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[e.length-1];let n=String(e);return n.charAt(n.length-1)},length:(e,t)=>{if(e===void 0||e===null)return 0;if(Array.isArray(e)||typeof e==="string")return e.length;if(e instanceof Map||e instanceof Set)return e.size;if(typeof e==="object")return Object.keys(e).length;return 0},json:(e,t,n=!1)=>{if(e===void 0)return"undefined";if(e===null)return"null";try{return n?JSON.stringify(e,null,2):JSON.stringify(e)}catch{return String(e)}},default:(e,t,n="")=>e===void 0||e===null||e===""?n:e,reverse:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return[...e].reverse();return String(e).split("").reverse().join("")},slice:(e,t,n=0,i)=>{if(e===void 0||e===null)return"";if(Array.isArray(e)||typeof e==="string")return e.slice(n,i);return e},replace:(e,t,n,i="")=>{if(e===void 0||e===null)return"";let a=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(e).replace(new RegExp(a,"g"),()=>i)},stripTags:(e,t)=>{if(e===void 0||e===null)return"";return String(e).replace(/<[^>]*>/g,"")},urlencode:(e,t)=>{if(e===void 0||e===null)return"";return encodeURIComponent(String(e))},abs:(e,t)=>{let n=Number(e);return Number.isNaN(n)?0:Math.abs(n)},round:(e,t,n=0)=>{let i=Number(e);if(Number.isNaN(i))return 0;let a=10**n;return Math.round(i*a)/a}};function _g(e,t){if(e in Gs)console.warn(`Filter "${e}" already exists as a built-in filter. Custom filter will take precedence.`);sn[e]=t}function ay(e){for(let[t,n]of Object.entries(e))_g(t,n)}function Cg(){return{...Gs,...sn}}function cy(){for(let e of Object.keys(sn))delete sn[e]}function Ui(e){let t=e.next();while(!t.done)t=e.next();return t.value}function*Hi(e,t,n,i){let a="{".repeat(n);if(!e.includes(a))return e;let l="",c=0,b=0,v=i===Number.POSITIVE_INFINITY?0:performance.now();for(;;){let T=e.indexOf(a,c);if(T===-1)break;let P=xe(e,T,n);if(P===-1)break;if(l+=e.slice(c,T)+t(e.slice(T,P+n),e.slice(T+n,P),T),c=P+n,++b>=64){b=0;let D=performance.now();if(D-v>=i)v=D,yield}}return c===0?e:l+e.slice(c)}function Sn(e,t,n=2){return Ui(Hi(e,t,n,Number.POSITIVE_INFINITY))}function hc(e,t,n){let i=n[0];if(i!=="'"&&i!=='"'&&i!=="`")return!1;let a=Cr(e,t);if(!a||a.kind!=="attribute"||a.quote===i)return!1;if(!/^(?::|@|x-|v-)/.test(a.name))return!1;let l=0;for(let c=0;c<a.valuePrefix.length;c++)if(a.valuePrefix[c]==="\\")c++;else if(a.valuePrefix[c]===i)l++;return l%2===1}function p(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function W(e){return Ai(p(e))}function xc(e){return e.replace(/ /g," ").replace(/\t/g,"	").replace(/\n/g," ").replace(/\r/g," ").replace(/\f/g,"").replace(/=/g,"=").replace(/`/g,"`")}function bc(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\([\dA-Fa-f]{1,6})\s?/g,(t,n)=>String.fromCodePoint(Number.parseInt(n,16))).replace(/\\([^\r\n])/g,"$1").replace(/[\u0000-\u0020]+/g,"").toLowerCase()}function yc(e,t){let n=bc(e);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(n))throw new ie(t,"network-capable or executable CSS is not allowed in an escaped interpolation");let i=/url\(([^)]*)\)/g,a;while((a=i.exec(n))!==null){let l=a[1].replace(/^["']|["']$/g,""),c=l.startsWith("/")&&!l.startsWith("//")||l.startsWith("./")||l.startsWith("../")||l.startsWith("#"),b=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(l);if(!c&&!b)throw new ie(t,"CSS URLs must be local paths or base64 raster images")}}function Q(e,t,n,i=!1,a=0){try{return _c(e,t,n,i,a)}catch(l){if(l instanceof ie)l.locate(e,t);throw l}}function _c(e,t,n,i,a){let l=Cr(e,t,i),c=W(n);if(!l)return c;if(l.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(n))throw new ie("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return n}if(l.kind==="tag"){let T=e.slice(t+a).trimStart(),P=n.trim();if(!T.startsWith("=")&&(P===""||P.split(/\s+/).every((D)=>/^(?!on)[A-Za-z_:][\w:.-]*$/.test(D))))return P;throw new ie("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let b=l.name.toLowerCase();if(/^on[a-z]/.test(b))throw new ie(l.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(b==="srcdoc")c=W(c);if(b==="style")yc(n,l.name);if(l.quote===null)c=xc(c);let v=As(b);if(v&&l.valuePrefix.trim()===""&&Kn(n,v))return Ii+c;return Oi(Pi(e,t),n,c)}function kn(e,t){let n=` ${e}="`;return Q(n,n.length,t,!0)}function qi(e){return e.flatMap((t)=>{let n=t.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);return!n||/\bserver\b|\bsrc\s*=/.test(n[1])?[]:[n[2]]})}function ke(e,t){let{scripts:n}=J(e);for(let i of qi(n)){if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(i)||sl.test(i))return!0;if(Lr(i,t))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(e))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(e))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(e))return!0;return!1}function Eg(e){let t=[],n=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let i=n.exec(e);i;i=n.exec(e)){let a=i[1].toLowerCase(),l=new Set(Y(i[3]));if(l.size===0)continue;let c=i.index+i[0].length;if(i[0].endsWith("/>")){t.push({start:i.index,end:c,names:l});continue}let b=new RegExp(`<(/?)${a}\\b[^>]*?(/?)>`,"gi");b.lastIndex=c;let v=1,T=e.length;for(let P=b.exec(e);P;P=b.exec(e)){if(P[2]==="/")continue;if(v+=P[1]==="/"?-1:1,v===0){T=P.index+P[0].length;break}}t.push({start:i.index,end:T,names:l})}return t}function zi(e,t,n){let i=r(n);for(let a of e){if(t<a.start||t>=a.end)continue;for(let l of a.names)if(new RegExp(`(?<![.#\\w$])${l.replace(/\$/g,"\\$")}(?![\\w$])`).test(i))return!0}return!1}function Bi(e,t){let n=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","URL","URLSearchParams","Intl","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console","new","typeof","instanceof","in","void"],i=e.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),a="",l=!1,c=0;for(let T=0;T<i.length;T++){let P=i[T];if(!l&&P==="`"){l=!0,c=0;continue}if(l){if(P==="`"&&c===0){l=!1;continue}if(P==="$"&&i[T+1]==="{"){c++,T++,a+=" ";continue}if(P==="}"&&c>0){c--;continue}if(c>0){a+=P;continue}continue}a+=P}i=a;let b=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,v;while((v=b.exec(i))!==null){let T=v[1];if(!i.substring(0,v.index).trimEnd().endsWith(".")){if(!n.includes(T)&&!(T in t))return!1}}return!0}function wc(e,t){let n=r(e);for(let i of n.matchAll(/(?<![.\w$])([A-Z_$][\w$]*)\s*\(/gi))if(typeof t[i[1]]==="function")return!0;return!1}function Sc(e,t){let n=t.__stx_serverDeclared;if(!n||n.size===0)return!1;let i=r(e);for(let a of n)if(new RegExp(`(?<![.#\\w$])${a}(?![\\w$])`).test(i))return!0;return!1}var Wi=new Set;function Fi(e){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(e.trim())}function $c(e,t,n){let i=n[0];if(i!=="'"&&i!=='"'&&i!=="`")return!1;let a=0;for(let l=e.lastIndexOf(`
|
|
217
|
-
`,t-1)+1;l<t;l++)if(e[l]==="\\")l++;else if(e[l]===i)a++;return a%2===1}function Vi(e,t){let n=`${t??"<unknown>"}\x00${e}`;if(process.env.STX_DEBUG||!Wi.has(n))Wi.add(n),console.warn(`[stx] {{ ${e} }} in a <script> in ${t??"<unknown>"} has no server value, so it was emitted as undefined. A mustache left in JavaScript is a SyntaxError that takes the whole script down, so give the value a default in <script server>.`);return"undefined"}function Ci(e,t,n){let i=e;return i=i.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>{try{let c=A(l,t);if(c===void 0)return Fi(l)?Vi(l.trim(),n):a;return c===null?"":String(c)}catch{return a}}),i=Sn(i,(a,l,c)=>{let b=l.trim();if($c(i,c,l))return a;if(/^__[A-Z_]+__$/.test(b))return a;try{let v=A(l,t);if(v===void 0)return Fi(b)?Vi(b,n):a;return JSON.stringify(v).replace(/</g,"\\u003c").replace(/@/g,"\\u0040").replace(/\{{2,}/g,(T)=>"\\u007b".repeat(T.length)).replace(/\{(?=!)/g,"\\u007b")}catch{return a}}),i}function Tg(e,t){if(!e.includes("{"))return e;let n=e;return n=n.replace(/\{!!([\s\S]*?)!!\}/g,(i,a)=>{try{let l=A(a,t);if(l===void 0)return i;return l===null?"":String(l)}catch{return i}}),n=Sn(n,(i,a,l)=>{let c=a.trim();if(/^__[A-Z_]+__$/.test(c))return i;try{let b=A(a,t);if(b===void 0)return i;if(b===null)return"";let v=String(b);return Q(n,l,v,!0,i.length)}catch(b){if(b instanceof
|
|
216
|
+
`}),ai(e,a)}function ai(e,t){if(t.length===0)return e;t.sort((l,c)=>l.start-c.start||l.end-c.end);let n=Array(t.length*2+1),i=0,a=0;for(let l of t)n[a++]=e.slice(i,l.start),n[a++]=l.replacement,i=l.end;return n[a]=e.slice(i),n.join("")}function ci(e){let t=Hn(e),n=new Map;if(t)for(let[i,a]of t)n.set(i,a.instances);return n}function li(e,t){let n=Hn(e);if(!n)return[];let i=[];for(let[a,l]of n){let c=l.instances-(t.get(a)??0);if(c>0)i.push({body:l.body,count:c})}return i}function Ri(e,t){for(let{body:n,count:i}of t)for(let a=0;a<i;a++)Rs(e,n)}function xe(e,t,n=2){let i=0,a=null;for(let l=t+n;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==="{"){i++;continue}if(c==="}"){if(i>0){i--;continue}let b=0;while(e[l+b]==="}")b++;if(b>=n)return l}}return-1}import Ni from"fs";var Ti=0,Ts=new Map;function il(){Ti=0,Ts.clear()}function qn(e,t){let n=Ti++,i=`<!--__STX_${e.toUpperCase()}_${n}__-->`;return Ts.set(i,{type:e,expression:t}),i}function al(){let e={};for(let[t,n]of Ts)e[t]={type:n.type,expression:n.expression};return e}function cl(e,t){let n=e;for(let[i,a]of t)n=n.split(i).join(a);return n}function _i(e){return e.includes("<!--__STX_")}var sc=/@(?=[a-zA-Z_]\w*\s*\(|end[a-zA-Z]*\b|else(?:if)?\b|empty\b|case\b|default\b|break\b|continue\b|fallback\b)/g;function rc(e){return Array.from({length:e},()=>"{").join("⁠")}function Ai(e){return e.replace(/\{{2,}/g,(t)=>rc(t.length)).replace(/\{(?=!)/g,"{⁠").replace(sc,"@")}function Cr(e,t,n=!1){let{openTag:i,tail:a}=n?ic(e,t):oc(e).at(t);return cc(a,i,n)}function ic(e,t){let n="",i=0;for(let c=0;c<t;c++){if(!e.startsWith("{{",c))continue;let b=xe(e,c);if(b<0||b+2>t)break;n+=e.slice(i,c)+"x",c=b+1,i=b+2}n+=e.slice(i,t);let a=-1,l=null;for(let c=0;c<n.length;c++){let b=n[c];if(l){if(b===l)l=null;continue}if(b==='"'||b==="'"){l=b;continue}if(b===">"){a=-1;continue}if(b==="<")a=c}return{openTag:a,tail:a>=0?n.slice(a+1):n}}var Zn=null;function oc(e){if(Zn&&Zn.source===e)return Zn.scanner;let t=ac(e);return Zn={source:e,scanner:t},t}function ac(e){let t=0,n=-1,i=null,a=-1,l=(b,v)=>{let T=e[b];if(v.quote){if(T===v.quote)v.quote=null;return}if(v.openTag>=0){if(T==='"'||T==="'"){v.quote=T;return}if(T===">"){v.openTag=-1;return}}if(T==="<")v.openTag=b},c=(b,v)=>{if(v.openTag>=0||!e.startsWith("<!--",b))return-1;let T=e.indexOf("-->",b+4);return T<0?e.length:T+3};return{at(b){if(b<t)t=0,n=-1,i=null,a=-1;let v={openTag:n,quote:i},T=!1;while(t<b){if(a<0&&e.startsWith("{{",t)){let F=xe(e,t);if(F<0)a=t;else if(F+2<=b){t=F+2;continue}else break}let L=c(t,v);if(L>=0){if(L>b){T=!0;break}t=L;continue}l(t,v),t++}if(n=v.openTag,i=v.quote,T)return{openTag:-1,tail:""};let P=a>=0?a:t,D={openTag:n,quote:i};for(let L=t;L<b;L++){let F=c(L,D);if(F>=0){if(F>b)return{openTag:-1,tail:""};L=F-1;continue}l(L,D)}if(D.openTag<0)return{openTag:-1,tail:""};let H="",O=D.openTag+1;for(let L=O;L<Math.min(b,P);L++){if(!e.startsWith("{{",L))continue;let F=xe(e,L);H+=e.slice(O,L)+"x",L=F+1,O=F+2}return H+=e.slice(O,b),{openTag:D.openTag,tail:H}}}}function cc(e,t,n){if(t<0&&!n)return null;if(t>=0&&/^\s*[!/?]/.test(e))return/^\s*\/?\s*$/.test(e)?{kind:"tag-name"}:null;if(t>=0&&/^\s*$/.test(e))return{kind:"tag-name"};let i=0;if(t>=0)while(i<e.length&&!/\s/.test(e[i]))i++;while(i<e.length){while(/\s/.test(e[i]??"")&&i<e.length)i++;let a=i;while(i<e.length&&!/[\s=/>]/.test(e[i]))i++;let l=e.slice(a,i);if(!l)break;while(i<e.length&&/\s/.test(e[i]))i++;if(e[i]!=="=")continue;i++;while(i<e.length&&/\s/.test(e[i]))i++;let c=e[i];if(c==='"'||c==="'"){let b=++i,v=e.indexOf(c,i);if(v===-1)return{kind:"attribute",name:l,quote:c,valuePrefix:e.slice(b)};i=v+1}else{let b=i;while(i<e.length&&!/\s/.test(e[i]))i++;if(i===e.length)return{kind:"attribute",name:l,quote:null,valuePrefix:e.slice(b)}}}return{kind:"tag"}}class ae extends Error{attribute;near;constructor(e,t){super(`Unsafe interpolation in ${e}: ${t}`);this.name="UnsafeInterpolationContextError",this.attribute=e}locate(e,t){if(this.near===void 0)this.near=e.slice(Math.max(0,t-160),t).replace(/\s+/g," ").trim(),this.message+=` (after: ${JSON.stringify(this.near)})`;return this}}var Ii="unsafe:";var lc=/^(?:javascript|vbscript|livescript|mocha|view-source):/,uc=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,fc=/^data:(?:text\/html|application\/xhtml\+xml)/,pc=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function dc(e){return e.replace(pc,"").toLowerCase()}function As(e){let t=e.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(t))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(t))return"fetched";return null}function Kn(e,t="navigable"){let n=dc(e);if(lc.test(n))return!0;return t==="navigable"?uc.test(n):fc.test(n)}function _r(e,t="navigable"){return Kn(e,t)?"unsafe:"+e:e}function gc(e){let t=e.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!t)return null;if(t[3].trim()!=="")return null;return As(t[1])}function Pi(e,t,n=256){if(t<=n)return e.slice(0,t);let i=e.slice(t-n,t),a=i.search(/[\s"'`/]/);return a===-1?"":i.slice(a)}function Oi(e,t,n=t){let i=gc(e);return i&&Kn(t,i)?"unsafe:"+n:n}function Nt(e){let t=e.indexOf(" as ");if(t!==-1){let l=e.slice(0,t).trim(),c=e.slice(t+4).trim();return l&&c?{arrayExpr:l,itemVar:c}:null}let n=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(e);if(!n)return null;let i=n[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),a=n[2].trim();return i&&a?{arrayExpr:a,itemVar:i}:null}function Xn(e){let t=[],n=0,i="",a=0;for(let l=0;l<e.length;l++){let c=e[l];if(i){if(c==="\\")l++;else if(c===i)i="";continue}if(c==="'"||c==='"'||c==="`")i=c;else if(c==="("||c==="["||c==="{")n++;else if(c===")"||c==="]"||c==="}")n--;else if(c===","&&n===0)t.push(e.slice(a,l)),a=l+1}return t.push(e.slice(a)),t}function Mi(e,t){let n=0;for(let i=0;i<e.length;i++){let a=e[i];if(a==="("||a==="["||a==="{")n++;else if(a===")"||a==="]"||a==="}")n--;else if(a===t&&n===0)return i}return-1}function ji(e){let t=0;for(let n=0;n<e.length;n++){let i=e[n];if(i==="("||i==="["||i==="{")t++;else if((i===")"||i==="]"||i==="}")&&--t===0)return n}return-1}function vt(e,t){let n=e.trim().replace(/^\.\.\./,"").trim(),i=Mi(n,"=");if(i!==-1&&n[i+1]!==">")n=n.slice(0,i).trim();if(!n)return;if(n.startsWith("{")&&n.endsWith("}")){for(let a of Xn(n.slice(1,-1))){let l=a.trim();if(!l)continue;if(l.startsWith("...")){vt(l,t);continue}let c=Mi(l,":");vt(c===-1?l:l.slice(c+1),t)}return}if(n.startsWith("[")&&n.endsWith("]")){for(let a of Xn(n.slice(1,-1)))vt(a,t);return}if(/^[A-Z_$][\w$]*$/i.test(n))t.push(n)}function Y(e){let t=e.trim(),n=[],i=0;for(let l=0;l<t.length;l++){let c=t[l];if(c==="("||c==="["||c==="{")i++;else if(c===")"||c==="]"||c==="}")i--;else if(i===0&&/\s/.test(c)){if(!/^\s+(?:in|of)\s/.exec(t.slice(l)))continue;let v=t.slice(0,l).trim();if(v.startsWith("(")&&ji(v)===v.length-1)v=v.slice(1,-1);for(let T of Xn(v))vt(T,n);if(n.length>0)return n;break}}let a=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(t);if(a){let l=a[1].trim();if(l.startsWith("(")&&ji(l)===l.length-1)l=l.slice(1,-1);let c=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(l);if(c)vt(c[2],n),vt(c[1],n);else for(let b of Xn(l))vt(b,n)}return n}function N(e,t){let n=t instanceof Set?t:new Set(t);if(n.size===0)return!1;let c=e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g," ").replace(/`(?:[^`\\$]|\\.|\$(?!\{))*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:(?!:))/g,"$1$2");for(let b of c.match(/[a-zA-Z_$][\w$]*/g)||[])if(n.has(b))return!0;return!1}var Jn="__stx_client_loop_names";function st(e){let t=e?.[Jn];return Array.isArray(t)?t:[]}function Gn(e){if(!e.includes("#")&&!e.includes("v-slot:")&&!e.includes("data-stx-slot-binding"))return[];let t=[],n=[],i=/<!--[\s\S]*?-->|<script\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/script\s*>|<style\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/style\s*>|<\/?[a-z][\w:-]*\b(?:"[^"]*"|'[^']*'|[^'">])*>/gi;for(let a of e.matchAll(i)){let l=a[0];if(/^<\/template\s*>$/i.test(l)){let c=n.pop();if(c)c.end=a.index}else if(/^<template\b/i.test(l)&&!/\/\s*>$/.test(l)){let b=[...l.slice(9).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)].find((P)=>/^(?:#[\w-]+|v-slot:[\w-]+|data-stx-slot-binding)$/i.test(P[1])),v=(b?.[2]??b?.[3])?.trim();if(v&&b?.[1]==="data-stx-slot-binding")try{v=decodeURIComponent(v)}catch{v=void 0}let T=v?{start:a.index+l.length,end:e.length,binding:v}:void 0;if(n.push(T),T)t.push(T)}}return t}var sn={},Li=new Map;function mc(e){let t=Li.get(e);if(!t){let n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=new RegExp(`:${n}(?!\\w)`,"g"),Li.set(e,t)}return t.lastIndex=0,t}var Gs={uppercase:(e,t)=>e!==void 0&&e!==null?String(e).toUpperCase():"",lowercase:(e,t)=>e!==void 0&&e!==null?String(e).toLowerCase():"",capitalize:(e,t)=>{if(e===void 0||e===null)return"";let n=String(e);return n.charAt(0).toUpperCase()+n.slice(1)},number:(e,t,n=0)=>{if(e===void 0||e===null)return"";try{let i=Number(e);return Number.isNaN(i)?"":i.toFixed(Number.parseInt(String(n),10))}catch{return""}},fmt:(e,t,n="en-US")=>{if(e===void 0||e===null)return"";try{let i=Number(e);if(Number.isNaN(i))return String(e);return i.toLocaleString(n)}catch{return String(e)}},join:(e,t,n=",")=>{if(!Array.isArray(e))return"";return e.join(String(n))},escape:(e,t)=>{if(e===void 0||e===null)return"";return W(String(e))},translate:(e,t,n={})=>{if(!t||!t.__translations)return e;let i=t.__translations,a=t.__i18nConfig?.fallbackToKey??!0,l=String(e).split("."),c=i;for(let v of l){if(c===void 0||c===null)break;c=c[v]}if(c===void 0||c===null)return a?e:"";let b=String(c);return Object.entries(n).forEach(([v,T])=>{b=b.replace(mc(v),()=>String(T))}),b},t:(e,t,n={})=>Gs.translate(e,t,n),truncate:(e,t,n=50,i="...")=>{if(e===void 0||e===null)return"";let a=String(e);if(a.length<=n)return a;if(n<=i.length)return i.substring(0,n);return a.substring(0,n-i.length)+i},date:(e,t,n="short",i="en-US")=>{if(e===void 0||e===null)return"";try{let a=e instanceof Date?e:new Date(e);if(Number.isNaN(a.getTime()))return String(e);let l={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(n==="iso")return a.toISOString();return new Intl.DateTimeFormat(i,l[n]||l.short).format(a)}catch{return String(e)}},currency:(e,t,n="USD",i="en-US")=>{if(e===void 0||e===null)return"";try{let a=Number(e);if(Number.isNaN(a))return String(e);return new Intl.NumberFormat(i,{style:"currency",currency:n}).format(a)}catch{return String(e)}},pluralize:(e,t,n,i)=>{let a=Number(e);if(Number.isNaN(a))return n;let l=i||`${n}s`;return a===1?n:l},first:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[0];return String(e).charAt(0)},last:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[e.length-1];let n=String(e);return n.charAt(n.length-1)},length:(e,t)=>{if(e===void 0||e===null)return 0;if(Array.isArray(e)||typeof e==="string")return e.length;if(e instanceof Map||e instanceof Set)return e.size;if(typeof e==="object")return Object.keys(e).length;return 0},json:(e,t,n=!1)=>{if(e===void 0)return"undefined";if(e===null)return"null";try{return n?JSON.stringify(e,null,2):JSON.stringify(e)}catch{return String(e)}},default:(e,t,n="")=>e===void 0||e===null||e===""?n:e,reverse:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return[...e].reverse();return String(e).split("").reverse().join("")},slice:(e,t,n=0,i)=>{if(e===void 0||e===null)return"";if(Array.isArray(e)||typeof e==="string")return e.slice(n,i);return e},replace:(e,t,n,i="")=>{if(e===void 0||e===null)return"";let a=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(e).replace(new RegExp(a,"g"),()=>i)},stripTags:(e,t)=>{if(e===void 0||e===null)return"";return String(e).replace(/<[^>]*>/g,"")},urlencode:(e,t)=>{if(e===void 0||e===null)return"";return encodeURIComponent(String(e))},abs:(e,t)=>{let n=Number(e);return Number.isNaN(n)?0:Math.abs(n)},round:(e,t,n=0)=>{let i=Number(e);if(Number.isNaN(i))return 0;let a=10**n;return Math.round(i*a)/a}};function _g(e,t){if(e in Gs)console.warn(`Filter "${e}" already exists as a built-in filter. Custom filter will take precedence.`);sn[e]=t}function ay(e){for(let[t,n]of Object.entries(e))_g(t,n)}function Cg(){return{...Gs,...sn}}function cy(){for(let e of Object.keys(sn))delete sn[e]}function Ui(e){let t=e.next();while(!t.done)t=e.next();return t.value}function*Hi(e,t,n,i){let a="{".repeat(n);if(!e.includes(a))return e;let l="",c=0,b=0,v=i===Number.POSITIVE_INFINITY?0:performance.now();for(;;){let T=e.indexOf(a,c);if(T===-1)break;let P=xe(e,T,n);if(P===-1)break;if(l+=e.slice(c,T)+t(e.slice(T,P+n),e.slice(T+n,P),T),c=P+n,++b>=64){b=0;let D=performance.now();if(D-v>=i)v=D,yield}}return c===0?e:l+e.slice(c)}function Sn(e,t,n=2){return Ui(Hi(e,t,n,Number.POSITIVE_INFINITY))}function hc(e,t,n){let i=n[0];if(i!=="'"&&i!=='"'&&i!=="`")return!1;let a=Cr(e,t);if(!a||a.kind!=="attribute"||a.quote===i)return!1;if(!/^(?::|@|x-|v-)/.test(a.name))return!1;let l=0;for(let c=0;c<a.valuePrefix.length;c++)if(a.valuePrefix[c]==="\\")c++;else if(a.valuePrefix[c]===i)l++;return l%2===1}function p(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function W(e){return Ai(p(e))}function xc(e){return e.replace(/ /g," ").replace(/\t/g,"	").replace(/\n/g," ").replace(/\r/g," ").replace(/\f/g,"").replace(/=/g,"=").replace(/`/g,"`")}function bc(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\([\dA-Fa-f]{1,6})\s?/g,(t,n)=>String.fromCodePoint(Number.parseInt(n,16))).replace(/\\([^\r\n])/g,"$1").replace(/[\u0000-\u0020]+/g,"").toLowerCase()}function yc(e,t){let n=bc(e);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(n))throw new ae(t,"network-capable or executable CSS is not allowed in an escaped interpolation");let i=/url\(([^)]*)\)/g,a;while((a=i.exec(n))!==null){let l=a[1].replace(/^["']|["']$/g,""),c=l.startsWith("/")&&!l.startsWith("//")||l.startsWith("./")||l.startsWith("../")||l.startsWith("#"),b=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(l);if(!c&&!b)throw new ae(t,"CSS URLs must be local paths or base64 raster images")}}function Q(e,t,n,i=!1,a=0){try{return _c(e,t,n,i,a)}catch(l){if(l instanceof ae)l.locate(e,t);throw l}}function _c(e,t,n,i,a){let l=Cr(e,t,i),c=W(n);if(!l)return c;if(l.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(n))throw new ae("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return n}if(l.kind==="tag"){let T=e.slice(t+a).trimStart(),P=n.trim();if(!T.startsWith("=")&&(P===""||P.split(/\s+/).every((D)=>/^(?!on)[A-Za-z_:][\w:.-]*$/.test(D))))return P;throw new ae("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let b=l.name.toLowerCase();if(/^on[a-z]/.test(b))throw new ae(l.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(b==="srcdoc")c=W(c);if(b==="style")yc(n,l.name);if(l.quote===null)c=xc(c);let v=As(b);if(v&&l.valuePrefix.trim()===""&&Kn(n,v))return Ii+c;return Oi(Pi(e,t),n,c)}function kn(e,t){let n=` ${e}="`;return Q(n,n.length,t,!0)}function qi(e){return e.flatMap((t)=>{let n=t.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);return!n||/\bserver\b|\bsrc\s*=/.test(n[1])?[]:[n[2]]})}function ke(e,t){let{scripts:n}=J(e);for(let i of qi(n)){if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(i)||sl.test(i))return!0;if(Lr(i,t))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(e))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(e))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(e))return!0;return!1}function Eg(e){let t=[],n=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let i=n.exec(e);i;i=n.exec(e)){let a=i[1].toLowerCase(),l=new Set(Y(i[3]));if(l.size===0)continue;let c=i.index+i[0].length;if(i[0].endsWith("/>")){t.push({start:i.index,end:c,names:l});continue}let b=new RegExp(`<(/?)${a}\\b[^>]*?(/?)>`,"gi");b.lastIndex=c;let v=1,T=e.length;for(let P=b.exec(e);P;P=b.exec(e)){if(P[2]==="/")continue;if(v+=P[1]==="/"?-1:1,v===0){T=P.index+P[0].length;break}}t.push({start:i.index,end:T,names:l})}return t}function zi(e,t,n){let i=r(n);for(let a of e){if(t<a.start||t>=a.end)continue;for(let l of a.names)if(new RegExp(`(?<![.#\\w$])${l.replace(/\$/g,"\\$")}(?![\\w$])`).test(i))return!0}return!1}function Bi(e,t){let n=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","URL","URLSearchParams","Intl","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console","new","typeof","instanceof","in","void"],i=e.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),a="",l=!1,c=0;for(let T=0;T<i.length;T++){let P=i[T];if(!l&&P==="`"){l=!0,c=0;continue}if(l){if(P==="`"&&c===0){l=!1;continue}if(P==="$"&&i[T+1]==="{"){c++,T++,a+=" ";continue}if(P==="}"&&c>0){c--;continue}if(c>0){a+=P;continue}continue}a+=P}i=a;let b=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,v;while((v=b.exec(i))!==null){let T=v[1];if(!i.substring(0,v.index).trimEnd().endsWith(".")){if(!n.includes(T)&&!(T in t))return!1}}return!0}function wc(e,t){let n=r(e);for(let i of n.matchAll(/(?<![.\w$])([A-Z_$][\w$]*)\s*\(/gi))if(typeof t[i[1]]==="function")return!0;return!1}function Sc(e,t){let n=t.__stx_serverDeclared;if(!n||n.size===0)return!1;let i=r(e);for(let a of n)if(new RegExp(`(?<![.#\\w$])${a}(?![\\w$])`).test(i))return!0;return!1}var Wi=new Set;function Fi(e){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(e.trim())}function $c(e,t,n){let i=n[0];if(i!=="'"&&i!=='"'&&i!=="`")return!1;let a=0;for(let l=e.lastIndexOf(`
|
|
217
|
+
`,t-1)+1;l<t;l++)if(e[l]==="\\")l++;else if(e[l]===i)a++;return a%2===1}function Vi(e,t){let n=`${t??"<unknown>"}\x00${e}`;if(process.env.STX_DEBUG||!Wi.has(n))Wi.add(n),console.warn(`[stx] {{ ${e} }} in a <script> in ${t??"<unknown>"} has no server value, so it was emitted as undefined. A mustache left in JavaScript is a SyntaxError that takes the whole script down, so give the value a default in <script server>.`);return"undefined"}function Ci(e,t,n){let i=e;return i=i.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>{try{let c=A(l,t);if(c===void 0)return Fi(l)?Vi(l.trim(),n):a;return c===null?"":String(c)}catch{return a}}),i=Sn(i,(a,l,c)=>{let b=l.trim();if($c(i,c,l))return a;if(/^__[A-Z_]+__$/.test(b))return a;try{let v=A(l,t);if(v===void 0)return Fi(b)?Vi(b,n):a;return JSON.stringify(v).replace(/</g,"\\u003c").replace(/@/g,"\\u0040").replace(/\{{2,}/g,(T)=>"\\u007b".repeat(T.length)).replace(/\{(?=!)/g,"\\u007b")}catch{return a}}),i}function Tg(e,t){if(!e.includes("{"))return e;let n=e;return n=n.replace(/\{!!([\s\S]*?)!!\}/g,(i,a)=>{try{let l=A(a,t);if(l===void 0)return i;return l===null?"":String(l)}catch{return i}}),n=Sn(n,(i,a,l)=>{let c=a.trim();if(/^__[A-Z_]+__$/.test(c))return i;try{let b=A(a,t);if(b===void 0)return i;if(b===null)return"";let v=String(b);return Q(n,l,v,!0,i.length)}catch(b){if(b instanceof ae)throw b;return i}}),n}function ly(e,t,n={}){let{output:i,scripts:a}=J(e),l=a.map((c)=>{let b=c.match(/^<script\b((?:[^>\"']|\"[^\"]*\"|'[^']*')*)>/i),v=c.search(/<\/script\s*>$/i);if(!b||v===-1)return c;let T=b[1],P=c.slice(b[0].length,v);if(/\bdata-raw\b/.test(T))return c;if(n.skipServer&&/\bserver\b/.test(T))return c;let H=`<script${Tg(T,t)}>`;if(/\bsrc\s*=/.test(T)||/\btype\s*=\s*["']application\/json["']/.test(T))return H+P+c.slice(v);return H+Ci(P,t)+c.slice(v)});return kr(i,l)}function*Zi(e,t,n,i){let a=e,l=(F,B)=>{let ee=mn(F,B);if(ee===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(F.slice(B,ee))?-1:ee},c=(F,B,ee,X)=>{let j=ee.length,{output:te,tokens:se}=fe(F,B,(ne,ue)=>X(j+ue));return ee.push(...se),te},b=[];a=c(a,l,b,(F)=>`<!--__STX_STYLE_${F}__-->`);let v=[];a=c(a,q,v,(F)=>`<!--__STX_SCRIPT_EXPR_${F}__-->`);let T=t?.__stx_signals_gate===!0||ke(e),P=new Set([...Array.isArray(t?.__stx_client_signal_names)?t.__stx_client_signal_names:[],...ki(qi(v))]),D=new Set(Array.isArray(t?.__stx_preserved_client_expressions)?t.__stx_preserved_client_expressions:[]);a=Sn(a,(F,B,ee)=>{if(N(B,P))return F;try{let X=A(B,t,!1,(j)=>Is(j,F,n,e));return X!==void 0&&X!==null?String(X):""}catch(X){let j=X instanceof Error?X.message:String(X);return m("Expression",`Error evaluating: {{{ ${B.trim()}}}}: ${j}`,n,e,ee,F)}},3),a=a.replace(/\{!!([\s\S]*?)!!\}/g,(F,B,ee)=>{if(N(B,P))return F;try{let X=A(B,t,!1,(j)=>Is(j,F,n,e));if(X===void 0&&t.__stx_buildMode==="compile")return qn("raw",B.trim());return X!==void 0&&X!==null?String(X):""}catch(X){if(t.__stx_buildMode==="compile")return qn("raw",B.trim());let j=X instanceof Error?X.message:String(X);return m("Expression",`Error evaluating: {!! ${B.trim()} !!}: ${j}`,n,e,ee,F)}}),a=c(a,q,v,(F)=>`<!--__STX_SCRIPT_EXPR_${F}__-->`),a=c(a,l,b,(F)=>`<!--__STX_STYLE_${F}__-->`);let H=T?Eg(a):[],O=Gn(a).map((F)=>({...F,names:new Set(Y(`${F.binding} in __slot`))})),L=new Set(st(t));if(a=yield*Hi(a,(F,B,ee)=>{let X=B.trim();if(hc(a,ee,B))return F;if(zi(O,ee,X))return F;if(N(X,L))return F;if(H.length>0&&zi(H,ee,X))return F;if(D.has(X))return F;let j=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],te=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,ne=X.match(te)?.[1],ue=ne&&((ne in t)||j.includes(ne)),ye=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,de=X.match(ye),Ae=de&&!j.includes(de[1])&&!(de[1]in t);if(/^__[A-Z_]+__$/.test(X))return"";if(N(X,P))return F;if(t.__stx_native_screen===!0&&wc(X,t))return F;let Ze;try{let Re=A(B,t,!1,(Ye)=>{Ze=Ye});if(T&&!Bi(X,t))return F;if(Ze)Is(Ze,F,n,e);if(t.__stx_buildMode==="compile"&&!T&&(Re===void 0||Sc(X,t)))return qn("expr",X);if(Re===void 0||Re===null)return"";let Ke=String(Re);return Q(a,ee,Ke,!1,F.length)}catch(Re){if(Re instanceof ae)throw Re;if(T&&!Bi(X,t))return F;if(Ae)return F;let Ke=Re instanceof Error?Re.message:String(Re);return m("Expression",`Error evaluating: {{ ${X} }}: ${Ke}`,n,e,ee,F)}},2,i),v.length>0)a=a.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(F,B)=>v[Number(B)]??F);if(b.length>0)a=a.replace(/<!--__STX_STYLE_(\d+)__-->/g,(F,B)=>b[Number(B)]??F);return a}function E(e,t,n){return Ui(Zi(e,t,n,Number.POSITIVE_INFINITY))}var vc=100;async function Ei(e,t,n,i=vc){let a=Zi(e,t,n,i),l=a.next();while(!l.done)await _(),l=a.next();return l.value}function $g(e,t,n){if(!t.trim())return e;let i=e,a=t.trim();while(a.length>0){let l=a.match(/^(\w+)/);if(!l)break;let c=l[1];a=a.substring(c.length).trim();let b=sn[c]||Gs[c];if(!b)throw Error(`Filter not found: ${c}. Available filters: ${Object.keys(Cg()).join(", ")}`);let v=[];if(a.startsWith(":")){let T=a.match(/^:([^|\s]+)/);if(T){let P=T[1].trim();try{let D=Number(P);v=[Number.isNaN(D)?P:D]}catch{v=[P]}a=a.substring(T[0].length).trim()}}else if(a.startsWith("(")){let T=1,P=1;while(T>0&&P<a.length){if(a[P]==="(")T++;if(a[P]===")")T--;P++}if(T===0){let D=a.substring(1,P-1).trim();if(D)try{if(D.startsWith("{")&&D.endsWith("}"))v=[A(`(${D})`,n,!0)];else{let H=[],O="",L=null,F=0,B=0,ee=0,X=!1;for(let j=0;j<D.length;j++){let te=D[j];if(X){O+=te,X=!1;continue}if(te==="\\"){O+=te,X=!0;continue}if(L){if(O+=te,te===L)L=null;continue}if(te==='"'||te==="'"||te==="`"){L=te,O+=te;continue}if(te==="(")F++;else if(te===")")F--;else if(te==="[")B++;else if(te==="]")B--;else if(te==="{")ee++;else if(te==="}")ee--;if(te===","&&F===0&&B===0&&ee===0){H.push(O),O="";continue}O+=te}if(O)H.push(O);v=H.map((j)=>{let te=j.trim();return A(te,n,!0)})}}catch{v=[D]}a=a.substring(P).trim()}}try{i=b(i,n,...v)}catch(T){let P=T instanceof Error?T.message:String(T);throw Error(`Error applying filter '${c}': ${P}`)}if(a.startsWith("|"))a=a.substring(1).trim();else break}return i}function Ec(e){let t=!1,n="",i=0,a=0,l=0,c=!1;for(let b=0;b<e.length;b++){let v=e[b],T=e[b+1];if(t&&c){c=!1;continue}if(t&&v==="\\"){c=!0;continue}if(c=!1,(v==='"'||v==="'"||v==="`")&&!c){if(!t)t=!0,n=v;else if(v===n)t=!1,n="";continue}if(t&&n==="`"&&v==="$"&&T==="{"){let P=1;b+=2;while(b<e.length&&P>0){if(e[b]==="{")P++;else if(e[b]==="}")P--;if(P>0)b++}continue}if(t)continue;if(v==="(")i++;else if(v===")")i--;else if(v==="[")a++;else if(v==="]")a--;else if(v==="{")l++;else if(v==="}")l--;if(v==="|"&&i===0&&a===0&&l===0){if(T==="|"){b++;continue}if(T==="="){b++;continue}return b}}return-1}var nn=new Set,kc=1000;function uy(){nn.clear()}function Is(e,t,n,i){if(!G())return;let a=`${n}\x00${e.expression}`;if(nn.has(a))return;if(nn.size>=kc)nn.clear();nn.add(a);let l=n,c=i;try{if(n&&Ni.existsSync(n))c=Ni.readFileSync(n,"utf8")}catch{}let b=c.indexOf(t);if(b>=0)l=`${n}:${c.slice(0,b).split(`
|
|
218
218
|
`).length}`;console.warn(`${l}: stx warning: ${t} rendered as an empty string. The safe evaluator rejected \`${e.expression}\` (${e.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function A(e,t,n=!1,i){try{let a=e.trim(),l=Ec(a);if(l>0){let b=a.substring(0,l).trim(),v=a.substring(l+1).trim(),T=A(b,t,!0,i);return $g(T,v,t)}let c=Js(a);if(c!==null){i?.({expression:a,rule:c});return}try{let b=Object.keys(t),v=Object.values(t);return d(a,b)(...v)}catch{return u(a,t)}}catch(a){if(a instanceof ReferenceError){let l=/(\b\w+)\s+is not defined/.exec(a.message);if(l){let c=l[1],b=Cc(c,Object.keys(t));if(b&&b!==c)a.message=`${a.message} \u2014 did you mean '${b}'?`}}if(!n)console.error(`Error evaluating expression: ${e}`,a);throw a}}function Cc(e,t){let n=null;for(let a of t){if(a===e)continue;let l=Rc(e,a);if(n===null||l<n.dist)n={key:a,dist:l}}if(!n)return null;let i=Math.max(e.length,n.key.length);if(n.dist<=2||n.dist/i<=0.35)return n.key;return null}function Rc(e,t){if(e===t)return 0;if(e.length===0)return t.length;if(t.length===0)return e.length;let[n,i]=e.length<t.length?[e,t]:[t,e],a=Array(n.length+1),l=Array(n.length+1);for(let c=0;c<=n.length;c++)a[c]=c;for(let c=1;c<=i.length;c++){l[0]=c;for(let b=1;b<=n.length;b++){let v=n[b-1]===i[c-1]?0:1;l[b]=Math.min(l[b-1]+1,a[b]+1,a[b-1]+v)}for(let b=0;b<=n.length;b++)a[b]=l[b]}return a[n.length]}function dy(e){if(!e)return"";return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}import Tc from"process";function C(e="STX_PUBLIC_"){let t={},n={};for(let[i,a]of Object.entries(Tc.env)){if(!i.startsWith(e)||a===void 0)continue;t[`import.meta.env.${i}`]=JSON.stringify(a),n[i]=a}return t["import.meta.env"]=JSON.stringify(n),t}function Ki(e,t=""){let n=`${e}${t}`,i=0;for(let a=0;a<n.length;a++){let l=n.charCodeAt(a);i=(i<<5)-i+l,i=i&i}return`stx-${Math.abs(i).toString(36)}`}function Xi(e,t,n={}){let{prefix:i="",preserveHost:a=!0,scopeKeyframes:l=!0,scopeCustomProperties:c=!1}=n;if(!e.trim())return"";let b=Ps(e),v=[],T=new Map;if(l)for(let P of b){let D=P.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(D){let H=D[1],O=`${t}_${H}`;T.set(H,O)}}for(let P of b){let D=Ji(P,t,i,a,T,c);v.push(D)}return v.join(`
|
|
219
219
|
|
|
220
220
|
`)}function Ps(e){let t=[],n=e.replace(/\/\*[\s\S]*?\*\//g,""),i=0,a="",l=!1,c="";for(let b=0;b<n.length;b++){let v=n[b];if(v==="@"&&i===0)l=!0;if(v==="{")i++;else if(v==="}"){if(i--,i===0){if(l){c+=v;let T=c.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(T){let[,P,D,H]=T;if(P==="keyframes")t.push({selector:`@keyframes ${D.trim()}`,declarations:H.trim()});else if(P==="media"||P==="supports"||P==="container"){let O=Ps(H);t.push({selector:`@${P} ${D.trim()}`,declarations:O.map((L)=>`${L.selector} { ${L.declarations} }`).join(`
|
|
@@ -573,17 +573,17 @@ ${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-g976n4r1.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=(oe)=>oe.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 oe=[X,X.toLowerCase(),ee(X),U(X)];for(let le of oe)if(te.has(le)){j=te.get(le);break}}let se=[];if(!j){let oe=[`${X}.stx`,`${ee(X)}.stx`,`${U(X)}.stx`],le=[...new Set(oe)],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 oe=Bo(j);ne=await Bun.file(j).text(),ln.set(j,ne),cr.set(j,oe)}catch(oe){let le=oe instanceof Error?oe.message:String(oe);return Ho(e,l,[j],le),qo(e)}if(P)for(let oe of new Set([...Object.keys(t),...P.reactiveProps??[]])){let le=oe.toLowerCase();if(le.startsWith("aria-")||le.startsWith("data-"))continue;let we=oe.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${we}\\b`).test(ne))P.declaredProps.add(oe);if(new RegExp(`\\$props\\s*(?:\\.\\s*${we}\\b|\\[\\s*['"]${we}['"]\\s*\\])`).test(ne)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${we}['"]`).test(ne))P.consumedProps?.add(oe)}if(P?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(ne))for(let oe of P.reactiveProps){if(wu.has(oe)||P.consumedProps?.has(oe))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${oe.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(ne))continue;let le=`${j}\x00${oe}`;if(Zo.has(le))continue;Zo.add(le),console.warn(`[stx] ${ce.basename(j)} reads \`${oe}\` with defineProps(), which is not live, but ${ce.basename(l)} binds it (:${oe}): 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('${oe}').`)}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[oe,le]of Object.entries(a))if(!oe.startsWith("__")||ue.has(oe))ye[oe]=le;let de=T.length>0?{[Jn]:[...T]}:{},Ae=n;if(n.includes("@include")){let{processIncludes:oe}=await o("stx/includes",()=>import("./chunk-8fprfzcn.js"));Ae=await oe(n,a,l,c,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ae)){let{processComponents:oe}=await o("stx/component-renderer",()=>import("./chunk-pj3xwwtg.js")),le={...a,__processedComponents:O,...de};Ae=await oe(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:oe}=await o("stx/expressions",()=>import("./chunk-e64m5ayt.js")),le=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...de}:T.length>0?{...a,...de}:a;Ae=oe(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,(oe,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-faf3gh3j.js")),rt=Je(Ye),et={};if(rt.defaultSlot?.trim())et.default=rt.defaultSlot;for(let[oe,le]of rt.namedSlots)et[oe]=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:oe}=await o("stx/component-renderer",()=>import("./chunk-pj3xwwtg.js"));ne=await oe(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[,oe,le]of Ht)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(oe))Ne(le,j,c.strict);let tt=[],qt=null,as=Ht.some((oe)=>/\bserver\b/.test(oe[1]||"")&&/\bcache\b/.test(oe[1]||"")),Et=null,ft=null,Zt=null,pn=0,Kt=null;if(fu(c),as&&pr>0){let oe=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(oe!==null){Et=`${j}\x00${S(ne)}\x00${oe}`;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 oe of Ht){let le=oe[1]||"",we=oe[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 ae=Ut;if(ae=ae.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),nt)ae=ae.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let oe=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,le=[];if(ae=ae.replace(oe,(we,be)=>{let Xe=be.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Xe)le.push(`<style${Xe[1]}>${Xe[2]}</style>`);return""}),ae=ae.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),le.length>0)pt=`${pt}${le.join(`
|
|
577
|
-
`)}`}if(n&&
|
|
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+`
|
|
581
581
|
`+ps.join(`
|
|
582
582
|
`),pt)qe+=`
|
|
583
583
|
`+pt}else{if(pt)qe+=`
|
|
584
|
-
`+pt;if(tt.length>0){let
|
|
584
|
+
`+pt;if(tt.length>0){let ie=We.__stx_event_bindings||[],le=Le(We),we=await Promise.all(tt.map(async(be)=>{let Xe=zo(be,We,j);if(Xe!==null)return Xe;let Te=be.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Te)return be;return await je(Te[1],{eventBindings:ie,templateContent:qe,filePath:j,projectRoot:process.cwd(),serverData:le,instanceId:ut})}));qe+=`
|
|
585
585
|
`+we.join(`
|
|
586
|
-
`),We.__stx_event_bindings=[]}}if(re){let
|
|
586
|
+
`),We.__stx_event_bindings=[]}}if(re){let ie=Vs(qe,j);if(ie.hasScoped)qe=ie.html}if(Et&&ft){let ie=Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[];ss.set(Et,{output:qe,dependencies:[...v].filter((le)=>!ft.has(le)),clientFactories:Zt?li(a,Zt):[],uidsConsumed:_t.n-pn,preservedClientExpressions:Kt?ie.filter((le)=>!Kt.has(le)):[]})}if(qt)qe=`<!--stx-render-failed:${qt}-->${qe}`;return Ke.length>0?`${qe}
|
|
587
587
|
${Ke.join(`
|
|
588
588
|
`)}`:qe}catch(ee){if(ee instanceof K)throw ee;return`[Error processing component: ${ee instanceof Error?ee.message:String(ee)}]`}finally{O.delete(e)}}async function s(e){return Bun.file(e).exists()}function dr(e,t){let n=ce.resolve(t),i=ce.resolve(e),a=n.endsWith(ce.sep)?n:n+ce.sep;if(i===n||i.startsWith(a))return i;return null}async function Ko(e,t,n,i){let a=t.startsWith("layouts/")?t.slice(8):t,l=ce.join(e,a);for(let c of l.endsWith(".stx")?[l]:[l,`${l}.stx`])if(await s(c)){if(i)console.log(`Found layout in ${e}: ${c}`);return n?.add(c),c}return null}async function xn(e,t,n,i){let a=await Su(e,t,n,i);if(a===null)return null;let l=dr(a,process.cwd());if(l)return l;let c=[n.root,n.layoutsDir,n.fallbackLayoutsDir,n.componentsDir,n.partialsDir,n.pagesDir,...n._layerLayoutDirs??[]].filter((b)=>typeof b==="string"&&b.length>0);for(let b of c){let v=ce.isAbsolute(b)?b:ce.resolve(process.cwd(),b);if(dr(a,v))return ce.resolve(a)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${a} (template: ${e}, from: ${t})`),null}async function Su(e,t,n,i){if(n.debug)console.log(`Resolving template path: ${e} from ${t}`);let a=ce.dirname(t),l=process.cwd();if(e.startsWith("/")){let O=ce.join(l,e),L=dr(O,l);if(!L)return console.warn(`[stx] rejected template path that escapes project root: ${e} (from ${t})`),null;if(n.debug)console.log(`Checking absolute path: ${L}`);if(await s(L)&&i)i.add(L);return L}let c=async(O)=>{if(!n.layoutsDir||!n.fallbackLayoutsDir)return O;let L=ce.relative(ce.resolve(l,n.fallbackLayoutsDir),O);if(L.startsWith("..")||ce.isAbsolute(L))return O;return await Ko(ce.resolve(l,n.layoutsDir),e,i,n.debug)??O},b=ce.join(a,e);if(await s(b)){if(n.debug)console.log(`Found direct path: ${b}`);let O=await c(b);if(i)i.add(O);return O}if(!e.endsWith(".stx")&&!e.endsWith(".jsx")&&!e.endsWith(".tsx"))for(let O of[".stx",".tsx",".jsx"]){let L=`${b}${O}`;if(await s(L)){if(n.debug)console.log(`Found direct path with extension: ${L}`);let F=await c(L);if(i)i.add(F);return F}}let v=[];if(v.push(...n._layerLayoutDirs??[]),n.layoutsDir)v.push(ce.isAbsolute(n.layoutsDir)?n.layoutsDir:ce.resolve(process.cwd(),n.layoutsDir));let T=ce.resolve(a),P=process.cwd();for(let O=0;O<10;O++){let L=ce.join(T,"layouts"),F=!1;try{F=rs.statSync(L,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(F){v.push(L);break}let B=ce.dirname(T);if(B===T||B.length<P.length)break;T=B}for(let O of v){let L=await Ko(O,e,i,n.debug);if(L)return L}if(n.fallbackLayoutsDir){let O=ce.isAbsolute(n.fallbackLayoutsDir)?n.fallbackLayoutsDir:ce.resolve(process.cwd(),n.fallbackLayoutsDir),L=e.startsWith("layouts/")?e.slice(8):e,F=[ce.join(O,L)];if(!e.endsWith(".stx"))F.push(`${F[0]}.stx`);for(let B of F)if(await s(B)){if(n.debug)console.log(`Found in options.fallbackLayoutsDir: ${B}`);if(i)i.add(B);return B}}if(e.startsWith("layouts/")||e.includes("/layouts/")){let O=e.split("layouts/"),L=ce.join(n.partialsDir||a,"layouts",O[1]);if(await s(L)){if(n.debug)console.log(`Found in layouts path: ${L}`);if(i)i.add(L);return L}if(!L.endsWith(".stx")){let F=`${L}.stx`;if(await s(F)){if(n.debug)console.log(`Found in layouts path with extension: ${F}`);if(i)i.add(F);return F}}}if(n.partialsDir){let O=ce.join(n.partialsDir,"layouts");if(await s(O)){let L=ce.join(O,e);if(await s(L)){if(n.debug)console.log(`Found in partials layouts dir: ${L}`);if(i)i.add(L);return L}if(!e.endsWith(".stx")){let F=`${L}.stx`;if(await s(F)){if(n.debug)console.log(`Found in partials layouts dir with extension: ${F}`);if(i)i.add(F);return F}}}}let D=n.partialsDir||ce.join(process.cwd(),"views"),H=ce.join(D,e);if(await s(H)){if(n.debug)console.log(`Found in views path: ${H}`);if(i)i.add(H);return H}if(!e.endsWith(".stx")){let O=`${H}.stx`;if(await s(O)){if(n.debug)console.log(`Found in views path with extension: ${O}`);if(i)i.add(O);return O}}if(a.includes("temp")){let O=ce.join(ce.dirname(a),"layouts",e);if(await s(O)){if(n.debug)console.log(`Found in temp layouts dir: ${O}`);if(i)i.add(O);return O}if(!e.endsWith(".stx")){let L=`${O}.stx`;if(await s(L)){if(n.debug)console.log(`Found in temp layouts dir with extension: ${L}`);if(i)i.add(L);return L}}}if(n.debug)console.warn(`Template not found after trying all paths: ${e} (referenced from ${t})`);else console.warn(`Template not found: ${e} (referenced from ${t})`);return null}function ol(e,t,n){let i=0,a="",l="";try{if(typeof t==="number"&&t>=0){let c=e.split(`
|
|
589
589
|
`),b=0;for(let v=0;v<c.length;v++)if(b+=c[v].length+1,b>=t){i=v+1,a=c[v].trim();let T=Math.max(0,v-2),P=Math.min(c.length,v+3);l=c.slice(T,P).map((D,H)=>{let O=T+H+1;return`${O===i?"> ":" "}${O}: ${D}`}).join(`
|
|
@@ -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] || {};
|
|
@@ -692,12 +692,12 @@ finally {
|
|
|
692
692
|
}`,ee={vendorStyleTags:b,factoryBody:B,clientCode:O,deps:Sr([...P,...l.styles.map((X)=>X.resolvedPath)])};if(!D&&l.unresolved.length===0)ar.set(i,ee);return ee}var wn=["module","exports","require","props","$props","$bool","$num","defineProps","withDefaults","defineClientPayload","useServerData","useRuntimeConfig","useServerRuntimeConfig","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","setResponseStatus","setResponseHeader","notFound","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params"];var vu=100,Eu=599,mr="__stxResponseStatus",un="__stxResponseHeaders";function is(e){return typeof e==="number"&&Number.isInteger(e)&&e>=vu&&e<=Eu}function yn(e){for(let t of e.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let n=t[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!n)continue;let i=Number(n[1]);if(is(i))return i}return}function gr(e,t){if(!e||typeof e!=="object")return!1;let n=typeof t==="string"&&/^\d+$/.test(t.trim())?Number(t.trim()):t;if(!is(n))return!1;return e[mr]=n,!0}function ku(e,t,n){if(!e||typeof e!=="object")return;let i=String(t??"").trim();if(!i)return;e[un]={...e[un],[i]:String(n)}}function Mt(e){let t=e?.[mr];return is(t)?t:void 0}function Dt(e){let t=e?.[un];if(!t||typeof t!=="object")return;let n=Object.entries(t).map(([i,a])=>[i,String(a)]);return n.length>0?Object.fromEntries(n):void 0}function Wc(e,t){if(!e||!t||e===t||typeof t!=="object")return;let n=Mt(e);if(n!==void 0)t[mr]=n;let i=Dt(e);if(i)t[un]={...t[un],...i}}function Us(e){return{setResponseStatus:(t)=>{gr(e,t)},notFound:(t=404)=>{let n=is(t)&&t>=400?t:404;gr(e,n)},setResponseHeader:(t,n)=>{ku(e,t,n)}}}function qc(e,t,n={}){if(!e.includes("@status"))return e;let{filePath:i,buildMode:a}=n,l=a==="compile",c="",b=0,v=/@status\s*\(/g,T;while((T=v.exec(e))!==null){let P=Cu(e,T.index+T[0].length-1);if(P<0)break;let D=e.slice(T.index+T[0].length,P).trim(),H=/^\d+$/.test(D)?Number(D):u(D,t),O=i?` in ${i}`:"";if(l)console.warn(`[stx] @status(${D})${O} is skipped when precompiling: the build has no request, so the branch it sits in is not the one a visitor will get. Call notFound() or setResponseStatus(${D}) from <script server> instead \u2014 that runs per request.`);else if(!gr(t,H))console.warn(`[stx] @status(${D})${O} is not an HTTP status (100-599) \u2014 ignoring it.`);c+=e.slice(b,T.index),b=P+1+(e.slice(P+1).match(/^[^\S\n]*\n?/)?.[0].length??0),v.lastIndex=b}return b===0?e:c+e.slice(b)}function Cu(e,t){let n=1,i=null,a=!1;for(let l=t+1;l<e.length;l++){let c=e[l];if(a){a=!1;continue}if(i){if(c==="\\")a=!0;else if(c===i)i=null;continue}if(c==='"'||c==="'"||c==="`"){i=c;continue}if(c==="(")n++;else if(c===")"&&--n===0)return l}return-1}var Qo=new Set(wn),Ru=new Set(["props","$props","defineProps"]),Tu=new Set(["stx","@stacksjs/stx"]),ea=w(128),ta=w(64);function Au(e){let t=[],n=0,i=e.split(`
|
|
693
693
|
`);for(let a of i){let l=n,c=null,b=!1;for(let v=0;v<a.length;v++){let T=a[v];if(b){b=!1;continue}if(T==="\\"){b=!0;continue}if(c){if(T===c)c=null;continue}if(T==="'"||T==='"'||T==="`"){c=T;continue}if(T==="/"&&v+1<a.length&&a[v+1]==="/")break;if(T==="{")n++;else if(T==="}")n--}if(l===0){let v=a.match(/(?:const|let|var)\s+(\w+)\s*=/);if(v)t.push(v[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(a)){let T=a.match(/(?:const|let|var)\s+(\w+)/);if(T)t.push(T[1])}else{let T=a.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(T){let D=T[1].slice(1,-1).split(",").map((H)=>{let O=H.split(":");return(O.length>1?O[1]:O[0]).trim()}).filter((H)=>/^\w+$/.test(H));t.push(...D)}}}}return[...new Set(t)]}function ag(e){let t=e;t=t.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),t=t.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),t=t.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),t=t.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),t=t.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function n(i){if(!i.includes(":"))return i;let a=[],l="",c=0,b=0,v=null;for(let T=0;T<i.length;T++){let P=i[T];if(v){if(l+=P,P===v)v=null;continue}if(P==='"'||P==="'"||P==="`"){v=P,l+=P;continue}if(P==="<")c++;else if(P===">"&&c>0)c--;else if(P==="(")b++;else if(P===")")b--;if(P===","&&c===0&&b===0){a.push(l),l="";continue}l+=P}if(l)a.push(l);return a.map((T)=>{let P=T.trim(),D=P.startsWith("..."),H=D?P.slice(3):P,O=-1,L=0;for(let se=0;se<H.length;se++)if(H[se]==="<")L++;else if(H[se]===">")L--;else if(H[se]===":"&&L===0){O=se;break}if(O===-1)return T;let B=H.substring(0,O).trim().replace(/\?$/,""),ee=H.substring(O+1),X=-1,j=0;for(let se=0;se<ee.length;se++)if(ee[se]==="<")j++;else if(ee[se]===">")j--;else if(ee[se]==="="&&j===0){X=se;break}let te=D?"...":"";if(X!==-1)return`${te}${B} = ${ee.substring(X+1).trim()}`;return`${te}${B}`}).join(", ")}t=t.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(i,a,l)=>{if(!l.includes(":"))return i;return`${a}(${n(l)})`});{let i=/\b(function\s+\w*\s*)\(/g,a,l=[];while((a=i.exec(t))!==null){let c=a.index+a[0].length-1,b=1,v=c+1,T=0,P=null;while(v<t.length&&b>0){let O=t[v];if(P){if(O===P)P=null;v++;continue}if(O==='"'||O==="'"||O==="`"){P=O,v++;continue}if(O==="<")T++;else if(O===">"&&T>0)T--;else if(T===0){if(O==="(")b++;else if(O===")")b--}if(b>0)v++}if(b!==0)continue;let D=t.substring(c+1,v);if(!D.includes(":"))continue;let H=n(D);l.push({start:c+1,end:v,replacement:H})}for(let c=l.length-1;c>=0;c--){let{start:b,end:v,replacement:T}=l[c];t=t.substring(0,b)+T+t.substring(v)}}return t=t.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(i,a)=>{if(!a.includes(":"))return i;if(a.includes("{")||a.includes("}"))return i;return`(${a.split(",").map((c)=>{let[b,...v]=c.split("="),T=b.split(":")[0].trim();if(v.length>0)return`${T} = ${v.join("=").trim()}`;return T}).join(", ")}) =>`}),t=t.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),t=t.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),t=t.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),t=t.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),t=t.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),t=t.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),t=t.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),t=t.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),t=t.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),t=t.replace(/\n\s*\n\s*\n/g,`
|
|
694
694
|
|
|
695
|
-
`),t}function cg(e){return e.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(t,...n)=>{let[,i,a]=n,l=i??a;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(l)?"":t})}function lg(e){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(e)}function ug(e){if(e instanceof SyntaxError)return!0;let t=e instanceof Error?e.message:String(e);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(t)}function dg(e){if(!/is not defined|can't find variable/i.test(e))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(e)}var na=new Set;async function g(e,t,n,i={}){if(!e.trim())return;let a=C(),l=S(e,JSON.stringify(a)),c=ea.get(l);if(c===void 0){try{let re=Z({loader:"ts",target:"browser",define:a}),
|
|
696
|
-
`),dn=t.params??{},Gt=[],Yt=[];for(let
|
|
695
|
+
`),t}function cg(e){return e.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(t,...n)=>{let[,i,a]=n,l=i??a;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(l)?"":t})}function lg(e){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(e)}function ug(e){if(e instanceof SyntaxError)return!0;let t=e instanceof Error?e.message:String(e);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(t)}function dg(e){if(!/is not defined|can't find variable/i.test(e))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(e)}var na=new Set;async function g(e,t,n,i={}){if(!e.trim())return;let a=C(),l=S(e,JSON.stringify(a)),c=ea.get(l);if(c===void 0){try{let re=Z({loader:"ts",target:"browser",define:a}),oe=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");oe=oe.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),c=re.transformSync(oe)}catch{c=ag(e)}ea.set(l,c)}let b={exports:{}},v=b.exports,T=Wt.cwd(),P={},D=[...c.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((re)=>re[1]).filter((re)=>!re.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(re)),H=new Map;for(let re of D)try{if(re.startsWith(".")){P[re]=await import(ct.resolve(ct.dirname(n),re));continue}let oe=ct.resolve(T,"node_modules",re),he=ct.join(oe,"package.json"),$e=JSON.parse(h("fs").readFileSync(he,"utf8")),Pe=$e.main||"index.js";if($e.exports){let Ve=typeof $e.exports==="string"?$e.exports:$e.exports["."];if(typeof Ve==="string")Pe=Ve;else if(Ve?.bun)Pe=Ve.bun;else if(Ve?.import)Pe=Ve.import;else if(Ve?.default)Pe=Ve.default}P[re]=await import(ct.resolve(oe,Pe))}catch(oe){if(re.startsWith("."))H.set(re,oe instanceof Error?oe.message:String(oe))}let O=(re)=>{if(P[re])return P[re];let oe=H.get(re);if(oe!==void 0)throw Error(`Cannot require '${re}' from ${n}: ${oe}`);return h(re)},L=t.props||{},F=(re)=>{if(!re)return L;let oe={};for(let[he,$e]of Object.entries(re)){let Pe=L[he];if(Pe!==void 0)oe[he]=Pe;else if(typeof $e==="function")oe[he]=$e();else oe[he]=$e}return oe};for(let[re,oe]of Object.entries(L))Object.defineProperty(F,re,{value:oe,enumerable:!0,configurable:!0,writable:!0});let B=(re,oe=!1)=>{if(re===void 0||re===null)return oe;if(typeof re==="string"){let he=re.trim().toLowerCase();if(he===""||he==="true"||he==="1"||he==="on"||he==="yes")return!0;if(he==="false"||he==="0"||he==="off"||he==="no")return!1;return!0}return Boolean(re)},ee=(re,oe=0)=>{if(re===void 0||re===null)return oe;if(typeof re==="string"){let $e=re.trim();if($e==="")return oe;let Pe=Number($e);return Number.isFinite(Pe)?Pe:oe}let he=Number(re);return Number.isFinite(he)?he:oe};for(let re of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(L,re))continue;try{Object.defineProperty(F,re,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let X=(re)=>{if(!re)return L;let oe={...L};for(let[he,$e]of Object.entries(re)){let Pe=$e&&typeof $e==="object"&&!Array.isArray($e)?$e:{type:$e};if(oe[he]===void 0&&Pe.default!==void 0)oe[he]=typeof Pe.default==="function"?Pe.default():Pe.default}return oe},j=()=>t.slots||{},te=(re,oe)=>{let he={...re};for(let[$e,Pe]of Object.entries(oe))if(he[$e]===void 0)if(typeof Pe==="function")he[$e]=Pe();else he[$e]=Pe;return he},se=(re)=>{let oe=()=>re;return oe.set=(he)=>{},oe.update=(he)=>{},oe},ne=(re)=>{let oe,he=!1;return()=>{if(!he)try{oe=re(),he=!0}catch{oe=void 0}return oe}},ue=(re)=>{},ye=(re)=>re(),de=(re)=>{},Ae=(re)=>{},Ze=Us(t);function Re(re){let oe=re||{};if(oe.title!==void 0||oe.description!==void 0)et({title:oe.title,description:oe.description})}function Ke(re){if(!re||typeof re!=="object")return;let oe=t.__stxClientPayload??{};Object.assign(oe,re),t.__stxClientPayload=oe}let Ye=()=>{let re=t.__stxServeContext,oe=t.__stxServeSearch??re?.search??"",he=re?.path??"",$e=Object.fromEntries(new URLSearchParams(oe)),Pe=t.query,Ve=Object.keys($e).length>0?$e:Pe??{},it=oe||(Object.keys(Ve).length>0?`?${new URLSearchParams(Ve).toString()}`:"");return{params:t.params??{},query:Ve,path:he,name:"",fullPath:he+it,hash:"",matched:[]}},Je=()=>({push:(re)=>{},replace:(re)=>{},back:()=>{},forward:()=>{},go:(re)=>{}}),rt=(re)=>{let oe=t.__stx_runtime_head||{};t.__stx_runtime_head=Ue(oe,Ce(re||{},{known:eo,source:"useHead()"}))},et=(re)=>{rt(to(re||{}))},_t=(re)=>({value:re}),Vt=(re)=>re,br=(re)=>({value:typeof re==="function"?re():re}),ut=(re,oe)=>{},We=(re)=>{},Ut=(re)=>{},fn=(re)=>re?re():Promise.resolve(),os=(re)=>(oe,...he)=>{},Ht=(re)=>{},tt=(re,oe)=>{},qt=(re,oe)=>oe,as=()=>({value:"light"}),Et=()=>se(!1),ft=(re)=>se(!1),Zt=()=>se(!1),pn=()=>ft("(prefers-color-scheme: dark)"),Kt=()=>ft("(prefers-color-scheme: light)"),Xt=()=>ft("(prefers-reduced-motion: reduce)"),yr=()=>ft("(prefers-contrast: more)"),nt={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},Jt=new Proxy(nt,{get(re,oe){if(oe in re)return re[oe];return},set(re,oe,he){return re[oe]=he,!0}}),cs={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},pt=console;try{let re=vi(c,n),oe=new Set(Object.keys(L)),he=Object.keys(t).filter((ie)=>!oe.has(ie)&&!Ru.has(ie)&&Ft(ie)),$e=he.map((ie)=>t[ie]);if(!he.includes("__stxServeContext"))he.push("__stxServeContext"),$e.push(void 0);if(!oe.has("cookies")){let ie=t.cookies??t.__stxServeContext?.cookies??{},le=he.indexOf("cookies");if(le<0)he.push("cookies"),$e.push(ie);else $e[le]=ie}let Pe=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),Ve=[],it=[];for(let[ie,le]of Object.entries(L)){if(!Ft(ie))continue;if(Pe.has(ie))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${ie}\\b`).test(re))continue;Ve.push(ie),it.push(le)}let us=Au(re).map((ie)=>`module.exports.${ie} = typeof ${ie} !== 'undefined' ? ${ie} : module.exports.${ie};`).join(`
|
|
696
|
+
`),dn=t.params??{},Gt=[],Yt=[];for(let ie=0;ie<he.length;ie++){if(he[ie]==="params")continue;Gt.push(he[ie]),Yt.push($e[ie])}let $n=[...wn,...Ve,...Gt],En=`return (async () => {
|
|
697
697
|
${re}
|
|
698
698
|
${us}
|
|
699
699
|
return module.exports
|
|
700
|
-
})()`,dt=S(En,$n.join("\x00")),xt=ta.get(dt);if(!xt)xt=Function(...$n,En),ta.set(dt,xt);let gt=t.__stx_options?.runtimeConfig;if(gt||/\buse(?:Server)?RuntimeConfig\b/.test(c))await _n(t,n,gt);let qe=await He(t.__stx_runtime_config??Cn()??M(),()=>Dr(t,()=>xt(b,v,O,L,F,B,ee,X,te,Ke,Mr,$i,Xs,se,ne,ue,ye,de,Ae,Re,Ye,Je,rt,et,Ze.setResponseStatus,Ze.setResponseHeader,Ze.notFound,_t,Vt,br,ut,We,Ut,fn,os,Ht,j,tt,qt,as,Et,ft,Zt,pn,Kt,Xt,yr,Jt,cs,pt,nt.confirm,nt.alert,nt.fetch,dn,...it,...Yt)));if(i.preserveExisting){for(let[
|
|
700
|
+
})()`,dt=S(En,$n.join("\x00")),xt=ta.get(dt);if(!xt)xt=Function(...$n,En),ta.set(dt,xt);let gt=t.__stx_options?.runtimeConfig;if(gt||/\buse(?:Server)?RuntimeConfig\b/.test(c))await _n(t,n,gt);let qe=await He(t.__stx_runtime_config??Cn()??M(),()=>Dr(t,()=>xt(b,v,O,L,F,B,ee,X,te,Ke,Mr,$i,Xs,se,ne,ue,ye,de,Ae,Re,Ye,Je,rt,et,Ze.setResponseStatus,Ze.setResponseHeader,Ze.notFound,_t,Vt,br,ut,We,Ut,fn,os,Ht,j,tt,qt,as,Et,ft,Zt,pn,Kt,Xt,yr,Jt,cs,pt,nt.confirm,nt.alert,nt.fetch,dn,...it,...Yt)));if(i.preserveExisting){for(let[ie,le]of Object.entries(qe))if(!(ie in t)||t[ie]===void 0)t[ie]=le}else Object.assign(t,qe);for(let[ie,le]of Object.entries(L))if(!(ie in t))t[ie]=le}catch(re){if(t.__stx_strict_hydration)throw re;let oe=cg(re instanceof Error?re.message:String(re));if(lg(oe))console.warn(`[stx] server <script> in ${n??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${oe}`),i.onFailure?.({kind:"module-resolution",message:oe,error:re});else if(ug(re))console.warn(`[stx] server <script> in ${n??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${oe}`),i.onFailure?.({kind:"syntax",message:oe,error:re});else if(dg(oe))console.warn(`[stx] server <script> in ${n??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${oe}`),i.onFailure?.({kind:"missing-binding",message:oe,error:re});else{let he=`${n??"<unknown>"}\x00${oe}`;if(Wt.env.STX_DEBUG||!na.has(he))na.add(he),console.warn(`[stx] server <script> in ${n??"<unknown>"} threw, so every variable in that script is undefined and anything that reads one renders empty. Cause: ${oe}`);i.onFailure?.({kind:"unknown",message:oe,error:re})}try{await ju(c,t,n)}catch(he){if(Wt.env.STX_DEBUG){let $e=he instanceof Error?he.message:String(he);console.warn(`[stx] fallback extraction also failed in ${n??"<unknown>"}: ${$e}`)}}}}function pg(e){let t=0,n=null,i=!1,a=!1;for(let l=0;l<e.length;l++){let c=e[l];if(n){if(c===n){if(n=null,i||t===0)a=!0}continue}if(c==="'"||c==='"'||c==="`"){n=c;continue}if(c==="{")t++;else if(c==="}")t--;else if(e.startsWith("from",l)&&t===0)i=!0}return n===null&&t===0&&a}var Iu=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function vi(e,t){let n=t?ct.dirname(t):Wt.cwd(),i=Wt.cwd(),a=e.split(`
|
|
701
701
|
`),l=[],c=0;while(c<a.length){let b=a[c].trim();if(b.startsWith("interface ")||b.startsWith("export interface ")||b.startsWith("type ")||b.startsWith("export type ")){if(b.includes("{")&&!b.includes("}")){let v=0;for(;c<a.length;c++){for(let T of a[c])if(T==="{")v++;else if(T==="}")v--;if(v<=0)break}}c++;continue}if(b.startsWith("definePageMeta(")){let v=0,T=!1,P=c;for(let O=c;O<a.length&&!T;O++){let L=null,F=!1,B=a[O];for(let ee=0;ee<B.length;ee++){let X=B[ee];if(F){F=!1;continue}if(X==="\\"){F=!0;continue}if(L){if(X===L)L=null;continue}if(X==='"'||X==="'"||X==="`"){L=X;continue}if(X==="(")v++;else if(X===")"){if(v--,v===0){c=O+1,T=!0;break}}}}if(!T)c=a.length;let D=a.slice(P,c).join(`
|
|
702
702
|
`),H=[];for(let O of["title","description"]){let L=new RegExp(`\\b${O}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(D);if(L)H.push(`${O}: ${JSON.stringify(L[2])}`)}if(H.length>0)l.push(`useSeoMeta({ ${H.join(", ")} });`);continue}if(b.startsWith("import ")||b==="import"||b.startsWith("import{")||/^import['"]/.test(b)){let v=b,T=0;while(!pg(v)&&c+T+1<a.length)T++,v=`${v} ${a[c+T].trim()}`;c+=T;let P=v.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),D=v.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),H=v.match(/^import\s*['"](.+?)['"]/),O=v,L=(F)=>{if(F.startsWith("."))return ct.resolve(n,F);if(F.startsWith("~/")||F.startsWith("@/"))return ct.resolve(i,F.slice(2));try{return Bun.resolveSync(F,n)}catch{return F}};if(P){let[,F,B]=P,ee=L(B);l.push(`const ${F} = (await import('${ee}')).default`),l.push(`module.exports.${F} = ${F};`)}else if(D){let[,F,B]=D,ee=L(B),X=[],j=[],te=Tu.has(B);for(let se of F.split(",")){let ne=se.trim();if(!ne)continue;let ue=ne.split(/\s+as\s+/);if(ue.length===2){let[ye,de]=[ue[0].trim(),ue[1].trim()];if(te&&Qo.has(ye)){l.push(`const ${de} = ${ye};`);continue}X.push(`${ye}: ${de}`),j.push(de)}else{if(te&&Qo.has(ne))continue;X.push(ne),j.push(ne)}}if(X.length>0)l.push(`const { ${X.join(", ")} } = await import('${ee}')`);for(let se of j)l.push(`module.exports.${se} = ${se};`)}else if(H){let F=L(H[1]);l.push(`await import('${F}')`)}else l.push(O);c++;continue}if(Iu.test(b))l.push(a[c]),c++;else if(b.startsWith("export const ")||b.startsWith("export let ")||b.startsWith("export var ")){let v=ra(a,c),{type:T,name:P,value:D}=v;l.push(`${T} ${P} = ${D};`),l.push(`module.exports.${P} = ${P};`),c=v.nextIndex}else if(b.startsWith("export function ")||b.startsWith("export async function ")){let v=hr(a,c);l.push(v.functionCode),l.push(`module.exports.${v.name} = ${v.name};`),c=v.nextIndex}else if(b.startsWith("const ")||b.startsWith("let ")||b.startsWith("var ")){let v=ra(a,c),{type:T,name:P,value:D}=v;l.push(`${T} ${P} = ${D};`),l.push(`module.exports.${P} = ${P};`),c=v.nextIndex}else if(b.startsWith("function ")||b.startsWith("async function ")){let v=hr(a,c);l.push(v.functionCode),l.push(`module.exports.${v.name} = ${v.name};`),c=v.nextIndex}else if(b.startsWith("export default function ")||b.startsWith("export default async function ")){let v=a[c].replace(/^(\s*)export\s+default\s+/,"$1"),T=[...a];T[c]=v;let P=hr(T,c);if(l.push(P.functionCode),P.name)l.push(`module.exports.default = ${P.name};`);c=P.nextIndex}else if(b.startsWith("export default ")){let v=b.replace(/^export\s+default\s+/,"").replace(/;$/,"");l.push(`module.exports.default = ${v};`),c++}else if(b.startsWith("class ")||b.startsWith("export class ")){let v=b.match(/(?:export\s+)?class\s+(\w+)/);if(v){let T=v[1],P=a[c].replace(/^export\s+/,""),D=0,H=c;for(;H<a.length;H++){let O=a[H];for(let L of O)if(L==="{")D++;else if(L==="}")D--;if(H>c)P+=`
|
|
703
703
|
`+O;if(D<=0&&H>=c)break}l.push(P),l.push(`module.exports.${T} = ${T};`),c=H+1}else l.push(b),c++}else if(b.includes("module.exports"))l.push(b),c++;else if(b.trim()&&!b.startsWith("//"))l.push(b),c++;else c++}return Pu(l.join(`
|
|
@@ -709,4 +709,4 @@ ${e[T]}`,T++;else break}return v=v.trim().replace(/;$/,""),{type:l,name:c,value:
|
|
|
709
709
|
${l}`,a++}while(a<e.length){let l=e[a].trim();if(l.startsWith(".")||l.startsWith("?."))i+=`
|
|
710
710
|
${e[a]}`,a++;else break}return{value:i,nextIndex:a}}function Mu(e,t,n){let i=n,a=t+1;while(a<e.length){let l=fa(i);if(l!==-1){if(x(i,"{","}",l)!==-1)break}let c=e[a];i+=`
|
|
711
711
|
${c}`,a++}return{functionCode:i,nextIndex:a}}function aa(e,t){let n=u(e,t)??u(`(${e})`,t);if(n!==void 0)return n;if(!/\bprocess\b/.test(e))return;let i={...t,process:Object.freeze({env:{...Wt.env}})},a=Object.keys(i).filter(Ft),l=a.map((c)=>i[c]);try{return Function(...a,`'use strict'; return (${e});`)(...l)}catch{try{return Function(...a,`'use strict'; return ${e};`)(...l)}catch{return}}}async function ju(e,t,n){let i=e.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let l of i){let[,,c,b]=l;try{let v=b.trim().replace(/;$/,""),T=aa(v,t);if(T!==void 0)t[c]=T}catch(v){console.warn(`Failed to parse export ${c} in fallback:`,v)}}let a=e.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let l of a){let[,,c,b]=l;if(!(c in t))try{let v=b.trim().replace(/;$/,""),T=aa(v,t);if(T!==void 0)t[c]=T}catch{}}}function Qc(e){let t=e.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),n=t?t[1]:"",i=t?e.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):e;return{scriptContent:n,templateWithoutScript:i}}function el(e){let t=e.trim();if(!t)return!1;return/(?:const|let|var|function)\s+\w+/.test(t)}
|
|
712
|
-
export{Ie,xe,V,Ms,Ds,U,xr,Ls,js,ui,di,Bs,pi,Dc,Pt,Oe,o,gn,w,Lc,S,Sr,Fs,Se,C,Ne,pe,It,Ot,q,mn,Me,y,jc,fe,J,kr,_r,Cr,
|
|
712
|
+
export{Ie,xe,V,Ms,Ds,U,xr,Ls,js,ui,di,Bs,pi,Dc,Pt,Oe,o,gn,w,Lc,S,Sr,Fs,Se,C,Ne,pe,It,Ot,q,mn,Me,y,jc,fe,J,kr,_r,Cr,ae,Nt,Y,N,st,Er,Tr,ot,fi,zs,ig,De,Bc,Fc,gi,zc,mi,Hc,Hs,hi,Vc,Uc,yi,bi,hn,Vs,yn,Mt,Dt,Wc,Us,qc,Kc,bn,$r,Ws,qs,Gc,wi,Xc,Jc,Yc,Zc,wn,ag,cg,lg,ug,dg,g,pg,vi,fg,Qc,el,xi,Si,gg,Lt,tl,mg,nl,oy,Le,vn,je,hg,yg,bg,wg,vg,Ks,xg,Be,Z,Fe,Sg,Rr,kg,rl,sl,ki,ze,s,xn,ol,m,ge,iy,il,al,cl,_i,Gs,_g,ay,Cg,cy,Sn,p,W,Q,kn,ke,Eg,Ci,Tg,ly,E,Ei,$g,uy,A,dy};
|