@stacksjs/stx 0.2.869 → 0.2.871
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-04pkrxse.js +2 -0
- package/dist/{chunk-wrgaxvxy.js → chunk-1217683z.js} +1 -1
- package/dist/{chunk-4vtw6f0c.js → chunk-17ttwt50.js} +2 -2
- package/dist/{chunk-wcq7a5pv.js → chunk-1n7vjs3t.js} +2 -2
- package/dist/{chunk-xtcba3r1.js → chunk-1ptjecaz.js} +1 -1
- package/dist/{chunk-6ggme8xx.js → chunk-21vrwgap.js} +1 -1
- package/dist/{chunk-s6fe2wp6.js → chunk-2pt2feg2.js} +1 -1
- package/dist/{chunk-mnx6njd4.js → chunk-2sw68zck.js} +3 -3
- package/dist/{chunk-qqvj5zra.js → chunk-34mx6czk.js} +1 -1
- package/dist/{chunk-r53eeyhv.js → chunk-38tdqbf1.js} +3 -3
- package/dist/{chunk-h8h97bcc.js → chunk-3972v2g1.js} +1 -1
- package/dist/{chunk-mbp7j1a7.js → chunk-3fkbbkkt.js} +1 -1
- package/dist/chunk-3mb2pw1s.js +3 -0
- package/dist/{chunk-9mkv1se7.js → chunk-3z3y475q.js} +1 -1
- package/dist/chunk-3zm4bwha.js +2 -0
- package/dist/{chunk-tjwzy9xq.js → chunk-40h07m5w.js} +1 -1
- package/dist/chunk-4es07dwb.js +2 -0
- package/dist/{chunk-05qpze12.js → chunk-4gx0z28s.js} +1 -1
- package/dist/{chunk-zbvfjm4a.js → chunk-4nb7egk0.js} +2 -2
- package/dist/chunk-55bne11m.js +2 -0
- package/dist/{chunk-stdddhk9.js → chunk-583rbj5e.js} +2 -2
- package/dist/{chunk-2wa1keyw.js → chunk-5kc0r06s.js} +2 -2
- package/dist/chunk-5mfymtae.js +2 -0
- package/dist/{chunk-bfww6qxt.js → chunk-5qfrnjkd.js} +2 -2
- package/dist/chunk-6jc67p70.js +2 -0
- package/dist/{chunk-jsyrp1n2.js → chunk-6npyrm89.js} +1 -1
- package/dist/{chunk-3ryp43f3.js → chunk-73k579v7.js} +1 -1
- package/dist/{chunk-hvx6j4a2.js → chunk-74vp2yw4.js} +2 -2
- package/dist/{chunk-3f51tn2b.js → chunk-7cvbz4eq.js} +2 -2
- package/dist/{chunk-gcsy3z1e.js → chunk-7mbezqy6.js} +2 -2
- package/dist/{chunk-gj16gta9.js → chunk-80x7c8d8.js} +4 -4
- package/dist/{chunk-fzz251r8.js → chunk-89xpfwy4.js} +1 -1
- package/dist/{chunk-6mjd3pqd.js → chunk-8q37c0jm.js} +3 -3
- package/dist/{chunk-1mqcttg3.js → chunk-8tk8yf91.js} +2 -2
- package/dist/{chunk-5f9z82xp.js → chunk-98832y5h.js} +4 -4
- package/dist/chunk-9d5cqgy7.js +2 -0
- package/dist/{chunk-akv760py.js → chunk-a3rqpyt8.js} +1 -1
- package/dist/{chunk-73vtvzb1.js → chunk-a7drjyq6.js} +1 -1
- package/dist/chunk-ajaqa958.js +2 -0
- package/dist/{chunk-ajy9tjct.js → chunk-ak6edtk2.js} +2 -2
- package/dist/{chunk-d2m57nd1.js → chunk-aktk5r6c.js} +1 -1
- package/dist/{chunk-xsbaha1z.js → chunk-avfsad8j.js} +1 -1
- package/dist/chunk-ax0ntjxy.js +2 -0
- package/dist/{chunk-311mrz2n.js → chunk-az07qe58.js} +1 -1
- package/dist/chunk-b7qfjv65.js +2 -0
- package/dist/chunk-bz52y1cb.js +2 -0
- package/dist/{chunk-gk8472hq.js → chunk-c8d5cv6w.js} +2 -2
- package/dist/{chunk-d9k8j44b.js → chunk-ce49k18q.js} +2 -2
- package/dist/chunk-dst4twmx.js +2 -0
- package/dist/{chunk-adqh1gp1.js → chunk-e7s109j6.js} +1 -1
- package/dist/{chunk-9fk02w6v.js → chunk-f14pyq81.js} +1 -1
- package/dist/{chunk-za61jaep.js → chunk-fn2j7g8g.js} +2 -2
- package/dist/{chunk-j148k8rf.js → chunk-gkdgg83x.js} +1 -1
- package/dist/{chunk-vzq77h80.js → chunk-gqjt1va8.js} +1 -1
- package/dist/{chunk-7chzhef2.js → chunk-gvz0kqkz.js} +1 -1
- package/dist/{chunk-095cn3p0.js → chunk-has2s6zj.js} +4 -4
- package/dist/{chunk-f3d1y318.js → chunk-hcp8qese.js} +4 -4
- package/dist/{chunk-6ksyrmpp.js → chunk-hgmjxq7t.js} +1 -1
- package/dist/{chunk-81kk8dnr.js → chunk-hs11350k.js} +1 -1
- package/dist/chunk-j0cfkp98.js +2 -0
- package/dist/{chunk-gxq3jnkb.js → chunk-jafn6jh0.js} +1 -1
- package/dist/{chunk-m4k6ndf5.js → chunk-jz76vn4n.js} +1 -1
- package/dist/{chunk-tz7b6fdz.js → chunk-k82hqmma.js} +1 -1
- package/dist/chunk-kpjtptnx.js +2 -0
- package/dist/chunk-ktrfk613.js +2 -0
- package/dist/{chunk-zfj8rfv2.js → chunk-ms60vwmg.js} +1 -1
- package/dist/{chunk-r3eezdg4.js → chunk-msvh8rda.js} +8 -8
- package/dist/{chunk-k4dcnc4e.js → chunk-n16ba3wz.js} +2 -2
- package/dist/chunk-n1g75yxa.js +2 -0
- package/dist/{chunk-tdd3765y.js → chunk-nbvpjwj1.js} +21 -21
- package/dist/chunk-npayn9fr.js +2 -0
- package/dist/chunk-p2kqsb5k.js +2 -0
- package/dist/chunk-p8t5mnes.js +2 -0
- package/dist/{chunk-5qk506kn.js → chunk-pczh82f8.js} +1 -1
- package/dist/{chunk-0tyyad6q.js → chunk-pffksrxb.js} +3 -3
- package/dist/{chunk-h2r54207.js → chunk-ptfhh54v.js} +5 -5
- package/dist/{chunk-79y9amt1.js → chunk-pywz8q4k.js} +5 -5
- package/dist/chunk-q28q8w89.js +2 -0
- package/dist/{chunk-sbvkk4cn.js → chunk-qnky63y3.js} +2 -2
- package/dist/{chunk-z2t6f4gt.js → chunk-s41wm1as.js} +1 -1
- package/dist/{chunk-nqz4es8a.js → chunk-sghbhdtj.js} +1 -1
- package/dist/{chunk-9rjr7hvf.js → chunk-teasmth3.js} +1 -1
- package/dist/chunk-ts61qx11.js +177 -0
- package/dist/{chunk-mrh08821.js → chunk-tyvm49be.js} +2 -2
- package/dist/chunk-w3n2jpk5.js +2 -0
- package/dist/chunk-wvtmex14.js +21 -0
- package/dist/{chunk-cvpbgf6h.js → chunk-wz1h33pz.js} +1 -1
- package/dist/{chunk-p3yesft1.js → chunk-xga3xhzr.js} +1 -1
- package/dist/chunk-ymmcv5g3.js +2 -0
- package/dist/{chunk-w2hqjv5e.js → chunk-z4zqtpqn.js} +1 -1
- package/dist/{chunk-kgh1xsfe.js → chunk-zebk7htd.js} +20 -20
- package/dist/cli.js +11 -11
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/native/accessibility.d.ts +15 -0
- package/dist/native/accessibility.js +14 -4
- package/dist/native/compiler/html-to-ir.js +56 -1
- package/dist/pwa.js +3 -3
- package/dist/signal-processing.js +4 -1
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-05dtat6q.js +0 -2
- package/dist/chunk-0snga2v8.js +0 -2
- package/dist/chunk-0xqefkqr.js +0 -2
- package/dist/chunk-1t8tkryw.js +0 -2
- package/dist/chunk-3eqa6hnx.js +0 -2
- package/dist/chunk-4math14x.js +0 -2
- package/dist/chunk-5debppk8.js +0 -2
- package/dist/chunk-5sbtbfj3.js +0 -2
- package/dist/chunk-7vc8b7c5.js +0 -2
- package/dist/chunk-8veysx0v.js +0 -2
- package/dist/chunk-a9y9ghm2.js +0 -2
- package/dist/chunk-ac5sa72c.js +0 -2
- package/dist/chunk-bv6rx5w4.js +0 -2
- package/dist/chunk-f64wbr0j.js +0 -2
- package/dist/chunk-hvh7v5bx.js +0 -177
- package/dist/chunk-k3qh0esd.js +0 -21
- package/dist/chunk-kdat1ht1.js +0 -3
- package/dist/chunk-nrpqrqqe.js +0 -2
- package/dist/chunk-ps6m8n9n.js +0 -2
- package/dist/chunk-pxce4aag.js +0 -2
- package/dist/chunk-swp254eb.js +0 -2
- package/dist/chunk-szfh1sg3.js +0 -2
- package/dist/chunk-wxggf5aq.js +0 -2
- package/dist/chunk-ympa56f9.js +0 -2
- package/dist/chunk-yx3vghee.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{qe,$n,Zs,Ii,B}from"./chunk-60yppcbb.js";import{Tn}from"./chunk-h8h97bcc.js";import{Fr,C,_l,ft,Fi,Cl}from"./chunk-qjey0jk6.js";import{N}from"./chunk-farh4p7f.js";import{P,E,Qs,d,m,Ut,p,Y,W,k,ro,Re,Ge,so}from"./chunk-0tyyad6q.js";import{r,we}from"./chunk-x7redxyd.js";import{b}from"./chunk-94mpe1ny.js";import{Z}from"./chunk-rpep1ve3.js";import{c}from"./chunk-fd1bpv35.js";import ut from"path";import Vt from"process";import{AsyncLocalStorage as ma}from"async_hooks";var Dr=new ma;function xn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function Mr(e,t){return Dr.run(xn(e),t)}async function jr(e,t){let n=Dr.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((u)=>{let l=JSON.stringify(u,(x,v)=>{if(v===void 0||typeof v==="function"||typeof v==="symbol"||typeof v==="bigint"||typeof v==="number"&&!Number.isFinite(v))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(v&&typeof v==="object"&&!Array.isArray(v)&&Object.getPrototypeOf(v)!==Object.prototype&&Object.getPrototypeOf(v)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return v}),f=JSON.parse(l);return n.values.set(e,f),f}).catch((u)=>{throw n.pending.delete(e),u});return n.pending.set(e,a),a}function Pr(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 K(e,t=!1){let n=r(e),i=[],a=new Set,u=0,l=0,f=n.length,x=()=>{if(u!==0)return;let v=n.slice(l).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(v){if(t&&v[1]==="const")return;let z=v[2];if(!a.has(z))i.push(z),a.add(z);return}let A=n.slice(l).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){if(t&&n.slice(l).startsWith("const"))return;A[1].split(",").forEach((z)=>{let V=z.trim();if(!V)return;let F=V.indexOf(":"),H=(F>=0?V.slice(F+1).trim():V).split(/[\s=]/)[0];if(H&&!a.has(H))i.push(H),a.add(H)});return}let D=n.slice(l).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(D){if(t&&n.slice(l).startsWith("const"))return;D[1].split(",").forEach((z)=>{let V=z.trim().replace(/^\.\.\./,"");if(!V)return;let F=V.split(/[\s=]/)[0];if(F&&!a.has(F))i.push(F),a.add(F)});return}if(t)return;let U=n.slice(l).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let z=U[1];if(!a.has(z))i.push(z),a.add(z);return}let O=n.slice(l).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let z=O[1];if(!a.has(z))i.push(z),a.add(z)}};while(l<f){if(n[l]==="{"){u++,l++;continue}if(n[l]==="}"){u--,l++;continue}if(u===0&&/[a-z]/i.test(n[l])&&(l===0||/\s|[;{}()]/.test(n[l-1])))x();l++}return i.join(", ")}function js(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function ha(e,t=K(e).split(",").map((n)=>n.trim()).filter(Boolean)){let n=new Set(K(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 Bs(e,t){let n=`{ ${ha(e,t)} }`;return K(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${n}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:n}import Ot from"fs";import ve from"path";function G(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Nr=new Map;function _r(e,t=!0){let n=Nr.get(e);if(t&&n)return n;let i=new Map,a=[ve.join(e,"src"),ve.join(e,"dist"),e];function u(l,f){if(f>6)return;let x;try{x=Ot.readdirSync(l,{withFileTypes:!0})}catch{return}for(let v of x){let A=ve.join(l,v.name);if(v.isDirectory()){if(v.name==="node_modules"||v.name.startsWith("."))continue;u(A,f+1)}else if(v.isFile()&&v.name.endsWith(".stx")){let D=v.name.slice(0,-4);if(!i.has(D))i.set(D,A);let U=D.toLowerCase();if(!i.has(U))i.set(U,A);let O=G(D);if(!i.has(O))i.set(O,A)}}}for(let l of a)if(u(l,0),i.size>0)break;if(t)Nr.set(e,i);return i}function Fs(e,t){if(e.startsWith(".")||e.startsWith("/"))return null;let n=t;while(!0){let i=ve.join(n,"node_modules",e);try{if(Ot.statSync(i).isDirectory())return i}catch{}let a=ve.dirname(n);if(a===n)return null;n=a}}function zs(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 Lr(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=G(t);return[t,n,i]}function fi(e,t){let[n,i,a]=Lr(e);for(let u of[n,n.toLowerCase(),i,a]){let l=t?.__importedComponents?.get(u);if(l!==void 0)return l}}function gi(e,t){let n=t?ve.resolve(t):void 0,i=ve.dirname(ve.resolve(e));for(;;){if(Ot.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 xa=["src/ui","src/components","components","dist"];function zn(e,t){let n=ve.resolve(e);if(!t&&!n.split(ve.sep).includes("node_modules"))return[];let i=gi(n,t);if(!i)return[];let a=[];try{let f=JSON.parse(Ot.readFileSync(ve.join(i,"package.json"),"utf8")).stx?.components;if(Array.isArray(f))a=f.filter((x)=>typeof x==="string")}catch{}let u=a.length?a:xa;return[ve.dirname(ve.resolve(e)),...u.map((l)=>ve.resolve(i,l))]}function*mi(e,t,n={},i){let a=Lr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield ve.resolve(ve.dirname(t),`${a[0]}.stx`);return}let u=[...new Set(a.map((x)=>`${x}.stx`))],l=n.projectRoot||process.cwd(),f=[...zn(t,n.projectRoot),...i?.__originalFilePath?[ve.join(ve.dirname(i.__originalFilePath),"components")]:[],...n.componentsDir?[n.componentsDir]:[],ve.join(ve.dirname(t),"components"),ve.resolve(l,"src/components"),ve.resolve(l,"components"),...import.meta.dir?[ve.resolve(import.meta.dir,"components")]:[]];for(let x of new Set(f)){for(let v of u)yield ve.join(x,v);try{for(let v of Ot.readdirSync(x,{withFileTypes:!0}))if(v.isDirectory())for(let A of u)yield ve.join(x,v.name,A)}catch{}}}function zr(e,t,n={},i){let a=fi(e,i);if(a!==void 0)return a;for(let u of mi(e,t,n,i))try{if(Ot.statSync(u,{throwIfNoEntry:!1})?.isFile())return u}catch{}return null}function Hs(e,t=[],n={}){let i=new Set([...e].map((v)=>v.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(([v,A])=>[v.replace(/[-_]/g,"").toLowerCase(),A])),u=a.get("alt"),l=a.get("decorative"),f=typeof u==="string"&&!!u.trim(),x=typeof l==="string"?!["false","0","off","no"].includes(l.trim().toLowerCase()):Boolean(l);if(!f&&!x)return!1;if(["defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((v)=>i.has(v)))return!1;if([...t].some((v)=>!["load","error"].includes(v.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((v)=>i.has(v))}import is from"fs";import le from"path";import Et from"path";import sn from"fs";var ba=new Set(["touchstart","touchmove","wheel","mousewheel"]);function ys(e,t){if(t.passive)return!0;if(t.prevent||t.nonpassive)return!1;return ba.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"},ya=new Set(["ctrl","alt","shift","meta"]),Hr={left:0,middle:1,right:2};function Vr(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(ya.has(i))t.systemKeys.push(i);else if(i in Hr)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 qr(e,t=""){let n=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,u;while((u=a.exec(e))!==null){let[l,f,x]=u,v=u.index,A=v+l.length,D=`__stx_evt_${t}${i++}`,U=[],O=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,z;while((z=O.exec(x))!==null){let[,F,q]=z,H=F.split("."),M=H[0];if(!Br.has(M))continue;U.push({attribute:`@${F}`,event:M,handler:q,modifiers:Vr(H.slice(1)),elementId:D})}let V=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((z=V.exec(x))!==null){let[,F,q]=z,H=F.split("."),M=H[0];if(!Br.has(M))continue;U.push({attribute:`@${F}`,event:M,handler:q,modifiers:Vr(H.slice(1)),elementId:D})}if(U.length>0)n.push({originalTag:l,elementId:D,events:U,startIndex:v,endIndex:A})}return n}function _a(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=Hr[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 wa(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 _s(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 Sa(e){let{modifiers:t}=e,n=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=_a(e),a=wa(_s(e.handler),t),u=[];if(t.once)u.push("once: true");if(t.capture)u.push("capture: true");if(ys(e.event,t))u.push("passive: true");let l=u.length>0?`, { ${u.join(", ")} }`:"",f=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
|
|
2
|
+
import{qe,$n,Zs,Ii,B}from"./chunk-60yppcbb.js";import{Tn}from"./chunk-3972v2g1.js";import{Fr,C,_l,ft,Fi,Cl}from"./chunk-qjey0jk6.js";import{N}from"./chunk-farh4p7f.js";import{P,E,Qs,d,m,Ut,p,Y,W,k,ro,Re,Xe,so}from"./chunk-pffksrxb.js";import{r,we}from"./chunk-x7redxyd.js";import{b}from"./chunk-94mpe1ny.js";import{Z}from"./chunk-rpep1ve3.js";import{c}from"./chunk-fd1bpv35.js";import ut from"path";import Vt from"process";import{AsyncLocalStorage as ma}from"async_hooks";var Dr=new ma;function xn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function Mr(e,t){return Dr.run(xn(e),t)}async function jr(e,t){let n=Dr.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((u)=>{let l=JSON.stringify(u,(x,v)=>{if(v===void 0||typeof v==="function"||typeof v==="symbol"||typeof v==="bigint"||typeof v==="number"&&!Number.isFinite(v))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(v&&typeof v==="object"&&!Array.isArray(v)&&Object.getPrototypeOf(v)!==Object.prototype&&Object.getPrototypeOf(v)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return v}),f=JSON.parse(l);return n.values.set(e,f),f}).catch((u)=>{throw n.pending.delete(e),u});return n.pending.set(e,a),a}function Pr(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 K(e,t=!1){let n=r(e),i=[],a=new Set,u=0,l=0,f=n.length,x=()=>{if(u!==0)return;let v=n.slice(l).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(v){if(t&&v[1]==="const")return;let z=v[2];if(!a.has(z))i.push(z),a.add(z);return}let A=n.slice(l).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){if(t&&n.slice(l).startsWith("const"))return;A[1].split(",").forEach((z)=>{let V=z.trim();if(!V)return;let F=V.indexOf(":"),H=(F>=0?V.slice(F+1).trim():V).split(/[\s=]/)[0];if(H&&!a.has(H))i.push(H),a.add(H)});return}let D=n.slice(l).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(D){if(t&&n.slice(l).startsWith("const"))return;D[1].split(",").forEach((z)=>{let V=z.trim().replace(/^\.\.\./,"");if(!V)return;let F=V.split(/[\s=]/)[0];if(F&&!a.has(F))i.push(F),a.add(F)});return}if(t)return;let U=n.slice(l).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let z=U[1];if(!a.has(z))i.push(z),a.add(z);return}let O=n.slice(l).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let z=O[1];if(!a.has(z))i.push(z),a.add(z)}};while(l<f){if(n[l]==="{"){u++,l++;continue}if(n[l]==="}"){u--,l++;continue}if(u===0&&/[a-z]/i.test(n[l])&&(l===0||/\s|[;{}()]/.test(n[l-1])))x();l++}return i.join(", ")}function js(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function ha(e,t=K(e).split(",").map((n)=>n.trim()).filter(Boolean)){let n=new Set(K(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 Bs(e,t){let n=`{ ${ha(e,t)} }`;return K(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${n}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:n}import Ot from"fs";import ve from"path";function X(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Nr=new Map;function _r(e,t=!0){let n=Nr.get(e);if(t&&n)return n;let i=new Map,a=[ve.join(e,"src"),ve.join(e,"dist"),e];function u(l,f){if(f>6)return;let x;try{x=Ot.readdirSync(l,{withFileTypes:!0})}catch{return}for(let v of x){let A=ve.join(l,v.name);if(v.isDirectory()){if(v.name==="node_modules"||v.name.startsWith("."))continue;u(A,f+1)}else if(v.isFile()&&v.name.endsWith(".stx")){let D=v.name.slice(0,-4);if(!i.has(D))i.set(D,A);let U=D.toLowerCase();if(!i.has(U))i.set(U,A);let O=X(D);if(!i.has(O))i.set(O,A)}}}for(let l of a)if(u(l,0),i.size>0)break;if(t)Nr.set(e,i);return i}function Fs(e,t){if(e.startsWith(".")||e.startsWith("/"))return null;let n=t;while(!0){let i=ve.join(n,"node_modules",e);try{if(Ot.statSync(i).isDirectory())return i}catch{}let a=ve.dirname(n);if(a===n)return null;n=a}}function zs(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 Lr(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=X(t);return[t,n,i]}function fi(e,t){let[n,i,a]=Lr(e);for(let u of[n,n.toLowerCase(),i,a]){let l=t?.__importedComponents?.get(u);if(l!==void 0)return l}}function gi(e,t){let n=t?ve.resolve(t):void 0,i=ve.dirname(ve.resolve(e));for(;;){if(Ot.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 xa=["src/ui","src/components","components","dist"];function zn(e,t){let n=ve.resolve(e);if(!t&&!n.split(ve.sep).includes("node_modules"))return[];let i=gi(n,t);if(!i)return[];let a=[];try{let f=JSON.parse(Ot.readFileSync(ve.join(i,"package.json"),"utf8")).stx?.components;if(Array.isArray(f))a=f.filter((x)=>typeof x==="string")}catch{}let u=a.length?a:xa;return[ve.dirname(ve.resolve(e)),...u.map((l)=>ve.resolve(i,l))]}function*mi(e,t,n={},i){let a=Lr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield ve.resolve(ve.dirname(t),`${a[0]}.stx`);return}let u=[...new Set(a.map((x)=>`${x}.stx`))],l=n.projectRoot||process.cwd(),f=[...zn(t,n.projectRoot),...i?.__originalFilePath?[ve.join(ve.dirname(i.__originalFilePath),"components")]:[],...n.componentsDir?[n.componentsDir]:[],ve.join(ve.dirname(t),"components"),ve.resolve(l,"src/components"),ve.resolve(l,"components"),...import.meta.dir?[ve.resolve(import.meta.dir,"components")]:[]];for(let x of new Set(f)){for(let v of u)yield ve.join(x,v);try{for(let v of Ot.readdirSync(x,{withFileTypes:!0}))if(v.isDirectory())for(let A of u)yield ve.join(x,v.name,A)}catch{}}}function zr(e,t,n={},i){let a=fi(e,i);if(a!==void 0)return a;for(let u of mi(e,t,n,i))try{if(Ot.statSync(u,{throwIfNoEntry:!1})?.isFile())return u}catch{}return null}function Hs(e,t=[],n={}){let i=new Set([...e].map((v)=>v.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(([v,A])=>[v.replace(/[-_]/g,"").toLowerCase(),A])),u=a.get("alt"),l=a.get("decorative"),f=typeof u==="string"&&!!u.trim(),x=typeof l==="string"?!["false","0","off","no"].includes(l.trim().toLowerCase()):Boolean(l);if(!f&&!x)return!1;if(["defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((v)=>i.has(v)))return!1;if([...t].some((v)=>!["load","error"].includes(v.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((v)=>i.has(v))}import is from"fs";import le from"path";import Et from"path";import sn from"fs";var ba=new Set(["touchstart","touchmove","wheel","mousewheel"]);function ys(e,t){if(t.passive)return!0;if(t.prevent||t.nonpassive)return!1;return ba.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"},ya=new Set(["ctrl","alt","shift","meta"]),Hr={left:0,middle:1,right:2};function Vr(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(ya.has(i))t.systemKeys.push(i);else if(i in Hr)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 qr(e,t=""){let n=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,u;while((u=a.exec(e))!==null){let[l,f,x]=u,v=u.index,A=v+l.length,D=`__stx_evt_${t}${i++}`,U=[],O=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,z;while((z=O.exec(x))!==null){let[,F,q]=z,H=F.split("."),M=H[0];if(!Br.has(M))continue;U.push({attribute:`@${F}`,event:M,handler:q,modifiers:Vr(H.slice(1)),elementId:D})}let V=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((z=V.exec(x))!==null){let[,F,q]=z,H=F.split("."),M=H[0];if(!Br.has(M))continue;U.push({attribute:`@${F}`,event:M,handler:q,modifiers:Vr(H.slice(1)),elementId:D})}if(U.length>0)n.push({originalTag:l,elementId:D,events:U,startIndex:v,endIndex:A})}return n}function _a(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=Hr[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 wa(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 _s(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 Sa(e){let{modifiers:t}=e,n=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=_a(e),a=wa(_s(e.handler),t),u=[];if(t.once)u.push("once: true");if(t.capture)u.push("capture: true");if(ys(e.event,t))u.push("passive: true");let l=u.length>0?`, { ${u.join(", ")} }`:"",f=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
|
|
3
3
|
(function() {
|
|
4
4
|
var $el = document.getElementById('${n}');
|
|
5
5
|
if (!$el) return;
|
|
@@ -112,7 +112,7 @@ else {
|
|
|
112
112
|
`)}
|
|
113
113
|
})();
|
|
114
114
|
</script>`}function $a(e,t=""){let n=qr(e,t);if(n.length===0)return{template:e,bindings:[]};let i=e,a=[];for(let u=n.length-1;u>=0;u--){let l=n[u],f=l.originalTag;if(!f.includes(" id="))f=f.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${l.elementId}"`);else{let x=f.match(/id=["']([^"']+)["']/);if(x)for(let v of l.events)v.elementId=x[1]}for(let x of l.events){let v=x.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),A=new RegExp(`\\s*${v}\\s*=\\s*"[^"]*"`,"g"),D=new RegExp(`\\s*${v}\\s*=\\s*'[^']*'`,"g");f=f.replace(A,""),f=f.replace(D,"")}i=i.slice(0,l.startIndex)+f+i.slice(l.endIndex),a.push(...l.events)}return{template:i,bindings:a}}function Ur(e){let t=e.$uid;return typeof t==="string"&&t?`${t}_`:""}function Hc(e,t,n){if(Cl(e))return e;if(t.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:f,bindings:x}=$a(e,Ur(t)),v=t.__stx_event_bindings||[];return t.__stx_event_bindings=[...v,...x],f}let i=qr(e,Ur(t));if(i.length===0)return e;let a=e;for(let f=i.length-1;f>=0;f--){let x=i[f],v=x.originalTag;if(!v.includes(" id="))v=v.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${x.elementId}"`);else{let A=v.match(/id=["']([^"']+)["']/);if(A)for(let D of x.events)D.elementId=A[1]}for(let A of x.events){let D=A.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),U=new RegExp(`\\s*${D}\\s*=\\s*"[^"]*"`,"g"),O=new RegExp(`\\s*${D}\\s*=\\s*'[^']*'`,"g");v=v.replace(U,""),v=v.replace(O,"")}a=a.slice(0,x.startIndex)+v+a.slice(x.endIndex)}let u=hi(i.flatMap((f)=>f.events)),l=c(a);if(l!==-1)a=a.slice(0,l)+u+`
|
|
115
|
-
`+a.slice(l);else a+=u;return a}function Zr(e,t){let n=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(t){let u=a.lastIndexOf(":");if(u!==-1)a=a.slice(u+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))n.add(a)}return n}function Dt(e,t){let n=r(e),{depths:i,balanced:a}=we(n),u=(f)=>!a||i[f]===0,l=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${t}\\b)`,"g");for(let f of n.matchAll(l)){let x=(f.index??0)+f[0].length-f[1].length;if(u(x))return!0}for(let f of n.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(u(f.index??0)&&Zr(f[1],!0).has(t))return!0;for(let f of n.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(u(f.index??0)&&Zr(f[1],!1).has(t))return!0;return!1}var Kr=new P(32,{maxBytes:2097152,sizeOf:(e)=>e.code.length*4}),wt=/^[A-Za-z_$][\w$]*$/,va=new Set(["if","for","while","switch","with"]),Xr=["(","[","{"],Jr=[")","]","}"],Ea=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function ka(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 ws(e){let t=Kr.get(e);if(t)return t;let{code:n,tokens:i}=ka(e),a=new Map,u=[];for(let F=0;F<i.length;F++){let q=i[F].text;if(["(","[","{"].includes(q))u.push(F);else if([")","]","}"].includes(q)){let H=u.at(-1);if(H!==void 0&&["()","[]","{}"].includes(i[H].text+q))u.pop(),a.set(H,F),a.set(F,H)}}function l(F,q){let H=[],M=F;for(let Q=F;Q<q;Q++){if(["(","[","{"].includes(i[Q].text)&&(a.get(Q)??q)<q){Q=a.get(Q);continue}if(i[Q].text===",")H.push([M,Q]),M=Q+1}return H.push([M,q]),H}let f=[];function x(F,q,H,M=!1){if(i[F]?.text==="...")F++;if(F>=q)return;let Q=i[F].text;if(wt.test(Q)){if(H.add(Q),H===D)f.push({name:Q,token:F,functionScoped:M});return}if(Q!=="{"&&Q!=="[")return;let ie=a.get(F);if(ie===void 0||ie>=q)return;for(let[se,fe]of l(F+1,ie)){let xe=se;if(Q==="{")for(let ge=se;ge<fe;ge++){if(i[ge].text===":"){xe=ge+1;break}if(i[ge].text==="=")break;if(["(","[","{"].includes(i[ge].text)&&a.has(ge))ge=a.get(ge)}x(xe,fe,H,M)}}function v(F,q){let H=new Set;for(let[M,Q]of l(F,q))x(M,Q,H);return H}function A(F){let q=F;for(;q<i.length;q++){let H=i[q].text;if(["(","[","{"].includes(H)&&a.has(q)){q=a.get(q);continue}if([",",";",")","]","}"].includes(H))break}return i[Math.max(F,q-1)]?.end??n.length}let D=new Set,U=[];for(let F=0;F<i.length;F++)if(i[F].text==="=>"){let q=F-1,H=q,M;if(i[q]?.text===")"&&a.has(q))H=a.get(q),M=v(H+1,q);else if(i[q]&&wt.test(i[q].text))M=new Set([i[q].text]);else continue;let Q=F+1,ie=i[Q]?.text==="{"&&a.has(Q)?i[a.get(Q)].end:A(Q);U.push({start:i[H].start,end:ie,bodyStart:i[Q]?.start??ie,functionBody:!0,names:M})}else if(i[F].text==="("&&a.has(F)){let q=i[F-1]?.text;if(!q||va.has(q)||!wt.test(q)&&q!=="*"&&q!=="]")continue;let H=a.get(F),M=H+1;if(i[M]?.text===":"){M++;while(M<i.length&&!["{","=>",";","="].includes(i[M].text))M++}if(i[M]?.text!=="{"||!a.has(M))continue;U.push({start:i[F].start,end:i[a.get(M)].end,bodyStart:i[M].start,functionBody:q!=="catch",names:v(F+1,H)})}function O(F){let q=F;for(;q<i.length;q++){let H=i[q].text;if(Xr.includes(H)&&a.has(q)){q=a.get(q);continue}if(H===";"||Jr.includes(H))break;let M=i[q-1];if(q>F&&Ea.has(H)&&M.text!==".")break;if(q>F&&/[\n\r]/.test(n.slice(M.end,i[q].start))&&(/^[\w$]+$/.test(M.text)||Jr.includes(M.text)||['"',"'","`"].includes(M.text))&&wt.test(H)&&!["in","of","instanceof"].includes(H))break}return q}let z=[];for(let F=0;F<i.length;F++){if(i[F].text!=="for")continue;let q=i[F+1]?.text==="await"?F+2:F+1;if(i[q]?.text!=="("||!a.has(q))continue;let H=a.get(q),M=H+1,Q=i[M]?.text==="{"&&a.has(M)?a.get(M):O(M),ie=i[Q]?.text===";"||i[Q]?.text==="}"?i[Q].end:i[Math.max(M,Q-1)]?.end??n.length;z.push({headStart:q,headEnd:H,start:i[q].start,end:ie})}for(let F=0;F<i.length;F++){let q=i[F].text,H=i[F-1]?.text;if(H==="."||i[F+1]?.text===":")continue;if(H==="as"||H==="<")continue;if(q==="const"||q==="let"||q==="var"){let M=O(F+1),Q=F+1,ie=!1,se=!1,fe=0;for(let xe=F+1;xe<=M;xe++){let ge=i[xe]?.text;if(xe<M&&Xr.includes(ge)&&a.has(xe)&&a.get(xe)<M){xe=a.get(xe);continue}if(xe<M&&ge===":"&&!se)ie=!0;else if(xe<M&&ge==="="&&fe===0)ie=!1,se=!0;else if(xe<M&&ie&&ge==="<")fe++;else if(xe<M&&ie&&ge===">"&&fe>0)fe--;else if(xe===M||ge===","&&fe===0)x(Q,xe,D,q==="var"),Q=xe+1,ie=!1,se=!1}}else if(q==="function"||q==="class"){let M=F+1;if(i[M]?.text==="*")M++;if(i[M]&&wt.test(i[M].text)&&i[M].text!=="extends")D.add(i[M].text),f.push({name:i[M].text,token:M})}else if(q==="import"){let M=F+1;if(i[M]?.text==="*"&&i[M+1]?.text==="as")M+=2;let Q=i[M]?.text;if(Q&&wt.test(Q)&&Q!=="type"&&i[M+1]?.text!=="("&&i[M+1]?.text!==".")D.add(Q),f.push({name:Q,token:M,file:!0});let ie=i[M]?.text==="{"?M:i[M+1]?.text===","&&i[M+2]?.text==="{"?M+2:-1;if(ie!==-1&&a.has(ie)){let se=a.get(ie);for(let[fe,xe]of l(ie+1,se)){let ge=xe-1;while(ge>=fe&&!wt.test(i[ge].text))ge--;if(ge>=fe&&i[ge].text!=="type")f.push({name:i[ge].text,token:ge,file:!0})}}}}let V={code:n,scopes:U,loops:z,declarations:D,sites:f,tokens:i,pairs:a};return Kr.set(e,V),V}function nn(e){let t=ws(e);return{code:t.code,shadows:(n,i)=>t.scopes.some((a)=>i>=a.start&&i<a.end&&a.names.has(n))}}function Bn(e){return new Set(ws(e).declarations)}function Le(e,t){let{scopes:n,loops:i,sites:a,tokens:u,pairs:l}=ws(e),f=Array.from({length:u.length},()=>-1),x=[];for(let O=0;O<u.length;O++){f[O]=x.length?x[x.length-1]:-1;let z=u[O].text;if(z==="{"&&l.has(O))x.push(O);else if(z==="}"&&x.length&&l.get(O)===x[x.length-1])x.pop()}let v=new Set,A=new Map;for(let O of a){if(!t.has(O.name))continue;v.add(O.token);let z=O.file?-1:f[O.token],V=z===-1?[0,Number.POSITIVE_INFINITY]:[u[z].start,u[l.get(z)].end];if(O.functionScoped){let q=u[O.token].start,H=n.filter((M)=>M.functionBody&&q>=M.bodyStart&&q<M.end).sort((M,Q)=>M.end-M.bodyStart-(Q.end-Q.bodyStart))[0];V=H?[H.bodyStart,H.end]:[0,Number.POSITIVE_INFINITY]}else if(!O.file){let q=i.filter((H)=>O.token>H.headStart&&O.token<H.headEnd).sort((H,M)=>H.headEnd-H.headStart-(M.headEnd-M.headStart))[0];if(q)V=[q.start,q.end]}let F=A.get(O.name);if(F)F.push(V);else A.set(O.name,[V])}let D=new Set;for(let O=0;O<u.length;O++){if(u[O].text!=="import"||u[O-1]?.text===".")continue;let z=O+1;if(u[z]?.text==="type")z++;if(u[z]&&wt.test(u[z].text)&&u[z+1]?.text===",")z+=2;if(u[z]?.text==="{"&&l.has(z))for(let V=z+1;V<l.get(z);V++)D.add(V)}let U=new Set;for(let O=0;O<u.length;O++){let z=u[O].text;if(!t.has(z)||U.has(z)||v.has(O)||D.has(O))continue;let V=u[O-1]?.text;if(V==="#"||V==="."&&u[O-2]?.text!=="..")continue;if(u[O+1]?.text===":"&&(V==="{"||V===","))continue;let F=u[O].start;if(A.get(z)?.some(([q,H])=>F>=q&&F<H))continue;if(n.some((q)=>F>=q.start&&F<q.end&&q.names.has(z)))continue;U.add(z)}return U}var Me="0.2.869";var Gr=Symbol.for(`stx.lazy-module-promises.${Me}`);function Ra(){let e=globalThis;return e[Gr]??=new Map,e[Gr]}function o(e,t){let n=Ra(),i=`${import.meta.url}\x00${e}`,a=n.get(i);if(a)return a;let u=t();return n.set(i,u),u.catch(()=>{if(n.get(i)===u)n.delete(i)}),u}var Ta=/<\/(script)/gi;function de(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(Ta,"<\\/$1")}import Yr from"fs";var Qr=[];function S(e){let t=new P(e);return Qr.push(t),t}function Vc(){for(let e of Qr)e.clear()}function _(e,...t){return`${t.map((n)=>String(n??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function Cr(e){let t=[];for(let n of new Set(e))try{t.push({path:n,mtimeMs:Yr.statSync(n).mtimeMs})}catch{}return t}function Vs(e){for(let t of e)try{if(Yr.statSync(t.path).mtimeMs!==t.mtimeMs)return!1}catch{return!1}return!0}var Ee=["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 Aa=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function Ia(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 Pa(e,t){let n=t;while(!0){let i=Et.join(n,"node_modules",e,"package.json");if(sn.existsSync(i))return Et.dirname(i);let a=Et.dirname(n);if(a===n)return null;n=a}}function Oa(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 u=a.indexOf("*");if(u===-1)continue;let l=a.slice(0,u),f=a.slice(u+1);if(!t.startsWith(l)||!t.endsWith(f))continue;if(t.length<l.length+f.length)continue;if(!i||l.length>i.prefix.length)i={pattern:a,prefix:l,suffix:f}}if(i){let a=t.slice(i.prefix.length,t.length-i.suffix.length),u=n(e[i.pattern]);if(u)return u.replace("*",a)}return null}function Da(e,t){let n=Ia(e);if(!n||!n.subpath)return null;let i=Pa(n.pkg,t);if(!i)return null;let a;try{a=JSON.parse(sn.readFileSync(Et.join(i,"package.json"),"utf8"))}catch{return null}let u=`.${n.subpath}`,l=Oa(a.exports,u);if(!l)return null;let f=Et.resolve(i,l);return sn.existsSync(f)?f:null}function Ci(e,t){let n=t.filePath?Et.dirname(t.filePath):t.projectRoot||process.cwd(),i=t.projectRoot||process.cwd(),a=new Set,u=[],l=[];return{code:e.replace(Aa,(x,v)=>{let A;try{if(v.startsWith("./")||v.startsWith("../")||v.startsWith("/")){if(A=v.startsWith("/")?v:Et.resolve(n,v),!sn.existsSync(A))throw Error(`file not found: ${A}`)}else{let D=null;try{D=Bun.resolveSync(v,i)}catch{D=Da(v,i)}if(!D)throw Error(`could not resolve ${v} (Bun.resolveSync + exports fallback both failed)`);A=D}}catch(D){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(v)} (from ${t.filePath||"<unknown>"}): ${D?.message||D}`),l.push(v),""}if(a.has(A))return"";a.add(A);try{let D=sn.readFileSync(A,"utf8");u.push({source:v,resolvedPath:A,contents:D})}catch(D){console.warn(`[stx:vendor-css] could not read ${A}: ${D?.message||D}`),l.push(v)}return""}),styles:u,unresolved:l}}function Ma(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Ei(e){if(e.length===0)return"";return`${e.map((t)=>`<style data-stx-vendor="${Ma(t.source)}" data-stx-layer="vendor">
|
|
115
|
+
`+a.slice(l);else a+=u;return a}function Zr(e,t){let n=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(t){let u=a.lastIndexOf(":");if(u!==-1)a=a.slice(u+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))n.add(a)}return n}function Dt(e,t){let n=r(e),{depths:i,balanced:a}=we(n),u=(f)=>!a||i[f]===0,l=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${t}\\b)`,"g");for(let f of n.matchAll(l)){let x=(f.index??0)+f[0].length-f[1].length;if(u(x))return!0}for(let f of n.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(u(f.index??0)&&Zr(f[1],!0).has(t))return!0;for(let f of n.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(u(f.index??0)&&Zr(f[1],!1).has(t))return!0;return!1}var Kr=new P(32,{maxBytes:2097152,sizeOf:(e)=>e.code.length*4}),wt=/^[A-Za-z_$][\w$]*$/,va=new Set(["if","for","while","switch","with"]),Xr=["(","[","{"],Jr=[")","]","}"],Ea=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function ka(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 ws(e){let t=Kr.get(e);if(t)return t;let{code:n,tokens:i}=ka(e),a=new Map,u=[];for(let F=0;F<i.length;F++){let q=i[F].text;if(["(","[","{"].includes(q))u.push(F);else if([")","]","}"].includes(q)){let H=u.at(-1);if(H!==void 0&&["()","[]","{}"].includes(i[H].text+q))u.pop(),a.set(H,F),a.set(F,H)}}function l(F,q){let H=[],M=F;for(let Q=F;Q<q;Q++){if(["(","[","{"].includes(i[Q].text)&&(a.get(Q)??q)<q){Q=a.get(Q);continue}if(i[Q].text===",")H.push([M,Q]),M=Q+1}return H.push([M,q]),H}let f=[];function x(F,q,H,M=!1){if(i[F]?.text==="...")F++;if(F>=q)return;let Q=i[F].text;if(wt.test(Q)){if(H.add(Q),H===D)f.push({name:Q,token:F,functionScoped:M});return}if(Q!=="{"&&Q!=="[")return;let ie=a.get(F);if(ie===void 0||ie>=q)return;for(let[se,fe]of l(F+1,ie)){let xe=se;if(Q==="{")for(let ge=se;ge<fe;ge++){if(i[ge].text===":"){xe=ge+1;break}if(i[ge].text==="=")break;if(["(","[","{"].includes(i[ge].text)&&a.has(ge))ge=a.get(ge)}x(xe,fe,H,M)}}function v(F,q){let H=new Set;for(let[M,Q]of l(F,q))x(M,Q,H);return H}function A(F){let q=F;for(;q<i.length;q++){let H=i[q].text;if(["(","[","{"].includes(H)&&a.has(q)){q=a.get(q);continue}if([",",";",")","]","}"].includes(H))break}return i[Math.max(F,q-1)]?.end??n.length}let D=new Set,U=[];for(let F=0;F<i.length;F++)if(i[F].text==="=>"){let q=F-1,H=q,M;if(i[q]?.text===")"&&a.has(q))H=a.get(q),M=v(H+1,q);else if(i[q]&&wt.test(i[q].text))M=new Set([i[q].text]);else continue;let Q=F+1,ie=i[Q]?.text==="{"&&a.has(Q)?i[a.get(Q)].end:A(Q);U.push({start:i[H].start,end:ie,bodyStart:i[Q]?.start??ie,functionBody:!0,names:M})}else if(i[F].text==="("&&a.has(F)){let q=i[F-1]?.text;if(!q||va.has(q)||!wt.test(q)&&q!=="*"&&q!=="]")continue;let H=a.get(F),M=H+1;if(i[M]?.text===":"){M++;while(M<i.length&&!["{","=>",";","="].includes(i[M].text))M++}if(i[M]?.text!=="{"||!a.has(M))continue;U.push({start:i[F].start,end:i[a.get(M)].end,bodyStart:i[M].start,functionBody:q!=="catch",names:v(F+1,H)})}function O(F){let q=F;for(;q<i.length;q++){let H=i[q].text;if(Xr.includes(H)&&a.has(q)){q=a.get(q);continue}if(H===";"||Jr.includes(H))break;let M=i[q-1];if(q>F&&Ea.has(H)&&M.text!==".")break;if(q>F&&/[\n\r]/.test(n.slice(M.end,i[q].start))&&(/^[\w$]+$/.test(M.text)||Jr.includes(M.text)||['"',"'","`"].includes(M.text))&&wt.test(H)&&!["in","of","instanceof"].includes(H))break}return q}let z=[];for(let F=0;F<i.length;F++){if(i[F].text!=="for")continue;let q=i[F+1]?.text==="await"?F+2:F+1;if(i[q]?.text!=="("||!a.has(q))continue;let H=a.get(q),M=H+1,Q=i[M]?.text==="{"&&a.has(M)?a.get(M):O(M),ie=i[Q]?.text===";"||i[Q]?.text==="}"?i[Q].end:i[Math.max(M,Q-1)]?.end??n.length;z.push({headStart:q,headEnd:H,start:i[q].start,end:ie})}for(let F=0;F<i.length;F++){let q=i[F].text,H=i[F-1]?.text;if(H==="."||i[F+1]?.text===":")continue;if(H==="as"||H==="<")continue;if(q==="const"||q==="let"||q==="var"){let M=O(F+1),Q=F+1,ie=!1,se=!1,fe=0;for(let xe=F+1;xe<=M;xe++){let ge=i[xe]?.text;if(xe<M&&Xr.includes(ge)&&a.has(xe)&&a.get(xe)<M){xe=a.get(xe);continue}if(xe<M&&ge===":"&&!se)ie=!0;else if(xe<M&&ge==="="&&fe===0)ie=!1,se=!0;else if(xe<M&&ie&&ge==="<")fe++;else if(xe<M&&ie&&ge===">"&&fe>0)fe--;else if(xe===M||ge===","&&fe===0)x(Q,xe,D,q==="var"),Q=xe+1,ie=!1,se=!1}}else if(q==="function"||q==="class"){let M=F+1;if(i[M]?.text==="*")M++;if(i[M]&&wt.test(i[M].text)&&i[M].text!=="extends")D.add(i[M].text),f.push({name:i[M].text,token:M})}else if(q==="import"){let M=F+1;if(i[M]?.text==="*"&&i[M+1]?.text==="as")M+=2;let Q=i[M]?.text;if(Q&&wt.test(Q)&&Q!=="type"&&i[M+1]?.text!=="("&&i[M+1]?.text!==".")D.add(Q),f.push({name:Q,token:M,file:!0});let ie=i[M]?.text==="{"?M:i[M+1]?.text===","&&i[M+2]?.text==="{"?M+2:-1;if(ie!==-1&&a.has(ie)){let se=a.get(ie);for(let[fe,xe]of l(ie+1,se)){let ge=xe-1;while(ge>=fe&&!wt.test(i[ge].text))ge--;if(ge>=fe&&i[ge].text!=="type")f.push({name:i[ge].text,token:ge,file:!0})}}}}let V={code:n,scopes:U,loops:z,declarations:D,sites:f,tokens:i,pairs:a};return Kr.set(e,V),V}function nn(e){let t=ws(e);return{code:t.code,shadows:(n,i)=>t.scopes.some((a)=>i>=a.start&&i<a.end&&a.names.has(n))}}function Bn(e){return new Set(ws(e).declarations)}function Le(e,t){let{scopes:n,loops:i,sites:a,tokens:u,pairs:l}=ws(e),f=Array.from({length:u.length},()=>-1),x=[];for(let O=0;O<u.length;O++){f[O]=x.length?x[x.length-1]:-1;let z=u[O].text;if(z==="{"&&l.has(O))x.push(O);else if(z==="}"&&x.length&&l.get(O)===x[x.length-1])x.pop()}let v=new Set,A=new Map;for(let O of a){if(!t.has(O.name))continue;v.add(O.token);let z=O.file?-1:f[O.token],V=z===-1?[0,Number.POSITIVE_INFINITY]:[u[z].start,u[l.get(z)].end];if(O.functionScoped){let q=u[O.token].start,H=n.filter((M)=>M.functionBody&&q>=M.bodyStart&&q<M.end).sort((M,Q)=>M.end-M.bodyStart-(Q.end-Q.bodyStart))[0];V=H?[H.bodyStart,H.end]:[0,Number.POSITIVE_INFINITY]}else if(!O.file){let q=i.filter((H)=>O.token>H.headStart&&O.token<H.headEnd).sort((H,M)=>H.headEnd-H.headStart-(M.headEnd-M.headStart))[0];if(q)V=[q.start,q.end]}let F=A.get(O.name);if(F)F.push(V);else A.set(O.name,[V])}let D=new Set;for(let O=0;O<u.length;O++){if(u[O].text!=="import"||u[O-1]?.text===".")continue;let z=O+1;if(u[z]?.text==="type")z++;if(u[z]&&wt.test(u[z].text)&&u[z+1]?.text===",")z+=2;if(u[z]?.text==="{"&&l.has(z))for(let V=z+1;V<l.get(z);V++)D.add(V)}let U=new Set;for(let O=0;O<u.length;O++){let z=u[O].text;if(!t.has(z)||U.has(z)||v.has(O)||D.has(O))continue;let V=u[O-1]?.text;if(V==="#"||V==="."&&u[O-2]?.text!=="..")continue;if(u[O+1]?.text===":"&&(V==="{"||V===","))continue;let F=u[O].start;if(A.get(z)?.some(([q,H])=>F>=q&&F<H))continue;if(n.some((q)=>F>=q.start&&F<q.end&&q.names.has(z)))continue;U.add(z)}return U}var Me="0.2.871";var Gr=Symbol.for(`stx.lazy-module-promises.${Me}`);function Ra(){let e=globalThis;return e[Gr]??=new Map,e[Gr]}function o(e,t){let n=Ra(),i=`${import.meta.url}\x00${e}`,a=n.get(i);if(a)return a;let u=t();return n.set(i,u),u.catch(()=>{if(n.get(i)===u)n.delete(i)}),u}var Ta=/<\/(script)/gi;function de(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(Ta,"<\\/$1")}import Yr from"fs";var Qr=[];function S(e){let t=new P(e);return Qr.push(t),t}function Vc(){for(let e of Qr)e.clear()}function _(e,...t){return`${t.map((n)=>String(n??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function Cr(e){let t=[];for(let n of new Set(e))try{t.push({path:n,mtimeMs:Yr.statSync(n).mtimeMs})}catch{}return t}function Vs(e){for(let t of e)try{if(Yr.statSync(t.path).mtimeMs!==t.mtimeMs)return!1}catch{return!1}return!0}var Ee=["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 Aa=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function Ia(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 Pa(e,t){let n=t;while(!0){let i=Et.join(n,"node_modules",e,"package.json");if(sn.existsSync(i))return Et.dirname(i);let a=Et.dirname(n);if(a===n)return null;n=a}}function Oa(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 u=a.indexOf("*");if(u===-1)continue;let l=a.slice(0,u),f=a.slice(u+1);if(!t.startsWith(l)||!t.endsWith(f))continue;if(t.length<l.length+f.length)continue;if(!i||l.length>i.prefix.length)i={pattern:a,prefix:l,suffix:f}}if(i){let a=t.slice(i.prefix.length,t.length-i.suffix.length),u=n(e[i.pattern]);if(u)return u.replace("*",a)}return null}function Da(e,t){let n=Ia(e);if(!n||!n.subpath)return null;let i=Pa(n.pkg,t);if(!i)return null;let a;try{a=JSON.parse(sn.readFileSync(Et.join(i,"package.json"),"utf8"))}catch{return null}let u=`.${n.subpath}`,l=Oa(a.exports,u);if(!l)return null;let f=Et.resolve(i,l);return sn.existsSync(f)?f:null}function Ci(e,t){let n=t.filePath?Et.dirname(t.filePath):t.projectRoot||process.cwd(),i=t.projectRoot||process.cwd(),a=new Set,u=[],l=[];return{code:e.replace(Aa,(x,v)=>{let A;try{if(v.startsWith("./")||v.startsWith("../")||v.startsWith("/")){if(A=v.startsWith("/")?v:Et.resolve(n,v),!sn.existsSync(A))throw Error(`file not found: ${A}`)}else{let D=null;try{D=Bun.resolveSync(v,i)}catch{D=Da(v,i)}if(!D)throw Error(`could not resolve ${v} (Bun.resolveSync + exports fallback both failed)`);A=D}}catch(D){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(v)} (from ${t.filePath||"<unknown>"}): ${D?.message||D}`),l.push(v),""}if(a.has(A))return"";a.add(A);try{let D=sn.readFileSync(A,"utf8");u.push({source:v,resolvedPath:A,contents:D})}catch(D){console.warn(`[stx:vendor-css] could not read ${A}: ${D?.message||D}`),l.push(v)}return""}),styles:u,unresolved:l}}function Ma(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Ei(e){if(e.length===0)return"";return`${e.map((t)=>`<style data-stx-vendor="${Ma(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)=>qa(n,i)).join(`
|
|
184
184
|
`)}`}function si(e){let t=[],n=new Set,i=e.replace(/^\s*import\s+.*$/gm,""),a=0,u=i.length,l=0;while(l<u){let f=i[l];if(f==="'"||f==='"'||f==="`"){let x=f;if(l++,x==="`"){let v=0;while(l<u){if(i[l]==="\\"){l+=2;continue}if(i[l]==="`"&&v===0){l++;break}if(i[l]==="$"&&i[l+1]==="{"){v++,l+=2;continue}if(i[l]==="}"&&v>0){v--,l++;continue}l++}}else while(l<u){if(i[l]==="\\"){l+=2;continue}if(i[l]===x){l++;break}l++}continue}if(f==="/"&&i[l+1]==="/"){while(l<u&&i[l]!==`
|
|
185
|
-
`)l++;continue}if(f==="/"&&i[l+1]==="*"){l+=2;while(l<u-1&&!(i[l]==="*"&&i[l+1]==="/"))l++;l+=2;continue}if(f==="{"){a++,l++;continue}if(f==="}"){a--,l++;continue}if(a===0){let x=i.slice(l),v=x.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(v){let U=v[1];if(!U.startsWith("_")&&!n.has(U))t.push(U),n.add(U);l+=v[0].length;continue}let A=x.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){A[1].split(",").forEach((U)=>{let O=U.trim(),z=O.indexOf(":"),V=z>=0?O.slice(z+1).trim().split(/[\s=]/)[0]:O.split(/[\s=]/)[0];if(V&&!V.startsWith("_")&&!n.has(V))t.push(V),n.add(V)}),l+=A[0].length;continue}let D=x.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(D){let U=D[1];if(!U.startsWith("_")&&!n.has(U))t.push(U),n.add(U);l+=D[0].length;continue}}l++}return t}var Ka=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 Xa(e){let t=new Set,n=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(U){let O;while((O=n.exec(U))!==null){let z=O[0];if(!Ka.has(z))t.add(z)}}let a=/\{\{([\s\S]*?)\}\}/g,u;while((u=a.exec(e))!==null)i(u[1]);let l=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((u=l.exec(e))!==null)i(u[1]);let f=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((u=f.exec(e))!==null)i(u[1]);let x=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((u=x.exec(e))!==null)i(u[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((u=v.exec(e))!==null)i(u[1]);let A=/@model\s*=\s*["']([^"']*)["']/gi;while((u=A.exec(e))!==null)i(u[1]);let D=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((u=D.exec(e))!==null)i(u[1]);return t}async function He(e,t={}){let n=e,i="",a=!1,u=[],l=Ci(n,{filePath:t.filePath,projectRoot:t.projectRoot});n=l.code;let f=Ei(l.styles),x=zt(n);n=x.code,u=[...x.imports,...x.models];let{hasUserImports:v,bundleClientScript:A}=await o("stx/client-script-bundler",()=>import("./chunk-
|
|
185
|
+
`)l++;continue}if(f==="/"&&i[l+1]==="*"){l+=2;while(l<u-1&&!(i[l]==="*"&&i[l+1]==="/"))l++;l+=2;continue}if(f==="{"){a++,l++;continue}if(f==="}"){a--,l++;continue}if(a===0){let x=i.slice(l),v=x.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(v){let U=v[1];if(!U.startsWith("_")&&!n.has(U))t.push(U),n.add(U);l+=v[0].length;continue}let A=x.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){A[1].split(",").forEach((U)=>{let O=U.trim(),z=O.indexOf(":"),V=z>=0?O.slice(z+1).trim().split(/[\s=]/)[0]:O.split(/[\s=]/)[0];if(V&&!V.startsWith("_")&&!n.has(V))t.push(V),n.add(V)}),l+=A[0].length;continue}let D=x.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(D){let U=D[1];if(!U.startsWith("_")&&!n.has(U))t.push(U),n.add(U);l+=D[0].length;continue}}l++}return t}var Ka=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 Xa(e){let t=new Set,n=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(U){let O;while((O=n.exec(U))!==null){let z=O[0];if(!Ka.has(z))t.add(z)}}let a=/\{\{([\s\S]*?)\}\}/g,u;while((u=a.exec(e))!==null)i(u[1]);let l=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((u=l.exec(e))!==null)i(u[1]);let f=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((u=f.exec(e))!==null)i(u[1]);let x=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((u=x.exec(e))!==null)i(u[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((u=v.exec(e))!==null)i(u[1]);let A=/@model\s*=\s*["']([^"']*)["']/gi;while((u=A.exec(e))!==null)i(u[1]);let D=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((u=D.exec(e))!==null)i(u[1]);return t}async function He(e,t={}){let n=e,i="",a=!1,u=[],l=Ci(n,{filePath:t.filePath,projectRoot:t.projectRoot});n=l.code;let f=Ei(l.styles),x=zt(n);n=x.code,u=[...x.imports,...x.models];let{hasUserImports:v,bundleClientScript:A}=await o("stx/client-script-bundler",()=>import("./chunk-sghbhdtj.js"));if(v(n))n=await A(n,t.filePath||"",{projectRoot:t.projectRoot,minify:t.production}),a=!0;if(t.autoImports!==!1){let M=al(n);n=M.code,i=cl(M.stxImports,M.browserImports.filter((Q)=>!u.includes(Q)))}if(i=`${kn(n,t.serverData)}${i}`,n=N(n),!a&&Ve(t.attrs||""))n=Ue(n);let D=Za(t.eventBindings||[]),U=(t.attrs||"").trim(),O=/\btype\s*=\s*["']module["']/i.test(U),z=t.instanceId?` data-stx-instance="${t.instanceId}"`:"";if(O){let M=U.replace(/\btype\s*=\s*["']module["']/i,"").trim(),Q=`type="module" data-stx-scoped${z}${M?` ${M}`:""}`;return`${f}<script ${Q}>
|
|
186
186
|
${de(`${i}${n}
|
|
187
187
|
${D}`)}
|
|
188
188
|
</script>`}let V=Fi(e),F=/function __stx_setup_/.test(n),q=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function H(M){let Q=M.length>0?`
|
|
@@ -213,8 +213,8 @@ ${D}`)}
|
|
|
213
213
|
${de(l)}
|
|
214
214
|
})();
|
|
215
215
|
</script>`,x,v=/<(?:template\b|script\b(?=[^>]*\bdata-stx-scoped\b))/iy;return w(e,(A,D)=>{if(x===void 0){if(v.lastIndex=D,v.test(A))x=D}return-1}),a.push({start:x??0,end:x??0,replacement:`${f}
|
|
216
|
-
`}),ci(e,a)}function ci(e,t){if(t.length===0)return e;t.sort((u,l)=>u.start-l.start||u.end-l.end);let n=Array(t.length*2+1),i=0,a=0;for(let u of t)n[a++]=e.slice(i,u.start),n[a++]=u.replacement,i=u.end;return n[a]=e.slice(i),n.join("")}function li(e){let t=qn(e),n=new Map;if(t)for(let[i,a]of t)n.set(i,a.instances);return n}function ui(e,t){let n=qn(e);if(!n)return[];let i=[];for(let[a,u]of n){let l=u.instances-(t.get(a)??0);if(l>0)i.push({body:u.body,count:l})}return i}function pi(e,t){for(let{body:n,count:i}of t)for(let a=0;a<i;a++)Ts(e,n)}function Ce(e,t,n=2){let i=0,a=null;for(let u=t+n;u<e.length;u++){let l=e[u];if(a){if(l==="\\"){u++;continue}if(l===a)a=null;continue}if(l==='"'||l==="'"||l==="`"){a=l;continue}if(l==="{"){i++;continue}if(l==="}"){if(i>0){i--;continue}let f=0;while(e[u+f]==="}")f++;if(f>=n)return u}}return-1}import Li from"fs";var di=0,As=new Map;function pl(){di=0,As.clear()}function Zn(e,t){let n=di++,i=`<!--__STX_${e.toUpperCase()}_${n}__-->`;return As.set(i,{type:e,expression:t}),i}function fl(){let e={};for(let[t,n]of As)e[t]={type:n.type,expression:n.expression};return e}function gl(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 rc=/@(?=[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 ic(e){return Array.from({length:e},()=>"{").join("⁠")}function Pi(e){return e.replace(/\{{2,}/g,(t)=>ic(t.length)).replace(/\{(?=!)/g,"{⁠").replace(rc,"@")}function $r(e,t,n=!1){let{openTag:i,tail:a}=n?oc(e,t):ac(e).at(t);return lc(a,i,n)}function oc(e,t){let n="",i=0;for(let l=0;l<t;l++){if(!e.startsWith("{{",l))continue;let f=Ce(e,l);if(f<0||f+2>t)break;n+=e.slice(i,l)+"x",l=f+1,i=f+2}n+=e.slice(i,t);let a=-1,u=null;for(let l=0;l<n.length;l++){let f=n[l];if(u){if(f===u)u=null;continue}if(f==='"'||f==="'"){u=f;continue}if(f===">"){a=-1;continue}if(f==="<")a=l}return{openTag:a,tail:a>=0?n.slice(a+1):n}}var Kn=null;function ac(e){if(Kn&&Kn.source===e)return Kn.scanner;let t=cc(e);return Kn={source:e,scanner:t},t}function cc(e){let t=0,n=-1,i=null,a=-1,u=(f,x)=>{let v=e[f];if(x.quote){if(v===x.quote)x.quote=null;return}if(x.openTag>=0){if(v==='"'||v==="'"){x.quote=v;return}if(v===">"){x.openTag=-1;return}}if(v==="<")x.openTag=f},l=(f,x)=>{if(x.openTag>=0||!e.startsWith("<!--",f))return-1;let v=e.indexOf("-->",f+4);return v<0?e.length:v+3};return{at(f){if(f<t)t=0,n=-1,i=null,a=-1;let x={openTag:n,quote:i},v=!1;while(t<f){if(a<0&&e.startsWith("{{",t)){let V=Ce(e,t);if(V<0)a=t;else if(V+2<=f){t=V+2;continue}else break}let z=l(t,x);if(z>=0){if(z>f){v=!0;break}t=z;continue}u(t,x),t++}if(n=x.openTag,i=x.quote,v)return{openTag:-1,tail:""};let A=a>=0?a:t,D={openTag:n,quote:i};for(let z=t;z<f;z++){let V=l(z,D);if(V>=0){if(V>f)return{openTag:-1,tail:""};z=V-1;continue}u(z,D)}if(D.openTag<0)return{openTag:-1,tail:""};let U="",O=D.openTag+1;for(let z=O;z<Math.min(f,A);z++){if(!e.startsWith("{{",z))continue;let V=Ce(e,z);U+=e.slice(O,z)+"x",z=V+1,O=V+2}return U+=e.slice(O,f),{openTag:D.openTag,tail:U}}}}function lc(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 u=e.slice(a,i);if(!u)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 l=e[i];if(l==='"'||l==="'"){let f=++i,x=e.indexOf(l,i);if(x===-1)return{kind:"attribute",name:u,quote:l,valuePrefix:e.slice(f)};i=x+1}else{let f=i;while(i<e.length&&!/\s/.test(e[i]))i++;if(i===e.length)return{kind:"attribute",name:u,quote:null,valuePrefix:e.slice(f)}}}return{kind:"tag"}}class pe 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 Oi="unsafe:";var uc=/^(?:javascript|vbscript|livescript|mocha|view-source):/,fc=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,pc=/^data:(?:text\/html|application\/xhtml\+xml)/,dc=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function gc(e){return e.replace(dc,"").toLowerCase()}function Is(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 Xn(e,t="navigable"){let n=gc(e);if(uc.test(n))return!0;return t==="navigable"?fc.test(n):pc.test(n)}function Tr(e,t="navigable"){return Xn(e,t)?"unsafe:"+e:e}function mc(e){let t=e.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!t)return null;if(t[3].trim()!=="")return null;return Is(t[1])}function Di(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 Mi(e,t,n=t){let i=mc(e);return i&&Xn(t,i)?"unsafe:"+n:n}function jt(e){let t=e.indexOf(" as ");if(t!==-1){let u=e.slice(0,t).trim(),l=e.slice(t+4).trim();return u&&l?{arrayExpr:u,itemVar:l}: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 Jn(e){let t=[],n=0,i="",a=0;for(let u=0;u<e.length;u++){let l=e[u];if(i){if(l==="\\")u++;else if(l===i)i="";continue}if(l==="'"||l==='"'||l==="`")i=l;else if(l==="("||l==="["||l==="{")n++;else if(l===")"||l==="]"||l==="}")n--;else if(l===","&&n===0)t.push(e.slice(a,u)),a=u+1}return t.push(e.slice(a)),t}function ji(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 Ni(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 kt(e,t){let n=e.trim().replace(/^\.\.\./,"").trim(),i=ji(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 Jn(n.slice(1,-1))){let u=a.trim();if(!u)continue;if(u.startsWith("...")){kt(u,t);continue}let l=ji(u,":");kt(l===-1?u:u.slice(l+1),t)}return}if(n.startsWith("[")&&n.endsWith("]")){for(let a of Jn(n.slice(1,-1)))kt(a,t);return}if(/^[A-Z_$][\w$]*$/i.test(n))t.push(n)}function te(e){let t=e.trim(),n=[],i=0;for(let u=0;u<t.length;u++){let l=t[u];if(l==="("||l==="["||l==="{")i++;else if(l===")"||l==="]"||l==="}")i--;else if(i===0&&/\s/.test(l)){if(!/^\s+(?:in|of)\s/.exec(t.slice(u)))continue;let x=t.slice(0,u).trim();if(x.startsWith("(")&&Ni(x)===x.length-1)x=x.slice(1,-1);for(let v of Jn(x))kt(v,n);if(n.length>0)return n;break}}let a=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(t);if(a){let u=a[1].trim();if(u.startsWith("(")&&Ni(u)===u.length-1)u=u.slice(1,-1);let l=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(u);if(l)kt(l[2],n),kt(l[1],n);else for(let f of Jn(u))kt(f,n)}return n}function j(e,t){let n=t instanceof Set?t:new Set(t);if(n.size===0)return!1;let l=e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g," ").replace(/`(?:[^`\\$]|\\.|\$(?!\{))*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:(?!:))/g,"$1$2");for(let f of l.match(/[a-zA-Z_$][\w$]*/g)||[])if(n.has(f))return!0;return!1}var Gn="__stx_client_loop_names";function ct(e){let t=e?.[Gn];return Array.isArray(t)?t:[]}function Yn(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 u=a[0];if(/^<\/template\s*>$/i.test(u)){let l=n.pop();if(l)l.end=a.index}else if(/^<template\b/i.test(u)&&!/\/\s*>$/.test(u)){let f=[...u.slice(9).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)].find((A)=>/^(?:#[\w-]+|v-slot:[\w-]+|data-stx-slot-binding)$/i.test(A[1])),x=(f?.[2]??f?.[3])?.trim();if(x&&f?.[1]==="data-stx-slot-binding")try{x=decodeURIComponent(x)}catch{x=void 0}let v=x?{start:a.index+u.length,end:e.length,binding:x}:void 0;if(n.push(v),v)t.push(v)}}return t}var on={},zi=new Map;function hc(e){let t=zi.get(e);if(!t){let n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=new RegExp(`:${n}(?!\\w)`,"g"),zi.set(e,t)}return t.lastIndex=0,t}var Ys={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 X(String(e))},translate:(e,t,n={})=>{if(!t||!t.__translations)return e;let i=t.__translations,a=t.__i18nConfig?.fallbackToKey??!0,u=String(e).split("."),l=i;for(let x of u){if(l===void 0||l===null)break;l=l[x]}if(l===void 0||l===null)return a?e:"";let f=String(l);return Object.entries(n).forEach(([x,v])=>{f=f.replace(hc(x),()=>String(v))}),f},t:(e,t,n={})=>Ys.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 u={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,u[n]||u.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 u=i||`${n}s`;return a===1?n:u},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 Ig(e,t){if(e in Ys)console.warn(`Filter "${e}" already exists as a built-in filter. Custom filter will take precedence.`);on[e]=t}function my(e){for(let[t,n]of Object.entries(e))Ig(t,n)}function Og(){return{...Ys,...on}}function hy(){for(let e of Object.keys(on))delete on[e]}function qi(e){let t=e.next();while(!t.done)t=e.next();return t.value}function*Zi(e,t,n,i){let a="{".repeat(n);if(!e.includes(a))return e;let u="",l=0,f=0,x=i===Number.POSITIVE_INFINITY?0:performance.now();for(;;){let v=e.indexOf(a,l);if(v===-1)break;let A=Ce(e,v,n);if(A===-1)break;if(u+=e.slice(l,v)+t(e.slice(v,A+n),e.slice(v+n,A),v),l=A+n,++f>=64){f=0;let D=performance.now();if(D-x>=i)x=D,yield}}return l===0?e:u+e.slice(l)}function Cn(e,t,n=2){return qi(Zi(e,t,n,Number.POSITIVE_INFINITY))}function xc(e,t,n){let i=n[0];if(i!=="'"&&i!=='"'&&i!=="`")return!1;let a=$r(e,t);if(!a||a.kind!=="attribute"||a.quote===i)return!1;if(!/^(?::|@|x-|v-)/.test(a.name))return!1;let u=0;for(let l=0;l<a.valuePrefix.length;l++)if(a.valuePrefix[l]==="\\")l++;else if(a.valuePrefix[l]===i)u++;return u%2===1}function g(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function X(e){return Pi(g(e))}function bc(e){return e.replace(/ /g," ").replace(/\t/g,"	").replace(/\n/g," ").replace(/\r/g," ").replace(/\f/g,"").replace(/=/g,"=").replace(/`/g,"`")}function yc(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 _c(e,t){let n=yc(e);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(n))throw new pe(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 u=a[1].replace(/^["']|["']$/g,""),l=u.startsWith("/")&&!u.startsWith("//")||u.startsWith("./")||u.startsWith("../")||u.startsWith("#"),f=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(u);if(!l&&!f)throw new pe(t,"CSS URLs must be local paths or base64 raster images")}}function re(e,t,n,i=!1,a=0){try{return wc(e,t,n,i,a)}catch(u){if(u instanceof pe)u.locate(e,t);throw u}}function wc(e,t,n,i,a){let u=$r(e,t,i),l=X(n);if(!u)return l;if(u.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(n))throw new pe("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return n}if(u.kind==="tag"){let v=e.slice(t+a).trimStart(),A=n.trim();if(!v.startsWith("=")&&(A===""||A.split(/\s+/).every((D)=>/^(?!on)[A-Za-z_:][\w:.-]*$/.test(D))))return A;throw new pe("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let f=u.name.toLowerCase();if(/^on[a-z]/.test(f))throw new pe(u.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(f==="srcdoc")l=X(l);if(f==="style")_c(n,u.name);if(u.quote===null)l=bc(l);let x=Is(f);if(x&&u.valuePrefix.trim()===""&&Xn(n,x))return Oi+l;return Mi(Di(e,t),n,l)}function En(e,t){let n=` ${e}="`;return re(n,n.length,t,!0)}function Ki(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 Te(e,t){let{scripts:n}=ee(e);for(let i of Ki(n)){if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(i)||ul.test(i))return!0;if(Fr(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 Ng(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(),u=new Set(te(i[3]));if(u.size===0)continue;let l=i.index+i[0].length;if(i[0].endsWith("/>")){t.push({start:i.index,end:l,names:u});continue}let f=new RegExp(`<(/?)${a}\\b[^>]*?(/?)>`,"gi");f.lastIndex=l;let x=1,v=e.length;for(let A=f.exec(e);A;A=f.exec(e)){if(A[2]==="/")continue;if(x+=A[1]==="/"?-1:1,x===0){v=A.index+A[0].length;break}}t.push({start:i.index,end:v,names:u})}return t}function Bi(e,t,n){let i=r(n);for(let a of e){if(t<a.start||t>=a.end)continue;for(let u of a.names)if(new RegExp(`(?<![.#\\w$])${u.replace(/\$/g,"\\$")}(?![\\w$])`).test(i))return!0}return!1}function Wi(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="",u=!1,l=0;for(let v=0;v<i.length;v++){let A=i[v];if(!u&&A==="`"){u=!0,l=0;continue}if(u){if(A==="`"&&l===0){u=!1;continue}if(A==="$"&&i[v+1]==="{"){l++,v++,a+=" ";continue}if(A==="}"&&l>0){l--;continue}if(l>0){a+=A;continue}continue}a+=A}i=a;let f=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,x;while((x=f.exec(i))!==null){let v=x[1];if(!i.substring(0,x.index).trimEnd().endsWith(".")){if(!n.includes(v)&&!(v in t))return!1}}return!0}function Sc(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 $c(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 Vi=new Set;function Ui(e){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(e.trim())}function vc(e,t,n){let i=n[0];if(i!=="'"&&i!=='"'&&i!=="`")return!1;let a=0;for(let u=e.lastIndexOf(`
|
|
217
|
-
`,t-1)+1;u<t;u++)if(e[u]==="\\")u++;else if(e[u]===i)a++;return a%2===1}function Hi(e,t){let n=`${t??"<unknown>"}\x00${e}`;if(process.env.STX_DEBUG||!Vi.has(n))Vi.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 Ri(e,t,n){let i=e;return i=i.replace(/\{!!([\s\S]*?)!!\}/g,(a,u)=>{try{let l=I(u,t);if(l===void 0)return Ui(u)?Hi(u.trim(),n):a;return l===null?"":String(l)}catch{return a}}),i=Cn(i,(a,u,l)=>{let f=u.trim();if(vc(i,l,u))return a;if(/^__[A-Z_]+__$/.test(f))return a;try{let x=I(u,t);if(x===void 0)return Ui(f)?Hi(f,n):a;return JSON.stringify(x).replace(/</g,"\\u003c").replace(/@/g,"\\u0040").replace(/\{{2,}/g,(v)=>"\\u007b".repeat(v.length)).replace(/\{(?=!)/g,"\\u007b")}catch{return a}}),i}function Dg(e,t){if(!e.includes("{"))return e;let n=e;return n=n.replace(/\{!!([\s\S]*?)!!\}/g,(i,a)=>{try{let u=I(a,t);if(u===void 0)return i;return u===null?"":String(u)}catch{return i}}),n=Cn(n,(i,a,u)=>{let l=a.trim();if(/^__[A-Z_]+__$/.test(l))return i;try{let f=I(a,t);if(f===void 0)return i;if(f===null)return"";let x=String(f);return re(n,u,x,!0,i.length)}catch(f){if(f instanceof pe)throw f;return i}}),n}function yy(e,t,n={}){let{output:i,scripts:a}=ee(e),u=a.map((l)=>{let f=l.match(/^<script\b((?:[^>\"']|\"[^\"]*\"|'[^']*')*)>/i),x=l.search(/<\/script\s*>$/i);if(!f||x===-1)return l;let v=f[1],A=l.slice(f[0].length,x);if(/\bdata-raw\b/.test(v))return l;if(n.skipServer&&/\bserver\b/.test(v))return l;let U=`<script${Dg(v,t)}>`;if(/\bsrc\s*=/.test(v)||/\btype\s*=\s*["']application\/json["']/.test(v))return U+A+l.slice(x);return U+Ri(A,t)+l.slice(x)});return Er(i,u)}function*Xi(e,t,n,i){let a=e,u=(V,F)=>{let q=bn(V,F);if(q===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(V.slice(F,q))?-1:q},l=(V,F,q,H)=>{let M=q.length,{output:Q,tokens:ie}=ye(V,F,(se,fe)=>H(M+fe));return q.push(...ie),Q},f=[];a=l(a,u,f,(V)=>`<!--__STX_STYLE_${V}__-->`);let x=[];a=l(a,J,x,(V)=>`<!--__STX_SCRIPT_EXPR_${V}__-->`);let v=t?.__stx_signals_gate===!0||Te(e),A=new Set([...Array.isArray(t?.__stx_client_signal_names)?t.__stx_client_signal_names:[],...Ti(Ki(x))]),D=new Set(Array.isArray(t?.__stx_preserved_client_expressions)?t.__stx_preserved_client_expressions:[]);a=Cn(a,(V,F,q)=>{if(j(F,A))return V;try{let H=I(F,t,!1,(M)=>Ps(M,V,n,e));return H!==void 0&&H!==null?String(H):""}catch(H){let M=H instanceof Error?H.message:String(H);return y("Expression",`Error evaluating: {{{ ${F.trim()}}}}: ${M}`,n,e,q,V)}},3),a=a.replace(/\{!!([\s\S]*?)!!\}/g,(V,F,q)=>{if(j(F,A))return V;try{let H=I(F,t,!1,(M)=>Ps(M,V,n,e));if(H===void 0&&t.__stx_buildMode==="compile")return Zn("raw",F.trim());return H!==void 0&&H!==null?String(H):""}catch(H){if(t.__stx_buildMode==="compile")return Zn("raw",F.trim());let M=H instanceof Error?H.message:String(H);return y("Expression",`Error evaluating: {!! ${F.trim()} !!}: ${M}`,n,e,q,V)}}),a=l(a,J,x,(V)=>`<!--__STX_SCRIPT_EXPR_${V}__-->`),a=l(a,u,f,(V)=>`<!--__STX_STYLE_${V}__-->`);let U=v?Ng(a):[],O=Yn(a).map((V)=>({...V,names:new Set(te(`${V.binding} in __slot`))})),z=new Set(ct(t));if(a=yield*Zi(a,(V,F,q)=>{let H=F.trim();if(xc(a,q,F))return V;if(Bi(O,q,H))return V;if(j(H,z))return V;if(U.length>0&&Bi(U,q,H))return V;if(D.has(H))return V;let M=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],Q=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,se=H.match(Q)?.[1],fe=se&&((se in t)||M.includes(se)),xe=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,ge=H.match(xe),Pe=ge&&!M.includes(ge[1])&&!(ge[1]in t);if(/^__[A-Z_]+__$/.test(H))return"";if(j(H,A))return V;if(t.__stx_native_screen===!0&&Sc(H,t))return V;let Ke;try{let Ae=I(F,t,!1,(et)=>{Ke=et});if(v&&!Wi(H,t))return V;if(Ke)Ps(Ke,V,n,e);if(t.__stx_buildMode==="compile"&&!v&&(Ae===void 0||$c(H,t)))return Zn("expr",H);if(Ae===void 0||Ae===null)return"";let
|
|
216
|
+
`}),ci(e,a)}function ci(e,t){if(t.length===0)return e;t.sort((u,l)=>u.start-l.start||u.end-l.end);let n=Array(t.length*2+1),i=0,a=0;for(let u of t)n[a++]=e.slice(i,u.start),n[a++]=u.replacement,i=u.end;return n[a]=e.slice(i),n.join("")}function li(e){let t=qn(e),n=new Map;if(t)for(let[i,a]of t)n.set(i,a.instances);return n}function ui(e,t){let n=qn(e);if(!n)return[];let i=[];for(let[a,u]of n){let l=u.instances-(t.get(a)??0);if(l>0)i.push({body:u.body,count:l})}return i}function pi(e,t){for(let{body:n,count:i}of t)for(let a=0;a<i;a++)Ts(e,n)}function Ce(e,t,n=2){let i=0,a=null;for(let u=t+n;u<e.length;u++){let l=e[u];if(a){if(l==="\\"){u++;continue}if(l===a)a=null;continue}if(l==='"'||l==="'"||l==="`"){a=l;continue}if(l==="{"){i++;continue}if(l==="}"){if(i>0){i--;continue}let f=0;while(e[u+f]==="}")f++;if(f>=n)return u}}return-1}import Li from"fs";var di=0,As=new Map;function pl(){di=0,As.clear()}function Zn(e,t){let n=di++,i=`<!--__STX_${e.toUpperCase()}_${n}__-->`;return As.set(i,{type:e,expression:t}),i}function fl(){let e={};for(let[t,n]of As)e[t]={type:n.type,expression:n.expression};return e}function gl(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 rc=/@(?=[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 ic(e){return Array.from({length:e},()=>"{").join("⁠")}function Pi(e){return e.replace(/\{{2,}/g,(t)=>ic(t.length)).replace(/\{(?=!)/g,"{⁠").replace(rc,"@")}function $r(e,t,n=!1){let{openTag:i,tail:a}=n?oc(e,t):ac(e).at(t);return lc(a,i,n)}function oc(e,t){let n="",i=0;for(let l=0;l<t;l++){if(!e.startsWith("{{",l))continue;let f=Ce(e,l);if(f<0||f+2>t)break;n+=e.slice(i,l)+"x",l=f+1,i=f+2}n+=e.slice(i,t);let a=-1,u=null;for(let l=0;l<n.length;l++){let f=n[l];if(u){if(f===u)u=null;continue}if(f==='"'||f==="'"){u=f;continue}if(f===">"){a=-1;continue}if(f==="<")a=l}return{openTag:a,tail:a>=0?n.slice(a+1):n}}var Kn=null;function ac(e){if(Kn&&Kn.source===e)return Kn.scanner;let t=cc(e);return Kn={source:e,scanner:t},t}function cc(e){let t=0,n=-1,i=null,a=-1,u=(f,x)=>{let v=e[f];if(x.quote){if(v===x.quote)x.quote=null;return}if(x.openTag>=0){if(v==='"'||v==="'"){x.quote=v;return}if(v===">"){x.openTag=-1;return}}if(v==="<")x.openTag=f},l=(f,x)=>{if(x.openTag>=0||!e.startsWith("<!--",f))return-1;let v=e.indexOf("-->",f+4);return v<0?e.length:v+3};return{at(f){if(f<t)t=0,n=-1,i=null,a=-1;let x={openTag:n,quote:i},v=!1;while(t<f){if(a<0&&e.startsWith("{{",t)){let V=Ce(e,t);if(V<0)a=t;else if(V+2<=f){t=V+2;continue}else break}let z=l(t,x);if(z>=0){if(z>f){v=!0;break}t=z;continue}u(t,x),t++}if(n=x.openTag,i=x.quote,v)return{openTag:-1,tail:""};let A=a>=0?a:t,D={openTag:n,quote:i};for(let z=t;z<f;z++){let V=l(z,D);if(V>=0){if(V>f)return{openTag:-1,tail:""};z=V-1;continue}u(z,D)}if(D.openTag<0)return{openTag:-1,tail:""};let U="",O=D.openTag+1;for(let z=O;z<Math.min(f,A);z++){if(!e.startsWith("{{",z))continue;let V=Ce(e,z);U+=e.slice(O,z)+"x",z=V+1,O=V+2}return U+=e.slice(O,f),{openTag:D.openTag,tail:U}}}}function lc(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 u=e.slice(a,i);if(!u)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 l=e[i];if(l==='"'||l==="'"){let f=++i,x=e.indexOf(l,i);if(x===-1)return{kind:"attribute",name:u,quote:l,valuePrefix:e.slice(f)};i=x+1}else{let f=i;while(i<e.length&&!/\s/.test(e[i]))i++;if(i===e.length)return{kind:"attribute",name:u,quote:null,valuePrefix:e.slice(f)}}}return{kind:"tag"}}class pe 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 Oi="unsafe:";var uc=/^(?:javascript|vbscript|livescript|mocha|view-source):/,fc=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,pc=/^data:(?:text\/html|application\/xhtml\+xml)/,dc=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function gc(e){return e.replace(dc,"").toLowerCase()}function Is(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 Xn(e,t="navigable"){let n=gc(e);if(uc.test(n))return!0;return t==="navigable"?fc.test(n):pc.test(n)}function Tr(e,t="navigable"){return Xn(e,t)?"unsafe:"+e:e}function mc(e){let t=e.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!t)return null;if(t[3].trim()!=="")return null;return Is(t[1])}function Di(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 Mi(e,t,n=t){let i=mc(e);return i&&Xn(t,i)?"unsafe:"+n:n}function jt(e){let t=e.indexOf(" as ");if(t!==-1){let u=e.slice(0,t).trim(),l=e.slice(t+4).trim();return u&&l?{arrayExpr:u,itemVar:l}: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 Jn(e){let t=[],n=0,i="",a=0;for(let u=0;u<e.length;u++){let l=e[u];if(i){if(l==="\\")u++;else if(l===i)i="";continue}if(l==="'"||l==='"'||l==="`")i=l;else if(l==="("||l==="["||l==="{")n++;else if(l===")"||l==="]"||l==="}")n--;else if(l===","&&n===0)t.push(e.slice(a,u)),a=u+1}return t.push(e.slice(a)),t}function ji(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 Ni(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 kt(e,t){let n=e.trim().replace(/^\.\.\./,"").trim(),i=ji(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 Jn(n.slice(1,-1))){let u=a.trim();if(!u)continue;if(u.startsWith("...")){kt(u,t);continue}let l=ji(u,":");kt(l===-1?u:u.slice(l+1),t)}return}if(n.startsWith("[")&&n.endsWith("]")){for(let a of Jn(n.slice(1,-1)))kt(a,t);return}if(/^[A-Z_$][\w$]*$/i.test(n))t.push(n)}function te(e){let t=e.trim(),n=[],i=0;for(let u=0;u<t.length;u++){let l=t[u];if(l==="("||l==="["||l==="{")i++;else if(l===")"||l==="]"||l==="}")i--;else if(i===0&&/\s/.test(l)){if(!/^\s+(?:in|of)\s/.exec(t.slice(u)))continue;let x=t.slice(0,u).trim();if(x.startsWith("(")&&Ni(x)===x.length-1)x=x.slice(1,-1);for(let v of Jn(x))kt(v,n);if(n.length>0)return n;break}}let a=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(t);if(a){let u=a[1].trim();if(u.startsWith("(")&&Ni(u)===u.length-1)u=u.slice(1,-1);let l=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(u);if(l)kt(l[2],n),kt(l[1],n);else for(let f of Jn(u))kt(f,n)}return n}function j(e,t){let n=t instanceof Set?t:new Set(t);if(n.size===0)return!1;let l=e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g," ").replace(/`(?:[^`\\$]|\\.|\$(?!\{))*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:(?!:))/g,"$1$2");for(let f of l.match(/[a-zA-Z_$][\w$]*/g)||[])if(n.has(f))return!0;return!1}var Gn="__stx_client_loop_names";function ct(e){let t=e?.[Gn];return Array.isArray(t)?t:[]}function Yn(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 u=a[0];if(/^<\/template\s*>$/i.test(u)){let l=n.pop();if(l)l.end=a.index}else if(/^<template\b/i.test(u)&&!/\/\s*>$/.test(u)){let f=[...u.slice(9).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)].find((A)=>/^(?:#[\w-]+|v-slot:[\w-]+|data-stx-slot-binding)$/i.test(A[1])),x=(f?.[2]??f?.[3])?.trim();if(x&&f?.[1]==="data-stx-slot-binding")try{x=decodeURIComponent(x)}catch{x=void 0}let v=x?{start:a.index+u.length,end:e.length,binding:x}:void 0;if(n.push(v),v)t.push(v)}}return t}var on={},zi=new Map;function hc(e){let t=zi.get(e);if(!t){let n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=new RegExp(`:${n}(?!\\w)`,"g"),zi.set(e,t)}return t.lastIndex=0,t}var Ys={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 G(String(e))},translate:(e,t,n={})=>{if(!t||!t.__translations)return e;let i=t.__translations,a=t.__i18nConfig?.fallbackToKey??!0,u=String(e).split("."),l=i;for(let x of u){if(l===void 0||l===null)break;l=l[x]}if(l===void 0||l===null)return a?e:"";let f=String(l);return Object.entries(n).forEach(([x,v])=>{f=f.replace(hc(x),()=>String(v))}),f},t:(e,t,n={})=>Ys.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 u={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,u[n]||u.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 u=i||`${n}s`;return a===1?n:u},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 Ig(e,t){if(e in Ys)console.warn(`Filter "${e}" already exists as a built-in filter. Custom filter will take precedence.`);on[e]=t}function my(e){for(let[t,n]of Object.entries(e))Ig(t,n)}function Og(){return{...Ys,...on}}function hy(){for(let e of Object.keys(on))delete on[e]}function qi(e){let t=e.next();while(!t.done)t=e.next();return t.value}function*Zi(e,t,n,i){let a="{".repeat(n);if(!e.includes(a))return e;let u="",l=0,f=0,x=i===Number.POSITIVE_INFINITY?0:performance.now();for(;;){let v=e.indexOf(a,l);if(v===-1)break;let A=Ce(e,v,n);if(A===-1)break;if(u+=e.slice(l,v)+t(e.slice(v,A+n),e.slice(v+n,A),v),l=A+n,++f>=64){f=0;let D=performance.now();if(D-x>=i)x=D,yield}}return l===0?e:u+e.slice(l)}function Cn(e,t,n=2){return qi(Zi(e,t,n,Number.POSITIVE_INFINITY))}function xc(e,t,n){let i=n[0];if(i!=="'"&&i!=='"'&&i!=="`")return!1;let a=$r(e,t);if(!a||a.kind!=="attribute"||a.quote===i)return!1;if(!/^(?::|@|x-|v-)/.test(a.name))return!1;let u=0;for(let l=0;l<a.valuePrefix.length;l++)if(a.valuePrefix[l]==="\\")l++;else if(a.valuePrefix[l]===i)u++;return u%2===1}function g(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function G(e){return Pi(g(e))}function bc(e){return e.replace(/ /g," ").replace(/\t/g,"	").replace(/\n/g," ").replace(/\r/g," ").replace(/\f/g,"").replace(/=/g,"=").replace(/`/g,"`")}function yc(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 _c(e,t){let n=yc(e);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(n))throw new pe(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 u=a[1].replace(/^["']|["']$/g,""),l=u.startsWith("/")&&!u.startsWith("//")||u.startsWith("./")||u.startsWith("../")||u.startsWith("#"),f=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(u);if(!l&&!f)throw new pe(t,"CSS URLs must be local paths or base64 raster images")}}function re(e,t,n,i=!1,a=0){try{return wc(e,t,n,i,a)}catch(u){if(u instanceof pe)u.locate(e,t);throw u}}function wc(e,t,n,i,a){let u=$r(e,t,i),l=G(n);if(!u)return l;if(u.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(n))throw new pe("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return n}if(u.kind==="tag"){let v=e.slice(t+a).trimStart(),A=n.trim();if(!v.startsWith("=")&&(A===""||A.split(/\s+/).every((D)=>/^(?!on)[A-Za-z_:][\w:.-]*$/.test(D))))return A;throw new pe("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let f=u.name.toLowerCase();if(/^on[a-z]/.test(f))throw new pe(u.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(f==="srcdoc")l=G(l);if(f==="style")_c(n,u.name);if(u.quote===null)l=bc(l);let x=Is(f);if(x&&u.valuePrefix.trim()===""&&Xn(n,x))return Oi+l;return Mi(Di(e,t),n,l)}function En(e,t){let n=` ${e}="`;return re(n,n.length,t,!0)}function Ki(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 Te(e,t){let{scripts:n}=ee(e);for(let i of Ki(n)){if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(i)||ul.test(i))return!0;if(Fr(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 Ng(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(),u=new Set(te(i[3]));if(u.size===0)continue;let l=i.index+i[0].length;if(i[0].endsWith("/>")){t.push({start:i.index,end:l,names:u});continue}let f=new RegExp(`<(/?)${a}\\b[^>]*?(/?)>`,"gi");f.lastIndex=l;let x=1,v=e.length;for(let A=f.exec(e);A;A=f.exec(e)){if(A[2]==="/")continue;if(x+=A[1]==="/"?-1:1,x===0){v=A.index+A[0].length;break}}t.push({start:i.index,end:v,names:u})}return t}function Bi(e,t,n){let i=r(n);for(let a of e){if(t<a.start||t>=a.end)continue;for(let u of a.names)if(new RegExp(`(?<![.#\\w$])${u.replace(/\$/g,"\\$")}(?![\\w$])`).test(i))return!0}return!1}function Wi(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="",u=!1,l=0;for(let v=0;v<i.length;v++){let A=i[v];if(!u&&A==="`"){u=!0,l=0;continue}if(u){if(A==="`"&&l===0){u=!1;continue}if(A==="$"&&i[v+1]==="{"){l++,v++,a+=" ";continue}if(A==="}"&&l>0){l--;continue}if(l>0){a+=A;continue}continue}a+=A}i=a;let f=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,x;while((x=f.exec(i))!==null){let v=x[1];if(!i.substring(0,x.index).trimEnd().endsWith(".")){if(!n.includes(v)&&!(v in t))return!1}}return!0}function Sc(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 $c(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 Vi=new Set;function Ui(e){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(e.trim())}function vc(e,t,n){let i=n[0];if(i!=="'"&&i!=='"'&&i!=="`")return!1;let a=0;for(let u=e.lastIndexOf(`
|
|
217
|
+
`,t-1)+1;u<t;u++)if(e[u]==="\\")u++;else if(e[u]===i)a++;return a%2===1}function Hi(e,t){let n=`${t??"<unknown>"}\x00${e}`;if(process.env.STX_DEBUG||!Vi.has(n))Vi.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 Ri(e,t,n){let i=e;return i=i.replace(/\{!!([\s\S]*?)!!\}/g,(a,u)=>{try{let l=I(u,t);if(l===void 0)return Ui(u)?Hi(u.trim(),n):a;return l===null?"":String(l)}catch{return a}}),i=Cn(i,(a,u,l)=>{let f=u.trim();if(vc(i,l,u))return a;if(/^__[A-Z_]+__$/.test(f))return a;try{let x=I(u,t);if(x===void 0)return Ui(f)?Hi(f,n):a;return JSON.stringify(x).replace(/</g,"\\u003c").replace(/@/g,"\\u0040").replace(/\{{2,}/g,(v)=>"\\u007b".repeat(v.length)).replace(/\{(?=!)/g,"\\u007b")}catch{return a}}),i}function Dg(e,t){if(!e.includes("{"))return e;let n=e;return n=n.replace(/\{!!([\s\S]*?)!!\}/g,(i,a)=>{try{let u=I(a,t);if(u===void 0)return i;return u===null?"":String(u)}catch{return i}}),n=Cn(n,(i,a,u)=>{let l=a.trim();if(/^__[A-Z_]+__$/.test(l))return i;try{let f=I(a,t);if(f===void 0)return i;if(f===null)return"";let x=String(f);return re(n,u,x,!0,i.length)}catch(f){if(f instanceof pe)throw f;return i}}),n}function yy(e,t,n={}){let{output:i,scripts:a}=ee(e),u=a.map((l)=>{let f=l.match(/^<script\b((?:[^>\"']|\"[^\"]*\"|'[^']*')*)>/i),x=l.search(/<\/script\s*>$/i);if(!f||x===-1)return l;let v=f[1],A=l.slice(f[0].length,x);if(/\bdata-raw\b/.test(v))return l;if(n.skipServer&&/\bserver\b/.test(v))return l;let U=`<script${Dg(v,t)}>`;if(/\bsrc\s*=/.test(v)||/\btype\s*=\s*["']application\/json["']/.test(v))return U+A+l.slice(x);return U+Ri(A,t)+l.slice(x)});return Er(i,u)}function*Xi(e,t,n,i){let a=e,u=(V,F)=>{let q=bn(V,F);if(q===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(V.slice(F,q))?-1:q},l=(V,F,q,H)=>{let M=q.length,{output:Q,tokens:ie}=ye(V,F,(se,fe)=>H(M+fe));return q.push(...ie),Q},f=[];a=l(a,u,f,(V)=>`<!--__STX_STYLE_${V}__-->`);let x=[];a=l(a,J,x,(V)=>`<!--__STX_SCRIPT_EXPR_${V}__-->`);let v=t?.__stx_signals_gate===!0||Te(e),A=new Set([...Array.isArray(t?.__stx_client_signal_names)?t.__stx_client_signal_names:[],...Ti(Ki(x))]),D=new Set(Array.isArray(t?.__stx_preserved_client_expressions)?t.__stx_preserved_client_expressions:[]);a=Cn(a,(V,F,q)=>{if(j(F,A))return V;try{let H=I(F,t,!1,(M)=>Ps(M,V,n,e));return H!==void 0&&H!==null?String(H):""}catch(H){let M=H instanceof Error?H.message:String(H);return y("Expression",`Error evaluating: {{{ ${F.trim()}}}}: ${M}`,n,e,q,V)}},3),a=a.replace(/\{!!([\s\S]*?)!!\}/g,(V,F,q)=>{if(j(F,A))return V;try{let H=I(F,t,!1,(M)=>Ps(M,V,n,e));if(H===void 0&&t.__stx_buildMode==="compile")return Zn("raw",F.trim());return H!==void 0&&H!==null?String(H):""}catch(H){if(t.__stx_buildMode==="compile")return Zn("raw",F.trim());let M=H instanceof Error?H.message:String(H);return y("Expression",`Error evaluating: {!! ${F.trim()} !!}: ${M}`,n,e,q,V)}}),a=l(a,J,x,(V)=>`<!--__STX_SCRIPT_EXPR_${V}__-->`),a=l(a,u,f,(V)=>`<!--__STX_STYLE_${V}__-->`);let U=v?Ng(a):[],O=Yn(a).map((V)=>({...V,names:new Set(te(`${V.binding} in __slot`))})),z=new Set(ct(t));if(a=yield*Zi(a,(V,F,q)=>{let H=F.trim();if(xc(a,q,F))return V;if(Bi(O,q,H))return V;if(j(H,z))return V;if(U.length>0&&Bi(U,q,H))return V;if(D.has(H))return V;let M=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],Q=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,se=H.match(Q)?.[1],fe=se&&((se in t)||M.includes(se)),xe=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,ge=H.match(xe),Pe=ge&&!M.includes(ge[1])&&!(ge[1]in t);if(/^__[A-Z_]+__$/.test(H))return"";if(j(H,A))return V;if(t.__stx_native_screen===!0&&Sc(H,t))return V;let Ke;try{let Ae=I(F,t,!1,(et)=>{Ke=et});if(v&&!Wi(H,t))return V;if(Ke)Ps(Ke,V,n,e);if(t.__stx_buildMode==="compile"&&!v&&(Ae===void 0||$c(H,t)))return Zn("expr",H);if(Ae===void 0||Ae===null)return"";let Je=String(Ae);return re(a,q,Je,!1,V.length)}catch(Ae){if(Ae instanceof pe)throw Ae;if(v&&!Wi(H,t))return V;if(Pe)return V;let Je=Ae instanceof Error?Ae.message:String(Ae);return y("Expression",`Error evaluating: {{ ${H} }}: ${Je}`,n,e,q,V)}},2,i),x.length>0)a=a.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(V,F)=>x[Number(F)]??V);if(f.length>0)a=a.replace(/<!--__STX_STYLE_(\d+)__-->/g,(V,F)=>f[Number(F)]??V);return a}function R(e,t,n){return qi(Xi(e,t,n,Number.POSITIVE_INFINITY))}var Ec=100;async function Ai(e,t,n,i=Ec){let a=Xi(e,t,n,i),u=a.next();while(!u.done)await E(),u=a.next();return u.value}function Mg(e,t,n){if(!t.trim())return e;let i=e,a=t.trim();while(a.length>0){let u=a.match(/^(\w+)/);if(!u)break;let l=u[1];a=a.substring(l.length).trim();let f=on[l]||Ys[l];if(!f)throw Error(`Filter not found: ${l}. Available filters: ${Object.keys(Og()).join(", ")}`);let x=[];if(a.startsWith(":")){let v=a.match(/^:([^|\s]+)/);if(v){let A=v[1].trim();try{let D=Number(A);x=[Number.isNaN(D)?A:D]}catch{x=[A]}a=a.substring(v[0].length).trim()}}else if(a.startsWith("(")){let v=1,A=1;while(v>0&&A<a.length){if(a[A]==="(")v++;if(a[A]===")")v--;A++}if(v===0){let D=a.substring(1,A-1).trim();if(D)try{if(D.startsWith("{")&&D.endsWith("}"))x=[I(`(${D})`,n,!0)];else{let U=[],O="",z=null,V=0,F=0,q=0,H=!1;for(let M=0;M<D.length;M++){let Q=D[M];if(H){O+=Q,H=!1;continue}if(Q==="\\"){O+=Q,H=!0;continue}if(z){if(O+=Q,Q===z)z=null;continue}if(Q==='"'||Q==="'"||Q==="`"){z=Q,O+=Q;continue}if(Q==="(")V++;else if(Q===")")V--;else if(Q==="[")F++;else if(Q==="]")F--;else if(Q==="{")q++;else if(Q==="}")q--;if(Q===","&&V===0&&F===0&&q===0){U.push(O),O="";continue}O+=Q}if(O)U.push(O);x=U.map((M)=>{let Q=M.trim();return I(Q,n,!0)})}}catch{x=[D]}a=a.substring(A).trim()}}try{i=f(i,n,...x)}catch(v){let A=v instanceof Error?v.message:String(v);throw Error(`Error applying filter '${l}': ${A}`)}if(a.startsWith("|"))a=a.substring(1).trim();else break}return i}function kc(e){let t=!1,n="",i=0,a=0,u=0,l=!1;for(let f=0;f<e.length;f++){let x=e[f],v=e[f+1];if(t&&l){l=!1;continue}if(t&&x==="\\"){l=!0;continue}if(l=!1,(x==='"'||x==="'"||x==="`")&&!l){if(!t)t=!0,n=x;else if(x===n)t=!1,n="";continue}if(t&&n==="`"&&x==="$"&&v==="{"){let A=1;f+=2;while(f<e.length&&A>0){if(e[f]==="{")A++;else if(e[f]==="}")A--;if(A>0)f++}continue}if(t)continue;if(x==="(")i++;else if(x===")")i--;else if(x==="[")a++;else if(x==="]")a--;else if(x==="{")u++;else if(x==="}")u--;if(x==="|"&&i===0&&a===0&&u===0){if(v==="|"){f++;continue}if(v==="="){f++;continue}return f}}return-1}var rn=new Set,Cc=1000;function by(){rn.clear()}function Ps(e,t,n,i){if(!Z())return;let a=`${n}\x00${e.expression}`;if(rn.has(a))return;if(rn.size>=Cc)rn.clear();rn.add(a);let u=n,l=i;try{if(n&&Li.existsSync(n))l=Li.readFileSync(n,"utf8")}catch{}let f=l.indexOf(t);if(f>=0)u=`${n}:${l.slice(0,f).split(`
|
|
218
218
|
`).length}`;console.warn(`${u}: 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 I(e,t,n=!1,i){try{let a=e.trim(),u=kc(a);if(u>0){let f=a.substring(0,u).trim(),x=a.substring(u+1).trim(),v=I(f,t,!0,i);return Mg(v,x,t)}let l=Qs(a);if(l!==null){i?.({expression:a,rule:l});return}try{let f=Object.keys(t),x=Object.values(t);return p(a,f)(...x)}catch{return d(a,t)}}catch(a){if(a instanceof ReferenceError){let u=/(\b\w+)\s+is not defined/.exec(a.message);if(u){let l=u[1],f=Rc(l,Object.keys(t));if(f&&f!==l)a.message=`${a.message} \u2014 did you mean '${f}'?`}}if(!n)console.error(`Error evaluating expression: ${e}`,a);throw a}}function Rc(e,t){let n=null;for(let a of t){if(a===e)continue;let u=Tc(e,a);if(n===null||u<n.dist)n={key:a,dist:u}}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 Tc(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),u=Array(n.length+1);for(let l=0;l<=n.length;l++)a[l]=l;for(let l=1;l<=i.length;l++){u[0]=l;for(let f=1;f<=n.length;f++){let x=n[f-1]===i[l-1]?0:1;u[f]=Math.min(u[f-1]+1,a[f]+1,a[f-1]+x)}for(let f=0;f<=n.length;f++)a[f]=u[f]}return a[n.length]}function wy(e){if(!e)return"";return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}import Ac from"process";function T(e="STX_PUBLIC_"){let t={},n={};for(let[i,a]of Object.entries(Ac.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 Ji(e,t=""){let n=`${e}${t}`,i=0;for(let a=0;a<n.length;a++){let u=n.charCodeAt(a);i=(i<<5)-i+u,i=i&i}return`stx-${Math.abs(i).toString(36)}`}function Gi(e,t,n={}){let{prefix:i="",preserveHost:a=!0,scopeKeyframes:u=!0,scopeCustomProperties:l=!1}=n;if(!e.trim())return"";let f=Os(e),x=[],v=new Map;if(u)for(let A of f){let D=A.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(D){let U=D[1],O=`${t}_${U}`;v.set(U,O)}}for(let A of f){let D=Yi(A,t,i,a,v,l);x.push(D)}return x.join(`
|
|
219
219
|
|
|
220
220
|
`)}function Os(e){let t=[],n=e.replace(/\/\*[\s\S]*?\*\//g,""),i=0,a="",u=!1,l="";for(let f=0;f<n.length;f++){let x=n[f];if(x==="@"&&i===0)u=!0;if(x==="{")i++;else if(x==="}"){if(i--,i===0){if(u){l+=x;let v=l.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(v){let[,A,D,U]=v;if(A==="keyframes")t.push({selector:`@keyframes ${D.trim()}`,declarations:U.trim()});else if(A==="media"||A==="supports"||A==="container"){let O=Os(U);t.push({selector:`@${A} ${D.trim()}`,declarations:O.map((z)=>`${z.selector} { ${z.declarations} }`).join(`
|
|
@@ -505,7 +505,7 @@ window.__stx_reactive = (function() {
|
|
|
505
505
|
${wl()}
|
|
506
506
|
${i}
|
|
507
507
|
</script>`}function Qc(e,t,n,i=!1){if(!Ns(e))return e;let a=hl(e);if(a.length===0)return e;let u=$l(e,a),l=Sl(a,t,i),f=c(u);if(f!==-1)u=u.slice(0,f)+l+`
|
|
508
|
-
`+u.slice(f);else u+=l;return u}function $l(e,t){let n=[],i=0;for(let[u,l]of oo(e).entries()){let f=t[u];if(!f)break;n.push(e.slice(i,l.startIndex));let x=Qn(l.attributes,"data-stx-scope");if(x)f.id=x,f.selector=`[data-stx-scope="${f.id}"]`,n.push(l.fullMatch);else n.push(`<${l.tagName} data-stx-scope="${f.id}"${l.attributes}>`);i=l.endIndex}n.push(e.slice(i));let a=n.join("");return a=a.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),a=a.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),a=a.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),a=a.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),a=a.replace(/\s*x-destroy\s*=\s*"([^"]*)"/g,' data-stx-xdestroy="$1"'),a=a.replace(/\s*x-destroy\s*=\s*'([^']*)'/g," data-stx-xdestroy='$1'"),a}function Ns(e){return/x-data\s*=\s*["']/.test(e)}function
|
|
508
|
+
`+u.slice(f);else u+=l;return u}function $l(e,t){let n=[],i=0;for(let[u,l]of oo(e).entries()){let f=t[u];if(!f)break;n.push(e.slice(i,l.startIndex));let x=Qn(l.attributes,"data-stx-scope");if(x)f.id=x,f.selector=`[data-stx-scope="${f.id}"]`,n.push(l.fullMatch);else n.push(`<${l.tagName} data-stx-scope="${f.id}"${l.attributes}>`);i=l.endIndex}n.push(e.slice(i));let a=n.join("");return a=a.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),a=a.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),a=a.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),a=a.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),a=a.replace(/\s*x-destroy\s*=\s*"([^"]*)"/g,' data-stx-xdestroy="$1"'),a=a.replace(/\s*x-destroy\s*=\s*'([^']*)'/g," data-stx-xdestroy='$1'"),a}function Ns(e){return/x-data\s*=\s*["']/.test(e)}function Xs(e,t){let n=e,i=/@json\s*\(/g,a;while((a=i.exec(n))!==null){let u=a.index,l=u+a[0].length-1,f=1,x=l+1,v=null,A=!1;while(x<n.length&&f>0){let M=n[x];if(A){A=!1,x++;continue}if(M==="\\"&&v){A=!0,x++;continue}if(v){if(M===v)v=null;x++;continue}if(M==='"'||M==="'"||M==="`"){v=M,x++;continue}if(M==="(")f++;else if(M===")"){if(f--,f===0)break}x++}if(f!==0)break;let D=n.substring(l+1,x).trim(),U=n.substring(u,x+1),O=-1,z=0,V=null,F=!1;for(let M=0;M<D.length;M++){let Q=D[M];if(F){F=!1;continue}if(Q==="\\"&&V){F=!0;continue}if(V){if(Q===V)V=null;continue}if(Q==='"'||Q==="'"||Q==="`"){V=Q;continue}if(Q==="("||Q==="["||Q==="{")z++;else if(Q===")"||Q==="]"||Q==="}")z--;if(Q===","&&z===0){O=M;break}}let q=O>=0?D.substring(0,O).trim():D,H=O>=0?D.substring(O+1).trim():void 0;try{let M=q.trim(),Q;if(m(M))Q=p(M,Object.keys(t))(...Object.values(t));else Q=void 0;let ie;if(H==="true")ie=JSON.stringify(Q,null,2);else ie=JSON.stringify(Q);let se=ie.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");n=n.substring(0,u)+se+n.substring(x+1),i.lastIndex=u+se.length}catch(M){W.log(M instanceof Error?M:Error(String(M)),{directive:"@json"},"error"),i.lastIndex=u+U.length}}return n}function Gs(e){return e.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function el(e){let t=e,n=/@memo\s*\(/g,i,a=[];while((i=n.exec(t))!==null){let u=i.index,l=u+i[0].length,f=1,x=l;while(x<t.length&&f>0){if(t[x]==="(")f++;else if(t[x]===")")f--;x++}if(f!==0)continue;let v=t.slice(l,x-1).trim(),A=x,D=t.slice(A),U=D.indexOf("@endmemo");if(U===-1)continue;let O=D.slice(0,U),z=A+U+8,V=Mt(O),F=O.slice(V),q=O.match(/(\s*)$/),H=q?q[0].length:0,M=F.slice(0,F.length-H),Q=M.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),ie;if(Q){let[se,fe,xe="",ge]=Q,Pe=`<${fe}${xe} data-stx-memo="${v}"${ge}>`;ie=O.slice(0,V)+Pe+M.slice(se.length)+O.slice(V+M.length)}else ie=`${O.slice(0,V)}<div data-stx-memo="${v}">${M}</div>${O.slice(V+M.length)}`;a.push({start:u,end:z,replacement:ie}),n.lastIndex=z}for(let u=a.length-1;u>=0;u--){let l=a[u];t=t.slice(0,l.start)+l.replacement+t.slice(l.end)}return t.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function ki(e){let t=e.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return t=t.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),t}function uo(e,t){let n=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,i=w(e,(f,x)=>{n.lastIndex=x;let v=n.exec(f);if(!v||/^(?:script|style)$/i.test(v[1]))return-1;return n.lastIndex}),a=[],u=0,l=[];for(let{start:f,end:x,token:v}of i){let A=/^<\/?([\w-]+)/.exec(v)[1].toLowerCase();if(v.startsWith("</")){while(a.length&&a.pop()!==A);continue}if(!a.length&&!/\sdata-stx-slot-owner\s*=/.test(v))l.push(e.slice(u,f),v.replace(/\s*\/?>$/,(D)=>` data-stx-slot-owner="${t}"${D}`)),u=x;if(!Ls.has(A)&&!/\/>$/.test(v))a.push(A)}return l.push(e.slice(u)),l.join("")}function fo(e,t){if(!/\bref\s*=/.test(e))return e;let n=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,i=w(e,(x,v)=>{n.lastIndex=v;let A=n.exec(x);if(!A||/^(?:script|style)$/i.test(A[1]))return-1;return n.lastIndex}),a=[],u=0,l=0,f=[];for(let{start:x,end:v,token:A}of i){let D=/^<\/?([\w-]+)/.exec(A)[1].toLowerCase();if(A.startsWith("</")){let V;while(V=a.pop()){if(V.scoped)u--;if(V.name===D)break}continue}let U=/\sdata-stx-scope\s*=/.test(A),O=/\sdata-stx-ref-caller\s*=\s*(["'])(.*?)\1/.exec(A),z=a.find((V)=>V.scoped)?.scopeId;if(O&&z&&O[2]===z)f.push(e.slice(l,x),A.replace(O[0],` data-stx-ref-caller="${t}"`)),l=v;else if(!u&&!U&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(A)&&!/\sdata-stx-ref-caller\s*=/.test(A))f.push(e.slice(l,x),A.replace(/\s*\/?>$/,(V)=>` data-stx-ref-caller="${t}"${V}`)),l=v;if(!Ls.has(D)&&!/\/>$/.test(A)){let V=/\sdata-stx-scope\s*=\s*(?:"([^"]*)"|'([^']*)')/.exec(A);if(a.push({name:D,scoped:U,scopeId:V?.[1]??V?.[2]}),U)u++}}return f.push(e.slice(l)),f.join("")}var Ls=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),po=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,ao=/<\/?\s*([a-z][\w-]*)/iy,vl=/\s/;function El(e,t){let n=t-1;while(n>=0&&vl.test(e[n]))n--;return n>=0&&e[n]==="/"}function kl(e,t){let n=!1,i=!1;for(let a=t;a<e.length;a++){let u=e[a];if(n){if(u==="'")n=!1}else if(i){if(u==='"')i=!1}else if(u==="'")n=!0;else if(u==='"')i=!0;else if(u===">")return a}return-1}function Rl(e,t){if(e.indexOf("{",t)===-1||e.indexOf("}",t)===-1)return!1;let n=0,i=t,a=!1,u=!1,l=!1;while(i<e.length){let f=e.indexOf("<",i),x=f===-1?e.length:f;if(x>i){if(n===0)while(i<x){let D=e.indexOf(u?"}":"{",i);if(D===-1||D>=x){if(u)l=!1;else a=!1;break}if(D>i)if(u)l=!1;else a=!1;if(u){if(l)return!0;l=!0}else if(a)u=!0,l=!1;else a=!0;i=D+1}i=x;continue}if(e.startsWith("<!--",i)){let D=e.indexOf("-->",i);i=D===-1?e.length:D+3;continue}let v=kl(e,i);if(v===-1)break;ao.lastIndex=i;let A=ao.exec(e)?.[1]?.toLowerCase()??"";if(e[i+1]==="/"){if(n===0)break;n--}else if(!El(e,v)&&!Ls.has(A))n++;i=v+1}return!1}var co=S(256);function tl(e){if(e.length<1024)return lo(e);let t=_(e),n=co.get(t);if(n!==void 0)return n;let i=lo(e);return co.set(t,i),i}function lo(e){if(e.length>=32768&&!ai(e))return e;let n=new RegExp(`<(${"div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i"})\\b`,"gi"),i="",a=0,u;while((u=n.exec(e))!==null){let l=u.index,f=l+u[0].length,x=!1,v=!1,A=-1;while(f<e.length){let U=e[f];if(x){if(U==="'")x=!1}else if(v){if(U==='"')v=!1}else if(U==="'")x=!0;else if(U==='"')v=!0;else if(U===">"){A=f;break}f++}if(A===-1)continue;let D=e.slice(l,A+1);if(po.test(D))continue;if(D.includes("x-cloak"))continue;if(Rl(e,A+1))i+=e.slice(a,A)+" x-cloak>",a=A+1}return i+=e.slice(a),i}var Tl=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,Al=/<\/script>/gi,Il=/<\/style>/gi;function nl(e){let t=/<[a-z][\w-]*/gi,n="",i=0,a;while((a=t.exec(e))!==null){let u=a.index,l=a[0].slice(1).toLowerCase();if(l==="script"||l==="style"){let z=l==="script"?Al:Il;z.lastIndex=u;let V=z.exec(e);if(V!==null)t.lastIndex=V.index+V[0].length;continue}let f=u+a[0].length,x=!1,v=!1,A=-1;while(f<e.length){let z=e[f];if(x){if(z==="'")x=!1}else if(v){if(z==='"')v=!1}else if(z==="'")x=!0;else if(z==='"')v=!0;else if(z===">"){A=f;break}f++}if(A===-1)continue;let D=e.slice(u+a[0].length,A);if(po.test(D))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(D))continue;if(!Tl.test(D))continue;let U=e[A-1]==="/",O=U?A-1:A;n+=`${e.slice(i,O)} x-cloak${U?" ":""}`,i=O}return n+=e.slice(i),n}import To from"path";import tr from"fs";import cn from"path";function go(e,t,n,i){let a=0;for(let u=t;u<e.length;u++)if(e[u]===n)a++;else if(e[u]===i&&!(i===">"&&e[u-1]==="=")){if(--a===0)return u}return-1}function Pl(e){let t=r(e),n=0,i=0,a=[];for(let u=0;u<t.length;u++)if("([{".includes(t[u]))n++;else if(")]}".includes(t[u]))n--;else if(t[u]===","&&n===0)a.push(e.slice(i,u).trim()),i=u+1;return a.push(e.slice(i).trim()),a}function er(e,t){let n=r(e),i=new RegExp(`\\b(?:${t.map((a)=>a.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let a of n.matchAll(i)){let u=a.index+a[0].length,l="";if(n[u]==="<"){let x=go(n,u,"<",">");if(x<0)continue;l=e.slice(u+1,x),u=x+1;while(/\s/.test(n[u]||"")&&u<n.length)u++}if(n[u]!=="(")continue;let f=go(n,u,"(",")");if(f>=0)return{type:l,args:Pl(e.slice(u+1,f))}}return null}var mo=`
|
|
509
509
|
type __StxCtor<T> = T extends StringConstructor ? string : T extends NumberConstructor ? number : T extends BooleanConstructor ? boolean : T extends ArrayConstructor ? unknown[] : T extends ObjectConstructor ? object : T extends readonly unknown[] ? __StxCtor<T[number]> : T extends abstract new (...args: any[]) => infer V ? V : unknown;
|
|
510
510
|
type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
|
|
511
511
|
type __StxOption<T> = T extends { type: infer C } ? __StxCtor<C> : T extends { default: infer D } ? D extends (...args: any[]) => infer V ? V : __StxWiden<D> : __StxCtor<T>;
|
|
@@ -526,7 +526,7 @@ ${v.join(`
|
|
|
526
526
|
`):"",checks:i,events:u,dependencies:l}}var bo=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function Dl(e){let t=(n)=>n.replace(/[^\n]/g," ");return e.replace(/<!--[\s\S]*?-->/g,t).replace(/\{\{--[\s\S]*?--\}\}/g,t)}function lt(e){let t=[],n=Dl(e);bo.lastIndex=0;let i;while((i=bo.exec(n))!==null){let a=(i[1]||"").trim(),u=(i[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,l=(i[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,f=i.index+u,x=i.index+i[0].length-l,v=e.slice(f,x);if(/\bsrc\s*=/.test(a))continue;let A=a.match(/\btype\s*=\s*["']([^"']+)["']/i);if(A&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(A[1]))continue;let D=/\bserver\b/.test(a)?"server":/\bclient\b/.test(a)?"client":"plain",U=ln(e,f);t.push({kind:D,code:v,startLine:U,startColumn:un(e,f),offset:f,attrs:a})}return t}function ln(e,t){let n=1;for(let i=0;i<t&&i<e.length;i++)if(e.charCodeAt(i)===10)n++;return n}function un(e,t){let n=e.lastIndexOf(`
|
|
527
527
|
`,t-1)+1;return t-n+1}function es(e){let t=e.split(""),n=(a,u)=>{for(let l=a;l<u&&l<t.length;l++)if(t[l]!==`
|
|
528
528
|
`)t[l]=" "},i=[/<script(?:\s[^>]*)?>[\s\S]*?<\/script>/gi,/<style(?:\s[^>]*)?>[\s\S]*?<\/style>/gi,/<!--[\s\S]*?-->/g,/\{\{--[\s\S]*?--\}\}/g,/@verbatim\b[\s\S]*?@endverbatim\b/g];for(let a of i){a.lastIndex=0;let u;while((u=a.exec(e))!==null)n(u.index,u.index+u[0].length)}return t.join("")}function Ao(e){let t=0,n="";for(let i=0;i<e.length;i++){let a=e[i];if(n){if(a==="\\"){i++;continue}if(a===n)n="";continue}if(a==='"'||a==="'"||a==="`"){n=a;continue}if(a==="("||a==="["||a==="{"){t++;continue}if(a===")"||a==="]"||a==="}"){t--;continue}if(a==="|"&&t===0){if(e[i+1]==="|"){i++;continue}if(e[i-1]==="|")continue;return e.slice(0,i)}}return e}var Io=new Set([":for","x-for","v-for"]),ts=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,nr="__stx_interpolated",yo="__StxElement",Po="__StxTemplateValue",Ml=`type ${Po}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function _o(e){return e.replace(/\{\{[\s\S]*?\}\}/g,nr).replace(/\{!![\s\S]*?!!\}/g,nr)}function jl(e,t,n){let i=0;for(let a=t;a<e.length;a++){let u=e[a];if(u==="{"){i++;continue}if(u!=="}"&&u!=="!")continue;if(e.startsWith(n,a)&&i===0)return a;if(u==="}"&&i>0)i--}return-1}function yi(e,t,n="0"){let i=`__stxScript${n}`;while((e+t).includes(i))i+="_";let a=new Map,u=[],l=[],f=r(e),x=zo(e),v=[],A=0;for(let F=0;F<f.length;F++){let q=f.startsWith("{{",F);if(!q&&!f.startsWith("{!!",F))continue;let H=q?2:3,M=q?"}}":"!!}",Q=jl(f,F+H,M);if(Q<0)continue;let ie=F,se=e.slice(ie,Q+M.length),fe=se.slice(H,-M.length);F=Q+M.length-1;let xe=l.length,ge=rr(x,ie),Pe=rr(x,ie+(q?2:3));l.push({code:Ao(fe),...Pe});let Ke=`${i}_${xe}`,Ae=se.split(`
|
|
529
|
-
`),
|
|
529
|
+
`),Je=Ae[0].length;Ae[0]=Ke+" ".repeat(Math.max(0,Je-Ke.length));for(let nt=1;nt<Ae.length;nt++)Ae[nt]=Ae[nt].replace(/[^\r]/g," ");let et=a.get(ge.line)??[],Ye=et.at(-1),it=ge.column+(Ye?Ye.generatedEnd-Ye.sourceEnd:0);et.push({sourceStart:ge.column,sourceEnd:ge.column+Je,generatedStart:it,generatedEnd:it+Ae[0].length}),a.set(ge.line,et),v.push(e.slice(A,ie),Ae.join(`
|
|
530
530
|
`)),A=ie+se.length}v.push(e.slice(A));let D=v.join("");if(!l.length)return{code:D,columns:a,declarations:u};let{imports:U,body:O}=Do(t),z=[],V=0;for(let F of U.split(/\n(?=import\b)/)){if(!F.trim())continue;let q=/^import\s+(?:type\s+)?([\s\S]+?)\s+from\s*(['"][^'"]+['"])/.exec(F);if(!q){u.push({text:F});continue}let H=`${i}Module${V++}`;u.push({text:`import * as ${H} from ${q[2]}`});let M=q[1],Q=/\{([\s\S]*?)\}/.exec(M);for(let xe of Q?.[1].split(",")??[]){let[ge,Pe=ge]=xe.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(ge==="default")z.push(`const ${Pe} = ${H}.default; type ${Pe} = import(${q[2]}).default`);else if(ge)z.push(`import ${Pe} = ${H}.${ge}`)}let ie=M.replace(/\{[\s\S]*?\}/,""),se=/\*\s+as\s+(\w+)/.exec(ie);if(se)z.push(`import ${se[1]} = ${H}`);let fe=/^\s*([\w$]+)/.exec(ie)?.[1];if(fe)z.push(`const ${fe} = ${H}.default; type ${fe} = import(${q[2]}).default`)}u.push({text:`namespace ${i}Scope {
|
|
531
531
|
${z.join(`
|
|
532
532
|
`)}
|
|
@@ -547,13 +547,13 @@ return {`});for(let[F,q]of l.entries())u.push({text:`value${F}: (`}),u.push({tex
|
|
|
547
547
|
`):"";let{imports:u,body:l}=Do(e),f=l.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),x=["",`// ${vo}`];if(u)x.push(u);return x.push(...a),x.push(`async function ${Eo}() {`,f,` return { ${n.join(", ")} }`,"}",`type ${ko} = Awaited<ReturnType<typeof ${Eo}>>`,...n.map((v)=>`declare var ${v}: ${ko}[${JSON.stringify(v)}]`)),x.join(`
|
|
548
548
|
`)}function wi(e){let t=r(e),n=t.split(""),i=[],a=0,u=0;for(let f=0;f<n.length;f++){let x=n[f];if(x===`
|
|
549
549
|
`)u=f+1;if(x==="{"||x==="("||x==="["){if(a===0&&x!=="("&&Hl.test(t.slice(u,f))){let v=jo(t,f);if(v!==-1)i.push(...No(t.slice(f,v+1)))}a++;continue}if(x==="}"||x===")"||x==="]"){a=Math.max(0,a-1);continue}if(a>0&&x!==`
|
|
550
|
-
`)n[f]=" "}let l=Fe(n.join(""));return i.length===0?l:[...new Set([...l,...i])].sort()}var Hl=/^\s*(?:export\s+)?(?:const|let|var)\s*$/;function jo(e,t){let n=0;for(let i=t;i<e.length;i++){let a=e[i];if(a==="{"||a==="("||a==="[")n++;else if(a==="}"||a===")"||a==="]")n--;if(n===0)return i}return-1}function ql(e){let t=[],n=0,i=0;for(let a=0;a<e.length;a++){let u=e[a];if(u==="{"||u==="("||u==="[")n++;else if(u==="}"||u===")"||u==="]")n--;else if(u===","&&n===0)t.push(e.slice(i,a)),i=a+1}return t.push(e.slice(i)),t}function $o(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--;else if(t===0&&(i===":"||i==="="))return{index:n,char:i}}return null}function No(e){let t=[],n=(a)=>{let u=a.trim().replace(/^\.\.\./,"").trim();if(u.startsWith("{")||u.startsWith("[")){let f=jo(u,0);if(f!==-1)t.push(...No(u.slice(0,f+1)));return}let l=$o(u);if(l)u=u.slice(0,l.index).trim();if(/^[A-Z_$][\w$]*$/i.test(u))t.push(u)},i=e.slice(1,-1);for(let a of ql(i)){if(!a.trim())continue;if(e[0]==="["){n(a);continue}let u=$o(a);n(u?.char===":"?a.slice(u.index+1):a)}return t}function
|
|
551
|
-
`))continue;let z=rr(i,f),V=n.get(z.line)??[],F=V.at(-1),q=z.column+(F?F.generatedEnd-F.sourceEnd:0);V.push({sourceStart:z.column,sourceEnd:z.column+x.length,generatedStart:q,generatedEnd:q+O.length}),n.set(z.line,V)}return a.push(e.slice(u)),{code:a.join(""),columns:n}}function Ql(e,t,n){let i=wo(e.importColumns?.get(t)??[],n);return wo(e.scriptColumns?.get(t)??[],i)}function vi(e){return" ".repeat(Math.max(0,(e.startColumn??1)-1))}function eu(e){let t=new Set,n=r(e);for(let i of n.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let a=i[1],u=/\{([^}]*)\}/.exec(a);for(let v of u?.[1].split(",")??[]){let A=v.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(A&&/^[A-Z_$][\w$]*$/i.test(A))t.add(A)}let l=a.replace(/\{[^}]*\}/,""),f=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(l);if(f)t.add(f[1]);let x=/^\s*([A-Z_$][\w$]*)/i.exec(l);if(x&&x[1]!=="type")t.add(x[1])}return[...t].sort()}function
|
|
550
|
+
`)n[f]=" "}let l=Fe(n.join(""));return i.length===0?l:[...new Set([...l,...i])].sort()}var Hl=/^\s*(?:export\s+)?(?:const|let|var)\s*$/;function jo(e,t){let n=0;for(let i=t;i<e.length;i++){let a=e[i];if(a==="{"||a==="("||a==="[")n++;else if(a==="}"||a===")"||a==="]")n--;if(n===0)return i}return-1}function ql(e){let t=[],n=0,i=0;for(let a=0;a<e.length;a++){let u=e[a];if(u==="{"||u==="("||u==="[")n++;else if(u==="}"||u===")"||u==="]")n--;else if(u===","&&n===0)t.push(e.slice(i,a)),i=a+1}return t.push(e.slice(i)),t}function $o(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--;else if(t===0&&(i===":"||i==="="))return{index:n,char:i}}return null}function No(e){let t=[],n=(a)=>{let u=a.trim().replace(/^\.\.\./,"").trim();if(u.startsWith("{")||u.startsWith("[")){let f=jo(u,0);if(f!==-1)t.push(...No(u.slice(0,f+1)));return}let l=$o(u);if(l)u=u.slice(0,l.index).trim();if(/^[A-Z_$][\w$]*$/i.test(u))t.push(u)},i=e.slice(1,-1);for(let a of ql(i)){if(!a.trim())continue;if(e[0]==="["){n(a);continue}let u=$o(a);n(u?.char===":"?a.slice(u.index+1):a)}return t}function Xc(e,t){if(Oo(e)!==null)return[];let n=wi(e),i=Le(t,new Set(n)),a=new Set(C);return n.filter((u)=>{if(a.has(u))return!1;if(Dt(t,u))return!1;return i.has(u)})}var vo="stx: types for the declared client payload (#1868)",Zl="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",Eo="__stxServerScope",ko="__StxClientPayload";var Co=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","$native","props","slot"];var Kl=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function Xl(e){let t=new Map,n=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let i of e){let a=r(i),{depths:u,balanced:l}=we(a);if(!l)continue;let f=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let x of a.matchAll(f)){let v=x.index??0;if(u[v+x[1].length]!==0)continue;let A=x[2],D=v+x[0].length-x[3].length,U=i.slice(D,v+x[0].length).trim().replace(/;$/,"").trim(),O=x[3],z=n.test(O)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(O)&&!/[,+\-*/%&|?:=]$/.test(U)&&we(O).balanced;t.set(A,t.has(A)||!z?null:U)}}return new Map([...t].filter((i)=>i[1]!==null))}function Lo(e,t,n=0,i=new Set){if(t.size===0||n>=5)return e;let a=r(e),u="",l=0;for(let f of a.matchAll(/[A-Za-z_$][\w$]*/g)){let x=f.index??0,v=f[0],A=t.get(v);if(!A||i.has(v))continue;let D=a.slice(0,x).trimEnd(),U=a.slice(x+v.length).trimStart();if(D.endsWith(".")||/^:(?!:)/.test(U)&&/[{,]$/.test(D))continue;if(x>0&&/[\w$]/.test(a[x-1]))continue;u+=`${e.slice(l,x)}(${Lo(A,t,n+1,new Set([...i,v]))})`,l=x+v.length}return u+e.slice(l)}function Jl(e,t){let n=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,i=[],a;while((a=n.exec(e))!==null){if(a.index>t)break;let u=a[1];if(a.index===t){if(u==="elseif"){let f=i[i.length-1];if(f?.current)f.seen.push(f.current);if(f)f.current=null}break}if(u==="endif"||u==="endunless"){i.pop();continue}let l="";if(a[2]==="("){let f=0,x=a.index+a[0].length-1,v=x+1;for(;x<e.length;x++){let A=e[x];if(A==="(")f++;else if(A===")"){if(f--,f===0)break}}l=e.slice(v,x).trim(),n.lastIndex=x+1}if(u==="if")i.push({seen:[],current:l});else if(u==="unless")i.push({seen:[],current:`!(${l})`});else if(u==="elseif"||u==="else"){let f=i[i.length-1];if(!f)continue;if(f.current)f.seen.push(f.current);f.current=u==="elseif"?l:null}}return i.flatMap((u)=>[...u.seen.map((l)=>`!(${l})`),...u.current?[u.current]:[]]).filter(Boolean)}function Gl(e){let t=e.code.trim();if(!t)return null;if(e.attribute?.startsWith("@")){if(Kl.test(t))return null;let i=";(($event: any): void => { ";return{text:`${i}${t} });`,prefixLength:i.length}}let n=";void ((";return{text:`${n}${t}));`,prefixLength:n.length}}var Yl=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function Ro(e,t){return Ws(e,t).code}function Ws(e,t){let n=new Map;if(!t)return{code:e,columns:n};let i=zo(e),a=[],u=0;for(let l of e.matchAll(Yl)){let f=l.index,[x,v,A,D]=l,U=To.resolve(t,D).replace(/\\/g,"/"),O=`${v}${A}${U}${A}`;if(a.push(e.slice(u,f),O),u=f+x.length,x.includes(`
|
|
551
|
+
`))continue;let z=rr(i,f),V=n.get(z.line)??[],F=V.at(-1),q=z.column+(F?F.generatedEnd-F.sourceEnd:0);V.push({sourceStart:z.column,sourceEnd:z.column+x.length,generatedStart:q,generatedEnd:q+O.length}),n.set(z.line,V)}return a.push(e.slice(u)),{code:a.join(""),columns:n}}function Ql(e,t,n){let i=wo(e.importColumns?.get(t)??[],n);return wo(e.scriptColumns?.get(t)??[],i)}function vi(e){return" ".repeat(Math.max(0,(e.startColumn??1)-1))}function eu(e){let t=new Set,n=r(e);for(let i of n.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let a=i[1],u=/\{([^}]*)\}/.exec(a);for(let v of u?.[1].split(",")??[]){let A=v.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(A&&/^[A-Z_$][\w$]*$/i.test(A))t.add(A)}let l=a.replace(/\{[^}]*\}/,""),f=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(l);if(f)t.add(f[1]);let x=/^\s*([A-Z_$][\w$]*)/i.exec(l);if(x&&x[1]!=="type")t.add(x[1])}return[...t].sort()}function Gc(e,t={}){let n=lt(e),i=e.split(`
|
|
552
552
|
`),a=Array.from({length:i.length},()=>""),u=new Map,l=new Map,f=new Map,x=[],v=bi(n),A=t.filePath&&t.templateExpressions!==!1?xo(e,es(e),{filePath:t.filePath,componentsDir:t.componentsDir,projectRoot:t.projectRoot,readComponent:t.readComponent,scriptCode:(V,F)=>lt(V).map((q)=>Ro(q.code,To.dirname(F))).join(`
|
|
553
553
|
`)}):void 0,D=new Set,U=[];for(let[V,F]of n.entries()){let q=yi(vi(F)+F.code,v,String(V));for(let[ie,se]of q.columns)l.set(F.startLine+ie-1,se);for(let ie of q.declarations)x.push({text:Ro(ie.text,t.originDir??""),origin:ie.origin?{...ie.origin,line:ie.origin.line+F.startLine-1}:void 0});let H=Us(q.code),M=Ws(H,t.originDir??"");for(let[ie,se]of M.columns)f.set(F.startLine+ie-1,se);let Q=M.code.split(`
|
|
554
554
|
`);Q.forEach((ie,se)=>{let fe=F.startLine-1+se;if(fe<a.length)a[fe]=ie,D.add(fe)}),U.push(F.startLine-1+Q.length-1)}for(let V of U){let F=a[V]?.trim()===""?V:V+1;if(F<a.length&&a[F].trim()===""&&(F===V||!D.has(F)))a[F]=";"}let O=(V,F)=>{for(let[q,H]of V.split(`
|
|
555
555
|
`).entries())if(a.push(H),F)u.set(a.length,q===0?F:{...F,line:F.line+q,column:1,prefixLength:0})};for(let V of x)O(V.text,V.origin);if(t.globals!==!1){O("");let V=new Set([...n.flatMap((M)=>Fe(M.code)),...n.flatMap((M)=>eu(M.code))]),F=(M)=>{if(!V.has(M))O(`declare var ${M}: any`)};if(t.runtimeGlobals!==!1){if(!V.has("window"))O("declare var window: any");for(let M of C)F(M)}let q=[...new Set([...sr,...Ee,...Co])].filter((M)=>t.runtimeGlobals!==!1||!C.includes(M));if(t.contextScope==="global"){O("declare global {");for(let M of q)O(` var ${M}: any`);O("}")}else{for(let M of sr)F(M);for(let M of Ee)F(M);for(let M of Co)F(M)}O(`declare var ${nr}: any`);let H=new Set(n.flatMap((M)=>Fe(M.code)));O(`type ${yo}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let M of Wl(e)){if(H.has(M.name))continue;let Q=M.iterable&&H.has(M.iterable)?`${yo}<typeof ${M.iterable}>`:"any";O(`declare var ${M.name}: ${Q}`)}}if(t.templateExpressions!==!1){if(A?.declarations)for(let F of A.declarations.split(`
|
|
556
|
-
`))O(F);let V=gg(e).map((F)=>{let q=A?.events.get(F.offset??-1);if(q){F.anchor=!0;let H=F.code.trim(),M=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(H),Q=M?`void ((${M[2]}) satisfies __StxAssignedValue<typeof ${M[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(H)?`${H} satisfies (($event: ${q}) => unknown)`:H,ie=`;(($event: ${q}): void => { `;return{expression:F,statement:{text:`${ie}${Q} });`,prefixLength:ie.length}}}return{expression:F,statement:Gl(F)}}).filter((F)=>F.statement!==null);if(V.push(...A?.checks||[]),V.length>0){let F=es(e),q=Yn(F),H=Xl(n.map((se)=>se.code)),Q=[...new Set(n.flatMap((se)=>Fe(se.code)))].filter((se)=>/^[A-Z_$][\w$]*$/i.test(se)),ie=0;if(Q.length>0){O(Ml);for(let se of Q)O(`function __StxRead_${se}() { return ${se} }`),O(`type __StxT_${se} = ${Po}<ReturnType<typeof __StxRead_${se}>>`);O(`;((${Q.map((se)=>`${se}: __StxT_${se}`).join(", ")}) => {`),ie=1}for(let{expression:se,statement:fe}of V){let xe=" ".repeat(ie),ge=se.offset===void 0?[]:q.filter((Ye)=>se.offset>=Ye.start&&se.offset<Ye.end),Pe=ge.map((Ye)=>`;((${Ye.binding.replace(/[\r\n]/g," ")}: any) => { `).join(""),Ke=" });".repeat(ge.length),Ae=se.offset===void 0?[]:Jl(F,se.offset),
|
|
556
|
+
`))O(F);let V=gg(e).map((F)=>{let q=A?.events.get(F.offset??-1);if(q){F.anchor=!0;let H=F.code.trim(),M=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(H),Q=M?`void ((${M[2]}) satisfies __StxAssignedValue<typeof ${M[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(H)?`${H} satisfies (($event: ${q}) => unknown)`:H,ie=`;(($event: ${q}): void => { `;return{expression:F,statement:{text:`${ie}${Q} });`,prefixLength:ie.length}}}return{expression:F,statement:Gl(F)}}).filter((F)=>F.statement!==null);if(V.push(...A?.checks||[]),V.length>0){let F=es(e),q=Yn(F),H=Xl(n.map((se)=>se.code)),Q=[...new Set(n.flatMap((se)=>Fe(se.code)))].filter((se)=>/^[A-Z_$][\w$]*$/i.test(se)),ie=0;if(Q.length>0){O(Ml);for(let se of Q)O(`function __StxRead_${se}() { return ${se} }`),O(`type __StxT_${se} = ${Po}<ReturnType<typeof __StxRead_${se}>>`);O(`;((${Q.map((se)=>`${se}: __StxT_${se}`).join(", ")}) => {`),ie=1}for(let{expression:se,statement:fe}of V){let xe=" ".repeat(ie),ge=se.offset===void 0?[]:q.filter((Ye)=>se.offset>=Ye.start&&se.offset<Ye.end),Pe=ge.map((Ye)=>`;((${Ye.binding.replace(/[\r\n]/g," ")}: any) => { `).join(""),Ke=" });".repeat(ge.length),Ae=se.offset===void 0?[]:Jl(F,se.offset),Je=Ae.length>0?`${Ae.map((Ye)=>`if (${Lo(Ye,H)}) `).join("")}{ `:"",et=Ae.length>0?" }":"";O(xe+Pe+Je+fe.text+et+Ke,{line:se.line,column:se.column,expression:se,prefixLength:fe.prefixLength+xe.length+Pe.length+Je.length,guardPrefixLength:xe.length+Pe.length+Je.length})}if(ie>0)O("});")}}let z=!1;if(t.reference&&a[0]!==void 0&&a[0].trim()==="")a[0]=`/// <reference path=${JSON.stringify(t.reference.replace(/\\/g,"/"))} />`,z=!0;return O("export {}"),{text:a.join(`
|
|
557
557
|
`),lineMap:u,sourceLineCount:i.length,componentDependencies:A?.dependencies,referenced:z,scriptColumns:l,importColumns:f}}function zo(e){let t=[0];for(let n=0;n<e.length;n++)if(e.charCodeAt(n)===10)t.push(n+1);return t}function rr(e,t){let n=0,i=e.length-1;while(n<i){let a=Math.ceil((n+i)/2);if(e[a]<=t)n=a;else i=a-1}return{line:n+1,column:t-e[n]+1}}function Jc(e,t){if(!e.expression)return!1;return e.inGuard===!0||t===2774}function xi(e,t,n){let i=e.lineMap.get(t);if(!i)return t<=e.sourceLineCount?{line:t,column:Ql(e,t,n)}:null;let a=i.expression?.anchor?0:Math.max(0,n-1-(i.prefixLength??0));return{line:i.line,column:i.column+a,expression:i.expression,inGuard:n<=(i.guardPrefixLength??0)}}var or=S(256),tu=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/(?:\bwindow\.)?localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables \u2014 or, where this must run before first paint and the runtime does not exist yet, the colorMode config for a light/dark theme, or @appearanceBootstrap when there is a second appearance axis"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}],Bo=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function nu(e){let t=Array.from(e,(a)=>a===`
|
|
558
558
|
`?`
|
|
559
559
|
`:" "),n=0,i="";while(n<e.length){let a=e[n],u=e[n+1];if(i){if(a==="\\"){n+=2;continue}if(a===i)i="";n++;continue}if(a==='"'||a==="'"||a==="`"){i=a,n++;continue}if(a==="/"&&u==="/"){while(n<e.length&&e[n]!==`
|
|
@@ -570,21 +570,21 @@ ${v.join(`
|
|
|
570
570
|
Tip: prefer useRef(), navigate(), and composables for component code`;if(or.set(u,O),console.warn(O),a.failOnViolation)throw new Y(O,i??t)}var iu=[{open:"@if",close:"@endif",name:"if"},{open:"@unless",close:"@endunless",name:"unless"},{open:"@foreach",close:"@endforeach",name:"foreach"},{open:"@for",close:"@endfor",name:"for"},{open:"@while",close:"@endwhile",name:"while"},{open:"@forelse",close:"@endforelse",name:"forelse"},{open:"@switch",close:"@endswitch",name:"switch"},{open:"@isset",close:"@endisset",name:"isset"},{open:"@empty",close:"@endempty",name:"empty"},{open:"@auth",close:"@endauth",name:"auth"},{open:"@guest",close:"@endguest",name:"guest"},{open:"@can",close:"@endcan",name:"can"},{open:"@cannot",close:"@endcannot",name:"cannot"},{open:"@section",close:"@endsection",name:"section",altClose:"@show"},{open:"@push",close:"@endpush",name:"push"},{open:"@prepend",close:"@endprepend",name:"prepend"},{open:"@once",close:"@endonce",name:"once"},{open:"@markdown",close:"@endmarkdown",name:"markdown"},{open:"@component",close:"@endcomponent",name:"component"}],ou=[{pattern:/@if\s*[^(]/,message:"@if directive missing parentheses",suggestion:"Use @if(condition)"},{pattern:/@foreach\s*[^(]/,message:"@foreach directive missing parentheses",suggestion:"Use @foreach(items as item)"},{pattern:/@foreach\([^)]*\)\s*[^@\n<]/,message:"@foreach may have content on same line",suggestion:"Put content on new line after @foreach()"},{pattern:/@include\s*[^(]/,message:"@include directive missing parentheses",suggestion:"Use @include('partial-name')"},{pattern:/@extends\s*[^(]/,message:"@extends directive missing parentheses",suggestion:"Use @extends('layout-name') or @layout('layout-name')"},{pattern:/@layout\s*[^(]/,message:"@layout directive missing parentheses",suggestion:"Use @layout('layout-name')"}],au=[{pattern:/\{\{\s*constructor\s*\}\}/,message:"Attempting to access constructor property"},{pattern:/\{\{\s*__proto__\s*\}\}/,message:"Attempting to access __proto__ property"},{pattern:/\{\{\s*eval\s*\(/,message:"Attempting to use eval in expression"}];function _g(e){let t=[],n=[];return cu(e,t),lu(e,t,n),uu(e,n),fu(e,t),{valid:t.length===0,errors:t,warnings:n}}function cu(e,t){let n=(e.match(/\{\{/g)||[]).length,i=(e.match(/\}\}/g)||[]).length;if(n!==i)t.push({type:"expression",message:`Unclosed expression brackets: found ${n} opening '{{' and ${i} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function lu(e,t,n){for(let i of iu){let a=new RegExp(`${i.open}(?:\\s|\\()`,"g"),u=new RegExp(i.close,"g"),l=(e.match(a)||[]).length,f=(e.match(u)||[]).length;if(i.altClose){let x=new RegExp(i.altClose,"g");f+=(e.match(x)||[]).length}if(l>f)t.push({type:"directive",message:`Unclosed @${i.name} directive: found ${l} opening and ${f} closing`,suggestion:`Add ${l-f} missing ${i.close} tag(s)`});else if(f>l)n.push({type:"directive",message:`Extra ${i.close} found: ${f-l} more closing than opening`,suggestion:`Check for orphaned ${i.close} tags`})}}function uu(e,t){for(let n of ou)if(n.pattern.test(e))t.push({type:"syntax",message:n.message,suggestion:n.suggestion})}function fu(e,t){for(let n of au)if(n.pattern.test(e))t.push({type:"expression",message:`Security warning: ${n.message}`,suggestion:"Remove dangerous code from template expressions"})}function Cg(e,t){let n=e.slice(0,t).split(`
|
|
571
571
|
`);return{line:n.length,column:n[n.length-1].length+1}}function Eg(e,t,n){let i=[];switch(e){case"if":case"elseif":case"unless":if(n.length===0)i.push({type:"syntax",message:`@${e} requires a condition`,suggestion:`Use @${e}(condition)`});break;case"foreach":if(n.length===0||!n[0].includes(" as "))i.push({type:"syntax",message:'@foreach requires "items as item" syntax',suggestion:"Use @foreach(items as item) or @foreach(items as key => value)"});break;case"for":if(n.length===0)i.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(n.length===0)i.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(n.length===0)i.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(n.length===0)i.push({type:"syntax",message:`@${e} requires a path`,suggestion:`Use @${e}('path/to/template')`});break}return i}function Tg(e){return/@[a-z]+/i.test(e)||/\{\{/.test(e)}function $g(e){let t=e.matchAll(/@([a-z]+)/gi),n=new Set;for(let i of t){let a=i[1].toLowerCase();if(!a.startsWith("end"))n.add(a)}return Array.from(n)}function Wo(e,t,n){let i=/^<script\b([^>]*)>/i.exec(e);if(!i||!/(?:^|\s)src\s*=/i.test(i[1]??""))return null;return R(i[0],t,n)+e.slice(i[0].length)}var fn=new P(500),lr=new Map;function Fo(e){try{let t=is.statSync(e);return`${t.size}:${t.mtimeMs}`}catch{return""}}var ss=new P(1000),ur=new Map,fr=new P(2000),pr=new P(500),Go=33554432,dr=Go;function pu(e){let t=e.componentRenderCacheBytes;if(typeof t!=="number"||t<0||t===dr)return;dr=t,rs.setMaxBytes(t)}var rs=new P(2000,{maxBytes:Go,sizeOf:(e)=>e.output.length});function du(e){let t=new WeakSet;try{let n=(i)=>{if(i===void 0)return{__stxType:"undefined"};if(typeof i==="bigint")return{__stxType:"bigint",value:i.toString()};if(typeof i==="function"||typeof i==="symbol")throw TypeError("Non-serializable component input");if(i===null||typeof i!=="object")return i;if(t.has(i))throw TypeError("Circular component input");t.add(i);try{if(i instanceof Date)return{__stxType:"date",value:i.toISOString()};if(Array.isArray(i))return i.map(n);let a=Object.getPrototypeOf(i);if(a!==Object.prototype&&a!==null)throw TypeError("Non-plain component input");let u={};for(let l of Object.keys(i).sort())u[l]=n(i[l]);return u}finally{t.delete(i)}};return JSON.stringify(n(e))}catch{return null}}function gu(e){let t={};for(let[n,i]of Object.entries(e))if(!n.startsWith("__")||n==="__stxServeContext")t[n]=i;return t}function ar(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Js(e){let t=process.cwd(),n=`${t}\x00${e}`,i=Vo.get(n);if(i===void 0)i=Bun.hash(Yo(e,t).split(le.sep).join("/")).toString(36).slice(0,6),Vo.set(n,i);return i}var Vo=new Map;function Yo(e,t){if(!le.isAbsolute(e))return e;let n=(i)=>{try{return is.realpathSync(i)}catch{return i}};return le.relative(n(t),n(e))}function Rg(e){return/\bjs\b/.test(e)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(e)}function Ve(e){return!Rg(e)}var ns=new Map;function ne(e){let t;try{t=JSON.stringify(e)}catch{return new Bun.Transpiler(e)}let n=ns.get(t);if(n)return n;if(ns.size>=16)ns.clear();let i=new Bun.Transpiler(e);return ns.set(t,i),i}var Uo=new WeakMap,mu=256;function Ue(e){try{let t=ne({loader:"ts",target:"browser",define:T()}),n=Uo.get(t);if(!n)n=new Map,Uo.set(t,n);let i=n.get(e);if(i!==void 0)return i;let a=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");a=a.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let u=[];a=a.replace(/\{!![\s\S]*?!!\}/g,(f)=>{let x=u.length;return u.push(f),`"__STX_EXPR_${x}__"`}),a=a.replace(/\{\{\{[\s\S]*?\}\}\}/g,(f)=>{let x=u.length;return u.push(f),`"__STX_EXPR_${x}__"`}),a=a.replace(/\{\{[\s\S]*?\}\}/g,(f)=>{let x=u.length;return u.push(f),`"__STX_EXPR_${x}__"`});let l=t.transformSync(a);for(let f=0;f<u.length;f++)l=l.replace(`"__STX_EXPR_${f}__"`,u[f]),l=l.replace(`'__STX_EXPR_${f}__'`,u[f]);if(n.size>=mu){let f=n.keys().next();if(!f.done)n.delete(f.value)}return n.set(e,l),l}catch(t){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",t);return e}}function hu(e){let t=[],n=new Set,i=0,a=0,u=e.length,l=(O)=>{a++;while(a<u){if(e[a]==="\\"){a+=2;continue}if(e[a]===O){a++;return}a++}},f=()=>{a++;while(a<u){if(e[a]==="\\"){a+=2;continue}if(e[a]==="`"){a++;return}if(e[a]==="$"&&e[a+1]==="{"){a+=2;let O=1;while(a<u&&O>0)if(e[a]==="{")O++,a++;else if(e[a]==="}")O--,a++;else if(e[a]==="'"||e[a]==='"')l(e[a]);else if(e[a]==="`")f();else a++;continue}a++}},x=()=>{if(e[a]==="/"&&e[a+1]==="/"){while(a<u&&e[a]!==`
|
|
572
572
|
`)a++;return!0}if(e[a]==="/"&&e[a+1]==="*"){a+=2;while(a<u-1&&!(e[a]==="*"&&e[a+1]==="/"))a++;return a+=2,!0}return!1},v=new Set(["return","typeof","instanceof","in","of","new","delete","void","throw","case","do","else","yield","await"]),A=()=>{let O=a-1;while(O>=0&&/\s/.test(e[O]))O--;if(O<0)return!0;let z=e[O];if("(,=:[!&|?{};+-*%<>~^".includes(z))return!0;if(!/[\w$]/.test(z))return!1;let V=O;while(V>0&&/[\w$]/.test(e[V-1]))V--;return v.has(e.slice(V,O+1))},D=()=>{a++;let O=!1;while(a<u&&e[a]!==`
|
|
573
|
-
`){let z=e[a];if(z==="\\"){a+=2;continue}if(z==="[")O=!0;else if(z==="]")O=!1;else if(z==="/"&&!O){a++;while(a<u&&/[a-z]/i.test(e[a]))a++;return}a++}},U=()=>{if(i!==0)return;let O=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(O){let q=O[2].split(",").map((H)=>{let M=H.trim().split(":");return M[M.length-1].trim()});for(let H of q)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!n.has(H))t.push(H),n.add(H);return}let z=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let q=z[2];if(!n.has(q))t.push(q),n.add(q);return}let V=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(V){let q=V[1];if(!n.has(q))t.push(q),n.add(q);return}let F=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let q=F[1];if(!n.has(q))t.push(q),n.add(q)}};while(a<u){if(x())continue;if(e[a]==="'"||e[a]==='"'){l(e[a]);continue}if(e[a]==="`"){f();continue}if(e[a]==="/"&&A()){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])))U();a++}return t}function xu(e){let t=[],n=0,i=0,a=null;for(let u=0;u<e.length;u++){let l=e[u];if(a){if(l==="\\"){u++;continue}if(l===a)a=null;continue}if(l==='"'||l==="'"||l==="`"){a=l;continue}if(l==="("||l==="["||l==="{")n++;else if(l===")"||l==="]"||l==="}")n--;else if(l===","&&n===0)t.push(e.slice(i,u)),i=u+1}if(i<e.length)t.push(e.slice(i));return t}function bu(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 u=e[i-1],l=e[i+1];if(u==="!"||u==="<"||u===">"||u==="=")continue;if(l==="="||l===">")continue;return i}}return-1}function yu(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,u=0,l=-1;for(;i>=0;i--){let x=e[i];if(x==="}")u++;else if(x==="{"){if(u--,u===0){l=i;break}}}if(l===-1)return;let f=e.slice(l+1,a);for(let x of xu(f)){let v=x.trim();if(!v||v.startsWith("..."))continue;let A=bu(v);if(A===-1)continue;let D=v.slice(0,A).trim();if(!/^[A-Z_$][\w$]*$/i.test(D))continue;if(t[D]!==void 0)continue;let U=v.slice(A+1).trim();if(!U)continue;try{let O=Object.keys(t).filter(Ut),z=Function(...O,`"use strict"; return (${U});`);t[D]=z(...O.map((V)=>t[V]))}catch{}}}catch{}}var _u=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function Ag(e,t){let n=Mt(e),i=e.slice(n).match(/^<([a-zA-Z][a-zA-Z0-9-]*)/);if(!i)return null;let a=i[1].toLowerCase();if(!_u.has(a))return null;let u=new RegExp(`<\\/?${a}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),l=w(e,(A,D)=>(u.lastIndex=D,u.exec(A)?.index===D?u.lastIndex:-1));if(a==="span"&&/\sdata-stx-scope\s*=/.test(l[0]?.token||""))return null;let f=0,x=!1;for(let A of l){if(f+=A.token.startsWith("</")?-1:1,f<0)return null;if(f===0){if(e.slice(A.end).trim())return null;x=!0;break}}if(!x)return null;let v=n+i[0].length;return e.slice(0,v)+t+e.slice(v)}function Qo(e,t){if(!e)return!1;return[...t.additionalComponentsDirs??[],...t.fallbackComponentsDir?[t.fallbackComponentsDir]:[]].some((i)=>{let a=le.relative(le.resolve(i),le.resolve(e));return!a.startsWith("..")&&!le.isAbsolute(a)})}async function Ir(e,t,n,i,a){let u=e.endsWith(".stx")?e.slice(0,-4):e,l=(se)=>se.split("-").map((fe)=>fe.charAt(0).toUpperCase()+fe.slice(1)).join(""),f=n.__importedComponents;if(f){for(let se of[u,u.toLowerCase(),l(u),
|
|
573
|
+
`){let z=e[a];if(z==="\\"){a+=2;continue}if(z==="[")O=!0;else if(z==="]")O=!1;else if(z==="/"&&!O){a++;while(a<u&&/[a-z]/i.test(e[a]))a++;return}a++}},U=()=>{if(i!==0)return;let O=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(O){let q=O[2].split(",").map((H)=>{let M=H.trim().split(":");return M[M.length-1].trim()});for(let H of q)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!n.has(H))t.push(H),n.add(H);return}let z=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let q=z[2];if(!n.has(q))t.push(q),n.add(q);return}let V=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(V){let q=V[1];if(!n.has(q))t.push(q),n.add(q);return}let F=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let q=F[1];if(!n.has(q))t.push(q),n.add(q)}};while(a<u){if(x())continue;if(e[a]==="'"||e[a]==='"'){l(e[a]);continue}if(e[a]==="`"){f();continue}if(e[a]==="/"&&A()){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])))U();a++}return t}function xu(e){let t=[],n=0,i=0,a=null;for(let u=0;u<e.length;u++){let l=e[u];if(a){if(l==="\\"){u++;continue}if(l===a)a=null;continue}if(l==='"'||l==="'"||l==="`"){a=l;continue}if(l==="("||l==="["||l==="{")n++;else if(l===")"||l==="]"||l==="}")n--;else if(l===","&&n===0)t.push(e.slice(i,u)),i=u+1}if(i<e.length)t.push(e.slice(i));return t}function bu(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 u=e[i-1],l=e[i+1];if(u==="!"||u==="<"||u===">"||u==="=")continue;if(l==="="||l===">")continue;return i}}return-1}function yu(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,u=0,l=-1;for(;i>=0;i--){let x=e[i];if(x==="}")u++;else if(x==="{"){if(u--,u===0){l=i;break}}}if(l===-1)return;let f=e.slice(l+1,a);for(let x of xu(f)){let v=x.trim();if(!v||v.startsWith("..."))continue;let A=bu(v);if(A===-1)continue;let D=v.slice(0,A).trim();if(!/^[A-Z_$][\w$]*$/i.test(D))continue;if(t[D]!==void 0)continue;let U=v.slice(A+1).trim();if(!U)continue;try{let O=Object.keys(t).filter(Ut),z=Function(...O,`"use strict"; return (${U});`);t[D]=z(...O.map((V)=>t[V]))}catch{}}}catch{}}var _u=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function Ag(e,t){let n=Mt(e),i=e.slice(n).match(/^<([a-zA-Z][a-zA-Z0-9-]*)/);if(!i)return null;let a=i[1].toLowerCase();if(!_u.has(a))return null;let u=new RegExp(`<\\/?${a}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),l=w(e,(A,D)=>(u.lastIndex=D,u.exec(A)?.index===D?u.lastIndex:-1));if(a==="span"&&/\sdata-stx-scope\s*=/.test(l[0]?.token||""))return null;let f=0,x=!1;for(let A of l){if(f+=A.token.startsWith("</")?-1:1,f<0)return null;if(f===0){if(e.slice(A.end).trim())return null;x=!0;break}}if(!x)return null;let v=n+i[0].length;return e.slice(0,v)+t+e.slice(v)}function Qo(e,t){if(!e)return!1;return[...t.additionalComponentsDirs??[],...t.fallbackComponentsDir?[t.fallbackComponentsDir]:[]].some((i)=>{let a=le.relative(le.resolve(i),le.resolve(e));return!a.startsWith("..")&&!le.isAbsolute(a)})}async function Ir(e,t,n,i,a){let u=e.endsWith(".stx")?e.slice(0,-4):e,l=(se)=>se.split("-").map((fe)=>fe.charAt(0).toUpperCase()+fe.slice(1)).join(""),f=n.__importedComponents;if(f){for(let se of[u,u.toLowerCase(),l(u),X(u)])if(f.has(se))return!0}let x=[...new Set([`${u}.stx`,`${l(u)}.stx`,`${X(u)}.stx`])],v=typeof a.root==="string"?le.resolve(a.root):void 0,A=v??le.dirname(i),D=[],U=(se)=>{if(se&&!D.includes(se))D.push(se)};for(let se of zn(i,v))U(se);let O=n.__originalFilePath;if(O)U(le.join(le.dirname(O),"components"));if(Qo(t,a))U(a._rootComponentsDir);U(t),U(a._rootComponentsDir),U(le.join(le.dirname(i),"components")),U(a.componentsDir);for(let se of a.additionalComponentsDirs??[])U(se);let z=a._targetComponentFallbackNames?.some((se)=>se.toLowerCase()===u.toLowerCase());if(!z)for(let se of a._targetComponentDirs??[])U(se);if(v)U(le.resolve(v,"resources/views/components")),U(le.resolve(v,"resources/components")),U(le.resolve(v,"src/components")),U(le.resolve(v,"components"));for(let se of a._layerComponentDirs??[])U(se);let V=a._pluginComponentDirs;if(Array.isArray(V))for(let se of V)U(typeof se==="string"?se:null);if(U(a.fallbackComponentsDir),z)for(let se of a._targetComponentDirs??[])U(se);let F=a._nativePrimitivesFallback;if(F&&!F.except.some((se)=>se.toLowerCase()===u.toLowerCase()))U(F.dir);if(u.startsWith("./")||u.startsWith("../"))return s(le.resolve(le.dirname(i),`${u}.stx`));let q=Ho(le.resolve(import.meta.dir,"components")),H=D.map((se)=>le.isAbsolute(se)?se:le.resolve(A,se)),M=`${x.join("\x00")}\x00\x00${H.join("\x00")}`,Q=fr.get(M);if(Q!==void 0)return Q;let ie=!1;e:for(let se of H){if(Ho(se)===q)continue;for(let fe of x)if(await s(le.join(se,fe))){ie=!0;break e}}return fr.set(M,ie),ie}function Ho(e){let t=pr.get(e);if(t!==void 0)return t;let n=e;try{n=is.realpathSync(e)}catch{}return pr.set(e,n),n}function Pg(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function ll(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 wu(e,t,n){if(!e.includes("{{")&&!e.includes("{!!"))return e;let i=(a,u)=>{let l;try{l=I(a,t)}catch{return u}if(l===void 0||l===null)return"";let f=String(l);if(/<\/style/i.test(f))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 f};return e.replace(/\{!!([\s\S]*?)!!\}/g,(a,u)=>i(u,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,u)=>i(u,a))}var qo=new Set;function Zo(e,t,n,i){let a=`${e}\x00${t}\x00${i??""}`;if(!process.env.STX_DEBUG&&qo.has(a))return;qo.add(a);let u=t?` used in ${t}`:"",l=i?` Cause: ${i}.`:"",f=n.length>0?`
|
|
574
574
|
searched:
|
|
575
575
|
${n.map((x)=>` - ${x}`).join(`
|
|
576
|
-
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${u}, so it rendered as nothing.${l}${f}`)}function Ko(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var Su=new Set(["for","if","show","key","ref","class","className","style"]),Xo=new Set,ea="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",ul=new RegExp(`\\b(?:${ea})\\s*(?:<[^>]*>)?\\s*\\(`);function Ti(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|${ea})\\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 We(e,t,n,i,a,u,l,f=new Set,x,v=ct(a),A,D=e){let{extractVariables:U}=await o("stx/variable-extractor",()=>import("./chunk-9rjr7hvf.js")),O=f??new Set;if(O.has(e))return`[Circular component reference: ${e}]`;let z=new Set(O);z.add(e);let V=typeof t.client==="string"?t.client.trim():"";if("client"in t)delete t.client;let F=V&&V!=="load"&&Pg(V)?V:"";try{let q=(ae)=>ae.split("-").map((ue)=>ue.charAt(0).toUpperCase()+ue.slice(1)).join(""),H=D.endsWith(".stx")?D.slice(0,-4):D,M=null,Q=a.__importedComponents;if(Q){let ae=[H,H.toLowerCase(),q(H),G(H)];for(let ue of ae)if(Q.has(ue)){M=Q.get(ue);break}}let ie=[];if(!M){let ae=[`${H}.stx`,`${q(H)}.stx`,`${G(H)}.stx`],ue=[...new Set(ae)],Se=a.__originalFilePath,he=[];for(let _e of zn(u))if(!he.includes(_e))he.push(_e);let Je=he.length;for(let _e of l._layerComponentDirs??[])if(!he.includes(_e))he.push(_e);if(Se){let _e=le.join(le.dirname(Se),"components");he.push(_e)}let Ie=l._rootComponentsDir;if(typeof Ie==="string"&&Qo(i,l)&&!he.includes(Ie))he.push(Ie);if(i&&!he.includes(i))he.push(i);if(typeof Ie==="string"&&!he.includes(Ie))he.push(Ie);let xt=le.join(le.dirname(u),"components");if(!he.includes(xt))he.push(xt);if(l.componentsDir&&l.componentsDir!==i&&!he.includes(l.componentsDir))he.push(l.componentsDir);for(let _e of l.additionalComponentsDirs??[])if(_e&&!he.includes(_e))he.push(_e);let Rt=l._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(H),_t=(A?.events??[]).map((_e)=>_e.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Rn=Object.hasOwn(t,"checked")||Boolean(A?.reactiveProps?.includes("checked")),ps=Object.hasOwn(t,"value")||Boolean(A?.reactiveProps?.includes("value")),ds=!_t.includes("valuechange")&&(Rn||_t.includes("change")&&!ps),$t=l._nativeHostAttrs&&/^textinput$/i.test(H),Tt=_t.includes("update:value")&&!_t.includes("input"),tn=l._nativeHostAttrs&&/^video$/i.test(H),gs=l._nativeHostAttrs&&/^image$/i.test(H),An=Hs([...Object.keys(t),...A?.reactiveProps??[]],A?.events,t),At=Object.hasOwn(t,"src")||Boolean(A?.reactiveProps?.includes("src")),In=Object.hasOwn(t,"source")||Boolean(A?.reactiveProps?.includes("source")),Pn=tn&&(At||In)&&(A?.events??[]).every((_e)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(_e.replace(/^@/,"").split(".")[0])),On=new Set(["","primary","secondary","outline","ghost","danger"]),Dn=typeof t.variant==="string"?t.variant.trim().toLowerCase():"",Mn=l._nativeHostAttrs&&/^button$/i.test(H)&&!On.has(Dn),wr=l._targetComponentFallbackNames?.some((_e)=>_e.toLowerCase()===H.toLowerCase())??!1,ms=wr&&(!Rt||ds)&&(!$t||Tt)&&(!tn||Pn)&&(!gs||An)&&!Mn;for(let _e of ms?[]:l._targetComponentDirs??[])if(_e&&!he.includes(_e))he.push(_e);let It=typeof l.root==="string"?le.resolve(l.root):void 0,Sr=It??le.dirname(u),Pt=[];if(It)Pt.push(le.resolve(It,"resources/views/components")),Pt.push(le.resolve(It,"resources/components")),Pt.push(le.resolve(It,"src/components")),Pt.push(le.resolve(It,"components"));Pt.push(le.resolve(import.meta.dir,"components"));for(let _e of Pt)if(!he.includes(_e))he.push(_e);if(wr){let _e=(l._componentPackageDirs??[]).filter((tt)=>typeof tt==="string"&&tt.length>0),bt=(ms?_e.length?_e:l._pluginComponentDirs??[]:l._targetComponentDirs??[]).filter((tt)=>typeof tt==="string"&&tt.length>0);if(bt.length){let tt=he.slice(Je).map((Qe)=>le.isAbsolute(Qe)?Qe:le.resolve(Sr,Qe)).filter((Qe)=>!bt.includes(Qe)),Nn=`${H}\x00${tt.join("\x00")}`,at=ur.get(Nn);if(at===void 0){at=!1;for(let Qe of tt){for(let vt of ue)if(await s(le.join(Qe,vt))){at=!0;break}if(at)break}ur.set(Nn,at)}if(!at){for(let Qe of bt){let vt=he.indexOf(Qe);if(vt>=0)he.splice(vt,1)}he.splice(Je,0,...bt)}}}let vr=l._pluginComponentDirs;if(Array.isArray(vr)){for(let _e of vr)if(typeof _e==="string"&&!he.includes(_e))he.push(_e)}if(l.fallbackComponentsDir&&!he.includes(l.fallbackComponentsDir))he.push(l.fallbackComponentsDir);if(ms){for(let _e of l._targetComponentDirs??[])if(_e&&!he.includes(_e))he.push(_e)}let jn=l._nativePrimitivesFallback;if(jn&&!jn.except.some((_e)=>_e.toLowerCase()===H.toLowerCase())&&!he.includes(jn.dir))he.push(jn.dir);let kr=[...new Set(he.map((_e)=>{if(!_e)return _e;return le.isAbsolute(_e)?_e:le.resolve(Sr,_e)}))];he.length=0,he.push(...kr);let hs=`${H}\x00${u}\x00${kr.join("\x00")}`,xs=ss.get(hs);if(xs)if(await s(xs))M=xs;else ss.delete(hs);if(!M&&(H.startsWith("./")||H.startsWith("../")))M=le.resolve(le.dirname(u),`${H}.stx`),ie.push(M);else if(!M)for(let _e of he){if(!_e)continue;for(let bt of ue){let tt=le.join(_e,bt);if(ie.push(tt),await s(tt)){M=tt;break}}if(M)break;if(!M)try{let bt=await import("fs");if(!bt.statSync(_e,{throwIfNoEntry:!1})?.isDirectory())continue;let Nn=8,at=[{path:_e,depth:0}];while(at.length>0&&!M){let Qe=at.pop();if(Qe.depth>=Nn)continue;let vt;try{vt=bt.readdirSync(Qe.path,{withFileTypes:!0})}catch{continue}for(let Ln of vt){if(!Ln.isDirectory())continue;if(Ln.name==="node_modules"||Ln.name.startsWith("."))continue;let Or=le.join(Qe.path,Ln.name);for(let ga of ue){let bs=le.join(Or,ga);if(ie.push(bs),await s(bs)){M=bs;break}}if(M)break;at.push({path:Or,depth:Qe.depth+1})}}}catch{}if(M)break}if(M)ss.set(hs,M)}if(!M||!await s(M))return Zo(e,u,ie),Ko(e);x.add(M);let se;if(fn.has(M)&&lr.get(M)===Fo(M))se=fn.get(M);else try{let ae=Fo(M);se=await Bun.file(M).text(),fn.set(M,se),lr.set(M,ae)}catch(ae){let ue=ae instanceof Error?ae.message:String(ae);return Zo(e,u,[M],ue),Ko(e)}if(A)for(let ae of new Set([...Object.keys(t),...A.reactiveProps??[]])){let ue=ae.toLowerCase();if(ue.startsWith("aria-")||ue.startsWith("data-"))continue;let Se=ae.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${Se}\\b`).test(se))A.declaredProps.add(ae);if(new RegExp(`\\$props\\s*(?:\\.\\s*${Se}\\b|\\[\\s*['"]${Se}['"]\\s*\\])`).test(se)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${Se}['"]`).test(se))A.consumedProps?.add(ae)}if(A?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(se))for(let ae of A.reactiveProps){if(Su.has(ae)||A.consumedProps?.has(ae))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${ae.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(se))continue;let ue=`${M}\x00${ae}`;if(Xo.has(ue))continue;Xo.add(ue),console.warn(`[stx] ${le.basename(M)} reads \`${ae}\` with defineProps(), which is not live, but ${le.basename(u)} binds it (:${ae}): 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('${ae}').`)}let fe=new Set(["__originalFilePath","__importedComponents",Hn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),xe={};for(let[ae,ue]of Object.entries(a))if(!ae.startsWith("__")||fe.has(ae))xe[ae]=ue;let ge=v.length>0?{[Gn]:[...v]}:{},Pe=n;if(n.includes("@include")){let{processIncludes:ae}=await o("stx/includes",()=>import("./chunk-1t8tkryw.js"));Pe=await ae(n,a,u,l,x)}if(/<[A-Z][\w.-]*[\s/>]/.test(Pe)){let{processComponents:ae}=await o("stx/component-renderer",()=>import("./chunk-0snga2v8.js")),ue={...a,__processedComponents:O,...ge};Pe=await ae(Pe,ue,u,l,x);let Se=ue.__stx_preserved_client_expressions;if(Array.isArray(Se)&&Se.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Se])]}let Ke=[];if(ll(Pe)){let{processExpressions:ae}=await o("stx/expressions",()=>import("./chunk-qqvj5zra.js")),ue=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...ge}:v.length>0?{...a,...ge}:a;Pe=ae(Pe,ue,u);for(let Se of Pe.matchAll(/\{\{([\s\S]*?)\}\}/g))Ke.push(Se[1].trim())}let Ae=ee(Pe),Xe=[],et=Ae.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(ae,ue)=>{let Se=Ae.scripts[Number(ue)]||"",he=Se.match(/^<script\b([^>]*)>/i)?.[1]||"",Je=he.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Ie=!Je||["module","text/javascript","application/javascript"].includes(Je),xt=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${he}`);if(!/\bserver\b/i.test(he)&&Ie&&!xt)return Xe.push(Se),"";return Se}),{extractSlotContent:Ye}=await o("stx/slots",()=>import("./chunk-swp254eb.js")),it=Ye(et),nt={};if(it.defaultSlot?.trim())nt.default=it.defaultSlot;for(let[ae,ue]of it.namedSlots)nt[ae]=ue.content;let St=a.__stx_scope_seq??={n:0,key:Js(String(a.__filename??u))},Ht=Yo(e,process.cwd()),pt=`stx_${(Ht.endsWith(".stx")?Ht.slice(0,-4):Ht).replace(/[^a-zA-Z0-9]/g,"_")}_${++St.n}_${St.key}`,De={...xe,$uid:pt,$native:l._nativeHostAttrs===!0,...t,props:t,slot:et,$slots:nt,__processedComponents:z,__sections:{},__stx_signals_gate:Te(se)||ll(n),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Ke]};if(/import\s/.test(se)){De.__importedComponents=new Map(De.__importedComponents);let{processESImports:ae}=await o("stx/component-renderer",()=>import("./chunk-0snga2v8.js"));se=await ae(se,De,M,l,x)}yu(se,De);let qt=se,dn=L(qt);if(dn)qt=dn.content.trim();let as=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Zt=[...se.matchAll(as)];for(let[,ae,ue]of Zt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(ae))je(ue,M,l.strict);let st=[],Kt=null,cs=Zt.some((ae)=>/\bserver\b/.test(ae[1]||"")&&/\bcache\b/.test(ae[1]||"")),Ct=null,dt=null,Xt=null,gn=0,Jt=null;if(pu(l),cs&&dr>0){let ae=du({props:t,slot:Pe,slotContext:n.trim()?gu(xe):void 0,buildMode:l.buildMode??"",skipEventDirectives:l.skipEventDirectives===!0,native:l._nativeHostAttrs===!0,clientLoopNames:[...v].sort(),layers:l._layerGraph?.layers.map((ue)=>ue.configFile),uid:pt});if(ae!==null){Ct=`${M}\x00${_(se)}\x00${ae}`;let ue=rs.get(Ct);if(ue){for(let Se of ue.dependencies)x.add(Se);if(pi(a,ue.clientFactories),St.n+=ue.uidsConsumed,ue.preservedClientExpressions.length>0){let Se=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let he of ue.preservedClientExpressions)Se.add(he);a.__stx_preserved_client_expressions=[...Se]}return ue.output}dt=new Set(x),Xt=li(a),gn=St.n,Jt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Gt=new Set;for(let ae of Zt){let ue=ae[1]||"",Se=ae[2]||"",he=ue.includes("server");if(Ve(ue)&&Se.trim())Se=Ue(Se);if(he&&Se){for(let Ie of Fe(Se))Gt.add(Ie);try{await U(Se,De,M,{onFailure:(Ie)=>{if(Ie.kind!=="unknown")Kt=Ie.kind}})}catch(Ie){}}if(!he){let Ie=Se.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),xt=Ie.includes("{{")&&Ie.includes("}}"),Rt=Ie.includes("{!!")&&Ie.includes("!!}");if(xt||Rt)Ie=Ri(Ie,De,M);let _t=ue.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");st.push(`<script${_t}>${Ie}</script>`)}}let rt=ee(se).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Yt=rt?rt[1]:"",ls=rt?rt[2]:"",gt="",oe=Yt&&/\bscoped\b/i.test(Yt);if(rt)gt=`<style${Yt}>${wu(ls,De,M)}</style>`;let ce=qt;if(ce=ce.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),rt)ce=ce.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let ae=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ue=[];if(ce=ce.replace(ae,(Se,he)=>{let Je=he.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Je)ue.push(`<style${Je[1]}>${Je[2]}</style>`);return""}),ce=ce.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ue.length>0)gt=`${gt}${ue.join(`
|
|
577
|
-
`)}`}if(n&&ce.includes("{{ text || slot }}"))ce=ce.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>n);let{applySlots:me}=await o("stx/slots",()=>import("./chunk-
|
|
576
|
+
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${u}, so it rendered as nothing.${l}${f}`)}function Ko(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var Su=new Set(["for","if","show","key","ref","class","className","style"]),Xo=new Set,ea="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",ul=new RegExp(`\\b(?:${ea})\\s*(?:<[^>]*>)?\\s*\\(`);function Ti(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|${ea})\\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 We(e,t,n,i,a,u,l,f=new Set,x,v=ct(a),A,D=e){let{extractVariables:U}=await o("stx/variable-extractor",()=>import("./chunk-teasmth3.js")),O=f??new Set;if(O.has(e))return`[Circular component reference: ${e}]`;let z=new Set(O);z.add(e);let V=typeof t.client==="string"?t.client.trim():"";if("client"in t)delete t.client;let F=V&&V!=="load"&&Pg(V)?V:"";try{let q=(ae)=>ae.split("-").map((ue)=>ue.charAt(0).toUpperCase()+ue.slice(1)).join(""),H=D.endsWith(".stx")?D.slice(0,-4):D,M=null,Q=a.__importedComponents;if(Q){let ae=[H,H.toLowerCase(),q(H),X(H)];for(let ue of ae)if(Q.has(ue)){M=Q.get(ue);break}}let ie=[];if(!M){let ae=[`${H}.stx`,`${q(H)}.stx`,`${X(H)}.stx`],ue=[...new Set(ae)],Se=a.__originalFilePath,he=[];for(let _e of zn(u))if(!he.includes(_e))he.push(_e);let Ge=he.length;for(let _e of l._layerComponentDirs??[])if(!he.includes(_e))he.push(_e);if(Se){let _e=le.join(le.dirname(Se),"components");he.push(_e)}let Ie=l._rootComponentsDir;if(typeof Ie==="string"&&Qo(i,l)&&!he.includes(Ie))he.push(Ie);if(i&&!he.includes(i))he.push(i);if(typeof Ie==="string"&&!he.includes(Ie))he.push(Ie);let xt=le.join(le.dirname(u),"components");if(!he.includes(xt))he.push(xt);if(l.componentsDir&&l.componentsDir!==i&&!he.includes(l.componentsDir))he.push(l.componentsDir);for(let _e of l.additionalComponentsDirs??[])if(_e&&!he.includes(_e))he.push(_e);let Rt=l._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(H),_t=(A?.events??[]).map((_e)=>_e.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Rn=Object.hasOwn(t,"checked")||Boolean(A?.reactiveProps?.includes("checked")),ps=Object.hasOwn(t,"value")||Boolean(A?.reactiveProps?.includes("value")),ds=!_t.includes("valuechange")&&(Rn||_t.includes("change")&&!ps),$t=l._nativeHostAttrs&&/^textinput$/i.test(H),Tt=_t.includes("update:value")&&!_t.includes("input"),tn=l._nativeHostAttrs&&/^video$/i.test(H),gs=l._nativeHostAttrs&&/^image$/i.test(H),An=Hs([...Object.keys(t),...A?.reactiveProps??[]],A?.events,t),At=Object.hasOwn(t,"src")||Boolean(A?.reactiveProps?.includes("src")),In=Object.hasOwn(t,"source")||Boolean(A?.reactiveProps?.includes("source")),Pn=tn&&(At||In)&&(A?.events??[]).every((_e)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(_e.replace(/^@/,"").split(".")[0])),On=new Set(["","primary","secondary","outline","ghost","danger"]),Dn=typeof t.variant==="string"?t.variant.trim().toLowerCase():"",Mn=l._nativeHostAttrs&&/^button$/i.test(H)&&!On.has(Dn),wr=l._targetComponentFallbackNames?.some((_e)=>_e.toLowerCase()===H.toLowerCase())??!1,ms=wr&&(!Rt||ds)&&(!$t||Tt)&&(!tn||Pn)&&(!gs||An)&&!Mn;for(let _e of ms?[]:l._targetComponentDirs??[])if(_e&&!he.includes(_e))he.push(_e);let It=typeof l.root==="string"?le.resolve(l.root):void 0,Sr=It??le.dirname(u),Pt=[];if(It)Pt.push(le.resolve(It,"resources/views/components")),Pt.push(le.resolve(It,"resources/components")),Pt.push(le.resolve(It,"src/components")),Pt.push(le.resolve(It,"components"));Pt.push(le.resolve(import.meta.dir,"components"));for(let _e of Pt)if(!he.includes(_e))he.push(_e);if(wr){let _e=(l._componentPackageDirs??[]).filter((tt)=>typeof tt==="string"&&tt.length>0),bt=(ms?_e.length?_e:l._pluginComponentDirs??[]:l._targetComponentDirs??[]).filter((tt)=>typeof tt==="string"&&tt.length>0);if(bt.length){let tt=he.slice(Ge).map((Qe)=>le.isAbsolute(Qe)?Qe:le.resolve(Sr,Qe)).filter((Qe)=>!bt.includes(Qe)),Nn=`${H}\x00${tt.join("\x00")}`,at=ur.get(Nn);if(at===void 0){at=!1;for(let Qe of tt){for(let vt of ue)if(await s(le.join(Qe,vt))){at=!0;break}if(at)break}ur.set(Nn,at)}if(!at){for(let Qe of bt){let vt=he.indexOf(Qe);if(vt>=0)he.splice(vt,1)}he.splice(Ge,0,...bt)}}}let vr=l._pluginComponentDirs;if(Array.isArray(vr)){for(let _e of vr)if(typeof _e==="string"&&!he.includes(_e))he.push(_e)}if(l.fallbackComponentsDir&&!he.includes(l.fallbackComponentsDir))he.push(l.fallbackComponentsDir);if(ms){for(let _e of l._targetComponentDirs??[])if(_e&&!he.includes(_e))he.push(_e)}let jn=l._nativePrimitivesFallback;if(jn&&!jn.except.some((_e)=>_e.toLowerCase()===H.toLowerCase())&&!he.includes(jn.dir))he.push(jn.dir);let kr=[...new Set(he.map((_e)=>{if(!_e)return _e;return le.isAbsolute(_e)?_e:le.resolve(Sr,_e)}))];he.length=0,he.push(...kr);let hs=`${H}\x00${u}\x00${kr.join("\x00")}`,xs=ss.get(hs);if(xs)if(await s(xs))M=xs;else ss.delete(hs);if(!M&&(H.startsWith("./")||H.startsWith("../")))M=le.resolve(le.dirname(u),`${H}.stx`),ie.push(M);else if(!M)for(let _e of he){if(!_e)continue;for(let bt of ue){let tt=le.join(_e,bt);if(ie.push(tt),await s(tt)){M=tt;break}}if(M)break;if(!M)try{let bt=await import("fs");if(!bt.statSync(_e,{throwIfNoEntry:!1})?.isDirectory())continue;let Nn=8,at=[{path:_e,depth:0}];while(at.length>0&&!M){let Qe=at.pop();if(Qe.depth>=Nn)continue;let vt;try{vt=bt.readdirSync(Qe.path,{withFileTypes:!0})}catch{continue}for(let Ln of vt){if(!Ln.isDirectory())continue;if(Ln.name==="node_modules"||Ln.name.startsWith("."))continue;let Or=le.join(Qe.path,Ln.name);for(let ga of ue){let bs=le.join(Or,ga);if(ie.push(bs),await s(bs)){M=bs;break}}if(M)break;at.push({path:Or,depth:Qe.depth+1})}}}catch{}if(M)break}if(M)ss.set(hs,M)}if(!M||!await s(M))return Zo(e,u,ie),Ko(e);x.add(M);let se;if(fn.has(M)&&lr.get(M)===Fo(M))se=fn.get(M);else try{let ae=Fo(M);se=await Bun.file(M).text(),fn.set(M,se),lr.set(M,ae)}catch(ae){let ue=ae instanceof Error?ae.message:String(ae);return Zo(e,u,[M],ue),Ko(e)}if(A)for(let ae of new Set([...Object.keys(t),...A.reactiveProps??[]])){let ue=ae.toLowerCase();if(ue.startsWith("aria-")||ue.startsWith("data-"))continue;let Se=ae.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${Se}\\b`).test(se))A.declaredProps.add(ae);if(new RegExp(`\\$props\\s*(?:\\.\\s*${Se}\\b|\\[\\s*['"]${Se}['"]\\s*\\])`).test(se)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${Se}['"]`).test(se))A.consumedProps?.add(ae)}if(A?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(se))for(let ae of A.reactiveProps){if(Su.has(ae)||A.consumedProps?.has(ae))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${ae.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(se))continue;let ue=`${M}\x00${ae}`;if(Xo.has(ue))continue;Xo.add(ue),console.warn(`[stx] ${le.basename(M)} reads \`${ae}\` with defineProps(), which is not live, but ${le.basename(u)} binds it (:${ae}): 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('${ae}').`)}let fe=new Set(["__originalFilePath","__importedComponents",Hn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),xe={};for(let[ae,ue]of Object.entries(a))if(!ae.startsWith("__")||fe.has(ae))xe[ae]=ue;let ge=v.length>0?{[Gn]:[...v]}:{},Pe=n;if(n.includes("@include")){let{processIncludes:ae}=await o("stx/includes",()=>import("./chunk-dst4twmx.js"));Pe=await ae(n,a,u,l,x)}if(/<[A-Z][\w.-]*[\s/>]/.test(Pe)){let{processComponents:ae}=await o("stx/component-renderer",()=>import("./chunk-w3n2jpk5.js")),ue={...a,__processedComponents:O,...ge};Pe=await ae(Pe,ue,u,l,x);let Se=ue.__stx_preserved_client_expressions;if(Array.isArray(Se)&&Se.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Se])]}let Ke=[];if(ll(Pe)){let{processExpressions:ae}=await o("stx/expressions",()=>import("./chunk-34mx6czk.js")),ue=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...ge}:v.length>0?{...a,...ge}:a;Pe=ae(Pe,ue,u);for(let Se of Pe.matchAll(/\{\{([\s\S]*?)\}\}/g))Ke.push(Se[1].trim())}let Ae=ee(Pe),Je=[],et=Ae.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(ae,ue)=>{let Se=Ae.scripts[Number(ue)]||"",he=Se.match(/^<script\b([^>]*)>/i)?.[1]||"",Ge=he.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Ie=!Ge||["module","text/javascript","application/javascript"].includes(Ge),xt=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${he}`);if(!/\bserver\b/i.test(he)&&Ie&&!xt)return Je.push(Se),"";return Se}),{extractSlotContent:Ye}=await o("stx/slots",()=>import("./chunk-ymmcv5g3.js")),it=Ye(et),nt={};if(it.defaultSlot?.trim())nt.default=it.defaultSlot;for(let[ae,ue]of it.namedSlots)nt[ae]=ue.content;let St=a.__stx_scope_seq??={n:0,key:Js(String(a.__filename??u))},Ht=Yo(e,process.cwd()),pt=`stx_${(Ht.endsWith(".stx")?Ht.slice(0,-4):Ht).replace(/[^a-zA-Z0-9]/g,"_")}_${++St.n}_${St.key}`,De={...xe,$uid:pt,$native:l._nativeHostAttrs===!0,...t,props:t,slot:et,$slots:nt,__processedComponents:z,__sections:{},__stx_signals_gate:Te(se)||ll(n),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Ke]};if(/import\s/.test(se)){De.__importedComponents=new Map(De.__importedComponents);let{processESImports:ae}=await o("stx/component-renderer",()=>import("./chunk-w3n2jpk5.js"));se=await ae(se,De,M,l,x)}yu(se,De);let qt=se,dn=L(qt);if(dn)qt=dn.content.trim();let as=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Zt=[...se.matchAll(as)];for(let[,ae,ue]of Zt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(ae))je(ue,M,l.strict);let st=[],Kt=null,cs=Zt.some((ae)=>/\bserver\b/.test(ae[1]||"")&&/\bcache\b/.test(ae[1]||"")),Ct=null,dt=null,Xt=null,gn=0,Jt=null;if(pu(l),cs&&dr>0){let ae=du({props:t,slot:Pe,slotContext:n.trim()?gu(xe):void 0,buildMode:l.buildMode??"",skipEventDirectives:l.skipEventDirectives===!0,native:l._nativeHostAttrs===!0,clientLoopNames:[...v].sort(),layers:l._layerGraph?.layers.map((ue)=>ue.configFile),uid:pt});if(ae!==null){Ct=`${M}\x00${_(se)}\x00${ae}`;let ue=rs.get(Ct);if(ue){for(let Se of ue.dependencies)x.add(Se);if(pi(a,ue.clientFactories),St.n+=ue.uidsConsumed,ue.preservedClientExpressions.length>0){let Se=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let he of ue.preservedClientExpressions)Se.add(he);a.__stx_preserved_client_expressions=[...Se]}return ue.output}dt=new Set(x),Xt=li(a),gn=St.n,Jt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Gt=new Set;for(let ae of Zt){let ue=ae[1]||"",Se=ae[2]||"",he=ue.includes("server");if(Ve(ue)&&Se.trim())Se=Ue(Se);if(he&&Se){for(let Ie of Fe(Se))Gt.add(Ie);try{await U(Se,De,M,{onFailure:(Ie)=>{if(Ie.kind!=="unknown")Kt=Ie.kind}})}catch(Ie){}}if(!he){let Ie=Se.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),xt=Ie.includes("{{")&&Ie.includes("}}"),Rt=Ie.includes("{!!")&&Ie.includes("!!}");if(xt||Rt)Ie=Ri(Ie,De,M);let _t=ue.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");st.push(`<script${_t}>${Ie}</script>`)}}let rt=ee(se).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Yt=rt?rt[1]:"",ls=rt?rt[2]:"",gt="",oe=Yt&&/\bscoped\b/i.test(Yt);if(rt)gt=`<style${Yt}>${wu(ls,De,M)}</style>`;let ce=qt;if(ce=ce.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),rt)ce=ce.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let ae=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ue=[];if(ce=ce.replace(ae,(Se,he)=>{let Ge=he.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Ge)ue.push(`<style${Ge[1]}>${Ge[2]}</style>`);return""}),ce=ce.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ue.length>0)gt=`${gt}${ue.join(`
|
|
577
|
+
`)}`}if(n&&ce.includes("{{ text || slot }}"))ce=ce.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>n);let{applySlots:me}=await o("stx/slots",()=>import("./chunk-ymmcv5g3.js")),{defaultSlot:$e,namedSlots:Oe}=it,Ne=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(et),ot=st.length>0&&Ns(ce)||l._nativeHostAttrs===!0&&st.length>0||Ne&&st.length>0||st.some((ae)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(ae)),us=(ae)=>ot?fo(ae,pt):ae,fs=new Map([...Oe].map(([ae,ue])=>[ae,{...ue,content:us(ue.content)}]));ce=await me(ce,ot?uo(us($e),pt):$e,fs,De,ot?pt:"");let mn=Ti(st),Qt=(Array.isArray(De.__stx_client_signal_names)?De.__stx_client_signal_names:[]).filter((ae)=>!Gt.has(ae));if(mn.length>0||Qt.length>0)De.__stx_client_signal_names=[...new Set([...Qt,...mn])];else delete De.__stx_client_signal_names;let en=v.filter((ae)=>!Gt.has(ae)&&!(ae in t));if(en.length>0)De[Gn]=en;let hn={...l,_rootComponentsDir:l._rootComponentsDir||l.componentsDir,componentsDir:le.dirname(M),skipSignalsRuntime:!0,skipEventDirectives:l._nativeHostAttrs===!0||ot||st.length===0,defaultLayout:void 0};De.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:yn}=await o("stx/process",()=>import("./chunk-npayn9fr.js")),mt=await yn(ce,De,M,hn,x),yt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let ae of mt.matchAll(/\{\{([\s\S]*?)\}\}/g))yt.add(ae[1].trim());if(yt.size>0)a.__stx_preserved_client_expressions=[...yt];let ht=pt,Ze=mt;if(ot){let ae="";if(Object.keys(t).length>0)try{ae=` data-stx-props="${ar(JSON.stringify(t))}"`}catch{}let ue=F?` stx-hydrate="${ar(F)}"`:"",Se=Object.fromEntries(Object.entries(nt).map(([$t,Tt])=>[$t,Boolean(Tt)])),he=Object.keys(Se).length>0?` data-stx-slots="${ar(JSON.stringify(Se))}"`:"",Ge=` data-stx-scope="${ht}"${ae}${he}${ue}`,Ie=mt.slice(Mt(mt)),xt=/^<span(?=[\s/>])/i.test(Ie),Rt=/^<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(Ie),_t=/^<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(Ie),Rn=xt?"span":"div",ps=Rt&&l._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':_t&&l._nativeHostAttrs?' style="width:100%;height:100%"':xt||Rt?' style="display:contents"':"";Ze=Ag(mt,Ge)??`<${Rn}${Ge} data-stx-component-wrapper${ps}>${mt}</${Rn}>`;let ds=await Promise.all(st.map(async($t)=>{let Tt=$t.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Tt)return $t;let[,tn,gs]=Tt,An=Wo($t,De,M);if(An!==null)return An;let At=await vu(gs,M,l.buildMode==="compile"),In=kn(At.clientCode,ze(De)),{vendorStyleTags:Pn}=At,On=In?`function(__scopeId) {
|
|
578
578
|
${In}
|
|
579
579
|
return (${At.factoryBody})(__scopeId);
|
|
580
580
|
}`:At.factoryBody,Dn=F?null:Ts(a,On),Mn=Dn?`window.__stxComponentFactories[${JSON.stringify(Dn)}](${JSON.stringify(ht)});`:`(${On})(${JSON.stringify(ht)});`;if(F)return`${Pn}<script type="stx/island" data-stx-island="${ht}" data-stx-scoped data-stx-owner="${ht}"${tn}>${de(Mn)}</script>`;return`${Pn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${ht}"${tn}>${de(Mn)}</script>`}));if(Ze=Ze+`
|
|
581
581
|
`+ds.join(`
|
|
582
582
|
`),gt)Ze+=`
|
|
583
583
|
`+gt}else{if(gt)Ze+=`
|
|
584
|
-
`+gt;if(st.length>0){let ae=De.__stx_event_bindings||[],ue=ze(De),Se=await Promise.all(st.map(async(he)=>{let
|
|
584
|
+
`+gt;if(st.length>0){let ae=De.__stx_event_bindings||[],ue=ze(De),Se=await Promise.all(st.map(async(he)=>{let Ge=Wo(he,De,M);if(Ge!==null)return Ge;let Ie=he.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Ie)return he;return await He(Ie[1],{eventBindings:ae,templateContent:Ze,filePath:M,projectRoot:process.cwd(),serverData:ue,instanceId:pt})}));Ze+=`
|
|
585
585
|
`+Se.join(`
|
|
586
|
-
`),De.__stx_event_bindings=[]}}if(oe){let ae=qs(Ze,M);if(ae.hasScoped)Ze=ae.html}if(Ct&&dt){let ae=Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[];rs.set(Ct,{output:Ze,dependencies:[...x].filter((ue)=>!dt.has(ue)),clientFactories:Xt?ui(a,Xt):[],uidsConsumed:St.n-gn,preservedClientExpressions:Jt?ae.filter((ue)=>!Jt.has(ue)):[]})}if(Kt)Ze=`<!--stx-render-failed:${Kt}-->${Ze}`;return
|
|
587
|
-
${
|
|
586
|
+
`),De.__stx_event_bindings=[]}}if(oe){let ae=qs(Ze,M);if(ae.hasScoped)Ze=ae.html}if(Ct&&dt){let ae=Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[];rs.set(Ct,{output:Ze,dependencies:[...x].filter((ue)=>!dt.has(ue)),clientFactories:Xt?ui(a,Xt):[],uidsConsumed:St.n-gn,preservedClientExpressions:Jt?ae.filter((ue)=>!Jt.has(ue)):[]})}if(Kt)Ze=`<!--stx-render-failed:${Kt}-->${Ze}`;return Je.length>0?`${Ze}
|
|
587
|
+
${Je.join(`
|
|
588
588
|
`)}`:Ze}catch(q){if(q instanceof Y)throw q;return`[Error processing component: ${q instanceof Error?q.message:String(q)}]`}finally{O.delete(e)}}async function s(e){return Bun.file(e).exists()}function gr(e,t){let n=le.resolve(t),i=le.resolve(e),a=n.endsWith(le.sep)?n:n+le.sep;if(i===n||i.startsWith(a))return i;return null}async function Jo(e,t,n,i){let a=t.startsWith("layouts/")?t.slice(8):t,u=le.join(e,a);for(let l of u.endsWith(".stx")?[u]:[u,`${u}.stx`])if(await s(l)){if(i)console.log(`Found layout in ${e}: ${l}`);return n?.add(l),l}return null}async function _n(e,t,n,i){let a=await $u(e,t,n,i);if(a===null)return null;let u=gr(a,process.cwd());if(u)return u;let l=[n.root,n.layoutsDir,n.fallbackLayoutsDir,n.componentsDir,n.partialsDir,n.pagesDir,...n._layerLayoutDirs??[]].filter((f)=>typeof f==="string"&&f.length>0);for(let f of l){let x=le.isAbsolute(f)?f:le.resolve(process.cwd(),f);if(gr(a,x))return le.resolve(a)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${a} (template: ${e}, from: ${t})`),null}async function $u(e,t,n,i){if(n.debug)console.log(`Resolving template path: ${e} from ${t}`);let a=le.dirname(t),u=process.cwd();if(e.startsWith("/")){let O=le.join(u,e),z=gr(O,u);if(!z)return console.warn(`[stx] rejected template path that escapes project root: ${e} (from ${t})`),null;if(n.debug)console.log(`Checking absolute path: ${z}`);if(await s(z)&&i)i.add(z);return z}let l=async(O)=>{if(!n.layoutsDir||!n.fallbackLayoutsDir)return O;let z=le.relative(le.resolve(u,n.fallbackLayoutsDir),O);if(z.startsWith("..")||le.isAbsolute(z))return O;return await Jo(le.resolve(u,n.layoutsDir),e,i,n.debug)??O},f=le.join(a,e);if(await s(f)){if(n.debug)console.log(`Found direct path: ${f}`);let O=await l(f);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 z=`${f}${O}`;if(await s(z)){if(n.debug)console.log(`Found direct path with extension: ${z}`);let V=await l(z);if(i)i.add(V);return V}}let x=[];if(x.push(...n._layerLayoutDirs??[]),n.layoutsDir)x.push(le.isAbsolute(n.layoutsDir)?n.layoutsDir:le.resolve(process.cwd(),n.layoutsDir));let v=le.resolve(a),A=process.cwd();for(let O=0;O<10;O++){let z=le.join(v,"layouts"),V=!1;try{V=is.statSync(z,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(V){x.push(z);break}let F=le.dirname(v);if(F===v||F.length<A.length)break;v=F}for(let O of x){let z=await Jo(O,e,i,n.debug);if(z)return z}if(n.fallbackLayoutsDir){let O=le.isAbsolute(n.fallbackLayoutsDir)?n.fallbackLayoutsDir:le.resolve(process.cwd(),n.fallbackLayoutsDir),z=e.startsWith("layouts/")?e.slice(8):e,V=[le.join(O,z)];if(!e.endsWith(".stx"))V.push(`${V[0]}.stx`);for(let F of V)if(await s(F)){if(n.debug)console.log(`Found in options.fallbackLayoutsDir: ${F}`);if(i)i.add(F);return F}}if(e.startsWith("layouts/")||e.includes("/layouts/")){let O=e.split("layouts/"),z=le.join(n.partialsDir||a,"layouts",O[1]);if(await s(z)){if(n.debug)console.log(`Found in layouts path: ${z}`);if(i)i.add(z);return z}if(!z.endsWith(".stx")){let V=`${z}.stx`;if(await s(V)){if(n.debug)console.log(`Found in layouts path with extension: ${V}`);if(i)i.add(V);return V}}}if(n.partialsDir){let O=le.join(n.partialsDir,"layouts");if(await s(O)){let z=le.join(O,e);if(await s(z)){if(n.debug)console.log(`Found in partials layouts dir: ${z}`);if(i)i.add(z);return z}if(!e.endsWith(".stx")){let V=`${z}.stx`;if(await s(V)){if(n.debug)console.log(`Found in partials layouts dir with extension: ${V}`);if(i)i.add(V);return V}}}}let D=n.partialsDir||le.join(process.cwd(),"views"),U=le.join(D,e);if(await s(U)){if(n.debug)console.log(`Found in views path: ${U}`);if(i)i.add(U);return U}if(!e.endsWith(".stx")){let O=`${U}.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=le.join(le.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 z=`${O}.stx`;if(await s(z)){if(n.debug)console.log(`Found in temp layouts dir with extension: ${z}`);if(i)i.add(z);return z}}}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 dl(e,t,n){let i=0,a="",u="";try{if(typeof t==="number"&&t>=0){let l=e.split(`
|
|
589
589
|
`),f=0;for(let x=0;x<l.length;x++)if(f+=l[x].length+1,f>=t){i=x+1,a=l[x].trim();let v=Math.max(0,x-2),A=Math.min(l.length,x+3);u=l.slice(v,A).map((D,U)=>{let O=v+U+1;return`${O===i?"> ":" "}${O}: ${D}`}).join(`
|
|
590
590
|
`);break}}else if(n){let l=e.indexOf(n);if(l>=0)return dl(e,l)}}catch{}return{lineNumber:i,lineContent:a,context:u}}var ke={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"};function y(e,t,n,i,a,u){let{lineNumber:l,context:f}=dl(i,a,u),x=n.split("/").pop(),v=0;if(typeof a==="number"&&a>=0&&i){let D=i.lastIndexOf(`
|
|
@@ -600,7 +600,7 @@ ${ke.yellow}${ke.bold}Message:${ke.reset} ${t}
|
|
|
600
600
|
`,f)A+=`
|
|
601
601
|
${ke.blue}${ke.bold}Context:${ke.reset}
|
|
602
602
|
${ke.dim}${f}${ke.reset}
|
|
603
|
-
`;return A}function be(){fn.clear(),lr.clear(),ss.clear(),ur.clear(),fr.clear(),pr.clear(),rs.clear()}function gy(){return{size:fn.size,maxSize:500}}var cr=S(128);async function vu(e,t,n){let i=_(e,t,n),a=cr.get(i);if(a){if(Vs(a.deps))return a;cr.delete(i)}let u=Ci(e,{filePath:t,projectRoot:process.cwd()}),l=u.code,f=Ei(u.styles);l=zt(l).code;let{hasUserImports:x,bundleClientScript:v}=await o("stx/client-script-bundler",()=>import("./chunk-
|
|
603
|
+
`;return A}function be(){fn.clear(),lr.clear(),ss.clear(),ur.clear(),fr.clear(),pr.clear(),rs.clear()}function gy(){return{size:fn.size,maxSize:500}}var cr=S(128);async function vu(e,t,n){let i=_(e,t,n),a=cr.get(i);if(a){if(Vs(a.deps))return a;cr.delete(i)}let u=Ci(e,{filePath:t,projectRoot:process.cwd()}),l=u.code,f=Ei(u.styles);l=zt(l).code;let{hasUserImports:x,bundleClientScript:v}=await o("stx/client-script-bundler",()=>import("./chunk-sghbhdtj.js")),A=[],D=!1;if(x(l)){let H=l;l=await v(H,t,{projectRoot:process.cwd(),minify:n,collectInputs:A}),D=l===H}let{stripStxRuntimeImports:U}=await o("stx/signal-processing",()=>import("./chunk-2pt2feg2.js"));l=U(l);let O=N(l),z=hu(O),V=new Set(K(O,!0).split(",").map((H)=>H.trim())),F=`function(__scopeId) {
|
|
604
604
|
${ft("const",[..._l,...z],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
|
}`,q={vendorStyleTags:f,factoryBody:F,clientCode:O,deps:Cr([...A,...u.styles.map((H)=>H.resolvedPath)])};if(!D&&u.unresolved.length===0)cr.set(i,q);return q}var Sn=["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 Eu=100,ku=599,hr="__stxResponseStatus",pn="__stxResponseHeaders";function os(e){return typeof e==="number"&&Number.isInteger(e)&&e>=Eu&&e<=ku}function vn(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(os(i))return i}return}function mr(e,t){if(!e||typeof e!=="object")return!1;let n=typeof t==="string"&&/^\d+$/.test(t.trim())?Number(t.trim()):t;if(!os(n))return!1;return e[hr]=n,!0}function Cu(e,t,n){if(!e||typeof e!=="object")return;let i=String(t??"").trim();if(!i)return;e[pn]={...e[pn],[i]:String(n)}}function Bt(e){let t=e?.[hr];return os(t)?t:void 0}function Ft(e){let t=e?.[pn];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 Yc(e,t){if(!e||!t||e===t||typeof t!=="object")return;let n=Bt(e);if(n!==void 0)t[hr]=n;let i=Ft(e);if(i)t[pn]={...t[pn],...i}}function Ks(e){return{setResponseStatus:(t)=>{mr(e,t)},notFound:(t=404)=>{let n=os(t)&&t>=400?t:404;mr(e,n)},setResponseHeader:(t,n)=>{Cu(e,t,n)}}}function Zc(e,t,n={}){if(!e.includes("@status"))return e;let{filePath:i,buildMode:a}=n,u=a==="compile",l="",f=0,x=/@status\s*\(/g,v;while((v=x.exec(e))!==null){let A=Ru(e,v.index+v[0].length-1);if(A<0)break;let D=e.slice(v.index+v[0].length,A).trim(),U=/^\d+$/.test(D)?Number(D):d(D,t),O=i?` in ${i}`:"";if(u)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(!mr(t,U))console.warn(`[stx] @status(${D})${O} is not an HTTP status (100-599) \u2014 ignoring it.`);l+=e.slice(f,v.index),f=A+1+(e.slice(A+1).match(/^[^\S\n]*\n?/)?.[0].length??0),x.lastIndex=f}return f===0?e:l+e.slice(f)}function Ru(e,t){let n=1,i=null,a=!1;for(let u=t+1;u<e.length;u++){let l=e[u];if(a){a=!1;continue}if(i){if(l==="\\")a=!0;else if(l===i)i=null;continue}if(l==='"'||l==="'"||l==="`"){i=l;continue}if(l==="(")n++;else if(l===")"&&--n===0)return u}return-1}var ta=new Set(Sn),Tu=new Set(["props","$props","defineProps"]),Au=new Set(["stx","@stacksjs/stx"]),na=S(128),sa=S(64);function Iu(e){let t=[],n=0,i=e.split(`
|
|
693
693
|
`);for(let a of i){let u=n,l=null,f=!1;for(let x=0;x<a.length;x++){let v=a[x];if(f){f=!1;continue}if(v==="\\"){f=!0;continue}if(l){if(v===l)l=null;continue}if(v==="'"||v==='"'||v==="`"){l=v;continue}if(v==="/"&&x+1<a.length&&a[x+1]==="/")break;if(v==="{")n++;else if(v==="}")n--}if(u===0){let x=a.match(/(?:const|let|var)\s+(\w+)\s*=/);if(x)t.push(x[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(a)){let v=a.match(/(?:const|let|var)\s+(\w+)/);if(v)t.push(v[1])}else{let v=a.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(v){let D=v[1].slice(1,-1).split(",").map((U)=>{let O=U.split(":");return(O.length>1?O[1]:O[0]).trim()}).filter((U)=>/^\w+$/.test(U));t.push(...D)}}}}return[...new Set(t)]}function mg(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=[],u="",l=0,f=0,x=null;for(let v=0;v<i.length;v++){let A=i[v];if(x){if(u+=A,A===x)x=null;continue}if(A==='"'||A==="'"||A==="`"){x=A,u+=A;continue}if(A==="<")l++;else if(A===">"&&l>0)l--;else if(A==="(")f++;else if(A===")")f--;if(A===","&&l===0&&f===0){a.push(u),u="";continue}u+=A}if(u)a.push(u);return a.map((v)=>{let A=v.trim(),D=A.startsWith("..."),U=D?A.slice(3):A,O=-1,z=0;for(let ie=0;ie<U.length;ie++)if(U[ie]==="<")z++;else if(U[ie]===">")z--;else if(U[ie]===":"&&z===0){O=ie;break}if(O===-1)return v;let F=U.substring(0,O).trim().replace(/\?$/,""),q=U.substring(O+1),H=-1,M=0;for(let ie=0;ie<q.length;ie++)if(q[ie]==="<")M++;else if(q[ie]===">")M--;else if(q[ie]==="="&&M===0){H=ie;break}let Q=D?"...":"";if(H!==-1)return`${Q}${F} = ${q.substring(H+1).trim()}`;return`${Q}${F}`}).join(", ")}t=t.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(i,a,u)=>{if(!u.includes(":"))return i;return`${a}(${n(u)})`});{let i=/\b(function\s+\w*\s*)\(/g,a,u=[];while((a=i.exec(t))!==null){let l=a.index+a[0].length-1,f=1,x=l+1,v=0,A=null;while(x<t.length&&f>0){let O=t[x];if(A){if(O===A)A=null;x++;continue}if(O==='"'||O==="'"||O==="`"){A=O,x++;continue}if(O==="<")v++;else if(O===">"&&v>0)v--;else if(v===0){if(O==="(")f++;else if(O===")")f--}if(f>0)x++}if(f!==0)continue;let D=t.substring(l+1,x);if(!D.includes(":"))continue;let U=n(D);u.push({start:l+1,end:x,replacement:U})}for(let l=u.length-1;l>=0;l--){let{start:f,end:x,replacement:v}=u[l];t=t.substring(0,f)+v+t.substring(x)}}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((l)=>{let[f,...x]=l.split("="),v=f.split(":")[0].trim();if(x.length>0)return`${v} = ${x.join("=").trim()}`;return v}).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 hg(e){return e.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(t,...n)=>{let[,i,a]=n,u=i??a;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(u)?"":t})}function yg(e){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(e)}function bg(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 wg(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 ra=new Set;async function h(e,t,n,i={}){if(!e.trim())return;let a=T(),u=_(e,JSON.stringify(a)),l=na.get(u);if(l===void 0){try{let oe=ne({loader:"ts",target:"browser",define:a}),ce=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");ce=ce.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),l=oe.transformSync(ce)}catch{l=mg(e)}na.set(u,l)}let f={exports:{}},x=f.exports,v=Vt.cwd(),A={},D=[...l.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((oe)=>oe[1]).filter((oe)=>!oe.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(oe)),U=new Map;for(let oe of D)try{if(oe.startsWith(".")){A[oe]=await import(ut.resolve(ut.dirname(n),oe));continue}let ce=ut.resolve(v,"node_modules",oe),me=ut.join(ce,"package.json"),$e=JSON.parse(b("fs").readFileSync(me,"utf8")),Oe=$e.main||"index.js";if($e.exports){let Ne=typeof $e.exports==="string"?$e.exports:$e.exports["."];if(typeof Ne==="string")Oe=Ne;else if(Ne?.bun)Oe=Ne.bun;else if(Ne?.import)Oe=Ne.import;else if(Ne?.default)Oe=Ne.default}A[oe]=await import(ut.resolve(ce,Oe))}catch(ce){if(oe.startsWith("."))U.set(oe,ce instanceof Error?ce.message:String(ce))}let O=(oe)=>{if(A[oe])return A[oe];let ce=U.get(oe);if(ce!==void 0)throw Error(`Cannot require '${oe}' from ${n}: ${ce}`);return b(oe)},z=t.props||{},V=(oe)=>{if(!oe)return z;let ce={};for(let[me,$e]of Object.entries(oe)){let Oe=z[me];if(Oe!==void 0)ce[me]=Oe;else if(typeof $e==="function")ce[me]=$e();else ce[me]=$e}return ce};for(let[oe,ce]of Object.entries(z))Object.defineProperty(V,oe,{value:ce,enumerable:!0,configurable:!0,writable:!0});let F=(oe,ce=!1)=>{if(oe===void 0||oe===null)return ce;if(typeof oe==="string"){let me=oe.trim().toLowerCase();if(me===""||me==="true"||me==="1"||me==="on"||me==="yes")return!0;if(me==="false"||me==="0"||me==="off"||me==="no")return!1;return!0}return Boolean(oe)},q=(oe,ce=0)=>{if(oe===void 0||oe===null)return ce;if(typeof oe==="string"){let $e=oe.trim();if($e==="")return ce;let Oe=Number($e);return Number.isFinite(Oe)?Oe:ce}let me=Number(oe);return Number.isFinite(me)?me:ce};for(let oe of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(z,oe))continue;try{Object.defineProperty(V,oe,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let H=(oe)=>{if(!oe)return z;let ce={...z};for(let[me,$e]of Object.entries(oe)){let Oe=$e&&typeof $e==="object"&&!Array.isArray($e)?$e:{type:$e};if(ce[me]===void 0&&Oe.default!==void 0)ce[me]=typeof Oe.default==="function"?Oe.default():Oe.default}return ce},M=()=>t.slots||{},Q=(oe,ce)=>{let me={...oe};for(let[$e,Oe]of Object.entries(ce))if(me[$e]===void 0)if(typeof Oe==="function")me[$e]=Oe();else me[$e]=Oe;return me},ie=(oe)=>{let ce=()=>oe;return ce.set=(me)=>{},ce.update=(me)=>{},ce},se=(oe)=>{let ce,me=!1;return()=>{if(!me)try{ce=oe(),me=!0}catch{ce=void 0}return ce}},fe=(oe)=>{},xe=(oe)=>oe(),ge=(oe)=>{},Pe=(oe)=>{},Ke=Ks(t);function Ae(oe){let ce=oe||{};if(ce.title!==void 0||ce.description!==void 0)nt({title:ce.title,description:ce.description})}function
|
|
695
|
+
`),t}function hg(e){return e.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(t,...n)=>{let[,i,a]=n,u=i??a;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(u)?"":t})}function yg(e){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(e)}function bg(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 wg(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 ra=new Set;async function h(e,t,n,i={}){if(!e.trim())return;let a=T(),u=_(e,JSON.stringify(a)),l=na.get(u);if(l===void 0){try{let oe=ne({loader:"ts",target:"browser",define:a}),ce=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");ce=ce.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),l=oe.transformSync(ce)}catch{l=mg(e)}na.set(u,l)}let f={exports:{}},x=f.exports,v=Vt.cwd(),A={},D=[...l.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((oe)=>oe[1]).filter((oe)=>!oe.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(oe)),U=new Map;for(let oe of D)try{if(oe.startsWith(".")){A[oe]=await import(ut.resolve(ut.dirname(n),oe));continue}let ce=ut.resolve(v,"node_modules",oe),me=ut.join(ce,"package.json"),$e=JSON.parse(b("fs").readFileSync(me,"utf8")),Oe=$e.main||"index.js";if($e.exports){let Ne=typeof $e.exports==="string"?$e.exports:$e.exports["."];if(typeof Ne==="string")Oe=Ne;else if(Ne?.bun)Oe=Ne.bun;else if(Ne?.import)Oe=Ne.import;else if(Ne?.default)Oe=Ne.default}A[oe]=await import(ut.resolve(ce,Oe))}catch(ce){if(oe.startsWith("."))U.set(oe,ce instanceof Error?ce.message:String(ce))}let O=(oe)=>{if(A[oe])return A[oe];let ce=U.get(oe);if(ce!==void 0)throw Error(`Cannot require '${oe}' from ${n}: ${ce}`);return b(oe)},z=t.props||{},V=(oe)=>{if(!oe)return z;let ce={};for(let[me,$e]of Object.entries(oe)){let Oe=z[me];if(Oe!==void 0)ce[me]=Oe;else if(typeof $e==="function")ce[me]=$e();else ce[me]=$e}return ce};for(let[oe,ce]of Object.entries(z))Object.defineProperty(V,oe,{value:ce,enumerable:!0,configurable:!0,writable:!0});let F=(oe,ce=!1)=>{if(oe===void 0||oe===null)return ce;if(typeof oe==="string"){let me=oe.trim().toLowerCase();if(me===""||me==="true"||me==="1"||me==="on"||me==="yes")return!0;if(me==="false"||me==="0"||me==="off"||me==="no")return!1;return!0}return Boolean(oe)},q=(oe,ce=0)=>{if(oe===void 0||oe===null)return ce;if(typeof oe==="string"){let $e=oe.trim();if($e==="")return ce;let Oe=Number($e);return Number.isFinite(Oe)?Oe:ce}let me=Number(oe);return Number.isFinite(me)?me:ce};for(let oe of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(z,oe))continue;try{Object.defineProperty(V,oe,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let H=(oe)=>{if(!oe)return z;let ce={...z};for(let[me,$e]of Object.entries(oe)){let Oe=$e&&typeof $e==="object"&&!Array.isArray($e)?$e:{type:$e};if(ce[me]===void 0&&Oe.default!==void 0)ce[me]=typeof Oe.default==="function"?Oe.default():Oe.default}return ce},M=()=>t.slots||{},Q=(oe,ce)=>{let me={...oe};for(let[$e,Oe]of Object.entries(ce))if(me[$e]===void 0)if(typeof Oe==="function")me[$e]=Oe();else me[$e]=Oe;return me},ie=(oe)=>{let ce=()=>oe;return ce.set=(me)=>{},ce.update=(me)=>{},ce},se=(oe)=>{let ce,me=!1;return()=>{if(!me)try{ce=oe(),me=!0}catch{ce=void 0}return ce}},fe=(oe)=>{},xe=(oe)=>oe(),ge=(oe)=>{},Pe=(oe)=>{},Ke=Ks(t);function Ae(oe){let ce=oe||{};if(ce.title!==void 0||ce.description!==void 0)nt({title:ce.title,description:ce.description})}function Je(oe){if(!oe||typeof oe!=="object")return;let ce=t.__stxClientPayload??{};Object.assign(ce,oe),t.__stxClientPayload=ce}let et=()=>{let oe=t.__stxServeContext,ce=t.__stxServeSearch??oe?.search??"",me=oe?.path??"",$e=Object.fromEntries(new URLSearchParams(ce)),Oe=t.query,Ne=Object.keys($e).length>0?$e:Oe??{},ot=ce||(Object.keys(Ne).length>0?`?${new URLSearchParams(Ne).toString()}`:"");return{params:t.params??{},query:Ne,path:me,name:"",fullPath:me+ot,hash:"",matched:[]}},Ye=()=>({push:(oe)=>{},replace:(oe)=>{},back:()=>{},forward:()=>{},go:(oe)=>{}}),it=(oe)=>{let ce=t.__stx_runtime_head||{};t.__stx_runtime_head=Xe(ce,Re(oe||{},{known:ro,source:"useHead()"}))},nt=(oe)=>{it(so(oe||{}))},St=(oe)=>({value:oe}),Ht=(oe)=>oe,br=(oe)=>({value:typeof oe==="function"?oe():oe}),pt=(oe,ce)=>{},De=(oe)=>{},qt=(oe)=>{},dn=(oe)=>oe?oe():Promise.resolve(),as=(oe)=>(ce,...me)=>{},Zt=(oe)=>{},st=(oe,ce)=>{},Kt=(oe,ce)=>ce,cs=()=>({value:"light"}),Ct=()=>ie(!1),dt=(oe)=>ie(!1),Xt=()=>ie(!1),gn=()=>dt("(prefers-color-scheme: dark)"),Jt=()=>dt("(prefers-color-scheme: light)"),Gt=()=>dt("(prefers-reduced-motion: reduce)"),yr=()=>dt("(prefers-contrast: more)"),rt={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:{}},Yt=new Proxy(rt,{get(oe,ce){if(ce in oe)return oe[ce];return},set(oe,ce,me){return oe[ce]=me,!0}}),ls={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},gt=console;try{let oe=_i(l,n),ce=new Set(Object.keys(z)),me=Object.keys(t).filter((ae)=>!ce.has(ae)&&!Tu.has(ae)&&Ut(ae)),$e=me.map((ae)=>t[ae]);if(!me.includes("__stxServeContext"))me.push("__stxServeContext"),$e.push(void 0);if(!ce.has("cookies")){let ae=t.cookies??t.__stxServeContext?.cookies??{},ue=me.indexOf("cookies");if(ue<0)me.push("cookies"),$e.push(ae);else $e[ue]=ae}let Oe=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),Ne=[],ot=[];for(let[ae,ue]of Object.entries(z)){if(!Ut(ae))continue;if(Oe.has(ae))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${ae}\\b`).test(oe))continue;Ne.push(ae),ot.push(ue)}let fs=Iu(oe).map((ae)=>`module.exports.${ae} = typeof ${ae} !== 'undefined' ? ${ae} : module.exports.${ae};`).join(`
|
|
696
696
|
`),mn=t.params??{},Qt=[],en=[];for(let ae=0;ae<me.length;ae++){if(me[ae]==="params")continue;Qt.push(me[ae]),en.push($e[ae])}let hn=[...Sn,...Ne,...Qt],yn=`return (async () => {
|
|
697
697
|
${oe}
|
|
698
698
|
${fs}
|
|
699
699
|
return module.exports
|
|
700
|
-
})()`,mt=_(yn,hn.join("\x00")),yt=sa.get(mt);if(!yt)yt=Function(...hn,yn),sa.set(mt,yt);let ht=t.__stx_options?.runtimeConfig;if(ht||/\buse(?:Server)?RuntimeConfig\b/.test(l))await Tn(t,n,ht);let Ze=await qe(t.__stx_runtime_config??$n()??B(),()=>Mr(t,()=>yt(f,x,O,z,V,F,q,H,Q,
|
|
700
|
+
})()`,mt=_(yn,hn.join("\x00")),yt=sa.get(mt);if(!yt)yt=Function(...hn,yn),sa.set(mt,yt);let ht=t.__stx_options?.runtimeConfig;if(ht||/\buse(?:Server)?RuntimeConfig\b/.test(l))await Tn(t,n,ht);let Ze=await qe(t.__stx_runtime_config??$n()??B(),()=>Mr(t,()=>yt(f,x,O,z,V,F,q,H,Q,Je,jr,Ii,Zs,ie,se,fe,xe,ge,Pe,Ae,et,Ye,it,nt,Ke.setResponseStatus,Ke.setResponseHeader,Ke.notFound,St,Ht,br,pt,De,qt,dn,as,Zt,M,st,Kt,cs,Ct,dt,Xt,gn,Jt,Gt,yr,Yt,ls,gt,rt.confirm,rt.alert,rt.fetch,mn,...ot,...en)));if(i.preserveExisting){for(let[ae,ue]of Object.entries(Ze))if(!(ae in t)||t[ae]===void 0)t[ae]=ue}else Object.assign(t,Ze);for(let[ae,ue]of Object.entries(z))if(!(ae in t))t[ae]=ue}catch(oe){if(t.__stx_strict_hydration)throw oe;let ce=hg(oe instanceof Error?oe.message:String(oe));if(yg(ce))console.warn(`[stx] server <script> in ${n??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${ce}`),i.onFailure?.({kind:"module-resolution",message:ce,error:oe});else if(bg(oe))console.warn(`[stx] server <script> in ${n??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${ce}`),i.onFailure?.({kind:"syntax",message:ce,error:oe});else if(wg(ce))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: ${ce}`),i.onFailure?.({kind:"missing-binding",message:ce,error:oe});else{let me=`${n??"<unknown>"}\x00${ce}`;if(Vt.env.STX_DEBUG||!ra.has(me))ra.add(me),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: ${ce}`);i.onFailure?.({kind:"unknown",message:ce,error:oe})}try{await Nu(l,t,n)}catch(me){if(Vt.env.STX_DEBUG){let $e=me instanceof Error?me.message:String(me);console.warn(`[stx] fallback extraction also failed in ${n??"<unknown>"}: ${$e}`)}}}}function vg(e){let t=0,n=null,i=!1,a=!1;for(let u=0;u<e.length;u++){let l=e[u];if(n){if(l===n){if(n=null,i||t===0)a=!0}continue}if(l==="'"||l==='"'||l==="`"){n=l;continue}if(l==="{")t++;else if(l==="}")t--;else if(e.startsWith("from",u)&&t===0)i=!0}return n===null&&t===0&&a}var Pu=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function _i(e,t){let n=t?ut.dirname(t):Vt.cwd(),i=Vt.cwd(),a=e.split(`
|
|
701
701
|
`),u=[],l=0;while(l<a.length){let f=a[l].trim();if(f.startsWith("interface ")||f.startsWith("export interface ")||f.startsWith("type ")||f.startsWith("export type ")){if(f.includes("{")&&!f.includes("}")){let x=0;for(;l<a.length;l++){for(let v of a[l])if(v==="{")x++;else if(v==="}")x--;if(x<=0)break}}l++;continue}if(f.startsWith("definePageMeta(")){let x=0,v=!1,A=l;for(let O=l;O<a.length&&!v;O++){let z=null,V=!1,F=a[O];for(let q=0;q<F.length;q++){let H=F[q];if(V){V=!1;continue}if(H==="\\"){V=!0;continue}if(z){if(H===z)z=null;continue}if(H==='"'||H==="'"||H==="`"){z=H;continue}if(H==="(")x++;else if(H===")"){if(x--,x===0){l=O+1,v=!0;break}}}}if(!v)l=a.length;let D=a.slice(A,l).join(`
|
|
702
702
|
`),U=[];for(let O of["title","description"]){let z=new RegExp(`\\b${O}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(D);if(z)U.push(`${O}: ${JSON.stringify(z[2])}`)}if(U.length>0)u.push(`useSeoMeta({ ${U.join(", ")} });`);continue}if(f.startsWith("import ")||f==="import"||f.startsWith("import{")||/^import['"]/.test(f)){let x=f,v=0;while(!vg(x)&&l+v+1<a.length)v++,x=`${x} ${a[l+v].trim()}`;l+=v;let A=x.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),D=x.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),U=x.match(/^import\s*['"](.+?)['"]/),O=x,z=(V)=>{if(V.startsWith("."))return ut.resolve(n,V);if(V.startsWith("~/")||V.startsWith("@/"))return ut.resolve(i,V.slice(2));try{return Bun.resolveSync(V,n)}catch{return V}};if(A){let[,V,F]=A,q=z(F);u.push(`const ${V} = (await import('${q}')).default`),u.push(`module.exports.${V} = ${V};`)}else if(D){let[,V,F]=D,q=z(F),H=[],M=[],Q=Au.has(F);for(let ie of V.split(",")){let se=ie.trim();if(!se)continue;let fe=se.split(/\s+as\s+/);if(fe.length===2){let[xe,ge]=[fe[0].trim(),fe[1].trim()];if(Q&&ta.has(xe)){u.push(`const ${ge} = ${xe};`);continue}H.push(`${xe}: ${ge}`),M.push(ge)}else{if(Q&&ta.has(se))continue;H.push(se),M.push(se)}}if(H.length>0)u.push(`const { ${H.join(", ")} } = await import('${q}')`);for(let ie of M)u.push(`module.exports.${ie} = ${ie};`)}else if(U){let V=z(U[1]);u.push(`await import('${V}')`)}else u.push(O);l++;continue}if(Pu.test(f))u.push(a[l]),l++;else if(f.startsWith("export const ")||f.startsWith("export let ")||f.startsWith("export var ")){let x=oa(a,l),{type:v,name:A,value:D}=x;u.push(`${v} ${A} = ${D};`),u.push(`module.exports.${A} = ${A};`),l=x.nextIndex}else if(f.startsWith("export function ")||f.startsWith("export async function ")){let x=xr(a,l);u.push(x.functionCode),u.push(`module.exports.${x.name} = ${x.name};`),l=x.nextIndex}else if(f.startsWith("const ")||f.startsWith("let ")||f.startsWith("var ")){let x=oa(a,l),{type:v,name:A,value:D}=x;u.push(`${v} ${A} = ${D};`),u.push(`module.exports.${A} = ${A};`),l=x.nextIndex}else if(f.startsWith("function ")||f.startsWith("async function ")){let x=xr(a,l);u.push(x.functionCode),u.push(`module.exports.${x.name} = ${x.name};`),l=x.nextIndex}else if(f.startsWith("export default function ")||f.startsWith("export default async function ")){let x=a[l].replace(/^(\s*)export\s+default\s+/,"$1"),v=[...a];v[l]=x;let A=xr(v,l);if(u.push(A.functionCode),A.name)u.push(`module.exports.default = ${A.name};`);l=A.nextIndex}else if(f.startsWith("export default ")){let x=f.replace(/^export\s+default\s+/,"").replace(/;$/,"");u.push(`module.exports.default = ${x};`),l++}else if(f.startsWith("class ")||f.startsWith("export class ")){let x=f.match(/(?:export\s+)?class\s+(\w+)/);if(x){let v=x[1],A=a[l].replace(/^export\s+/,""),D=0,U=l;for(;U<a.length;U++){let O=a[U];for(let z of O)if(z==="{")D++;else if(z==="}")D--;if(U>l)A+=`
|
|
703
703
|
`+O;if(D<=0&&U>=l)break}u.push(A),u.push(`module.exports.${v} = ${v};`),l=U+1}else u.push(f),l++}else if(f.includes("module.exports"))u.push(f),l++;else if(f.trim()&&!f.startsWith("//"))u.push(f),l++;else l++}return Ou(u.join(`
|
|
@@ -709,4 +709,4 @@ ${e[v]}`,v++;else break}return x=x.trim().replace(/;$/,""),{type:u,name:l,value:
|
|
|
709
709
|
${u}`,a++}while(a<e.length){let u=e[a].trim();if(u.startsWith(".")||u.startsWith("?."))i+=`
|
|
710
710
|
${e[a]}`,a++;else break}return{value:i,nextIndex:a}}function ju(e,t,n){let i=n,a=t+1;while(a<e.length){let u=da(i);if(u!==-1){if(k(i,"{","}",u)!==-1)break}let l=e[a];i+=`
|
|
711
711
|
${l}`,a++}return{functionCode:i,nextIndex:a}}function la(e,t){let n=d(e,t)??d(`(${e})`,t);if(n!==void 0)return n;if(!/\bprocess\b/.test(e))return;let i={...t,process:Object.freeze({env:{...Vt.env}})},a=Object.keys(i).filter(Ut),u=a.map((l)=>i[l]);try{return Function(...a,`'use strict'; return (${e});`)(...u)}catch{try{return Function(...a,`'use strict'; return ${e};`)(...u)}catch{return}}}async function Nu(e,t,n){let i=e.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let u of i){let[,,l,f]=u;try{let x=f.trim().replace(/;$/,""),v=la(x,t);if(v!==void 0)t[l]=v}catch(x){console.warn(`Failed to parse export ${l} in fallback:`,x)}}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 u of a){let[,,l,f]=u;if(!(l in t))try{let x=f.trim().replace(/;$/,""),v=la(x,t);if(v!==void 0)t[l]=v}catch{}}}function ol(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 il(e){let t=e.trim();if(!t)return!1;return/(?:const|let|var|function)\s+\w+/.test(t)}
|
|
712
|
-
export{Me,Ce,K,js,Bs,
|
|
712
|
+
export{Me,Ce,K,js,Bs,X,_r,Fs,zs,fi,gi,mi,Hs,hi,Hc,Dt,Le,o,de,S,Vc,_,Cr,Vs,Ee,T,je,L,Mt,Lt,J,bn,Be,w,Uc,ye,ee,Er,Tr,$r,pe,jt,te,j,ct,Rr,Ar,lt,yi,Us,gg,Fe,Wc,qc,bi,Kc,wi,Xc,Ws,vi,Gc,Jc,xi,Si,wn,qs,vn,Bt,Ft,Yc,Ks,Zc,Qc,xn,Pr,Xs,Gs,el,ki,tl,nl,rl,sl,Sn,mg,hg,yg,bg,wg,h,vg,_i,xg,ol,il,Ci,Ei,Sg,zt,al,kg,cl,fy,ze,kn,He,_g,Cg,Eg,Tg,$g,Js,Rg,Ve,ne,Ue,Ag,Ir,Pg,ll,ul,Ti,We,s,_n,dl,y,be,gy,pl,fl,gl,$i,Ys,Ig,my,Og,hy,Cn,g,G,re,En,Te,Ng,Ri,Dg,yy,R,Ai,Mg,by,I,wy};
|