@stacksjs/stx 0.2.867 → 0.2.869
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/app-shell.js +5 -4
- package/dist/chunk-05dtat6q.js +2 -0
- package/dist/{chunk-gxqcnn5r.js → chunk-05qpze12.js} +1 -1
- package/dist/{chunk-rnvw07ca.js → chunk-095cn3p0.js} +26 -26
- package/dist/chunk-0snga2v8.js +2 -0
- package/dist/{chunk-g0xn80gz.js → chunk-0tyyad6q.js} +9 -9
- package/dist/chunk-0xqefkqr.js +2 -0
- package/dist/{chunk-67dgp45w.js → chunk-1dt8e7ew.js} +2 -2
- package/dist/chunk-1t8tkryw.js +2 -0
- package/dist/{chunk-mzr29qkj.js → chunk-2wa1keyw.js} +1 -1
- package/dist/{chunk-5dvkphbe.js → chunk-311mrz2n.js} +1 -1
- package/dist/chunk-3eqa6hnx.js +2 -0
- package/dist/{chunk-z512gt4v.js → chunk-3f51tn2b.js} +3 -3
- package/dist/{chunk-8s6s6nd0.js → chunk-4068rmzv.js} +2 -2
- package/dist/chunk-4math14x.js +2 -0
- package/dist/{chunk-8arfg8kp.js → chunk-4vtw6f0c.js} +1 -1
- package/dist/{chunk-5kkq2eqr.js → chunk-5d0csn7w.js} +1 -1
- package/dist/chunk-5debppk8.js +2 -0
- package/dist/{chunk-3nyh76r3.js → chunk-5f9z82xp.js} +2 -2
- package/dist/{chunk-vvzys1x7.js → chunk-5h9d6jew.js} +3 -3
- package/dist/{chunk-qx8czb2j.js → chunk-5qk506kn.js} +1 -1
- package/dist/{chunk-h65shwe9.js → chunk-5sbtbfj3.js} +1 -1
- package/dist/{chunk-k32q90b2.js → chunk-60yppcbb.js} +2 -2
- package/dist/{chunk-eafqxbr0.js → chunk-6ggme8xx.js} +1 -1
- package/dist/{chunk-fmzyrg2e.js → chunk-6ksyrmpp.js} +1 -1
- package/dist/{chunk-x64afx6z.js → chunk-6mjd3pqd.js} +1 -1
- package/dist/{chunk-6k4ac74t.js → chunk-6vgr5g6d.js} +2 -2
- package/dist/{chunk-a76dtc8w.js → chunk-73vtvzb1.js} +1 -1
- package/dist/{chunk-xebx3ryb.js → chunk-7vc8b7c5.js} +1 -1
- package/dist/{chunk-6c5g6sv6.js → chunk-81kk8dnr.js} +1 -1
- package/dist/chunk-8veysx0v.js +2 -0
- package/dist/{chunk-k15hxcgs.js → chunk-9fk02w6v.js} +3 -3
- package/dist/{chunk-kandgxsh.js → chunk-9mkv1se7.js} +1 -1
- package/dist/{chunk-1vwgddct.js → chunk-9rjr7hvf.js} +1 -1
- package/dist/chunk-a9y9ghm2.js +2 -0
- package/dist/chunk-ac5sa72c.js +2 -0
- package/dist/{chunk-enxzwz0j.js → chunk-ajy9tjct.js} +2 -2
- package/dist/{chunk-jn335zs0.js → chunk-akv760py.js} +1 -1
- package/dist/{chunk-ea5pm30m.js → chunk-bfww6qxt.js} +1 -1
- package/dist/chunk-bv6rx5w4.js +2 -0
- package/dist/{chunk-efywv35k.js → chunk-cvpbgf6h.js} +1 -1
- package/dist/{chunk-1mmyxay3.js → chunk-d2m57nd1.js} +1 -1
- package/dist/{chunk-mcnwvh06.js → chunk-d9k8j44b.js} +5 -5
- package/dist/chunk-djdganvr.js +2 -0
- package/dist/{chunk-kh6njq2r.js → chunk-dy7vqv1x.js} +2 -2
- package/dist/chunk-f3d1y318.js +33 -0
- package/dist/chunk-f64wbr0j.js +2 -0
- package/dist/{chunk-b3wc86ez.js → chunk-fzz251r8.js} +9 -9
- package/dist/{chunk-ynkbv9jq.js → chunk-gcsy3z1e.js} +2 -2
- package/dist/{chunk-cr0msawk.js → chunk-gj16gta9.js} +6 -6
- package/dist/{chunk-9vzeea7p.js → chunk-gk8472hq.js} +2 -2
- package/dist/{chunk-7qmr1z81.js → chunk-gxq3jnkb.js} +1 -1
- package/dist/chunk-h2r54207.js +54 -0
- package/dist/{chunk-pqjmse0r.js → chunk-h8h97bcc.js} +1 -1
- package/dist/chunk-hb6r4pxp.js +2 -0
- package/dist/{chunk-yzh9rsqp.js → chunk-hvh7v5bx.js} +4 -4
- package/dist/{chunk-jbgj2hph.js → chunk-hvx6j4a2.js} +2 -2
- package/dist/{chunk-v5kjwkz2.js → chunk-j148k8rf.js} +1 -1
- package/dist/{chunk-w6k6nkvq.js → chunk-jsyrp1n2.js} +1 -1
- package/dist/{chunk-c6rcrh48.js → chunk-k3qh0esd.js} +7 -7
- package/dist/{chunk-5tt1xbeh.js → chunk-k4dcnc4e.js} +3 -3
- package/dist/{chunk-8me8hamk.js → chunk-k7m8659h.js} +2 -2
- package/dist/chunk-kdat1ht1.js +3 -0
- package/dist/{chunk-fpya25cc.js → chunk-kgh1xsfe.js} +74 -74
- package/dist/{chunk-cjy9cdm0.js → chunk-m4k6ndf5.js} +1 -1
- package/dist/{chunk-t5jfh1bs.js → chunk-mbp7j1a7.js} +2 -2
- package/dist/{chunk-7xhwqc0c.js → chunk-mnx6njd4.js} +4 -4
- package/dist/{chunk-7fg2sj1z.js → chunk-nqz4es8a.js} +1 -1
- package/dist/chunk-nrpqrqqe.js +2 -0
- package/dist/{chunk-qbf8re0y.js → chunk-p3yesft1.js} +1 -1
- package/dist/chunk-ps6m8n9n.js +2 -0
- package/dist/{chunk-aef82ns3.js → chunk-pxce4aag.js} +1 -1
- package/dist/{chunk-v2712w9b.js → chunk-qqvj5zra.js} +1 -1
- package/dist/{chunk-d0cjw1gn.js → chunk-r3eezdg4.js} +26 -26
- package/dist/chunk-r53eeyhv.js +42 -0
- package/dist/chunk-rhhq8k9f.js +2 -0
- package/dist/{chunk-bwdbj60y.js → chunk-rpep1ve3.js} +2 -2
- package/dist/{chunk-xfvedjvb.js → chunk-s6fe2wp6.js} +1 -1
- package/dist/{chunk-83tvkw4y.js → chunk-sbvkk4cn.js} +2 -2
- package/dist/{chunk-f6ypmk8x.js → chunk-stdddhk9.js} +1 -1
- package/dist/chunk-swp254eb.js +2 -0
- package/dist/chunk-szfh1sg3.js +2 -0
- package/dist/{chunk-d60bvtmy.js → chunk-tdd3765y.js} +39 -39
- package/dist/{chunk-6m6y9bbx.js → chunk-tjwzy9xq.js} +1 -1
- package/dist/{chunk-vdj4m9z2.js → chunk-tz7b6fdz.js} +1 -1
- package/dist/{chunk-gd56arnm.js → chunk-vrcr4b13.js} +1 -1
- package/dist/{chunk-rd751nw3.js → chunk-vzq77h80.js} +1 -1
- package/dist/{chunk-0v2yj490.js → chunk-w2hqjv5e.js} +1 -1
- package/dist/{chunk-mnf4gktz.js → chunk-wcq7a5pv.js} +3 -3
- package/dist/{chunk-q13dgfe1.js → chunk-wrgaxvxy.js} +3 -3
- package/dist/{chunk-vkb353c3.js → chunk-wxggf5aq.js} +1 -1
- package/dist/{chunk-3a4tfycz.js → chunk-xsbaha1z.js} +2 -2
- package/dist/{chunk-qvjxg8yz.js → chunk-xtcba3r1.js} +2 -2
- package/dist/chunk-ympa56f9.js +2 -0
- package/dist/{chunk-64ebysb4.js → chunk-yx3vghee.js} +1 -1
- package/dist/chunk-z2t6f4gt.js +2 -0
- package/dist/{chunk-73c3awyw.js → chunk-za61jaep.js} +2 -2
- package/dist/{chunk-2v0jdfhg.js → chunk-zfj8rfv2.js} +1 -1
- package/dist/cli.js +12 -12
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/pwa.js +2 -2
- package/dist/ssg.js +3 -3
- package/package.json +5 -5
- package/dist/chunk-031dn0yr.js +0 -2
- package/dist/chunk-0twkeh31.js +0 -2
- package/dist/chunk-23zpvmw5.js +0 -2
- package/dist/chunk-2h41y75x.js +0 -2
- package/dist/chunk-3gk1e2b1.js +0 -2
- package/dist/chunk-4yhd0mg6.js +0 -2
- package/dist/chunk-66eszw4f.js +0 -2
- package/dist/chunk-6d39636b.js +0 -33
- package/dist/chunk-9cwag0tk.js +0 -2
- package/dist/chunk-acrgy1m7.js +0 -2
- package/dist/chunk-apkna83n.js +0 -2
- package/dist/chunk-bx29jsqg.js +0 -2
- package/dist/chunk-c9mkbjk5.js +0 -2
- package/dist/chunk-cwdg0v05.js +0 -2
- package/dist/chunk-cwdvmvc6.js +0 -2
- package/dist/chunk-f0kcmckh.js +0 -2
- package/dist/chunk-fkbh874c.js +0 -2
- package/dist/chunk-h1hcjx7e.js +0 -42
- package/dist/chunk-kd82s3ry.js +0 -2
- package/dist/chunk-s21bj83r.js +0 -3
- package/dist/chunk-tzey0xq2.js +0 -54
- package/dist/chunk-x5ap19jt.js +0 -2
- package/dist/chunk-xzb0w6mf.js +0 -2
- package/dist/chunk-ywp7tmyg.js +0 -2
- package/dist/chunk-z1rs6b4x.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{qe,$n,Zs,Ii,j}from"./chunk-k32q90b2.js";import{Tn}from"./chunk-pqjmse0r.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,J,U,k,ro,Re,Ge,so}from"./chunk-g0xn80gz.js";import{r,we}from"./chunk-x7redxyd.js";import{b}from"./chunk-94mpe1ny.js";import{Y}from"./chunk-bwdbj60y.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 q(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 W=z.trim();if(!W)return;let B=W.indexOf(":"),V=(B>=0?W.slice(B+1).trim():W).split(/[\s=]/)[0];if(V&&!a.has(V))i.push(V),a.add(V)});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 W=z.trim().replace(/^\.\.\./,"");if(!W)return;let B=W.split(/[\s=]/)[0];if(B&&!a.has(B))i.push(B),a.add(B)});return}if(t)return;let F=n.slice(l).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let z=F[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=q(e).split(",").map((n)=>n.trim()).filter(Boolean)){let n=new Set(q(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 q(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${n}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:n}import Ot from"fs";import ve from"path";function K(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 F=D.toLowerCase();if(!i.has(F))i.set(F,A);let O=K(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=K(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 ce 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++}`,F=[],O=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,z;while((z=O.exec(x))!==null){let[,B,H]=z,V=B.split("."),M=V[0];if(!Br.has(M))continue;F.push({attribute:`@${B}`,event:M,handler:H,modifiers:Vr(V.slice(1)),elementId:D})}let W=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((z=W.exec(x))!==null){let[,B,H]=z,V=B.split("."),M=V[0];if(!Br.has(M))continue;F.push({attribute:`@${B}`,event:M,handler:H,modifiers:Vr(V.slice(1)),elementId:D})}if(F.length>0)n.push({originalTag:l,elementId:D,events:F,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-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`
|
|
3
3
|
(function() {
|
|
4
4
|
var $el = document.getElementById('${n}');
|
|
5
5
|
if (!$el) return;
|
|
@@ -111,8 +111,8 @@ else {
|
|
|
111
111
|
${e.map(Sa).join(`
|
|
112
112
|
`)}
|
|
113
113
|
})();
|
|
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,"\\$&"),
|
|
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 B=0;B<i.length;B++){let H=i[B].text;if(["(","[","{"].includes(H))u.push(B);else if([")","]","}"].includes(H)){let V=u.at(-1);if(V!==void 0&&["()","[]","{}"].includes(i[V].text+H))u.pop(),a.set(V,B),a.set(B,V)}}function l(B,H){let V=[],M=B;for(let Z=B;Z<H;Z++){if(["(","[","{"].includes(i[Z].text)&&(a.get(Z)??H)<H){Z=a.get(Z);continue}if(i[Z].text===",")V.push([M,Z]),M=Z+1}return V.push([M,H]),V}let f=[];function x(B,H,V,M=!1){if(i[B]?.text==="...")B++;if(B>=H)return;let Z=i[B].text;if(wt.test(Z)){if(V.add(Z),V===D)f.push({name:Z,token:B,functionScoped:M});return}if(Z!=="{"&&Z!=="[")return;let re=a.get(B);if(re===void 0||re>=H)return;for(let[se,fe]of l(B+1,re)){let xe=se;if(Z==="{")for(let pe=se;pe<fe;pe++){if(i[pe].text===":"){xe=pe+1;break}if(i[pe].text==="=")break;if(["(","[","{"].includes(i[pe].text)&&a.has(pe))pe=a.get(pe)}x(xe,fe,V,M)}}function v(B,H){let V=new Set;for(let[M,Z]of l(B,H))x(M,Z,V);return V}function A(B){let H=B;for(;H<i.length;H++){let V=i[H].text;if(["(","[","{"].includes(V)&&a.has(H)){H=a.get(H);continue}if([",",";",")","]","}"].includes(V))break}return i[Math.max(B,H-1)]?.end??n.length}let D=new Set,F=[];for(let B=0;B<i.length;B++)if(i[B].text==="=>"){let H=B-1,V=H,M;if(i[H]?.text===")"&&a.has(H))V=a.get(H),M=v(V+1,H);else if(i[H]&&wt.test(i[H].text))M=new Set([i[H].text]);else continue;let Z=B+1,re=i[Z]?.text==="{"&&a.has(Z)?i[a.get(Z)].end:A(Z);F.push({start:i[V].start,end:re,bodyStart:i[Z]?.start??re,functionBody:!0,names:M})}else if(i[B].text==="("&&a.has(B)){let H=i[B-1]?.text;if(!H||va.has(H)||!wt.test(H)&&H!=="*"&&H!=="]")continue;let V=a.get(B),M=V+1;if(i[M]?.text===":"){M++;while(M<i.length&&!["{","=>",";","="].includes(i[M].text))M++}if(i[M]?.text!=="{"||!a.has(M))continue;F.push({start:i[B].start,end:i[a.get(M)].end,bodyStart:i[M].start,functionBody:H!=="catch",names:v(B+1,V)})}function O(B){let H=B;for(;H<i.length;H++){let V=i[H].text;if(Xr.includes(V)&&a.has(H)){H=a.get(H);continue}if(V===";"||Jr.includes(V))break;let M=i[H-1];if(H>B&&Ea.has(V)&&M.text!==".")break;if(H>B&&/[\n\r]/.test(n.slice(M.end,i[H].start))&&(/^[\w$]+$/.test(M.text)||Jr.includes(M.text)||['"',"'","`"].includes(M.text))&&wt.test(V)&&!["in","of","instanceof"].includes(V))break}return H}let z=[];for(let B=0;B<i.length;B++){if(i[B].text!=="for")continue;let H=i[B+1]?.text==="await"?B+2:B+1;if(i[H]?.text!=="("||!a.has(H))continue;let V=a.get(H),M=V+1,Z=i[M]?.text==="{"&&a.has(M)?a.get(M):O(M),re=i[Z]?.text===";"||i[Z]?.text==="}"?i[Z].end:i[Math.max(M,Z-1)]?.end??n.length;z.push({headStart:H,headEnd:V,start:i[H].start,end:re})}for(let B=0;B<i.length;B++){let H=i[B].text,V=i[B-1]?.text;if(V==="."||i[B+1]?.text===":")continue;if(V==="as"||V==="<")continue;if(H==="const"||H==="let"||H==="var"){let M=O(B+1),Z=B+1,re=!1,se=!1,fe=0;for(let xe=B+1;xe<=M;xe++){let pe=i[xe]?.text;if(xe<M&&Xr.includes(pe)&&a.has(xe)&&a.get(xe)<M){xe=a.get(xe);continue}if(xe<M&&pe===":"&&!se)re=!0;else if(xe<M&&pe==="="&&fe===0)re=!1,se=!0;else if(xe<M&&re&&pe==="<")fe++;else if(xe<M&&re&&pe===">"&&fe>0)fe--;else if(xe===M||pe===","&&fe===0)x(Z,xe,D,H==="var"),Z=xe+1,re=!1,se=!1}}else if(H==="function"||H==="class"){let M=B+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(H==="import"){let M=B+1;if(i[M]?.text==="*"&&i[M+1]?.text==="as")M+=2;let Z=i[M]?.text;if(Z&&wt.test(Z)&&Z!=="type"&&i[M+1]?.text!=="("&&i[M+1]?.text!==".")D.add(Z),f.push({name:Z,token:M,file:!0});let re=i[M]?.text==="{"?M:i[M+1]?.text===","&&i[M+2]?.text==="{"?M+2:-1;if(re!==-1&&a.has(re)){let se=a.get(re);for(let[fe,xe]of l(re+1,se)){let pe=xe-1;while(pe>=fe&&!wt.test(i[pe].text))pe--;if(pe>=fe&&i[pe].text!=="type")f.push({name:i[pe].text,token:pe,file:!0})}}}}let W={code:n,scopes:F,loops:z,declarations:D,sites:f,tokens:i,pairs:a};return Kr.set(e,W),W}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],W=z===-1?[0,Number.POSITIVE_INFINITY]:[u[z].start,u[l.get(z)].end];if(O.functionScoped){let H=u[O.token].start,V=n.filter((M)=>M.functionBody&&H>=M.bodyStart&&H<M.end).sort((M,Z)=>M.end-M.bodyStart-(Z.end-Z.bodyStart))[0];W=V?[V.bodyStart,V.end]:[0,Number.POSITIVE_INFINITY]}else if(!O.file){let H=i.filter((V)=>O.token>V.headStart&&O.token<V.headEnd).sort((V,M)=>V.headEnd-V.headStart-(M.headEnd-M.headStart))[0];if(H)W=[H.start,H.end]}let B=A.get(O.name);if(B)B.push(W);else A.set(O.name,[W])}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 W=z+1;W<l.get(z);W++)D.add(W)}let F=new Set;for(let O=0;O<u.length;O++){let z=u[O].text;if(!t.has(z)||F.has(z)||v.has(O)||D.has(O))continue;let W=u[O-1]?.text;if(W==="#"||W==="."&&u[O-2]?.text!=="..")continue;if(u[O+1]?.text===":"&&(W==="{"||W===","))continue;let B=u[O].start;if(A.get(z)?.some(([H,V])=>B>=H&&B<V))continue;if(n.some((H)=>B>=H.start&&B<H.end&&H.names.has(z)))continue;F.add(z)}return F}var Me="0.2.867";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 ue(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">
|
|
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">
|
|
116
116
|
@layer vendor {
|
|
117
117
|
${t.contents}
|
|
118
118
|
}
|
|
@@ -120,7 +120,7 @@ ${t.contents}
|
|
|
120
120
|
`)}
|
|
121
121
|
`}var Sg=C,ei=S(256);function zt(e){let t=_(e),n=ei.get(t);if(!n)n=ja(e),ei.set(t,n);return{code:n.code,imports:[...n.imports],models:[...n.models]}}function ja(e){let t=r(e),n=new Set;for(let f of e.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let x of f[1].split(",")){let v=x.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(v)n.add(v)}let i=Bn(t),a=Ee.filter((f)=>{if(n.has(f)||i.has(f))return!1;return kg(t,f,!0)}),u=ri(t).filter((f)=>!n.has(f)&&!i.has(f));if(a.length===0&&u.length===0)return{code:e,imports:a,models:u};return{code:`${[a.length>0?`import { ${a.join(", ")} } from '@stacksjs/browser'`:"",u.length>0?"import '@stacksjs/browser'":"",u.length>0?`const { ${u.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
|
|
122
122
|
`)}
|
|
123
|
-
${e}`,imports:a,models:u}}var Na=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process","Modal","Intl"]);function ri(e,t=nn(e)){let n=new Set,i=Bn(e),a=/(?<![\w$.])([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g;for(let u of t.code.matchAll(a)){let l=u[1];if(Na.has(l)||i.has(l)||l.length<3)continue;if(t.shadows(l,u.index??0))continue;n.add(l)}return Array.from(n)}function La(e){return Bn(e)}var ti=S(128);function al(e){let t=_(e),n=ti.get(t);if(!n)n=za(e),ti.set(t,n);return{code:n.code,stxImports:[...n.stxImports],browserImports:[...n.browserImports]}}function za(e){let t=new Set,n=new Set,i=e;i=i.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let a=new Set,u=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,l;while((l=u.exec(e))!==null){let O=l[1],z=l[2];if(l[0].includes("import type"))continue;let
|
|
123
|
+
${e}`,imports:a,models:u}}var Na=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process","Modal","Intl"]);function ri(e,t=nn(e)){let n=new Set,i=Bn(e),a=/(?<![\w$.])([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g;for(let u of t.code.matchAll(a)){let l=u[1];if(Na.has(l)||i.has(l)||l.length<3)continue;if(t.shadows(l,u.index??0))continue;n.add(l)}return Array.from(n)}function La(e){return Bn(e)}var ti=S(128);function al(e){let t=_(e),n=ti.get(t);if(!n)n=za(e),ti.set(t,n);return{code:n.code,stxImports:[...n.stxImports],browserImports:[...n.browserImports]}}function za(e){let t=new Set,n=new Set,i=e;i=i.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let a=new Set,u=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,l;while((l=u.exec(e))!==null){let O=l[1],z=l[2];if(l[0].includes("import type"))continue;let V=[];for(let q of O.split(",")){let H=q.trim();if(!H||H.startsWith("type "))continue;let M=H.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!M)continue;let Q=M[1],ie=M[2]||Q;if(a.add(Q),a.add(ie),z==="stx"||z==="@stacksjs/stx")t.add(Q);else n.add(Q);if(ie!==Q)V.push(`${ie} = ${Q}`)}let F=V.length>0?`var ${V.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";i=i.replace(l[0],F)}let f=La(i),x=nn(i);for(let O of Sg){if(a.has(O)||f.has(O))continue;if(Ss(x,O,!0))t.add(O)}let v=r(i),A=nn(v),D=new Set;for(let O of i.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let z of O[1].split(",")){let V=z.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let F of V){let q=F.trim();if(q)D.add(q)}}for(let O of Ee){if(a.has(O)||f.has(O)||D.has(O))continue;if(Ss(A,O))n.add(O)}let U=ri(v,A);for(let O of U)if(!a.has(O)&&!f.has(O))n.add(O);return{code:i,stxImports:Array.from(t),browserImports:Array.from(n)}}function kg(e,t,n=!1){return Ss(nn(e),t,n)}function Ss(e,t,n=!1){let i=e.code,a=new RegExp(`\\b${t.replace(/[$]/g,"\\$")}\\b`,"g");for(let u of i.matchAll(a)){let l=u.index??0;if(e.shadows(t,l))continue;let f=l+t.length,x=l-1;while(x>=0&&/\s/.test(i[x]))x--;if(i[x]==="."&&i.slice(Math.max(0,x-2),x+1)!=="...")continue;let v=f;while(v<i.length&&/\s/.test(i[v]))v++;if(i[v]===":"&&i[v+1]!==":"&&(i[x]==="{"||i[x]===","))continue;if(n&&!/^\s*(?:<[^>]*>)?\s*\(/.test(i.slice(f)))continue;if(Ba(i,f))continue;return!0}return!1}function Ba(e,t){let n=t;while(n<e.length&&(e[n]===" "||e[n]==="\t"))n++;if(e[n]!=="(")return!1;let i=0;for(;n<e.length;n++){let a=e[n];if(a==="(")i++;else if(a===")"){if(i--,i===0)break}}if(i!==0)return!1;n++;while(n<e.length&&(e[n]===" "||e[n]==="\t"))n++;return e[n]==="{"}function cl(e,t){let n=[];if(e.length>0)n.push(` var { ${e.join(", ")} } = window.stx || window;`);if(t.length>0)n.push(` var { ${t.join(", ")} } = window.StacksBrowser || {};`);if(n.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
|
|
124
124
|
${n.join(`
|
|
125
125
|
`)}
|
|
126
126
|
${Wa(e,t)}`;return""}function fy(e,t=[]){let{browserImports:n}=al(e),i=new Set(t);return cl([],n.filter((a)=>!i.has(a)))}function Wa(e,t){let n=[...e.map((i)=>`['${i}', typeof ${i}, 'stx']`),...t.map((i)=>`['${i}', typeof ${i}, '@stacksjs/browser']`)];if(n.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
|
|
@@ -137,7 +137,7 @@ ${a.join(`
|
|
|
137
137
|
`)}
|
|
138
138
|
`}var Ua={left:0,middle:1,right:2};function Ha(e){let t=[];if(e.self)t.push("if ($event.target !== $el) return");for(let n of e.systemKeys)t.push(`if (!$event.${n}Key) return`);if(e.keys.length>0){let n=e.keys.map((i)=>`$event.key === '${i}'`).join(" || ");t.push(`if (!(${n})) return`)}if(e.mouse!==null){let n=Ua[e.mouse];t.push(`if ($event.button !== ${n}) return`)}if(e.prevent)t.push("$event.preventDefault()");if(e.stop)t.push("$event.stopPropagation()");return t.join("; ")}function qa(e,t){let{elementId:n,event:i,modifiers:a}=e,u=_s(e.handler),l=Ha(a),f=[];if(a.once)f.push("once: true");if(a.capture)f.push("capture: true");if(ys(i,a))f.push("passive: true");let x=f.length>0?`, { ${f.join(", ")} }`:"",v="";if(l)v+=`${l}; `;let A=u.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),D=`var $emit = function(name, detail) {
|
|
139
139
|
$el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
|
|
140
|
-
};`;function
|
|
140
|
+
};`;function U(O){if(/\$emit\s*\(/.test(O))return`${D}
|
|
141
141
|
${O}`;return`var scope = $el.closest('[data-stx-scope]');
|
|
142
142
|
if (scope && scope.__stx_execute) {
|
|
143
143
|
scope.__stx_execute('${A}', $event, $el);
|
|
@@ -151,7 +151,7 @@ else {
|
|
|
151
151
|
var __timer
|
|
152
152
|
$el.addEventListener('${i}', function($event) {
|
|
153
153
|
${l?l+"; ":""}clearTimeout(__timer)
|
|
154
|
-
__timer = setTimeout(function() { ${
|
|
154
|
+
__timer = setTimeout(function() { ${U(u)} }, ${a.debounce})
|
|
155
155
|
}${x})
|
|
156
156
|
})()`;if(a.throttle!==null)return` ;(function() {
|
|
157
157
|
// eslint-disable-next-line pickier/no-unused-vars
|
|
@@ -162,7 +162,7 @@ else {
|
|
|
162
162
|
${l?l+"; ":""}var __now = Date.now()
|
|
163
163
|
if (__now - __last >= ${a.throttle}) {
|
|
164
164
|
__last = __now
|
|
165
|
-
${
|
|
165
|
+
${U(u)}
|
|
166
166
|
}
|
|
167
167
|
}${x})
|
|
168
168
|
})()`;if(/\$emit\s*\(/.test(u))return` var $el = document.getElementById('${n}')
|
|
@@ -182,46 +182,46 @@ 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
|
|
186
|
-
${
|
|
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-nqz4es8a.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
|
+
${de(`${i}${n}
|
|
187
187
|
${D}`)}
|
|
188
|
-
</script>`}let
|
|
189
|
-
return ${Bs(n,M)};`:"",
|
|
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?`
|
|
189
|
+
return ${Bs(n,M)};`:"",ie=JSON.stringify(`[stx] client block failed${t.filePath?` (${t.filePath})`:""}; this block will not hydrate`);return`${f}<script data-stx-scoped data-stx-run="always"${z}>
|
|
190
190
|
window.stx.mount(function() {
|
|
191
191
|
'use strict';
|
|
192
192
|
try {
|
|
193
|
-
${
|
|
194
|
-
${D}${
|
|
193
|
+
${de(`${i}${n}
|
|
194
|
+
${D}${Q}`)}
|
|
195
195
|
} catch (error) {
|
|
196
|
-
console.error(${
|
|
196
|
+
console.error(${ie}, error);
|
|
197
197
|
return {};
|
|
198
198
|
}
|
|
199
|
-
})</script>`}if(!
|
|
199
|
+
})</script>`}if(!q&&!F){if(V)return H(si(e));if(t.templateContent){let M=si(e);if(M.length>0){let Q=Xa(t.templateContent);if(M.some((se)=>Q.has(se)))return H(M)}}}return`${f}<script data-stx-scoped data-stx-run="always"${z}>
|
|
200
200
|
;(function() {
|
|
201
201
|
'use strict';
|
|
202
202
|
try {
|
|
203
|
-
${
|
|
203
|
+
${de(`${i}${n}
|
|
204
204
|
${D}`)}
|
|
205
205
|
} catch (error) {
|
|
206
206
|
console.error(${JSON.stringify(`[stx] client block failed${t.filePath?` (${t.filePath})`:""}; this block will not hydrate`)}, error);
|
|
207
207
|
}
|
|
208
|
-
})()</script>`}import{createHash as sc}from"crypto";var $s=/\s*/y,vs=/\x00STX_HTML_COMMENT_\d+\x00/y;function Mt(e){let t=0;while(t<e.length){if($s.lastIndex=t,$s.exec(e),t=$s.lastIndex,e.startsWith("<!--",t)){let n=e.indexOf("-->",t+4);if(n===-1)return t;t=n+3;continue}if(vs.lastIndex=t,vs.test(e)){t=vs.lastIndex;continue}return t}return t}var Es=/<(\/?)([a-zA-Z][a-zA-Z0-9-]*)\b/y,Ja=new Map(["textarea","title","xmp","iframe","noembed","noframes"].map((e)=>[e,new RegExp(`</${e}\\s*>`,"ig")]));function Lt(e){let t=[],n=0;while(n<e.length){let i=e.indexOf("<",n);if(i===-1)break;if(e.startsWith("<!--",i)){let
|
|
208
|
+
})()</script>`}import{createHash as sc}from"crypto";var $s=/\s*/y,vs=/\x00STX_HTML_COMMENT_\d+\x00/y;function Mt(e){let t=0;while(t<e.length){if($s.lastIndex=t,$s.exec(e),t=$s.lastIndex,e.startsWith("<!--",t)){let n=e.indexOf("-->",t+4);if(n===-1)return t;t=n+3;continue}if(vs.lastIndex=t,vs.test(e)){t=vs.lastIndex;continue}return t}return t}var Es=/<(\/?)([a-zA-Z][a-zA-Z0-9-]*)\b/y,Ja=new Map(["textarea","title","xmp","iframe","noembed","noframes"].map((e)=>[e,new RegExp(`</${e}\\s*>`,"ig")]));function Lt(e){let t=[],n=0;while(n<e.length){let i=e.indexOf("<",n);if(i===-1)break;if(e.startsWith("<!--",i)){let U=e.indexOf("-->",i+4);if(U===-1)break;n=U+3;continue}Es.lastIndex=i;let a=Es.exec(e);if(!a){n=i+1;continue}let u=Es.lastIndex,l=u,f=null;for(;l<e.length;l++){let U=e[l];if(f){if(U===f)f=null}else if(U==='"'||U==="'")f=U;else if(U===">")break}if(l===e.length)break;let x=a[1]==="/",v=e[l-1]==="/";t.push({start:i,end:l+1,name:a[2],attributes:e.slice(u,v?l-1:l),closing:x,selfClosing:v}),n=l+1;let A=a[2].toLowerCase();if(!x&&A==="plaintext")break;let D=Ja.get(A);if(!x&&(A==="script"||A==="style"||D)){let U=D??(A==="script"?Vn:Un);U.lastIndex=n;let O=U.exec(e);if(!O)break;n=O.index}}return t}var Wn=/<script\b[^>]*>/iy,Vn=/<\/script\s*>/ig,Fn=/<style\b[^>]*>/iy,Un=/<\/style\s*>/ig;function ii(e,t,n,i){n.lastIndex=t;let a=n.exec(e);if(!a||a.index!==t)return-1;i.lastIndex=n.lastIndex;let u=i.exec(e);if(!u)return-1;return u.index+u[0].length}function J(e,t){return ii(e,t,Wn,Vn)}function bn(e,t){return ii(e,t,Fn,Un)}function Be(e,t){if(!e.startsWith("<!--",t))return-1;let n=e.indexOf("-->",t+4);if(n===-1)return-1;return n+3}function oi(e,t){if(e.startsWith("<!--",t)){let a=Be(e,t);return a===-1?e.length:a}if(Wn.lastIndex=t,Wn.exec(e)?.index===t){Vn.lastIndex=Wn.lastIndex;let a=Vn.exec(e);return a?a.index+a[0].length:e.length}if(Fn.lastIndex=t,Fn.exec(e)?.index===t){Un.lastIndex=Fn.lastIndex;let a=Un.exec(e);return a?a.index+a[0].length:e.length}return-1}function w(e,t){let n=[],i=0,a=e.length,u=!1,l=null;while(i<a){let f=e[i];if(u){if(l){if(f===l)l=null}else if(f==='"'||f==="'")l=f;else if(f===">")u=!1;i++;continue}if(f!=="<"){let D=e.indexOf("<",i+1);if(D===-1)break;i=D;continue}let x=t(e,i);if(x>i){n.push({start:i,end:x,token:e.slice(i,x)}),i=x;continue}let v=oi(e,i);if(v>i){i=v;continue}let A=e.charCodeAt(i+1);if(A>=65&&A<=90||A>=97&&A<=122)u=!0;i++}return n}function ai(e){let t=0,n=0,i=0,a=!1,u=null;while(i<e.length){if(a){let D=e[i];if(u){if(D===u)u=null}else if(D==='"'||D==="'")u=D;else if(D===">")a=!1;i++;continue}let l=e.indexOf("<",i),f=l===-1?e.length:l;while(i<f){let D=e[i++];if(D==="{")t++;else if(D==="}")n++;if(t>=2&&n>=2)return!0}if(l===-1)break;let x=oi(e,l);if(x>l){i=x;continue}let v=e.charCodeAt(l+1),A=v===47?e.charCodeAt(l+2):v;if(A>=65&&A<=90||A>=97&&A<=122)a=!0;i=l+1}return!1}function Uc(e,t){while(e.size>=t){let n=e.keys().next();if(n.done)return;e.delete(n.value)}}var Ga=1024,Ya=16777216,Nt=new Map,ks=0;function Qa(e,t){Nt.set(e,t),ks+=e.length+t.output.length;for(let[n,i]of Nt){if(ks<=Ya)break;Nt.delete(n),ks-=n.length+i.output.length}}function ye(e,t,n,i){let a=i!==void 0&&e.length>=Ga,u=a?`${i}\x00${e}`:"";if(a){let A=Nt.get(u);if(A)return Nt.delete(u),Nt.set(u,A),{output:A.output,tokens:A.tokens.slice()}}let l=w(e,t);if(l.length===0)return{output:e,tokens:[]};let f=l.map((A)=>A.token),x="",v=0;for(let A=0;A<l.length;A++){let D=l[A];x+=e.slice(v,D.start),x+=n(D.token,A),v=D.end}if(x+=e.slice(v),a)return Qa(u,{output:x,tokens:f}),{output:x,tokens:f.slice()};return{output:x,tokens:f}}var ec=1024,tc=16777216,Wt=new Map,Cs=0;function nc(e,t){Wt.set(e,t),Cs+=e.length+t.output.length;for(let[n,i]of Wt){if(Cs<=tc)break;Wt.delete(n),Cs-=n.length+i.output.length}}function Rs(e,t,n){return{output:t,scripts:n,restore:(i)=>i===t?e:Er(i,n)}}function ee(e){let t=e.length>=ec;if(t){let a=Wt.get(e);if(a)return Wt.delete(e),Wt.set(e,a),Rs(e,a.output,a.scripts.slice())}let{output:n,tokens:i}=ye(e,J,(a,u)=>`\x00STX_SCRIPT_${u}\x00`);if(t)return nc(e,{output:n,scripts:i}),Rs(e,n,i.slice());return Rs(e,n,i)}function Er(e,t){if(t.length===0)return e;return e.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(n,i)=>t[+i]??"")}var Hn="__stx_component_client_factories";function qn(e){let t=e[Hn];return t instanceof Map?t:null}function rl(e){e[Hn]=new Map}function Ts(e,t){let n=qn(e);if(!n)return null;let i=sc("sha256").update(t).digest("hex").slice(0,16),a=n.get(i);if(a)a.instances++;else n.set(i,{body:t,instances:1});return i}function sl(e,t){let n=qn(t);if(!n?.size)return e;let i=new Map;for(let[A,D]of n)if(D.instances===1)i.set(A,D.body);let a=[];if(i.size>0){let A=[...i.keys()].map((O)=>JSON.stringify(O).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),D=new RegExp(`window\\.__stxComponentFactories\\[(${A})\\]\\(("[^"]+")\\);`,"g"),U=D.exec(e);while(U!==null){let O=i.get(JSON.parse(U[1]));if(O!==void 0)a.push({start:U.index,end:U.index+U[0].length,replacement:de(`(${O})(${U[2]});`)});U=D.exec(e)}}let u=[...n].filter(([,A])=>A.instances>1);if(u.length===0)return ci(e,a);let l=u.map(([A,D])=>` try { factories[${JSON.stringify(A)}] = factories[${JSON.stringify(A)}] || ${D.body}; }
|
|
209
209
|
catch (e) { console.error('[stx] component factory ' + ${JSON.stringify(A)} + ' failed to register; instances of it will not hydrate.', e); }`).join(`
|
|
210
210
|
`),f=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
|
|
211
211
|
(function() {
|
|
212
212
|
const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
|
|
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 W=Ce(e,t);if(W<0)a=t;else if(W+2<=f){t=W+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 W=l(z,D);if(W>=0){if(W>f)return{openTag:-1,tail:""};z=W-1;continue}u(z,D)}if(D.openTag<0)return{openTag:-1,tail:""};let F="",O=D.openTag+1;for(let z=O;z<Math.min(f,A);z++){if(!e.startsWith("{{",z))continue;let W=Ce(e,z);F+=e.slice(O,z)+"x",z=W+1,O=W+2}return F+=e.slice(O,f),{openTag:D.openTag,tail:F}}}}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 de 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 ee(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 L(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 de(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 de(t,"CSS URLs must be local paths or base64 raster images")}}function ne(e,t,n,i=!1,a=0){try{return wc(e,t,n,i,a)}catch(u){if(u instanceof de)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 de("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 de("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 de(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 ne(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}=Q(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(ee(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
|
|
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
|
|
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 Xe=String(Ae);return re(a,q,Xe,!1,V.length)}catch(Ae){if(Ae instanceof pe)throw Ae;if(v&&!Wi(H,t))return V;if(Pe)return V;let Xe=Ae instanceof Error?Ae.message:String(Ae);return y("Expression",`Error evaluating: {{ ${H} }}: ${Xe}`,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
|
+
`).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
|
-
`)}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,
|
|
221
|
-
`)})}else t.push({selector:`@${A} ${D.trim()}`,declarations:
|
|
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(`
|
|
221
|
+
`)})}else t.push({selector:`@${A} ${D.trim()}`,declarations:U.trim()})}l="",u=!1}else if(a.trim()){a+=x;let v=a.match(/([^{]+)\{([^}]*)\}/);if(v)t.push({selector:v[1].trim(),declarations:v[2].trim()});a=""}continue}}if(u)l+=x;else a+=x}return t}function Yi(e,t,n,i,a,u){let{selector:l,declarations:f}=e;if(l.startsWith("@")){if(l.startsWith("@keyframes")){let A=l.replace("@keyframes ","").trim();return`@keyframes ${a.get(A)||A} { ${f} }`}if(l.startsWith("@media")||l.startsWith("@supports")||l.startsWith("@container")){let D=Os(`x { ${f} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((U)=>Yi(U,t,n,i,a,u)).join(`
|
|
222
222
|
`);return`${l} {
|
|
223
223
|
${D}
|
|
224
|
-
}`}return`${l} { ${f} }`}let x=Ic(l,t,n,i),v=f;for(let[A,D]of a)v=v.replace(new RegExp(`\\b${A}\\b`,"g"),D);if(u)v=v.replace(/--([a-z-]+)/gi,`--${t}-$1`);return`${x} { ${v} }`}function Ic(e,t,n,i){let a=e.split(",").map((l)=>l.trim()),u=[];for(let l of a){if(l.startsWith(":host")){if(i)u.push(l);else{let v=l.replace(/:host(\([^)]*\))?/,`.${t}$1`);u.push(v)}continue}if(l.includes("::slotted")){u.push(l);continue}if(l===":root"){u.push(`:root .${t}`);continue}let f=n?`${n} .${t}`:`.${t}`;u.push(`${f} ${l}`);let x=Pc(l,t);if(x)u.push(n?`${n} ${x}`:x)}return u.join(", ")}function Pc(e,t){let n=0,i=e.length;for(let x=0;x<e.length;x++){let v=e[x];if(v==="["||v==="(")n++;else if(v==="]"||v===")")n--;else if(n===0&&(v===" "||v===">"||v==="+"||v==="~")){i=x;break}}let a=e.slice(0,i),u=e.slice(i);if(!a)return"";let l=a.length,f=0;for(let x=0;x<a.length;x++){let v=a[x];if(v==="["||v==="(")f++;else if(v==="]"||v===")")f--;else if(n===0&&f===0&&v===":"){l=x;break}}return`${a.slice(0,l)}.${t}${a.slice(l)}${u}`}var to=String.raw`(?<![\w-])scoped(?![\w-])`,Ds=/<style\s+([^>]*)>/gi,Qi=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,no=new RegExp(to,"i"),Oc=new RegExp(to,"gi"),Ms=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function Dc(e){Ds.lastIndex=0;let t=Ds.exec(e);while(t!==null){if(no.test(t[1]))return!0;t=Ds.exec(e)}return!1}function Si(e){let t=new Set,n=[];Ms.lastIndex=0;let i=Ms.exec(e);while(i!==null){let a=i[0].trim();if(t.has(a))n.push({start:i.index,end:i.index+i[0].length});else t.add(a);i=Ms.exec(e)}return n}function wn(e){let t=Si(e);if(t.length===0)return e;let n=Array(t.length+1),i=0;for(let a=0;a<t.length;a++){let u=t[a];n[a]=e.slice(i,u.start),i=u.end}return n[t.length]=e.slice(i),n.join("")}function qs(e,t){if(!Dc(e))return{html:e,hasScoped:!1};let n=Ji(t),i=`data-v-${n}`,a=e,u=!1;if(Qi.lastIndex=0,a=a.replace(Qi,(l,f,x)=>{if(!no.test(f))return l;u=!0;let v=Mc(x,i),A=f.replace(Oc,"").trim(),D=A?` ${A}`:"";return`<style data-stx-scoped="${n}"${D}>${v}</style>`}),!u)return{html:e,hasScoped:!1};return a=Nc(a,i),{html:a,hasScoped:!0}}function Mc(e,t){return Gi(e,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${t}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${t}]`)}var jc=(e)=>`\x00stx-scope-mask-${e}\x00`,eo=/\u0000stx-scope-mask-(\d+)\u0000/g;function Nc(e,t){let n=ye(e,(a,u)=>{let l=
|
|
224
|
+
}`}return`${l} { ${f} }`}let x=Ic(l,t,n,i),v=f;for(let[A,D]of a)v=v.replace(new RegExp(`\\b${A}\\b`,"g"),D);if(u)v=v.replace(/--([a-z-]+)/gi,`--${t}-$1`);return`${x} { ${v} }`}function Ic(e,t,n,i){let a=e.split(",").map((l)=>l.trim()),u=[];for(let l of a){if(l.startsWith(":host")){if(i)u.push(l);else{let v=l.replace(/:host(\([^)]*\))?/,`.${t}$1`);u.push(v)}continue}if(l.includes("::slotted")){u.push(l);continue}if(l===":root"){u.push(`:root .${t}`);continue}let f=n?`${n} .${t}`:`.${t}`;u.push(`${f} ${l}`);let x=Pc(l,t);if(x)u.push(n?`${n} ${x}`:x)}return u.join(", ")}function Pc(e,t){let n=0,i=e.length;for(let x=0;x<e.length;x++){let v=e[x];if(v==="["||v==="(")n++;else if(v==="]"||v===")")n--;else if(n===0&&(v===" "||v===">"||v==="+"||v==="~")){i=x;break}}let a=e.slice(0,i),u=e.slice(i);if(!a)return"";let l=a.length,f=0;for(let x=0;x<a.length;x++){let v=a[x];if(v==="["||v==="(")f++;else if(v==="]"||v===")")f--;else if(n===0&&f===0&&v===":"){l=x;break}}return`${a.slice(0,l)}.${t}${a.slice(l)}${u}`}var to=String.raw`(?<![\w-])scoped(?![\w-])`,Ds=/<style\s+([^>]*)>/gi,Qi=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,no=new RegExp(to,"i"),Oc=new RegExp(to,"gi"),Ms=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function Dc(e){Ds.lastIndex=0;let t=Ds.exec(e);while(t!==null){if(no.test(t[1]))return!0;t=Ds.exec(e)}return!1}function Si(e){let t=new Set,n=[];Ms.lastIndex=0;let i=Ms.exec(e);while(i!==null){let a=i[0].trim();if(t.has(a))n.push({start:i.index,end:i.index+i[0].length});else t.add(a);i=Ms.exec(e)}return n}function wn(e){let t=Si(e);if(t.length===0)return e;let n=Array(t.length+1),i=0;for(let a=0;a<t.length;a++){let u=t[a];n[a]=e.slice(i,u.start),i=u.end}return n[t.length]=e.slice(i),n.join("")}function qs(e,t){if(!Dc(e))return{html:e,hasScoped:!1};let n=Ji(t),i=`data-v-${n}`,a=e,u=!1;if(Qi.lastIndex=0,a=a.replace(Qi,(l,f,x)=>{if(!no.test(f))return l;u=!0;let v=Mc(x,i),A=f.replace(Oc,"").trim(),D=A?` ${A}`:"";return`<style data-stx-scoped="${n}"${D}>${v}</style>`}),!u)return{html:e,hasScoped:!1};return a=Nc(a,i),{html:a,hasScoped:!0}}function Mc(e,t){return Gi(e,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${t}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${t}]`)}var jc=(e)=>`\x00stx-scope-mask-${e}\x00`,eo=/\u0000stx-scope-mask-(\d+)\u0000/g;function Nc(e,t){let n=ye(e,(a,u)=>{let l=J(a,u);return l>u?l:bn(a,u)},(a,u)=>jc(u)),i=Lc(n.output,t);return eo.lastIndex=0,i.replace(eo,(a,u)=>n.tokens[Number(u)])}function Lc(e,t){let n=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return e.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(i,a,u)=>{if(n.has(a.toLowerCase()))return i;if(i.includes(t))return i;if(a.toLowerCase()==="style"||a.toLowerCase()==="script")return i;if(u)return i.replace(`<${a}${u}`,`<${a} ${t}${u}`);if(i.endsWith("/>"))return`<${a} ${t} />`;return`<${a} ${t}>`})}var an=/<\/?template\b[^>]*>/gi,zc=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function Bc(e){let t=e.replace(/^<template\b/i,"").replace(/>$/,"");return zc.test(t)}function L(e){an.lastIndex=0;let t;while((t=an.exec(e))!==null){if(t[0].startsWith("</")||Bc(t[0]))continue;let n=t.index,i=an.lastIndex,a=1,u;while((u=an.exec(e))!==null)if(u[0].startsWith("</")){if(a--,a===0){let l=u.index;return{start:n,openEnd:i,closeStart:l,end:an.lastIndex,content:e.slice(i,l)}}}else a++;return null}return null}var Fc=0,ml=0;function Qn(e,t){let n=/(?:^|\s)([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g;for(let i of e.matchAll(n))if(i[1].toLowerCase()===t.toLowerCase())return i[2]??i[3]??i[4]??null;return null}function oo(e){let t=[],n=/<([a-z][a-z0-9-]*)\b((?:"[^"]*"|'[^']*'|[^>"'])*)>/iy;return w(e,(i,a)=>{n.lastIndex=a;let u=n.exec(i);if(!u||!Qn(u[2],"x-data"))return-1;return t.push({fullMatch:u[0],tagName:u[1],attributes:u[2],startIndex:a,endIndex:n.lastIndex}),n.lastIndex}),t}function hl(e){let t=[];for(let{fullMatch:n,tagName:i,attributes:a,startIndex:u}of oo(e)){let l=Qn(a,"x-data");if(!l)continue;let f=`__stx_scope_${Fc++}`,x=Qn(a,"x-init"),v=xl(e,i,u+n.length),A=e.slice(u,v.endIndex),D=bl(A);t.push({id:f,selector:`[data-stx-scope="${f}"]`,stateExpr:l,initExpr:x,bindings:[],refs:D})}return t}function xl(e,t,n){let i=1,a=n,u=new RegExp(`<${t}(?:\\s|>)`,"gi"),l=new RegExp(`</${t}>`,"gi"),f=new RegExp(`<${t}[^>]*/\\s*>`,"gi");while(i>0&&a<e.length){u.lastIndex=a,l.lastIndex=a,f.lastIndex=a;let x=u.exec(e),v=l.exec(e),A=f.exec(e);if(A&&A.index<(x?.index??1/0)){a=A.index+A[0].length;continue}if(!v)return{endIndex:e.length};if(x&&x.index<v.index)i++,a=x.index+x[0].length;else{if(i--,i===0)return{endIndex:v.index+v[0].length};a=v.index+v[0].length}}return{endIndex:e.length}}function bl(e){let t=new Map,n=e.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),i=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,a;while((a=i.exec(n))!==null){let[,u,l]=a,f=yl(u);t.set(l,f)}return t}function yl(e){let t=e.match(/\bid\s*=\s*["']([^"']*)["']/);if(t)return t[1];return`__stx_el_${ml++}`}function wl(){return`
|
|
225
225
|
// STX Reactive Runtime - x-cloak and transition CSS
|
|
226
226
|
(function() {
|
|
227
227
|
var style = document.createElement('style');
|
|
@@ -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 Gs(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(),
|
|
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 Gs(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 Xs(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>;
|
|
@@ -513,33 +513,33 @@ type __StxRequired<O> = { [K in keyof O]-?: O[K] extends { required: true } ? K
|
|
|
513
513
|
type __StxDefaulted<O> = { [K in keyof O]-?: O[K] extends { default: unknown } ? K : never }[keyof O];
|
|
514
514
|
type __StxOptions<O> = { [K in Exclude<__StxRequired<O>, __StxDefaulted<O>>]: __StxOption<O[K]> } & { [K in Exclude<keyof O, Exclude<__StxRequired<O>, __StxDefaulted<O>>>]?: __StxOption<O[K]> };
|
|
515
515
|
type __StxDefaults<P, K> = Omit<P, Extract<keyof P, K>> & Partial<Pick<P, Extract<keyof P, K>>>;
|
|
516
|
-
`;function ho(e,t){let n=[],i={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},a=r(e),u=e.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(
|
|
517
|
-
`)}),l=er(e,i.defineProps),f=er(e,i.defineEmits),x=er(e,i.withDefaults);if(!l&&!f)return{declarations:"",props:null,events:null};let v=[],A=null,D=null;if(l){v.push(`const __options = (${l.args[0]||"{}"}) as const;`),v.push(`const __defaults = (${x?.args[1]||"{}"});`);let
|
|
516
|
+
`;function ho(e,t){let n=[],i={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},a=r(e),u=e.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(U,O,z,V,F)=>{if(a.slice(F,F+6)!=="import")return U;if(V.endsWith(".stx"))return"";let q=`${t}Import${n.length}`;if(n.push(`import * as ${q} from ${JSON.stringify(V)};`),O.startsWith("*"))return`import ${O.replace(/^\*\s+as\s+/,"")} = ${q};`;if(!O.startsWith("{"))return`import ${O} = ${q}.default;`;return O.slice(1,-1).split(",").map((H)=>{let[M,Q=M]=H.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!M)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(V)&&M in i)i[M].push(Q);return`import ${Q} = ${q}.${M};`}).join(`
|
|
517
|
+
`)}),l=er(e,i.defineProps),f=er(e,i.defineEmits),x=er(e,i.withDefaults);if(!l&&!f)return{declarations:"",props:null,events:null};let v=[],A=null,D=null;if(l){v.push(`const __options = (${l.args[0]||"{}"}) as const;`),v.push(`const __defaults = (${x?.args[1]||"{}"});`);let U=l.type||"__StxOptions<typeof __options>";v.push(`export type __StxProps = __StxDefaults<${U}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),A=`${t}.__StxProps`}if(f)v.push(`const __events = (${f.args[0]||"[]"}) as const;`),v.push(`export type __StxEvents = ${f.type||"Record<(typeof __events)[number], any[]>"};`),D=`${t}.__StxEvents`;return{declarations:`${n.join(`
|
|
518
518
|
`)}
|
|
519
519
|
namespace ${t} {
|
|
520
520
|
${u}
|
|
521
521
|
${v.join(`
|
|
522
522
|
`)}
|
|
523
|
-
}`,props:A,events:D}}var Rr=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);function Ar(e){if(e.includes("-")||e==="component")return!1;if(/^[A-Z]/.test(e))return!/[a-z]/.test(e)&&[...Rr].some((t)=>t.toLowerCase()===e.toLowerCase());return Rr.has(e)||/[A-Z]/.test(e)}function*Ol(e){let t=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,n;while(n=t.exec(e)){let i=t.lastIndex,a=[];while(i<e.length){while(/\s/.test(e[i]||""))i++;if(e[i]===">"||e.slice(i,i+2)==="/>"){i+=e[i]===">"?1:2;break}let u=/^[^\s=/>]+/.exec(e.slice(i))?.[0];if(!u){i++;continue}let l=i;i+=u.length;while(/\s/.test(e[i]||""))i++;if(e[i]!=="="){a.push({name:u,value:!0,offset:l,braced:!1});continue}i++;while(/\s/.test(e[i]||""))i++;let f=e[i],x=f==="{",v=f==='"'||f==="'";if(v||x)i++;let A=i;if(x){let D=r(e.slice(i)),
|
|
524
|
-
`).length,column:z-
|
|
525
|
-
`)}},O=(z,
|
|
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",
|
|
523
|
+
}`,props:A,events:D}}var Rr=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);function Ar(e){if(e.includes("-")||e==="component")return!1;if(/^[A-Z]/.test(e))return!/[a-z]/.test(e)&&[...Rr].some((t)=>t.toLowerCase()===e.toLowerCase());return Rr.has(e)||/[A-Z]/.test(e)}function*Ol(e){let t=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,n;while(n=t.exec(e)){let i=t.lastIndex,a=[];while(i<e.length){while(/\s/.test(e[i]||""))i++;if(e[i]===">"||e.slice(i,i+2)==="/>"){i+=e[i]===">"?1:2;break}let u=/^[^\s=/>]+/.exec(e.slice(i))?.[0];if(!u){i++;continue}let l=i;i+=u.length;while(/\s/.test(e[i]||""))i++;if(e[i]!=="="){a.push({name:u,value:!0,offset:l,braced:!1});continue}i++;while(/\s/.test(e[i]||""))i++;let f=e[i],x=f==="{",v=f==='"'||f==="'";if(v||x)i++;let A=i;if(x){let D=r(e.slice(i)),U=1,O=0;for(;O<D.length;O++){if(D[O]==="{")U++;if(D[O]==="}"&&--U===0)break}i+=O}else if(v)while(i<e.length&&e[i]!==f)i++;else while(i<e.length&&!/[\s/>]/.test(e[i]))i++;if(a.push({name:u,value:e.slice(A,i),offset:A,braced:x}),v||x)i++}t.lastIndex=i,yield{name:n[1],offset:n.index,attributes:a}}}function xo(e,t,n){let i=[],a=[mo,"type __StxAssignedValue<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? T extends () => infer V ? V : T : T;","type __StxProp<P, K> = K extends keyof P ? P[K] : unknown;",'type __StxStaticProp<P, K> = __StxProp<P, K> extends infer T ? boolean extends T ? T | "true" | "false" : T : never;','type __StxEvent<E, K> = K extends keyof E ? E[K] extends readonly unknown[] ? number extends E[K]["length"] ? E[K][0] : Exclude<E[K]["length"], 0 | 1> extends never ? E[K][0] : E[K] : E[K] : any;'],u=new Map,l=new Map,f=new Map,x=n.scriptCode(e,n.filePath),v=r(x);for(let z of x.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(v.slice(z.index,z.index+6)!=="import")continue;let V=z[2],F=cn.isAbsolute(V)||V.startsWith(".")?cn.resolve(cn.dirname(n.filePath),V):Fs(V,cn.dirname(n.filePath));if(!F)continue;let q=F.endsWith(".stx")?F:tr.existsSync(`${F}.stx`)?`${F}.stx`:void 0,H=q?null:_r(F,!1),M=z[1].startsWith("{")?z[1].slice(1,-1).split(","):[z[1]];for(let Q of M){let[ie,se=ie]=Q.trim().split(/\s+as\s+/),fe=q||H?.get(ie)||H?.get(ie.toLowerCase());if(fe)f.set(se,fe),f.set(se.toLowerCase(),fe),f.set(se.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),fe)}}for(let z of t.matchAll(/@import\s*\(([^)]+)\)/g))for(let V of z[1].matchAll(/['"]([^'"]+)['"]/g)){let F=zs(V[1],n.filePath,n).find((q)=>tr.statSync(q,{throwIfNoEntry:!1})?.isFile());if(F)f.set(cn.basename(V[1]).replace(/\.stx$/,""),F)}let A={__importedComponents:f},D=new Map,U=(z,V,F)=>{let q=e.slice(0,z);return{code:V,offset:z,attribute:F,anchor:!0,kind:"directive",line:q.split(`
|
|
524
|
+
`).length,column:z-q.lastIndexOf(`
|
|
525
|
+
`)}},O=(z,V,F)=>i.push({expression:z,statement:{text:V+z.code+F,prefixLength:V.length}});for(let z of Ol(t)){if(Ar(z.name)||z.name==="component")continue;let V=zr(z.name,n.filePath,n,A);if(!V)continue;let F=D.get(V);if(!F){let H;try{H=n.readComponent?n.readComponent(V):tr.readFileSync(V,"utf8")}catch{continue}if(H===void 0)continue;l.set(V,H),F=ho(n.scriptCode(H,V),`__StxComponent${D.size}`),D.set(V,F),a.push(F.declarations)}let q=[];for(let H of z.attributes){let{name:M,offset:Q}=H,ie=H.value===!0?"true":H.value;if(M.startsWith("@")||M.startsWith("v-on:")){if(F.events&&H.value!==!0)u.set(Q,`__StxEvent<${F.events}, ${JSON.stringify(M.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let se=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(M);if(M.startsWith("v-")&&!M.startsWith("v-bind:")&&!se)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(M))continue;let fe=(se?se[1]||"modelValue":M.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(Ke,Ae)=>Ae.toUpperCase());if(q.push(fe),!F.props)continue;let xe=M.startsWith(":")||M.startsWith("v-bind:")||!!se||H.braced,ge=xe?ie:H.value!==!0?JSON.stringify(ie):"true",Pe=!xe&&H.value!==!0&&(ie==="true"||ie==="false");O(U(Q,ge,M),";void ((",`) satisfies ${Pe?"__StxStaticProp":"__StxProp"}<${F.props}, ${JSON.stringify(fe)}>);`)}if(F.props){let H=[...new Set(q)].map((Q)=>`${JSON.stringify(Q)}: undefined as any`).join(", "),M=U(z.offset,`<${z.name}>`);i.push({expression:M,statement:{text:`;void ({ ${H} } satisfies ${F.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:D.size?a.join(`
|
|
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
|
-
`)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
|
|
529
|
-
`),Xe=Ae[0].length;Ae[0]=Ke+" ".repeat(Math.max(0,Xe-Ke.length));for(let nt=1;nt<Ae.length;nt++)Ae[nt]=Ae[nt].replace(/[^\r]/g," ");let et=a.get(
|
|
530
|
-
`)),A=
|
|
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
|
+
`),Xe=Ae[0].length;Ae[0]=Ke+" ".repeat(Math.max(0,Xe-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+Xe,generatedStart:it,generatedEnd:it+Ae[0].length}),a.set(ge.line,et),v.push(e.slice(A,ie),Ae.join(`
|
|
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
|
`)}
|
|
533
533
|
export async function read() {
|
|
534
534
|
${Us(O).replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class|interface|type)\b)/gm,"")}
|
|
535
|
-
return {`});for(let[
|
|
535
|
+
return {`});for(let[F,q]of l.entries())u.push({text:`value${F}: (`}),u.push({text:q.code,origin:{line:q.line,column:q.column}}),u.push({text:"),"});u.push({text:`}
|
|
536
536
|
}
|
|
537
|
-
}`});for(let
|
|
537
|
+
}`});for(let F=0;F<l.length;F++)u.push({text:`declare var ${i}_${F}: Awaited<ReturnType<typeof ${i}Scope.read>>['value${F}']`});return{code:D,columns:a,declarations:u}}function wo(e,t){let n=0;for(let i of e){if(t<i.generatedStart)break;if(t<i.generatedEnd)return i.sourceStart+Math.min(t-i.generatedStart,i.sourceEnd-i.sourceStart);n=i.sourceEnd-i.generatedEnd}return t+n}var Nl=["foreach","endforeach","forelse","endforelse","for","endfor","while","endwhile","empty","if","elseif","else","endif","unless","endunless","isset","endisset","switch","case","default","endswitch","auth","endauth","guest","endguest","env","endenv","once","endonce","break","continue"],Ll=new RegExp(String.raw`^[ \t]*@(?:${Nl.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function Us(e){return e.replace(Ll,(t)=>t.replace(/[^\n]/g," "))}var So=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function gg(e){let t=es(e),n=[],i=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,a;while((a=i.exec(t))!==null){if(a[1]||a[3])continue;let f=a[2]??a[4]??"",x=a[2]!==void 0?2:3,v=Ao(f);if(!v.trim())continue;let A=a.index+x+(v.length-v.trimStart().length);n.push({code:v.trim(),line:ln(t,A),column:un(t,A),offset:A,kind:"interpolation"})}let u=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((a=u.exec(t))!==null){let l=a.index+a[0].length-1,f=0,x=l;for(;x<t.length;x++){let U=t[x];if(U==="(")f++;else if(U===")"){if(f--,f===0)break}}if(f!==0)continue;let v=t.slice(l+1,x),A=v.trim();if(u.lastIndex=x+1,!A)continue;let D=l+1+(v.length-v.trimStart().length);n.push({code:A,line:ln(t,D),column:un(t,D),offset:a.index,kind:"condition"})}ts.lastIndex=0;while((a=ts.exec(t))!==null){let l=a[1],f=a[3]??"",x=l.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(So.has(x)||So.has(l))continue;if(!f.trim())continue;let v=a.index+a[0].indexOf(a[2],a[0].indexOf(l)+l.length)+1;if(Io.has(x)){let D=f.match(/\s+(?:in|of)\s+/);if(!D||D.index===void 0)continue;let U=f.slice(D.index+D[0].length),O=D.index+D[0].length+(U.length-U.trimStart().length);n.push({code:_o(U.trim()),line:ln(t,v+O),column:un(t,v+O),offset:v+O,kind:"directive",attribute:x});continue}let A=f.length-f.trimStart().length;n.push({code:_o(f.trim()),line:ln(t,v+A),column:un(t,v+A),offset:v+A,kind:"directive",attribute:x})}return n.sort((l,f)=>l.line-f.line||l.column-f.column),n}var zl=2000;function Bl(e,t){let n=0,i=Math.min(e.length,t+zl);for(let a=t;a<i;a++){let u=e[a];if(u==="(")n++;else if(u===")"){if(n--,n===0)return e.slice(t+1,a)}}return null}function Wl(e){let t=new Map,n=(f,x)=>{let v=f.split(/[,[\]{}()\s]+/).filter(Boolean);for(let A of v){let D=A.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(D))continue;let U=v.length===1?x:void 0,O=t.get(D);if(!O)t.set(D,{name:D,iterable:U});else if(O.iterable!==U)O.iterable=void 0}},i=/^\$?[A-Z_$][\w$]*$/i,a=(f)=>{let x=f.trim();return i.test(x)?x:void 0};for(let f of e.matchAll(/@for(?:each|else)\s*\(/g)){let x=Bl(e,f.index+f[0].length-1);if(x===null)continue;let v=jt(x);if(!v)continue;n(v.itemVar.replace(/=>/g," "),a(v.arrayExpr))}for(let f of e.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))n(f[1],f[2]==="of"?a(f[3]):void 0);for(let f of e.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))n(f[1]);let u=es(e);ts.lastIndex=0;let l;while((l=ts.exec(u))!==null){let f=l[1].replace(/\..*$/,"");if(!Io.has(f))continue;let x=l[3].match(/\s+(?:in|of)\s+/);if(!x||x.index===void 0)continue;n(l[3].slice(0,x.index),a(l[3].slice(x.index+x[0].length)))}for(let f of e.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let x of f[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))n(x[1]);return[...t.values()].sort((f,x)=>f.name.localeCompare(x.name))}function Fe(e){let t=new Set;for(let n of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))t.add(n[1]);for(let n of e.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))t.add(n[1]);for(let n of e.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))t.add(n[1]);for(let n of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let i of n[1].split(",")){let a=i.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(a))t.add(a)}return[...t].sort()}var sr=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],Fl={$bool:"declare function $bool(value: unknown, fallback?: boolean): boolean",$num:"declare function $num(value: unknown, fallback?: number): number",$uid:"declare var $uid: string",$native:"declare var $native: boolean"};function Wc(e=new Set){return[...sr.filter((t)=>!e.has(t)).map((t)=>`declare var ${t}: any`),...Object.entries(Fl).filter(([t])=>!e.has(t)).map(([,t])=>t)].join(`
|
|
538
538
|
`)}function qc(e){return new Set([...e.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((t)=>t[1]))}function Oo(e){let t=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,n,i=!1,a=new Set,u=r(e);while((n=t.exec(u))!==null){i=!0;for(let l of Vl(n[1])){let f=l.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(f))a.add(f)}}return i?[...a]:null}function Vl(e){let t=[],n=0,i="";for(let a of e){if(a===","&&n===0){t.push(i),i="";continue}if(a==="("||a==="["||a==="{")n++;else if(a===")"||a==="]"||a==="}")n--;i+=a}return t.push(i),t.filter((a)=>a.trim().length>0)}function Do(e){let t=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,n=[],i=e.replace(t,(a)=>(n.push(a.trim()),a.split(`
|
|
539
539
|
`).map(()=>"").join(`
|
|
540
540
|
`)));return{imports:n.join(`
|
|
541
|
-
`),body:i}}function ir(e){let t=r(e),n=Array(t.length),i=0;for(let f=0;f<t.length;f++){let x=t[f];if(x==="}"||x===")"||x==="]")i=Math.max(0,i-1);if(n[f]=i,x==="{"||x==="("||x==="[")i++}let a=[],u=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,l;while((l=u.exec(t))!==null){if(n[l.index]!==0)continue;let f=l[1],x=l[2],v;if(f==="interface"){let A=t.indexOf("{",l.index);if(A===-1)continue;let D=0;v=-1;for(let
|
|
542
|
-
`&&!/[=|&,<([{]\s*$/.test(t.slice(Math.max(0,D-40),D)))){v=
|
|
541
|
+
`),body:i}}function ir(e){let t=r(e),n=Array(t.length),i=0;for(let f=0;f<t.length;f++){let x=t[f];if(x==="}"||x===")"||x==="]")i=Math.max(0,i-1);if(n[f]=i,x==="{"||x==="("||x==="[")i++}let a=[],u=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,l;while((l=u.exec(t))!==null){if(n[l.index]!==0)continue;let f=l[1],x=l[2],v;if(f==="interface"){let A=t.indexOf("{",l.index);if(A===-1)continue;let D=0;v=-1;for(let U=A;U<t.length;U++)if(t[U]==="{")D++;else if(t[U]==="}"&&--D===0){v=U+1;break}if(v===-1)continue}else{let A=0;v=t.length;for(let D=t.indexOf("=",l.index)+1;D<t.length;D++){let U=t[D];if(U==="{"||U==="["||U==="("||U==="<")A++;else if(U==="}"||U==="]"||U===")"||U===">")A--;else if(A<=0&&(U===";"||U===`
|
|
542
|
+
`&&!/[=|&,<([{]\s*$/.test(t.slice(Math.max(0,D-40),D)))){v=U===";"?D+1:D;break}}}a.push({name:x,text:e.slice(l.index,v).replace(/^[ \t]*export[ \t]+/,"")}),u.lastIndex=v}return a}function Ul(e){let t=r(e),n=[],i=/^[ \t]*(?:export[ \t]+)?(?:const|let|var)[ \t]+/gm,a,u=0,l=0;while((a=i.exec(t))!==null){for(;l<a.index;l++){let v=t[l];if(v==="{"||v==="("||v==="[")u++;else if(v==="}"||v===")"||v==="]")u=Math.max(0,u-1)}if(u!==0)continue;let f=0,x=t.length;for(let v=a.index+a[0].length;v<t.length;v++){let A=t[v];if(A==="{"||A==="("||A==="[")f++;else if(A==="}"||A===")"||A==="]")f--;else if(f<=0&&(A===";"||A===`
|
|
543
543
|
`)){x=A===";"?v+1:v;break}}if(/\bdefineProps\s*(?:<|\()/.test(t.slice(a.index,x)))n.push(e.slice(a.index,x).replace(/^[ \t]*export[ \t]+/,"").trim())}return n}function bi(e){let t=e.filter((a)=>a.kind==="server").map((a)=>a.code).join(`
|
|
544
544
|
`);if(/\bdefineProps\s*(?:<|\()/.test(r(t)))return t;let n=Mo(t),i=e.filter((a)=>a.kind!=="server").flatMap((a)=>{let u=Ul(a.code);if(!u.length)return[];return[...ir(a.code).filter((l)=>!n.has(l.name)).map((l)=>l.text),...u]});return[t,...i].filter(Boolean).join(`
|
|
545
545
|
`)}function Mo(e){return new Set(ir(e).map((t)=>t.name))}function Kc(e,t=""){let n=Oo(e),i=Mo(t),a=ir(e).filter((v)=>!i.has(v.name)).map((v)=>v.text);if(!n){let v=Fe(e).filter((A)=>!Dt(t,A));if(v.length===0&&a.length===0)return"";return["",`// ${Zl}`,...a,...v.map((A)=>`declare var ${A}: any`)].join(`
|
|
@@ -547,46 +547,46 @@ return {`});for(let[B,H]of l.entries())u.push({text:`value${B}: (`}),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 Gc(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,
|
|
551
|
-
`))continue;let z=rr(i,f),
|
|
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:(
|
|
553
|
-
`)}):void 0,D=new Set,
|
|
554
|
-
`);
|
|
555
|
-
`).entries())if(a.push(
|
|
556
|
-
`))O(
|
|
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 Gc(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 Xc(e,t={}){let n=lt(e),i=e.split(`
|
|
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
|
+
`)}):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
|
+
`);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
|
+
`).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),Xe=Ae.length>0?`${Ae.map((Ye)=>`if (${Lo(Ye,H)}) `).join("")}{ `:"",et=Ae.length>0?" }":"";O(xe+Pe+Xe+fe.text+et+Ke,{line:se.line,column:se.column,expression:se,prefixLength:fe.prefixLength+xe.length+Pe.length+Xe.length,guardPrefixLength:xe.length+Pe.length+Xe.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]!==`
|
|
560
560
|
`)t[n]=e[n],n++;continue}if(a==="/"&&u==="*"){let l=e.indexOf("*/",n+2),f=l===-1?e.length:l+2;for(;n<f;n++)t[n]=e[n];continue}if(a==="{"&&u==="{"&&e.slice(n,n+4)==="{{--"){let l=e.indexOf("--}}",n+4),f=l===-1?e.length:l+4;for(;n<f;n++)t[n]=e[n];continue}n++}return t.join("")}function su(e){let t=new Map,n=nu(e).split(`
|
|
561
561
|
`),i=e.split(`
|
|
562
|
-
`);return n.forEach((a,u)=>{Bo.lastIndex=0;for(let l of a.matchAll(Bo)){let f=l[1]==="-next-line",x=(i[u]??"").slice(0,l.index).trim(),v=f||x===""?u+2:u+1,D=(l[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),
|
|
562
|
+
`);return n.forEach((a,u)=>{Bo.lastIndex=0;for(let l of a.matchAll(Bo)){let f=l[1]==="-next-line",x=(i[u]??"").slice(0,l.index).trim(),v=f||x===""?u+2:u+1,D=(l[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),U=D.filter((z)=>/\w/.test(z));if(D.length>0&&U.length===0)continue;let O=t.get(v);if(O&&O.size===0)continue;if(U.length===0){t.set(v,new Set);continue}if(O)U.forEach((z)=>O.add(z));else t.set(v,new Set(U))}}),t}function ru(e,t,n){let i=e.get(t);if(!i)return!1;if(i.size===0)return!0;return[...i].some((a)=>n.includes(a))}function je(e,t,n,i){let a=typeof n==="boolean"?{enabled:n,failOnViolation:n}:n??{enabled:!1};if(!a.enabled)return;let u=_(e,t,i,JSON.stringify(a)),l=or.get(u);if(l!==void 0){if(l&&a.failOnViolation)throw new Y(l,i??t);return}let f=a.allowPatterns??[],x=su(e),v=[],A=r(e.replace(/\{\{--[\s\S]*?--\}\}/g,(z)=>z.replace(/[^\n]/g," ")));for(let{pattern:z,message:V,suggestion:F}of tu){if(f.some((H)=>/\w/.test(H)&&V.includes(H)))continue;z.lastIndex=0;let q=A.match(z);if(q&&q.length>0){let H=A.split(`
|
|
563
563
|
`),M=e.split(`
|
|
564
|
-
`),
|
|
564
|
+
`),Q=[];if(H.forEach((xe,ge)=>{if(z.lastIndex=0,z.test(xe)&&!ru(x,ge+1,V))Q.push(ge+1)}),Q.length===0&&H.some((xe)=>(z.lastIndex=0,z.test(xe))))continue;let ie=Q.length>0?` (script line${Q.length>1?"s":""} ${Q.join(", ")})`:"",se=Q.slice(0,3).map((xe)=>` ${xe} | ${(M[xe-1]??"").trim().slice(0,100)}`).join(`
|
|
565
565
|
`),fe=se?`
|
|
566
|
-
${se}`:"";v.push(` \u2717 ${
|
|
567
|
-
\u2192 ${
|
|
566
|
+
${se}`:"";v.push(` \u2717 ${V}${ie}
|
|
567
|
+
\u2192 ${F}${fe}`)}}if(v.length===0){or.set(u,"");return}let D=(z)=>{let V=`${process.cwd()}/`;return z.startsWith(V)?z.slice(V.length):z},O=`[STX] DOM API violation in ${i&&i!==t?`${D(i)} (composed into ${D(t)})`:D(t)}:
|
|
568
568
|
${v.join(`
|
|
569
569
|
`)}
|
|
570
|
-
Tip: prefer useRef(), navigate(), and composables for component code`;if(or.set(u,O),console.warn(O),a.failOnViolation)throw new
|
|
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(
|
|
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
|
|
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++}},
|
|
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
|
+
`);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
|
+
`)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),G(u)])if(f.has(se))return!0}let x=[...new Set([`${u}.stx`,`${l(u)}.stx`,`${G(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:F}=await o("stx/variable-extractor",()=>import("./chunk-1vwgddct.js")),O=f??new Set;if(O.has(e))return`[Circular component reference: ${e}]`;let z=new Set(O);z.add(e);let W=typeof t.client==="string"?t.client.trim():"";if("client"in t)delete t.client;let B=W&&W!=="load"&&Pg(W)?W:"";try{let H=(oe)=>oe.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""),V=D.endsWith(".stx")?D.slice(0,-4):D,M=null,Z=a.__importedComponents;if(Z){let oe=[V,V.toLowerCase(),H(V),K(V)];for(let le of oe)if(Z.has(le)){M=Z.get(le);break}}let re=[];if(!M){let oe=[`${V}.stx`,`${H(V)}.stx`,`${K(V)}.stx`],le=[...new Set(oe)],Se=a.__originalFilePath,me=[];for(let _e of zn(u))if(!me.includes(_e))me.push(_e);let Je=me.length;for(let _e of l._layerComponentDirs??[])if(!me.includes(_e))me.push(_e);if(Se){let _e=ce.join(ce.dirname(Se),"components");me.push(_e)}let Ie=l._rootComponentsDir;if(typeof Ie==="string"&&Qo(i,l)&&!me.includes(Ie))me.push(Ie);if(i&&!me.includes(i))me.push(i);if(typeof Ie==="string"&&!me.includes(Ie))me.push(Ie);let xt=ce.join(ce.dirname(u),"components");if(!me.includes(xt))me.push(xt);if(l.componentsDir&&l.componentsDir!==i&&!me.includes(l.componentsDir))me.push(l.componentsDir);for(let _e of l.additionalComponentsDirs??[])if(_e&&!me.includes(_e))me.push(_e);let Rt=l._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(V),_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(V),Tt=_t.includes("update:value")&&!_t.includes("input"),tn=l._nativeHostAttrs&&/^video$/i.test(V),gs=l._nativeHostAttrs&&/^image$/i.test(V),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(V)&&!On.has(Dn),wr=l._targetComponentFallbackNames?.some((_e)=>_e.toLowerCase()===V.toLowerCase())??!1,ms=wr&&(!Rt||ds)&&(!$t||Tt)&&(!tn||Pn)&&(!gs||An)&&!Mn;for(let _e of ms?[]:l._targetComponentDirs??[])if(_e&&!me.includes(_e))me.push(_e);let It=typeof l.root==="string"?ce.resolve(l.root):void 0,Sr=It??ce.dirname(u),Pt=[];if(It)Pt.push(ce.resolve(It,"resources/views/components")),Pt.push(ce.resolve(It,"resources/components")),Pt.push(ce.resolve(It,"src/components")),Pt.push(ce.resolve(It,"components"));Pt.push(ce.resolve(import.meta.dir,"components"));for(let _e of Pt)if(!me.includes(_e))me.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=me.slice(Je).map((Qe)=>ce.isAbsolute(Qe)?Qe:ce.resolve(Sr,Qe)).filter((Qe)=>!bt.includes(Qe)),Nn=`${V}\x00${tt.join("\x00")}`,at=ur.get(Nn);if(at===void 0){at=!1;for(let Qe of tt){for(let vt of le)if(await s(ce.join(Qe,vt))){at=!0;break}if(at)break}ur.set(Nn,at)}if(!at){for(let Qe of bt){let vt=me.indexOf(Qe);if(vt>=0)me.splice(vt,1)}me.splice(Je,0,...bt)}}}let vr=l._pluginComponentDirs;if(Array.isArray(vr)){for(let _e of vr)if(typeof _e==="string"&&!me.includes(_e))me.push(_e)}if(l.fallbackComponentsDir&&!me.includes(l.fallbackComponentsDir))me.push(l.fallbackComponentsDir);if(ms){for(let _e of l._targetComponentDirs??[])if(_e&&!me.includes(_e))me.push(_e)}let jn=l._nativePrimitivesFallback;if(jn&&!jn.except.some((_e)=>_e.toLowerCase()===V.toLowerCase())&&!me.includes(jn.dir))me.push(jn.dir);let kr=[...new Set(me.map((_e)=>{if(!_e)return _e;return ce.isAbsolute(_e)?_e:ce.resolve(Sr,_e)}))];me.length=0,me.push(...kr);let hs=`${V}\x00${u}\x00${kr.join("\x00")}`,xs=ss.get(hs);if(xs)if(await s(xs))M=xs;else ss.delete(hs);if(!M&&(V.startsWith("./")||V.startsWith("../")))M=ce.resolve(ce.dirname(u),`${V}.stx`),re.push(M);else if(!M)for(let _e of me){if(!_e)continue;for(let bt of le){let tt=ce.join(_e,bt);if(re.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=ce.join(Qe.path,Ln.name);for(let ga of le){let bs=ce.join(Or,ga);if(re.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,re),Ko(e);x.add(M);let se;if(fn.has(M)&&lr.get(M)===Fo(M))se=fn.get(M);else try{let oe=Fo(M);se=await Bun.file(M).text(),fn.set(M,se),lr.set(M,oe)}catch(oe){let le=oe instanceof Error?oe.message:String(oe);return Zo(e,u,[M],le),Ko(e)}if(A)for(let oe of new Set([...Object.keys(t),...A.reactiveProps??[]])){let le=oe.toLowerCase();if(le.startsWith("aria-")||le.startsWith("data-"))continue;let Se=oe.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${Se}\\b`).test(se))A.declaredProps.add(oe);if(new RegExp(`\\$props\\s*(?:\\.\\s*${Se}\\b|\\[\\s*['"]${Se}['"]\\s*\\])`).test(se)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${Se}['"]`).test(se))A.consumedProps?.add(oe)}if(A?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(se))for(let oe of A.reactiveProps){if(Su.has(oe)||A.consumedProps?.has(oe))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${oe.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(se))continue;let le=`${M}\x00${oe}`;if(Xo.has(le))continue;Xo.add(le),console.warn(`[stx] ${ce.basename(M)} reads \`${oe}\` with defineProps(), which is not live, but ${ce.basename(u)} binds it (:${oe}): the value can arrive empty or stale (on a native screen, and for a :for's rows, it does not arrive at all). Read it with useReactiveProp('${oe}').`)}let fe=new Set(["__originalFilePath","__importedComponents",Hn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),xe={};for(let[oe,le]of Object.entries(a))if(!oe.startsWith("__")||fe.has(oe))xe[oe]=le;let pe=v.length>0?{[Gn]:[...v]}:{},Pe=n;if(n.includes("@include")){let{processIncludes:oe}=await o("stx/includes",()=>import("./chunk-f0kcmckh.js"));Pe=await oe(n,a,u,l,x)}if(/<[A-Z][\w.-]*[\s/>]/.test(Pe)){let{processComponents:oe}=await o("stx/component-renderer",()=>import("./chunk-x5ap19jt.js")),le={...a,__processedComponents:O,...pe};Pe=await oe(Pe,le,u,l,x);let Se=le.__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:oe}=await o("stx/expressions",()=>import("./chunk-v2712w9b.js")),le=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...pe}:v.length>0?{...a,...pe}:a;Pe=oe(Pe,le,u);for(let Se of Pe.matchAll(/\{\{([\s\S]*?)\}\}/g))Ke.push(Se[1].trim())}let Ae=Q(Pe),Xe=[],et=Ae.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(oe,le)=>{let Se=Ae.scripts[Number(le)]||"",me=Se.match(/^<script\b([^>]*)>/i)?.[1]||"",Je=me.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Ie=!Je||["module","text/javascript","application/javascript"].includes(Je),xt=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${me}`);if(!/\bserver\b/i.test(me)&&Ie&&!xt)return Xe.push(Se),"";return Se}),{extractSlotContent:Ye}=await o("stx/slots",()=>import("./chunk-kd82s3ry.js")),it=Ye(et),nt={};if(it.defaultSlot?.trim())nt.default=it.defaultSlot;for(let[oe,le]of it.namedSlots)nt[oe]=le.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:oe}=await o("stx/component-renderer",()=>import("./chunk-x5ap19jt.js"));se=await oe(se,De,M,l,x)}yu(se,De);let qt=se,dn=he(qt);if(dn)qt=dn.content.trim();let as=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Zt=[...se.matchAll(as)];for(let[,oe,le]of Zt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(oe))je(le,M,l.strict);let st=[],Kt=null,cs=Zt.some((oe)=>/\bserver\b/.test(oe[1]||"")&&/\bcache\b/.test(oe[1]||"")),Ct=null,dt=null,Xt=null,gn=0,Jt=null;if(pu(l),cs&&dr>0){let oe=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((le)=>le.configFile),uid:pt});if(oe!==null){Ct=`${M}\x00${_(se)}\x00${oe}`;let le=rs.get(Ct);if(le){for(let Se of le.dependencies)x.add(Se);if(pi(a,le.clientFactories),St.n+=le.uidsConsumed,le.preservedClientExpressions.length>0){let Se=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let me of le.preservedClientExpressions)Se.add(me);a.__stx_preserved_client_expressions=[...Se]}return le.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 oe of Zt){let le=oe[1]||"",Se=oe[2]||"",me=le.includes("server");if(Ve(le)&&Se.trim())Se=Ue(Se);if(me&&Se){for(let Ie of Fe(Se))Gt.add(Ie);try{await F(Se,De,M,{onFailure:(Ie)=>{if(Ie.kind!=="unknown")Kt=Ie.kind}})}catch(Ie){}}if(!me){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=le.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");st.push(`<script${_t}>${Ie}</script>`)}}let rt=Q(se).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Yt=rt?rt[1]:"",ls=rt?rt[2]:"",gt="",ie=Yt&&/\bscoped\b/i.test(Yt);if(rt)gt=`<style${Yt}>${wu(ls,De,M)}</style>`;let ae=qt;if(ae=ae.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),rt)ae=ae.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let oe=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,le=[];if(ae=ae.replace(oe,(Se,me)=>{let Je=me.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Je)le.push(`<style${Je[1]}>${Je[2]}</style>`);return""}),ae=ae.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),le.length>0)gt=`${gt}${le.join(`
|
|
577
|
-
`)}`}if(n&&
|
|
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-swp254eb.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-nrpqrqqe.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))}"`:"",Je=` 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,Je)??`<${Rn}${Je} 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
|
-
}`:At.factoryBody,Dn=
|
|
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
|
|
584
|
+
`+gt;if(st.length>0){let ae=De.__stx_event_bindings||[],ue=ze(De),Se=await Promise.all(st.map(async(he)=>{let Je=Wo(he,De,M);if(Je!==null)return Je;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(
|
|
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 Xe.length>0?`${Ze}
|
|
587
587
|
${Xe.join(`
|
|
588
|
-
`)}`:Ze}catch(
|
|
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,
|
|
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
|
+
`),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(`
|
|
591
591
|
`,Math.max(0,a-1));v=a-(D+1)+1}let A="";if(l>0)A+=`
|
|
592
592
|
${n}:${l}${v>0?`:${v}`:""}: ${e.toLowerCase()} error: ${t}
|
|
@@ -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-nqz4es8a.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-s6fe2wp6.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] || {};
|
|
@@ -670,7 +670,7 @@ ${O}
|
|
|
670
670
|
// Register all defined signals and functions in this scope
|
|
671
671
|
const __localVars = {};
|
|
672
672
|
try {
|
|
673
|
-
${z.map((
|
|
673
|
+
${z.map((H)=>V.has(H)?`Object.defineProperty(__localVars, '${H}', ${js(H)});`:`if (typeof ${H} !== 'undefined') __localVars['${H}'] = ${H};`).join(`
|
|
674
674
|
`)}
|
|
675
675
|
}
|
|
676
676
|
catch (e) {}
|
|
@@ -689,24 +689,24 @@ finally {
|
|
|
689
689
|
window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
|
|
690
690
|
window.__STX_CURRENT_PROPS__ = __previousCurrentProps;
|
|
691
691
|
}
|
|
692
|
-
}`,
|
|
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((
|
|
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
|
+
`);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
|
|
696
|
-
`),mn=t.params??{},Qt=[],en=[];for(let
|
|
697
|
-
${
|
|
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 Xe(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=Ge(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
|
+
`),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
|
+
${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()??
|
|
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,
|
|
702
|
-
`),
|
|
703
|
-
`+O;if(D<=0&&
|
|
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,Xe,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
|
+
`),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
|
+
`),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
|
+
`+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(`
|
|
704
704
|
`),n,i)}function Ou(e,t,n){let i=e.length,a="",u=0,l=null,f=!1,x=!1,v=0;while(u<i){let A=e[u],D=e[u+1];if(f){if(a+=A,A===`
|
|
705
|
-
`)f=!1;u++;continue}if(x){if(a+=A,A==="*"&&D==="/"){a+=D,u+=2,x=!1;continue}u++;continue}if(!l&&A==="/"&&D==="/"){f=!0,a+=A,u++;continue}if(!l&&A==="/"&&D==="*"){x=!0,a+=A,u++;continue}if(l){if(a+=A,A==="\\"){a+=D,u+=2;continue}if(A===l&&l!=="`"){l=null,u++;continue}if(l==="`"){if(A==="$"&&D==="{"){v++,a+=D,u+=2;continue}if(A==="`"){l=null,u++;continue}}u++;continue}if(v>0){if(A==="{")v++;else if(A==="}")v--}if(A==='"'||A==="'"||A==="`"){l=A,a+=A,u++;continue}if(A==="a"&&e.startsWith("await",u)){let
|
|
706
|
-
`);return{type:z,name:
|
|
705
|
+
`)f=!1;u++;continue}if(x){if(a+=A,A==="*"&&D==="/"){a+=D,u+=2,x=!1;continue}u++;continue}if(!l&&A==="/"&&D==="/"){f=!0,a+=A,u++;continue}if(!l&&A==="/"&&D==="*"){x=!0,a+=A,u++;continue}if(l){if(a+=A,A==="\\"){a+=D,u+=2;continue}if(A===l&&l!=="`"){l=null,u++;continue}if(l==="`"){if(A==="$"&&D==="{"){v++,a+=D,u+=2;continue}if(A==="`"){l=null,u++;continue}}u++;continue}if(v>0){if(A==="{")v++;else if(A==="}")v--}if(A==='"'||A==="'"||A==="`"){l=A,a+=A,u++;continue}if(A==="a"&&e.startsWith("await",u)){let U=Du(e,u);if(U){let{quote:O,path:z,end:V}=U;if(z.startsWith(".")||z.startsWith("~/")||z.startsWith("@/")){let F=z.startsWith(".")?ut.resolve(t,z):ut.resolve(n,z.slice(2));a+=`await import(${O}${F}${O})`,u=V;continue}}}a+=A,u++}return a}function Du(e,t){let n=t+5;if(n>=e.length)return null;if(!/\s/.test(e[n]))return null;while(n<e.length&&/\s/.test(e[n]))n++;if(!e.startsWith("import",n))return null;n+=6;while(n<e.length&&/\s/.test(e[n]))n++;if(e[n]!=="(")return null;n++;while(n<e.length&&/\s/.test(e[n]))n++;let i=e[n];if(i!=="'"&&i!=='"')return null;n++;let a=n;while(n<e.length&&e[n]!==i)if(e[n]==="\\")n+=2;else n++;if(n>=e.length)return null;let u=e.slice(a,n);n++;while(n<e.length&&/\s/.test(e[n]))n++;if(e[n]!==")")return null;return{quote:i,path:u,end:n+1}}function ua(e,t){let n=e[t];if(n!=="{"&&n!=="[")return null;let a=k(e,n,n==="{"?"}":"]",t);if(a===-1)return null;return{pattern:e.slice(t,a+1),endPos:a+1}}function fa(e){let t=[],n=e.slice(1,-1).trim();if(!n)return t;let i=0,a=0,u="";while(i<n.length){let l=n[i];if(l==="{"||l==="["){let f=a===0?ua(n,i):null;if(f){t.push(...fa(f.pattern)),i=f.endPos,u="";continue}a++}else if(l==="}"||l==="]")a--;if(a>0){i++;continue}if(l===","){if(u.trim())t.push(u.trim());u="",i++;continue}if(l===":"){u="",i++;continue}if(l==="="){if(u.trim())t.push(u.trim());u="",i++;while(i<n.length&&n[i]!==","&&a===0){if(n[i]==="{"||n[i]==="[")a++;else if(n[i]==="}"||n[i]==="]")a--;i++}continue}if(/[\w$]/.test(l))u+=l;i++}if(u.trim())t.push(u.trim());return t}function xg(e){let t=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(e);if(!t)return null;let n=t[0].length,i=(a)=>a===" "||a==="\t";while(n<e.length&&i(e[n]))n++;if(e[n]===":"){let a=0,u=null;n++;for(;n<e.length;n++){let l=e[n];if(u){if(l==="\\"){n++;continue}if(l===u)u=null;continue}if(l==="'"||l==='"'||l==="`"){u=l;continue}if(l==="("||l==="["||l==="{"||l==="<"){a++;continue}if(l===")"||l==="]"||l==="}"||l===">"){a--;continue}if(l==="="&&a<=0){let f=e[n+1],x=e[n-1];if(f!=="="&&f!==">"&&x!=="="&&x!=="!"&&x!=="<"&&x!==">")break}}if(e[n]!=="=")return null}while(n<e.length&&i(e[n]))n++;if(e[n]!=="=")return null;return{type:t[1],name:t[2],value:e.slice(n+1).trim()}}function ia(e,t,n,i){let a=null,u=!1;for(let l of e){if(u){u=!1;continue}if(l==="\\"){u=!0;continue}if(a){if(l===a)a=null;continue}if(l==="'"||l==='"'||l==="`"){a=l;continue}if(l===t)i++;else if(l===n)i--}return i}function oa(e,t){let n=e[t].trim(),i=xg(n),a=i?[n,i.type,i.name,i.value]:null;if(!a){let A=n.match(/^(?:export\s+)?(const|let|var)\s+/);if(A){let D=n.slice(A[0].length),U=t;if(D.startsWith("{")||D.startsWith("[")){let z=D[0],V=z==="{"?"}":"]",F=ia(D,z,V,0),q=D;for(let H=t+1;H<e.length&&F>0;H++)q+=` ${e[H].trim()}`,U=H,F=ia(e[H],z,V,F);if(F>0)q=D,U=t;D=q}let O=ua(D,0);if(O){let z=A[1],V=O.pattern,F=D.slice(O.endPos).trim();if(F.startsWith("=")){let q=F.slice(1).trim(),H=q,M=Math.max(U,t);if(aa(q)){let fe=ca(e,M,q);H=fe.value,M=fe.nextIndex}else M=M+1;H=H.trim().replace(/;$/,"");let Q=fa(V),ie=`__stx_src_${t}`,se=Q.map((fe)=>`module.exports.${fe} = ${fe};`).join(`
|
|
706
|
+
`);return{type:z,name:ie,value:`${H}; ${z} ${V} = ${ie};
|
|
707
707
|
${se}`,nextIndex:M}}}}throw Error(`Failed to parse variable declaration: ${n}`)}let[,u,l,f]=a,x=f,v=t;if(aa(f)){let A=ca(e,t,f);x=A.value,v=A.nextIndex}else v=t+1;while(v<e.length){let A=e[v].trim();if(A.startsWith(".")||A.startsWith("?."))x+=`
|
|
708
708
|
${e[v]}`,v++;else break}return x=x.trim().replace(/;$/,""),{type:u,name:l,value:x,nextIndex:v}}function xr(e,t){let n=e[t].trim(),i=n.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!i)throw Error(`Failed to parse function declaration: ${n}`);let[,a]=i,u=n.replace(/^export\s+/,""),l=t;if(Mu(n)){let f=ju(e,t,u);u=f.functionCode,l=f.nextIndex}else l=t+1;return{name:a,functionCode:u,nextIndex:l}}function aa(e){let t=e.trim();if(t.startsWith("{"))return k(t,"{","}",0)===-1;if(t.startsWith("["))return k(t,"[","]",0)===-1;return!pa(t)}function pa(e){let t={paren:0,bracket:0,brace:0},n=null,i=0;for(let a=0;a<e.length;a++){let u=e[a];if((a>0?e[a-1]:"")==="\\"&&n)continue;if((u==='"'||u==="'")&&!n){n=u;continue}if(u===n&&n!=="`"){n=null;continue}if(u==="`"&&!n){n="`";continue}if(u==="`"&&n==="`"&&i===0){n=null;continue}if(n==="`"&&u==="$"&&e[a+1]==="{"){i++,a++;continue}if(i>0&&u==="{"){i++;continue}if(i>0&&u==="}"){i--;continue}if(n)continue;if(u==="(")t.paren++;else if(u===")")t.paren--;else if(u==="[")t.bracket++;else if(u==="]")t.bracket--;else if(u==="{")t.brace++;else if(u==="}")t.brace--}return t.paren===0&&t.bracket===0&&t.brace===0&&n===null}function da(e){let t=e.indexOf("(");if(t===-1)return e.indexOf("{");let n=k(e,"(",")",t);if(n===-1)return-1;return e.indexOf("{",n)}function Mu(e){let t=da(e);if(t===-1)return!0;return k(e,"{","}",t)===-1}function ca(e,t,n){let i=n,a=t+1;while(a<e.length&&!pa(i)){let u=e[a];i+=`
|
|
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,
|
|
712
|
+
export{Me,Ce,K,js,Bs,G,_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,Gc,Ws,vi,Xc,Jc,xi,Si,wn,qs,vn,Bt,Ft,Yc,Ks,Zc,Qc,xn,Pr,Gs,Xs,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,X,re,En,Te,Ng,Ri,Dg,yy,R,Ai,Mg,by,I,wy};
|