@stacksjs/stx 0.2.884 → 0.2.885
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-rw5sxr5a.js → chunk-0gkxqcpj.js} +1 -1
- package/dist/chunk-1dhdt31n.js +2 -0
- package/dist/chunk-2mn0w25t.js +2 -0
- package/dist/chunk-2mxqchs1.js +2 -0
- package/dist/{chunk-be201zh7.js → chunk-2n2102vf.js} +5 -5
- package/dist/{chunk-d80re6y8.js → chunk-2v0pcxqs.js} +4 -4
- package/dist/{chunk-5kh07k1p.js → chunk-46cghgdm.js} +2 -2
- package/dist/chunk-4mw05zhy.js +2 -0
- package/dist/{chunk-pxt57028.js → chunk-4n1ywp14.js} +1 -1
- package/dist/{chunk-we9k6vtw.js → chunk-4ryy2m8q.js} +3 -3
- package/dist/{chunk-pw2bfb6k.js → chunk-5mmgdpjr.js} +6 -6
- package/dist/{chunk-hd6hc981.js → chunk-5p6xtzkk.js} +1 -1
- package/dist/{chunk-jyyyzazb.js → chunk-5xhaabn0.js} +1 -1
- package/dist/{chunk-vh1sewja.js → chunk-63y8exx2.js} +1 -1
- package/dist/chunk-6cbxs47h.js +2 -0
- package/dist/chunk-6gyy25fz.js +2 -0
- package/dist/{chunk-kg7w5xwh.js → chunk-6nvm1dgn.js} +1 -1
- package/dist/{chunk-k06xctna.js → chunk-72qdbhfh.js} +1 -1
- package/dist/{chunk-swwn1pa7.js → chunk-7dtfkf1b.js} +1 -1
- package/dist/{chunk-tvhm8t45.js → chunk-84xnev80.js} +1 -1
- package/dist/{chunk-yv1w9dqr.js → chunk-8an1mp1z.js} +4 -4
- package/dist/chunk-8hbzej4h.js +2 -0
- package/dist/chunk-8qkmgxkn.js +2 -0
- package/dist/chunk-8xh4ek56.js +182 -0
- package/dist/{chunk-bnawaxh5.js → chunk-9cgwe3tb.js} +1 -1
- package/dist/{chunk-twhahqbd.js → chunk-aw6m1t68.js} +6 -6
- package/dist/{chunk-nb6erf75.js → chunk-c47stwqj.js} +1 -1
- package/dist/{chunk-n4d7qk9w.js → chunk-c8pdjhxm.js} +1 -1
- package/dist/{chunk-2bvms1pz.js → chunk-ce1d71m1.js} +2 -2
- package/dist/{chunk-xs8fccfq.js → chunk-charhv8y.js} +1 -1
- package/dist/{chunk-sb1e0rd8.js → chunk-css5czqk.js} +1 -1
- package/dist/{chunk-8t8yzdzq.js → chunk-d9hsqh1w.js} +1 -1
- package/dist/chunk-e2d34r31.js +2 -0
- package/dist/{chunk-q8dkdnvg.js → chunk-eebxdb5z.js} +1 -1
- package/dist/chunk-eg3sxm03.js +2 -0
- package/dist/chunk-fdzpphww.js +2 -0
- package/dist/{chunk-4fkcn6z5.js → chunk-fg67643b.js} +1 -1
- package/dist/{chunk-z9cz0vxm.js → chunk-j5a3yrcf.js} +1 -1
- package/dist/{chunk-q910pjr4.js → chunk-jbv448x5.js} +1 -1
- package/dist/chunk-k3s16azh.js +2 -0
- package/dist/{chunk-rcjkms52.js → chunk-kk92sv04.js} +5 -5
- package/dist/chunk-kpkjb7hy.js +2 -0
- package/dist/{chunk-a60ztvnp.js → chunk-kwf3kfr0.js} +1 -1
- package/dist/{chunk-0c913abf.js → chunk-m321yrb2.js} +1 -1
- package/dist/{chunk-v5zm24gy.js → chunk-m4f13mrp.js} +1 -1
- package/dist/{chunk-gn2x58yq.js → chunk-mejhzan9.js} +1 -1
- package/dist/{chunk-gksn30x7.js → chunk-mrjr0vtb.js} +21 -20
- package/dist/{chunk-00tq7ghn.js → chunk-n22xtagg.js} +2 -2
- package/dist/{chunk-4qzytgtg.js → chunk-n63z5hbk.js} +3 -3
- package/dist/{chunk-n2nxpgzc.js → chunk-nxbws5qm.js} +4 -4
- package/dist/{chunk-mdb4pvv9.js → chunk-p0rpdj1w.js} +1 -1
- package/dist/{chunk-rzq0s8k3.js → chunk-p6e48m6t.js} +1 -1
- package/dist/{chunk-rptq6d7b.js → chunk-p6yavy8h.js} +3 -3
- package/dist/{chunk-rcxer2km.js → chunk-pc8dt8xs.js} +1 -1
- package/dist/{chunk-rqbqxs01.js → chunk-pk3pp1j5.js} +1 -1
- package/dist/chunk-qtbbc0h2.js +3 -0
- package/dist/chunk-qw6cyy5j.js +2 -0
- package/dist/{chunk-7xc81f1w.js → chunk-rtehrddv.js} +2 -2
- package/dist/{chunk-szwde015.js → chunk-t4v7pjnh.js} +1 -1
- package/dist/{chunk-2nt2wjb2.js → chunk-tng16znx.js} +1 -1
- package/dist/chunk-tzvapd0t.js +2 -0
- package/dist/{chunk-6ha9vbjv.js → chunk-v9wt6jx2.js} +2 -2
- package/dist/{chunk-ntk07yeh.js → chunk-wh8yhpyh.js} +4 -4
- package/dist/chunk-wkcx67x4.js +2 -0
- package/dist/{chunk-19q3j7cd.js → chunk-ws3wfpy9.js} +1 -1
- package/dist/{chunk-0q117rw8.js → chunk-xfxcchpt.js} +1 -1
- package/dist/chunk-xwwp2ftx.js +2 -0
- package/dist/{chunk-7vggqc7d.js → chunk-y3v0r845.js} +10 -10
- package/dist/{chunk-rx94z3d5.js → chunk-z2mvdnce.js} +1 -1
- package/dist/chunk-z5n2sjg2.js +2 -0
- package/dist/{chunk-yh2hnt3m.js → chunk-zpj6ggee.js} +2 -2
- package/dist/cli.js +9 -9
- package/dist/component-library.js +5 -2
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/native/compiler/bundle.js +19 -1
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +6 -6
- package/dist/types/component-types.d.ts +2 -0
- package/package.json +5 -5
- package/dist/chunk-188st53m.js +0 -2
- package/dist/chunk-3t0pf47w.js +0 -2
- package/dist/chunk-5a73eghg.js +0 -2
- package/dist/chunk-5fn9s4e7.js +0 -2
- package/dist/chunk-bx301nnn.js +0 -2
- package/dist/chunk-ccv21bj8.js +0 -2
- package/dist/chunk-egmkawq6.js +0 -2
- package/dist/chunk-fa3syk1m.js +0 -3
- package/dist/chunk-fzxynhyc.js +0 -2
- package/dist/chunk-gg4vcn6m.js +0 -2
- package/dist/chunk-h573cegy.js +0 -2
- package/dist/chunk-j5gcwg3k.js +0 -2
- package/dist/chunk-mcc01ts7.js +0 -2
- package/dist/chunk-nsa675xs.js +0 -2
- package/dist/chunk-pzm31te2.js +0 -2
- package/dist/chunk-s7c1f3h4.js +0 -2
- package/dist/chunk-se4xbbh5.js +0 -2
- package/dist/chunk-t25pwp2a.js +0 -177
- package/dist/chunk-vc3sz26f.js +0 -2
- package/dist/chunk-wkgzyjyv.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ye,Nn,ao,Ui,F}from"./chunk-6t04tqvh.js";import{On}from"./chunk-rqbqxs01.js";import{Kr,E,Ll,wt,Qi,jl}from"./chunk-00tq7ghn.js";import{M}from"./chunk-hxhmhw23.js";import{T,R}from"./chunk-s29hp1qw.js";import{qr,mo,Zi,Nl,De}from"./chunk-a60ztvnp.js";import{co,d,m,Xt,p,ee,q,k,fo,Me,Qe,go}from"./chunk-295bykzd.js";import{b}from"./chunk-94mpe1ny.js";import{te}from"./chunk-ws2h92mm.js";import{t,C}from"./chunk-yh2hnt3m.js";import{c}from"./chunk-xpbakn6t.js";import St from"path";import on from"process";import{AsyncLocalStorage as Ua}from"async_hooks";var Jr=new Ua;function $n(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function Xr(e,n){return Jr.run($n(e),n)}async function Gr(e,n){let r=Jr.getStore();if(!r)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=r.pending.get(e);if(i)return i;let a=Promise.resolve().then(n).then((l)=>{let u=JSON.stringify(l,(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(u);return r.values.set(e,f),f}).catch((l)=>{throw r.pending.delete(e),l});return r.pending.set(e,a),a}function Lr(e){let n=e.__stx_server_data;if(!n?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(n.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function G(e,n=!1){let r=t(e),i=[],a=new Set,l=0,u=0,f=r.length,x=()=>{if(l!==0)return;let v=r.slice(u).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(v){if(n&&v[1]==="const")return;let z=v[2];if(!a.has(z))i.push(z),a.add(z);return}let I=r.slice(u).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(I){if(n&&r.slice(u).startsWith("const"))return;I[1].split(",").forEach((z)=>{let N=z.trim();if(!N)return;let H=N.indexOf(":"),U=(H>=0?N.slice(H+1).trim():N).split(/[\s=]/)[0];if(U&&!a.has(U))i.push(U),a.add(U)});return}let D=r.slice(u).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(D){if(n&&r.slice(u).startsWith("const"))return;D[1].split(",").forEach((z)=>{let N=z.trim().replace(/^\.\.\./,"");if(!N)return;let H=N.split(/[\s=]/)[0];if(H&&!a.has(H))i.push(H),a.add(H)});return}if(n)return;let W=r.slice(u).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(W){let z=W[1];if(!a.has(z))i.push(z),a.add(z);return}let L=r.slice(u).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let z=L[1];if(!a.has(z))i.push(z),a.add(z)}};while(u<f){if(r[u]==="{"){l++,u++;continue}if(r[u]==="}"){l--,u++;continue}if(l===0&&/[a-z]/i.test(r[u])&&(u===0||/\s|[;{}()]/.test(r[u-1])))x();u++}return i.join(", ")}function Ws(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function Ha(e,n=G(e).split(",").map((r)=>r.trim()).filter(Boolean)){let r=new Set(G(e,!0).split(",").map((i)=>i.trim()));return n.map((i)=>r.has(i)?`get ${i}() { return ${i} }, set ${i}(__stxValue_${i}) { ${i} = __stxValue_${i} }`:i).join(", ")}function qs(e,n){let r=`{ ${Ha(e,n)} }`;return G(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${r}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:r}import en from"fs";import ze from"path";function X(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Yr=new Map;function Ar(e,n=!0){let r=Yr.get(e);if(n&&r)return r;let i=new Map,a=[ze.join(e,"src"),ze.join(e,"dist"),e];function l(u,f){if(f>6)return;let x;try{x=en.readdirSync(u,{withFileTypes:!0})}catch{return}for(let v of x){let I=ze.join(u,v.name);if(v.isDirectory()){if(v.name==="node_modules"||v.name.startsWith("."))continue;l(I,f+1)}else if(v.isFile()&&v.name.endsWith(".stx")){let D=v.name.slice(0,-4);if(!i.has(D))i.set(D,I);let W=D.toLowerCase();if(!i.has(W))i.set(W,I);let L=X(D);if(!i.has(L))i.set(L,I)}}}for(let u of a)if(l(u,0),i.size>0)break;if(n)Yr.set(e,i);return i}function Ks(e,n){if(e.startsWith(".")||e.startsWith("/"))return null;let r=n;while(!0){let i=ze.join(r,"node_modules",e);try{if(en.statSync(i).isDirectory())return i}catch{}let a=ze.dirname(r);if(a===r)return null;r=a}}function Gs(e,n,r={}){return[ze.resolve(ze.dirname(n),`${e}.stx`),ze.resolve(ze.dirname(n),e),ze.resolve(r.componentsDir||"components",`${e}.stx`),ze.resolve(r.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function Qr(e){let n=e.endsWith(".stx")?e.slice(0,-4):e,r=n.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),i=X(n);return[n,r,i]}function _i(e,n){let[r,i,a]=Qr(e);for(let l of[r,r.toLowerCase(),i,a]){let u=n?.__importedComponents?.get(l);if(u!==void 0)return u}}function Ci(e,n){let r=n?ze.resolve(n):void 0,i=ze.dirname(ze.resolve(e));for(;;){if(en.existsSync(ze.join(i,"package.json")))return r&&i===r?void 0:i;let a=ze.dirname(i);if(a===i)return;i=a}}var Ka=["src/ui","src/components","components","dist"];function Qn(e,n){let r=ze.resolve(e);if(!n&&!r.split(ze.sep).includes("node_modules"))return[];let i=Ci(r,n);if(!i)return[];let a=[];try{let f=JSON.parse(en.readFileSync(ze.join(i,"package.json"),"utf8")).stx?.components;if(Array.isArray(f))a=f.filter((x)=>typeof x==="string")}catch{}let l=a.length?a:Ka;return[ze.dirname(ze.resolve(e)),...l.map((u)=>ze.resolve(i,u))]}function*Ei(e,n,r={},i){let a=Qr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield ze.resolve(ze.dirname(n),`${a[0]}.stx`);return}let l=[...new Set(a.map((x)=>`${x}.stx`))],u=r.projectRoot||process.cwd(),f=[...Qn(n,r.projectRoot),...i?.__originalFilePath?[ze.join(ze.dirname(i.__originalFilePath),"components")]:[],...r.componentsDir?[r.componentsDir]:[],ze.join(ze.dirname(n),"components"),ze.resolve(u,"src/components"),ze.resolve(u,"components"),...import.meta.dir?[ze.resolve(import.meta.dir,"components")]:[]];for(let x of new Set(f)){for(let v of l)yield ze.join(x,v);try{for(let v of en.readdirSync(x,{withFileTypes:!0}))if(v.isDirectory())for(let I of l)yield ze.join(x,v.name,I)}catch{}}}function ei(e,n,r={},i){let a=_i(e,i);if(a!==void 0)return a;for(let l of Ei(e,n,r,i))try{if(en.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Xs(e,n=[],r={}){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(r).map(([v,I])=>[v.replace(/[-_]/g,"").toLowerCase(),I])),l=a.get("alt"),u=a.get("decorative"),f=typeof l==="string"&&!!l.trim(),x=typeof u==="string"?!["false","0","off","no"].includes(u.trim().toLowerCase()):Boolean(u);if(!f&&!x)return!1;if(["defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((v)=>i.has(v)))return!1;if([...n].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 Ss from"fs";import fe from"path";import Dt from"path";import hn from"fs";var qa=new Set(["touchstart","touchmove","wheel","mousewheel"]);function Ms(e,n){if(n.passive)return!0;if(n.prevent||n.nonpassive)return!1;return qa.has(e.toLowerCase())}var ti=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"]),ni={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"},Za=new Set(["ctrl","alt","shift","meta"]),ii={left:0,middle:1,right:2};function si(e){let n={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let r of e){let i=r.toLowerCase();if(i==="prevent")n.prevent=!0;else if(i==="stop")n.stop=!0;else if(i==="once")n.once=!0;else if(i==="capture")n.capture=!0;else if(i==="self")n.self=!0;else if(i==="passive")n.passive=!0;else if(i==="nonpassive")n.nonpassive=!0;else if(Za.has(i))n.systemKeys.push(i);else if(i in ii)n.mouse=i;else if(i in ni||/^[a-z]$/.test(i))n.keys.push(ni[i]||i.toUpperCase());else if(i.startsWith("debounce")){let a=i.match(/debounce(?:\.(\d+))?/);n.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(i.startsWith("throttle")){let a=i.match(/throttle(?:\.(\d+))?/);n.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return n}function oi(e,n=""){let r=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[u,f,x]=l,v=l.index,I=v+u.length,D=`__stx_evt_${n}${i++}`,W=[],L=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,z;while((z=L.exec(x))!==null){let[,H,Z]=z,U=H.split("."),V=U[0];if(!ti.has(V))continue;W.push({attribute:`@${H}`,event:V,handler:Z,modifiers:si(U.slice(1)),elementId:D})}let N=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((z=N.exec(x))!==null){let[,H,Z]=z,U=H.split("."),V=U[0];if(!ti.has(V))continue;W.push({attribute:`@${H}`,event:V,handler:Z,modifiers:si(U.slice(1)),elementId:D})}if(W.length>0)r.push({originalTag:u,elementId:D,events:W,startIndex:v,endIndex:I})}return r}function Ja(e){let n=[],{modifiers:r}=e;if(r.self)n.push("if ($event.target !== $el) return");for(let i of r.systemKeys)n.push(`if (!$event.${i}Key) return`);if(r.keys.length>0){let i=r.keys.map((a)=>`$event.key === '${a}'`).join(" || ");n.push(`if (!(${i})) return`)}if(r.mouse!==null){let i=ii[r.mouse];n.push(`if ($event.button !== ${i}) return`)}if(r.prevent)n.push("$event.preventDefault()");if(r.stop)n.push("$event.stopPropagation()");return n.join("; ")}function Xa(e,n){let r=e;if(n.debounce!==null)r=`__stx_debounce(() => { ${r} }, ${n.debounce})`;else if(n.throttle!==null)r=`__stx_throttle(() => { ${r} }, ${n.throttle})`;return r}function Ds(e){let n=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(n))return e;return`if (typeof ${n} === 'function' && !${n}._isSignal) ${n}($event);`}function Ga(e){let{modifiers:n}=e,r=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=Ja(e),a=Xa(Ds(e.handler),n),l=[];if(n.once)l.push("once: true");if(n.capture)l.push("capture: true");if(Ms(e.event,n))l.push("passive: true");let u=l.length>0?`, { ${l.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{Ye,Nn,ao,Ui,F}from"./chunk-6t04tqvh.js";import{On}from"./chunk-pk3pp1j5.js";import{Kr,_,Ll,wt,Qi,jl}from"./chunk-n22xtagg.js";import{M}from"./chunk-hxhmhw23.js";import{T,R}from"./chunk-s29hp1qw.js";import{qr,mo,Zi,Nl,De}from"./chunk-kwf3kfr0.js";import{co,d,m,Xt,p,ee,q,k,fo,Me,Qe,go}from"./chunk-295bykzd.js";import{b}from"./chunk-94mpe1ny.js";import{te}from"./chunk-ws2h92mm.js";import{t,E}from"./chunk-zpj6ggee.js";import{c}from"./chunk-xpbakn6t.js";import St from"path";import on from"process";import{AsyncLocalStorage as Ua}from"async_hooks";var Jr=new Ua;function $n(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function Xr(e,n){return Jr.run($n(e),n)}async function Gr(e,n){let r=Jr.getStore();if(!r)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=r.pending.get(e);if(i)return i;let a=Promise.resolve().then(n).then((l)=>{let u=JSON.stringify(l,(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(u);return r.values.set(e,f),f}).catch((l)=>{throw r.pending.delete(e),l});return r.pending.set(e,a),a}function Lr(e){let n=e.__stx_server_data;if(!n?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(n.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function G(e,n=!1){let r=t(e),i=[],a=new Set,l=0,u=0,f=r.length,x=()=>{if(l!==0)return;let v=r.slice(u).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(v){if(n&&v[1]==="const")return;let z=v[2];if(!a.has(z))i.push(z),a.add(z);return}let I=r.slice(u).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(I){if(n&&r.slice(u).startsWith("const"))return;I[1].split(",").forEach((z)=>{let N=z.trim();if(!N)return;let H=N.indexOf(":"),U=(H>=0?N.slice(H+1).trim():N).split(/[\s=]/)[0];if(U&&!a.has(U))i.push(U),a.add(U)});return}let D=r.slice(u).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(D){if(n&&r.slice(u).startsWith("const"))return;D[1].split(",").forEach((z)=>{let N=z.trim().replace(/^\.\.\./,"");if(!N)return;let H=N.split(/[\s=]/)[0];if(H&&!a.has(H))i.push(H),a.add(H)});return}if(n)return;let W=r.slice(u).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(W){let z=W[1];if(!a.has(z))i.push(z),a.add(z);return}let L=r.slice(u).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let z=L[1];if(!a.has(z))i.push(z),a.add(z)}};while(u<f){if(r[u]==="{"){l++,u++;continue}if(r[u]==="}"){l--,u++;continue}if(l===0&&/[a-z]/i.test(r[u])&&(u===0||/\s|[;{}()]/.test(r[u-1])))x();u++}return i.join(", ")}function Ws(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function Ha(e,n=G(e).split(",").map((r)=>r.trim()).filter(Boolean)){let r=new Set(G(e,!0).split(",").map((i)=>i.trim()));return n.map((i)=>r.has(i)?`get ${i}() { return ${i} }, set ${i}(__stxValue_${i}) { ${i} = __stxValue_${i} }`:i).join(", ")}function qs(e,n){let r=`{ ${Ha(e,n)} }`;return G(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${r}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:r}import en from"fs";import ze from"path";function X(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Yr=new Map;function Ar(e,n=!0){let r=Yr.get(e);if(n&&r)return r;let i=new Map,a=[ze.join(e,"src"),ze.join(e,"dist"),e];function l(u,f){if(f>6)return;let x;try{x=en.readdirSync(u,{withFileTypes:!0})}catch{return}for(let v of x){let I=ze.join(u,v.name);if(v.isDirectory()){if(v.name==="node_modules"||v.name.startsWith("."))continue;l(I,f+1)}else if(v.isFile()&&v.name.endsWith(".stx")){let D=v.name.slice(0,-4);if(!i.has(D))i.set(D,I);let W=D.toLowerCase();if(!i.has(W))i.set(W,I);let L=X(D);if(!i.has(L))i.set(L,I)}}}for(let u of a)if(l(u,0),i.size>0)break;if(n)Yr.set(e,i);return i}function Ks(e,n){if(e.startsWith(".")||e.startsWith("/"))return null;let r=n;while(!0){let i=ze.join(r,"node_modules",e);try{if(en.statSync(i).isDirectory())return i}catch{}let a=ze.dirname(r);if(a===r)return null;r=a}}function Gs(e,n,r={}){return[ze.resolve(ze.dirname(n),`${e}.stx`),ze.resolve(ze.dirname(n),e),ze.resolve(r.componentsDir||"components",`${e}.stx`),ze.resolve(r.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function Qr(e){let n=e.endsWith(".stx")?e.slice(0,-4):e,r=n.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),i=X(n);return[n,r,i]}function _i(e,n){let[r,i,a]=Qr(e);for(let l of[r,r.toLowerCase(),i,a]){let u=n?.__importedComponents?.get(l);if(u!==void 0)return u}}function Ci(e,n){let r=n?ze.resolve(n):void 0,i=ze.dirname(ze.resolve(e));for(;;){if(en.existsSync(ze.join(i,"package.json")))return r&&i===r?void 0:i;let a=ze.dirname(i);if(a===i)return;i=a}}var Ka=["src/ui","src/components","components","dist"];function Qn(e,n){let r=ze.resolve(e);if(!n&&!r.split(ze.sep).includes("node_modules"))return[];let i=Ci(r,n);if(!i)return[];let a=[];try{let f=JSON.parse(en.readFileSync(ze.join(i,"package.json"),"utf8")).stx?.components;if(Array.isArray(f))a=f.filter((x)=>typeof x==="string")}catch{}let l=a.length?a:Ka;return[ze.dirname(ze.resolve(e)),...l.map((u)=>ze.resolve(i,u))]}function*Ei(e,n,r={},i){let a=Qr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield ze.resolve(ze.dirname(n),`${a[0]}.stx`);return}let l=[...new Set(a.map((x)=>`${x}.stx`))],u=r.projectRoot||process.cwd(),f=[...Qn(n,r.projectRoot),...i?.__originalFilePath?[ze.join(ze.dirname(i.__originalFilePath),"components")]:[],...r.componentsDir?[r.componentsDir]:[],ze.join(ze.dirname(n),"components"),ze.resolve(u,"src/components"),ze.resolve(u,"components"),...import.meta.dir?[ze.resolve(import.meta.dir,"components")]:[]];for(let x of new Set(f)){for(let v of l)yield ze.join(x,v);try{for(let v of en.readdirSync(x,{withFileTypes:!0}))if(v.isDirectory())for(let I of l)yield ze.join(x,v.name,I)}catch{}}}function ei(e,n,r={},i){let a=_i(e,i);if(a!==void 0)return a;for(let l of Ei(e,n,r,i))try{if(en.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Xs(e,n=[],r={}){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(r).map(([v,I])=>[v.replace(/[-_]/g,"").toLowerCase(),I])),l=a.get("alt"),u=a.get("decorative"),f=typeof l==="string"&&!!l.trim(),x=typeof u==="string"?!["false","0","off","no"].includes(u.trim().toLowerCase()):Boolean(u);if(!f&&!x)return!1;if(["defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((v)=>i.has(v)))return!1;if([...n].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 Ss from"fs";import fe from"path";import Dt from"path";import hn from"fs";var qa=new Set(["touchstart","touchmove","wheel","mousewheel"]);function Ms(e,n){if(n.passive)return!0;if(n.prevent||n.nonpassive)return!1;return qa.has(e.toLowerCase())}var ti=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"]),ni={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"},Za=new Set(["ctrl","alt","shift","meta"]),ii={left:0,middle:1,right:2};function si(e){let n={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let r of e){let i=r.toLowerCase();if(i==="prevent")n.prevent=!0;else if(i==="stop")n.stop=!0;else if(i==="once")n.once=!0;else if(i==="capture")n.capture=!0;else if(i==="self")n.self=!0;else if(i==="passive")n.passive=!0;else if(i==="nonpassive")n.nonpassive=!0;else if(Za.has(i))n.systemKeys.push(i);else if(i in ii)n.mouse=i;else if(i in ni||/^[a-z]$/.test(i))n.keys.push(ni[i]||i.toUpperCase());else if(i.startsWith("debounce")){let a=i.match(/debounce(?:\.(\d+))?/);n.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(i.startsWith("throttle")){let a=i.match(/throttle(?:\.(\d+))?/);n.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return n}function oi(e,n=""){let r=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[u,f,x]=l,v=l.index,I=v+u.length,D=`__stx_evt_${n}${i++}`,W=[],L=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,z;while((z=L.exec(x))!==null){let[,H,Z]=z,U=H.split("."),V=U[0];if(!ti.has(V))continue;W.push({attribute:`@${H}`,event:V,handler:Z,modifiers:si(U.slice(1)),elementId:D})}let N=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((z=N.exec(x))!==null){let[,H,Z]=z,U=H.split("."),V=U[0];if(!ti.has(V))continue;W.push({attribute:`@${H}`,event:V,handler:Z,modifiers:si(U.slice(1)),elementId:D})}if(W.length>0)r.push({originalTag:u,elementId:D,events:W,startIndex:v,endIndex:I})}return r}function Ja(e){let n=[],{modifiers:r}=e;if(r.self)n.push("if ($event.target !== $el) return");for(let i of r.systemKeys)n.push(`if (!$event.${i}Key) return`);if(r.keys.length>0){let i=r.keys.map((a)=>`$event.key === '${a}'`).join(" || ");n.push(`if (!(${i})) return`)}if(r.mouse!==null){let i=ii[r.mouse];n.push(`if ($event.button !== ${i}) return`)}if(r.prevent)n.push("$event.preventDefault()");if(r.stop)n.push("$event.stopPropagation()");return n.join("; ")}function Xa(e,n){let r=e;if(n.debounce!==null)r=`__stx_debounce(() => { ${r} }, ${n.debounce})`;else if(n.throttle!==null)r=`__stx_throttle(() => { ${r} }, ${n.throttle})`;return r}function Ds(e){let n=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(n))return e;return`if (typeof ${n} === 'function' && !${n}._isSignal) ${n}($event);`}function Ga(e){let{modifiers:n}=e,r=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=Ja(e),a=Xa(Ds(e.handler),n),l=[];if(n.once)l.push("once: true");if(n.capture)l.push("capture: true");if(Ms(e.event,n))l.push("passive: true");let u=l.length>0?`, { ${l.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('${r}');
|
|
5
5
|
if (!$el) return;
|
|
@@ -112,15 +112,15 @@ else {
|
|
|
112
112
|
`)}
|
|
113
113
|
})();
|
|
114
114
|
</script>`}function Ya(e,n=""){let r=oi(e,n);if(r.length===0)return{template:e,bindings:[]};let i=e,a=[];for(let l=r.length-1;l>=0;l--){let u=r[l],f=u.originalTag;if(!f.includes(" id="))f=f.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${u.elementId}"`);else{let x=f.match(/id=["']([^"']+)["']/);if(x)for(let v of u.events)v.elementId=x[1]}for(let x of u.events){let v=x.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),I=new RegExp(`\\s*${v}\\s*=\\s*"[^"]*"`,"g"),D=new RegExp(`\\s*${v}\\s*=\\s*'[^']*'`,"g");f=f.replace(I,""),f=f.replace(D,"")}i=i.slice(0,u.startIndex)+f+i.slice(u.endIndex),a.push(...u.events)}return{template:i,bindings:a}}function ri(e){let n=e.$uid;return typeof n==="string"&&n?`${n}_`:""}function Qc(e,n,r){if(jl(e))return e;if(n.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:f,bindings:x}=Ya(e,ri(n)),v=n.__stx_event_bindings||[];return n.__stx_event_bindings=[...v,...x],f}let i=oi(e,ri(n));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 I=v.match(/id=["']([^"']+)["']/);if(I)for(let D of x.events)D.elementId=I[1]}for(let I of x.events){let D=I.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`\\s*${D}\\s*=\\s*"[^"]*"`,"g"),L=new RegExp(`\\s*${D}\\s*=\\s*'[^']*'`,"g");v=v.replace(W,""),v=v.replace(L,"")}a=a.slice(0,x.startIndex)+v+a.slice(x.endIndex)}let l=Ti(i.flatMap((f)=>f.events)),u=c(a);if(u!==-1)a=a.slice(0,u)+l+`
|
|
115
|
-
`+a.slice(u);else a+=l;return a}function ai(e,n){let r=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(n){let l=a.lastIndexOf(":");if(l!==-1)a=a.slice(l+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))r.add(a)}return r}function zt(e,n){let r=t(e),{depths:i,balanced:a}=
|
|
115
|
+
`+a.slice(u);else a+=l;return a}function ai(e,n){let r=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(n){let l=a.lastIndexOf(":");if(l!==-1)a=a.slice(l+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))r.add(a)}return r}function zt(e,n){let r=t(e),{depths:i,balanced:a}=E(r),l=(f)=>!a||i[f]===0,u=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${n}\\b)`,"g");for(let f of r.matchAll(u)){let x=(f.index??0)+f[0].length-f[1].length;if(l(x))return!0}for(let f of r.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(f.index??0)&&ai(f[1],!0).has(n))return!0;for(let f of r.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(f.index??0)&&ai(f[1],!1).has(n))return!0;return!1}var Ve="0.2.885";var ci=Symbol.for(`stx.lazy-module-promises.${Ve}`);function ec(){let e=globalThis;return e[ci]??=new Map,e[ci]}function o(e,n){let r=ec(),i=`${import.meta.url}\x00${e}`,a=r.get(i);if(a)return a;let l=n();return r.set(i,l),l.catch(()=>{if(r.get(i)===l)r.delete(i)}),l}var tc=/<\/(script)/gi;function ge(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(tc,"<\\/$1")}import li from"fs";var ui=[];function S(e){let n=new T(e);return ui.push(n),n}function el(){for(let e of ui)e.clear()}function C(e,...n){return`${n.map((r)=>String(r??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function Pr(e){let n=[];for(let r of new Set(e))try{n.push({path:r,mtimeMs:li.statSync(r).mtimeMs})}catch{}return n}function Js(e){for(let n of e)try{if(li.statSync(n.path).mtimeMs!==n.mtimeMs)return!1}catch{return!1}return!0}var Ae=["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 nc=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function sc(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let r=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!r)return null;return{pkg:r[1],subpath:r[2]||""}}let n=e.match(/^([^/]+)(\/.*)?$/);if(!n)return null;return{pkg:n[1],subpath:n[2]||""}}function rc(e,n){let r=n;while(!0){let i=Dt.join(r,"node_modules",e,"package.json");if(hn.existsSync(i))return Dt.dirname(i);let a=Dt.dirname(r);if(a===r)return null;r=a}}function ic(e,n){if(!e||typeof e!=="object")return null;let r=(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 r(a.import);if(typeof a.default==="object")return r(a.default)}return null};if(Object.prototype.hasOwnProperty.call(e,n))return r(e[n]);let i=null;for(let a of Object.keys(e)){let l=a.indexOf("*");if(l===-1)continue;let u=a.slice(0,l),f=a.slice(l+1);if(!n.startsWith(u)||!n.endsWith(f))continue;if(n.length<u.length+f.length)continue;if(!i||u.length>i.prefix.length)i={pattern:a,prefix:u,suffix:f}}if(i){let a=n.slice(i.prefix.length,n.length-i.suffix.length),l=r(e[i.pattern]);if(l)return l.replace("*",a)}return null}function oc(e,n){let r=sc(e);if(!r||!r.subpath)return null;let i=rc(r.pkg,n);if(!i)return null;let a;try{a=JSON.parse(hn.readFileSync(Dt.join(i,"package.json"),"utf8"))}catch{return null}let l=`.${r.subpath}`,u=ic(a.exports,l);if(!u)return null;let f=Dt.resolve(i,u);return hn.existsSync(f)?f:null}function Li(e,n){let r=n.filePath?Dt.dirname(n.filePath):n.projectRoot||process.cwd(),i=n.projectRoot||process.cwd(),a=new Set,l=[],u=[];return{code:e.replace(nc,(x,v)=>{let I;try{if(v.startsWith("./")||v.startsWith("../")||v.startsWith("/")){if(I=v.startsWith("/")?v:Dt.resolve(r,v),!hn.existsSync(I))throw Error(`file not found: ${I}`)}else{let D=null;try{D=Bun.resolveSync(v,i)}catch{D=oc(v,i)}if(!D)throw Error(`could not resolve ${v} (Bun.resolveSync + exports fallback both failed)`);I=D}}catch(D){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(v)} (from ${n.filePath||"<unknown>"}): ${D?.message||D}`),u.push(v),""}if(a.has(I))return"";a.add(I);try{let D=hn.readFileSync(I,"utf8");l.push({source:v,resolvedPath:I,contents:D})}catch(D){console.warn(`[stx:vendor-css] could not read ${I}: ${D?.message||D}`),u.push(v)}return""}),styles:l,unresolved:u}}function ac(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function ji(e){if(e.length===0)return"";return`${e.map((n)=>`<style data-stx-vendor="${ac(n.source)}" data-stx-layer="vendor">
|
|
116
116
|
@layer vendor {
|
|
117
117
|
${n.contents}
|
|
118
118
|
}
|
|
119
119
|
</style>`).join(`
|
|
120
120
|
`)}
|
|
121
|
-
`}var Ng=
|
|
121
|
+
`}var Ng=_,pi=S(256);function Kt(e){let n=C(e),r=pi.get(n);if(!r)r=cc(e),pi.set(n,r);return{code:r.code,imports:[...r.imports],models:[...r.models]}}function cc(e){let n=t(e),r=new Set;for(let f of e.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let x of f[1].split(",")){let v=x.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(v)r.add(v)}let i=mo(n),a=Ae.filter((f)=>{if(r.has(f)||i.has(f))return!1;return Mg(n,f,!0)}),l=mi(n).filter((f)=>!r.has(f)&&!i.has(f));if(a.length===0&&l.length===0)return{code:e,imports:a,models:l};return{code:`${[a.length>0?`import { ${a.join(", ")} } from '@stacksjs/browser'`:"",l.length>0?"import '@stacksjs/browser'":"",l.length>0?`const { ${l.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
|
|
122
122
|
`)}
|
|
123
|
-
${e}`,imports:a,models:l}}var lc=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process","Modal","Intl"]);function mi(e,n=qr(e)){let r=new Set,i=mo(e),a=/(?<![\w$.])([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g;for(let l of n.code.matchAll(a)){let u=l[1];if(lc.has(u)||i.has(u)||u.length<3)continue;if(n.shadows(u,l.index??0))continue;r.add(u)}return Array.from(r)}function uc(e){return mo(e)}var fi=S(128);function bl(e){let n=
|
|
123
|
+
${e}`,imports:a,models:l}}var lc=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process","Modal","Intl"]);function mi(e,n=qr(e)){let r=new Set,i=mo(e),a=/(?<![\w$.])([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g;for(let l of n.code.matchAll(a)){let u=l[1];if(lc.has(u)||i.has(u)||u.length<3)continue;if(n.shadows(u,l.index??0))continue;r.add(u)}return Array.from(r)}function uc(e){return mo(e)}var fi=S(128);function bl(e){let n=C(e),r=fi.get(n);if(!r)r=pc(e),fi.set(n,r);return{code:r.code,stxImports:[...r.stxImports],browserImports:[...r.browserImports]}}function pc(e){let n=new Set,r=new Set,i=e;i=i.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let a=new Set,l=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,u;while((u=l.exec(e))!==null){let L=u[1],z=u[2];if(u[0].includes("import type"))continue;let N=[];for(let Z of L.split(",")){let U=Z.trim();if(!U||U.startsWith("type "))continue;let V=U.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!V)continue;let K=V[1],ne=V[2]||K;if(a.add(K),a.add(ne),z==="stx"||z==="@stacksjs/stx")n.add(K);else r.add(K);if(ne!==K)N.push(`${ne} = ${K}`)}let H=N.length>0?`var ${N.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";i=i.replace(u[0],H)}let f=uc(i),x=qr(i);for(let L of Ng){if(a.has(L)||f.has(L))continue;if(Ns(x,L,!0))n.add(L)}let v=t(i),I=qr(v),D=new Set;for(let L of i.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let z of L[1].split(",")){let N=z.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let H of N){let Z=H.trim();if(Z)D.add(Z)}}for(let L of Ae){if(a.has(L)||f.has(L)||D.has(L))continue;if(Ns(I,L))r.add(L)}let W=mi(v,I);for(let L of W)if(!a.has(L)&&!f.has(L))r.add(L);return{code:i,stxImports:Array.from(n),browserImports:Array.from(r)}}function Mg(e,n,r=!1){return Ns(qr(e),n,r)}function Ns(e,n,r=!1){let i=e.code,a=new RegExp(`\\b${n.replace(/[$]/g,"\\$")}\\b`,"g");for(let l of i.matchAll(a)){let u=l.index??0;if(e.shadows(n,u))continue;let f=u+n.length,x=u-1;while(x>=0&&/\s/.test(i[x]))x--;if(i[x]==="."&&i.slice(Math.max(0,x-2),x+1)!=="...")continue;let v=f;while(v<i.length&&/\s/.test(i[v]))v++;if(i[v]===":"&&i[v+1]!==":"&&(i[x]==="{"||i[x]===","))continue;if(r&&!/^\s*(?:<[^>]*>)?\s*\(/.test(i.slice(f)))continue;if(fc(i,f))continue;return!0}return!1}function fc(e,n){let r=n;while(r<e.length&&(e[r]===" "||e[r]==="\t"))r++;if(e[r]!=="(")return!1;let i=0;for(;r<e.length;r++){let a=e[r];if(a==="(")i++;else if(a===")"){if(i--,i===0)break}}if(i!==0)return!1;r++;while(r<e.length&&(e[r]===" "||e[r]==="\t"))r++;return e[r]==="{"}function wl(e,n){let r=[];if(e.length>0)r.push(` var { ${e.join(", ")} } = window.stx || window;`);if(n.length>0)r.push(` var { ${n.join(", ")} } = window.StacksBrowser || {};`);if(r.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
|
|
124
124
|
${r.join(`
|
|
125
125
|
`)}
|
|
126
126
|
${dc(e,n)}`;return""}function Cy(e,n=[]){let{browserImports:r}=bl(e),i=new Set(n);return wl([],r.filter((a)=>!i.has(a)))}function dc(e,n){let r=[...e.map((i)=>`['${i}', typeof ${i}, 'stx']`),...n.map((i)=>`['${i}', typeof ${i}, '@stacksjs/browser']`)];if(r.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
|
|
@@ -182,7 +182,7 @@ else {
|
|
|
182
182
|
// STX: auto-generated event bindings
|
|
183
183
|
${e.map((r,i)=>bc(r,i)).join(`
|
|
184
184
|
`)}`}function gi(e){let n=[],r=new Set,i=e.replace(/^\s*import\s+.*$/gm,""),a=0,l=i.length,u=0;while(u<l){let f=i[u];if(f==="'"||f==='"'||f==="`"){let x=f;if(u++,x==="`"){let v=0;while(u<l){if(i[u]==="\\"){u+=2;continue}if(i[u]==="`"&&v===0){u++;break}if(i[u]==="$"&&i[u+1]==="{"){v++,u+=2;continue}if(i[u]==="}"&&v>0){v--,u++;continue}u++}}else while(u<l){if(i[u]==="\\"){u+=2;continue}if(i[u]===x){u++;break}u++}continue}if(f==="/"&&i[u+1]==="/"){while(u<l&&i[u]!==`
|
|
185
|
-
`)u++;continue}if(f==="/"&&i[u+1]==="*"){u+=2;while(u<l-1&&!(i[u]==="*"&&i[u+1]==="/"))u++;u+=2;continue}if(f==="{"){a++,u++;continue}if(f==="}"){a--,u++;continue}if(a===0){let x=i.slice(u),v=x.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(v){let W=v[1];if(!W.startsWith("_")&&!r.has(W))n.push(W),r.add(W);u+=v[0].length;continue}let I=x.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(I){I[1].split(",").forEach((W)=>{let L=W.trim(),z=L.indexOf(":"),N=z>=0?L.slice(z+1).trim().split(/[\s=]/)[0]:L.split(/[\s=]/)[0];if(N&&!N.startsWith("_")&&!r.has(N))n.push(N),r.add(N)}),u+=I[0].length;continue}let D=x.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(D){let W=D[1];if(!W.startsWith("_")&&!r.has(W))n.push(W),r.add(W);u+=D[0].length;continue}}u++}return n}var _c=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 wc(e){let n=new Set,r=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(W){let L;while((L=r.exec(W))!==null){let z=L[0];if(!_c.has(z))n.add(z)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)i(l[1]);let u=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=u.exec(e))!==null)i(l[1]);let f=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=f.exec(e))!==null)i(l[1]);let x=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=x.exec(e))!==null)i(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=v.exec(e))!==null)i(l[1]);let I=/@model\s*=\s*["']([^"']*)["']/gi;while((l=I.exec(e))!==null)i(l[1]);let D=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=D.exec(e))!==null)i(l[1]);return n}async function Ke(e,n={}){let r=e,i="",a=!1,l=[],u=Li(r,{filePath:n.filePath,projectRoot:n.projectRoot});r=u.code;let f=ji(u.styles),x=Kt(r);r=x.code,l=[...x.imports,...x.models];let{hasUserImports:v,bundleClientScript:I}=await o("stx/client-script-bundler",()=>import("./chunk-
|
|
185
|
+
`)u++;continue}if(f==="/"&&i[u+1]==="*"){u+=2;while(u<l-1&&!(i[u]==="*"&&i[u+1]==="/"))u++;u+=2;continue}if(f==="{"){a++,u++;continue}if(f==="}"){a--,u++;continue}if(a===0){let x=i.slice(u),v=x.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(v){let W=v[1];if(!W.startsWith("_")&&!r.has(W))n.push(W),r.add(W);u+=v[0].length;continue}let I=x.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(I){I[1].split(",").forEach((W)=>{let L=W.trim(),z=L.indexOf(":"),N=z>=0?L.slice(z+1).trim().split(/[\s=]/)[0]:L.split(/[\s=]/)[0];if(N&&!N.startsWith("_")&&!r.has(N))n.push(N),r.add(N)}),u+=I[0].length;continue}let D=x.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(D){let W=D[1];if(!W.startsWith("_")&&!r.has(W))n.push(W),r.add(W);u+=D[0].length;continue}}u++}return n}var _c=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 wc(e){let n=new Set,r=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(W){let L;while((L=r.exec(W))!==null){let z=L[0];if(!_c.has(z))n.add(z)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)i(l[1]);let u=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=u.exec(e))!==null)i(l[1]);let f=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=f.exec(e))!==null)i(l[1]);let x=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=x.exec(e))!==null)i(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=v.exec(e))!==null)i(l[1]);let I=/@model\s*=\s*["']([^"']*)["']/gi;while((l=I.exec(e))!==null)i(l[1]);let D=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=D.exec(e))!==null)i(l[1]);return n}async function Ke(e,n={}){let r=e,i="",a=!1,l=[],u=Li(r,{filePath:n.filePath,projectRoot:n.projectRoot});r=u.code;let f=ji(u.styles),x=Kt(r);r=x.code,l=[...x.imports,...x.models];let{hasUserImports:v,bundleClientScript:I}=await o("stx/client-script-bundler",()=>import("./chunk-72qdbhfh.js"));if(v(r))r=await I(r,n.filePath||"",{projectRoot:n.projectRoot,minify:n.production}),a=!0;if(n.autoImports!==!1){let V=bl(r);r=V.code,i=wl(V.stxImports,V.browserImports.filter((K)=>!l.includes(K)))}if(i=`${Rn(r,n.serverData)}${i}`,r=M(r),!a&&Ge(n.attrs||""))r=Xe(r);let D=yc(n.eventBindings||[]),W=(n.attrs||"").trim(),L=/\btype\s*=\s*["']module["']/i.test(W),z=n.instanceId?` data-stx-instance="${n.instanceId}"`:"";if(L){let V=W.replace(/\btype\s*=\s*["']module["']/i,"").trim(),K=`type="module" data-stx-scoped${z}${V?` ${V}`:""}`;return`${f}<script ${K}>
|
|
186
186
|
${ge(`${i}${r}
|
|
187
187
|
${D}`)}
|
|
188
188
|
</script>`}let N=Qi(e),H=/function __stx_setup_/.test(r),Z=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function U(V){let K=V.length>0?`
|
|
@@ -505,7 +505,7 @@ window.__stx_reactive = (function() {
|
|
|
505
505
|
${Jl()}
|
|
506
506
|
${i}
|
|
507
507
|
</script>`}function ul(e,n,r,i=!1){if(!or(e))return e;let a=Hl(e);if(a.length===0)return e;let l=Gl(e,a),u=Xl(a,n,i),f=c(l);if(f!==-1)l=l.slice(0,f)+u+`
|
|
508
|
-
`+l.slice(f);else l+=u;return l}function Gl(e,n){let r=[],i=0;for(let[l,u]of To(e).entries()){let f=n[l];if(!f)break;r.push(e.slice(i,u.startIndex));let x=fs(u.attributes,"data-stx-scope");if(x)f.id=x,f.selector=`[data-stx-scope="${f.id}"]`,r.push(u.fullMatch);else r.push(`<${u.tagName} data-stx-scope="${f.id}"${u.attributes}>`);i=u.endIndex}r.push(e.slice(i));let a=r.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 or(e){return/x-data\s*=\s*["']/.test(e)}function ro(e,n){let r=e,i=/@json\s*\(/g,a;while((a=i.exec(r))!==null){let l=a.index,u=l+a[0].length-1,f=1,x=u+1,v=null,I=!1;while(x<r.length&&f>0){let V=r[x];if(I){I=!1,x++;continue}if(V==="\\"&&v){I=!0,x++;continue}if(v){if(V===v)v=null;x++;continue}if(V==='"'||V==="'"||V==="`"){v=V,x++;continue}if(V==="(")f++;else if(V===")"){if(f--,f===0)break}x++}if(f!==0)break;let D=r.substring(u+1,x).trim(),W=r.substring(l,x+1),L=-1,z=0,N=null,H=!1;for(let V=0;V<D.length;V++){let K=D[V];if(H){H=!1;continue}if(K==="\\"&&N){H=!0;continue}if(N){if(K===N)N=null;continue}if(K==='"'||K==="'"||K==="`"){N=K;continue}if(K==="("||K==="["||K==="{")z++;else if(K===")"||K==="]"||K==="}")z--;if(K===","&&z===0){L=V;break}}let Z=L>=0?D.substring(0,L).trim():D,U=L>=0?D.substring(L+1).trim():void 0;try{let V=Z.trim(),K;if(m(V))K=p(V,Object.keys(n))(...Object.values(n));else K=void 0;let ne;if(U==="true")ne=JSON.stringify(K,null,2);else ne=JSON.stringify(K);let ae=ne.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");r=r.substring(0,l)+ae+r.substring(x+1),i.lastIndex=l+ae.length}catch(V){q.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),i.lastIndex=l+W.length}}return r}function so(e){return e.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function dl(e){let n=e,r=/@memo\s*\(/g,i,a=[];while((i=r.exec(n))!==null){let l=i.index,u=l+i[0].length,f=1,x=u;while(x<n.length&&f>0){if(n[x]==="(")f++;else if(n[x]===")")f--;x++}if(f!==0)continue;let v=n.slice(u,x-1).trim(),I=x,D=n.slice(I),W=D.indexOf("@endmemo");if(W===-1)continue;let L=D.slice(0,W),z=I+W+8,N=Ht(L),H=L.slice(N),Z=L.match(/(\s*)$/),U=Z?Z[0].length:0,V=H.slice(0,H.length-U),K=V.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),ne;if(K){let[ae,de,pe="",Ee]=K,Ce=`<${de}${pe} data-stx-memo="${v}"${Ee}>`;ne=L.slice(0,N)+Ce+V.slice(ae.length)+L.slice(N+V.length)}else ne=`${L.slice(0,N)}<div data-stx-memo="${v}">${V}</div>${L.slice(N+V.length)}`;a.push({start:l,end:z,replacement:ne}),r.lastIndex=z}for(let l=a.length-1;l>=0;l--){let u=a[l];n=n.slice(0,u.start)+u.replacement+n.slice(u.end)}return n.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function Mi(e){let n=e.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return n=n.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),n}function jo(e,n){let r=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,i=w(e,(f,x)=>{r.lastIndex=x;let v=r.exec(f);if(!v||/^(?:script|style)$/i.test(v[1]))return-1;return r.lastIndex}),a=[],l=0,u=[];for(let{start:f,end:x,token:v}of i){let I=/^<\/?([\w-]+)/.exec(v)[1].toLowerCase();if(v.startsWith("</")){while(a.length&&a.pop()!==I);continue}if(!a.length&&!/\sdata-stx-slot-owner\s*=/.test(v))u.push(e.slice(l,f),v.replace(/\s*\/?>$/,(D)=>` data-stx-slot-owner="${n}"${D}`)),l=x;if(!ar.has(I)&&!/\/>$/.test(v))a.push(I)}return u.push(e.slice(l)),u.join("")}function Mo(e,n){if(!/\bref\s*=/.test(e))return e;let r=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,i=w(e,(x,v)=>{r.lastIndex=v;let I=r.exec(x);if(!I||/^(?:script|style)$/i.test(I[1]))return-1;return r.lastIndex}),a=[],l=0,u=0,f=[];for(let{start:x,end:v,token:I}of i){let D=/^<\/?([\w-]+)/.exec(I)[1].toLowerCase();if(I.startsWith("</")){let N;while(N=a.pop()){if(N.scoped)l--;if(N.name===D)break}continue}let W=/\sdata-stx-scope\s*=/.test(I),L=/\sdata-stx-ref-caller\s*=\s*(["'])(.*?)\1/.exec(I),z=a.find((N)=>N.scoped)?.scopeId;if(L&&z&&L[2]===z)f.push(e.slice(u,x),I.replace(L[0],` data-stx-ref-caller="${n}"`)),u=v;else if(!l&&!W&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(I)&&!/\sdata-stx-ref-caller\s*=/.test(I))f.push(e.slice(u,x),I.replace(/\s*\/?>$/,(N)=>` data-stx-ref-caller="${n}"${N}`)),u=v;if(!ar.has(D)&&!/\/>$/.test(I)){let N=/\sdata-stx-scope\s*=\s*(?:"([^"]*)"|'([^']*)')/.exec(I);if(a.push({name:D,scoped:W,scopeId:N?.[1]??N?.[2]}),W)l++}}return f.push(e.slice(u)),f.join("")}var ar=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Do=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,Io=/<\/?\s*([a-z][\w-]*)/iy,Yl=/\s/;function Ql(e,n){let r=n-1;while(r>=0&&Yl.test(e[r]))r--;return r>=0&&e[r]==="/"}function eu(e,n){let r=!1,i=!1;for(let a=n;a<e.length;a++){let l=e[a];if(r){if(l==="'")r=!1}else if(i){if(l==='"')i=!1}else if(l==="'")r=!0;else if(l==='"')i=!0;else if(l===">")return a}return-1}function tu(e,n){if(e.indexOf("{",n)===-1||e.indexOf("}",n)===-1)return!1;let r=0,i=n,a=!1,l=!1,u=!1;while(i<e.length){let f=e.indexOf("<",i),x=f===-1?e.length:f;if(x>i){if(r===0)while(i<x){let D=e.indexOf(l?"}":"{",i);if(D===-1||D>=x){if(l)u=!1;else a=!1;break}if(D>i)if(l)u=!1;else a=!1;if(l){if(u)return!0;u=!0}else if(a)l=!0,u=!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=eu(e,i);if(v===-1)break;Io.lastIndex=i;let I=Io.exec(e)?.[1]?.toLowerCase()??"";if(e[i+1]==="/"){if(r===0)break;r--}else if(!Ql(e,v)&&!ar.has(I))r++;i=v+1}return!1}var Po=S(256);function pl(e){if(e.length<1024)return Oo(e);let n=
|
|
508
|
+
`+l.slice(f);else l+=u;return l}function Gl(e,n){let r=[],i=0;for(let[l,u]of To(e).entries()){let f=n[l];if(!f)break;r.push(e.slice(i,u.startIndex));let x=fs(u.attributes,"data-stx-scope");if(x)f.id=x,f.selector=`[data-stx-scope="${f.id}"]`,r.push(u.fullMatch);else r.push(`<${u.tagName} data-stx-scope="${f.id}"${u.attributes}>`);i=u.endIndex}r.push(e.slice(i));let a=r.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 or(e){return/x-data\s*=\s*["']/.test(e)}function ro(e,n){let r=e,i=/@json\s*\(/g,a;while((a=i.exec(r))!==null){let l=a.index,u=l+a[0].length-1,f=1,x=u+1,v=null,I=!1;while(x<r.length&&f>0){let V=r[x];if(I){I=!1,x++;continue}if(V==="\\"&&v){I=!0,x++;continue}if(v){if(V===v)v=null;x++;continue}if(V==='"'||V==="'"||V==="`"){v=V,x++;continue}if(V==="(")f++;else if(V===")"){if(f--,f===0)break}x++}if(f!==0)break;let D=r.substring(u+1,x).trim(),W=r.substring(l,x+1),L=-1,z=0,N=null,H=!1;for(let V=0;V<D.length;V++){let K=D[V];if(H){H=!1;continue}if(K==="\\"&&N){H=!0;continue}if(N){if(K===N)N=null;continue}if(K==='"'||K==="'"||K==="`"){N=K;continue}if(K==="("||K==="["||K==="{")z++;else if(K===")"||K==="]"||K==="}")z--;if(K===","&&z===0){L=V;break}}let Z=L>=0?D.substring(0,L).trim():D,U=L>=0?D.substring(L+1).trim():void 0;try{let V=Z.trim(),K;if(m(V))K=p(V,Object.keys(n))(...Object.values(n));else K=void 0;let ne;if(U==="true")ne=JSON.stringify(K,null,2);else ne=JSON.stringify(K);let ae=ne.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");r=r.substring(0,l)+ae+r.substring(x+1),i.lastIndex=l+ae.length}catch(V){q.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),i.lastIndex=l+W.length}}return r}function so(e){return e.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function dl(e){let n=e,r=/@memo\s*\(/g,i,a=[];while((i=r.exec(n))!==null){let l=i.index,u=l+i[0].length,f=1,x=u;while(x<n.length&&f>0){if(n[x]==="(")f++;else if(n[x]===")")f--;x++}if(f!==0)continue;let v=n.slice(u,x-1).trim(),I=x,D=n.slice(I),W=D.indexOf("@endmemo");if(W===-1)continue;let L=D.slice(0,W),z=I+W+8,N=Ht(L),H=L.slice(N),Z=L.match(/(\s*)$/),U=Z?Z[0].length:0,V=H.slice(0,H.length-U),K=V.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),ne;if(K){let[ae,de,pe="",Ee]=K,Ce=`<${de}${pe} data-stx-memo="${v}"${Ee}>`;ne=L.slice(0,N)+Ce+V.slice(ae.length)+L.slice(N+V.length)}else ne=`${L.slice(0,N)}<div data-stx-memo="${v}">${V}</div>${L.slice(N+V.length)}`;a.push({start:l,end:z,replacement:ne}),r.lastIndex=z}for(let l=a.length-1;l>=0;l--){let u=a[l];n=n.slice(0,u.start)+u.replacement+n.slice(u.end)}return n.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function Mi(e){let n=e.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return n=n.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),n}function jo(e,n){let r=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,i=w(e,(f,x)=>{r.lastIndex=x;let v=r.exec(f);if(!v||/^(?:script|style)$/i.test(v[1]))return-1;return r.lastIndex}),a=[],l=0,u=[];for(let{start:f,end:x,token:v}of i){let I=/^<\/?([\w-]+)/.exec(v)[1].toLowerCase();if(v.startsWith("</")){while(a.length&&a.pop()!==I);continue}if(!a.length&&!/\sdata-stx-slot-owner\s*=/.test(v))u.push(e.slice(l,f),v.replace(/\s*\/?>$/,(D)=>` data-stx-slot-owner="${n}"${D}`)),l=x;if(!ar.has(I)&&!/\/>$/.test(v))a.push(I)}return u.push(e.slice(l)),u.join("")}function Mo(e,n){if(!/\bref\s*=/.test(e))return e;let r=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,i=w(e,(x,v)=>{r.lastIndex=v;let I=r.exec(x);if(!I||/^(?:script|style)$/i.test(I[1]))return-1;return r.lastIndex}),a=[],l=0,u=0,f=[];for(let{start:x,end:v,token:I}of i){let D=/^<\/?([\w-]+)/.exec(I)[1].toLowerCase();if(I.startsWith("</")){let N;while(N=a.pop()){if(N.scoped)l--;if(N.name===D)break}continue}let W=/\sdata-stx-scope\s*=/.test(I),L=/\sdata-stx-ref-caller\s*=\s*(["'])(.*?)\1/.exec(I),z=a.find((N)=>N.scoped)?.scopeId;if(L&&z&&L[2]===z)f.push(e.slice(u,x),I.replace(L[0],` data-stx-ref-caller="${n}"`)),u=v;else if(!l&&!W&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(I)&&!/\sdata-stx-ref-caller\s*=/.test(I))f.push(e.slice(u,x),I.replace(/\s*\/?>$/,(N)=>` data-stx-ref-caller="${n}"${N}`)),u=v;if(!ar.has(D)&&!/\/>$/.test(I)){let N=/\sdata-stx-scope\s*=\s*(?:"([^"]*)"|'([^']*)')/.exec(I);if(a.push({name:D,scoped:W,scopeId:N?.[1]??N?.[2]}),W)l++}}return f.push(e.slice(u)),f.join("")}var ar=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Do=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,Io=/<\/?\s*([a-z][\w-]*)/iy,Yl=/\s/;function Ql(e,n){let r=n-1;while(r>=0&&Yl.test(e[r]))r--;return r>=0&&e[r]==="/"}function eu(e,n){let r=!1,i=!1;for(let a=n;a<e.length;a++){let l=e[a];if(r){if(l==="'")r=!1}else if(i){if(l==='"')i=!1}else if(l==="'")r=!0;else if(l==='"')i=!0;else if(l===">")return a}return-1}function tu(e,n){if(e.indexOf("{",n)===-1||e.indexOf("}",n)===-1)return!1;let r=0,i=n,a=!1,l=!1,u=!1;while(i<e.length){let f=e.indexOf("<",i),x=f===-1?e.length:f;if(x>i){if(r===0)while(i<x){let D=e.indexOf(l?"}":"{",i);if(D===-1||D>=x){if(l)u=!1;else a=!1;break}if(D>i)if(l)u=!1;else a=!1;if(l){if(u)return!0;u=!0}else if(a)l=!0,u=!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=eu(e,i);if(v===-1)break;Io.lastIndex=i;let I=Io.exec(e)?.[1]?.toLowerCase()??"";if(e[i+1]==="/"){if(r===0)break;r--}else if(!Ql(e,v)&&!ar.has(I))r++;i=v+1}return!1}var Po=S(256);function pl(e){if(e.length<1024)return Oo(e);let n=C(e),r=Po.get(n);if(r!==void 0)return r;let i=Oo(e);return Po.set(n,i),i}function Oo(e){if(e.length>=32768&&!bi(e))return e;let r=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,l;while((l=r.exec(e))!==null){let u=l.index,f=u+l[0].length,x=!1,v=!1,I=-1;while(f<e.length){let W=e[f];if(x){if(W==="'")x=!1}else if(v){if(W==='"')v=!1}else if(W==="'")x=!0;else if(W==='"')v=!0;else if(W===">"){I=f;break}f++}if(I===-1)continue;let D=e.slice(u,I+1);if(Do.test(D))continue;if(D.includes("x-cloak"))continue;if(tu(e,I+1))i+=e.slice(a,I)+" x-cloak>",a=I+1}return i+=e.slice(a),i}var nu=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,su=/<\/script>/gi,ru=/<\/style>/gi;function fl(e){let n=/<[a-z][\w-]*/gi,r="",i=0,a;while((a=n.exec(e))!==null){let l=a.index,u=a[0].slice(1).toLowerCase();if(u==="script"||u==="style"){let z=u==="script"?su:ru;z.lastIndex=l;let N=z.exec(e);if(N!==null)n.lastIndex=N.index+N[0].length;continue}let f=l+a[0].length,x=!1,v=!1,I=-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===">"){I=f;break}f++}if(I===-1)continue;let D=e.slice(l+a[0].length,I);if(Do.test(D))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(D))continue;if(!nu.test(D))continue;let W=e[I-1]==="/",L=W?I-1:I;r+=`${e.slice(i,L)} x-cloak${W?" ":""}`,i=L}return r+=e.slice(i),r}function J(e){let n=new Map;for(let r of e.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g))n.set(r[1].toLowerCase(),r[2]??r[3]??r[4]??!0);return n}function Lt(e){let n=e.get("type");return typeof n!=="string"||!n.trim()||/^(?:module|(?:text|application)\/(?:javascript|typescript|ecmascript))$/i.test(n.trim())}import ra from"path";import lr from"fs";import wn from"path";function No(e,n,r,i){let a=0;for(let l=n;l<e.length;l++)if(e[l]===r)a++;else if(e[l]===i&&!(i===">"&&e[l-1]==="=")){if(--a===0)return l}return-1}function iu(e){let n=t(e),r=0,i=0,a=[];for(let l=0;l<n.length;l++)if("([{".includes(n[l]))r++;else if(")]}".includes(n[l]))r--;else if(n[l]===","&&r===0)a.push(e.slice(i,l).trim()),i=l+1;return a.push(e.slice(i).trim()),a}function cr(e,n){let r=t(e),i=new RegExp(`\\b(?:${n.map((a)=>a.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let a of r.matchAll(i)){let l=a.index+a[0].length,u="";if(r[l]==="<"){let x=No(r,l,"<",">");if(x<0)continue;u=e.slice(l+1,x),l=x+1;while(/\s/.test(r[l]||"")&&l<r.length)l++}if(r[l]!=="(")continue;let f=No(r,l,"(",")");if(f>=0)return{type:u,args:iu(e.slice(l+1,f))}}return null}var ds=`
|
|
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>;
|
|
@@ -523,14 +523,15 @@ ${v.join(`
|
|
|
523
523
|
}`,props:I,events:D}}var Mr=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);function Dr(e){if(e.includes("-")||e==="component")return!1;if(/^[A-Z]/.test(e))return!/[a-z]/.test(e)&&[...Mr].some((n)=>n.toLowerCase()===e.toLowerCase());return Mr.has(e)||/[A-Z]/.test(e)}function*ou(e){let n=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,r;while(r=n.exec(e)){let i=n.lastIndex,a=[];while(i<e.length){while(/\s/.test(e[i]||""))i++;if(e[i]===">"||e.slice(i,i+2)==="/>"){i+=e[i]===">"?1:2;break}let l=/^[^\s=/>]+/.exec(e.slice(i))?.[0];if(!l){i++;continue}let u=i;i+=l.length;while(/\s/.test(e[i]||""))i++;if(e[i]!=="="){a.push({name:l,value:!0,offset:u,braced:!1});continue}i++;while(/\s/.test(e[i]||""))i++;let f=e[i],x=f==="{",v=f==='"'||f==="'";if(v||x)i++;let I=i;if(x){let D=t(e.slice(i)),W=1,L=0;for(;L<D.length;L++){if(D[L]==="{")W++;if(D[L]==="}"&&--W===0)break}i+=L}else if(v)while(i<e.length&&e[i]!==f)i++;else while(i<e.length&&!/[\s/>]/.test(e[i]))i++;if(a.push({name:l,value:e.slice(I,i),offset:I,braced:x}),v||x)i++}n.lastIndex=i,yield{name:r[1],offset:r.index,attributes:a}}}function Lo(e,n,r){let i=[],a=[ds,"type __StxAssignedValue<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? T extends () => infer V ? V : T : T;","type __StxProp<P, K> = K extends keyof P ? P[K] : unknown;",'type __StxStaticProp<P, K> = __StxProp<P, K> extends infer T ? boolean extends T ? T | "true" | "false" : T : never;','type __StxEvent<E, K> = K extends keyof E ? E[K] extends readonly unknown[] ? number extends E[K]["length"] ? E[K][0] : Exclude<E[K]["length"], 0 | 1> extends never ? E[K][0] : E[K] : E[K] : any;'],l=new Map,u=new Map,f=new Map,x=r.scriptCode(e,r.filePath),v=t(x);for(let z of x.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(v.slice(z.index,z.index+6)!=="import")continue;let N=z[2],H=wn.isAbsolute(N)||N.startsWith(".")?wn.resolve(wn.dirname(r.filePath),N):Ks(N,wn.dirname(r.filePath));if(!H)continue;let Z=H.endsWith(".stx")?H:lr.existsSync(`${H}.stx`)?`${H}.stx`:void 0,U=Z?null:Ar(H,!1),V=z[1].startsWith("{")?z[1].slice(1,-1).split(","):[z[1]];for(let K of V){let[ne,ae=ne]=K.trim().split(/\s+as\s+/),de=Z||U?.get(ne)||U?.get(ne.toLowerCase());if(de)f.set(ae,de),f.set(ae.toLowerCase(),de),f.set(ae.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),de)}}for(let z of n.matchAll(/@import\s*\(([^)]+)\)/g))for(let N of z[1].matchAll(/['"]([^'"]+)['"]/g)){let H=Gs(N[1],r.filePath,r).find((Z)=>lr.statSync(Z,{throwIfNoEntry:!1})?.isFile());if(H)f.set(wn.basename(N[1]).replace(/\.stx$/,""),H)}let I={__importedComponents:f},D=new Map,W=(z,N,H)=>{let Z=e.slice(0,z);return{code:N,offset:z,attribute:H,anchor:!0,kind:"directive",line:Z.split(`
|
|
524
524
|
`).length,column:z-Z.lastIndexOf(`
|
|
525
525
|
`)}},L=(z,N,H)=>i.push({expression:z,statement:{text:N+z.code+H,prefixLength:N.length}});for(let z of ou(n)){if(Dr(z.name)||z.name==="component")continue;let N=ei(z.name,r.filePath,r,I);if(!N)continue;let H=D.get(N);if(!H){let U;try{U=r.readComponent?r.readComponent(N):lr.readFileSync(N,"utf8")}catch{continue}if(U===void 0)continue;u.set(N,U),H=gs(r.scriptCode(U,N),`__StxComponent${D.size}`),D.set(N,H),a.push(H.declarations)}let Z=[];for(let U of z.attributes){let{name:V,offset:K}=U,ne=U.value===!0?"true":U.value;if(V.startsWith("@")||V.startsWith("v-on:")){if(H.events&&U.value!==!0)l.set(K,`__StxEvent<${H.events}, ${JSON.stringify(V.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let ae=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(V);if(V.startsWith("v-")&&!V.startsWith("v-bind:")&&!ae)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(V))continue;let de=(ae?ae[1]||"modelValue":V.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,($e,ye)=>ye.toUpperCase());if(Z.push(de),!H.props)continue;let pe=V.startsWith(":")||V.startsWith("v-bind:")||!!ae||U.braced,Ee=pe?ne:U.value!==!0?JSON.stringify(ne):"true",Ce=!pe&&U.value!==!0&&(ne==="true"||ne==="false");L(W(K,Ee,V),";void ((",`) satisfies ${Ce?"__StxStaticProp":"__StxProp"}<${H.props}, ${JSON.stringify(de)}>);`)}if(H.props){let U=[...new Set(Z)].map((K)=>`${JSON.stringify(K)}: undefined as any`).join(", "),V=W(z.offset,`<${z.name}>`);i.push({expression:V,statement:{text:`;void ({ ${U} } satisfies ${H.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:D.size?a.join(`
|
|
526
|
-
`):"",checks:i,events:l,dependencies:u}}import qo from"fs";import dt from"path";var mt=["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"];import{mkdir as au,readFile as cu,readdir as lu,stat as zo,writeFile as uu}from"fs/promises";import at from"path";function Ho(e){if(e==="connectedCallback")return`method "${e}" is reserved; define "onConnect" instead, which the element calls once it is connected, rendered and bound`;if(e==="disconnectedCallback")return`method "${e}" is reserved; define "onDisconnect" instead, which the element calls as it leaves the DOM, before it releases its own listeners`;return`method "${e}" is reserved`}var Ko=new Set(["constructor","connectedCallback","disconnectedCallback","attributeChangedCallback","adoptedCallback"]);function pu(e){return e.replace(/\.stx$/i,"").split(/[^a-z0-9]+/i).filter(Boolean).map((n)=>n.charAt(0).toUpperCase()+n.slice(1)).join("")}function pr(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[^a-z0-9]+/gi,"-").replace(/^-+|-+$/g,"").toLowerCase()}function fu(e){return/^[a-z][.0-9_a-z-]*-[.0-9_a-z-]*$/.test(e)&&!e.startsWith("xml")&&!/[A-Z]/.test(e)}function du(e){if(e===!0)return"open";if(e==="open"||e==="closed")return e;return!1}async function gu(e){let n=[];async function r(i){let a=await lu(i,{withFileTypes:!0});a.sort((l,u)=>l.name.localeCompare(u.name));for(let l of a){let u=at.join(i,l.name);if(l.isDirectory()){if(!l.name.startsWith(".")&&l.name!=="node_modules")await r(u)}else if(l.isFile()&&l.name.endsWith(".stx")&&!/\.(?:test|spec)\.stx$/i.test(l.name))n.push(u)}}return await r(e),n}function vn(e){return e.replace(/<!--[\s\S]*?-->|\{\{--[\s\S]*?--\}\}/g,(n)=>n.replace(/[^\n]/g," "))}function fr(e){for(let n of Ie(vn(e))){let r=J(n.attrs);if(!r.has("component")&&!r.has("stx:component"))continue;return{code:e.slice(n.bodyStart,n.bodyEnd),start:n.bodyStart,open:n.start}}}function dr(e,n){let r=fr(e);if(!r)return{};let i=r.code.trim();if(!i)return{};try{let a=JSON.parse(i);if(!a||typeof a!=="object"||Array.isArray(a))throw Error("expected a JSON object");return a}catch(a){throw Error(`${n}: <script component> must contain JSON metadata (${a.message})`)}}function ms(e,n){let r=t(e),i=new Set(Zi(e).map((x)=>x.start)),a=/(?:export\s+)?(?:async\s+)?function\s+([A-Za-z_$][\w$]*)/g,l=[],u=n?void 0:new Bun.Transpiler({loader:"ts"}),f;while(f=a.exec(r)){if(!i.has(f.index+f[0].indexOf("function")))continue;let x=a.lastIndex;while(/\s/.test(r[x]||""))x++;let v=x;if(r[x]==="<")x=Pt(r,x,"<",">");if(x<0)continue;let I=e.slice(v,x).trim();while(/\s/.test(r[x]||""))x++;if(r[x]!=="(")continue;let D=x,W=Pt(r,x,"(",")");if(W<0)continue;for(x=W;x<e.length;x++){let L=r[x];if(L!=="{"&&L!==";")continue;let z=e.slice(f.index,x).trim();if(n){if(!n(z,L,f[1]))continue}else{let H;try{H=u.transformSync(z+(L==="{"?"{}":";"))}catch{continue}if(L==="{"&&!H.includes(`function ${f[1]}(`))continue;if(L===";"&&H.trim())continue}let N=L==="{"?Pt(r,x,"{","}"):x+1;if(N<0)break;l.push({name:f[1],header:z,generic:I,parameterOffset:D+1,parameters:e.slice(D+1,W-1),returns:e.slice(W,x).trim().replace(/^:\s*/,""),async:/\basync\s+function/.test(f[0]),...L==="{"?{source:e.slice(f.index,N)}:{}}),a.lastIndex=N;break}}return l}function mu(e){let n=Sn(e.parameters,",",!0).flatMap((r,i)=>{let a=t(r),l=0,u=-1;for(let N=0;N<a.length;N++){let H=a[N];if("([{<".includes(H))l++;else if(")]}>".includes(H)&&!(H===">"&&a[N-1]==="="))l--;if(H==="="&&l===0&&a[N+1]!==">"){u=N;break}}let f=(u<0?r:r.slice(0,u)).trim(),x=Sn(f,":",!0),v=x.shift().trim();if(v==="this")return[];let I=/^[A-Za-z_$]|^\.\.\./.test(v)?v:`argument${i}`,D=u<0?"":r.slice(u+1).trim(),W=D==="true"||D==="false"?"boolean":/^-?\d+(?:\.\d+)?$/.test(D)?"number":/^['"`]/.test(D)?"string":I.startsWith("...")?"unknown[]":"unknown",L=x.join(":").trim()||W,z=u>=0&&!I.endsWith("?")&&!I.startsWith("...")?"?":"";return[`${I}${z}: ${L}`]}).join(", ");return`${e.name}${e.generic}(${n}): ${e.returns||(e.async?"Promise<unknown>":"unknown")}`}function hu(e,n){let r={},i={},a=[],l=[],u=Ie(vn(e));for(let I of u){let D=e.slice(I.bodyStart,I.bodyEnd),W=J(I.attrs);if(W.has("src")||W.has("server")||W.has("component")||W.has("stx:component")||!Lt(W))continue;try{new Bun.Transpiler({loader:"ts"}).transformSync(D)}catch(V){throw Error(`${n}: failed to transpile <script client> (${V.message})`)}let L=W.has("client")?ms(D):[],z=new Set(L.filter((V)=>!V.source).map((V)=>V.name));for(let V of L){if(Ko.has(V.name))throw Error(`${n}: client ${Ho(V.name)}`);if(V.source)r[V.name]=new Bun.Transpiler({loader:"ts"}).transformSync(V.source).trim().replace(/^(?:export\s+)?(async\s+)?function\s+/,"$1");if(!V.source||!z.has(V.name))(i[V.name]??=[]).push(mu(V))}for(let V of D.matchAll(/^\s*import\s+(?:type\s+)?([\s\S]*?)\s+from\s*(['"])([^'"]+)\2\s*;?/gm))l.push({binding:V[1].trim(),module:V[3]});let N=t(D),H=
|
|
526
|
+
`):"",checks:i,events:l,dependencies:u}}import qo from"fs";import dt from"path";var mt=["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"];import{mkdir as au,readFile as cu,readdir as lu,stat as zo,writeFile as uu}from"fs/promises";import at from"path";function Ho(e){if(e==="connectedCallback")return`method "${e}" is reserved; define "onConnect" instead, which the element calls once it is connected, rendered and bound`;if(e==="disconnectedCallback")return`method "${e}" is reserved; define "onDisconnect" instead, which the element calls as it leaves the DOM, before it releases its own listeners`;return`method "${e}" is reserved`}var Ko=new Set(["constructor","connectedCallback","disconnectedCallback","attributeChangedCallback","adoptedCallback"]);function pu(e){return e.replace(/\.stx$/i,"").split(/[^a-z0-9]+/i).filter(Boolean).map((n)=>n.charAt(0).toUpperCase()+n.slice(1)).join("")}function pr(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[^a-z0-9]+/gi,"-").replace(/^-+|-+$/g,"").toLowerCase()}function fu(e){return/^[a-z][.0-9_a-z-]*-[.0-9_a-z-]*$/.test(e)&&!e.startsWith("xml")&&!/[A-Z]/.test(e)}function du(e){if(e===!0)return"open";if(e==="open"||e==="closed")return e;return!1}async function gu(e){let n=[];async function r(i){let a=await lu(i,{withFileTypes:!0});a.sort((l,u)=>l.name.localeCompare(u.name));for(let l of a){let u=at.join(i,l.name);if(l.isDirectory()){if(!l.name.startsWith(".")&&l.name!=="node_modules")await r(u)}else if(l.isFile()&&l.name.endsWith(".stx")&&!/\.(?:test|spec)\.stx$/i.test(l.name))n.push(u)}}return await r(e),n}function vn(e){return e.replace(/<!--[\s\S]*?-->|\{\{--[\s\S]*?--\}\}/g,(n)=>n.replace(/[^\n]/g," "))}function fr(e){for(let n of Ie(vn(e))){let r=J(n.attrs);if(!r.has("component")&&!r.has("stx:component"))continue;return{code:e.slice(n.bodyStart,n.bodyEnd),start:n.bodyStart,open:n.start}}}function dr(e,n){let r=fr(e);if(!r)return{};let i=r.code.trim();if(!i)return{};try{let a=JSON.parse(i);if(!a||typeof a!=="object"||Array.isArray(a))throw Error("expected a JSON object");return a}catch(a){throw Error(`${n}: <script component> must contain JSON metadata (${a.message})`)}}function ms(e,n){let r=t(e),i=new Set(Zi(e).map((x)=>x.start)),a=/(?:export\s+)?(?:async\s+)?function\s+([A-Za-z_$][\w$]*)/g,l=[],u=n?void 0:new Bun.Transpiler({loader:"ts"}),f;while(f=a.exec(r)){if(!i.has(f.index+f[0].indexOf("function")))continue;let x=a.lastIndex;while(/\s/.test(r[x]||""))x++;let v=x;if(r[x]==="<")x=Pt(r,x,"<",">");if(x<0)continue;let I=e.slice(v,x).trim();while(/\s/.test(r[x]||""))x++;if(r[x]!=="(")continue;let D=x,W=Pt(r,x,"(",")");if(W<0)continue;for(x=W;x<e.length;x++){let L=r[x];if(L!=="{"&&L!==";")continue;let z=e.slice(f.index,x).trim();if(n){if(!n(z,L,f[1]))continue}else{let H;try{H=u.transformSync(z+(L==="{"?"{}":";"))}catch{continue}if(L==="{"&&!H.includes(`function ${f[1]}(`))continue;if(L===";"&&H.trim())continue}let N=L==="{"?Pt(r,x,"{","}"):x+1;if(N<0)break;l.push({name:f[1],header:z,generic:I,parameterOffset:D+1,parameters:e.slice(D+1,W-1),returns:e.slice(W,x).trim().replace(/^:\s*/,""),async:/\basync\s+function/.test(f[0]),...L==="{"?{source:e.slice(f.index,N)}:{}}),a.lastIndex=N;break}}return l}function mu(e){let n=Sn(e.parameters,",",!0).flatMap((r,i)=>{let a=t(r),l=0,u=-1;for(let N=0;N<a.length;N++){let H=a[N];if("([{<".includes(H))l++;else if(")]}>".includes(H)&&!(H===">"&&a[N-1]==="="))l--;if(H==="="&&l===0&&a[N+1]!==">"){u=N;break}}let f=(u<0?r:r.slice(0,u)).trim(),x=Sn(f,":",!0),v=x.shift().trim();if(v==="this")return[];let I=/^[A-Za-z_$]|^\.\.\./.test(v)?v:`argument${i}`,D=u<0?"":r.slice(u+1).trim(),W=D==="true"||D==="false"?"boolean":/^-?\d+(?:\.\d+)?$/.test(D)?"number":/^['"`]/.test(D)?"string":I.startsWith("...")?"unknown[]":"unknown",L=x.join(":").trim()||W,z=u>=0&&!I.endsWith("?")&&!I.startsWith("...")?"?":"";return[`${I}${z}: ${L}`]}).join(", ");return`${e.name}${e.generic}(${n}): ${e.returns||(e.async?"Promise<unknown>":"unknown")}`}function hu(e,n){let r={},i={},a=[],l=[],u=Ie(vn(e));for(let I of u){let D=e.slice(I.bodyStart,I.bodyEnd),W=J(I.attrs);if(W.has("src")||W.has("server")||W.has("component")||W.has("stx:component")||!Lt(W))continue;try{new Bun.Transpiler({loader:"ts"}).transformSync(D)}catch(V){throw Error(`${n}: failed to transpile <script client> (${V.message})`)}let L=W.has("client")?ms(D):[],z=new Set(L.filter((V)=>!V.source).map((V)=>V.name));for(let V of L){if(Ko.has(V.name))throw Error(`${n}: client ${Ho(V.name)}`);if(V.source)r[V.name]=new Bun.Transpiler({loader:"ts"}).transformSync(V.source).trim().replace(/^(?:export\s+)?(async\s+)?function\s+/,"$1");if(!V.source||!z.has(V.name))(i[V.name]??=[]).push(mu(V))}for(let V of D.matchAll(/^\s*import\s+(?:type\s+)?([\s\S]*?)\s+from\s*(['"])([^'"]+)\2\s*;?/gm))l.push({binding:V[1].trim(),module:V[3]});let N=t(D),H=E(N).depths,Z=/(?:export\s+)?(interface|type)\s+[A-Za-z_$][\w$]*/g,U;while(U=Z.exec(N)){if(H[U.index]!==0)continue;let V=Z.lastIndex,K=0;for(;V<N.length;V++){let ne=N[V];if(ne==="{"){let ae=Pt(N,V,"{","}");if(ae<0)break;if(V=ae-1,U[1]==="interface"&&K===0){V++;break}continue}if("([<".includes(ne))K++;else if(")]>".includes(ne)&&!(ne===">"&&N[V-1]==="="))K--;if(U[1]==="type"&&K===0&&(ne===";"||ne===`
|
|
527
527
|
`)){if(ne===`
|
|
528
528
|
`&&/^[\s]*[|&]/.test(N.slice(V+1)))continue;try{new Bun.Transpiler({loader:"ts"}).transformSync(D.slice(U.index,V));break}catch{}}}a.push(D.slice(U.index,V).replace(/^export\s+/,"").trim()),Z.lastIndex=V+1}}let f=Object.values(i).flat().join(`
|
|
529
529
|
`)+`
|
|
530
530
|
`+a.join(`
|
|
531
531
|
`),x=l.filter((I)=>(I.binding.match(/[A-Za-z_$][\w$]*/g)||[]).filter((D)=>!["type","as"].includes(D)).some((D)=>new RegExp(`\\b${D}\\b`).test(f)));for(let I of x)if(I.module.startsWith(".")||at.isAbsolute(I.module))throw Error(`${n}: public method types import ${JSON.stringify(I.module)} outside the generated package; declare these types in the component or import them from a published dependency`);let v=[...new Set(x.map((I)=>`import type ${I.binding.replace(/\btype\s+/g,"")} from ${JSON.stringify(I.module)}`))];return{methods:r,declarations:i,types:[...v,...a].join(`
|
|
532
532
|
|
|
533
|
-
`)}}function xu(e){let n=e.match(/<template\b(?![^>]*\bshadowrootmode\b)[^>]*>([\s\S]*?)<\/template>/i);return(n?n[1]:e).replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"").trim()}function Bo(e){return[...e.matchAll(/<style\b[^>]*>([\s\S]*?)<\/style>/gi)].map((n)=>n[1].
|
|
533
|
+
`)}}function xu(e){let n=e.match(/<template\b(?![^>]*\bshadowrootmode\b)[^>]*>([\s\S]*?)<\/template>/i);return(n?n[1]:e).replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"").trim()}function Bo(e){return[...e.matchAll(/<style\b[^>]*>([\s\S]*?)<\/style>/gi)].map((n)=>n[1].replace(/\r\n?/g,`
|
|
534
|
+
`).replaceAll("\x00","\uFFFD").trim()).filter(Boolean).join(`
|
|
534
535
|
|
|
535
536
|
`)}function bu(e){if(!e)return null;let n=e.replace(/\s*\|\s*(?:undefined|null)\b/g,"").trim();if(/^string$/.test(n))return"string";if(/^number$/.test(n))return"number";if(/^boolean$/.test(n))return"boolean";if(/^(?:'[^']*'|"[^"]*")(?:\s*\|\s*(?:'[^']*'|"[^"]*"))*$/.test(n))return"string";return"object"}function yu(e){if(e===void 0)return"object";if(e==="true"||e==="false")return"boolean";if(/^-?\d+(?:\.\d+)?$/.test(e))return"number";if(/^['"`]/.test(e))return"string";return"object"}function _u(e){if(e==="true")return!0;if(e==="false")return!1;if(/^-?\d+(?:\.\d+)?$/.test(e))return Number(e);if(/^['"`]/.test(e))return e.slice(1,-1);try{return JSON.parse(e)}catch{return}}function kn(e,n){if(e[n]!=="(")return null;let r=0,i="";for(let a=n;a<e.length;a++){let l=e[a];if(i!==""){if(l==="\\")a++;else if(l===i)i="";continue}if(l==="'"||l==='"'||l==="`"){i=l;continue}if(l==="(")r++;else if(l===")"){if(r--,r===0)return{expression:e.slice(n+1,a),end:a+1}}}return null}function gr(e){let n=/^([\s\S]+?)\s+as\s+(?:([A-Za-z_$][\w$]*)\s*=>\s*)?([A-Za-z_$][\w$]*)$/.exec(e.trim());return n?{iterable:n[1],key:n[2],value:n[3]}:void 0}function wu(e){let n=[],r=0,i=e.replace(/\{\{--[\s\S]*?--\}\}/g,""),a=/@(if|elseif|else|endif|foreach|endforeach)\s*/g,l,u=(f)=>{if(f==="")return;let x=0,v=/\{!!\s*([\s\S]*?)\s*!!\}|\{\{\s*([\s\S]*?)\s*\}\}/g,I;while(I=v.exec(f)){if(I.index>x)n.push(`out += ${JSON.stringify(f.slice(x,I.index))};`);n.push(I[1]!==void 0?`out += __raw(${I[1]});`:`out += __escape(${I[2]});`),x=I.index+I[0].length}if(x<f.length)n.push(`out += ${JSON.stringify(f.slice(x))};`)};while(l=a.exec(i)){u(i.slice(r,l.index)),r=l.index+l[0].length;let x=l[1]==="if"||l[1]==="elseif"||l[1]==="foreach"?kn(i,r):null;if(x)r=x.end,a.lastIndex=x.end;let v=x?.expression;switch(l[1]){case"if":n.push(`if (${v}) {`);break;case"elseif":n.push(`} else if (${v}) {`);break;case"else":n.push("} else {");break;case"endif":case"endforeach":n.push("}");break;case"foreach":{let I=gr(v||"");if(!I){n.push(`out += ${JSON.stringify(l[0]+(x?`(${v})`:""))};`);break}let{iterable:D,key:W,value:L}=I;n.push(W?`for (const [${W}, ${L}] of __entries(${D})) {`:`for (const ${L} of __values(${D})) {`);break}}}return u(i.slice(r)),n.join(`
|
|
536
537
|
`)}function Pt(e,n,r,i){if(e[n]!==r)return-1;let a=0,l=null;for(let u=n;u<e.length;u++){let f=e[u];if(l){if(f==="\\"){u++;continue}if(f===l)l=null;continue}if(f==="'"||f==='"'||f==="`"){l=f;continue}if(f===r)a++;else if(f===i){if(i===">"&&e[u-1]==="=")continue;if(a--,a===0)return u+1}}return-1}function Sn(e,n,r){let i=r?"([{<":"([{",a=r?")]}>":")]}",l=[],u=0,f=null,x="";for(let v=0;v<e.length;v++){let I=e[v];if(f){if(x+=I,I==="\\"){x+=e[++v]??"";continue}if(I===f)f=null;continue}if(I==="'"||I==='"'||I==="`"){f=I,x+=I;continue}if(i.includes(I))u++;else if(a.includes(I)&&!(r&&I===">"&&e[v-1]==="="))u--;if(u===0&&n.includes(I)){l.push(x),x="";continue}x+=I}return l.push(x),l.map((v)=>v.trim()).filter(Boolean)}function Su(e){let n=0,r=null;for(let i=0;i<e.length;i++){let a=e[i];if(r){if(a==="\\"){i++;continue}if(a===r)r=null;continue}if(a==="'"||a==='"'||a==="`"){r=a;continue}if("([{".includes(a))n++;else if(")]}".includes(a))n--;if(n!==0||a!=="=")continue;let l=e[i-1];if(e[i+1]==="="||l==="="||l==="!"||l==="<"||l===">")continue;return i}return-1}function Wo(e){switch(e.trim()){case"String":return"string";case"Number":return"number";case"Boolean":return"boolean";case"Array":return"unknown[]";case"Object":return"Record<string, unknown>";default:return}}function vu(e){let n=/\bdefineProps\b/.exec(e);if(!n)return null;let r=/(?:^|[\s;{}()])(const|let|var)\s+/g,i=-1;for(let U=r.exec(e);U&&U.index<n.index;U=r.exec(e))i=U.index+U[0].indexOf(U[1]);if(i===-1)return null;let a={},l={},u=[],f={},x=i+(/^(?:const|let|var)\s+/.exec(e.slice(i))?.[0].length??0),v=()=>{while(x<e.length&&/\s/.test(e[x]))x++},I;if(e[x]==="{"){let U=Pt(e,x,"{","}");if(U===-1)return null;I=e.slice(x,U),x=U}else{let U=/^[A-Za-z_$][\w$]*/.exec(e.slice(x));if(!U)return null;I=U[0],x+=U[0].length}if(v(),e[x]!=="=")return null;x++,v();let D=/^withDefaults\s*\(\s*/.exec(e.slice(x)),W=Boolean(D);if(D)x+=D[0].length;let L=/^defineProps\b/.exec(e.slice(x));if(!L)return null;x+=L[0].length;let z="";if(v(),e[x]==="<"){let U=Pt(e,x,"<",">");if(U===-1)return null;z=e.slice(x+1,U-1).trim(),x=U}if(v(),e[x]!=="(")return null;let N=Pt(e,x,"(",")");if(N===-1)return null;let H=e.slice(x+1,N-1).trim();if(x=N,W){if(v(),e[x]===",")x++,v();if(e[x]==="{"){let U=Pt(e,x,"{","}");if(U===-1)return null;for(let[V,K]of ur(e.slice(x,U)))l[V]=K;x=U}if(v(),e[x]===",")x++,v();if(e[x]===")")x++}if(e[x]===";")x++;let Z=/^[A-Za-z_$][\w$]*$/.test(z)?z:void 0;if(z.startsWith("{"))for(let U of Sn(z.replace(/^\{/,"").replace(/\}$/,""),",;",!0)){let V=/^(?:readonly\s+)?([A-Za-z_$][\w$]*)\s*\??\s*:\s*([\s\S]+)$/.exec(U);if(V)a[V[1]]=V[2].trim()}if(H.startsWith("{"))for(let[U,V]of ur(H)){if(u.push(U),!V.startsWith("{")){let K=Wo(V);if(K)a[U]=K;continue}for(let[K,ne]of ur(V))if(K==="default")l[U]=ne;else if(K==="type"){let ae=Wo(ne);if(ae)a[U]=ae}}else if(H.startsWith("["))for(let U of Sn(H.slice(1,-1),",",!1))u.push(U.replace(/^['"`]/,"").replace(/['"`]$/,""));if(I.startsWith("{")){u.length=0;for(let U of Sn(I.replace(/^\{/,"").replace(/\}$/,""),",",!1)){let V=Su(U),K=V===-1?U:U.slice(0,V),ne=K.split(":")[0].trim().replace(/^\.\.\./,"");if(!ne)continue;if(u.push(ne),f[ne]=K.trim(),V!==-1)l[ne]=U.slice(V+1).trim()}}else if(u.length===0)u.push(...Object.keys(a));return{text:e.slice(i,x),propNames:u,propBindings:f,defaults:l,declared:a,typeName:Z}}function ur(e){let n=e.trim().replace(/^\{/,"").replace(/\}$/,""),r=[],i=0;while(i<n.length){let a=/\s*([A-Za-z_$][\w$]*)\s*:/y;a.lastIndex=i;let l=a.exec(n);if(!l)break;i=a.lastIndex;let u=0,f="",x=i;while(i<n.length){let I=n[i];if(f){if(I==="\\")i++;else if(I===f)f=""}else if(I==="'"||I==='"'||I==="`")f=I;else if(I==="{"||I==="["||I==="(")u++;else if(I==="}"||I==="]"||I===")")u--;else if(I===","&&u===0)break;i++}let v=n.slice(x,i).trim();if(v)r.push([l[1],v]);i++}return r}function $u(e,n,r){let a=Ie(vn(e)).find((L)=>{let z=J(L.attrs);return Lt(z)&&!["component","stx:component","client","src"].some((N)=>z.has(N))});if(!a)return{imports:[],body:"",propNames:[],propBindings:{},defaults:{},declared:{}};let l=e.slice(a.bodyStart,a.bodyEnd),u=[],f=[],x={},v={},I={};l=l.replace(/^\s*import\s+[\s\S]*?from\s*['"][^'"]+['"];?\s*$/gm,(L)=>{if(/from\s*['"]stx['"]/.test(L))return"";return u.push(L.trim().replace(/(from\s*['"])(\.[^'"]*)(['"])/,(z,N,H,Z)=>{let U=at.resolve(at.dirname(n),H),V=at.relative(r,U);return`${N}${V.startsWith(".")?V:`./${V}`}${Z}`})),""});let D=vu(l);if(D)f.push(...D.propNames),Object.assign(x,D.propBindings),Object.assign(v,D.defaults),Object.assign(I,D.declared),l=l.replace(D.text,"");let W={};for(let L of l.matchAll(/(?:export\s+)?interface\s+([A-Za-z_$][\w$]*)\s*\{([\s\S]*?)\n\}/g)){let z=[];for(let N of L[2].matchAll(/^\s*(?:\/\*\*[\s\S]*?\*\/\s*)?([A-Za-z_$][\w$]*)\??\s*:\s*([^\n;]+)/gm))I[N[1]]=N[2].trim(),z.push(N[1]);W[L[1]]=z}if(D&&D.propNames.length===0&&D.typeName){for(let L of W[D.typeName]??[])if(!f.includes(L))f.push(L)}return l=l.replace(/(?:export\s+)?interface\s+[A-Za-z_$][\w$]*\s*\{[\s\S]*?\n\}/g,""),{imports:u,body:l.trim(),propNames:f,propBindings:x,defaults:v,declared:I}}function Eu(e){let n=new Set;return{template:e.replace(/\s@([a-z][\w:-]*)(\.[\w.-]+)?\s*=\s*(["'])([A-Za-z_$][\w$]*)\3/gi,(i,a,l,u,f)=>{let x=a.toLowerCase();n.add(x);let v=(l||"").split(".").filter(Boolean).join(" ");return` data-stx-on-${x}="${f}"${v?` data-stx-mod-${x}="${v}"`:""}`}),eventTypes:[...n].sort()}}function ku(e){let n=[];return{template:e.replace(/\s:([a-z][\w:-]*)\s*=\s*(["'])([\w$.]+)\2/gi,(i,a,l,u)=>{let f=n.length;return n.push({id:f,name:a,expression:u}),` data-stx-bind-${f}=""`}),bindings:n}}function Cu(e){let n=new Set;for(let r of e.matchAll(/<slot\b([^>]*)>/gi))n.add(r[1].match(/\bname\s*=\s*["']([^"']+)["']/i)?.[1]||"");return[...n].map((r)=>({name:r}))}function Ru(e){return[...new Set([...e.matchAll(/(--[a-z0-9_-]+)\s*:/gi)].map((n)=>n[1]))].sort().map((n)=>({name:n}))}function Fo(e,n){if(!n||!new Set(["string","number","boolean","object","array"]).has(n.type))throw Error(`Property "${e}" must declare one of: string, number, boolean, object, array`);return{...n,reflect:n.reflect??n.attribute!==!1}}async function Au(e,n,r){let i=at.isAbsolute(n.file)?n.file:at.resolve(e,n.file),a=await cu(i,"utf8"),l=dr(a,i),u=at.basename(i,".stx"),f=n.name||l.name||pu(u),x=`${pr(r.prefix||"stx")}-${pr(u)}`,v=n.tag||l.tag||x;if(!f||!/^[A-Za-z_$][\w$]*$/.test(f))throw Error(`${i}: invalid component class name "${f}"`);if(!fu(v))throw Error(`${i}: invalid custom-element tag "${v}"; tags must be lowercase and contain a hyphen`);let I=n.properties||l.properties||l.props||{},D=Object.fromEntries(Object.entries(I).map(([V,K])=>[V,Fo(V,K)])),W=Eu(xu(a)),L=ku(W.template),z=$u(a,i,at.resolve(r.outputDir)),N=wu(L.template);for(let V of z.propNames){if(D[V])continue;let K=z.defaults[V];D[V]=Fo(V,{type:bu(z.declared[V])??yu(K),...K===void 0?{}:{default:_u(K)}})}let H=l.methods||{},Z=n.methods||{},U=hu(a,i);return{file:at.relative(e,i),sourcePath:i,name:f,tag:v,description:n.description||l.description||"",template:L.template,styles:Bo(a),shadowMode:du(n.shadowDOM??l.shadowDOM??r.shadowDOM),progressive:n.progressive??l.progressive??r.progressive??!0,properties:D,events:n.events||l.events||{},methods:{...H,...Z,...U.methods},methodDeclarations:U.declarations,declarationTypes:U.types,eventTypes:W.eventTypes,bindings:L.bindings,slots:Cu(L.template),cssProperties:Ru(Bo(a)),scope:z,render:N}}function Tu(){let e=JSON.stringify("\\{!!\\s*([\\w$.]+)\\s*!!\\}"),n=JSON.stringify("\\{\\{\\s*([\\w$.]+)\\s*\\}\\}");return`const HTMLElementBase = globalThis.HTMLElement || class {};
|
|
@@ -977,7 +978,7 @@ ${l.map((N)=>`import type { ${N.name}Props } from './${N.tag}.js'`).join(`
|
|
|
977
978
|
`);throw AggregateError(Z,`Failed to bundle component library${U?`
|
|
978
979
|
${U}`:""}`)}if(!N.success){let H=N.logs.map((Z)=>String(Z).trim()).filter(Boolean).join(`
|
|
979
980
|
`);throw AggregateError(N.logs,`Failed to bundle component library${H?`
|
|
980
|
-
${H}`:""}`)}if(x.push(L),e.sourcemap==="external")x.push(`${L}.map`)}let z=await Promise.all(x.map(async(N)=>(await zo(N)).size));return{components:l.map((N)=>({name:N.name,tag:N.tag,source:N.sourcePath,module:at.join(r,`${N.tag}.js`)})),files:x,manifest:D,bundle:L,cssBundle:W,totalBytes:z.reduce((N,H)=>N+H,0)}}var Du=new Set(mt);function Ut(e){let n=Bt(e),r=n.find((D)=>D.name==="InheritedContext");if(!r)return;let i=/^(?:interface\s+InheritedContext|type\s+InheritedContext\s*=)\s*\{/.test(t(r.text).trim()),a=t(e),l=
|
|
981
|
+
${H}`:""}`)}if(x.push(L),e.sourcemap==="external")x.push(`${L}.map`)}let z=await Promise.all(x.map(async(N)=>(await zo(N)).size));return{components:l.map((N)=>({name:N.name,tag:N.tag,source:N.sourcePath,module:at.join(r,`${N.tag}.js`),styles:N.styles,shadowMode:N.shadowMode})),files:x,manifest:D,bundle:L,cssBundle:W,totalBytes:z.reduce((N,H)=>N+H,0)}}var Du=new Set(mt);function Ut(e){let n=Bt(e),r=n.find((D)=>D.name==="InheritedContext");if(!r)return;let i=/^(?:interface\s+InheritedContext|type\s+InheritedContext\s*=)\s*\{/.test(t(r.text).trim()),a=t(e),l=E(a).depths,u=[...a.matchAll(/\b(?:interface|type)\s+InheritedContext\b/g)].find((D)=>l[D.index]===0)?.index??0,f=r.text.slice(r.text.indexOf("{")+1,r.text.lastIndexOf("}")),x=t(f),v=E(x).depths,I=[...x.matchAll(/(?:^|[;,\n])\s*(?:readonly\s+)?([A-Za-z_$][\w$]*)\??\s*:/g)].filter((D)=>v[D.index]===0).map((D)=>D[1]);return{keys:i?I:[],types:n.map((D)=>D.text).join(`
|
|
981
982
|
`),offset:Math.max(0,u),...!i?{unsupported:"InheritedContext requires a local non-generic object interface or object type alias with named properties"}:{}}}function Nu(e){let n=[],r=t(e);for(let i of e.matchAll(/\bimport\s+(type\s+)?([\w$*{}\s,]+?)\s+from\s*(['"])([^'"]+)\3/g)){if(i[1]||r.slice(i.index,i.index+6)!=="import")continue;let a=i[2].trim(),l=["stx","@stacksjs/stx"].includes(i[4]);if(/^[A-Za-z_$][\w$]*$/.test(a)){n.push(a);continue}if(!a.startsWith("{")||!a.endsWith("}"))continue;for(let u of a.slice(1,-1).split(",")){if(/^\s*type\s+/.test(u))continue;let[f,x=f]=u.trim().split(/\s+as\s+/);if(x&&!(l&&Du.has(f)))n.push(x)}}return n}function Ys(e){let n=Ut(e);if(!n||n.unsupported)return"";let r=new Set(he(e));return n.keys.filter((i)=>!r.has(i)).map((i)=>`declare const ${i}: InheritedContext[${JSON.stringify(i)}];`).join(`
|
|
982
983
|
`)}function Zo(e,n){let r=[ds],i=[],a=new Map,l=dt.resolve(n.filePath),u=l.split(dt.sep).lastIndexOf("views"),f=u>=0?l.split(dt.sep).slice(0,u).join(dt.sep):dt.dirname(l),x=dt.resolve(n.partialsDir||dt.join(f,"partials")),v=dt.resolve(n.layoutsDir||dt.join(f,"views/layouts"));if([x,v].some((H)=>l===H||l.startsWith(H+dt.sep)))return{declarations:"",checks:i,dependencies:a};let I=(H)=>n.readTemplate?.(H)??(qo.existsSync(H)?qo.readFileSync(H,"utf8"):void 0),D=0,W=!1,L=[];function z(H,Z){let U=e.slice(0,H).split(`
|
|
983
984
|
`).length,V=H-e.lastIndexOf(`
|
|
@@ -1000,9 +1001,9 @@ return { context: ${Ot}${nt.map((je)=>`, ${je.name}: { ...${Ot}, ...(${je.args})
|
|
|
1000
1001
|
`).length,column:ne-e.lastIndexOf(`
|
|
1001
1002
|
`,ne-1),origin:"component"}],project:(de)=>({code:de,columns:new Map})}}let l=Ie(r).filter((K)=>{let ne=J(K.attrs);return Lt(ne)&&ne.has("client")&&!ne.has("server")&&!ne.has("component")&&!ne.has("stx:component")&&!ne.has("src")}),u=l.map((K)=>e.slice(K.bodyStart,K.bodyEnd)).join(`
|
|
1002
1003
|
`),f=ms(u,n),x=Bt(u).some((K)=>K.name==="ComponentState")||xs(u).includes("ComponentState"),v=Object.entries(a.properties||a.props||{}).map(([K,ne])=>`${JSON.stringify(K)}: ${sn(ne)}`).join("; "),I=[...new Set(f.map((K)=>K.name))],D=[`interface __StxMetadataProperties { ${v} }`,"type __StxNativeProperties = Omit<__StxMetadataProperties, keyof HTMLElement> & Pick<HTMLElement, Extract<keyof __StxMetadataProperties, keyof HTMLElement>>;","type __StxAny<T> = 0 extends (1 & T) ? true : false;","type __StxAnyFields<T> = { [K in keyof T]-?: __StxAny<T[K]> extends true ? K : never }[keyof T];","type __StxSpecific<T> = __StxAny<T> extends true ? false : T extends object ? string extends keyof T ? false : number extends keyof T ? false : symbol extends keyof T ? false : __StxAnyFields<T> extends never ? true : false : false;",x?"type __StxState = __StxSpecific<ComponentState> extends true ? ComponentState : {};":"type __StxState = {};",x?'declare function __stxSpecificState(value: __StxSpecific<ComponentState> extends true ? true : "ComponentState requires named explicit fields without any or index signatures"): void;':"",x?"declare const __stxStateProperties: Pick<ComponentState, Extract<keyof ComponentState, keyof __StxInstanceProperties>>;":"",x?'declare function __stxStateMethods(value: Extract<keyof ComponentState, __StxMethodNames | "emit" | "requestUpdate" | "updateComplete" | "renderRoot"> extends never ? true : "ComponentState cannot redeclare component methods"): void;':"",`type __StxMethodNames = ${I.map((K)=>JSON.stringify(K)).join(" | ")||"never"};`,"type __StxInstanceProperties = Omit<HTMLElement, __StxMethodNames | keyof __StxNativeProperties> & __StxNativeProperties;",'type __StxPrivateKeys<T> = Exclude<keyof T, keyof HTMLElement | keyof __StxNativeProperties | __StxMethodNames | "emit" | "updateComplete" | "requestUpdate" | "renderRoot">;',x?'declare function __stxOptionalPrivate(value: { [K in __StxPrivateKeys<ComponentState>]-?: {} extends Pick<ComponentState, K> ? never : K }[__StxPrivateKeys<ComponentState>] extends never ? true : "Private ComponentState fields must be optional until initialized"): void;':"","type __StxRefinedProperties = { [K in keyof __StxNativeProperties]: K extends keyof __StxState ? __StxAny<__StxState[K]> extends true ? __StxNativeProperties[K] : __StxState[K] extends __StxNativeProperties[K] ? __StxState[K] : __StxNativeProperties[K] : __StxNativeProperties[K] };","type __StxNativeComponent = Omit<HTMLElement, keyof __StxNativeProperties | __StxMethodNames> & __StxRefinedProperties & Partial<Pick<__StxState, __StxPrivateKeys<__StxState>>> & {","readonly updateComplete: Promise<void>; requestUpdate(): Promise<void>; readonly renderRoot: HTMLElement | ShadowRoot;","emit<T = unknown>(name: string, detail?: T, options?: CustomEventInit<T>): boolean;",...I.map((K)=>`${JSON.stringify(K)}: typeof ${K};`),"}"].filter(Boolean).join(`
|
|
1003
|
-
`),W=-1;for(let K of l){let ne=K.bodyStart,ae=e.slice(ne,K.bodyEnd),de=t(ae),pe=
|
|
1004
|
+
`),W=-1;for(let K of l){let ne=K.bodyStart,ae=e.slice(ne,K.bodyEnd),de=t(ae),pe=E(de).depths,Ee=[...de.matchAll(/\b(?:interface|type)\s+ComponentState\b/g)].find((Ce)=>pe[Ce.index]===0)??(xs(ae).includes("ComponentState")?/\bComponentState\b/.exec(de):void 0);if(Ee){W=ne+Ee.index;break}}let L=x&&W>=0?[{origin:"client",text:"__stxSpecificState(true); __stxStateMethods(true); __stxOptionalPrivate(true); __stxStateProperties satisfies Pick<__StxInstanceProperties, Extract<keyof ComponentState, keyof __StxInstanceProperties>>;",line:e.slice(0,W).split(`
|
|
1004
1005
|
`).length,column:W-e.lastIndexOf(`
|
|
1005
|
-
`,W-1)}]:[],{start:z,code:N}=i,H=t(N),Z=
|
|
1006
|
+
`,W-1)}]:[],{start:z,code:N}=i,H=t(N),Z=E(H).depths,U=new Map,V=!1;for(let K of N.matchAll(/"(?:\\.|[^"\\])*"\s*:/g)){let ne=JSON.parse(K[0].slice(0,K[0].lastIndexOf(":")).trim());if(Z[K.index]===1&&["properties","props"].includes(ne)){V=!0;continue}if(V&&Z[K.index]===1)V=!1;if(V&&Z[K.index]===2&&!U.has(ne))U.set(ne,z+K.index)}for(let[K,ne]of Object.entries(a.properties||a.props||{})){let ae=U.get(K)??z,de=e.slice(0,ae).split(`
|
|
1006
1007
|
`).length,pe=ae-e.lastIndexOf(`
|
|
1007
1008
|
`,ae-1);if(!ne||typeof ne!=="object"||!["string","number","boolean","object","array"].includes(ne.type))L.push({text:`({})[${JSON.stringify(`Property ${K} must declare string, number, boolean, object or array`)}];`,line:de,column:pe,origin:"component"});if(ne&&ne.default!==void 0)L.push({text:`const __stxDefault${L.length}: ${sn(ne)} = ${JSON.stringify(ne.default)};`,line:de,column:pe,origin:"component"})}return{declarations:D,checks:L,project(K){let ne=new Map,ae=[],de=0;for(let pe of ms(K,n)){if(/^\s*this\s*:/.test(pe.parameters))continue;let Ee=pe.parameterOffset,Ce=`this: __StxNativeComponent${pe.parameters.trim()?", ":""}`;ae.push(K.slice(de,Ee),Ce);let $e=K.slice(0,Ee).split(`
|
|
1008
1009
|
`).length,ye=Ee-K.lastIndexOf(`
|
|
@@ -1030,7 +1031,7 @@ return {`});for(let[N,H]of u.entries())l.push({text:`value${N}: (`}),l.push({tex
|
|
|
1030
1031
|
`):"";let{imports:l,body:u}=la(e),f=u.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),x=["",`// ${ea}`];if(l)x.push(l);return x.push(...a),x.push(`async function ${ta}() {`,f,` return { ${r.join(", ")} }`,"}",`type ${na} = Awaited<ReturnType<typeof ${ta}>>`,...r.map((v)=>`declare var ${v}: ${na}[${JSON.stringify(v)}]`)),x.join(`
|
|
1031
1032
|
`)}function Ai(e){let n=t(e),r=n.split(""),i=[],a=0,l=0;for(let f=0;f<r.length;f++){let x=r[f];if(x===`
|
|
1032
1033
|
`)l=f+1;if(x==="{"||x==="("||x==="["){if(a===0&&x!=="("&&Ju.test(n.slice(l,f))){let v=pa(n,f);if(v!==-1)i.push(...fa(n.slice(f,v+1)))}a++;continue}if(x==="}"||x===")"||x==="]"){a=Math.max(0,a-1);continue}if(a>0&&x!==`
|
|
1033
|
-
`)r[f]=" "}let u=he(r.join(""));return i.length===0?u:[...new Set([...u,...i])].sort()}var Ju=/^\s*(?:export\s+)?(?:const|let|var)\s*$/;function pa(e,n){let r=0;for(let i=n;i<e.length;i++){let a=e[i];if(a==="{"||a==="("||a==="[")r++;else if(a==="}"||a===")"||a==="]")r--;if(r===0)return i}return-1}function Xu(e){let n=[],r=0,i=0;for(let a=0;a<e.length;a++){let l=e[a];if(l==="{"||l==="("||l==="[")r++;else if(l==="}"||l===")"||l==="]")r--;else if(l===","&&r===0)n.push(e.slice(i,a)),i=a+1}return n.push(e.slice(i)),n}function Qo(e){let n=0;for(let r=0;r<e.length;r++){let i=e[r];if(i==="{"||i==="("||i==="[")n++;else if(i==="}"||i===")"||i==="]")n--;else if(n===0&&(i===":"||i==="="))return{index:r,char:i}}return null}function fa(e){let n=[],r=(a)=>{let l=a.trim().replace(/^\.\.\./,"").trim();if(l.startsWith("{")||l.startsWith("[")){let f=pa(l,0);if(f!==-1)n.push(...fa(l.slice(0,f+1)));return}let u=Qo(l);if(u)l=l.slice(0,u.index).trim();if(/^[A-Z_$][\w$]*$/i.test(l))n.push(l)},i=e.slice(1,-1);for(let a of Xu(i)){if(!a.trim())continue;if(e[0]==="["){r(a);continue}let l=Qo(a);r(l?.char===":"?a.slice(l.index+1):a)}return n}function il(e,n){if(ca(e)!==null)return[];let r=Ai(e),i=De(n,new Set(r)),a=new Set(
|
|
1034
|
+
`)r[f]=" "}let u=he(r.join(""));return i.length===0?u:[...new Set([...u,...i])].sort()}var Ju=/^\s*(?:export\s+)?(?:const|let|var)\s*$/;function pa(e,n){let r=0;for(let i=n;i<e.length;i++){let a=e[i];if(a==="{"||a==="("||a==="[")r++;else if(a==="}"||a===")"||a==="]")r--;if(r===0)return i}return-1}function Xu(e){let n=[],r=0,i=0;for(let a=0;a<e.length;a++){let l=e[a];if(l==="{"||l==="("||l==="[")r++;else if(l==="}"||l===")"||l==="]")r--;else if(l===","&&r===0)n.push(e.slice(i,a)),i=a+1}return n.push(e.slice(i)),n}function Qo(e){let n=0;for(let r=0;r<e.length;r++){let i=e[r];if(i==="{"||i==="("||i==="[")n++;else if(i==="}"||i===")"||i==="]")n--;else if(n===0&&(i===":"||i==="="))return{index:r,char:i}}return null}function fa(e){let n=[],r=(a)=>{let l=a.trim().replace(/^\.\.\./,"").trim();if(l.startsWith("{")||l.startsWith("[")){let f=pa(l,0);if(f!==-1)n.push(...fa(l.slice(0,f+1)));return}let u=Qo(l);if(u)l=l.slice(0,u.index).trim();if(/^[A-Z_$][\w$]*$/i.test(l))n.push(l)},i=e.slice(1,-1);for(let a of Xu(i)){if(!a.trim())continue;if(e[0]==="["){r(a);continue}let l=Qo(a);r(l?.char===":"?a.slice(l.index+1):a)}return n}function il(e,n){if(ca(e)!==null)return[];let r=Ai(e),i=De(n,new Set(r)),a=new Set(_);return r.filter((l)=>{if(a.has(l))return!1;if(zt(n,l))return!1;return i.has(l)})}var ea="stx: types for the declared client payload (#1868)",Gu="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",ta="__stxServerScope",na="__StxClientPayload";var sa=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","$native","props","slot"];var Yu=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function Qu(e){let n=new Map,r=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let i of e){let a=t(i),{depths:l,balanced:u}=E(a);if(!u)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(l[v+x[1].length]!==0)continue;let I=x[2],D=v+x[0].length-x[3].length,W=i.slice(D,v+x[0].length).trim().replace(/;$/,"").trim(),L=x[3],z=r.test(L)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(L)&&!/[,+\-*/%&|?:=]$/.test(W)&&E(L).balanced;n.set(I,n.has(I)||!z?null:W)}}return new Map([...n].filter((i)=>i[1]!==null))}function da(e,n,r=0,i=new Set){if(n.size===0||r>=5)return e;let a=t(e),l="",u=0;for(let f of a.matchAll(/[A-Za-z_$][\w$]*/g)){let x=f.index??0,v=f[0],I=n.get(v);if(!I||i.has(v))continue;let D=a.slice(0,x).trimEnd(),W=a.slice(x+v.length).trimStart();if(D.endsWith(".")||/^:(?!:)/.test(W)&&/[{,]$/.test(D))continue;if(x>0&&/[\w$]/.test(a[x-1]))continue;l+=`${e.slice(u,x)}(${da(I,n,r+1,new Set([...i,v]))})`,u=x+v.length}return l+e.slice(u)}function ep(e,n){let r=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,i=[],a;while((a=r.exec(e))!==null){if(a.index>n)break;let l=a[1];if(a.index===n){if(l==="elseif"){let f=i[i.length-1];if(f?.current)f.seen.push(f.current);if(f)f.current=null}break}if(l==="endif"||l==="endunless"){i.pop();continue}let u="";if(a[2]==="("){let f=0,x=a.index+a[0].length-1,v=x+1;for(;x<e.length;x++){let I=e[x];if(I==="(")f++;else if(I===")"){if(f--,f===0)break}}u=e.slice(v,x).trim(),r.lastIndex=x+1}if(l==="if")i.push({seen:[],current:u});else if(l==="unless")i.push({seen:[],current:`!(${u})`});else if(l==="elseif"||l==="else"){let f=i[i.length-1];if(!f)continue;if(f.current)f.seen.push(f.current);f.current=l==="elseif"?u:null}}return i.flatMap((l)=>[...l.seen.map((u)=>`!(${u})`),...l.current?[l.current]:[]]).filter(Boolean)}function tp(e){let n=e.code.trim();if(!n)return null;if(e.attribute?.startsWith("@")){if(Yu.test(n))return null;let i=";(($event: any): void => { ";return{text:`${i}${n} });`,prefixLength:i.length}}let r=";void ((";return{text:`${r}${n}));`,prefixLength:r.length}}var np=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function hs(e,n){return eo(e,n).code}function eo(e,n){let r=new Map;if(!n)return{code:e,columns:r};let i=ga(e),a=[],l=0;for(let u of e.matchAll(np)){let f=u.index,[x,v,I,D]=u,W=ra.resolve(n,D).replace(/\\/g,"/"),L=`${v}${I}${W}${I}`;if(a.push(e.slice(l,f),L),l=f+x.length,x.includes(`
|
|
1034
1035
|
`))continue;let z=yr(i,f),N=r.get(z.line)??[],H=N.at(-1),Z=z.column+(H?H.generatedEnd-H.sourceEnd:0);N.push({sourceStart:z.column,sourceEnd:z.column+x.length,generatedStart:Z,generatedEnd:Z+L.length}),r.set(z.line,N)}return a.push(e.slice(l)),{code:a.join(""),columns:r}}function sp(e,n,r){let i=hr(e.importColumns?.get(n)??[],r);return hr(e.scriptColumns?.get(n)??[],hr(e.componentColumns?.get(n)??[],i))}function Pi(e){return" ".repeat(Math.max(0,(e.startColumn??1)-1))}function xs(e){let n=new Set,r=t(e);for(let i of r.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let a=i[1],l=/\{([^}]*)\}/.exec(a);for(let v of l?.[1].split(",")??[]){let I=v.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(I&&/^[A-Z_$][\w$]*$/i.test(I))n.add(I)}let u=a.replace(/\{[^}]*\}/,""),f=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(u);if(f)n.add(f[1]);let x=/^\s*([A-Z_$][\w$]*)/i.exec(u);if(x&&x[1]!=="type")n.add(x[1])}return[...n].sort()}function Ii(e,n={}){let r=Se(e),i=n.scriptKinds?r.filter((K)=>n.scriptKinds.includes(K.kind)):r,a=Zs(e,n.componentMethodValidator),l=n.filePath&&n.templateExpressions!==!1?Zo(e,{filePath:n.filePath,partialsDir:n.partialsDir,layoutsDir:n.layoutsDir,contractsKnown:n.inheritedContractsKnown,readTemplate:n.readComponent}):void 0,u=new Map,f=e.split(`
|
|
1035
1036
|
`),x=Array.from({length:f.length},()=>""),v=new Map,I=new Map,D=new Map,W=[],L=Ri(r),z=n.filePath&&n.templateExpressions!==!1?Lo(e,rn(e),{filePath:n.filePath,componentsDir:n.componentsDir,projectRoot:n.projectRoot,readComponent:n.readComponent,scriptCode:(K,ne)=>Se(K).map((ae)=>hs(ae.code,ra.dirname(ne))).join(`
|
|
1036
1037
|
`)}):void 0,N=new Set,H=[];for(let[K,ne]of i.entries()){let ae=$i(Pi(ne)+ne.code,L,String(K));for(let[$e,ye]of ae.columns)I.set(ne.startLine+$e-1,ye);for(let $e of ae.declarations)W.push({text:hs($e.text,n.originDir??""),origin:$e.origin?{...$e.origin,line:$e.origin.line+ne.startLine-1}:void 0});let de=ne.kind==="client"&&a?a.project(ae.code):void 0;for(let[$e,ye]of de?.columns??[])u.set(ne.startLine+$e-1,ye);let pe=Cn(de?.code??ae.code),Ee=eo(pe,n.originDir??"");for(let[$e,ye]of Ee.columns)D.set(ne.startLine+$e-1,ye);let Ce=Ee.code.split(`
|
|
@@ -1038,14 +1039,14 @@ return {`});for(let[N,H]of u.entries())l.push({text:`value${N}: (`}),l.push({tex
|
|
|
1038
1039
|
`).entries())if(x.push(de),ne)v.set(x.length,ae===0?ne:{...ne,line:ne.line+ae,column:1,prefixLength:0})},U=Ys(i.filter((K)=>K.kind==="server").map((K)=>K.code).join(`
|
|
1039
1040
|
`));if(U)Z(U);for(let K of i.filter((ne)=>ne.kind==="server")){let ne=Ut(K.code);if(!ne?.unsupported)continue;let ae=K.code.slice(0,ne.offset),de=K.startLine+ae.split(`
|
|
1040
1041
|
`).length-1,pe=ne.offset-K.code.lastIndexOf(`
|
|
1041
|
-
`,ne.offset-1)+(de===K.startLine?(K.startColumn??1)-1:0);Z(`;({})[${JSON.stringify(ne.unsupported)}];`,{line:de,column:pe,anchor:!0})}if(l?.declarations)Z(l.declarations);for(let K of W)Z(K.text,K.origin);if(a){if(Z(a.declarations),n.nativeChecks!==!1)for(let K of a.checks)Z(K.text,{line:K.line,column:K.column,diagnosticOrigin:K.origin,anchor:!0})}if(n.globals!==!1){Z("");let K=new Set([...i.flatMap((pe)=>he(pe.code)),...i.flatMap((pe)=>xs(pe.code))]),ne=(pe)=>{if(!K.has(pe)&&!n.declaredGlobals?.includes(pe))Z(`declare var ${pe}: any`)};if(n.runtimeGlobals!==!1){if(!K.has("window"))Z("declare var window: any");for(let pe of
|
|
1042
|
+
`,ne.offset-1)+(de===K.startLine?(K.startColumn??1)-1:0);Z(`;({})[${JSON.stringify(ne.unsupported)}];`,{line:de,column:pe,anchor:!0})}if(l?.declarations)Z(l.declarations);for(let K of W)Z(K.text,K.origin);if(a){if(Z(a.declarations),n.nativeChecks!==!1)for(let K of a.checks)Z(K.text,{line:K.line,column:K.column,diagnosticOrigin:K.origin,anchor:!0})}if(n.globals!==!1){Z("");let K=new Set([...i.flatMap((pe)=>he(pe.code)),...i.flatMap((pe)=>xs(pe.code))]),ne=(pe)=>{if(!K.has(pe)&&!n.declaredGlobals?.includes(pe))Z(`declare var ${pe}: any`)};if(n.runtimeGlobals!==!1){if(!K.has("window"))Z("declare var window: any");for(let pe of _)ne(pe)}let ae=[...new Set([...br,...Ae,...sa])].filter((pe)=>!n.declaredGlobals?.includes(pe)&&(n.runtimeGlobals!==!1||!_.includes(pe)));if(n.contextScope==="global"){Z("declare global {");for(let pe of ae)Z(` var ${pe}: any`);Z("}")}else{for(let pe of br)ne(pe);for(let pe of Ae)ne(pe);for(let pe of sa)ne(pe)}Z(`declare var ${xr}: any`);let de=new Set(i.flatMap((pe)=>he(pe.code)));Z(`type ${Xo}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let pe of a?[]:Hu(e)){if(de.has(pe.name))continue;let Ee=pe.iterable&&de.has(pe.iterable)?`${Xo}<typeof ${pe.iterable}>`:"any";Z(`declare var ${pe.name}: ${Ee}`)}}if(n.templateExpressions!==!1){if(z?.declarations)for(let ne of z.declarations.split(`
|
|
1042
1043
|
`))Z(ne);let K=Qs(e).map((ne)=>{let ae=z?.events.get(ne.offset??-1);if(ae){ne.anchor=!0;let de=ne.code.trim(),pe=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(de),Ee=pe?`void ((${pe[2]}) satisfies __StxAssignedValue<typeof ${pe[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(de)?`${de} satisfies (($event: ${ae}) => unknown)`:de,Ce=`;(($event: ${ae}): void => { `;return{expression:ne,statement:{text:`${Ce}${Ee} });`,prefixLength:Ce.length}}}return{expression:ne,statement:tp(ne)}}).filter((ne)=>ne.statement!==null);if(K.push(...z?.checks||[],...l?.checks||[]),K.length>0){let ne=rn(e),ae=ps(ne),de=a?Jo(ne):[];if(a)Z("type __StxNativeValue<T> = T extends readonly (infer E)[] ? E : T extends object ? T[keyof T] : never; declare function __stxEach<T>(items: T, callback: (item: __StxNativeValue<T>, key: string) => void): void;");let pe=Qu(i.map((ye)=>ye.code)),Ce=[...new Set(i.flatMap((ye)=>he(ye.code)))].filter((ye)=>/^[A-Z_$][\w$]*$/i.test(ye)),$e=0;if(a)Z("function __stxNativeTemplate(this: __StxNativeComponent) {");if(Ce.length>0){Z(zu);for(let ye of Ce)Z(`function __StxRead_${ye}() { return ${ye} }`),Z(`type __StxT_${ye} = ${aa}<ReturnType<typeof __StxRead_${ye}>>`);Z(`;((${Ce.map((ye)=>`${ye}: __StxT_${ye}`).join(", ")}) => {`),$e=1}for(let{expression:ye,statement:He}of K){let tt=" ".repeat($e),ct=ye.offset===void 0?[]:ae.filter((et)=>ye.offset>=et.start&&ye.offset<et.end),nt=ye.offset===void 0?[]:de.filter((et)=>ye.offset>=et.start&&ye.offset<et.end),ht=nt.map((et)=>`;__stxEach(${et.iterable}, (${et.binding}) => { `).join(""),ut=" });".repeat(nt.length),st=ht+ct.map((et)=>`;((${et.binding.replace(/[\r\n]/g," ")}: any) => { `).join(""),Ot=" });".repeat(ct.length)+ut,je=ye.offset===void 0?[]:ep(ne,ye.offset),Te=je.length>0?`${je.map((et)=>`if (${da(et,pe)}) `).join("")}{ `:"",pt=je.length>0?" }":"";Z(tt+st+Te+He.text+pt+Ot,{line:ye.line,column:ye.column,expression:ye,prefixLength:He.prefixLength+tt.length+st.length+Te.length,guardPrefixLength:tt.length+st.length+Te.length})}if($e>0)Z("});");if(a)Z("}")}}let V=!1;if(n.reference&&x[0]!==void 0&&x[0].trim()==="")x[0]=`/// <reference path=${JSON.stringify(n.reference.replace(/\\/g,"/"))} />`,V=!0;return Z("export {}"),{text:x.join(`
|
|
1043
1044
|
`),lineMap:v,sourceLineCount:f.length,componentDependencies:new Map([...z?.dependencies??[],...l?.dependencies??[]]),referenced:V,scriptColumns:I,importColumns:D,componentColumns:u}}function ga(e){let n=[0];for(let r=0;r<e.length;r++)if(e.charCodeAt(r)===10)n.push(r+1);return n}function yr(e,n){let r=0,i=e.length-1;while(r<i){let a=Math.ceil((r+i)/2);if(e[a]<=n)r=a;else i=a-1}return{line:r+1,column:n-e[r]+1}}function al(e,n){if(!e.expression)return!1;return e.inGuard===!0||n===2774}function Oi(e,n,r){let i=e.lineMap.get(n);if(!i)return n<=e.sourceLineCount?{line:n,column:sp(e,n,r)}:null;let a=i.anchor||i.expression?.anchor||i.diagnosticOrigin==="component"?0:Math.max(0,r-1-(i.prefixLength??0));return{line:i.line,column:i.column+a,expression:i.expression,diagnosticOrigin:i.diagnosticOrigin,inGuard:r<=(i.guardPrefixLength??0)}}var _r=S(256),rp=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/(?:\bwindow\.)?localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables \u2014 or, where this must run before first paint and the runtime does not exist yet, the colorMode config for a light/dark theme, or @appearanceBootstrap when there is a second appearance axis"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}],ma=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function ip(e){let n=Array.from(e,(a)=>a===`
|
|
1044
1045
|
`?`
|
|
1045
1046
|
`:" "),r=0,i="";while(r<e.length){let a=e[r],l=e[r+1];if(i){if(a==="\\"){r+=2;continue}if(a===i)i="";r++;continue}if(a==='"'||a==="'"||a==="`"){i=a,r++;continue}if(a==="/"&&l==="/"){while(r<e.length&&e[r]!==`
|
|
1046
1047
|
`)n[r]=e[r],r++;continue}if(a==="/"&&l==="*"){let u=e.indexOf("*/",r+2),f=u===-1?e.length:u+2;for(;r<f;r++)n[r]=e[r];continue}if(a==="{"&&l==="{"&&e.slice(r,r+4)==="{{--"){let u=e.indexOf("--}}",r+4),f=u===-1?e.length:u+4;for(;r<f;r++)n[r]=e[r];continue}r++}return n.join("")}function op(e){let n=new Map,r=ip(e).split(`
|
|
1047
1048
|
`),i=e.split(`
|
|
1048
|
-
`);return r.forEach((a,l)=>{ma.lastIndex=0;for(let u of a.matchAll(ma)){let f=u[1]==="-next-line",x=(i[l]??"").slice(0,u.index).trim(),v=f||x===""?l+2:l+1,D=(u[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),W=D.filter((z)=>/\w/.test(z));if(D.length>0&&W.length===0)continue;let L=n.get(v);if(L&&L.size===0)continue;if(W.length===0){n.set(v,new Set);continue}if(L)W.forEach((z)=>L.add(z));else n.set(v,new Set(W))}}),n}function ap(e,n,r){let i=e.get(n);if(!i)return!1;if(i.size===0)return!0;return[...i].some((a)=>r.includes(a))}function Ue(e,n,r,i){let a=typeof r==="boolean"?{enabled:r,failOnViolation:r}:r??{enabled:!1};if(!a.enabled)return;let l=
|
|
1049
|
+
`);return r.forEach((a,l)=>{ma.lastIndex=0;for(let u of a.matchAll(ma)){let f=u[1]==="-next-line",x=(i[l]??"").slice(0,u.index).trim(),v=f||x===""?l+2:l+1,D=(u[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),W=D.filter((z)=>/\w/.test(z));if(D.length>0&&W.length===0)continue;let L=n.get(v);if(L&&L.size===0)continue;if(W.length===0){n.set(v,new Set);continue}if(L)W.forEach((z)=>L.add(z));else n.set(v,new Set(W))}}),n}function ap(e,n,r){let i=e.get(n);if(!i)return!1;if(i.size===0)return!0;return[...i].some((a)=>r.includes(a))}function Ue(e,n,r,i){let a=typeof r==="boolean"?{enabled:r,failOnViolation:r}:r??{enabled:!1};if(!a.enabled)return;let l=C(e,n,i,JSON.stringify(a)),u=_r.get(l);if(u!==void 0){if(u&&a.failOnViolation)throw new ee(u,i??n);return}let f=a.allowPatterns??[],x=op(e),v=[],I=t(e.replace(/\{\{--[\s\S]*?--\}\}/g,(z)=>z.replace(/[^\n]/g," ")));for(let{pattern:z,message:N,suggestion:H}of rp){if(f.some((U)=>/\w/.test(U)&&N.includes(U)))continue;z.lastIndex=0;let Z=I.match(z);if(Z&&Z.length>0){let U=I.split(`
|
|
1049
1050
|
`),V=e.split(`
|
|
1050
1051
|
`),K=[];if(U.forEach((pe,Ee)=>{if(z.lastIndex=0,z.test(pe)&&!ap(x,Ee+1,N))K.push(Ee+1)}),K.length===0&&U.some((pe)=>(z.lastIndex=0,z.test(pe))))continue;let ne=K.length>0?` (script line${K.length>1?"s":""} ${K.join(", ")})`:"",ae=K.slice(0,3).map((pe)=>` ${pe} | ${(V[pe-1]??"").trim().slice(0,100)}`).join(`
|
|
1051
1052
|
`),de=ae?`
|
|
@@ -1059,8 +1060,8 @@ ${v.join(`
|
|
|
1059
1060
|
`){let z=e[a];if(z==="\\"){a+=2;continue}if(z==="[")L=!0;else if(z==="]")L=!1;else if(z==="/"&&!L){a++;while(a<l&&/[a-z]/i.test(e[a]))a++;return}a++}},W=()=>{if(i!==0)return;let L=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(L){let Z=L[2].split(",").map((U)=>{let V=U.trim().split(":");return V[V.length-1].trim()});for(let U of Z)if(U&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(U)&&!r.has(U))n.push(U),r.add(U);return}let z=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let Z=z[2];if(!r.has(Z))n.push(Z),r.add(Z);return}let N=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(N){let Z=N[1];if(!r.has(Z))n.push(Z),r.add(Z);return}let H=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let Z=H[1];if(!r.has(Z))n.push(Z),r.add(Z)}};while(a<l){if(x())continue;if(e[a]==="'"||e[a]==='"'){u(e[a]);continue}if(e[a]==="`"){f();continue}if(e[a]==="/"&&I()){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])))W();a++}return n}function _p(e){let n=[],r=0,i=0,a=null;for(let l=0;l<e.length;l++){let u=e[l];if(a){if(u==="\\"){l++;continue}if(u===a)a=null;continue}if(u==='"'||u==="'"||u==="`"){a=u;continue}if(u==="("||u==="["||u==="{")r++;else if(u===")"||u==="]"||u==="}")r--;else if(u===","&&r===0)n.push(e.slice(i,l)),i=l+1}if(i<e.length)n.push(e.slice(i));return n}function wp(e){let n=0,r=null;for(let i=0;i<e.length;i++){let a=e[i];if(r){if(a==="\\"){i++;continue}if(a===r)r=null;continue}if(a==='"'||a==="'"||a==="`"){r=a;continue}if(a==="("||a==="["||a==="{")n++;else if(a===")"||a==="]"||a==="}")n--;else if(a==="="&&n===0){let l=e[i-1],u=e[i+1];if(l==="!"||l==="<"||l===">"||l==="=")continue;if(u==="="||u===">")continue;return i}}return-1}function Sp(e,n){try{let r=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!r)return;let i=r.index-1;while(i>=0&&/\s/.test(e[i]))i--;if(e[i]!=="}")return;let a=i,l=0,u=-1;for(;i>=0;i--){let x=e[i];if(x==="}")l++;else if(x==="{"){if(l--,l===0){u=i;break}}}if(u===-1)return;let f=e.slice(u+1,a);for(let x of _p(f)){let v=x.trim();if(!v||v.startsWith("..."))continue;let I=wp(v);if(I===-1)continue;let D=v.slice(0,I).trim();if(!/^[A-Z_$][\w$]*$/i.test(D))continue;if(n[D]!==void 0)continue;let W=v.slice(I+1).trim();if(!W)continue;try{let L=Object.keys(n).filter(Xt),z=Function(...L,`"use strict"; return (${W});`);n[D]=z(...L.map((N)=>n[N]))}catch{}}}catch{}}var vp=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function Hg(e,n){let r=Ht(e),i=e.slice(r).match(/^<([a-zA-Z][a-zA-Z0-9-]*)/);if(!i)return null;let a=i[1].toLowerCase();if(!vp.has(a))return null;let l=new RegExp(`<\\/?${a}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),u=w(e,(I,D)=>(l.lastIndex=D,l.exec(I)?.index===D?l.lastIndex:-1));if(a==="span"&&/\sdata-stx-scope\s*=/.test(u[0]?.token||""))return null;let f=0,x=!1;for(let I of u){if(f+=I.token.startsWith("</")?-1:1,f<0)return null;if(f===0){if(e.slice(I.end).trim())return null;x=!0;break}}if(!x)return null;let v=r+i[0].length;return e.slice(0,v)+n+e.slice(v)}function Ra(e,n){if(!e)return!1;return[...n.additionalComponentsDirs??[],...n.fallbackComponentsDir?[n.fallbackComponentsDir]:[]].some((i)=>{let a=fe.relative(fe.resolve(i),fe.resolve(e));return!a.startsWith("..")&&!fe.isAbsolute(a)})}async function jr(e,n,r,i,a){let l=e.endsWith(".stx")?e.slice(0,-4):e,u=(ae)=>ae.split("-").map((de)=>de.charAt(0).toUpperCase()+de.slice(1)).join(""),f=r.__importedComponents;if(f){for(let ae of[l,l.toLowerCase(),u(l),X(l)])if(f.has(ae))return!0}let x=[...new Set([`${l}.stx`,`${u(l)}.stx`,`${X(l)}.stx`])],v=typeof a.root==="string"?fe.resolve(a.root):void 0,I=v??fe.dirname(i),D=[],W=(ae)=>{if(ae&&!D.includes(ae))D.push(ae)};for(let ae of Qn(i,v))W(ae);let L=r.__originalFilePath;if(L)W(fe.join(fe.dirname(L),"components"));if(Ra(n,a))W(a._rootComponentsDir);W(n),W(a._rootComponentsDir),W(fe.join(fe.dirname(i),"components")),W(a.componentsDir);for(let ae of a.additionalComponentsDirs??[])W(ae);let z=a._targetComponentFallbackNames?.some((ae)=>ae.toLowerCase()===l.toLowerCase());if(!z)for(let ae of a._targetComponentDirs??[])W(ae);if(v)W(fe.resolve(v,"resources/views/components")),W(fe.resolve(v,"resources/components")),W(fe.resolve(v,"src/components")),W(fe.resolve(v,"components"));for(let ae of a._layerComponentDirs??[])W(ae);let N=a._pluginComponentDirs;if(Array.isArray(N))for(let ae of N)W(typeof ae==="string"?ae:null);if(W(a.fallbackComponentsDir),z)for(let ae of a._targetComponentDirs??[])W(ae);let H=a._nativePrimitivesFallback;if(H&&!H.except.some((ae)=>ae.toLowerCase()===l.toLowerCase()))W(H.dir);if(l.startsWith("./")||l.startsWith("../"))return s(fe.resolve(fe.dirname(i),`${l}.stx`));let Z=_a(fe.resolve(import.meta.dir,"components")),U=D.map((ae)=>fe.isAbsolute(ae)?ae:fe.resolve(I,ae)),V=`${x.join("\x00")}\x00\x00${U.join("\x00")}`,K=Er.get(V);if(K!==void 0)return K;let ne=!1;e:for(let ae of U){if(_a(ae)===Z)continue;for(let de of x)if(await s(fe.join(ae,de))){ne=!0;break e}}return Er.set(V,ne),ne}function _a(e){let n=kr.get(e);if(n!==void 0)return n;let r=e;try{r=Ss.realpathSync(e)}catch{}return kr.set(e,r),r}function Vg(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function vl(e){if(!e)return!1;let n=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(n)}function $p(e,n,r){if(!e.includes("{{")&&!e.includes("{!!"))return e;let i=(a,l)=>{let u;try{u=O(a,n)}catch{return l}if(u===void 0||u===null)return"";let f=String(u);if(/<\/style/i.test(f))return console.warn(`[stx] a <style> expression in ${r??"<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,l)=>i(l,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,l)=>i(l,a))}var wa=new Set;function Sa(e,n,r,i){let a=`${e}\x00${n}\x00${i??""}`;if(!process.env.STX_DEBUG&&wa.has(a))return;wa.add(a);let l=n?` used in ${n}`:"",u=i?` Cause: ${i}.`:"",f=r.length>0?`
|
|
1060
1061
|
searched:
|
|
1061
1062
|
${r.map((x)=>` - ${x}`).join(`
|
|
1062
|
-
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${u}${f}`)}function va(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var Ep=new Set(["for","if","show","key","ref","class","className","style"]),$a=new Set,Aa="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",xl=new RegExp(`\\b(?:${Aa})\\s*(?:<[^>]*>)?\\s*\\(`);function Bi(e){let n=new Set,r=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|${Aa})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let i of e){let a;while((a=r.exec(i))!==null)n.add(a[1]);r.lastIndex=0}return[...n]}async function Je(e,n,r,i,a,l,u,f=new Set,x,v=gt(a),I,D=e){let{extractVariables:W}=await o("stx/variable-extractor",()=>import("./chunk-rx94z3d5.js")),L=f??new Set;if(L.has(e))return`[Circular component reference: ${e}]`;let z=new Set(L);z.add(e);let N=typeof n.client==="string"?n.client.trim():"";if("client"in n)delete n.client;let H=N&&N!=="load"&&Vg(N)?N:"";try{let Z=(le)=>le.split("-").map((be)=>be.charAt(0).toUpperCase()+be.slice(1)).join(""),U=D.endsWith(".stx")?D.slice(0,-4):D,V=null,K=a.__importedComponents;if(K){let le=[U,U.toLowerCase(),Z(U),X(U)];for(let be of le)if(K.has(be)){V=K.get(be);break}}let ne=[];if(!V){let le=[`${U}.stx`,`${Z(U)}.stx`,`${X(U)}.stx`],be=[...new Set(le)],Ne=a.__originalFilePath,we=[];for(let ve of Qn(l))if(!we.includes(ve))we.push(ve);let ot=we.length;for(let ve of u._layerComponentDirs??[])if(!we.includes(ve))we.push(ve);if(Ne){let ve=fe.join(fe.dirname(Ne),"components");we.push(ve)}let Fe=u._rootComponentsDir;if(typeof Fe==="string"&&Ra(i,u)&&!we.includes(Fe))we.push(Fe);if(i&&!we.includes(i))we.push(i);if(typeof Fe==="string"&&!we.includes(Fe))we.push(Fe);let Ct=fe.join(fe.dirname(l),"components");if(!we.includes(Ct))we.push(Ct);if(u.componentsDir&&u.componentsDir!==i&&!we.includes(u.componentsDir))we.push(u.componentsDir);for(let ve of u.additionalComponentsDirs??[])if(ve&&!we.includes(ve))we.push(ve);let Zt=u._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(U),It=(I?.events??[]).map((ve)=>ve.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Vn=Object.hasOwn(n,"checked")||Boolean(I?.reactiveProps?.includes("checked")),Rs=Object.hasOwn(n,"value")||Boolean(I?.reactiveProps?.includes("value")),As=!It.includes("valuechange")&&(Vn||It.includes("change")&&!Rs),jt=u._nativeHostAttrs&&/^textinput$/i.test(U),Jt=It.includes("update:value")&&!It.includes("input"),mn=u._nativeHostAttrs&&/^video$/i.test(U),Ts=u._nativeHostAttrs&&/^image$/i.test(U),Un=Xs([...Object.keys(n),...I?.reactiveProps??[]],I?.events,n),Gt=Object.hasOwn(n,"src")||Boolean(I?.reactiveProps?.includes("src")),Hn=Object.hasOwn(n,"source")||Boolean(I?.reactiveProps?.includes("source")),Kn=mn&&(Gt||Hn)&&(I?.events??[]).every((ve)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(ve.replace(/^@/,"").split(".")[0])),qn=new Set(["","primary","secondary","outline","ghost","danger"]),Zn=typeof n.variant==="string"?n.variant.trim().toLowerCase():"",Jn=u._nativeHostAttrs&&/^button$/i.test(U)&&!qn.has(Zn),Fr=u._targetComponentFallbackNames?.some((ve)=>ve.toLowerCase()===U.toLowerCase())??!1,Is=Fr&&(!Zt||As)&&(!jt||Jt)&&(!mn||Kn)&&(!Ts||Un)&&!Jn;for(let ve of Is?[]:u._targetComponentDirs??[])if(ve&&!we.includes(ve))we.push(ve);let Yt=typeof u.root==="string"?fe.resolve(u.root):void 0,Vr=Yt??fe.dirname(l),Qt=[];if(Yt)Qt.push(fe.resolve(Yt,"resources/views/components")),Qt.push(fe.resolve(Yt,"resources/components")),Qt.push(fe.resolve(Yt,"src/components")),Qt.push(fe.resolve(Yt,"components"));Qt.push(fe.resolve(import.meta.dir,"components"));for(let ve of Qt)if(!we.includes(ve))we.push(ve);if(Fr){let ve=(u._componentPackageDirs??[]).filter((ft)=>typeof ft==="string"&&ft.length>0),Rt=(Is?ve.length?ve:u._pluginComponentDirs??[]:u._targetComponentDirs??[]).filter((ft)=>typeof ft==="string"&&ft.length>0);if(Rt.length){let ft=we.slice(ot).map((lt)=>fe.isAbsolute(lt)?lt:fe.resolve(Vr,lt)).filter((lt)=>!Rt.includes(lt)),Gn=`${U}\x00${ft.join("\x00")}`,_t=$r.get(Gn);if(_t===void 0){_t=!1;for(let lt of ft){for(let Mt of be)if(await s(fe.join(lt,Mt))){_t=!0;break}if(_t)break}$r.set(Gn,_t)}if(!_t){for(let lt of Rt){let Mt=we.indexOf(lt);if(Mt>=0)we.splice(Mt,1)}we.splice(ot,0,...Rt)}}}let Ur=u._pluginComponentDirs;if(Array.isArray(Ur)){for(let ve of Ur)if(typeof ve==="string"&&!we.includes(ve))we.push(ve)}if(u.fallbackComponentsDir&&!we.includes(u.fallbackComponentsDir))we.push(u.fallbackComponentsDir);if(Is){for(let ve of u._targetComponentDirs??[])if(ve&&!we.includes(ve))we.push(ve)}let Xn=u._nativePrimitivesFallback;if(Xn&&!Xn.except.some((ve)=>ve.toLowerCase()===U.toLowerCase())&&!we.includes(Xn.dir))we.push(Xn.dir);let Hr=[...new Set(we.map((ve)=>{if(!ve)return ve;return fe.isAbsolute(ve)?ve:fe.resolve(Vr,ve)}))];we.length=0,we.push(...Hr);let Ps=`${U}\x00${l}\x00${Hr.join("\x00")}`,Os=_s.get(Ps);if(Os)if(await s(Os))V=Os;else _s.delete(Ps);if(!V&&(U.startsWith("./")||U.startsWith("../")))V=fe.resolve(fe.dirname(l),`${U}.stx`),ne.push(V);else if(!V)for(let ve of we){if(!ve)continue;for(let Rt of be){let ft=fe.join(ve,Rt);if(ne.push(ft),await s(ft)){V=ft;break}}if(V)break;if(!V)try{let Rt=await import("fs");if(!Rt.statSync(ve,{throwIfNoEntry:!1})?.isDirectory())continue;let Gn=8,_t=[{path:ve,depth:0}];while(_t.length>0&&!V){let lt=_t.pop();if(lt.depth>=Gn)continue;let Mt;try{Mt=Rt.readdirSync(lt.path,{withFileTypes:!0})}catch{continue}for(let Yn of Mt){if(!Yn.isDirectory())continue;if(Yn.name==="node_modules"||Yn.name.startsWith("."))continue;let Zr=fe.join(lt.path,Yn.name);for(let Va of be){let js=fe.join(Zr,Va);if(ne.push(js),await s(js)){V=js;break}}if(V)break;_t.push({path:Zr,depth:lt.depth+1})}}}catch{}if(V)break}if(V)_s.set(Ps,V)}if(!V||!await s(V))return Sa(e,l,ne),va(e);x.add(V);let ae;if(Dn.has(V)&&vr.get(V)===xa(V))ae=Dn.get(V);else try{let le=xa(V);ae=await Bun.file(V).text(),Dn.set(V,ae),vr.set(V,le)}catch(le){let be=le instanceof Error?le.message:String(le);return Sa(e,l,[V],be),va(e)}if(I)for(let le of new Set([...Object.keys(n),...I.reactiveProps??[]])){let be=le.toLowerCase();if(be.startsWith("aria-")||be.startsWith("data-"))continue;let Ne=le.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${Ne}\\b`).test(ae))I.declaredProps.add(le);if(new RegExp(`\\$props\\s*(?:\\.\\s*${Ne}\\b|\\[\\s*['"]${Ne}['"]\\s*\\])`).test(ae)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${Ne}['"]`).test(ae))I.consumedProps?.add(le)}if(I?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(ae))for(let le of I.reactiveProps){if(Ep.has(le)||I.consumedProps?.has(le))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${le.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(ae))continue;let be=`${V}\x00${le}`;if($a.has(be))continue;$a.add(be),console.warn(`[stx] ${fe.basename(V)} reads \`${le}\` with defineProps(), which is not live, but ${fe.basename(l)} binds it (:${le}): 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('${le}').`)}let de=new Set(["__originalFilePath","__importedComponents",rs,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),pe={};for(let[le,be]of Object.entries(a))if(!le.startsWith("__")||de.has(le))pe[le]=be;let Ee=v.length>0?{[us]:[...v]}:{},Ce=r;if(r.includes("@include")){let{processIncludes:le}=await o("stx/includes",()=>import("./chunk-nsa675xs.js"));Ce=await le(r,a,l,u,x)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ce)){let{processComponents:le}=await o("stx/component-renderer",()=>import("./chunk-j5gcwg3k.js")),be={...a,__processedComponents:L,...Ee};Ce=await le(Ce,be,l,u,x);let Ne=be.__stx_preserved_client_expressions;if(Array.isArray(Ne)&&Ne.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Ne])]}let $e=[];if(vl(Ce)){let{processExpressions:le}=await o("stx/expressions",()=>import("./chunk-bnawaxh5.js")),be=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...Ee}:v.length>0?{...a,...Ee}:a;Ce=le(Ce,be,l);for(let Ne of Ce.matchAll(/\{\{([\s\S]*?)\}\}/g))$e.push(Ne[1].trim())}let ye=re(Ce),He=[],tt=ye.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(le,be)=>{let Ne=ye.scripts[Number(be)]||"",we=Ne.match(/^<script\b([^>]*)>/i)?.[1]||"",ot=we.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Fe=!ot||["module","text/javascript","application/javascript"].includes(ot),Ct=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${we}`);if(!/\bserver\b/i.test(we)&&Fe&&!Ct)return He.push(Ne),"";return Ne}),{extractSlotContent:ct}=await o("stx/slots",()=>import("./chunk-5fn9s4e7.js")),nt=ct(tt),ht={};if(nt.defaultSlot?.trim())ht.default=nt.defaultSlot;for(let[le,be]of nt.namedSlots)ht[le]=be.content;let ut=a.__stx_scope_seq??={n:0,key:oo(String(a.__filename??l))},st=Ca(e,process.cwd()),je=`stx_${(st.endsWith(".stx")?st.slice(0,-4):st).replace(/[^a-zA-Z0-9]/g,"_")}_${++ut.n}_${ut.key}`,Te={...pe,$uid:je,$native:u._nativeHostAttrs===!0,...n,props:n,slot:tt,$slots:ht,__processedComponents:z,__sections:{},__stx_signals_gate:Oe(ae)||vl(r),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...$e]};if(/import\s/.test(ae)){Te.__importedComponents=new Map(Te.__importedComponents);let{processESImports:le}=await o("stx/component-renderer",()=>import("./chunk-j5gcwg3k.js"));ae=await le(ae,Te,V,u,x)}Sp(ae,Te);let pt=ae,et=j(pt);if(et)pt=et.content.trim();let an=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,At=[...ae.matchAll(an)];for(let[,le,be]of At)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(le))Ue(be,V,u.strict);let xt=[],cn=null,$s=At.some((le)=>/\bserver\b/.test(le[1]||"")&&/\bcache\b/.test(le[1]||"")),Ft=null,vt=null,ln=null,zn=0,un=null;if(mp(u),$s&&Cr>0){let le=hp({props:n,slot:Ce,slotContext:r.trim()?xp(pe):void 0,buildMode:u.buildMode??"",skipEventDirectives:u.skipEventDirectives===!0,native:u._nativeHostAttrs===!0,clientLoopNames:[...v].sort(),layers:u._layerGraph?.layers.map((be)=>be.configFile),uid:je});if(le!==null){Ft=`${V}\x00${_(ae)}\x00${le}`;let be=ws.get(Ft);if(be){for(let Ne of be.dependencies)x.add(Ne);if(vi(a,be.clientFactories),ut.n+=be.uidsConsumed,be.preservedClientExpressions.length>0){let Ne=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let we of be.preservedClientExpressions)Ne.add(we);a.__stx_preserved_client_expressions=[...Ne]}return be.output}vt=new Set(x),ln=wi(a),zn=ut.n,un=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let pn=new Set;for(let le of At){let be=le[1]||"",Ne=le[2]||"",we=be.includes("server");if(Ge(be)&&Ne.trim())Ne=Xe(Ne);if(we&&Ne){for(let Fe of he(Ne))pn.add(Fe);try{await W(Ne,Te,V,{onFailure:(Fe)=>{if(Fe.kind!=="unknown")cn=Fe.kind}})}catch(Fe){}}if(!we){let Fe=Ne.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),Ct=Fe.includes("{{")&&Fe.includes("}}"),Zt=Fe.includes("{!!")&&Fe.includes("!!}");if(Ct||Zt)Fe=zi(Fe,Te,V);let It=be.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");xt.push(`<script${It}>${Fe}</script>`)}}let bt=re(ae).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),fn=bt?bt[1]:"",Es=bt?bt[2]:"",$t="",ce=fn&&/\bscoped\b/i.test(fn);if(bt)$t=`<style${fn}>${$p(Es,Te,V)}</style>`;let ue=pt;if(ue=ue.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),bt)ue=ue.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let le=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,be=[];if(ue=ue.replace(le,(Ne,we)=>{let ot=we.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(ot)be.push(`<style${ot[1]}>${ot[2]}</style>`);return""}),ue=ue.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),be.length>0)$t=`${$t}${be.join(`
|
|
1063
|
-
`)}`}if(r&&ue.includes("{{ text || slot }}"))ue=ue.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>r);let{applySlots:_e}=await o("stx/slots",()=>import("./chunk-
|
|
1063
|
+
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${u}${f}`)}function va(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var Ep=new Set(["for","if","show","key","ref","class","className","style"]),$a=new Set,Aa="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",xl=new RegExp(`\\b(?:${Aa})\\s*(?:<[^>]*>)?\\s*\\(`);function Bi(e){let n=new Set,r=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|${Aa})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let i of e){let a;while((a=r.exec(i))!==null)n.add(a[1]);r.lastIndex=0}return[...n]}async function Je(e,n,r,i,a,l,u,f=new Set,x,v=gt(a),I,D=e){let{extractVariables:W}=await o("stx/variable-extractor",()=>import("./chunk-z2mvdnce.js")),L=f??new Set;if(L.has(e))return`[Circular component reference: ${e}]`;let z=new Set(L);z.add(e);let N=typeof n.client==="string"?n.client.trim():"";if("client"in n)delete n.client;let H=N&&N!=="load"&&Vg(N)?N:"";try{let Z=(le)=>le.split("-").map((be)=>be.charAt(0).toUpperCase()+be.slice(1)).join(""),U=D.endsWith(".stx")?D.slice(0,-4):D,V=null,K=a.__importedComponents;if(K){let le=[U,U.toLowerCase(),Z(U),X(U)];for(let be of le)if(K.has(be)){V=K.get(be);break}}let ne=[];if(!V){let le=[`${U}.stx`,`${Z(U)}.stx`,`${X(U)}.stx`],be=[...new Set(le)],Ne=a.__originalFilePath,we=[];for(let ve of Qn(l))if(!we.includes(ve))we.push(ve);let ot=we.length;for(let ve of u._layerComponentDirs??[])if(!we.includes(ve))we.push(ve);if(Ne){let ve=fe.join(fe.dirname(Ne),"components");we.push(ve)}let Fe=u._rootComponentsDir;if(typeof Fe==="string"&&Ra(i,u)&&!we.includes(Fe))we.push(Fe);if(i&&!we.includes(i))we.push(i);if(typeof Fe==="string"&&!we.includes(Fe))we.push(Fe);let Ct=fe.join(fe.dirname(l),"components");if(!we.includes(Ct))we.push(Ct);if(u.componentsDir&&u.componentsDir!==i&&!we.includes(u.componentsDir))we.push(u.componentsDir);for(let ve of u.additionalComponentsDirs??[])if(ve&&!we.includes(ve))we.push(ve);let Zt=u._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(U),It=(I?.events??[]).map((ve)=>ve.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Vn=Object.hasOwn(n,"checked")||Boolean(I?.reactiveProps?.includes("checked")),Rs=Object.hasOwn(n,"value")||Boolean(I?.reactiveProps?.includes("value")),As=!It.includes("valuechange")&&(Vn||It.includes("change")&&!Rs),jt=u._nativeHostAttrs&&/^textinput$/i.test(U),Jt=It.includes("update:value")&&!It.includes("input"),mn=u._nativeHostAttrs&&/^video$/i.test(U),Ts=u._nativeHostAttrs&&/^image$/i.test(U),Un=Xs([...Object.keys(n),...I?.reactiveProps??[]],I?.events,n),Gt=Object.hasOwn(n,"src")||Boolean(I?.reactiveProps?.includes("src")),Hn=Object.hasOwn(n,"source")||Boolean(I?.reactiveProps?.includes("source")),Kn=mn&&(Gt||Hn)&&(I?.events??[]).every((ve)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(ve.replace(/^@/,"").split(".")[0])),qn=new Set(["","primary","secondary","outline","ghost","danger"]),Zn=typeof n.variant==="string"?n.variant.trim().toLowerCase():"",Jn=u._nativeHostAttrs&&/^button$/i.test(U)&&!qn.has(Zn),Fr=u._targetComponentFallbackNames?.some((ve)=>ve.toLowerCase()===U.toLowerCase())??!1,Is=Fr&&(!Zt||As)&&(!jt||Jt)&&(!mn||Kn)&&(!Ts||Un)&&!Jn;for(let ve of Is?[]:u._targetComponentDirs??[])if(ve&&!we.includes(ve))we.push(ve);let Yt=typeof u.root==="string"?fe.resolve(u.root):void 0,Vr=Yt??fe.dirname(l),Qt=[];if(Yt)Qt.push(fe.resolve(Yt,"resources/views/components")),Qt.push(fe.resolve(Yt,"resources/components")),Qt.push(fe.resolve(Yt,"src/components")),Qt.push(fe.resolve(Yt,"components"));Qt.push(fe.resolve(import.meta.dir,"components"));for(let ve of Qt)if(!we.includes(ve))we.push(ve);if(Fr){let ve=(u._componentPackageDirs??[]).filter((ft)=>typeof ft==="string"&&ft.length>0),Rt=(Is?ve.length?ve:u._pluginComponentDirs??[]:u._targetComponentDirs??[]).filter((ft)=>typeof ft==="string"&&ft.length>0);if(Rt.length){let ft=we.slice(ot).map((lt)=>fe.isAbsolute(lt)?lt:fe.resolve(Vr,lt)).filter((lt)=>!Rt.includes(lt)),Gn=`${U}\x00${ft.join("\x00")}`,_t=$r.get(Gn);if(_t===void 0){_t=!1;for(let lt of ft){for(let Mt of be)if(await s(fe.join(lt,Mt))){_t=!0;break}if(_t)break}$r.set(Gn,_t)}if(!_t){for(let lt of Rt){let Mt=we.indexOf(lt);if(Mt>=0)we.splice(Mt,1)}we.splice(ot,0,...Rt)}}}let Ur=u._pluginComponentDirs;if(Array.isArray(Ur)){for(let ve of Ur)if(typeof ve==="string"&&!we.includes(ve))we.push(ve)}if(u.fallbackComponentsDir&&!we.includes(u.fallbackComponentsDir))we.push(u.fallbackComponentsDir);if(Is){for(let ve of u._targetComponentDirs??[])if(ve&&!we.includes(ve))we.push(ve)}let Xn=u._nativePrimitivesFallback;if(Xn&&!Xn.except.some((ve)=>ve.toLowerCase()===U.toLowerCase())&&!we.includes(Xn.dir))we.push(Xn.dir);let Hr=[...new Set(we.map((ve)=>{if(!ve)return ve;return fe.isAbsolute(ve)?ve:fe.resolve(Vr,ve)}))];we.length=0,we.push(...Hr);let Ps=`${U}\x00${l}\x00${Hr.join("\x00")}`,Os=_s.get(Ps);if(Os)if(await s(Os))V=Os;else _s.delete(Ps);if(!V&&(U.startsWith("./")||U.startsWith("../")))V=fe.resolve(fe.dirname(l),`${U}.stx`),ne.push(V);else if(!V)for(let ve of we){if(!ve)continue;for(let Rt of be){let ft=fe.join(ve,Rt);if(ne.push(ft),await s(ft)){V=ft;break}}if(V)break;if(!V)try{let Rt=await import("fs");if(!Rt.statSync(ve,{throwIfNoEntry:!1})?.isDirectory())continue;let Gn=8,_t=[{path:ve,depth:0}];while(_t.length>0&&!V){let lt=_t.pop();if(lt.depth>=Gn)continue;let Mt;try{Mt=Rt.readdirSync(lt.path,{withFileTypes:!0})}catch{continue}for(let Yn of Mt){if(!Yn.isDirectory())continue;if(Yn.name==="node_modules"||Yn.name.startsWith("."))continue;let Zr=fe.join(lt.path,Yn.name);for(let Va of be){let js=fe.join(Zr,Va);if(ne.push(js),await s(js)){V=js;break}}if(V)break;_t.push({path:Zr,depth:lt.depth+1})}}}catch{}if(V)break}if(V)_s.set(Ps,V)}if(!V||!await s(V))return Sa(e,l,ne),va(e);x.add(V);let ae;if(Dn.has(V)&&vr.get(V)===xa(V))ae=Dn.get(V);else try{let le=xa(V);ae=await Bun.file(V).text(),Dn.set(V,ae),vr.set(V,le)}catch(le){let be=le instanceof Error?le.message:String(le);return Sa(e,l,[V],be),va(e)}if(I)for(let le of new Set([...Object.keys(n),...I.reactiveProps??[]])){let be=le.toLowerCase();if(be.startsWith("aria-")||be.startsWith("data-"))continue;let Ne=le.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${Ne}\\b`).test(ae))I.declaredProps.add(le);if(new RegExp(`\\$props\\s*(?:\\.\\s*${Ne}\\b|\\[\\s*['"]${Ne}['"]\\s*\\])`).test(ae)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${Ne}['"]`).test(ae))I.consumedProps?.add(le)}if(I?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(ae))for(let le of I.reactiveProps){if(Ep.has(le)||I.consumedProps?.has(le))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${le.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(ae))continue;let be=`${V}\x00${le}`;if($a.has(be))continue;$a.add(be),console.warn(`[stx] ${fe.basename(V)} reads \`${le}\` with defineProps(), which is not live, but ${fe.basename(l)} binds it (:${le}): 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('${le}').`)}let de=new Set(["__originalFilePath","__importedComponents",rs,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),pe={};for(let[le,be]of Object.entries(a))if(!le.startsWith("__")||de.has(le))pe[le]=be;let Ee=v.length>0?{[us]:[...v]}:{},Ce=r;if(r.includes("@include")){let{processIncludes:le}=await o("stx/includes",()=>import("./chunk-6cbxs47h.js"));Ce=await le(r,a,l,u,x)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ce)){let{processComponents:le}=await o("stx/component-renderer",()=>import("./chunk-wkcx67x4.js")),be={...a,__processedComponents:L,...Ee};Ce=await le(Ce,be,l,u,x);let Ne=be.__stx_preserved_client_expressions;if(Array.isArray(Ne)&&Ne.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Ne])]}let $e=[];if(vl(Ce)){let{processExpressions:le}=await o("stx/expressions",()=>import("./chunk-9cgwe3tb.js")),be=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...Ee}:v.length>0?{...a,...Ee}:a;Ce=le(Ce,be,l);for(let Ne of Ce.matchAll(/\{\{([\s\S]*?)\}\}/g))$e.push(Ne[1].trim())}let ye=re(Ce),He=[],tt=ye.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(le,be)=>{let Ne=ye.scripts[Number(be)]||"",we=Ne.match(/^<script\b([^>]*)>/i)?.[1]||"",ot=we.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Fe=!ot||["module","text/javascript","application/javascript"].includes(ot),Ct=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${we}`);if(!/\bserver\b/i.test(we)&&Fe&&!Ct)return He.push(Ne),"";return Ne}),{extractSlotContent:ct}=await o("stx/slots",()=>import("./chunk-tzvapd0t.js")),nt=ct(tt),ht={};if(nt.defaultSlot?.trim())ht.default=nt.defaultSlot;for(let[le,be]of nt.namedSlots)ht[le]=be.content;let ut=a.__stx_scope_seq??={n:0,key:oo(String(a.__filename??l))},st=Ca(e,process.cwd()),je=`stx_${(st.endsWith(".stx")?st.slice(0,-4):st).replace(/[^a-zA-Z0-9]/g,"_")}_${++ut.n}_${ut.key}`,Te={...pe,$uid:je,$native:u._nativeHostAttrs===!0,...n,props:n,slot:tt,$slots:ht,__processedComponents:z,__sections:{},__stx_signals_gate:Oe(ae)||vl(r),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...$e]};if(/import\s/.test(ae)){Te.__importedComponents=new Map(Te.__importedComponents);let{processESImports:le}=await o("stx/component-renderer",()=>import("./chunk-wkcx67x4.js"));ae=await le(ae,Te,V,u,x)}Sp(ae,Te);let pt=ae,et=j(pt);if(et)pt=et.content.trim();let an=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,At=[...ae.matchAll(an)];for(let[,le,be]of At)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(le))Ue(be,V,u.strict);let xt=[],cn=null,$s=At.some((le)=>/\bserver\b/.test(le[1]||"")&&/\bcache\b/.test(le[1]||"")),Ft=null,vt=null,ln=null,zn=0,un=null;if(mp(u),$s&&Cr>0){let le=hp({props:n,slot:Ce,slotContext:r.trim()?xp(pe):void 0,buildMode:u.buildMode??"",skipEventDirectives:u.skipEventDirectives===!0,native:u._nativeHostAttrs===!0,clientLoopNames:[...v].sort(),layers:u._layerGraph?.layers.map((be)=>be.configFile),uid:je});if(le!==null){Ft=`${V}\x00${C(ae)}\x00${le}`;let be=ws.get(Ft);if(be){for(let Ne of be.dependencies)x.add(Ne);if(vi(a,be.clientFactories),ut.n+=be.uidsConsumed,be.preservedClientExpressions.length>0){let Ne=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let we of be.preservedClientExpressions)Ne.add(we);a.__stx_preserved_client_expressions=[...Ne]}return be.output}vt=new Set(x),ln=wi(a),zn=ut.n,un=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let pn=new Set;for(let le of At){let be=le[1]||"",Ne=le[2]||"",we=be.includes("server");if(Ge(be)&&Ne.trim())Ne=Xe(Ne);if(we&&Ne){for(let Fe of he(Ne))pn.add(Fe);try{await W(Ne,Te,V,{onFailure:(Fe)=>{if(Fe.kind!=="unknown")cn=Fe.kind}})}catch(Fe){}}if(!we){let Fe=Ne.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),Ct=Fe.includes("{{")&&Fe.includes("}}"),Zt=Fe.includes("{!!")&&Fe.includes("!!}");if(Ct||Zt)Fe=zi(Fe,Te,V);let It=be.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");xt.push(`<script${It}>${Fe}</script>`)}}let bt=re(ae).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),fn=bt?bt[1]:"",Es=bt?bt[2]:"",$t="",ce=fn&&/\bscoped\b/i.test(fn);if(bt)$t=`<style${fn}>${$p(Es,Te,V)}</style>`;let ue=pt;if(ue=ue.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),bt)ue=ue.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let le=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,be=[];if(ue=ue.replace(le,(Ne,we)=>{let ot=we.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(ot)be.push(`<style${ot[1]}>${ot[2]}</style>`);return""}),ue=ue.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),be.length>0)$t=`${$t}${be.join(`
|
|
1064
|
+
`)}`}if(r&&ue.includes("{{ text || slot }}"))ue=ue.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>r);let{applySlots:_e}=await o("stx/slots",()=>import("./chunk-tzvapd0t.js")),{defaultSlot:Le,namedSlots:Ze}=nt,rt=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(tt),yt=xt.length>0&&or(ue)||u._nativeHostAttrs===!0&&xt.length>0||rt&&xt.length>0||xt.some((le)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(le)),ks=(le)=>yt?Mo(le,je):le,Cs=new Map([...Ze].map(([le,be])=>[le,{...be,content:ks(be.content)}]));ue=await _e(ue,yt?jo(ks(Le),je):Le,Cs,Te,yt?je:"");let Bn=Bi(xt),dn=(Array.isArray(Te.__stx_client_signal_names)?Te.__stx_client_signal_names:[]).filter((le)=>!pn.has(le));if(Bn.length>0||dn.length>0)Te.__stx_client_signal_names=[...new Set([...dn,...Bn])];else delete Te.__stx_client_signal_names;let gn=v.filter((le)=>!pn.has(le)&&!(le in n));if(gn.length>0)Te[us]=gn;let Wn={...u,_rootComponentsDir:u._rootComponentsDir||u.componentsDir,componentsDir:fe.dirname(V),skipSignalsRuntime:!0,skipEventDirectives:u._nativeHostAttrs===!0||yt||xt.length===0,defaultLayout:void 0};Te.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:Fn}=await o("stx/process",()=>import("./chunk-xwwp2ftx.js")),Et=await Fn(ue,Te,V,Wn,x),Tt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let le of Et.matchAll(/\{\{([\s\S]*?)\}\}/g))Tt.add(le[1].trim());if(Tt.size>0)a.__stx_preserved_client_expressions=[...Tt];let kt=je,it=Et;if(yt){let le="";if(Object.keys(n).length>0)try{le=` data-stx-props="${wr(JSON.stringify(n))}"`}catch{}let be=H?` stx-hydrate="${wr(H)}"`:"",Ne=Object.fromEntries(Object.entries(ht).map(([jt,Jt])=>[jt,Boolean(Jt)])),we=Object.keys(Ne).length>0?` data-stx-slots="${wr(JSON.stringify(Ne))}"`:"",ot=` data-stx-scope="${kt}"${le}${we}${be}`,Fe=Et.slice(Ht(Et)),Ct=/^<span(?=[\s/>])/i.test(Fe),Zt=/^<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(Fe),It=/^<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(Fe),Vn=Ct?"span":"div",Rs=Zt&&u._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':It&&u._nativeHostAttrs?' style="width:100%;height:100%"':Ct||Zt?' style="display:contents"':"";it=Hg(Et,ot)??`<${Vn}${ot} data-stx-component-wrapper${Rs}>${Et}</${Vn}>`;let As=await Promise.all(xt.map(async(jt)=>{let Jt=jt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Jt)return jt;let[,mn,Ts]=Jt,Un=ha(jt,Te,V);if(Un!==null)return Un;let Gt=await Cp(Ts,V,u.buildMode==="compile"),Hn=Rn(Gt.clientCode,qe(Te)),{vendorStyleTags:Kn}=Gt,qn=Hn?`function(__scopeId) {
|
|
1064
1065
|
${Hn}
|
|
1065
1066
|
return (${Gt.factoryBody})(__scopeId);
|
|
1066
1067
|
}`:Gt.factoryBody,Zn=H?null:Hs(a,qn),Jn=Zn?`window.__stxComponentFactories[${JSON.stringify(Zn)}](${JSON.stringify(kt)});`:`(${qn})(${JSON.stringify(kt)});`;if(H)return`${Kn}<script type="stx/island" data-stx-island="${kt}" data-stx-scoped data-stx-owner="${kt}"${mn}>${ge(Jn)}</script>`;return`${Kn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${kt}"${mn}>${ge(Jn)}</script>`}));if(it=it+`
|
|
@@ -1086,7 +1087,7 @@ ${Be.yellow}${Be.bold}Message:${Be.reset} ${n}
|
|
|
1086
1087
|
`,f)I+=`
|
|
1087
1088
|
${Be.blue}${Be.bold}Context:${Be.reset}
|
|
1088
1089
|
${Be.dim}${f}${Be.reset}
|
|
1089
|
-
`;return I}function ke(){Dn.clear(),vr.clear(),_s.clear(),$r.clear(),Er.clear(),kr.clear(),ws.clear()}function Ey(){return{size:Dn.size,maxSize:500}}var Sr=S(128);async function Cp(e,n,r){let i=
|
|
1090
|
+
`;return I}function ke(){Dn.clear(),vr.clear(),_s.clear(),$r.clear(),Er.clear(),kr.clear(),ws.clear()}function Ey(){return{size:Dn.size,maxSize:500}}var Sr=S(128);async function Cp(e,n,r){let i=C(e,n,r),a=Sr.get(i);if(a){if(Js(a.deps))return a;Sr.delete(i)}let l=Li(e,{filePath:n,projectRoot:process.cwd()}),u=l.code,f=ji(l.styles);u=Kt(u).code;let{hasUserImports:x,bundleClientScript:v}=await o("stx/client-script-bundler",()=>import("./chunk-72qdbhfh.js")),I=[],D=!1;if(x(u)){let U=u;u=await v(U,n,{projectRoot:process.cwd(),minify:r,collectInputs:I}),D=u===U}let{stripStxRuntimeImports:W}=await o("stx/signal-processing",()=>import("./chunk-p6e48m6t.js"));u=W(u);let L=M(u),z=yp(L),N=new Set(G(L,!0).split(",").map((U)=>U.trim())),H=`function(__scopeId) {
|
|
1090
1091
|
${wt("const",[...Ll,...z],L)}
|
|
1091
1092
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
1092
1093
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
@@ -1178,12 +1179,12 @@ finally {
|
|
|
1178
1179
|
}`,Z={vendorStyleTags:f,factoryBody:H,clientCode:L,deps:Pr([...I,...l.styles.map((U)=>U.resolvedPath)])};if(!D&&l.unresolved.length===0)Sr.set(i,Z);return Z}var Rp=100,Ap=599,zr="__stxResponseStatus",Ln="__stxResponseHeaders";function vs(e){return typeof e==="number"&&Number.isInteger(e)&&e>=Rp&&e<=Ap}function Tn(e){for(let n of e.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let r=n[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!r)continue;let i=Number(r[1]);if(vs(i))return i}return}function Tr(e,n){if(!e||typeof e!=="object")return!1;let r=typeof n==="string"&&/^\d+$/.test(n.trim())?Number(n.trim()):n;if(!vs(r))return!1;return e[zr]=r,!0}function Tp(e,n,r){if(!e||typeof e!=="object")return;let i=String(n??"").trim();if(!i)return;e[Ln]={...e[Ln],[i]:String(r)}}function Wt(e){let n=e?.[zr];return vs(n)?n:void 0}function qt(e){let n=e?.[Ln];if(!n||typeof n!=="object")return;let r=Object.entries(n).map(([i,a])=>[i,String(a)]);return r.length>0?Object.fromEntries(r):void 0}function cl(e,n){if(!e||!n||e===n||typeof n!=="object")return;let r=Wt(e);if(r!==void 0)n[zr]=r;let i=qt(e);if(i)n[Ln]={...n[Ln],...i}}function no(e){return{setResponseStatus:(n)=>{Tr(e,n)},notFound:(n=404)=>{let r=vs(n)&&n>=400?n:404;Tr(e,r)},setResponseHeader:(n,r)=>{Tp(e,n,r)}}}function ll(e,n,r={}){if(!e.includes("@status"))return e;let{filePath:i,buildMode:a}=r,l=a==="compile",u="",f=0,x=/@status\s*\(/g,v;while((v=x.exec(e))!==null){let I=Ip(e,v.index+v[0].length-1);if(I<0)break;let D=e.slice(v.index+v[0].length,I).trim(),W=/^\d+$/.test(D)?Number(D):d(D,n),L=i?` in ${i}`:"";if(l)console.warn(`[stx] @status(${D})${L} 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(!Tr(n,W))console.warn(`[stx] @status(${D})${L} is not an HTTP status (100-599) \u2014 ignoring it.`);u+=e.slice(f,v.index),f=I+1+(e.slice(I+1).match(/^[^\S\n]*\n?/)?.[0].length??0),x.lastIndex=f}return f===0?e:u+e.slice(f)}function Ip(e,n){let r=1,i=null,a=!1;for(let l=n+1;l<e.length;l++){let u=e[l];if(a){a=!1;continue}if(i){if(u==="\\")a=!0;else if(u===i)i=null;continue}if(u==='"'||u==="'"||u==="`"){i=u;continue}if(u==="(")r++;else if(u===")"&&--r===0)return l}return-1}var Ta=new Set(mt),Pp=new Set(["props","$props","defineProps"]),Op=new Set(["stx","@stacksjs/stx"]),Ia=S(128),Pa=S(64);function jp(e){let n=[],r=0,i=e.split(`
|
|
1179
1180
|
`);for(let a of i){let l=r,u=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(u){if(v===u)u=null;continue}if(v==="'"||v==='"'||v==="`"){u=v;continue}if(v==="/"&&x+1<a.length&&a[x+1]==="/")break;if(v==="{")r++;else if(v==="}")r--}if(l===0){let x=a.match(/(?:const|let|var)\s+(\w+)\s*=/);if(x)n.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)n.push(v[1])}else{let v=a.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(v){let D=v[1].slice(1,-1).split(",").map((W)=>{let L=W.split(":");return(L.length>1?L[1]:L[0]).trim()}).filter((W)=>/^\w+$/.test(W));n.push(...D)}}}}return[...new Set(n)]}function Tg(e){let n=e;n=n.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),n=n.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),n=n.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),n=n.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),n=n.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function r(i){if(!i.includes(":"))return i;let a=[],l="",u=0,f=0,x=null;for(let v=0;v<i.length;v++){let I=i[v];if(x){if(l+=I,I===x)x=null;continue}if(I==='"'||I==="'"||I==="`"){x=I,l+=I;continue}if(I==="<")u++;else if(I===">"&&u>0)u--;else if(I==="(")f++;else if(I===")")f--;if(I===","&&u===0&&f===0){a.push(l),l="";continue}l+=I}if(l)a.push(l);return a.map((v)=>{let I=v.trim(),D=I.startsWith("..."),W=D?I.slice(3):I,L=-1,z=0;for(let ne=0;ne<W.length;ne++)if(W[ne]==="<")z++;else if(W[ne]===">")z--;else if(W[ne]===":"&&z===0){L=ne;break}if(L===-1)return v;let H=W.substring(0,L).trim().replace(/\?$/,""),Z=W.substring(L+1),U=-1,V=0;for(let ne=0;ne<Z.length;ne++)if(Z[ne]==="<")V++;else if(Z[ne]===">")V--;else if(Z[ne]==="="&&V===0){U=ne;break}let K=D?"...":"";if(U!==-1)return`${K}${H} = ${Z.substring(U+1).trim()}`;return`${K}${H}`}).join(", ")}n=n.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(i,a,l)=>{if(!l.includes(":"))return i;return`${a}(${r(l)})`});{let i=/\b(function\s+\w*\s*)\(/g,a,l=[];while((a=i.exec(n))!==null){let u=a.index+a[0].length-1,f=1,x=u+1,v=0,I=null;while(x<n.length&&f>0){let L=n[x];if(I){if(L===I)I=null;x++;continue}if(L==='"'||L==="'"||L==="`"){I=L,x++;continue}if(L==="<")v++;else if(L===">"&&v>0)v--;else if(v===0){if(L==="(")f++;else if(L===")")f--}if(f>0)x++}if(f!==0)continue;let D=n.substring(u+1,x);if(!D.includes(":"))continue;let W=r(D);l.push({start:u+1,end:x,replacement:W})}for(let u=l.length-1;u>=0;u--){let{start:f,end:x,replacement:v}=l[u];n=n.substring(0,f)+v+n.substring(x)}}return n=n.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(i,a)=>{if(!a.includes(":"))return i;if(a.includes("{")||a.includes("}"))return i;return`(${a.split(",").map((u)=>{let[f,...x]=u.split("="),v=f.split(":")[0].trim();if(x.length>0)return`${v} = ${x.join("=").trim()}`;return v}).join(", ")}) =>`}),n=n.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"),n=n.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),n=n.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),n=n.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),n=n.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),n=n.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),n=n.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),n=n.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),n=n.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),n=n.replace(/\n\s*\n\s*\n/g,`
|
|
1180
1181
|
|
|
1181
|
-
`),n}function $g(e){return e.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(n,...r)=>{let[,i,a]=r,l=i??a;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(l)?"":n})}function Rg(e){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(e)}function Ag(e){if(e instanceof SyntaxError)return!0;let n=e instanceof Error?e.message:String(e);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(n)}function Pg(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 Oa=new Set;async function h(e,n,r,i={}){if(!e.trim())return;let a=A(),l=
|
|
1182
|
+
`),n}function $g(e){return e.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(n,...r)=>{let[,i,a]=r,l=i??a;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(l)?"":n})}function Rg(e){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(e)}function Ag(e){if(e instanceof SyntaxError)return!0;let n=e instanceof Error?e.message:String(e);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(n)}function Pg(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 Oa=new Set;async function h(e,n,r,i={}){if(!e.trim())return;let a=A(),l=C(e,JSON.stringify(a)),u=Ia.get(l);if(u===void 0){try{let ce=oe({loader:"ts",target:"browser",define:a}),ue=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");ue=ue.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),u=ce.transformSync(ue)}catch{u=Tg(e)}Ia.set(l,u)}let f={exports:{}},x=f.exports,v=on.cwd(),I={},D=[...u.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((ce)=>ce[1]).filter((ce)=>!ce.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(ce)),W=new Map;for(let ce of D)try{if(ce.startsWith(".")){I[ce]=await import(St.resolve(St.dirname(r),ce));continue}let ue=St.resolve(v,"node_modules",ce),_e=St.join(ue,"package.json"),Le=JSON.parse(b("fs").readFileSync(_e,"utf8")),Ze=Le.main||"index.js";if(Le.exports){let rt=typeof Le.exports==="string"?Le.exports:Le.exports["."];if(typeof rt==="string")Ze=rt;else if(rt?.bun)Ze=rt.bun;else if(rt?.import)Ze=rt.import;else if(rt?.default)Ze=rt.default}I[ce]=await import(St.resolve(ue,Ze))}catch(ue){if(ce.startsWith("."))W.set(ce,ue instanceof Error?ue.message:String(ue))}let L=(ce)=>{if(I[ce])return I[ce];let ue=W.get(ce);if(ue!==void 0)throw Error(`Cannot require '${ce}' from ${r}: ${ue}`);return b(ce)},z=n.props||{},N=(ce)=>{if(!ce)return z;let ue={};for(let[_e,Le]of Object.entries(ce)){let Ze=z[_e];if(Ze!==void 0)ue[_e]=Ze;else if(typeof Le==="function")ue[_e]=Le();else ue[_e]=Le}return ue};for(let[ce,ue]of Object.entries(z))Object.defineProperty(N,ce,{value:ue,enumerable:!0,configurable:!0,writable:!0});let H=(ce,ue=!1)=>{if(ce===void 0||ce===null)return ue;if(typeof ce==="string"){let _e=ce.trim().toLowerCase();if(_e===""||_e==="true"||_e==="1"||_e==="on"||_e==="yes")return!0;if(_e==="false"||_e==="0"||_e==="off"||_e==="no")return!1;return!0}return Boolean(ce)},Z=(ce,ue=0)=>{if(ce===void 0||ce===null)return ue;if(typeof ce==="string"){let Le=ce.trim();if(Le==="")return ue;let Ze=Number(Le);return Number.isFinite(Ze)?Ze:ue}let _e=Number(ce);return Number.isFinite(_e)?_e:ue};for(let ce of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(z,ce))continue;try{Object.defineProperty(N,ce,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let U=(ce)=>{if(!ce)return z;let ue={...z};for(let[_e,Le]of Object.entries(ce)){let Ze=Le&&typeof Le==="object"&&!Array.isArray(Le)?Le:{type:Le};if(ue[_e]===void 0&&Ze.default!==void 0)ue[_e]=typeof Ze.default==="function"?Ze.default():Ze.default}return ue},V=()=>n.slots||{},K=(ce,ue)=>{let _e={...ce};for(let[Le,Ze]of Object.entries(ue))if(_e[Le]===void 0)if(typeof Ze==="function")_e[Le]=Ze();else _e[Le]=Ze;return _e},ne=(ce)=>{let ue=()=>ce;return ue.set=(_e)=>{},ue.update=(_e)=>{},ue},ae=(ce)=>{let ue,_e=!1;return()=>{if(!_e)try{ue=ce(),_e=!0}catch{ue=void 0}return ue}},de=(ce)=>{},pe=(ce)=>ce(),Ee=(ce)=>{},Ce=(ce)=>{},$e=no(n);function ye(ce){let ue=ce||{};if(ue.title!==void 0||ue.description!==void 0)ht({title:ue.title,description:ue.description})}function He(ce){if(!ce||typeof ce!=="object")return;let ue=n.__stxClientPayload??{};Object.assign(ue,ce),n.__stxClientPayload=ue}let tt=()=>{let ce=n.__stxServeContext,ue=n.__stxServeSearch??ce?.search??"",_e=ce?.path??"",Le=Object.fromEntries(new URLSearchParams(ue)),Ze=n.query,rt=Object.keys(Le).length>0?Le:Ze??{},yt=ue||(Object.keys(rt).length>0?`?${new URLSearchParams(rt).toString()}`:"");return{params:n.params??{},query:rt,path:_e,name:"",fullPath:_e+yt,hash:"",matched:[]}},ct=()=>({push:(ce)=>{},replace:(ce)=>{},back:()=>{},forward:()=>{},go:(ce)=>{}}),nt=(ce)=>{let ue=n.__stx_runtime_head||{};n.__stx_runtime_head=Qe(ue,Me(ce||{},{known:fo,source:"useHead()"}))},ht=(ce)=>{nt(go(ce||{}))},ut=(ce)=>({value:ce}),st=(ce)=>ce,Ot=(ce)=>({value:typeof ce==="function"?ce():ce}),je=(ce,ue)=>{},Te=(ce)=>{},pt=(ce)=>{},et=(ce)=>ce?ce():Promise.resolve(),an=(ce)=>(ue,..._e)=>{},At=(ce)=>{},xt=(ce,ue)=>{},cn=(ce,ue)=>ue,$s=()=>({value:"light"}),Ft=()=>ne(!1),vt=(ce)=>ne(!1),ln=()=>ne(!1),zn=()=>vt("(prefers-color-scheme: dark)"),un=()=>vt("(prefers-color-scheme: light)"),pn=()=>vt("(prefers-reduced-motion: reduce)"),Wr=()=>vt("(prefers-contrast: more)"),bt={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:{}},fn=new Proxy(bt,{get(ce,ue){if(ue in ce)return ce[ue];return},set(ce,ue,_e){return ce[ue]=_e,!0}}),Es={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},$t=console;try{let ce=Di(u,r),ue=new Set(Object.keys(z)),_e=Object.keys(n).filter((le)=>!ue.has(le)&&!Pp.has(le)&&Xt(le)),Le=_e.map((le)=>n[le]);if(!_e.includes("__stxServeContext"))_e.push("__stxServeContext"),Le.push(void 0);if(!ue.has("cookies")){let le=n.cookies??n.__stxServeContext?.cookies??{},be=_e.indexOf("cookies");if(be<0)_e.push("cookies"),Le.push(le);else Le[be]=le}let Ze=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),rt=[],yt=[];for(let[le,be]of Object.entries(z)){if(!Xt(le))continue;if(Ze.has(le))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${le}\\b`).test(ce))continue;rt.push(le),yt.push(be)}let Cs=jp(ce).map((le)=>`module.exports.${le} = typeof ${le} !== 'undefined' ? ${le} : module.exports.${le};`).join(`
|
|
1182
1183
|
`),Bn=n.params??{},dn=[],gn=[];for(let le=0;le<_e.length;le++){if(_e[le]==="params")continue;dn.push(_e[le]),gn.push(Le[le])}let Wn=[...mt,...rt,...dn],Fn=`return (async () => {
|
|
1183
1184
|
${ce}
|
|
1184
1185
|
${Cs}
|
|
1185
1186
|
return module.exports
|
|
1186
|
-
})()`,Et=
|
|
1187
|
+
})()`,Et=C(Fn,Wn.join("\x00")),Tt=Pa.get(Et);if(!Tt)Tt=Function(...Wn,Fn),Pa.set(Et,Tt);let kt=n.__stx_options?.runtimeConfig;if(kt||/\buse(?:Server)?RuntimeConfig\b/.test(u))await On(n,r,kt);let it=await Ye(n.__stx_runtime_config??Nn()??F(),()=>Xr(n,()=>Tt(f,x,L,z,N,H,Z,U,K,He,Gr,Ui,ao,ne,ae,de,pe,Ee,Ce,ye,tt,ct,nt,ht,$e.setResponseStatus,$e.setResponseHeader,$e.notFound,ut,st,Ot,je,Te,pt,et,an,At,V,xt,cn,$s,Ft,vt,ln,zn,un,pn,Wr,fn,Es,$t,bt.confirm,bt.alert,bt.fetch,Bn,...yt,...gn)));if(i.preserveExisting){for(let[le,be]of Object.entries(it))if(!(le in n)||n[le]===void 0)n[le]=be}else Object.assign(n,it);for(let[le,be]of Object.entries(z))if(!(le in n))n[le]=be}catch(ce){if(n.__stx_strict_hydration)throw ce;let ue=$g(ce instanceof Error?ce.message:String(ce));if(Rg(ue))console.warn(`[stx] server <script> in ${r??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${ue}`),i.onFailure?.({kind:"module-resolution",message:ue,error:ce});else if(Ag(ce))console.warn(`[stx] server <script> in ${r??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${ue}`),i.onFailure?.({kind:"syntax",message:ue,error:ce});else if(Pg(ue))console.warn(`[stx] server <script> in ${r??"<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: ${ue}`),i.onFailure?.({kind:"missing-binding",message:ue,error:ce});else{let _e=`${r??"<unknown>"}\x00${ue}`;if(on.env.STX_DEBUG||!Oa.has(_e))Oa.add(_e),console.warn(`[stx] server <script> in ${r??"<unknown>"} threw, so every variable in that script is undefined and anything that reads one renders empty. Cause: ${ue}`);i.onFailure?.({kind:"unknown",message:ue,error:ce})}try{await Bp(u,n,r)}catch(_e){if(on.env.STX_DEBUG){let Le=_e instanceof Error?_e.message:String(_e);console.warn(`[stx] fallback extraction also failed in ${r??"<unknown>"}: ${Le}`)}}}}function Ig(e){let n=0,r=null,i=!1,a=!1;for(let l=0;l<e.length;l++){let u=e[l];if(r){if(u===r){if(r=null,i||n===0)a=!0}continue}if(u==="'"||u==='"'||u==="`"){r=u;continue}if(u==="{")n++;else if(u==="}")n--;else if(e.startsWith("from",l)&&n===0)i=!0}return r===null&&n===0&&a}var Mp=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function Di(e,n){let r=n?St.dirname(n):on.cwd(),i=on.cwd(),a=e.split(`
|
|
1187
1188
|
`),l=[],u=0;while(u<a.length){let f=a[u].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(;u<a.length;u++){for(let v of a[u])if(v==="{")x++;else if(v==="}")x--;if(x<=0)break}}u++;continue}if(f.startsWith("definePageMeta(")){let x=0,v=!1,I=u;for(let L=u;L<a.length&&!v;L++){let z=null,N=!1,H=a[L];for(let Z=0;Z<H.length;Z++){let U=H[Z];if(N){N=!1;continue}if(U==="\\"){N=!0;continue}if(z){if(U===z)z=null;continue}if(U==='"'||U==="'"||U==="`"){z=U;continue}if(U==="(")x++;else if(U===")"){if(x--,x===0){u=L+1,v=!0;break}}}}if(!v)u=a.length;let D=a.slice(I,u).join(`
|
|
1188
1189
|
`),W=[];for(let L of["title","description"]){let z=new RegExp(`\\b${L}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(D);if(z)W.push(`${L}: ${JSON.stringify(z[2])}`)}if(W.length>0)l.push(`useSeoMeta({ ${W.join(", ")} });`);continue}if(f.startsWith("import ")||f==="import"||f.startsWith("import{")||/^import['"]/.test(f)){let x=f,v=0;while(!Ig(x)&&u+v+1<a.length)v++,x=`${x} ${a[u+v].trim()}`;u+=v;let I=x.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),D=x.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),W=x.match(/^import\s*['"](.+?)['"]/),L=x,z=(N)=>{if(N.startsWith("."))return St.resolve(r,N);if(N.startsWith("~/")||N.startsWith("@/"))return St.resolve(i,N.slice(2));try{return Bun.resolveSync(N,r)}catch{return N}};if(I){let[,N,H]=I,Z=z(H);l.push(`const ${N} = (await import('${Z}')).default`),l.push(`module.exports.${N} = ${N};`)}else if(D){let[,N,H]=D,Z=z(H),U=[],V=[],K=Op.has(H);for(let ne of N.split(",")){let ae=ne.trim();if(!ae)continue;let de=ae.split(/\s+as\s+/);if(de.length===2){let[pe,Ee]=[de[0].trim(),de[1].trim()];if(K&&Ta.has(pe)){l.push(`const ${Ee} = ${pe};`);continue}U.push(`${pe}: ${Ee}`),V.push(Ee)}else{if(K&&Ta.has(ae))continue;U.push(ae),V.push(ae)}}if(U.length>0)l.push(`const { ${U.join(", ")} } = await import('${Z}')`);for(let ne of V)l.push(`module.exports.${ne} = ${ne};`)}else if(W){let N=z(W[1]);l.push(`await import('${N}')`)}else l.push(L);u++;continue}if(Mp.test(f))l.push(a[u]),u++;else if(f.startsWith("export const ")||f.startsWith("export let ")||f.startsWith("export var ")){let x=Ma(a,u),{type:v,name:I,value:D}=x;l.push(`${v} ${I} = ${D};`),l.push(`module.exports.${I} = ${I};`),u=x.nextIndex}else if(f.startsWith("export function ")||f.startsWith("export async function ")){let x=Br(a,u);l.push(x.functionCode),l.push(`module.exports.${x.name} = ${x.name};`),u=x.nextIndex}else if(f.startsWith("const ")||f.startsWith("let ")||f.startsWith("var ")){let x=Ma(a,u),{type:v,name:I,value:D}=x;l.push(`${v} ${I} = ${D};`),l.push(`module.exports.${I} = ${I};`),u=x.nextIndex}else if(f.startsWith("function ")||f.startsWith("async function ")){let x=Br(a,u);l.push(x.functionCode),l.push(`module.exports.${x.name} = ${x.name};`),u=x.nextIndex}else if(f.startsWith("export default function ")||f.startsWith("export default async function ")){let x=a[u].replace(/^(\s*)export\s+default\s+/,"$1"),v=[...a];v[u]=x;let I=Br(v,u);if(l.push(I.functionCode),I.name)l.push(`module.exports.default = ${I.name};`);u=I.nextIndex}else if(f.startsWith("export default ")){let x=f.replace(/^export\s+default\s+/,"").replace(/;$/,"");l.push(`module.exports.default = ${x};`),u++}else if(f.startsWith("class ")||f.startsWith("export class ")){let x=f.match(/(?:export\s+)?class\s+(\w+)/);if(x){let v=x[1],I=a[u].replace(/^export\s+/,""),D=0,W=u;for(;W<a.length;W++){let L=a[W];for(let z of L)if(z==="{")D++;else if(z==="}")D--;if(W>u)I+=`
|
|
1189
1190
|
`+L;if(D<=0&&W>=u)break}l.push(I),l.push(`module.exports.${v} = ${v};`),u=W+1}else l.push(f),u++}else if(f.includes("module.exports"))l.push(f),u++;else if(f.trim()&&!f.startsWith("//"))l.push(f),u++;else u++}return Dp(l.join(`
|
|
@@ -1195,4 +1196,4 @@ ${e[v]}`,v++;else break}return x=x.trim().replace(/;$/,""),{type:l,name:u,value:
|
|
|
1195
1196
|
${l}`,a++}while(a<e.length){let l=e[a].trim();if(l.startsWith(".")||l.startsWith("?."))i+=`
|
|
1196
1197
|
${e[a]}`,a++;else break}return{value:i,nextIndex:a}}function zp(e,n,r){let i=r,a=n+1;while(a<e.length){let l=Fa(i);if(l!==-1){if(k(i,"{","}",l)!==-1)break}let u=e[a];i+=`
|
|
1197
1198
|
${u}`,a++}return{functionCode:i,nextIndex:a}}function La(e,n){let r=d(e,n)??d(`(${e})`,n);if(r!==void 0)return r;if(!/\bprocess\b/.test(e))return;let i={...n,process:Object.freeze({env:{...on.env}})},a=Object.keys(i).filter(Xt),l=a.map((u)=>i[u]);try{return Function(...a,`'use strict'; return (${e});`)(...l)}catch{try{return Function(...a,`'use strict'; return ${e};`)(...l)}catch{return}}}async function Bp(e,n,r){let i=e.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let l of i){let[,,u,f]=l;try{let x=f.trim().replace(/;$/,""),v=La(x,n);if(v!==void 0)n[u]=v}catch(x){console.warn(`Failed to parse export ${u} 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 l of a){let[,,u,f]=l;if(!(u in n))try{let x=f.trim().replace(/;$/,""),v=La(x,n);if(v!==void 0)n[u]=v}catch{}}}function hl(e){let n=e.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),r=n?n[1]:"",i=n?e.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):e;return{scriptContent:r,templateWithoutScript:i}}function yl(e){let n=e.trim();if(!n)return!1;return/(?:const|let|var|function)\s+\w+/.test(n)}
|
|
1198
|
-
export{Ve,Re,G,Ws,qs,X,Ar,Ks,Gs,_i,Ci,Ei,Xs,Ti,Qc,zt,o,ge,S,el,
|
|
1199
|
+
export{Ve,Re,G,Ws,qs,X,Ar,Ks,Gs,_i,Ci,Ei,Xs,Ti,Qc,zt,o,ge,S,el,C,Pr,Js,Ae,A,Ue,j,Ht,Pe,Q,_n,We,w,tl,xe,re,Ir,Ie,Or,Nr,me,Vt,se,B,gt,J,Mr,Dr,mt,nl,Ut,Ys,Zs,Se,$i,Cn,Qs,he,rl,sl,Ri,ol,Ai,il,eo,Pi,Ii,al,Oi,Ni,En,to,Tn,Wt,qt,cl,no,ll,ul,$n,Lr,ro,so,dl,Mi,pl,fl,gl,ml,Tg,$g,Rg,Ag,Pg,h,Ig,Di,Og,hl,yl,Li,ji,Ng,Kt,bl,Mg,wl,Cy,qe,Rn,Ke,Dg,Lg,jg,Bg,Fg,oo,zg,Ge,oe,Xe,Hg,jr,Vg,vl,xl,Bi,Je,s,An,Sl,y,ke,Ey,kl,_l,Cl,Fi,io,Ug,Ty,Wg,$y,Pn,g,Y,ie,In,Oe,qg,zi,Kg,Ry,P,Hi,Gg,Ay,O,Py};
|