@stacksjs/stx 0.2.863 → 0.2.864
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-gp8hgpt9.js → chunk-01mwbg1r.js} +3 -3
- package/dist/{chunk-fnv94wc6.js → chunk-0v2yj490.js} +1 -1
- package/dist/chunk-0zxzcrns.js +2 -0
- package/dist/chunk-18qvx7b0.js +2 -0
- package/dist/{chunk-zr22gtpf.js → chunk-1smbjj34.js} +1 -1
- package/dist/chunk-28nk2zej.js +2 -0
- package/dist/chunk-2mgajzam.js +2 -0
- package/dist/{chunk-k7dxm48r.js → chunk-4w8a7f8t.js} +1 -1
- package/dist/chunk-53797jvm.js +2 -0
- package/dist/{chunk-zsnmk5me.js → chunk-5dvkphbe.js} +1 -1
- package/dist/{chunk-v408qsze.js → chunk-5kkq2eqr.js} +1 -1
- package/dist/{chunk-xfd3yqgj.js → chunk-6mhj42gz.js} +12 -12
- package/dist/chunk-6nzdsh2c.js +2 -0
- package/dist/{chunk-ks5p5w6z.js → chunk-6y066pr2.js} +1 -1
- package/dist/chunk-709hfmpj.js +2 -0
- package/dist/{chunk-8502xb4n.js → chunk-79y9amt1.js} +7 -7
- package/dist/{chunk-8v1zpdef.js → chunk-7chzhef2.js} +1 -1
- package/dist/{chunk-5s1fb8z4.js → chunk-7wpk300q.js} +1 -1
- package/dist/{chunk-sj3ry5ck.js → chunk-7xhwqc0c.js} +7 -1
- package/dist/{chunk-z383x16t.js → chunk-8010hzhm.js} +1 -1
- package/dist/{chunk-yhc1c4tr.js → chunk-83qwwnye.js} +52 -52
- package/dist/{chunk-mfa07erx.js → chunk-83tvkw4y.js} +1 -1
- package/dist/{chunk-1grdbpsk.js → chunk-8ay0nq31.js} +2 -2
- package/dist/{chunk-2c18y094.js → chunk-8v8eawjw.js} +1 -1
- package/dist/{chunk-5p1k2h5q.js → chunk-8yybk485.js} +1 -1
- package/dist/chunk-9cwag0tk.js +2 -0
- package/dist/{chunk-vwwpbhd2.js → chunk-a98jgxkb.js} +1 -1
- package/dist/chunk-aef82ns3.js +2 -0
- package/dist/{chunk-ztbexx3h.js → chunk-axkgbc0k.js} +1 -1
- package/dist/chunk-az12j7cr.js +2 -0
- package/dist/{chunk-46ddesnf.js → chunk-b666d8m6.js} +1 -1
- package/dist/{chunk-y190sh29.js → chunk-brs63ht2.js} +9 -9
- package/dist/chunk-byve4g2y.js +2 -0
- package/dist/{chunk-jfmj0wsy.js → chunk-cdbmfe7d.js} +1 -1
- package/dist/{chunk-az5xw3w8.js → chunk-cjy9cdm0.js} +1 -1
- package/dist/chunk-cwjt04kc.js +2 -0
- package/dist/chunk-d10cq130.js +2 -0
- package/dist/{chunk-32ty2zx6.js → chunk-df0ry01a.js} +1 -1
- package/dist/{chunk-qxw9h564.js → chunk-ehd68fc7.js} +1 -1
- package/dist/{chunk-yr1zx78b.js → chunk-epct9fqd.js} +2 -2
- package/dist/{chunk-reeaknf2.js → chunk-eq40b4n4.js} +1 -1
- package/dist/{chunk-58sh82aj.js → chunk-ez6e7rh1.js} +1 -1
- package/dist/chunk-f0b3ca2n.js +2 -0
- package/dist/chunk-f52b9hjv.js +2 -0
- package/dist/{chunk-bx5d87xx.js → chunk-f6ypmk8x.js} +1 -1
- package/dist/{chunk-s9df8srx.js → chunk-fd1bpv35.js} +3 -3
- package/dist/{chunk-wk4wg6sn.js → chunk-fh8jzm4b.js} +2 -2
- package/dist/{chunk-0xtda6aw.js → chunk-fmzyrg2e.js} +1 -1
- package/dist/{chunk-qa5y30sy.js → chunk-g0xn80gz.js} +7 -7
- package/dist/{chunk-gw7t6a3t.js → chunk-gheba4nb.js} +1 -1
- package/dist/{chunk-hc6111md.js → chunk-h4rjzbek.js} +4 -4
- package/dist/{chunk-w468n41y.js → chunk-hpfq5qe4.js} +18 -18
- package/dist/{chunk-xymr4ys9.js → chunk-jbgj2hph.js} +1 -1
- package/dist/{chunk-15m7jnc0.js → chunk-jwghpcqn.js} +1 -1
- package/dist/{chunk-x512h2gv.js → chunk-kh6njq2r.js} +2 -2
- package/dist/{chunk-jgra00m8.js → chunk-kh7hbgx6.js} +1 -1
- package/dist/{chunk-d0afg5f7.js → chunk-ma1tf68v.js} +1 -1
- package/dist/{chunk-wtfamngc.js → chunk-mrw6vmqy.js} +4 -4
- package/dist/{chunk-dtarm8x9.js → chunk-nack2xs5.js} +4 -4
- package/dist/{chunk-ntbe5q5x.js → chunk-ndez5ee8.js} +2 -2
- package/dist/{chunk-h816ta81.js → chunk-p8x0a0fp.js} +2 -2
- package/dist/{chunk-pyckafsb.js → chunk-pfs0gv2a.js} +1 -1
- package/dist/{chunk-gjngg182.js → chunk-pghp2tkv.js} +8 -8
- package/dist/{chunk-g4gcf4jn.js → chunk-ppfp1w98.js} +1 -1
- package/dist/{chunk-xcjvx6zt.js → chunk-ptxptv29.js} +1 -1
- package/dist/{chunk-021tjkd6.js → chunk-q22fpqtr.js} +1 -1
- package/dist/chunk-qcvfzskb.js +2 -0
- package/dist/{chunk-5zzrrxns.js → chunk-qjbjn6vz.js} +4 -4
- package/dist/{chunk-dpmayc2w.js → chunk-r0v2chpn.js} +2 -2
- package/dist/{chunk-b6w0f610.js → chunk-rme1a5qv.js} +19 -19
- package/dist/{chunk-669b2bya.js → chunk-rw5492e2.js} +3 -3
- package/dist/{chunk-czca8yds.js → chunk-sxdzpv90.js} +1 -1
- package/dist/{chunk-2n932qtv.js → chunk-syzggy76.js} +1 -1
- package/dist/{chunk-nttsc0aw.js → chunk-t2a6j64z.js} +5 -5
- package/dist/{chunk-qmkaqjba.js → chunk-t9r644tq.js} +1 -1
- package/dist/{chunk-x3p4emdp.js → chunk-tbq6msyc.js} +1 -1
- package/dist/chunk-v7jjrz5k.js +2 -0
- package/dist/{chunk-prrvggcy.js → chunk-vkj9fem6.js} +1 -1
- package/dist/chunk-w463vqkh.js +2 -0
- package/dist/{chunk-p0tkhd12.js → chunk-w8qr5414.js} +1 -1
- package/dist/{chunk-y036cwc7.js → chunk-wcvzsyf1.js} +2 -2
- package/dist/chunk-wxng15a3.js +2 -0
- package/dist/{chunk-yakdcak2.js → chunk-x5n2jc6m.js} +1 -1
- package/dist/{chunk-qbghf76y.js → chunk-x64afx6z.js} +2 -2
- package/dist/chunk-xsscsar3.js +3 -0
- package/dist/{chunk-r4v4vswq.js → chunk-y69k2fww.js} +1 -1
- package/dist/chunk-yrstc4z4.js +2 -0
- package/dist/chunk-z6c4c951.js +2 -0
- package/dist/{chunk-85zmxbt0.js → chunk-zdrn7wp0.js} +4 -4
- package/dist/cli.js +13 -13
- package/dist/client/signals-component-props-runtime.js +7 -1
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/native/floating-actions-web.d.ts +20 -0
- package/dist/native/floating-actions-web.js +177 -0
- package/dist/native/floating-actions.d.ts +8 -1
- package/dist/native/floating-actions.js +1 -1
- package/dist/native/primitives/FloatingActions.stx +22 -2
- package/dist/pwa.js +3 -3
- package/dist/site-builder/build.d.ts +6 -0
- package/dist/site-builder/build.js +13 -3
- package/dist/site-builder/types.d.ts +3 -0
- package/dist/ssg.js +4 -4
- package/package.json +5 -5
- package/dist/chunk-0bfgsv31.js +0 -2
- package/dist/chunk-36j129p1.js +0 -2
- package/dist/chunk-7mjf144y.js +0 -2
- package/dist/chunk-a4cn8rf4.js +0 -2
- package/dist/chunk-ap84eenm.js +0 -2
- package/dist/chunk-as2ffje6.js +0 -2
- package/dist/chunk-c0t2tdfk.js +0 -2
- package/dist/chunk-caxqwrnc.js +0 -2
- package/dist/chunk-d9vzfbdp.js +0 -2
- package/dist/chunk-e634vffz.js +0 -3
- package/dist/chunk-g65dptx2.js +0 -2
- package/dist/chunk-kw11yydy.js +0 -2
- package/dist/chunk-ns04v3am.js +0 -2
- package/dist/chunk-p2etn78y.js +0 -2
- package/dist/chunk-r23zq8yk.js +0 -2
- package/dist/chunk-rqmb09ss.js +0 -2
- package/dist/chunk-sz6d3v6b.js +0 -2
- package/dist/chunk-va07zs9v.js +0 -2
- package/dist/chunk-vc42mvjn.js +0 -2
- package/dist/chunk-xzdkjkyp.js +0 -2
- package/dist/chunk-ybkwnscv.js +0 -2
- package/dist/chunk-z3gz5fy4.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-k7dxm48r.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-qa5y30sy.js";import{r,we}from"./chunk-x7redxyd.js";import{b}from"./chunk-94mpe1ny.js";import{Y}from"./chunk-bwdbj60y.js";import{c}from"./chunk-s9df8srx.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,j}from"./chunk-k32q90b2.js";import{Tn}from"./chunk-4w8a7f8t.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`
|
|
3
3
|
(function() {
|
|
4
4
|
var $el = document.getElementById('${n}');
|
|
5
5
|
if (!$el) return;
|
|
@@ -112,7 +112,7 @@ else {
|
|
|
112
112
|
`)}
|
|
113
113
|
})();
|
|
114
114
|
</script>`}function $a(e,t=""){let n=qr(e,t);if(n.length===0)return{template:e,bindings:[]};let i=e,a=[];for(let u=n.length-1;u>=0;u--){let l=n[u],f=l.originalTag;if(!f.includes(" id="))f=f.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${l.elementId}"`);else{let x=f.match(/id=["']([^"']+)["']/);if(x)for(let v of l.events)v.elementId=x[1]}for(let x of l.events){let v=x.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),A=new RegExp(`\\s*${v}\\s*=\\s*"[^"]*"`,"g"),D=new RegExp(`\\s*${v}\\s*=\\s*'[^']*'`,"g");f=f.replace(A,""),f=f.replace(D,"")}i=i.slice(0,l.startIndex)+f+i.slice(l.endIndex),a.push(...l.events)}return{template:i,bindings:a}}function Ur(e){let t=e.$uid;return typeof t==="string"&&t?`${t}_`:""}function Hc(e,t,n){if(Cl(e))return e;if(t.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:f,bindings:x}=$a(e,Ur(t)),v=t.__stx_event_bindings||[];return t.__stx_event_bindings=[...v,...x],f}let i=qr(e,Ur(t));if(i.length===0)return e;let a=e;for(let f=i.length-1;f>=0;f--){let x=i[f],v=x.originalTag;if(!v.includes(" id="))v=v.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${x.elementId}"`);else{let A=v.match(/id=["']([^"']+)["']/);if(A)for(let D of x.events)D.elementId=A[1]}for(let A of x.events){let D=A.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),F=new RegExp(`\\s*${D}\\s*=\\s*"[^"]*"`,"g"),O=new RegExp(`\\s*${D}\\s*=\\s*'[^']*'`,"g");v=v.replace(F,""),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 Mt(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 De="0.2.863";var Gr=Symbol.for(`stx.lazy-module-promises.${De}`);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">
|
|
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.864";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">
|
|
116
116
|
@layer vendor {
|
|
117
117
|
${t.contents}
|
|
118
118
|
}
|
|
@@ -132,7 +132,7 @@ ${Wa(e,t)}`;return""}function fy(e,t=[]){let{browserImports:n}=al(e),i=new Set(t
|
|
|
132
132
|
+ 'or it should be imported from a relative path so the bundler includes it.'
|
|
133
133
|
);
|
|
134
134
|
});
|
|
135
|
-
`}function ze(e){let t=e.__stxClientPayload;if(t&&typeof t==="object"){let i={};for(let a in t){let u=t[a];if(typeof u==="function")continue;i[a]=u}return i.__stxDeclaredPayload=!0,i}let n={};for(let i in e){if(i.startsWith("__")||i.startsWith("$"))continue;let a=e[i];if(typeof a==="function")continue;n[i]=a}return n}var Fa=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,ni=new Set;function Va(e,t){let n=Fa.test(e),i=t.length>32768;if(!n&&!i)return;if(ni.has(e))return;if(ni.add(e),n)console.warn(`[stx] server\u2192client bridge is publishing "${e}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(i)console.warn(`[stx] server\u2192client bridge is publishing ${(t.length/1024).toFixed(1)}KB under "${e}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function kn(e,t){if(!t)return"";let n=Le(e,new Set(Object.keys(t))),i=t.__stxDeclaredPayload===!0,a=[],u=Object.entries(t).sort(([l],[f])=>l<f?-1:l>f?1:0);for(let[l,f]of u){if(!/^[A-Za-z_$][\w$]*$/.test(l))continue;if(l.startsWith("__")||l.startsWith("$"))continue;if(!i&&!n.has(l))continue;if(
|
|
135
|
+
`}function ze(e){let t=e.__stxClientPayload;if(t&&typeof t==="object"){let i={};for(let a in t){let u=t[a];if(typeof u==="function")continue;i[a]=u}return i.__stxDeclaredPayload=!0,i}let n={};for(let i in e){if(i.startsWith("__")||i.startsWith("$"))continue;let a=e[i];if(typeof a==="function")continue;n[i]=a}return n}var Fa=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,ni=new Set;function Va(e,t){let n=Fa.test(e),i=t.length>32768;if(!n&&!i)return;if(ni.has(e))return;if(ni.add(e),n)console.warn(`[stx] server\u2192client bridge is publishing "${e}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(i)console.warn(`[stx] server\u2192client bridge is publishing ${(t.length/1024).toFixed(1)}KB under "${e}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function kn(e,t){if(!t)return"";let n=Le(e,new Set(Object.keys(t))),i=t.__stxDeclaredPayload===!0,a=[],u=Object.entries(t).sort(([l],[f])=>l<f?-1:l>f?1:0);for(let[l,f]of u){if(!/^[A-Za-z_$][\w$]*$/.test(l))continue;if(l.startsWith("__")||l.startsWith("$"))continue;if(!i&&!n.has(l))continue;if(Dt(e,l)){if(i)console.warn(`[stx] defineClientPayload declares "${l}", but this client block also declares "${l}" at the top level, so the server value is not published (emitting it would be a duplicate binding). Rename the local, or drop "${l}" from defineClientPayload.`);continue}let x;try{x=JSON.stringify(f)}catch{continue}if(x===void 0)continue;Va(l,x),a.push(` var ${l} = ${x.replace(/</g,"\\u003c")};`)}if(a.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
|
|
136
136
|
${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) {
|
|
@@ -182,7 +182,7 @@ else {
|
|
|
182
182
|
// STX: auto-generated event bindings
|
|
183
183
|
${e.map((n,i)=>qa(n,i)).join(`
|
|
184
184
|
`)}`}function si(e){let t=[],n=new Set,i=e.replace(/^\s*import\s+.*$/gm,""),a=0,u=i.length,l=0;while(l<u){let f=i[l];if(f==="'"||f==='"'||f==="`"){let x=f;if(l++,x==="`"){let v=0;while(l<u){if(i[l]==="\\"){l+=2;continue}if(i[l]==="`"&&v===0){l++;break}if(i[l]==="$"&&i[l+1]==="{"){v++,l+=2;continue}if(i[l]==="}"&&v>0){v--,l++;continue}l++}}else while(l<u){if(i[l]==="\\"){l+=2;continue}if(i[l]===x){l++;break}l++}continue}if(f==="/"&&i[l+1]==="/"){while(l<u&&i[l]!==`
|
|
185
|
-
`)l++;continue}if(f==="/"&&i[l+1]==="*"){l+=2;while(l<u-1&&!(i[l]==="*"&&i[l+1]==="/"))l++;l+=2;continue}if(f==="{"){a++,l++;continue}if(f==="}"){a--,l++;continue}if(a===0){let x=i.slice(l),v=x.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(v){let F=v[1];if(!F.startsWith("_")&&!n.has(F))t.push(F),n.add(F);l+=v[0].length;continue}let A=x.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){A[1].split(",").forEach((F)=>{let O=F.trim(),z=O.indexOf(":"),W=z>=0?O.slice(z+1).trim().split(/[\s=]/)[0]:O.split(/[\s=]/)[0];if(W&&!W.startsWith("_")&&!n.has(W))t.push(W),n.add(W)}),l+=A[0].length;continue}let D=x.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(D){let F=D[1];if(!F.startsWith("_")&&!n.has(F))t.push(F),n.add(F);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(F){let O;while((O=n.exec(F))!==null){let z=O[0];if(!Ka.has(z))t.add(z)}}let a=/\{\{([\s\S]*?)\}\}/g,u;while((u=a.exec(e))!==null)i(u[1]);let l=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((u=l.exec(e))!==null)i(u[1]);let f=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((u=f.exec(e))!==null)i(u[1]);let x=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((u=x.exec(e))!==null)i(u[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((u=v.exec(e))!==null)i(u[1]);let A=/@model\s*=\s*["']([^"']*)["']/gi;while((u=A.exec(e))!==null)i(u[1]);let D=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((u=D.exec(e))!==null)i(u[1]);return t}async function He(e,t={}){let n=e,i="",a=!1,u=[],l=Ci(n,{filePath:t.filePath,projectRoot:t.projectRoot});n=l.code;let f=Ei(l.styles),x=zt(n);n=x.code,u=[...x.imports,...x.models];let{hasUserImports:v,bundleClientScript:A}=await o("stx/client-script-bundler",()=>import("./chunk-
|
|
185
|
+
`)l++;continue}if(f==="/"&&i[l+1]==="*"){l+=2;while(l<u-1&&!(i[l]==="*"&&i[l+1]==="/"))l++;l+=2;continue}if(f==="{"){a++,l++;continue}if(f==="}"){a--,l++;continue}if(a===0){let x=i.slice(l),v=x.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(v){let F=v[1];if(!F.startsWith("_")&&!n.has(F))t.push(F),n.add(F);l+=v[0].length;continue}let A=x.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){A[1].split(",").forEach((F)=>{let O=F.trim(),z=O.indexOf(":"),W=z>=0?O.slice(z+1).trim().split(/[\s=]/)[0]:O.split(/[\s=]/)[0];if(W&&!W.startsWith("_")&&!n.has(W))t.push(W),n.add(W)}),l+=A[0].length;continue}let D=x.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(D){let F=D[1];if(!F.startsWith("_")&&!n.has(F))t.push(F),n.add(F);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(F){let O;while((O=n.exec(F))!==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-yrstc4z4.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((Z)=>!u.includes(Z)))}if(i=`${kn(n,t.serverData)}${i}`,n=N(n),!a&&Ve(t.attrs||""))n=Ue(n);let D=Za(t.eventBindings||[]),F=(t.attrs||"").trim(),O=/\btype\s*=\s*["']module["']/i.test(F),z=t.instanceId?` data-stx-instance="${t.instanceId}"`:"";if(O){let M=F.replace(/\btype\s*=\s*["']module["']/i,"").trim(),Z=`type="module" data-stx-scoped${z}${M?` ${M}`:""}`;return`${f}<script ${Z}>
|
|
186
186
|
${ue(`${i}${n}
|
|
187
187
|
${D}`)}
|
|
188
188
|
</script>`}let W=Fi(e),B=/function __stx_setup_/.test(n),H=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function V(M){let Z=M.length>0?`
|
|
@@ -205,7 +205,7 @@ ${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
|
|
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 F=e.indexOf("-->",i+4);if(F===-1)break;n=F+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 F=e[l];if(f){if(F===f)f=null}else if(F==='"'||F==="'")f=F;else if(F===">")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 F=D??(A==="script"?Vn:Un);F.lastIndex=n;let O=F.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 X(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 Q(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,X,(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"),F=D.exec(e);while(F!==null){let O=i.get(JSON.parse(F[1]));if(O!==void 0)a.push({start:F.index,end:F.index+F[0].length,replacement:ue(`(${O})(${F[2]});`)});F=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() {
|
|
@@ -214,8 +214,8 @@ ${ue(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
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
|
|
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
|
|
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 ne(n,u,x,!0,i.length)}catch(f){if(f instanceof de)throw f;return i}}),n}function yy(e,t,n={}){let{output:i,scripts:a}=Q(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 F=`<script${Dg(v,t)}>`;if(/\bsrc\s*=/.test(v)||/\btype\s*=\s*["']application\/json["']/.test(v))return F+A+l.slice(x);return F+Ri(A,t)+l.slice(x)});return Er(i,u)}function*Xi(e,t,n,i){let a=e,u=(W,B)=>{let H=bn(W,B);if(H===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(W.slice(B,H))?-1:H},l=(W,B,H,V)=>{let M=H.length,{output:Z,tokens:re}=ye(W,B,(se,fe)=>V(M+fe));return H.push(...re),Z},f=[];a=l(a,u,f,(W)=>`<!--__STX_STYLE_${W}__-->`);let x=[];a=l(a,X,x,(W)=>`<!--__STX_SCRIPT_EXPR_${W}__-->`);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,(W,B,H)=>{if(L(B,A))return W;try{let V=I(B,t,!1,(M)=>Ps(M,W,n,e));return V!==void 0&&V!==null?String(V):""}catch(V){let M=V instanceof Error?V.message:String(V);return y("Expression",`Error evaluating: {{{ ${B.trim()}}}}: ${M}`,n,e,H,W)}},3),a=a.replace(/\{!!([\s\S]*?)!!\}/g,(W,B,H)=>{if(L(B,A))return W;try{let V=I(B,t,!1,(M)=>Ps(M,W,n,e));if(V===void 0&&t.__stx_buildMode==="compile")return Zn("raw",B.trim());return V!==void 0&&V!==null?String(V):""}catch(V){if(t.__stx_buildMode==="compile")return Zn("raw",B.trim());let M=V instanceof Error?V.message:String(V);return y("Expression",`Error evaluating: {!! ${B.trim()} !!}: ${M}`,n,e,H,W)}}),a=l(a,X,x,(W)=>`<!--__STX_SCRIPT_EXPR_${W}__-->`),a=l(a,u,f,(W)=>`<!--__STX_STYLE_${W}__-->`);let F=v?Ng(a):[],O=Yn(a).map((W)=>({...W,names:new Set(ee(`${W.binding} in __slot`))})),z=new Set(ct(t));if(a=yield*Zi(a,(W,B,H)=>{let V=B.trim();if(xc(a,H,B))return W;if(Bi(O,H,V))return W;if(L(V,z))return W;if(F.length>0&&Bi(F,H,V))return W;if(D.has(V))return W;let M=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],Z=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,se=V.match(Z)?.[1],fe=se&&((se in t)||M.includes(se)),xe=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,pe=V.match(xe),Pe=pe&&!M.includes(pe[1])&&!(pe[1]in t);if(/^__[A-Z_]+__$/.test(V))return"";if(L(V,A))return W;if(t.__stx_native_screen===!0&&Sc(V,t))return W;let Ke;try{let Ae=I(B,t,!1,(et)=>{Ke=et});if(v&&!Wi(V,t))return W;if(Ke)Ps(Ke,W,n,e);if(t.__stx_buildMode==="compile"&&!v&&(Ae===void 0||$c(V,t)))return Zn("expr",V);if(Ae===void 0||Ae===null)return"";let Xe=String(Ae);return ne(a,H,Xe,!1,W.length)}catch(Ae){if(Ae instanceof de)throw Ae;if(v&&!Wi(V,t))return W;if(Pe)return W;let Xe=Ae instanceof Error?Ae.message:String(Ae);return y("Expression",`Error evaluating: {{ ${V} }}: ${Xe}`,n,e,H,W)}},2,i),x.length>0)a=a.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(W,B)=>x[Number(B)]??W);if(f.length>0)a=a.replace(/<!--__STX_STYLE_(\d+)__-->/g,(W,B)=>f[Number(B)]??W);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 F=[],O="",z=null,W=0,B=0,H=0,V=!1;for(let M=0;M<D.length;M++){let Z=D[M];if(V){O+=Z,V=!1;continue}if(Z==="\\"){O+=Z,V=!0;continue}if(z){if(O+=Z,Z===z)z=null;continue}if(Z==='"'||Z==="'"||Z==="`"){z=Z,O+=Z;continue}if(Z==="(")W++;else if(Z===")")W--;else if(Z==="[")B++;else if(Z==="]")B--;else if(Z==="{")H++;else if(Z==="}")H--;if(Z===","&&W===0&&B===0&&H===0){F.push(O),O="";continue}O+=Z}if(O)F.push(O);x=F.map((M)=>{let Z=M.trim();return I(Z,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(!Y())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 F=D[1],O=`${t}_${F}`;v.set(F,O)}}for(let A of f){let D=Yi(A,t,i,a,v,l);x.push(D)}return x.join(`
|
|
219
219
|
|
|
220
220
|
`)}function Os(e){let t=[],n=e.replace(/\/\*[\s\S]*?\*\//g,""),i=0,a="",u=!1,l="";for(let f=0;f<n.length;f++){let x=n[f];if(x==="@"&&i===0)u=!0;if(x==="{")i++;else if(x==="}"){if(i--,i===0){if(u){l+=x;let v=l.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(v){let[,A,D,F]=v;if(A==="keyframes")t.push({selector:`@keyframes ${D.trim()}`,declarations:F.trim()});else if(A==="media"||A==="supports"||A==="container"){let O=Os(F);t.push({selector:`@${A} ${D.trim()}`,declarations:O.map((z)=>`${z.selector} { ${z.declarations} }`).join(`
|
|
221
221
|
`)})}else t.push({selector:`@${A} ${D.trim()}`,declarations:F.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((F)=>Yi(F,t,n,i,a,u)).join(`
|
|
@@ -505,7 +505,7 @@ window.__stx_reactive = (function() {
|
|
|
505
505
|
${wl()}
|
|
506
506
|
${i}
|
|
507
507
|
</script>`}function Qc(e,t,n,i=!1){if(!Ns(e))return e;let a=hl(e);if(a.length===0)return e;let u=$l(e,a),l=Sl(a,t,i),f=c(u);if(f!==-1)u=u.slice(0,f)+l+`
|
|
508
|
-
`+u.slice(f);else u+=l;return u}function $l(e,t){let n=[],i=0;for(let[u,l]of oo(e).entries()){let f=t[u];if(!f)break;n.push(e.slice(i,l.startIndex));let x=Qn(l.attributes,"data-stx-scope");if(x)f.id=x,f.selector=`[data-stx-scope="${f.id}"]`,n.push(l.fullMatch);else n.push(`<${l.tagName} data-stx-scope="${f.id}"${l.attributes}>`);i=l.endIndex}n.push(e.slice(i));let a=n.join("");return a=a.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),a=a.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),a=a.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),a=a.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),a=a.replace(/\s*x-destroy\s*=\s*"([^"]*)"/g,' data-stx-xdestroy="$1"'),a=a.replace(/\s*x-destroy\s*=\s*'([^']*)'/g," data-stx-xdestroy='$1'"),a}function Ns(e){return/x-data\s*=\s*["']/.test(e)}function 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(),F=n.substring(u,x+1),O=-1,z=0,W=null,B=!1;for(let M=0;M<D.length;M++){let Z=D[M];if(B){B=!1;continue}if(Z==="\\"&&W){B=!0;continue}if(W){if(Z===W)W=null;continue}if(Z==='"'||Z==="'"||Z==="`"){W=Z;continue}if(Z==="("||Z==="["||Z==="{")z++;else if(Z===")"||Z==="]"||Z==="}")z--;if(Z===","&&z===0){O=M;break}}let H=O>=0?D.substring(0,O).trim():D,V=O>=0?D.substring(O+1).trim():void 0;try{let M=H.trim(),Z;if(m(M))Z=p(M,Object.keys(t))(...Object.values(t));else Z=void 0;let re;if(V==="true")re=JSON.stringify(Z,null,2);else re=JSON.stringify(Z);let se=re.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){U.log(M instanceof Error?M:Error(String(M)),{directive:"@json"},"error"),i.lastIndex=u+F.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),F=D.indexOf("@endmemo");if(F===-1)continue;let O=D.slice(0,F),z=A+F+8,W=
|
|
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(),F=n.substring(u,x+1),O=-1,z=0,W=null,B=!1;for(let M=0;M<D.length;M++){let Z=D[M];if(B){B=!1;continue}if(Z==="\\"&&W){B=!0;continue}if(W){if(Z===W)W=null;continue}if(Z==='"'||Z==="'"||Z==="`"){W=Z;continue}if(Z==="("||Z==="["||Z==="{")z++;else if(Z===")"||Z==="]"||Z==="}")z--;if(Z===","&&z===0){O=M;break}}let H=O>=0?D.substring(0,O).trim():D,V=O>=0?D.substring(O+1).trim():void 0;try{let M=H.trim(),Z;if(m(M))Z=p(M,Object.keys(t))(...Object.values(t));else Z=void 0;let re;if(V==="true")re=JSON.stringify(Z,null,2);else re=JSON.stringify(Z);let se=re.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){U.log(M instanceof Error?M:Error(String(M)),{directive:"@json"},"error"),i.lastIndex=u+F.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),F=D.indexOf("@endmemo");if(F===-1)continue;let O=D.slice(0,F),z=A+F+8,W=Mt(O),B=O.slice(W),H=O.match(/(\s*)$/),V=H?H[0].length:0,M=B.slice(0,B.length-V),Z=M.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),re;if(Z){let[se,fe,xe="",pe]=Z,Pe=`<${fe}${xe} data-stx-memo="${v}"${pe}>`;re=O.slice(0,W)+Pe+M.slice(se.length)+O.slice(W+M.length)}else re=`${O.slice(0,W)}<div data-stx-memo="${v}">${M}</div>${O.slice(W+M.length)}`;a.push({start:u,end:z,replacement:re}),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 W;while(W=a.pop()){if(W.scoped)u--;if(W.name===D)break}continue}let F=/\sdata-stx-scope\s*=/.test(A),O=/\sdata-stx-ref-caller\s*=\s*(["'])(.*?)\1/.exec(A),z=a.find((W)=>W.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&&!F&&/\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*\/?>$/,(W)=>` data-stx-ref-caller="${t}"${W}`)),l=v;if(!Ls.has(D)&&!/\/>$/.test(A)){let W=/\sdata-stx-scope\s*=\s*(?:"([^"]*)"|'([^']*)')/.exec(A);if(a.push({name:D,scoped:F,scopeId:W?.[1]??W?.[2]}),F)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 F=e[f];if(x){if(F==="'")x=!1}else if(v){if(F==='"')v=!1}else if(F==="'")x=!0;else if(F==='"')v=!0;else if(F===">"){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 W=z.exec(e);if(W!==null)t.lastIndex=W.index+W[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 F=e[A-1]==="/",O=F?A-1:A;n+=`${e.slice(i,O)} x-cloak${F?" ":""}`,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>;
|
|
@@ -542,12 +542,12 @@ return {`});for(let[B,H]of l.entries())u.push({text:`value${B}: (`}),u.push({tex
|
|
|
542
542
|
`&&!/[=|&,<([{]\s*$/.test(t.slice(Math.max(0,D-40),D)))){v=F===";"?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
|
-
`)}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)=>!
|
|
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(`
|
|
546
546
|
`)}if(n.length===0)return a.length>0?["",`// ${vo}`,...a].join(`
|
|
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(
|
|
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,F=i.slice(D,v+x[0].length).trim().replace(/;$/,"").trim(),O=x[3],z=n.test(O)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(O)&&!/[,+\-*/%&|?:=]$/.test(F)&&we(O).balanced;t.set(A,t.has(A)||!z?null:F)}}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(),F=a.slice(x+v.length).trimStart();if(D.endsWith(".")||/^:(?!:)/.test(F)&&/[{,]$/.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,F=To.resolve(t,D).replace(/\\/g,"/"),O=`${v}${A}${F}${A}`;if(a.push(e.slice(u,f),O),u=f+x.length,x.includes(`
|
|
551
551
|
`))continue;let z=rr(i,f),W=n.get(z.line)??[],B=W.at(-1),H=z.column+(B?B.generatedEnd-B.sourceEnd:0);W.push({sourceStart:z.column,sourceEnd:z.column+x.length,generatedStart:H,generatedEnd:H+O.length}),n.set(z.line,W)}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
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:(W,B)=>lt(W).map((H)=>Ro(H.code,To.dirname(B))).join(`
|
|
553
553
|
`)}):void 0,D=new Set,F=[];for(let[W,B]of n.entries()){let H=yi(vi(B)+B.code,v,String(W));for(let[re,se]of H.columns)l.set(B.startLine+re-1,se);for(let re of H.declarations)x.push({text:Ro(re.text,t.originDir??""),origin:re.origin?{...re.origin,line:re.origin.line+B.startLine-1}:void 0});let V=Us(H.code),M=Ws(V,t.originDir??"");for(let[re,se]of M.columns)f.set(B.startLine+re-1,se);let Z=M.code.split(`
|
|
@@ -570,20 +570,20 @@ ${v.join(`
|
|
|
570
570
|
Tip: prefer useRef(), navigate(), and composables for component code`;if(or.set(u,O),console.warn(O),a.failOnViolation)throw new J(O,i??t)}var iu=[{open:"@if",close:"@endif",name:"if"},{open:"@unless",close:"@endunless",name:"unless"},{open:"@foreach",close:"@endforeach",name:"foreach"},{open:"@for",close:"@endfor",name:"for"},{open:"@while",close:"@endwhile",name:"while"},{open:"@forelse",close:"@endforelse",name:"forelse"},{open:"@switch",close:"@endswitch",name:"switch"},{open:"@isset",close:"@endisset",name:"isset"},{open:"@empty",close:"@endempty",name:"empty"},{open:"@auth",close:"@endauth",name:"auth"},{open:"@guest",close:"@endguest",name:"guest"},{open:"@can",close:"@endcan",name:"can"},{open:"@cannot",close:"@endcannot",name:"cannot"},{open:"@section",close:"@endsection",name:"section",altClose:"@show"},{open:"@push",close:"@endpush",name:"push"},{open:"@prepend",close:"@endprepend",name:"prepend"},{open:"@once",close:"@endonce",name:"once"},{open:"@markdown",close:"@endmarkdown",name:"markdown"},{open:"@component",close:"@endcomponent",name:"component"}],ou=[{pattern:/@if\s*[^(]/,message:"@if directive missing parentheses",suggestion:"Use @if(condition)"},{pattern:/@foreach\s*[^(]/,message:"@foreach directive missing parentheses",suggestion:"Use @foreach(items as item)"},{pattern:/@foreach\([^)]*\)\s*[^@\n<]/,message:"@foreach may have content on same line",suggestion:"Put content on new line after @foreach()"},{pattern:/@include\s*[^(]/,message:"@include directive missing parentheses",suggestion:"Use @include('partial-name')"},{pattern:/@extends\s*[^(]/,message:"@extends directive missing parentheses",suggestion:"Use @extends('layout-name') or @layout('layout-name')"},{pattern:/@layout\s*[^(]/,message:"@layout directive missing parentheses",suggestion:"Use @layout('layout-name')"}],au=[{pattern:/\{\{\s*constructor\s*\}\}/,message:"Attempting to access constructor property"},{pattern:/\{\{\s*__proto__\s*\}\}/,message:"Attempting to access __proto__ property"},{pattern:/\{\{\s*eval\s*\(/,message:"Attempting to use eval in expression"}];function _g(e){let t=[],n=[];return cu(e,t),lu(e,t,n),uu(e,n),fu(e,t),{valid:t.length===0,errors:t,warnings:n}}function cu(e,t){let n=(e.match(/\{\{/g)||[]).length,i=(e.match(/\}\}/g)||[]).length;if(n!==i)t.push({type:"expression",message:`Unclosed expression brackets: found ${n} opening '{{' and ${i} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function lu(e,t,n){for(let i of iu){let a=new RegExp(`${i.open}(?:\\s|\\()`,"g"),u=new RegExp(i.close,"g"),l=(e.match(a)||[]).length,f=(e.match(u)||[]).length;if(i.altClose){let x=new RegExp(i.altClose,"g");f+=(e.match(x)||[]).length}if(l>f)t.push({type:"directive",message:`Unclosed @${i.name} directive: found ${l} opening and ${f} closing`,suggestion:`Add ${l-f} missing ${i.close} tag(s)`});else if(f>l)n.push({type:"directive",message:`Extra ${i.close} found: ${f-l} more closing than opening`,suggestion:`Check for orphaned ${i.close} tags`})}}function uu(e,t){for(let n of ou)if(n.pattern.test(e))t.push({type:"syntax",message:n.message,suggestion:n.suggestion})}function fu(e,t){for(let n of au)if(n.pattern.test(e))t.push({type:"expression",message:`Security warning: ${n.message}`,suggestion:"Remove dangerous code from template expressions"})}function Cg(e,t){let n=e.slice(0,t).split(`
|
|
571
571
|
`);return{line:n.length,column:n[n.length-1].length+1}}function Eg(e,t,n){let i=[];switch(e){case"if":case"elseif":case"unless":if(n.length===0)i.push({type:"syntax",message:`@${e} requires a condition`,suggestion:`Use @${e}(condition)`});break;case"foreach":if(n.length===0||!n[0].includes(" as "))i.push({type:"syntax",message:'@foreach requires "items as item" syntax',suggestion:"Use @foreach(items as item) or @foreach(items as key => value)"});break;case"for":if(n.length===0)i.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(n.length===0)i.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(n.length===0)i.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(n.length===0)i.push({type:"syntax",message:`@${e} requires a path`,suggestion:`Use @${e}('path/to/template')`});break}return i}function Tg(e){return/@[a-z]+/i.test(e)||/\{\{/.test(e)}function $g(e){let t=e.matchAll(/@([a-z]+)/gi),n=new Set;for(let i of t){let a=i[1].toLowerCase();if(!a.startsWith("end"))n.add(a)}return Array.from(n)}function Wo(e,t,n){let i=/^<script\b([^>]*)>/i.exec(e);if(!i||!/(?:^|\s)src\s*=/i.test(i[1]??""))return null;return R(i[0],t,n)+e.slice(i[0].length)}var fn=new P(500),lr=new Map;function Fo(e){try{let t=is.statSync(e);return`${t.size}:${t.mtimeMs}`}catch{return""}}var ss=new P(1000),ur=new Map,fr=new P(2000),pr=new P(500),Go=33554432,dr=Go;function pu(e){let t=e.componentRenderCacheBytes;if(typeof t!=="number"||t<0||t===dr)return;dr=t,rs.setMaxBytes(t)}var rs=new P(2000,{maxBytes:Go,sizeOf:(e)=>e.output.length});function du(e){let t=new WeakSet;try{let n=(i)=>{if(i===void 0)return{__stxType:"undefined"};if(typeof i==="bigint")return{__stxType:"bigint",value:i.toString()};if(typeof i==="function"||typeof i==="symbol")throw TypeError("Non-serializable component input");if(i===null||typeof i!=="object")return i;if(t.has(i))throw TypeError("Circular component input");t.add(i);try{if(i instanceof Date)return{__stxType:"date",value:i.toISOString()};if(Array.isArray(i))return i.map(n);let a=Object.getPrototypeOf(i);if(a!==Object.prototype&&a!==null)throw TypeError("Non-plain component input");let u={};for(let l of Object.keys(i).sort())u[l]=n(i[l]);return u}finally{t.delete(i)}};return JSON.stringify(n(e))}catch{return null}}function gu(e){let t={};for(let[n,i]of Object.entries(e))if(!n.startsWith("__")||n==="__stxServeContext")t[n]=i;return t}function ar(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Js(e){let t=process.cwd(),n=`${t}\x00${e}`,i=Vo.get(n);if(i===void 0)i=Bun.hash(Yo(e,t).split(ce.sep).join("/")).toString(36).slice(0,6),Vo.set(n,i);return i}var Vo=new Map;function Yo(e,t){if(!ce.isAbsolute(e))return e;let n=(i)=>{try{return is.realpathSync(i)}catch{return i}};return ce.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 te(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=te({loader:"ts",target:"browser",define:T()}),n=Uo.get(t);if(!n)n=new Map,Uo.set(t,n);let i=n.get(e);if(i!==void 0)return i;let a=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");a=a.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let u=[];a=a.replace(/\{!![\s\S]*?!!\}/g,(f)=>{let x=u.length;return u.push(f),`"__STX_EXPR_${x}__"`}),a=a.replace(/\{\{\{[\s\S]*?\}\}\}/g,(f)=>{let x=u.length;return u.push(f),`"__STX_EXPR_${x}__"`}),a=a.replace(/\{\{[\s\S]*?\}\}/g,(f)=>{let x=u.length;return u.push(f),`"__STX_EXPR_${x}__"`});let l=t.transformSync(a);for(let f=0;f<u.length;f++)l=l.replace(`"__STX_EXPR_${f}__"`,u[f]),l=l.replace(`'__STX_EXPR_${f}__'`,u[f]);if(n.size>=mu){let f=n.keys().next();if(!f.done)n.delete(f.value)}return n.set(e,l),l}catch(t){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",t);return e}}function hu(e){let t=[],n=new Set,i=0,a=0,u=e.length,l=(O)=>{a++;while(a<u){if(e[a]==="\\"){a+=2;continue}if(e[a]===O){a++;return}a++}},f=()=>{a++;while(a<u){if(e[a]==="\\"){a+=2;continue}if(e[a]==="`"){a++;return}if(e[a]==="$"&&e[a+1]==="{"){a+=2;let O=1;while(a<u&&O>0)if(e[a]==="{")O++,a++;else if(e[a]==="}")O--,a++;else if(e[a]==="'"||e[a]==='"')l(e[a]);else if(e[a]==="`")f();else a++;continue}a++}},x=()=>{if(e[a]==="/"&&e[a+1]==="/"){while(a<u&&e[a]!==`
|
|
572
572
|
`)a++;return!0}if(e[a]==="/"&&e[a+1]==="*"){a+=2;while(a<u-1&&!(e[a]==="*"&&e[a+1]==="/"))a++;return a+=2,!0}return!1},v=new Set(["return","typeof","instanceof","in","of","new","delete","void","throw","case","do","else","yield","await"]),A=()=>{let O=a-1;while(O>=0&&/\s/.test(e[O]))O--;if(O<0)return!0;let z=e[O];if("(,=:[!&|?{};+-*%<>~^".includes(z))return!0;if(!/[\w$]/.test(z))return!1;let W=O;while(W>0&&/[\w$]/.test(e[W-1]))W--;return v.has(e.slice(W,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++}},F=()=>{if(i!==0)return;let O=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(O){let H=O[2].split(",").map((V)=>{let M=V.trim().split(":");return M[M.length-1].trim()});for(let V of H)if(V&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(V)&&!n.has(V))t.push(V),n.add(V);return}let z=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let H=z[2];if(!n.has(H))t.push(H),n.add(H);return}let W=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(W){let H=W[1];if(!n.has(H))t.push(H),n.add(H);return}let B=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let H=B[1];if(!n.has(H))t.push(H),n.add(H)}};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])))F();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 F=v.slice(A+1).trim();if(!F)continue;try{let O=Object.keys(t).filter(Ut),z=Function(...O,`"use strict"; return (${F});`);t[D]=z(...O.map((W)=>t[W]))}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=
|
|
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++}},F=()=>{if(i!==0)return;let O=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(O){let H=O[2].split(",").map((V)=>{let M=V.trim().split(":");return M[M.length-1].trim()});for(let V of H)if(V&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(V)&&!n.has(V))t.push(V),n.add(V);return}let z=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let H=z[2];if(!n.has(H))t.push(H),n.add(H);return}let W=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(W){let H=W[1];if(!n.has(H))t.push(H),n.add(H);return}let B=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let H=B[1];if(!n.has(H))t.push(H),n.add(H)}};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])))F();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 F=v.slice(A+1).trim();if(!F)continue;try{let O=Object.keys(t).filter(Ut),z=Function(...O,`"use strict"; return (${F});`);t[D]=z(...O.map((W)=>t[W]))}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=ce.relative(ce.resolve(i),ce.resolve(e));return!a.startsWith("..")&&!ce.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),K(u)])if(f.has(se))return!0}let x=[...new Set([`${u}.stx`,`${l(u)}.stx`,`${K(u)}.stx`])],v=typeof a.root==="string"?ce.resolve(a.root):void 0,A=v??ce.dirname(i),D=[],F=(se)=>{if(se&&!D.includes(se))D.push(se)};for(let se of zn(i,v))F(se);let O=n.__originalFilePath;if(O)F(ce.join(ce.dirname(O),"components"));if(Qo(t,a))F(a._rootComponentsDir);F(t),F(a._rootComponentsDir),F(ce.join(ce.dirname(i),"components")),F(a.componentsDir);for(let se of a.additionalComponentsDirs??[])F(se);let z=a._targetComponentFallbackNames?.some((se)=>se.toLowerCase()===u.toLowerCase());if(!z)for(let se of a._targetComponentDirs??[])F(se);if(v)F(ce.resolve(v,"resources/views/components")),F(ce.resolve(v,"resources/components")),F(ce.resolve(v,"src/components")),F(ce.resolve(v,"components"));for(let se of a._layerComponentDirs??[])F(se);let W=a._pluginComponentDirs;if(Array.isArray(W))for(let se of W)F(typeof se==="string"?se:null);if(F(a.fallbackComponentsDir),z)for(let se of a._targetComponentDirs??[])F(se);let B=a._nativePrimitivesFallback;if(B&&!B.except.some((se)=>se.toLowerCase()===u.toLowerCase()))F(B.dir);if(u.startsWith("./")||u.startsWith("../"))return s(ce.resolve(ce.dirname(i),`${u}.stx`));let H=Ho(ce.resolve(import.meta.dir,"components")),V=D.map((se)=>ce.isAbsolute(se)?se:ce.resolve(A,se)),M=`${x.join("\x00")}\x00\x00${V.join("\x00")}`,Z=fr.get(M);if(Z!==void 0)return Z;let re=!1;e:for(let se of V){if(Ho(se)===H)continue;for(let fe of x)if(await s(ce.join(se,fe))){re=!0;break e}}return fr.set(M,re),re}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-x3p4emdp.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-r23zq8yk.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-c0t2tdfk.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-ztbexx3h.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-va07zs9v.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}`,Me={...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)){Me.__importedComponents=new Map(Me.__importedComponents);let{processESImports:oe}=await o("stx/component-renderer",()=>import("./chunk-c0t2tdfk.js"));se=await oe(se,Me,M,l,x)}yu(se,Me);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,Me,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,Me,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,Me,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&&ae.includes("{{ text || slot }}"))ae=ae.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>n);let{applySlots:ge}=await o("stx/slots",()=>import("./chunk-
|
|
576
|
+
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${u}, so it rendered as nothing.${l}${f}`)}function Ko(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var Su=new Set(["for","if","show","key","ref","class","className","style"]),Xo=new Set,ea="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",ul=new RegExp(`\\b(?:${ea})\\s*(?:<[^>]*>)?\\s*\\(`);function Ti(e){let t=new Set,n=new RegExp(`\\b(?:const|let|var)\\s+([a-zA-Z_$][\\w$]*)\\s*=\\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue|${ea})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let i of e){let a;while((a=n.exec(i))!==null)t.add(a[1]);n.lastIndex=0}return[...t]}async function We(e,t,n,i,a,u,l,f=new Set,x,v=ct(a),A,D=e){let{extractVariables:F}=await o("stx/variable-extractor",()=>import("./chunk-tbq6msyc.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-az12j7cr.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-53797jvm.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-axkgbc0k.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-18qvx7b0.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-53797jvm.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&&ae.includes("{{ text || slot }}"))ae=ae.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>n);let{applySlots:ge}=await o("stx/slots",()=>import("./chunk-18qvx7b0.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(ae)||l._nativeHostAttrs===!0&&st.length>0||Ne&&st.length>0||st.some((oe)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(oe)),us=(oe)=>ot?fo(oe,pt):oe,fs=new Map([...Oe].map(([oe,le])=>[oe,{...le,content:us(le.content)}]));ae=await ge(ae,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((oe)=>!Gt.has(oe));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((oe)=>!Gt.has(oe)&&!(oe in t));if(en.length>0)De[Gn]=en;let hn={...l,_rootComponentsDir:l._rootComponentsDir||l.componentsDir,componentsDir:ce.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-2mgajzam.js")),mt=await yn(ae,De,M,hn,x),yt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let oe of mt.matchAll(/\{\{([\s\S]*?)\}\}/g))yt.add(oe[1].trim());if(yt.size>0)a.__stx_preserved_client_expressions=[...yt];let ht=pt,Ze=mt;if(ot){let oe="";if(Object.keys(t).length>0)try{oe=` data-stx-props="${ar(JSON.stringify(t))}"`}catch{}let le=B?` stx-hydrate="${ar(B)}"`:"",Se=Object.fromEntries(Object.entries(nt).map(([$t,Tt])=>[$t,Boolean(Tt)])),me=Object.keys(Se).length>0?` data-stx-slots="${ar(JSON.stringify(Se))}"`:"",Je=` data-stx-scope="${ht}"${oe}${me}${le}`,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
580
|
}`:At.factoryBody,Dn=B?null:Ts(a,On),Mn=Dn?`window.__stxComponentFactories[${JSON.stringify(Dn)}](${JSON.stringify(ht)});`:`(${On})(${JSON.stringify(ht)});`;if(B)return`${Pn}<script type="stx/island" data-stx-island="${ht}" data-stx-scoped data-stx-owner="${ht}"${tn}>${ue(Mn)}</script>`;return`${Pn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${ht}"${tn}>${ue(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 oe=
|
|
584
|
+
`+gt;if(st.length>0){let oe=De.__stx_event_bindings||[],le=ze(De),Se=await Promise.all(st.map(async(me)=>{let Je=Wo(me,De,M);if(Je!==null)return Je;let Ie=me.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Ie)return me;return await He(Ie[1],{eventBindings:oe,templateContent:Ze,filePath:M,projectRoot:process.cwd(),serverData:le,instanceId:pt})}));Ze+=`
|
|
585
585
|
`+Se.join(`
|
|
586
|
-
`),
|
|
586
|
+
`),De.__stx_event_bindings=[]}}if(ie){let oe=qs(Ze,M);if(oe.hasScoped)Ze=oe.html}if(Ct&&dt){let oe=Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[];rs.set(Ct,{output:Ze,dependencies:[...x].filter((le)=>!dt.has(le)),clientFactories:Xt?ui(a,Xt):[],uidsConsumed:St.n-gn,preservedClientExpressions:Jt?oe.filter((le)=>!Jt.has(le)):[]})}if(Kt)Ze=`<!--stx-render-failed:${Kt}-->${Ze}`;return Xe.length>0?`${Ze}
|
|
587
587
|
${Xe.join(`
|
|
588
588
|
`)}`:Ze}catch(H){if(H instanceof J)throw H;return`[Error processing component: ${H instanceof Error?H.message:String(H)}]`}finally{O.delete(e)}}async function s(e){return Bun.file(e).exists()}function gr(e,t){let n=ce.resolve(t),i=ce.resolve(e),a=n.endsWith(ce.sep)?n:n+ce.sep;if(i===n||i.startsWith(a))return i;return null}async function Jo(e,t,n,i){let a=t.startsWith("layouts/")?t.slice(8):t,u=ce.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=ce.isAbsolute(f)?f:ce.resolve(process.cwd(),f);if(gr(a,x))return ce.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=ce.dirname(t),u=process.cwd();if(e.startsWith("/")){let O=ce.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=ce.relative(ce.resolve(u,n.fallbackLayoutsDir),O);if(z.startsWith("..")||ce.isAbsolute(z))return O;return await Jo(ce.resolve(u,n.layoutsDir),e,i,n.debug)??O},f=ce.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 W=await l(z);if(i)i.add(W);return W}}let x=[];if(x.push(...n._layerLayoutDirs??[]),n.layoutsDir)x.push(ce.isAbsolute(n.layoutsDir)?n.layoutsDir:ce.resolve(process.cwd(),n.layoutsDir));let v=ce.resolve(a),A=process.cwd();for(let O=0;O<10;O++){let z=ce.join(v,"layouts"),W=!1;try{W=is.statSync(z,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(W){x.push(z);break}let B=ce.dirname(v);if(B===v||B.length<A.length)break;v=B}for(let O of x){let z=await Jo(O,e,i,n.debug);if(z)return z}if(n.fallbackLayoutsDir){let O=ce.isAbsolute(n.fallbackLayoutsDir)?n.fallbackLayoutsDir:ce.resolve(process.cwd(),n.fallbackLayoutsDir),z=e.startsWith("layouts/")?e.slice(8):e,W=[ce.join(O,z)];if(!e.endsWith(".stx"))W.push(`${W[0]}.stx`);for(let B of W)if(await s(B)){if(n.debug)console.log(`Found in options.fallbackLayoutsDir: ${B}`);if(i)i.add(B);return B}}if(e.startsWith("layouts/")||e.includes("/layouts/")){let O=e.split("layouts/"),z=ce.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 W=`${z}.stx`;if(await s(W)){if(n.debug)console.log(`Found in layouts path with extension: ${W}`);if(i)i.add(W);return W}}}if(n.partialsDir){let O=ce.join(n.partialsDir,"layouts");if(await s(O)){let z=ce.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 W=`${z}.stx`;if(await s(W)){if(n.debug)console.log(`Found in partials layouts dir with extension: ${W}`);if(i)i.add(W);return W}}}}let D=n.partialsDir||ce.join(process.cwd(),"views"),F=ce.join(D,e);if(await s(F)){if(n.debug)console.log(`Found in views path: ${F}`);if(i)i.add(F);return F}if(!e.endsWith(".stx")){let O=`${F}.stx`;if(await s(O)){if(n.debug)console.log(`Found in views path with extension: ${O}`);if(i)i.add(O);return O}}if(a.includes("temp")){let O=ce.join(ce.dirname(a),"layouts",e);if(await s(O)){if(n.debug)console.log(`Found in temp layouts dir: ${O}`);if(i)i.add(O);return O}if(!e.endsWith(".stx")){let z=`${O}.stx`;if(await s(z)){if(n.debug)console.log(`Found in temp layouts dir with extension: ${z}`);if(i)i.add(z);return z}}}if(n.debug)console.warn(`Template not found after trying all paths: ${e} (referenced from ${t})`);else console.warn(`Template not found: ${e} (referenced from ${t})`);return null}function dl(e,t,n){let i=0,a="",u="";try{if(typeof t==="number"&&t>=0){let l=e.split(`
|
|
589
589
|
`),f=0;for(let x=0;x<l.length;x++)if(f+=l[x].length+1,f>=t){i=x+1,a=l[x].trim();let v=Math.max(0,x-2),A=Math.min(l.length,x+3);u=l.slice(v,A).map((D,F)=>{let O=v+F+1;return`${O===i?"> ":" "}${O}: ${D}`}).join(`
|
|
@@ -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-yrstc4z4.js")),A=[],D=!1;if(x(l)){let V=l;l=await v(V,t,{projectRoot:process.cwd(),minify:n,collectInputs:A}),D=l===V}let{stripStxRuntimeImports:F}=await o("stx/signal-processing",()=>import("./chunk-t9r644tq.js"));l=F(l);let O=N(l),z=hu(O),W=new Set(q(O,!0).split(",").map((V)=>V.trim())),B=`function(__scopeId) {
|
|
604
604
|
${ft("const",[..._l,...z],O)}
|
|
605
605
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
606
606
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
@@ -692,12 +692,12 @@ finally {
|
|
|
692
692
|
}`,H={vendorStyleTags:f,factoryBody:B,clientCode:O,deps:Cr([...A,...u.styles.map((V)=>V.resolvedPath)])};if(!D&&u.unresolved.length===0)cr.set(i,H);return H}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(),F=/^\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,F))console.warn(`[stx] @status(${D})${O} is not an HTTP status (100-599) \u2014 ignoring it.`);l+=e.slice(f,v.index),f=A+1+(e.slice(A+1).match(/^[^\S\n]*\n?/)?.[0].length??0),x.lastIndex=f}return f===0?e:l+e.slice(f)}function Ru(e,t){let n=1,i=null,a=!1;for(let u=t+1;u<e.length;u++){let l=e[u];if(a){a=!1;continue}if(i){if(l==="\\")a=!0;else if(l===i)i=null;continue}if(l==='"'||l==="'"||l==="`"){i=l;continue}if(l==="(")n++;else if(l===")"&&--n===0)return u}return-1}var ta=new Set(Sn),Tu=new Set(["props","$props","defineProps"]),Au=new Set(["stx","@stacksjs/stx"]),na=S(128),sa=S(64);function Iu(e){let t=[],n=0,i=e.split(`
|
|
693
693
|
`);for(let a of i){let u=n,l=null,f=!1;for(let x=0;x<a.length;x++){let v=a[x];if(f){f=!1;continue}if(v==="\\"){f=!0;continue}if(l){if(v===l)l=null;continue}if(v==="'"||v==='"'||v==="`"){l=v;continue}if(v==="/"&&x+1<a.length&&a[x+1]==="/")break;if(v==="{")n++;else if(v==="}")n--}if(u===0){let x=a.match(/(?:const|let|var)\s+(\w+)\s*=/);if(x)t.push(x[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(a)){let v=a.match(/(?:const|let|var)\s+(\w+)/);if(v)t.push(v[1])}else{let v=a.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(v){let D=v[1].slice(1,-1).split(",").map((F)=>{let O=F.split(":");return(O.length>1?O[1]:O[0]).trim()}).filter((F)=>/^\w+$/.test(F));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("..."),F=D?A.slice(3):A,O=-1,z=0;for(let re=0;re<F.length;re++)if(F[re]==="<")z++;else if(F[re]===">")z--;else if(F[re]===":"&&z===0){O=re;break}if(O===-1)return v;let B=F.substring(0,O).trim().replace(/\?$/,""),H=F.substring(O+1),V=-1,M=0;for(let re=0;re<H.length;re++)if(H[re]==="<")M++;else if(H[re]===">")M--;else if(H[re]==="="&&M===0){V=re;break}let Z=D?"...":"";if(V!==-1)return`${Z}${B} = ${H.substring(V+1).trim()}`;return`${Z}${B}`}).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 F=n(D);u.push({start:l+1,end:x,replacement:F})}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 ie=te({loader:"ts",target:"browser",define:a}),ae=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");ae=ae.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),l=ie.transformSync(ae)}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((ie)=>ie[1]).filter((ie)=>!ie.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(ie)),F=new Map;for(let ie of D)try{if(ie.startsWith(".")){A[ie]=await import(ut.resolve(ut.dirname(n),ie));continue}let ae=ut.resolve(v,"node_modules",ie),ge=ut.join(ae,"package.json"),$e=JSON.parse(b("fs").readFileSync(ge,"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[ie]=await import(ut.resolve(ae,Oe))}catch(ae){if(ie.startsWith("."))F.set(ie,ae instanceof Error?ae.message:String(ae))}let O=(ie)=>{if(A[ie])return A[ie];let ae=F.get(ie);if(ae!==void 0)throw Error(`Cannot require '${ie}' from ${n}: ${ae}`);return b(ie)},z=t.props||{},W=(ie)=>{if(!ie)return z;let ae={};for(let[ge,$e]of Object.entries(ie)){let Oe=z[ge];if(Oe!==void 0)ae[ge]=Oe;else if(typeof $e==="function")ae[ge]=$e();else ae[ge]=$e}return ae};for(let[ie,ae]of Object.entries(z))Object.defineProperty(W,ie,{value:ae,enumerable:!0,configurable:!0,writable:!0});let B=(ie,ae=!1)=>{if(ie===void 0||ie===null)return ae;if(typeof ie==="string"){let ge=ie.trim().toLowerCase();if(ge===""||ge==="true"||ge==="1"||ge==="on"||ge==="yes")return!0;if(ge==="false"||ge==="0"||ge==="off"||ge==="no")return!1;return!0}return Boolean(ie)},H=(ie,ae=0)=>{if(ie===void 0||ie===null)return ae;if(typeof ie==="string"){let $e=ie.trim();if($e==="")return ae;let Oe=Number($e);return Number.isFinite(Oe)?Oe:ae}let ge=Number(ie);return Number.isFinite(ge)?ge:ae};for(let ie of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(z,ie))continue;try{Object.defineProperty(W,ie,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let V=(ie)=>{if(!ie)return z;let ae={...z};for(let[ge,$e]of Object.entries(ie)){let Oe=$e&&typeof $e==="object"&&!Array.isArray($e)?$e:{type:$e};if(ae[ge]===void 0&&Oe.default!==void 0)ae[ge]=typeof Oe.default==="function"?Oe.default():Oe.default}return ae},M=()=>t.slots||{},Z=(ie,ae)=>{let ge={...ie};for(let[$e,Oe]of Object.entries(ae))if(ge[$e]===void 0)if(typeof Oe==="function")ge[$e]=Oe();else ge[$e]=Oe;return ge},re=(ie)=>{let ae=()=>ie;return ae.set=(ge)=>{},ae.update=(ge)=>{},ae},se=(ie)=>{let ae,ge=!1;return()=>{if(!ge)try{ae=ie(),ge=!0}catch{ae=void 0}return ae}},fe=(ie)=>{},xe=(ie)=>ie(),pe=(ie)=>{},Pe=(ie)=>{},Ke=Ks(t);function Ae(ie){let ae=ie||{};if(ae.title!==void 0||ae.description!==void 0)nt({title:ae.title,description:ae.description})}function Xe(ie){if(!ie||typeof ie!=="object")return;let ae=t.__stxClientPayload??{};Object.assign(ae,ie),t.__stxClientPayload=ae}let et=()=>{let ie=t.__stxServeContext,ae=t.__stxServeSearch??ie?.search??"",ge=ie?.path??"",$e=Object.fromEntries(new URLSearchParams(ae)),Oe=t.query,Ne=Object.keys($e).length>0?$e:Oe??{},ot=ae||(Object.keys(Ne).length>0?`?${new URLSearchParams(Ne).toString()}`:"");return{params:t.params??{},query:Ne,path:ge,name:"",fullPath:ge+ot,hash:"",matched:[]}},Ye=()=>({push:(ie)=>{},replace:(ie)=>{},back:()=>{},forward:()=>{},go:(ie)=>{}}),it=(ie)=>{let ae=t.__stx_runtime_head||{};t.__stx_runtime_head=Ge(ae,Re(ie||{},{known:ro,source:"useHead()"}))},nt=(ie)=>{it(so(ie||{}))},St=(ie)=>({value:ie}),Ht=(ie)=>ie,br=(ie)=>({value:typeof ie==="function"?ie():ie}),pt=(ie,ae)=>{},
|
|
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 ie=te({loader:"ts",target:"browser",define:a}),ae=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");ae=ae.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),l=ie.transformSync(ae)}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((ie)=>ie[1]).filter((ie)=>!ie.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(ie)),F=new Map;for(let ie of D)try{if(ie.startsWith(".")){A[ie]=await import(ut.resolve(ut.dirname(n),ie));continue}let ae=ut.resolve(v,"node_modules",ie),ge=ut.join(ae,"package.json"),$e=JSON.parse(b("fs").readFileSync(ge,"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[ie]=await import(ut.resolve(ae,Oe))}catch(ae){if(ie.startsWith("."))F.set(ie,ae instanceof Error?ae.message:String(ae))}let O=(ie)=>{if(A[ie])return A[ie];let ae=F.get(ie);if(ae!==void 0)throw Error(`Cannot require '${ie}' from ${n}: ${ae}`);return b(ie)},z=t.props||{},W=(ie)=>{if(!ie)return z;let ae={};for(let[ge,$e]of Object.entries(ie)){let Oe=z[ge];if(Oe!==void 0)ae[ge]=Oe;else if(typeof $e==="function")ae[ge]=$e();else ae[ge]=$e}return ae};for(let[ie,ae]of Object.entries(z))Object.defineProperty(W,ie,{value:ae,enumerable:!0,configurable:!0,writable:!0});let B=(ie,ae=!1)=>{if(ie===void 0||ie===null)return ae;if(typeof ie==="string"){let ge=ie.trim().toLowerCase();if(ge===""||ge==="true"||ge==="1"||ge==="on"||ge==="yes")return!0;if(ge==="false"||ge==="0"||ge==="off"||ge==="no")return!1;return!0}return Boolean(ie)},H=(ie,ae=0)=>{if(ie===void 0||ie===null)return ae;if(typeof ie==="string"){let $e=ie.trim();if($e==="")return ae;let Oe=Number($e);return Number.isFinite(Oe)?Oe:ae}let ge=Number(ie);return Number.isFinite(ge)?ge:ae};for(let ie of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(z,ie))continue;try{Object.defineProperty(W,ie,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let V=(ie)=>{if(!ie)return z;let ae={...z};for(let[ge,$e]of Object.entries(ie)){let Oe=$e&&typeof $e==="object"&&!Array.isArray($e)?$e:{type:$e};if(ae[ge]===void 0&&Oe.default!==void 0)ae[ge]=typeof Oe.default==="function"?Oe.default():Oe.default}return ae},M=()=>t.slots||{},Z=(ie,ae)=>{let ge={...ie};for(let[$e,Oe]of Object.entries(ae))if(ge[$e]===void 0)if(typeof Oe==="function")ge[$e]=Oe();else ge[$e]=Oe;return ge},re=(ie)=>{let ae=()=>ie;return ae.set=(ge)=>{},ae.update=(ge)=>{},ae},se=(ie)=>{let ae,ge=!1;return()=>{if(!ge)try{ae=ie(),ge=!0}catch{ae=void 0}return ae}},fe=(ie)=>{},xe=(ie)=>ie(),pe=(ie)=>{},Pe=(ie)=>{},Ke=Ks(t);function Ae(ie){let ae=ie||{};if(ae.title!==void 0||ae.description!==void 0)nt({title:ae.title,description:ae.description})}function Xe(ie){if(!ie||typeof ie!=="object")return;let ae=t.__stxClientPayload??{};Object.assign(ae,ie),t.__stxClientPayload=ae}let et=()=>{let ie=t.__stxServeContext,ae=t.__stxServeSearch??ie?.search??"",ge=ie?.path??"",$e=Object.fromEntries(new URLSearchParams(ae)),Oe=t.query,Ne=Object.keys($e).length>0?$e:Oe??{},ot=ae||(Object.keys(Ne).length>0?`?${new URLSearchParams(Ne).toString()}`:"");return{params:t.params??{},query:Ne,path:ge,name:"",fullPath:ge+ot,hash:"",matched:[]}},Ye=()=>({push:(ie)=>{},replace:(ie)=>{},back:()=>{},forward:()=>{},go:(ie)=>{}}),it=(ie)=>{let ae=t.__stx_runtime_head||{};t.__stx_runtime_head=Ge(ae,Re(ie||{},{known:ro,source:"useHead()"}))},nt=(ie)=>{it(so(ie||{}))},St=(ie)=>({value:ie}),Ht=(ie)=>ie,br=(ie)=>({value:typeof ie==="function"?ie():ie}),pt=(ie,ae)=>{},De=(ie)=>{},qt=(ie)=>{},dn=(ie)=>ie?ie():Promise.resolve(),as=(ie)=>(ae,...ge)=>{},Zt=(ie)=>{},st=(ie,ae)=>{},Kt=(ie,ae)=>ae,cs=()=>({value:"light"}),Ct=()=>re(!1),dt=(ie)=>re(!1),Xt=()=>re(!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(ie,ae){if(ae in ie)return ie[ae];return},set(ie,ae,ge){return ie[ae]=ge,!0}}),ls={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},gt=console;try{let ie=_i(l,n),ae=new Set(Object.keys(z)),ge=Object.keys(t).filter((oe)=>!ae.has(oe)&&!Tu.has(oe)&&Ut(oe)),$e=ge.map((oe)=>t[oe]);if(!ge.includes("__stxServeContext"))ge.push("__stxServeContext"),$e.push(void 0);if(!ae.has("cookies")){let oe=t.cookies??t.__stxServeContext?.cookies??{},le=ge.indexOf("cookies");if(le<0)ge.push("cookies"),$e.push(oe);else $e[le]=oe}let Oe=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),Ne=[],ot=[];for(let[oe,le]of Object.entries(z)){if(!Ut(oe))continue;if(Oe.has(oe))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${oe}\\b`).test(ie))continue;Ne.push(oe),ot.push(le)}let fs=Iu(ie).map((oe)=>`module.exports.${oe} = typeof ${oe} !== 'undefined' ? ${oe} : module.exports.${oe};`).join(`
|
|
696
696
|
`),mn=t.params??{},Qt=[],en=[];for(let oe=0;oe<ge.length;oe++){if(ge[oe]==="params")continue;Qt.push(ge[oe]),en.push($e[oe])}let hn=[...Sn,...Ne,...Qt],yn=`return (async () => {
|
|
697
697
|
${ie}
|
|
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()??j(),()=>Mr(t,()=>yt(f,x,O,z,W,B,H,V,Z,Xe,jr,Ii,Zs,re,se,fe,xe,pe,Pe,Ae,et,Ye,it,nt,Ke.setResponseStatus,Ke.setResponseHeader,Ke.notFound,St,Ht,br,pt,
|
|
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()??j(),()=>Mr(t,()=>yt(f,x,O,z,W,B,H,V,Z,Xe,jr,Ii,Zs,re,se,fe,xe,pe,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[oe,le]of Object.entries(Ze))if(!(oe in t)||t[oe]===void 0)t[oe]=le}else Object.assign(t,Ze);for(let[oe,le]of Object.entries(z))if(!(oe in t))t[oe]=le}catch(ie){if(t.__stx_strict_hydration)throw ie;let ae=hg(ie instanceof Error?ie.message:String(ie));if(yg(ae))console.warn(`[stx] server <script> in ${n??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${ae}`),i.onFailure?.({kind:"module-resolution",message:ae,error:ie});else if(bg(ie))console.warn(`[stx] server <script> in ${n??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${ae}`),i.onFailure?.({kind:"syntax",message:ae,error:ie});else if(wg(ae))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: ${ae}`),i.onFailure?.({kind:"missing-binding",message:ae,error:ie});else{let ge=`${n??"<unknown>"}\x00${ae}`;if(Vt.env.STX_DEBUG||!ra.has(ge))ra.add(ge),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: ${ae}`);i.onFailure?.({kind:"unknown",message:ae,error:ie})}try{await Nu(l,t,n)}catch(ge){if(Vt.env.STX_DEBUG){let $e=ge instanceof Error?ge.message:String(ge);console.warn(`[stx] fallback extraction also failed in ${n??"<unknown>"}: ${$e}`)}}}}function vg(e){let t=0,n=null,i=!1,a=!1;for(let u=0;u<e.length;u++){let l=e[u];if(n){if(l===n){if(n=null,i||t===0)a=!0}continue}if(l==="'"||l==='"'||l==="`"){n=l;continue}if(l==="{")t++;else if(l==="}")t--;else if(e.startsWith("from",u)&&t===0)i=!0}return n===null&&t===0&&a}var Pu=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function _i(e,t){let n=t?ut.dirname(t):Vt.cwd(),i=Vt.cwd(),a=e.split(`
|
|
701
701
|
`),u=[],l=0;while(l<a.length){let f=a[l].trim();if(f.startsWith("interface ")||f.startsWith("export interface ")||f.startsWith("type ")||f.startsWith("export type ")){if(f.includes("{")&&!f.includes("}")){let x=0;for(;l<a.length;l++){for(let v of a[l])if(v==="{")x++;else if(v==="}")x--;if(x<=0)break}}l++;continue}if(f.startsWith("definePageMeta(")){let x=0,v=!1,A=l;for(let O=l;O<a.length&&!v;O++){let z=null,W=!1,B=a[O];for(let H=0;H<B.length;H++){let V=B[H];if(W){W=!1;continue}if(V==="\\"){W=!0;continue}if(z){if(V===z)z=null;continue}if(V==='"'||V==="'"||V==="`"){z=V;continue}if(V==="(")x++;else if(V===")"){if(x--,x===0){l=O+1,v=!0;break}}}}if(!v)l=a.length;let D=a.slice(A,l).join(`
|
|
702
702
|
`),F=[];for(let O of["title","description"]){let z=new RegExp(`\\b${O}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(D);if(z)F.push(`${O}: ${JSON.stringify(z[2])}`)}if(F.length>0)u.push(`useSeoMeta({ ${F.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+['"](.+?)['"]/),F=x.match(/^import\s*['"](.+?)['"]/),O=x,z=(W)=>{if(W.startsWith("."))return ut.resolve(n,W);if(W.startsWith("~/")||W.startsWith("@/"))return ut.resolve(i,W.slice(2));try{return Bun.resolveSync(W,n)}catch{return W}};if(A){let[,W,B]=A,H=z(B);u.push(`const ${W} = (await import('${H}')).default`),u.push(`module.exports.${W} = ${W};`)}else if(D){let[,W,B]=D,H=z(B),V=[],M=[],Z=Au.has(B);for(let re of W.split(",")){let se=re.trim();if(!se)continue;let fe=se.split(/\s+as\s+/);if(fe.length===2){let[xe,pe]=[fe[0].trim(),fe[1].trim()];if(Z&&ta.has(xe)){u.push(`const ${pe} = ${xe};`);continue}V.push(`${xe}: ${pe}`),M.push(pe)}else{if(Z&&ta.has(se))continue;V.push(se),M.push(se)}}if(V.length>0)u.push(`const { ${V.join(", ")} } = await import('${H}')`);for(let re of M)u.push(`module.exports.${re} = ${re};`)}else if(F){let W=z(F[1]);u.push(`await import('${W}')`)}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,F=l;for(;F<a.length;F++){let O=a[F];for(let z of O)if(z==="{")D++;else if(z==="}")D--;if(F>l)A+=`
|
|
703
703
|
`+O;if(D<=0&&F>=l)break}u.push(A),u.push(`module.exports.${v} = ${v};`),l=F+1}else u.push(f),l++}else if(f.includes("module.exports"))u.push(f),l++;else if(f.trim()&&!f.startsWith("//"))u.push(f),l++;else l++}return Ou(u.join(`
|
|
@@ -709,4 +709,4 @@ ${e[v]}`,v++;else break}return x=x.trim().replace(/;$/,""),{type:u,name:l,value:
|
|
|
709
709
|
${u}`,a++}while(a<e.length){let u=e[a].trim();if(u.startsWith(".")||u.startsWith("?."))i+=`
|
|
710
710
|
${e[a]}`,a++;else break}return{value:i,nextIndex:a}}function ju(e,t,n){let i=n,a=t+1;while(a<e.length){let u=da(i);if(u!==-1){if(k(i,"{","}",u)!==-1)break}let l=e[a];i+=`
|
|
711
711
|
${l}`,a++}return{functionCode:i,nextIndex:a}}function la(e,t){let n=d(e,t)??d(`(${e})`,t);if(n!==void 0)return n;if(!/\bprocess\b/.test(e))return;let i={...t,process:Object.freeze({env:{...Vt.env}})},a=Object.keys(i).filter(Ut),u=a.map((l)=>i[l]);try{return Function(...a,`'use strict'; return (${e});`)(...u)}catch{try{return Function(...a,`'use strict'; return ${e};`)(...u)}catch{return}}}async function Nu(e,t,n){let i=e.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let u of i){let[,,l,f]=u;try{let x=f.trim().replace(/;$/,""),v=la(x,t);if(v!==void 0)t[l]=v}catch(x){console.warn(`Failed to parse export ${l} in fallback:`,x)}}let a=e.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let u of a){let[,,l,f]=u;if(!(l in t))try{let x=f.trim().replace(/;$/,""),v=la(x,t);if(v!==void 0)t[l]=v}catch{}}}function ol(e){let t=e.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),n=t?t[1]:"",i=t?e.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):e;return{scriptContent:n,templateWithoutScript:i}}function il(e){let t=e.trim();if(!t)return!1;return/(?:const|let|var|function)\s+\w+/.test(t)}
|
|
712
|
-
export{
|
|
712
|
+
export{Me,Ce,q,js,Bs,K,_r,Fs,zs,fi,gi,mi,Hs,hi,Hc,Dt,Le,o,ue,S,Vc,_,Cr,Vs,Ee,T,je,he,Mt,Lt,X,bn,Be,w,Uc,ye,Q,Er,Tr,$r,de,jt,ee,L,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,te,Ue,Ag,Ir,Pg,ll,ul,Ti,We,s,_n,dl,y,be,gy,pl,fl,gl,$i,Ys,Ig,my,Og,hy,Cn,g,G,ne,En,Te,Ng,Ri,Dg,yy,R,Ai,Mg,by,I,wy};
|