@stacksjs/stx 0.2.899 → 0.2.900
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-h2gnz7ja.js → chunk-04y5dmrd.js} +1 -1
- package/dist/chunk-0cn37c8d.js +2 -0
- package/dist/{chunk-ft9h5qbs.js → chunk-0mkwzn5j.js} +1 -1
- package/dist/{chunk-6hjcqaqr.js → chunk-1y8mazr5.js} +1 -1
- package/dist/{chunk-3k4rteax.js → chunk-219eyehn.js} +1 -1
- package/dist/{chunk-eka2e4cm.js → chunk-2banqeqd.js} +1 -1
- package/dist/{chunk-javb4e3b.js → chunk-2d6yne48.js} +2 -2
- package/dist/{chunk-4jtewn1v.js → chunk-3bxsf2je.js} +1 -1
- package/dist/{chunk-becs8132.js → chunk-4ad47zef.js} +1 -1
- package/dist/chunk-4c2wsbw0.js +2 -0
- package/dist/{chunk-b6ctdvdf.js → chunk-4dzn95wr.js} +2 -2
- package/dist/{chunk-40fpt0r6.js → chunk-4jtx5996.js} +2 -2
- package/dist/chunk-4zeydjkp.js +2 -0
- package/dist/{chunk-8rgy17fj.js → chunk-56g17qhz.js} +2 -2
- package/dist/{chunk-ytk4f2j9.js → chunk-5z0jmmkk.js} +1 -1
- package/dist/{chunk-dj8fyaea.js → chunk-6hvjh6yc.js} +1 -1
- package/dist/{chunk-pd31ge72.js → chunk-6qjycee4.js} +1 -1
- package/dist/{chunk-g065d7p7.js → chunk-6zqj4cym.js} +1 -1
- package/dist/{chunk-q4yq72wh.js → chunk-79kr4fq6.js} +1 -1
- package/dist/{chunk-jq49238b.js → chunk-7jptw1pa.js} +1 -1
- package/dist/chunk-7s7e5zs5.js +2 -0
- package/dist/{chunk-q6p96qq7.js → chunk-8d0m37zy.js} +4 -4
- package/dist/{chunk-tga3nrn6.js → chunk-8jdvpbbc.js} +2 -2
- package/dist/{chunk-p4hm5srd.js → chunk-8xvt2m5s.js} +1 -1
- package/dist/{chunk-vgvxs1ag.js → chunk-9e3g1hbx.js} +1 -1
- package/dist/{chunk-4wd5sn16.js → chunk-9wsmkfhz.js} +3 -3
- package/dist/chunk-a6ayk6vc.js +2 -0
- package/dist/{chunk-avqxkbrd.js → chunk-aj94z67v.js} +1 -1
- package/dist/{chunk-9m45t60c.js → chunk-ayhh7b6f.js} +6 -6
- package/dist/{chunk-472w7t7p.js → chunk-b7rxqt0z.js} +1 -1
- package/dist/{chunk-mjqsz20a.js → chunk-c8af9sh0.js} +1 -1
- package/dist/{chunk-2vqamyay.js → chunk-dmydyd5j.js} +1 -1
- package/dist/{chunk-70ez3njv.js → chunk-ett9thrc.js} +1 -1
- package/dist/{chunk-v5v6w6rn.js → chunk-g227deyj.js} +1 -1
- package/dist/chunk-g47cwnx4.js +3 -0
- package/dist/{chunk-gq3gttt5.js → chunk-gyzzxqh8.js} +5 -5
- package/dist/{chunk-n8xjqsze.js → chunk-h2ydchz3.js} +1 -1
- package/dist/{chunk-9n5san33.js → chunk-hqn3s226.js} +1 -1
- package/dist/{chunk-3my2eef2.js → chunk-hydbch0w.js} +1 -1
- package/dist/{chunk-9jpsxqaf.js → chunk-jcdctrj2.js} +1 -1
- package/dist/{chunk-65rx54n6.js → chunk-jcec7r3g.js} +1 -1
- package/dist/{chunk-k352spys.js → chunk-jvxbcrha.js} +1 -1
- package/dist/chunk-kxfskbc8.js +2 -0
- package/dist/{chunk-rrpfn9rr.js → chunk-kxjztx5b.js} +1 -1
- package/dist/{chunk-bmwcgmev.js → chunk-kywhdtzt.js} +1 -1
- package/dist/{chunk-r9n86na1.js → chunk-mjqa2e8d.js} +4 -4
- package/dist/{chunk-36mz0nwv.js → chunk-n5zb7ha5.js} +1 -1
- package/dist/{chunk-e0bwzxfd.js → chunk-nkgkctpe.js} +4 -4
- package/dist/{chunk-rapr0m13.js → chunk-nq7nykq9.js} +1 -1
- package/dist/{chunk-0f2d61b3.js → chunk-q94cp86y.js} +1 -1
- package/dist/{chunk-e4xd1ca7.js → chunk-r04wx2c1.js} +1 -1
- package/dist/{chunk-e5q1ammf.js → chunk-rsvjnj3k.js} +1 -1
- package/dist/{chunk-d1bwb2kz.js → chunk-sfbdpsee.js} +1 -1
- package/dist/{chunk-7z1hqp86.js → chunk-sk0hje4f.js} +1 -1
- package/dist/{chunk-8v2hsn4d.js → chunk-svx4s83s.js} +1 -1
- package/dist/{chunk-fsxk5fsh.js → chunk-syh0s7he.js} +2 -2
- package/dist/chunk-tgq24t9b.js +2 -0
- package/dist/chunk-v2mme2zb.js +2 -0
- package/dist/{chunk-hpqvq1r9.js → chunk-vmh5zd0t.js} +1 -1
- package/dist/{chunk-4e28p8vf.js → chunk-w3vwv1yp.js} +4 -4
- package/dist/{chunk-fe1wmmr5.js → chunk-ww4wxxx5.js} +1 -1
- package/dist/{chunk-cgqpn3e2.js → chunk-x7s2y8gc.js} +1 -1
- package/dist/{chunk-1tb18a92.js → chunk-xysxzj69.js} +1 -1
- package/dist/{chunk-73nazfe5.js → chunk-yeaz44dq.js} +1 -1
- package/dist/cli.js +7 -7
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/native/runtime/craft-bridge.js +17 -3
- package/dist/native/runtime/craft.d.ts +1 -0
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-3m37fzvh.js +0 -2
- package/dist/chunk-8a9gmbxa.js +0 -2
- package/dist/chunk-9vafweyd.js +0 -3
- package/dist/chunk-psyqrxg0.js +0 -2
- package/dist/chunk-ryp47rwp.js +0 -2
- package/dist/chunk-t9j000tb.js +0 -2
- package/dist/chunk-y10eaxgc.js +0 -2
- package/dist/chunk-zcys6b06.js +0 -2
- package/dist/chunk-zpwh9bpc.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ze,Dn,po,Gi,z}from"./chunk-esm0pnpz.js";import{Mn}from"./chunk-472w7t7p.js";import{Yr,C,Fl,xt,na,zl}from"./chunk-hdfhaddy.js";import{D}from"./chunk-7b3dqeyr.js";import{T,R}from"./chunk-0jdz31q1.js";import{Jr,wo,zn,Ll,Le}from"./chunk-5g5khx0m.js";import{fo,d,m,Hr,p,te,K,be,_,bt,yo,De,et,bo}from"./chunk-945zygwa.js";import{w}from"./chunk-v6gkjg5f.js";import{ne}from"./chunk-qykbjg3z.js";import{t,h}from"./chunk-68r2zs20.js";import{c}from"./chunk-p92272k0.js";import Ct from"path";import un from"process";import{AsyncLocalStorage as sc}from"async_hooks";var ti=new sc;function An(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function ni(e,n){return ti.run(An(e),n)}async function si(e,n){let r=ti.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,(v,S)=>{if(S===void 0||typeof S==="function"||typeof S==="symbol"||typeof S==="bigint"||typeof S==="number"&&!Number.isFinite(S))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(S&&typeof S==="object"&&!Array.isArray(S)&&Object.getPrototypeOf(S)!==Object.prototype&&Object.getPrototypeOf(S)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return S}),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 Fr(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 X(e,n=!1){let r=t(e),i=[],a=new Set,l=0,u=0,f=r.length,v=()=>{if(l!==0)return;let S=r.slice(u).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(S){if(n&&S[1]==="const")return;let V=S[2];if(!a.has(V))i.push(V),a.add(V);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((V)=>{let W=V.trim();if(!W)return;let Z=W.indexOf(":"),G=(Z>=0?W.slice(Z+1).trim():W).split(/[\s=]/)[0];if(G&&!a.has(G))i.push(G),a.add(G)});return}let j=r.slice(u).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(j){if(n&&r.slice(u).startsWith("const"))return;j[1].split(",").forEach((V)=>{let W=V.trim().replace(/^\.\.\./,"");if(!W)return;let Z=W.split(/[\s=]/)[0];if(Z&&!a.has(Z))i.push(Z),a.add(Z)});return}if(n)return;let L=r.slice(u).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let V=L[1];if(!a.has(V))i.push(V),a.add(V);return}let M=r.slice(u).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(M){let V=M[1];if(!a.has(V))i.push(V),a.add(V)}};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])))v();u++}return i.join(", ")}function Xs(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function rc(e,n=X(e).split(",").map((r)=>r.trim()).filter(Boolean)){let r=new Set(X(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 Js(e,n){let r=`{ ${rc(e,n)} }`;return X(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${r}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:r}import sn from"fs";import Ve from"path";function J(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var ri=new Map;function Or(e,n=!0){let r=ri.get(e);if(n&&r)return r;let i=new Map,a=[Ve.join(e,"src"),Ve.join(e,"dist"),e];function l(u,f){if(f>6)return;let v;try{v=sn.readdirSync(u,{withFileTypes:!0})}catch{return}for(let S of v){let I=Ve.join(u,S.name);if(S.isDirectory()){if(S.name==="node_modules"||S.name.startsWith("."))continue;l(I,f+1)}else if(S.isFile()&&S.name.endsWith(".stx")){let j=S.name.slice(0,-4);if(!i.has(j))i.set(j,I);let L=j.toLowerCase();if(!i.has(L))i.set(L,I);let M=J(j);if(!i.has(M))i.set(M,I)}}}for(let u of a)if(l(u,0),i.size>0)break;if(n)ri.set(e,i);return i}function Ys(e,n){if(e.startsWith(".")||e.startsWith("/"))return null;let r=n;while(!0){let i=Ve.join(r,"node_modules",e);try{if(sn.statSync(i).isDirectory())return i}catch{}let a=Ve.dirname(r);if(a===r)return null;r=a}}function Zs(e,n,r={}){return[Ve.resolve(Ve.dirname(n),`${e}.stx`),Ve.resolve(Ve.dirname(n),e),Ve.resolve(r.componentsDir||"components",`${e}.stx`),Ve.resolve(r.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function ii(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=J(n);return[n,r,i]}function $i(e,n){let[r,i,a]=ii(e);for(let l of[r,r.toLowerCase(),i,a]){let u=n?.__importedComponents?.get(l);if(u!==void 0)return u}}function Ri(e,n){let r=n?Ve.resolve(n):void 0,i=Ve.dirname(Ve.resolve(e));for(;;){if(sn.existsSync(Ve.join(i,"package.json")))return r&&i===r?void 0:i;let a=Ve.dirname(i);if(a===i)return;i=a}}var ic=["src/ui","src/components","components","dist"];function rs(e,n){let r=Ve.resolve(e);if(!n&&!r.split(Ve.sep).includes("node_modules"))return[];let i=Ri(r,n);if(!i)return[];let a=[];try{let f=JSON.parse(sn.readFileSync(Ve.join(i,"package.json"),"utf8")).stx?.components;if(Array.isArray(f))a=f.filter((v)=>typeof v==="string")}catch{}let l=a.length?a:ic;return[Ve.dirname(Ve.resolve(e)),...l.map((u)=>Ve.resolve(i,u))]}function*Ai(e,n,r={},i){let a=ii(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield Ve.resolve(Ve.dirname(n),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],u=r.projectRoot||process.cwd(),f=[...rs(n,r.projectRoot),...i?.__originalFilePath?[Ve.join(Ve.dirname(i.__originalFilePath),"components")]:[],...r.componentsDir?[r.componentsDir]:[],Ve.join(Ve.dirname(n),"components"),Ve.resolve(u,"src/components"),Ve.resolve(u,"components"),...import.meta.dir?[Ve.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(f)){for(let S of l)yield Ve.join(v,S);try{for(let S of sn.readdirSync(v,{withFileTypes:!0}))if(S.isDirectory())for(let I of l)yield Ve.join(v,S.name,I)}catch{}}}function oi(e,n,r={},i){let a=$i(e,i);if(a!==void 0)return a;for(let l of Ai(e,n,r,i))try{if(sn.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Qs(e,n=[],r={}){let i=new Set([...e].map((S)=>S.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(([S,I])=>[S.replace(/[-_]/g,"").toLowerCase(),I])),l=a.get("alt"),u=a.get("decorative"),f=typeof l==="string"&&!!l.trim(),v=typeof u==="string"?!["false","0","off","no"].includes(u.trim().toLowerCase()):Boolean(u);if(!f&&!v)return!1;if(["defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((S)=>i.has(S)))return!1;if([...n].some((S)=>!["load","error"].includes(S.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((S)=>i.has(S))}import Is from"fs";import xe from"path";import Bt from"path";import _n from"fs";var oc=new Set(["touchstart","touchmove","wheel","mousewheel"]);function Us(e,n){if(n.passive)return!0;if(n.prevent||n.nonpassive)return!1;return oc.has(e.toLowerCase())}var ai=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"]),ci={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"},ac=new Set(["ctrl","alt","shift","meta"]),pi={left:0,middle:1,right:2};function li(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(ac.has(i))n.systemKeys.push(i);else if(i in pi)n.mouse=i;else if(i in ci||/^[a-z]$/.test(i))n.keys.push(ci[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 fi(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,v]=l,S=l.index,I=S+u.length,j=`__stx_evt_${n}${i++}`,L=[],M=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,V;while((V=M.exec(v))!==null){let[,Z,q]=V,G=Z.split("."),U=G[0];if(!ai.has(U))continue;L.push({attribute:`@${Z}`,event:U,handler:q,modifiers:li(G.slice(1)),elementId:j})}let W=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((V=W.exec(v))!==null){let[,Z,q]=V,G=Z.split("."),U=G[0];if(!ai.has(U))continue;L.push({attribute:`@${Z}`,event:U,handler:q,modifiers:li(G.slice(1)),elementId:j})}if(L.length>0)r.push({originalTag:u,elementId:j,events:L,startIndex:S,endIndex:I})}return r}function cc(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=pi[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 lc(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 Hs(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 uc(e){let{modifiers:n}=e,r=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=cc(e),a=lc(Hs(e.handler),n),l=[];if(n.once)l.push("once: true");if(n.capture)l.push("capture: true");if(Us(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{Ze,Dn,po,Gi,z}from"./chunk-esm0pnpz.js";import{Mn}from"./chunk-b7rxqt0z.js";import{Yr,C,Fl,xt,na,zl}from"./chunk-hdfhaddy.js";import{D}from"./chunk-7b3dqeyr.js";import{T,R}from"./chunk-0jdz31q1.js";import{Jr,wo,zn,Ll,Le}from"./chunk-5g5khx0m.js";import{fo,d,m,Hr,p,te,K,be,_,bt,yo,De,et,bo}from"./chunk-945zygwa.js";import{w}from"./chunk-v6gkjg5f.js";import{ne}from"./chunk-qykbjg3z.js";import{t,h}from"./chunk-68r2zs20.js";import{c}from"./chunk-p92272k0.js";import Ct from"path";import un from"process";import{AsyncLocalStorage as sc}from"async_hooks";var ti=new sc;function An(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function ni(e,n){return ti.run(An(e),n)}async function si(e,n){let r=ti.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,(v,S)=>{if(S===void 0||typeof S==="function"||typeof S==="symbol"||typeof S==="bigint"||typeof S==="number"&&!Number.isFinite(S))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(S&&typeof S==="object"&&!Array.isArray(S)&&Object.getPrototypeOf(S)!==Object.prototype&&Object.getPrototypeOf(S)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return S}),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 Fr(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 X(e,n=!1){let r=t(e),i=[],a=new Set,l=0,u=0,f=r.length,v=()=>{if(l!==0)return;let S=r.slice(u).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(S){if(n&&S[1]==="const")return;let V=S[2];if(!a.has(V))i.push(V),a.add(V);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((V)=>{let W=V.trim();if(!W)return;let Z=W.indexOf(":"),G=(Z>=0?W.slice(Z+1).trim():W).split(/[\s=]/)[0];if(G&&!a.has(G))i.push(G),a.add(G)});return}let j=r.slice(u).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(j){if(n&&r.slice(u).startsWith("const"))return;j[1].split(",").forEach((V)=>{let W=V.trim().replace(/^\.\.\./,"");if(!W)return;let Z=W.split(/[\s=]/)[0];if(Z&&!a.has(Z))i.push(Z),a.add(Z)});return}if(n)return;let L=r.slice(u).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let V=L[1];if(!a.has(V))i.push(V),a.add(V);return}let M=r.slice(u).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(M){let V=M[1];if(!a.has(V))i.push(V),a.add(V)}};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])))v();u++}return i.join(", ")}function Xs(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function rc(e,n=X(e).split(",").map((r)=>r.trim()).filter(Boolean)){let r=new Set(X(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 Js(e,n){let r=`{ ${rc(e,n)} }`;return X(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${r}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:r}import sn from"fs";import Ve from"path";function J(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var ri=new Map;function Or(e,n=!0){let r=ri.get(e);if(n&&r)return r;let i=new Map,a=[Ve.join(e,"src"),Ve.join(e,"dist"),e];function l(u,f){if(f>6)return;let v;try{v=sn.readdirSync(u,{withFileTypes:!0})}catch{return}for(let S of v){let I=Ve.join(u,S.name);if(S.isDirectory()){if(S.name==="node_modules"||S.name.startsWith("."))continue;l(I,f+1)}else if(S.isFile()&&S.name.endsWith(".stx")){let j=S.name.slice(0,-4);if(!i.has(j))i.set(j,I);let L=j.toLowerCase();if(!i.has(L))i.set(L,I);let M=J(j);if(!i.has(M))i.set(M,I)}}}for(let u of a)if(l(u,0),i.size>0)break;if(n)ri.set(e,i);return i}function Ys(e,n){if(e.startsWith(".")||e.startsWith("/"))return null;let r=n;while(!0){let i=Ve.join(r,"node_modules",e);try{if(sn.statSync(i).isDirectory())return i}catch{}let a=Ve.dirname(r);if(a===r)return null;r=a}}function Zs(e,n,r={}){return[Ve.resolve(Ve.dirname(n),`${e}.stx`),Ve.resolve(Ve.dirname(n),e),Ve.resolve(r.componentsDir||"components",`${e}.stx`),Ve.resolve(r.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function ii(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=J(n);return[n,r,i]}function $i(e,n){let[r,i,a]=ii(e);for(let l of[r,r.toLowerCase(),i,a]){let u=n?.__importedComponents?.get(l);if(u!==void 0)return u}}function Ri(e,n){let r=n?Ve.resolve(n):void 0,i=Ve.dirname(Ve.resolve(e));for(;;){if(sn.existsSync(Ve.join(i,"package.json")))return r&&i===r?void 0:i;let a=Ve.dirname(i);if(a===i)return;i=a}}var ic=["src/ui","src/components","components","dist"];function rs(e,n){let r=Ve.resolve(e);if(!n&&!r.split(Ve.sep).includes("node_modules"))return[];let i=Ri(r,n);if(!i)return[];let a=[];try{let f=JSON.parse(sn.readFileSync(Ve.join(i,"package.json"),"utf8")).stx?.components;if(Array.isArray(f))a=f.filter((v)=>typeof v==="string")}catch{}let l=a.length?a:ic;return[Ve.dirname(Ve.resolve(e)),...l.map((u)=>Ve.resolve(i,u))]}function*Ai(e,n,r={},i){let a=ii(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield Ve.resolve(Ve.dirname(n),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],u=r.projectRoot||process.cwd(),f=[...rs(n,r.projectRoot),...i?.__originalFilePath?[Ve.join(Ve.dirname(i.__originalFilePath),"components")]:[],...r.componentsDir?[r.componentsDir]:[],Ve.join(Ve.dirname(n),"components"),Ve.resolve(u,"src/components"),Ve.resolve(u,"components"),...import.meta.dir?[Ve.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(f)){for(let S of l)yield Ve.join(v,S);try{for(let S of sn.readdirSync(v,{withFileTypes:!0}))if(S.isDirectory())for(let I of l)yield Ve.join(v,S.name,I)}catch{}}}function oi(e,n,r={},i){let a=$i(e,i);if(a!==void 0)return a;for(let l of Ai(e,n,r,i))try{if(sn.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Qs(e,n=[],r={}){let i=new Set([...e].map((S)=>S.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(([S,I])=>[S.replace(/[-_]/g,"").toLowerCase(),I])),l=a.get("alt"),u=a.get("decorative"),f=typeof l==="string"&&!!l.trim(),v=typeof u==="string"?!["false","0","off","no"].includes(u.trim().toLowerCase()):Boolean(u);if(!f&&!v)return!1;if(["defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((S)=>i.has(S)))return!1;if([...n].some((S)=>!["load","error"].includes(S.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((S)=>i.has(S))}import Is from"fs";import xe from"path";import Bt from"path";import _n from"fs";var oc=new Set(["touchstart","touchmove","wheel","mousewheel"]);function Us(e,n){if(n.passive)return!0;if(n.prevent||n.nonpassive)return!1;return oc.has(e.toLowerCase())}var ai=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"]),ci={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"},ac=new Set(["ctrl","alt","shift","meta"]),pi={left:0,middle:1,right:2};function li(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(ac.has(i))n.systemKeys.push(i);else if(i in pi)n.mouse=i;else if(i in ci||/^[a-z]$/.test(i))n.keys.push(ci[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 fi(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,v]=l,S=l.index,I=S+u.length,j=`__stx_evt_${n}${i++}`,L=[],M=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,V;while((V=M.exec(v))!==null){let[,Z,q]=V,G=Z.split("."),U=G[0];if(!ai.has(U))continue;L.push({attribute:`@${Z}`,event:U,handler:q,modifiers:li(G.slice(1)),elementId:j})}let W=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((V=W.exec(v))!==null){let[,Z,q]=V,G=Z.split("."),U=G[0];if(!ai.has(U))continue;L.push({attribute:`@${Z}`,event:U,handler:q,modifiers:li(G.slice(1)),elementId:j})}if(L.length>0)r.push({originalTag:u,elementId:j,events:L,startIndex:S,endIndex:I})}return r}function cc(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=pi[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 lc(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 Hs(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 uc(e){let{modifiers:n}=e,r=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=cc(e),a=lc(Hs(e.handler),n),l=[];if(n.once)l.push("once: true");if(n.capture)l.push("capture: true");if(Us(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,7 +112,7 @@ else {
|
|
|
112
112
|
`)}
|
|
113
113
|
})();
|
|
114
114
|
</script>`}function pc(e,n=""){let r=fi(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 v=f.match(/id=["']([^"']+)["']/);if(v)for(let S of u.events)S.elementId=v[1]}for(let v of u.events){let S=v.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),I=new RegExp(`\\s*${S}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${S}\\s*=\\s*'[^']*'`,"g");f=f.replace(I,""),f=f.replace(j,"")}i=i.slice(0,u.startIndex)+f+i.slice(u.endIndex),a.push(...u.events)}return{template:i,bindings:a}}function ui(e){let n=e.$uid;return typeof n==="string"&&n?`${n}_`:""}function nl(e,n,r){if(zl(e))return e;if(n.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:f,bindings:v}=pc(e,ui(n)),S=n.__stx_event_bindings||[];return n.__stx_event_bindings=[...S,...v],f}let i=fi(e,ui(n));if(i.length===0)return e;let a=e;for(let f=i.length-1;f>=0;f--){let v=i[f],S=v.originalTag;if(!S.includes(" id="))S=S.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${v.elementId}"`);else{let I=S.match(/id=["']([^"']+)["']/);if(I)for(let j of v.events)j.elementId=I[1]}for(let I of v.events){let j=I.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),L=new RegExp(`\\s*${j}\\s*=\\s*"[^"]*"`,"g"),M=new RegExp(`\\s*${j}\\s*=\\s*'[^']*'`,"g");S=S.replace(L,""),S=S.replace(M,"")}a=a.slice(0,v.startIndex)+S+a.slice(v.endIndex)}let l=Pi(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 di(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 Vt(e,n){let r=t(e),{depths:i,balanced:a}=h(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 v=(f.index??0)+f[0].length-f[1].length;if(l(v))return!0}for(let f of r.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(f.index??0)&&di(f[1],!0).has(n))return!0;for(let f of r.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(f.index??0)&&di(f[1],!1).has(n))return!0;return!1}var Ue="0.2.
|
|
115
|
+
`+a.slice(u);else a+=l;return a}function di(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 Vt(e,n){let r=t(e),{depths:i,balanced:a}=h(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 v=(f.index??0)+f[0].length-f[1].length;if(l(v))return!0}for(let f of r.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(f.index??0)&&di(f[1],!0).has(n))return!0;for(let f of r.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(f.index??0)&&di(f[1],!1).has(n))return!0;return!1}var Ue="0.2.900";var gi=Symbol.for(`stx.lazy-module-promises.${Ue}`);function dc(){let e=globalThis;return e[gi]??=new Map,e[gi]}function o(e,n){let r=dc(),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 gc=/<\/(script)/gi;function me(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(gc,"<\\/$1")}import mi from"fs";var hi=[];function k(e){let n=new T(e);return hi.push(n),n}function rl(){for(let e of hi)e.clear()}function E(e,...n){return`${n.map((r)=>String(r??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function Nr(e){let n=[];for(let r of new Set(e))try{n.push({path:r,mtimeMs:mi.statSync(r).mtimeMs})}catch{}return n}function eo(e){for(let n of e)try{if(mi.statSync(n.path).mtimeMs!==n.mtimeMs)return!1}catch{return!1}return!0}var Ie=["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 mc=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function hc(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 xc(e,n){let r=n;while(!0){let i=Bt.join(r,"node_modules",e,"package.json");if(_n.existsSync(i))return Bt.dirname(i);let a=Bt.dirname(r);if(a===r)return null;r=a}}function bc(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 yc(e,n){let r=hc(e);if(!r||!r.subpath)return null;let i=xc(r.pkg,n);if(!i)return null;let a;try{a=JSON.parse(_n.readFileSync(Bt.join(i,"package.json"),"utf8"))}catch{return null}let l=`.${r.subpath}`,u=bc(a.exports,l);if(!u)return null;let f=Bt.resolve(i,u);return _n.existsSync(f)?f:null}function zi(e,n){let r=n.filePath?Bt.dirname(n.filePath):n.projectRoot||process.cwd(),i=n.projectRoot||process.cwd(),a=new Set,l=[],u=[];return{code:e.replace(mc,(v,S)=>{let I;try{if(S.startsWith("./")||S.startsWith("../")||S.startsWith("/")){if(I=S.startsWith("/")?S:Bt.resolve(r,S),!_n.existsSync(I))throw Error(`file not found: ${I}`)}else{let j=null;try{j=Bun.resolveSync(S,i)}catch{j=yc(S,i)}if(!j)throw Error(`could not resolve ${S} (Bun.resolveSync + exports fallback both failed)`);I=j}}catch(j){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(S)} (from ${n.filePath||"<unknown>"}): ${j?.message||j}`),u.push(S),""}if(a.has(I))return"";a.add(I);try{let j=_n.readFileSync(I,"utf8");l.push({source:S,resolvedPath:I,contents:j})}catch(j){console.warn(`[stx:vendor-css] could not read ${I}: ${j?.message||j}`),u.push(S)}return""}),styles:l,unresolved:u}}function _c(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Hi(e){if(e.length===0)return"";return`${e.map((n)=>`<style data-stx-vendor="${_c(n.source)}" data-stx-layer="vendor">
|
|
116
116
|
@layer vendor {
|
|
117
117
|
${n.contents}
|
|
118
118
|
}
|
|
@@ -182,7 +182,7 @@ else {
|
|
|
182
182
|
// STX: auto-generated event bindings
|
|
183
183
|
${e.map((r,i)=>Ic(r,i)).join(`
|
|
184
184
|
`)}`}function _i(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 v=f;if(u++,v==="`"){let S=0;while(u<l){if(i[u]==="\\"){u+=2;continue}if(i[u]==="`"&&S===0){u++;break}if(i[u]==="$"&&i[u+1]==="{"){S++,u+=2;continue}if(i[u]==="}"&&S>0){S--,u++;continue}u++}}else while(u<l){if(i[u]==="\\"){u+=2;continue}if(i[u]===v){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 v=i.slice(u),S=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(S){let L=S[1];if(!L.startsWith("_")&&!r.has(L))n.push(L),r.add(L);u+=S[0].length;continue}let I=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(I){I[1].split(",").forEach((L)=>{let M=L.trim(),V=M.indexOf(":"),W=V>=0?M.slice(V+1).trim().split(/[\s=]/)[0]:M.split(/[\s=]/)[0];if(W&&!W.startsWith("_")&&!r.has(W))n.push(W),r.add(W)}),u+=I[0].length;continue}let j=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(j){let L=j[1];if(!L.startsWith("_")&&!r.has(L))n.push(L),r.add(L);u+=j[0].length;continue}}u++}return n}var jc=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 Pc(e){let n=new Set,r=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(L){let M;while((M=r.exec(L))!==null){let V=M[0];if(!jc.has(V))n.add(V)}}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 v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)i(l[1]);let S=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=S.exec(e))!==null)i(l[1]);let I=/@model\s*=\s*["']([^"']*)["']/gi;while((l=I.exec(e))!==null)i(l[1]);let j=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=j.exec(e))!==null)i(l[1]);return n}async function Ge(e,n={}){let r=e,i="",a=!1,l=[],u=zi(r,{filePath:n.filePath,projectRoot:n.projectRoot});r=u.code;let f=Hi(u.styles),v=Xt(r);r=v.code,l=[...v.imports,...v.models];let{hasUserImports:S,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 v=i.slice(u),S=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(S){let L=S[1];if(!L.startsWith("_")&&!r.has(L))n.push(L),r.add(L);u+=S[0].length;continue}let I=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(I){I[1].split(",").forEach((L)=>{let M=L.trim(),V=M.indexOf(":"),W=V>=0?M.slice(V+1).trim().split(/[\s=]/)[0]:M.split(/[\s=]/)[0];if(W&&!W.startsWith("_")&&!r.has(W))n.push(W),r.add(W)}),u+=I[0].length;continue}let j=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(j){let L=j[1];if(!L.startsWith("_")&&!r.has(L))n.push(L),r.add(L);u+=j[0].length;continue}}u++}return n}var jc=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 Pc(e){let n=new Set,r=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(L){let M;while((M=r.exec(L))!==null){let V=M[0];if(!jc.has(V))n.add(V)}}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 v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)i(l[1]);let S=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=S.exec(e))!==null)i(l[1]);let I=/@model\s*=\s*["']([^"']*)["']/gi;while((l=I.exec(e))!==null)i(l[1]);let j=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=j.exec(e))!==null)i(l[1]);return n}async function Ge(e,n={}){let r=e,i="",a=!1,l=[],u=zi(r,{filePath:n.filePath,projectRoot:n.projectRoot});r=u.code;let f=Hi(u.styles),v=Xt(r);r=v.code,l=[...v.imports,...v.models];let{hasUserImports:S,bundleClientScript:I}=await o("stx/client-script-bundler",()=>import("./chunk-dmydyd5j.js"));if(S(r))r=await I(r,n.filePath||"",{projectRoot:n.projectRoot,minify:n.production}),a=!0;if(n.autoImports!==!1){let U=xl(r);r=U.code,i=Sl(U.stxImports,U.browserImports.filter((H)=>!l.includes(H)))}if(i=`${Pn(r,n.serverData)}${i}`,r=D(r),!a&&Xe(n.attrs||""))r=Je(r);let j=Oc(n.eventBindings||[]),L=(n.attrs||"").trim(),M=/\btype\s*=\s*["']module["']/i.test(L),V=n.instanceId?` data-stx-instance="${n.instanceId}"`:"";if(M){let U=L.replace(/\btype\s*=\s*["']module["']/i,"").trim(),H=`type="module" data-stx-scoped${V}${U?` ${U}`:""}`;return`${f}<script ${H}>
|
|
186
186
|
${me(`${i}${r}
|
|
187
187
|
${j}`)}
|
|
188
188
|
</script>`}let W=na(e),Z=/function __stx_setup_/.test(r),q=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function G(U){let H=U.length>0?`
|
|
@@ -1183,8 +1183,8 @@ ${S.join(`
|
|
|
1183
1183
|
`){let V=e[a];if(V==="\\"){a+=2;continue}if(V==="[")M=!0;else if(V==="]")M=!1;else if(V==="/"&&!M){a++;while(a<l&&/[a-z]/i.test(e[a]))a++;return}a++}},L=()=>{if(i!==0)return;let M=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(M){let q=M[2].split(",").map((G)=>{let U=G.trim().split(":");return U[U.length-1].trim()});for(let G of q)if(G&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(G)&&!r.has(G))n.push(G),r.add(G);return}let V=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(V){let q=V[2];if(!r.has(q))n.push(q),r.add(q);return}let W=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(W){let q=W[1];if(!r.has(q))n.push(q),r.add(q);return}let Z=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Z){let q=Z[1];if(!r.has(q))n.push(q),r.add(q)}};while(a<l){if(v())continue;if(e[a]==="'"||e[a]==='"'){u(e[a]);continue}if(e[a]==="`"){f();continue}if(e[a]==="/"&&I()){j();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])))L();a++}return n}function jp(e,n,r){for(let i of ee(e)){let a=O(i.attrs);if(["server","src","component","stx:component"].some((f)=>a.has(f))||!$t(a))continue;let l=an(e.slice(i.bodyStart,i.bodyEnd));if(!l)continue;let u=Object.assign(Object.create(null),r);for(let[f,v]of Object.entries(l.defaults))if(u[f]===void 0)u[f]=ws(v);for(let f of new Set([...l.propNames,...Object.keys(l.defaults)])){let v=l.localBindings[f]??(l.propBindings[f]?void 0:f);if(v)Object.defineProperty(n,v,{value:u[f],writable:!0,enumerable:!0,configurable:!0})}if(l.identifier)Object.defineProperty(n,l.identifier,{value:u,writable:!0,enumerable:!0,configurable:!0})}}var Pp=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function Wg(e,n){let r=Ut(e),i=e.slice(r).match(/^<([a-zA-Z][a-zA-Z0-9-]*)/);if(!i)return null;let a=i[1].toLowerCase();if(!Pp.has(a))return null;let l=new RegExp(`<\\/?${a}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),u=x(e,(I,j)=>(l.lastIndex=j,l.exec(I)?.index===j?l.lastIndex:-1));if(a==="span"&&/\sdata-stx-scope\s*=/.test(u[0]?.token||""))return null;let f=0,v=!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;v=!0;break}}if(!v)return null;let S=r+i[0].length;return e.slice(0,S)+n+e.slice(S)}function Wa(e,n){if(!e)return!1;return[...n.additionalComponentsDirs??[],...n.fallbackComponentsDir?[n.fallbackComponentsDir]:[]].some((i)=>{let a=xe.relative(xe.resolve(i),xe.resolve(e));return!a.startsWith("..")&&!xe.isAbsolute(a)})}async function zr(e,n,r,i,a){let l=e.endsWith(".stx")?e.slice(0,-4):e,u=(ce)=>ce.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""),f=r.__importedComponents;if(f){for(let ce of[l,l.toLowerCase(),u(l),J(l)])if(f.has(ce))return!0}let v=[...new Set([`${l}.stx`,`${u(l)}.stx`,`${J(l)}.stx`])],S=typeof a.root==="string"?xe.resolve(a.root):void 0,I=S??xe.dirname(i),j=[],L=(ce)=>{if(ce&&!j.includes(ce))j.push(ce)};for(let ce of rs(i,S))L(ce);let M=r.__originalFilePath;if(M)L(xe.join(xe.dirname(M),"components"));if(Wa(n,a))L(a._rootComponentsDir);L(n),L(a._rootComponentsDir),L(xe.join(xe.dirname(i),"components")),L(a.componentsDir);for(let ce of a.additionalComponentsDirs??[])L(ce);let V=a._targetComponentFallbackNames?.some((ce)=>ce.toLowerCase()===l.toLowerCase());if(!V)for(let ce of a._targetComponentDirs??[])L(ce);if(S)L(xe.resolve(S,"resources/views/components")),L(xe.resolve(S,"resources/components")),L(xe.resolve(S,"src/components")),L(xe.resolve(S,"components"));for(let ce of a._layerComponentDirs??[])L(ce);let W=a._pluginComponentDirs;if(Array.isArray(W))for(let ce of W)L(typeof ce==="string"?ce:null);if(L(a.fallbackComponentsDir),V)for(let ce of a._targetComponentDirs??[])L(ce);let Z=a._nativePrimitivesFallback;if(Z&&!Z.except.some((ce)=>ce.toLowerCase()===l.toLowerCase()))L(Z.dir);if(l.startsWith("./")||l.startsWith("../"))return s(xe.resolve(xe.dirname(i),`${l}.stx`));let q=ja(xe.resolve(import.meta.dir,"components")),G=j.map((ce)=>xe.isAbsolute(ce)?ce:xe.resolve(I,ce)),U=`${v.join("\x00")}\x00\x00${G.join("\x00")}`,H=Ar.get(U);if(H!==void 0)return H;let re=!1;e:for(let ce of G){if(ja(ce)===q)continue;for(let le of v)if(await s(xe.join(ce,le))){re=!0;break e}}return Ar.set(U,re),re}function ja(e){let n=Ir.get(e);if(n!==void 0)return n;let r=e;try{r=Is.realpathSync(e)}catch{}return Ir.set(e,r),r}function qg(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function kl(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 Mp(e,n,r){if(!e.includes("{{")&&!e.includes("{!!"))return e;let i=(a,l)=>{let u;try{u=N(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 Pa=new Set;function Ma(e,n,r,i){let a=`${e}\x00${n}\x00${i??""}`;if(!process.env.STX_DEBUG&&Pa.has(a))return;Pa.add(a);let l=n?` used in ${n}`:"",u=i?` Cause: ${i}.`:"",f=r.length>0?`
|
|
1184
1184
|
searched:
|
|
1185
1185
|
${r.map((v)=>` - ${v}`).join(`
|
|
1186
|
-
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${u}${f}`)}function Da(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var Dp=new Set(["for","if","show","key","ref","class","className","style"]),Na=new Set,Fa="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",_l=new RegExp(`\\b(?:${Fa})\\s*(?:<[^>]*>)?\\s*\\(`);function Vi(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|${Fa})\\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 Ye(e,n,r,i,a,l,u,f=new Set,v,S=mt(a),I,j=e){let{extractVariables:L}=await o("stx/variable-extractor",()=>import("./chunk-1tb18a92.js")),M=f??new Set;if(M.has(e))return`[Circular component reference: ${e}]`;let V=new Set(M);V.add(e);let W=typeof n.client==="string"?n.client.trim():"";if("client"in n)delete n.client;let Z=W&&W!=="load"&&qg(W)?W:"";try{let q=(pe)=>pe.split("-").map((ve)=>ve.charAt(0).toUpperCase()+ve.slice(1)).join(""),G=j.endsWith(".stx")?j.slice(0,-4):j,U=null,H=a.__importedComponents;if(H){let pe=[G,G.toLowerCase(),q(G),J(G)];for(let ve of pe)if(H.has(ve)){U=H.get(ve);break}}let re=[];if(!U){let pe=[`${G}.stx`,`${q(G)}.stx`,`${J(G)}.stx`],ve=[...new Set(pe)],Me=a.__originalFilePath,$e=[];for(let Te of rs(l))if(!$e.includes(Te))$e.push(Te);let lt=$e.length;for(let Te of u._layerComponentDirs??[])if(!$e.includes(Te))$e.push(Te);if(Me){let Te=xe.join(xe.dirname(Me),"components");$e.push(Te)}let Qe=u._rootComponentsDir;if(typeof Qe==="string"&&Wa(i,u)&&!$e.includes(Qe))$e.push(Qe);if(i&&!$e.includes(i))$e.push(i);if(typeof Qe==="string"&&!$e.includes(Qe))$e.push(Qe);let Ot=xe.join(xe.dirname(l),"components");if(!$e.includes(Ot))$e.push(Ot);if(u.componentsDir&&u.componentsDir!==i&&!$e.includes(u.componentsDir))$e.push(u.componentsDir);for(let Te of u.additionalComponentsDirs??[])if(Te&&!$e.includes(Te))$e.push(Te);let Yt=u._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(G),Dt=(I?.events??[]).map((Te)=>Te.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Zn=Object.hasOwn(n,"checked")||Boolean(I?.reactiveProps?.includes("checked")),Ns=Object.hasOwn(n,"value")||Boolean(I?.reactiveProps?.includes("value")),Ls=!Dt.includes("valuechange")&&(Zn||Dt.includes("change")&&!Ns),Lt=u._nativeHostAttrs&&/^textinput$/i.test(G),Qt=Dt.includes("update:value")&&!Dt.includes("input"),yn=u._nativeHostAttrs&&/^video$/i.test(G),zs=u._nativeHostAttrs&&/^image$/i.test(G),Jn=Qs([...Object.keys(n),...I?.reactiveProps??[]],I?.events,n),en=Object.hasOwn(n,"src")||Boolean(I?.reactiveProps?.includes("src")),Xn=Object.hasOwn(n,"source")||Boolean(I?.reactiveProps?.includes("source")),Gn=yn&&(en||Xn)&&(I?.events??[]).every((Te)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(Te.replace(/^@/,"").split(".")[0])),Yn=new Set(["","primary","secondary","outline","ghost","danger"]),Qn=typeof n.variant==="string"?n.variant.trim().toLowerCase():"",es=u._nativeHostAttrs&&/^button$/i.test(G)&&!Yn.has(Qn),Zr=u._targetComponentFallbackNames?.some((Te)=>Te.toLowerCase()===G.toLowerCase())??!1,Bs=Zr&&(!Yt||Ls)&&(!Lt||Qt)&&(!yn||Gn)&&(!zs||Jn)&&!es;for(let Te of Bs?[]:u._targetComponentDirs??[])if(Te&&!$e.includes(Te))$e.push(Te);let tn=typeof u.root==="string"?xe.resolve(u.root):void 0,Xr=tn??xe.dirname(l),nn=[];if(tn)nn.push(xe.resolve(tn,"resources/views/components")),nn.push(xe.resolve(tn,"resources/components")),nn.push(xe.resolve(tn,"src/components")),nn.push(xe.resolve(tn,"components"));nn.push(xe.resolve(import.meta.dir,"components"));for(let Te of nn)if(!$e.includes(Te))$e.push(Te);if(Zr){let Te=(u._componentPackageDirs??[]).filter((gt)=>typeof gt==="string"&>.length>0),jt=(Bs?Te.length?Te:u._pluginComponentDirs??[]:u._targetComponentDirs??[]).filter((gt)=>typeof gt==="string"&>.length>0);if(jt.length){let gt=$e.slice(lt).map((ut)=>xe.isAbsolute(ut)?ut:xe.resolve(Xr,ut)).filter((ut)=>!jt.includes(ut)),ns=`${G}\x00${gt.join("\x00")}`,kt=Tr.get(ns);if(kt===void 0){kt=!1;for(let ut of gt){for(let zt of ve)if(await s(xe.join(ut,zt))){kt=!0;break}if(kt)break}Tr.set(ns,kt)}if(!kt){for(let ut of jt){let zt=$e.indexOf(ut);if(zt>=0)$e.splice(zt,1)}$e.splice(lt,0,...jt)}}}let Gr=u._pluginComponentDirs;if(Array.isArray(Gr)){for(let Te of Gr)if(typeof Te==="string"&&!$e.includes(Te))$e.push(Te)}if(u.fallbackComponentsDir&&!$e.includes(u.fallbackComponentsDir))$e.push(u.fallbackComponentsDir);if(Bs){for(let Te of u._targetComponentDirs??[])if(Te&&!$e.includes(Te))$e.push(Te)}let ts=u._nativePrimitivesFallback;if(ts&&!ts.except.some((Te)=>Te.toLowerCase()===G.toLowerCase())&&!$e.includes(ts.dir))$e.push(ts.dir);let Qr=[...new Set($e.map((Te)=>{if(!Te)return Te;return xe.isAbsolute(Te)?Te:xe.resolve(Xr,Te)}))];$e.length=0,$e.push(...Qr);let Ws=`${G}\x00${l}\x00${Qr.join("\x00")}`,Fs=Ts.get(Ws);if(Fs)if(await s(Fs))U=Fs;else Ts.delete(Ws);if(!U&&(G.startsWith("./")||G.startsWith("../")))U=xe.resolve(xe.dirname(l),`${G}.stx`),re.push(U);else if(!U)for(let Te of $e){if(!Te)continue;for(let jt of ve){let gt=xe.join(Te,jt);if(re.push(gt),await s(gt)){U=gt;break}}if(U)break;if(!U)try{let jt=await import("fs");if(!jt.statSync(Te,{throwIfNoEntry:!1})?.isDirectory())continue;let ns=8,kt=[{path:Te,depth:0}];while(kt.length>0&&!U){let ut=kt.pop();if(ut.depth>=ns)continue;let zt;try{zt=jt.readdirSync(ut.path,{withFileTypes:!0})}catch{continue}for(let ss of zt){if(!ss.isDirectory())continue;if(ss.name==="node_modules"||ss.name.startsWith("."))continue;let ei=xe.join(ut.path,ss.name);for(let nc of ve){let Vs=xe.join(ei,nc);if(re.push(Vs),await s(Vs)){U=Vs;break}}if(U)break;kt.push({path:ei,depth:ut.depth+1})}}}catch{}if(U)break}if(U)Ts.set(Ws,U)}if(!U||!await s(U))return Ma(e,l,re),Da(e);v.add(U);let ce;if(Fn.has(U)&&Rr.get(U)===Aa(U))ce=Fn.get(U);else try{let pe=Aa(U);ce=await Bun.file(U).text(),Fn.set(U,ce),Rr.set(U,pe)}catch(pe){let ve=pe instanceof Error?pe.message:String(pe);return Ma(e,l,[U],ve),Da(e)}if(I)for(let pe of new Set([...Object.keys(n),...I.reactiveProps??[]])){let ve=pe.toLowerCase();if(ve.startsWith("aria-")||ve.startsWith("data-"))continue;let Me=pe.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${Me}\\b`).test(ce))I.declaredProps.add(pe);if(new RegExp(`\\$props\\s*(?:\\.\\s*${Me}\\b|\\[\\s*['"]${Me}['"]\\s*\\])`).test(ce)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${Me}['"]`).test(ce))I.consumedProps?.add(pe)}if(I?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(ce))for(let pe of I.reactiveProps){if(Dp.has(pe)||I.consumedProps?.has(pe))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${pe.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(ce))continue;let ve=`${U}\x00${pe}`;if(Na.has(ve))continue;Na.add(ve),console.warn(`[stx] ${xe.basename(U)} reads \`${pe}\` with defineProps(), which is not live, but ${xe.basename(l)} binds it (:${pe}): 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('${pe}').`)}let le=new Set(["__originalFilePath","__importedComponents",ls,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),de={};for(let[pe,ve]of Object.entries(a))if(!pe.startsWith("__")||le.has(pe))de[pe]=ve;let Ee=S.length>0?{[ms]:[...S]}:{},Re=r;if(r.includes("@include")){let{processIncludes:pe}=await o("stx/includes",()=>import("./chunk-avqxkbrd.js"));Re=await pe(r,a,l,u,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Re)){let{processComponents:pe}=await o("stx/component-renderer",()=>import("./chunk-jq49238b.js")),ve={...a,__processedComponents:M,...Ee};Re=await pe(Re,ve,l,u,v);let Me=ve.__stx_preserved_client_expressions;if(Array.isArray(Me)&&Me.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Me])]}let we=[];if(kl(Re)){let{processExpressions:pe}=await o("stx/expressions",()=>import("./chunk-k352spys.js")),ve=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...Ee}:S.length>0?{...a,...Ee}:a;Re=pe(Re,ve,l);for(let Me of Re.matchAll(/\{\{([\s\S]*?)\}\}/g))we.push(Me[1].trim())}let ge=se(Re),ze=[],Fe=ge.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(pe,ve)=>{let Me=ge.scripts[Number(ve)]||"",$e=Me.match(/^<script\b([^>]*)>/i)?.[1]||"",lt=$e.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Qe=!lt||["module","text/javascript","application/javascript"].includes(lt),Ot=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${$e}`);if(!/\bserver\b/i.test($e)&&Qe&&!Ot)return ze.push(Me),"";return Me}),{extractSlotContent:it}=await o("stx/slots",()=>import("./chunk-73nazfe5.js")),rt=it(Fe),wt={};if(rt.defaultSlot?.trim())wt.default=rt.defaultSlot;for(let[pe,ve]of rt.namedSlots)wt[pe]=ve.content;let ft=a.__stx_scope_seq??={n:0,key:lo(String(a.__filename??l))},ot=Ba(e,process.cwd()),je=`stx_${(ot.endsWith(".stx")?ot.slice(0,-4):ot).replace(/[^a-zA-Z0-9]/g,"_")}_${++ft.n}_${ft.key}`,Ae={...de,$uid:je,$native:u._nativeHostAttrs===!0,...n,props:n,slot:Fe,$slots:wt,__processedComponents:V,__sections:{},__stx_signals_gate:Ne(ce)||kl(r),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...we]};if(/import\s/.test(ce)){Ae.__importedComponents=new Map(Ae.__importedComponents);let{processESImports:pe}=await o("stx/component-renderer",()=>import("./chunk-jq49238b.js"));ce=await pe(ce,Ae,U,u,v)}jp(ce,Ae,n);let dt=ce,nt=B(dt);if(nt)dt=nt.content.trim();let pn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Pt=[...ce.matchAll(pn)];for(let[,pe,ve]of Pt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(pe))We(ve,U,u.strict);let vt=[],fn=null,js=Pt.some((pe)=>/\bserver\b/.test(pe[1]||"")&&/\bcache\b/.test(pe[1]||"")),Jt=null,Rt=null,dn=null,Un=0,gn=null;if(Rp(u),js&&Pr>0){let pe=Tp({props:n,slot:Re,slotContext:r.trim()?Ap(de):void 0,buildMode:u.buildMode??"",skipEventDirectives:u.skipEventDirectives===!0,native:u._nativeHostAttrs===!0,clientLoopNames:[...S].sort(),layers:u._layerGraph?.layers.map((ve)=>ve.configFile),uid:je});if(pe!==null){Jt=`${U}\x00${E(ce)}\x00${pe}`;let ve=As.get(Jt);if(ve){for(let Me of ve.dependencies)v.add(Me);if(Ki(a,ve.clientFactories),ft.n+=ve.uidsConsumed,ve.preservedClientExpressions.length>0){let Me=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let $e of ve.preservedClientExpressions)Me.add($e);a.__stx_preserved_client_expressions=[...Me]}return ve.output}Rt=new Set(v),dn=Ci(a),Un=ft.n,gn=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let mn=new Set;for(let pe of Pt){let ve=pe[1]||"",Me=pe[2]||"",$e=ve.includes("server");if(Xe(ve)&&Me.trim())Me=Je(Me);if($e&&Me){for(let Qe of ye(Me))mn.add(Qe);try{await L(Me,Ae,U,{onFailure:(Qe)=>{if(Qe.kind!=="unknown")fn=Qe.kind}})}catch(Qe){}}if(!$e){let Qe=Me.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),Ot=Qe.includes("{{")&&Qe.includes("}}"),Yt=Qe.includes("{!!")&&Qe.includes("!!}");if(Ot||Yt)Qe=Wi(Qe,Ae,U);let Dt=ve.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");vt.push(`<script${Dt}>${Qe}</script>`)}}let St=se(ce).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),hn=St?St[1]:"",Ps=St?St[2]:"",Tt="",ue=hn&&/\bscoped\b/i.test(hn);if(St)Tt=`<style${hn}>${Mp(Ps,Ae,U)}</style>`;let fe=dt;if(fe=fe.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),St)fe=fe.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let pe=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ve=[];if(fe=fe.replace(pe,(Me,$e)=>{let lt=$e.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(lt)ve.push(`<style${lt[1]}>${lt[2]}</style>`);return""}),fe=fe.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ve.length>0)Tt=`${Tt}${ve.join(`
|
|
1187
|
-
`)}`}if(r&&fe.includes("{{ text || slot }}"))fe=fe.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>r);let{applySlots:Se}=await o("stx/slots",()=>import("./chunk-
|
|
1186
|
+
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${u}${f}`)}function Da(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var Dp=new Set(["for","if","show","key","ref","class","className","style"]),Na=new Set,Fa="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",_l=new RegExp(`\\b(?:${Fa})\\s*(?:<[^>]*>)?\\s*\\(`);function Vi(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|${Fa})\\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 Ye(e,n,r,i,a,l,u,f=new Set,v,S=mt(a),I,j=e){let{extractVariables:L}=await o("stx/variable-extractor",()=>import("./chunk-xysxzj69.js")),M=f??new Set;if(M.has(e))return`[Circular component reference: ${e}]`;let V=new Set(M);V.add(e);let W=typeof n.client==="string"?n.client.trim():"";if("client"in n)delete n.client;let Z=W&&W!=="load"&&qg(W)?W:"";try{let q=(pe)=>pe.split("-").map((ve)=>ve.charAt(0).toUpperCase()+ve.slice(1)).join(""),G=j.endsWith(".stx")?j.slice(0,-4):j,U=null,H=a.__importedComponents;if(H){let pe=[G,G.toLowerCase(),q(G),J(G)];for(let ve of pe)if(H.has(ve)){U=H.get(ve);break}}let re=[];if(!U){let pe=[`${G}.stx`,`${q(G)}.stx`,`${J(G)}.stx`],ve=[...new Set(pe)],Me=a.__originalFilePath,$e=[];for(let Te of rs(l))if(!$e.includes(Te))$e.push(Te);let lt=$e.length;for(let Te of u._layerComponentDirs??[])if(!$e.includes(Te))$e.push(Te);if(Me){let Te=xe.join(xe.dirname(Me),"components");$e.push(Te)}let Qe=u._rootComponentsDir;if(typeof Qe==="string"&&Wa(i,u)&&!$e.includes(Qe))$e.push(Qe);if(i&&!$e.includes(i))$e.push(i);if(typeof Qe==="string"&&!$e.includes(Qe))$e.push(Qe);let Ot=xe.join(xe.dirname(l),"components");if(!$e.includes(Ot))$e.push(Ot);if(u.componentsDir&&u.componentsDir!==i&&!$e.includes(u.componentsDir))$e.push(u.componentsDir);for(let Te of u.additionalComponentsDirs??[])if(Te&&!$e.includes(Te))$e.push(Te);let Yt=u._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(G),Dt=(I?.events??[]).map((Te)=>Te.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Zn=Object.hasOwn(n,"checked")||Boolean(I?.reactiveProps?.includes("checked")),Ns=Object.hasOwn(n,"value")||Boolean(I?.reactiveProps?.includes("value")),Ls=!Dt.includes("valuechange")&&(Zn||Dt.includes("change")&&!Ns),Lt=u._nativeHostAttrs&&/^textinput$/i.test(G),Qt=Dt.includes("update:value")&&!Dt.includes("input"),yn=u._nativeHostAttrs&&/^video$/i.test(G),zs=u._nativeHostAttrs&&/^image$/i.test(G),Jn=Qs([...Object.keys(n),...I?.reactiveProps??[]],I?.events,n),en=Object.hasOwn(n,"src")||Boolean(I?.reactiveProps?.includes("src")),Xn=Object.hasOwn(n,"source")||Boolean(I?.reactiveProps?.includes("source")),Gn=yn&&(en||Xn)&&(I?.events??[]).every((Te)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(Te.replace(/^@/,"").split(".")[0])),Yn=new Set(["","primary","secondary","outline","ghost","danger"]),Qn=typeof n.variant==="string"?n.variant.trim().toLowerCase():"",es=u._nativeHostAttrs&&/^button$/i.test(G)&&!Yn.has(Qn),Zr=u._targetComponentFallbackNames?.some((Te)=>Te.toLowerCase()===G.toLowerCase())??!1,Bs=Zr&&(!Yt||Ls)&&(!Lt||Qt)&&(!yn||Gn)&&(!zs||Jn)&&!es;for(let Te of Bs?[]:u._targetComponentDirs??[])if(Te&&!$e.includes(Te))$e.push(Te);let tn=typeof u.root==="string"?xe.resolve(u.root):void 0,Xr=tn??xe.dirname(l),nn=[];if(tn)nn.push(xe.resolve(tn,"resources/views/components")),nn.push(xe.resolve(tn,"resources/components")),nn.push(xe.resolve(tn,"src/components")),nn.push(xe.resolve(tn,"components"));nn.push(xe.resolve(import.meta.dir,"components"));for(let Te of nn)if(!$e.includes(Te))$e.push(Te);if(Zr){let Te=(u._componentPackageDirs??[]).filter((gt)=>typeof gt==="string"&>.length>0),jt=(Bs?Te.length?Te:u._pluginComponentDirs??[]:u._targetComponentDirs??[]).filter((gt)=>typeof gt==="string"&>.length>0);if(jt.length){let gt=$e.slice(lt).map((ut)=>xe.isAbsolute(ut)?ut:xe.resolve(Xr,ut)).filter((ut)=>!jt.includes(ut)),ns=`${G}\x00${gt.join("\x00")}`,kt=Tr.get(ns);if(kt===void 0){kt=!1;for(let ut of gt){for(let zt of ve)if(await s(xe.join(ut,zt))){kt=!0;break}if(kt)break}Tr.set(ns,kt)}if(!kt){for(let ut of jt){let zt=$e.indexOf(ut);if(zt>=0)$e.splice(zt,1)}$e.splice(lt,0,...jt)}}}let Gr=u._pluginComponentDirs;if(Array.isArray(Gr)){for(let Te of Gr)if(typeof Te==="string"&&!$e.includes(Te))$e.push(Te)}if(u.fallbackComponentsDir&&!$e.includes(u.fallbackComponentsDir))$e.push(u.fallbackComponentsDir);if(Bs){for(let Te of u._targetComponentDirs??[])if(Te&&!$e.includes(Te))$e.push(Te)}let ts=u._nativePrimitivesFallback;if(ts&&!ts.except.some((Te)=>Te.toLowerCase()===G.toLowerCase())&&!$e.includes(ts.dir))$e.push(ts.dir);let Qr=[...new Set($e.map((Te)=>{if(!Te)return Te;return xe.isAbsolute(Te)?Te:xe.resolve(Xr,Te)}))];$e.length=0,$e.push(...Qr);let Ws=`${G}\x00${l}\x00${Qr.join("\x00")}`,Fs=Ts.get(Ws);if(Fs)if(await s(Fs))U=Fs;else Ts.delete(Ws);if(!U&&(G.startsWith("./")||G.startsWith("../")))U=xe.resolve(xe.dirname(l),`${G}.stx`),re.push(U);else if(!U)for(let Te of $e){if(!Te)continue;for(let jt of ve){let gt=xe.join(Te,jt);if(re.push(gt),await s(gt)){U=gt;break}}if(U)break;if(!U)try{let jt=await import("fs");if(!jt.statSync(Te,{throwIfNoEntry:!1})?.isDirectory())continue;let ns=8,kt=[{path:Te,depth:0}];while(kt.length>0&&!U){let ut=kt.pop();if(ut.depth>=ns)continue;let zt;try{zt=jt.readdirSync(ut.path,{withFileTypes:!0})}catch{continue}for(let ss of zt){if(!ss.isDirectory())continue;if(ss.name==="node_modules"||ss.name.startsWith("."))continue;let ei=xe.join(ut.path,ss.name);for(let nc of ve){let Vs=xe.join(ei,nc);if(re.push(Vs),await s(Vs)){U=Vs;break}}if(U)break;kt.push({path:ei,depth:ut.depth+1})}}}catch{}if(U)break}if(U)Ts.set(Ws,U)}if(!U||!await s(U))return Ma(e,l,re),Da(e);v.add(U);let ce;if(Fn.has(U)&&Rr.get(U)===Aa(U))ce=Fn.get(U);else try{let pe=Aa(U);ce=await Bun.file(U).text(),Fn.set(U,ce),Rr.set(U,pe)}catch(pe){let ve=pe instanceof Error?pe.message:String(pe);return Ma(e,l,[U],ve),Da(e)}if(I)for(let pe of new Set([...Object.keys(n),...I.reactiveProps??[]])){let ve=pe.toLowerCase();if(ve.startsWith("aria-")||ve.startsWith("data-"))continue;let Me=pe.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${Me}\\b`).test(ce))I.declaredProps.add(pe);if(new RegExp(`\\$props\\s*(?:\\.\\s*${Me}\\b|\\[\\s*['"]${Me}['"]\\s*\\])`).test(ce)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${Me}['"]`).test(ce))I.consumedProps?.add(pe)}if(I?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(ce))for(let pe of I.reactiveProps){if(Dp.has(pe)||I.consumedProps?.has(pe))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${pe.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(ce))continue;let ve=`${U}\x00${pe}`;if(Na.has(ve))continue;Na.add(ve),console.warn(`[stx] ${xe.basename(U)} reads \`${pe}\` with defineProps(), which is not live, but ${xe.basename(l)} binds it (:${pe}): 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('${pe}').`)}let le=new Set(["__originalFilePath","__importedComponents",ls,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),de={};for(let[pe,ve]of Object.entries(a))if(!pe.startsWith("__")||le.has(pe))de[pe]=ve;let Ee=S.length>0?{[ms]:[...S]}:{},Re=r;if(r.includes("@include")){let{processIncludes:pe}=await o("stx/includes",()=>import("./chunk-aj94z67v.js"));Re=await pe(r,a,l,u,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Re)){let{processComponents:pe}=await o("stx/component-renderer",()=>import("./chunk-7jptw1pa.js")),ve={...a,__processedComponents:M,...Ee};Re=await pe(Re,ve,l,u,v);let Me=ve.__stx_preserved_client_expressions;if(Array.isArray(Me)&&Me.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Me])]}let we=[];if(kl(Re)){let{processExpressions:pe}=await o("stx/expressions",()=>import("./chunk-jvxbcrha.js")),ve=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...Ee}:S.length>0?{...a,...Ee}:a;Re=pe(Re,ve,l);for(let Me of Re.matchAll(/\{\{([\s\S]*?)\}\}/g))we.push(Me[1].trim())}let ge=se(Re),ze=[],Fe=ge.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(pe,ve)=>{let Me=ge.scripts[Number(ve)]||"",$e=Me.match(/^<script\b([^>]*)>/i)?.[1]||"",lt=$e.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Qe=!lt||["module","text/javascript","application/javascript"].includes(lt),Ot=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${$e}`);if(!/\bserver\b/i.test($e)&&Qe&&!Ot)return ze.push(Me),"";return Me}),{extractSlotContent:it}=await o("stx/slots",()=>import("./chunk-yeaz44dq.js")),rt=it(Fe),wt={};if(rt.defaultSlot?.trim())wt.default=rt.defaultSlot;for(let[pe,ve]of rt.namedSlots)wt[pe]=ve.content;let ft=a.__stx_scope_seq??={n:0,key:lo(String(a.__filename??l))},ot=Ba(e,process.cwd()),je=`stx_${(ot.endsWith(".stx")?ot.slice(0,-4):ot).replace(/[^a-zA-Z0-9]/g,"_")}_${++ft.n}_${ft.key}`,Ae={...de,$uid:je,$native:u._nativeHostAttrs===!0,...n,props:n,slot:Fe,$slots:wt,__processedComponents:V,__sections:{},__stx_signals_gate:Ne(ce)||kl(r),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...we]};if(/import\s/.test(ce)){Ae.__importedComponents=new Map(Ae.__importedComponents);let{processESImports:pe}=await o("stx/component-renderer",()=>import("./chunk-7jptw1pa.js"));ce=await pe(ce,Ae,U,u,v)}jp(ce,Ae,n);let dt=ce,nt=B(dt);if(nt)dt=nt.content.trim();let pn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Pt=[...ce.matchAll(pn)];for(let[,pe,ve]of Pt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(pe))We(ve,U,u.strict);let vt=[],fn=null,js=Pt.some((pe)=>/\bserver\b/.test(pe[1]||"")&&/\bcache\b/.test(pe[1]||"")),Jt=null,Rt=null,dn=null,Un=0,gn=null;if(Rp(u),js&&Pr>0){let pe=Tp({props:n,slot:Re,slotContext:r.trim()?Ap(de):void 0,buildMode:u.buildMode??"",skipEventDirectives:u.skipEventDirectives===!0,native:u._nativeHostAttrs===!0,clientLoopNames:[...S].sort(),layers:u._layerGraph?.layers.map((ve)=>ve.configFile),uid:je});if(pe!==null){Jt=`${U}\x00${E(ce)}\x00${pe}`;let ve=As.get(Jt);if(ve){for(let Me of ve.dependencies)v.add(Me);if(Ki(a,ve.clientFactories),ft.n+=ve.uidsConsumed,ve.preservedClientExpressions.length>0){let Me=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let $e of ve.preservedClientExpressions)Me.add($e);a.__stx_preserved_client_expressions=[...Me]}return ve.output}Rt=new Set(v),dn=Ci(a),Un=ft.n,gn=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let mn=new Set;for(let pe of Pt){let ve=pe[1]||"",Me=pe[2]||"",$e=ve.includes("server");if(Xe(ve)&&Me.trim())Me=Je(Me);if($e&&Me){for(let Qe of ye(Me))mn.add(Qe);try{await L(Me,Ae,U,{onFailure:(Qe)=>{if(Qe.kind!=="unknown")fn=Qe.kind}})}catch(Qe){}}if(!$e){let Qe=Me.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),Ot=Qe.includes("{{")&&Qe.includes("}}"),Yt=Qe.includes("{!!")&&Qe.includes("!!}");if(Ot||Yt)Qe=Wi(Qe,Ae,U);let Dt=ve.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");vt.push(`<script${Dt}>${Qe}</script>`)}}let St=se(ce).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),hn=St?St[1]:"",Ps=St?St[2]:"",Tt="",ue=hn&&/\bscoped\b/i.test(hn);if(St)Tt=`<style${hn}>${Mp(Ps,Ae,U)}</style>`;let fe=dt;if(fe=fe.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),St)fe=fe.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let pe=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ve=[];if(fe=fe.replace(pe,(Me,$e)=>{let lt=$e.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(lt)ve.push(`<style${lt[1]}>${lt[2]}</style>`);return""}),fe=fe.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ve.length>0)Tt=`${Tt}${ve.join(`
|
|
1187
|
+
`)}`}if(r&&fe.includes("{{ text || slot }}"))fe=fe.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>r);let{applySlots:Se}=await o("stx/slots",()=>import("./chunk-yeaz44dq.js")),{defaultSlot:Be,namedSlots:tt}=rt,at=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(Fe),Et=vt.length>0&&pr(fe)||u._nativeHostAttrs===!0&&vt.length>0||at&&vt.length>0||vt.some((pe)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(pe)),Ms=(pe)=>Et?Vo(pe,je):pe,Ds=new Map([...tt].map(([pe,ve])=>[pe,{...ve,content:Ms(ve.content)}]));fe=await Se(fe,Et?Fo(Ms(Be),je):Be,Ds,Ae,Et?je:"");let Hn=Vi(vt),xn=(Array.isArray(Ae.__stx_client_signal_names)?Ae.__stx_client_signal_names:[]).filter((pe)=>!mn.has(pe));if(Hn.length>0||xn.length>0)Ae.__stx_client_signal_names=[...new Set([...xn,...Hn])];else delete Ae.__stx_client_signal_names;let bn=S.filter((pe)=>!mn.has(pe)&&!(pe in n));if(bn.length>0)Ae[ms]=bn;let Kn={...u,_rootComponentsDir:u._rootComponentsDir||u.componentsDir,componentsDir:xe.dirname(U),skipSignalsRuntime:!0,skipEventDirectives:u._nativeHostAttrs===!0||Et||vt.length===0,defaultLayout:void 0};Ae.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:qn}=await o("stx/process",()=>import("./chunk-a6ayk6vc.js")),At=await qn(fe,Ae,U,Kn,v),Mt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let pe of At.matchAll(/\{\{([\s\S]*?)\}\}/g))Mt.add(pe[1].trim());if(Mt.size>0)a.__stx_preserved_client_expressions=[...Mt];let It=je,ct=At;if(Et){let pe="";if(Object.keys(n).length>0)try{pe=` data-stx-props="${kr(JSON.stringify(n))}"`}catch{}let ve=Z?` stx-hydrate="${kr(Z)}"`:"",Me=Object.fromEntries(Object.entries(wt).map(([Lt,Qt])=>[Lt,Boolean(Qt)])),$e=Object.keys(Me).length>0?` data-stx-slots="${kr(JSON.stringify(Me))}"`:"",lt=` data-stx-scope="${It}"${pe}${$e}${ve}`,Qe=At.slice(Ut(At)),Ot=/^<span(?=[\s/>])/i.test(Qe),Yt=/^<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(Qe),Dt=/^<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(Qe),Zn=Ot?"span":"div",Ns=Yt&&u._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':Dt&&u._nativeHostAttrs?' style="width:100%;height:100%"':Ot||Yt?' style="display:contents"':"";ct=Wg(At,lt)??`<${Zn}${lt} data-stx-component-wrapper${Ns}>${At}</${Zn}>`;let Ls=await Promise.all(vt.map(async(Lt)=>{let Qt=Lt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Qt)return Lt;let[,yn,zs]=Qt,Jn=Ta(Lt,Ae,U);if(Jn!==null)return Jn;let en=await Lp(zs,U,u.buildMode==="compile"),Xn=Pn(en.clientCode,Ke(Ae)),{vendorStyleTags:Gn}=en,Yn=Xn?`function(__scopeId) {
|
|
1188
1188
|
${Xn}
|
|
1189
1189
|
return (${en.factoryBody})(__scopeId);
|
|
1190
1190
|
}`:en.factoryBody,Qn=Z?null:rr(a,Yn),es=Qn?`window.__stxComponentFactories[${JSON.stringify(Qn)}](${JSON.stringify(It)});`:`(${Yn})(${JSON.stringify(It)});`;if(Z)return`${Gn}<script type="stx/island" data-stx-island="${It}" data-stx-scoped data-stx-owner="${It}"${yn}>${me(es)}</script>`;return`${Gn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${It}"${yn}>${me(es)}</script>`}));if(ct=ct+`
|
|
@@ -1210,7 +1210,7 @@ ${He.yellow}${He.bold}Message:${He.reset} ${n}
|
|
|
1210
1210
|
`,f)I+=`
|
|
1211
1211
|
${He.blue}${He.bold}Context:${He.reset}
|
|
1212
1212
|
${He.dim}${f}${He.reset}
|
|
1213
|
-
`;return I}function Ce(){Fn.clear(),Rr.clear(),Ts.clear(),Tr.clear(),Ar.clear(),Ir.clear(),As.clear()}function Ry(){return{size:Fn.size,maxSize:500}}var Cr=k(128);async function Lp(e,n,r){let i=E(e,n,r),a=Cr.get(i);if(a){if(eo(a.deps))return a;Cr.delete(i)}let l=zi(e,{filePath:n,projectRoot:process.cwd()}),u=l.code,f=Hi(l.styles);u=Xt(u).code;let{hasUserImports:v,bundleClientScript:S}=await o("stx/client-script-bundler",()=>import("./chunk-
|
|
1213
|
+
`;return I}function Ce(){Fn.clear(),Rr.clear(),Ts.clear(),Tr.clear(),Ar.clear(),Ir.clear(),As.clear()}function Ry(){return{size:Fn.size,maxSize:500}}var Cr=k(128);async function Lp(e,n,r){let i=E(e,n,r),a=Cr.get(i);if(a){if(eo(a.deps))return a;Cr.delete(i)}let l=zi(e,{filePath:n,projectRoot:process.cwd()}),u=l.code,f=Hi(l.styles);u=Xt(u).code;let{hasUserImports:v,bundleClientScript:S}=await o("stx/client-script-bundler",()=>import("./chunk-dmydyd5j.js")),I=[],j=!1;if(v(u)){let G=u;u=await S(G,n,{projectRoot:process.cwd(),minify:r,collectInputs:I}),j=u===G}let{stripStxRuntimeImports:L}=await o("stx/signal-processing",()=>import("./chunk-vmh5zd0t.js"));u=L(u);let M=D(u),V=Op(M),W=new Set(X(M,!0).split(",").map((G)=>G.trim())),Z=`function(__scopeId) {
|
|
1214
1214
|
${xt("const",[...Fl,...V],M)}
|
|
1215
1215
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
1216
1216
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Dn,z}from"./chunk-esm0pnpz.js";import m from"fs";import e from"path";async function Mn(r,o,i){if(r.__stx_runtime_config)return;let n=Dn();if(n||i){r.__stx_runtime_config=n??z(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-
|
|
2
|
+
import{Dn,z}from"./chunk-esm0pnpz.js";import m from"fs";import e from"path";async function Mn(r,o,i){if(r.__stx_runtime_config)return;let n=Dn();if(n||i){r.__stx_runtime_config=n??z(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-x7s2y8gc.js"),c=await f(t);if(c.runtimeConfig)r.__stx_runtime_config=z(c.runtimeConfig);return}let s=e.dirname(t);if(s===t)return;t=s}}async function Ki(r,o){function i(n){if(n===null)return"null";if(Array.isArray(n))return`Array<${n.length?[...new Set(n.map(i))].join(" | "):"unknown"}>`;if(typeof n==="object")return`{ ${Object.entries(n).map(([t,s])=>`readonly ${JSON.stringify(t)}: ${i(s)}`).join("; ")} }`;return typeof n}await Bun.write(e.join(r,".stx/runtime-config.d.ts"),`import '@stacksjs/stx/runtime-config'
|
|
3
3
|
declare module '@stacksjs/stx/runtime-config' { interface PublicRuntimeConfig ${i(o.public??{})} }
|
|
4
4
|
`),await Bun.write(e.join(r,".stx/runtime-config-server.d.ts"),`import '@stacksjs/stx/runtime-config-server'
|
|
5
5
|
declare module '@stacksjs/stx/runtime-config-server' { interface PrivateRuntimeConfig ${i(o.private??{})} }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ft}from"./chunk-0b57fgpn.js";import{At,sr}from"./chunk-qt2mr3f0.js";import{ye,Rn,El,Tl}from"./chunk-
|
|
2
|
+
import{ft}from"./chunk-0b57fgpn.js";import{At,sr}from"./chunk-qt2mr3f0.js";import{ye,Rn,El,Tl}from"./chunk-ayhh7b6f.js";import{Wr,qr,Kr,Xr,De}from"./chunk-945zygwa.js";import{z}from"./chunk-esm0pnpz.js";import{Ki}from"./chunk-b7rxqt0z.js";import{S}from"./chunk-syh0s7he.js";import{i}from"./chunk-mjqa2e8d.js";import{q,a}from"./chunk-4jtx5996.js";import{Jc}from"./chunk-vw7crz0z.js";import{qn,Kn,rt,Be,Ma,Da,Gn}from"./chunk-9wsmkfhz.js";import{vn,Qo}from"./chunk-4ad47zef.js";import{Xn}from"./chunk-gnf1e5q7.js";import{fn,fr,gr}from"./chunk-arfpzf17.js";import{re}from"./chunk-nkgkctpe.js";import m from"fs";import c from"path";import{createHash as Y}from"crypto";function I(n){return Y("sha256").update(n).digest("hex").slice(0,8)}function W(n=!1){let l=n?sr():At(),o=I(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function J(){let n=ft(),l=I(n);return{content:n,filename:`router.${l}.js`,hash:l}}import U from"path";import{createHash as Q}from"crypto";function ee(n={}){let l=new Set;return{context:new Proxy(n,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function V(n,l,o={}){let r=U.resolve(n),e=await Bun.file(r).text(),x=Q("sha256").update(e).digest("hex").slice(0,16);El();let _={};try{_=await a(o.configDir)}catch{}let y=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))y.push(g[2])}let u=new Set(y.flatMap((R)=>ye(R))),{context:D}=ee({__filename:r,__dirname:U.dirname(r),__stx_serverDeclared:u}),A=new Set,T={...q,..._,...o,buildMode:"compile",strict:!1},f=await i(e,D,r,T,A),w=qn(f)+Kn(f)+rt(f),j=Tl();return{route:l,sourceFile:n,html:f,fragment:w,placeholders:j,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(A),contentHash:x,status:Rn(e),streamTemplates:D.__streamTemplates}}var te=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function X(n,l){let o=0,r=0;if(!m.existsSync(n))return{copied:o,bytes:r};m.mkdirSync(l,{recursive:!0});function e(x,_){let y=m.readdirSync(x,{withFileTypes:!0});for(let d of y){if(te.has(d.name))continue;let g=c.join(x,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),o++,r+=m.statSync(u).size}}}return e(n,l),{copied:o,bytes:r}}async function Nm(n={}){let l=Date.now(),o=c.resolve(n.root||process.cwd()),r=c.resolve(o,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await a(o),x=c.resolve(o,n.componentsDir??e.componentsDir??"components"),_=c.resolve(o,n.partialsDir??e.partialsDir??"partials"),y=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=De(e.app?.head,{known:Xr,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",A=n.routeRules??e.routeRules??{},T=Xn(A),f=n.serverApi??e.serverApi,w=typeof f==="object"?f:{};if(f)vn(o,w);if(e.runtimeConfig)z(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let j=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of j)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=re(o,{pagesDirs:e._layerPageDirs}),Z=["components","layouts","partials"],P=R.filter((s)=>!Z.some((h)=>s.pattern.startsWith(`/${h}/`)||s.pattern===`/${h}`));console.log(`[stx build] Found ${P.length} page routes (${R.length-P.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=W(n.debug),b=J();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",b.filename),b.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${b.filename} (${(b.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let B=[],O=[];for(let s of P){let h=T(s.pattern),M=h.rendering==="prerender";if(M&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await V(s.filePath,s.pattern,{configDir:o,componentsDir:x,partialsDir:_,layoutsDir:y,debug:n.debug});if(B.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,b.filename),t.html=Kr(t.html,g,{bodyScripts:[`<script src="/__stx/${b.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=Wr(t.html,u);if(g.htmlAttrs)t.html=qr(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let G=p[1];t.html=t.html.replace(" "+G,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${G}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await S(t.html),M){let p=await Gn(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=Be(t.html,D,!0);let N=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),K=c.join("server","pages",`${N}.compiled.json`),L=c.join("server","fragments",`${N}.html`);await Bun.write(c.join(r,K),JSON.stringify(t,null,2)),await Bun.write(c.join(r,L),t.fragment),O.push({pattern:s.pattern,compiledPath:K,fragmentPath:L,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:M}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(h).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let H=c.resolve(o,d);if(m.existsSync(H)){let{copied:s,bytes:h}=X(H,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${d}/`)}let k=gr(o);if(k){let{copied:s,bytes:h}=X(k,c.join(r,"public",fr));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${fn}/`)}let E={runtime:v.filename,router:b.filename},C=Ma(O,E,r);if(C.routeRules=A,C.routerContainer=D,f)C.apiRoutes=await Qo(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await Ki(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(Jc(e._layerGraph),null,2));Da(C,r);let F=Date.now()-l;return console.log(`
|
|
3
3
|
[stx build] Done in ${F}ms \u2014 ${B.length} pages compiled`),{pageCount:B.length,assets:E,outputDir:r,duration:F}}
|
|
4
4
|
export{Nm};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Jf,Yf,Te,Zf,Ec,mn,hn,ty,Tc,yn,mr,Qf,eg,tg,ks,ng,rg,$c,bn,sg,wn,Rc,ny}from"./chunk-
|
|
2
|
+
import{Jf,Yf,Te,Zf,Ec,mn,hn,ty,Tc,yn,mr,Qf,eg,tg,ks,ng,rg,$c,bn,sg,wn,Rc,ny}from"./chunk-sk0hje4f.js";import"./chunk-4ad47zef.js";import"./chunk-qs0zk04y.js";import"./chunk-65g78sge.js";import"./chunk-4jtx5996.js";import"./chunk-nq7nykq9.js";import"./chunk-5mrt1enm.js";import"./chunk-vw7crz0z.js";import"./chunk-150cz8qq.js";import"./chunk-0b57fgpn.js";import"./chunk-ayhh7b6f.js";import"./chunk-b7rxqt0z.js";import"./chunk-esm0pnpz.js";import"./chunk-945zygwa.js";import"./chunk-7b3dqeyr.js";import"./chunk-5g5khx0m.js";import"./chunk-0jdz31q1.js";import"./chunk-hdfhaddy.js";export{mr as MODULE_SPECIFIER_PREFIX,$c as assertBundleBuildCanSettle,Jf as bundleCacheDir,Yf as bundleCacheEntryLimit,ny as bundleClientEntriesSplit,wn as bundleClientScript,hn as clearBundleFailures,Te as clientBundleDependencies,mn as getBundleFailures,yn as hasUserImports,rg as isWithinBundlerCallback,bn as moduleSubstitutionKey,eg as normalizeRegistrySpecifiers,sg as queueClientBundleBuild,Ec as recordBundleFailure,Qf as registryIdForPath,Tc as resolveBundlerFallback,tg as rewriteRegistryImports,ty as setBundlerFallbackMode,Zf as shouldLogBundlerDiagnostics,Rc as tempBuildName,ks as withModuleSubstitutes,ng as withinBundlerCallback};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{y,Fi,wl,vl,Bg,Fg,zg,Hg,Vg,lo,Ug,Xe,ie,Je,Wg,zr,qg,kl,_l,Vi,Ye,s,In,Cl,b,Ce,Ry}from"./chunk-
|
|
2
|
+
import{y,Fi,wl,vl,Bg,Fg,zg,Hg,Vg,lo,Ug,Xe,ie,Je,Wg,zr,qg,kl,_l,Vi,Ye,s,In,Cl,b,Ce,Ry}from"./chunk-ayhh7b6f.js";import"./chunk-b7rxqt0z.js";import"./chunk-esm0pnpz.js";import"./chunk-945zygwa.js";import"./chunk-7b3dqeyr.js";import"./chunk-5g5khx0m.js";import"./chunk-0jdz31q1.js";import"./chunk-hdfhaddy.js";export{_l as SIGNAL_COMPOSABLE_CALL,Ce as clearComponentCache,Vi as componentClientSignalNames,Fi as convertToCommonJS,b as createDetailedErrorMessage,Vg as extractDirectiveNames,wl as extractScriptFromTemplate,y as extractVariables,s as fileExists,Ry as getComponentCacheStats,Fg as getPositionInfo,ie as getSharedTranspiler,Cl as getSourceLineInfo,Hg as hasDirectives,vl as hasVariables,qg as isHydrateTrigger,Ug as isJavaScriptScript,Ye as renderComponentWithSlot,In as resolveTemplatePath,Wg as scopeOnRootElement,lo as scopeSequenceKey,Xe as shouldTranspileTypeScript,kl as slotContentHasExpressions,Je as transpileTypeScript,zr as userComponentFileExists,zg as validateDirective,Bg as validateTemplate};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{m,p}from"./chunk-945zygwa.js";import{oe,F,g}from"./chunk-
|
|
2
|
+
import{m,p}from"./chunk-945zygwa.js";import{oe,F,g}from"./chunk-ayhh7b6f.js";function z(t,o){let i=1,r=o,e="<template",n="</template";while(r<t.length&&i>0){let s=t.indexOf("<",r);if(s===-1)break;if(r=s,t.startsWith(e,r)&&(r+e.length>=t.length||/[\s>\/]/.test(t[r+e.length]))){i++,r+=e.length;continue}if(t.startsWith(n,r)){let a=t.indexOf(">",r+n.length);if(a!==-1){if(i--,i===0)return a+1;r=a+1;continue}}r++}return i===0?r:-1}var N=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function k(t,o){let i=null;for(let r=o;r<t.length;r++){let e=t[r];if(i){if(e==="\\"){r++;continue}if(e===i)i=null;continue}if(e==='"'||e==="'"){i=e;continue}if(e===">")return r+1}return-1}function B(t,o,i){let r=o.toLowerCase(),e=1,n=i;while(n<t.length){let s=t.indexOf("<",n);if(s===-1)return-1;if(t.startsWith("<!--",s)){let f=t.indexOf("-->",s+4);n=f===-1?t.length:f+3;continue}let a=k(t,s+1);if(a===-1)return-1;let u=t.slice(s,a),c=u.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(c&&c[2].toLowerCase()===r){if(c[1]==="/"){if(e--,e===0)return a}else if(!/\/\s*>$/.test(u))e++}n=a}return-1}function Z(t){let o=[],i=[],r=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=k(t,n+1);if(s===-1)break;let a=t.slice(n,s),u=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!u){e=s;continue}let c=u[2].toLowerCase();if(u[1]==="/"){let l=i.lastIndexOf(c);if(l!==-1)i.splice(l);e=s;continue}let f=/\/\s*>$/.test(a),d=i.length===0?a.match(r):null;if(d){let l=d[1]||d[2],h=a.replace(r,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),S=f||N.has(c)?-1:B(t,c,s);if(S===-1)o.push({start:n,end:s,slotName:l,element:h}),e=s;else o.push({start:n,end:S,slotName:l,element:h+t.slice(s,S)}),e=S;continue}if(!f&&!N.has(c)){if(i.push(c),c==="script"||c==="style"){let l=t.toLowerCase().indexOf(`</${c}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function L(t){let o=[],i=[],r=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=k(t,n+1);if(s===-1)break;let a=t.slice(n,s),u=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!u){e=s;continue}let c=u[1]==="/",f=u[2].toLowerCase();if(c){let l=i.lastIndexOf(f);if(l!==-1)i.splice(l);e=s;continue}if(f==="template"&&i.length===0){let l=a.match(r);if(l){let h=z(t,s);if(h!==-1){let S=l[1]||l[2]||l[3];o.push({start:n,end:h,slotName:S,content:t.slice(s,h-11).trim(),propsBinding:l[4]||void 0}),e=h;continue}}}if(!/\/\s*>$/.test(a)&&!N.has(f)){if(i.push(f),f==="script"||f==="style"){let l=t.toLowerCase().indexOf(`</${f}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function yu(t){let o={default:"",named:new Map},i=t,r=L(t);for(let n of r)o.named.set(n.slotName,{name:n.slotName,content:n.content,propsBinding:n.propsBinding});r.sort((n,s)=>s.start-n.start);for(let n of r)i=i.slice(0,n.start)+i.slice(n.end);let e=Z(i);for(let n of e){let s=o.named.get(n.slotName);if(s)s.content+=n.element;else o.named.set(n.slotName,{name:n.slotName,content:n.element})}for(let n=e.length-1;n>=0;n--){let s=e[n];i=i.slice(0,s.start)+i.slice(s.end)}return o.default=i.trim(),o}function Km(t){let o=t.match(/name\s*=\s*["']([^"']+)["']/),i=o?o[1]:"",r={},e=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,n;while((n=e.exec(t))!==null)r[n[1]]=n[2];let s=t.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),a=s?s[1].trim():"";return{name:i,props:r,defaultContent:a}}async function bu(t,o,i,r){if(!t)return i;let e=t.content;if(t.propsBinding&&Object.keys(o).length>0){let n=t.propsBinding.trim(),s={...r},a=new Set,u=new Set;if(n.startsWith("{")&&n.endsWith("}")){let c=n.slice(1,-1).split(",").map((f)=>f.trim()).filter(Boolean);for(let f of c){let[d,l]=f.split(":").map((S)=>S.trim()),h=l||d;if(s[h]=o[d],o[d]!==void 0)u.add(h);else a.add(h)}}else if(s[n]=o,Object.values(o).some((c)=>c===void 0))a.add(n);else u.add(n);e=j(e,s,a,u)}return e}function j(t,o,i,r){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(e,n)=>{try{let s=n.trim();if(F(s,i))return e;if(Array.isArray(o.__stx_preserved_client_expressions)&&o.__stx_preserved_client_expressions.includes(s)&&!F(s,r))return e;let a=_(s,o);if(a===void 0)return e;return g(String(a??""))}catch{return`{{ ${n} }}`}})}function _(t,o){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(t)){let r=t.split("."),e=o;for(let n of r)if(e&&typeof e==="object"&&n in e)e=e[n];else return;return e}let i=t.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(i){let[,r,e,n]=i,s=o[r],a=parseInt(n,10);if(typeof s==="number")switch(e){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":return s/a}}try{if(!m(t))return;return p(t,Object.keys(o))(...Object.values(o))}catch{return}}async function wu(t,o,i,r){let e=t;e=await I(e,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(a,u,c,f)=>{let d=o.named.get(u),l=f?.trim()||"",h=c||"",S={},E=[],C=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,b;while((b=C.exec(h))!==null){let w=b[1],x=b[2];S[w]=_(x,i),E.push([w,x])}if(r!==void 0&&d?.propsBinding&&Object.values(S).some((w)=>w===void 0)){let w=d.propsBinding.trim(),x=oe(`${w} in []`),y="__stx_slot_props";while(x.includes(y))y+="_";let M=E.map(([A,P])=>{let O=S[A],R;try{R=O===void 0?void 0:JSON.stringify(O)}catch{}return`${JSON.stringify(A)}:(${R??P})`}).join(","),v=g(JSON.stringify({binding:w,names:x,owner:r}));return`<template :for="${g(`${y} in [{${M}}]`)}" data-stx-slot-binding="${encodeURIComponent(w)}" data-stx-slot-scope="${v}">${d.content}</template>`}return await bu(d,S,l,i)});let s=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return e=e.replace(s,(a,u,c)=>{if(/\bname\s*=/.test(u||""))return a;let f=c?.trim()||"";return o.default||f}),e}async function I(t,o,i){let r=[],e=[];t.replace(o,(a,...u)=>{let c=u[u.length-2];return e.push({match:a,index:c}),r.push(i(a,...u.slice(0,-2))),a});let n=await Promise.all(r),s=t;for(let a=e.length-1;a>=0;a--){let{match:u,index:c}=e[a];s=s.slice(0,c)+n[a]+s.slice(c+u.length)}return s}function Gm(t){let o=yu(t);return{defaultSlot:o.default,namedSlots:o.named}}async function Xm(t,o,i,r,e){return await wu(t,{default:o,named:i},r,e)}
|
|
3
3
|
export{yu,Km,bu,wu,Gm,Xm};
|