@stacksjs/stx 0.2.304 → 0.2.306
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-0gz0rhvs.js → chunk-0gbptqh2.js} +1 -1
- package/dist/{chunk-g97atepq.js → chunk-0mnv8pf5.js} +1 -1
- package/dist/{chunk-nqq7y7m9.js → chunk-18p8dqya.js} +1 -1
- package/dist/{chunk-gfc3qye3.js → chunk-1bmtk8s5.js} +1 -1
- package/dist/{chunk-fvtv1s5j.js → chunk-1zcm299e.js} +1 -1
- package/dist/{chunk-awj7yy37.js → chunk-1ztjv7a4.js} +1 -1
- package/dist/{chunk-qev11kg8.js → chunk-2kv2gnzc.js} +1 -1
- package/dist/chunk-2mx57479.js +2 -0
- package/dist/{chunk-b4xwbh8a.js → chunk-322qz0cj.js} +1 -1
- package/dist/{chunk-t51mwjyq.js → chunk-397rqs12.js} +1 -1
- package/dist/{chunk-env6knrs.js → chunk-3by4c2g9.js} +1 -1
- package/dist/{chunk-tt4r8q4v.js → chunk-3pv0qj5f.js} +1 -1
- package/dist/{chunk-9499k64n.js → chunk-3qc0h6bj.js} +2 -2
- package/dist/{chunk-9xzszvn5.js → chunk-3qfz82gw.js} +1 -1
- package/dist/chunk-455m2k1y.js +2 -0
- package/dist/{chunk-c131k3mt.js → chunk-4ee1aaet.js} +1 -1
- package/dist/{chunk-d3srvh3q.js → chunk-4hk5ewgp.js} +1 -1
- package/dist/{chunk-xganfzgn.js → chunk-4k0h6sca.js} +1 -1
- package/dist/chunk-4mtc9vyb.js +2 -0
- package/dist/chunk-4yky0frv.js +2 -0
- package/dist/{chunk-wx13qmaw.js → chunk-51gea48g.js} +1 -1
- package/dist/chunk-5598ankf.js +2 -0
- package/dist/{chunk-gbwhbasw.js → chunk-5g39e9ra.js} +1 -1
- package/dist/{chunk-8215nhej.js → chunk-5yhb5fad.js} +1 -1
- package/dist/{chunk-xsfwcj6x.js → chunk-604qr43v.js} +1 -1
- package/dist/chunk-6vt9ddra.js +2 -0
- package/dist/{chunk-9vqnrcrw.js → chunk-74sgwgyt.js} +1 -1
- package/dist/{chunk-zggm7kjd.js → chunk-79nj87t6.js} +1 -1
- package/dist/chunk-7amgwmrw.js +2 -0
- package/dist/{chunk-gssbag3e.js → chunk-7c1qq9zq.js} +1 -1
- package/dist/chunk-7q81jygp.js +2 -0
- package/dist/{chunk-sb7ana2z.js → chunk-7sn5rbrd.js} +1 -1
- package/dist/{chunk-yyyxt326.js → chunk-7yzyn9k7.js} +1 -1
- package/dist/{chunk-ppyz9623.js → chunk-85p4dmft.js} +1 -1
- package/dist/chunk-8n2cafmh.js +2 -0
- package/dist/{chunk-8ee62a9q.js → chunk-8q8gj45z.js} +1 -1
- package/dist/chunk-9aw5d4rr.js +2 -0
- package/dist/{chunk-5k1hznvq.js → chunk-9b9znn2f.js} +2 -2
- package/dist/{chunk-y7wsk78j.js → chunk-9eat8v8r.js} +1 -1
- package/dist/{chunk-fp7ms6e7.js → chunk-9ebfmdyb.js} +1 -1
- package/dist/chunk-9j1jfhrf.js +2 -0
- package/dist/chunk-9ypp0a8t.js +2 -0
- package/dist/{chunk-rzevgemj.js → chunk-a50hb40e.js} +1 -1
- package/dist/{chunk-z9ezmjwd.js → chunk-aftse9mb.js} +1 -1
- package/dist/{chunk-wfffa8zm.js → chunk-aqrp68m6.js} +1 -1
- package/dist/{chunk-8jam44my.js → chunk-at84gyvf.js} +1 -1
- package/dist/{chunk-ess2pgt5.js → chunk-b8cteeha.js} +1 -1
- package/dist/{chunk-mbmqpaq1.js → chunk-bnq0p4r4.js} +1 -1
- package/dist/{chunk-ez28vck6.js → chunk-bs18cyh6.js} +1 -1
- package/dist/{chunk-yz16bgs3.js → chunk-bxqzqwv5.js} +1 -1
- package/dist/chunk-bzmxbz48.js +2 -0
- package/dist/{chunk-5x2fc4vk.js → chunk-e5yebhrk.js} +2 -2
- package/dist/{chunk-45y8bjrv.js → chunk-ejjzrtym.js} +10 -10
- package/dist/{chunk-54f8bpp6.js → chunk-ewcxfn7m.js} +3 -3
- package/dist/{chunk-gt8ja700.js → chunk-f044qmn3.js} +1 -1
- package/dist/chunk-f3k3kk5x.js +2 -0
- package/dist/{chunk-y2kmm6bt.js → chunk-ffexgxm3.js} +1 -1
- package/dist/chunk-fh97a60e.js +2 -0
- package/dist/chunk-fzwqh8sy.js +2 -0
- package/dist/chunk-g812bscg.js +2 -0
- package/dist/chunk-gt40xkj3.js +2 -0
- package/dist/chunk-h78pksyp.js +2 -0
- package/dist/chunk-hq3w5crk.js +2 -0
- package/dist/chunk-hy1ma54e.js +2 -0
- package/dist/{chunk-695fkras.js → chunk-j3ajrx2n.js} +1 -1
- package/dist/{chunk-jsg1rthc.js → chunk-jd9nv63q.js} +1 -1
- package/dist/{chunk-jp2f8yzw.js → chunk-jryjwara.js} +1 -1
- package/dist/{chunk-4evbx7sz.js → chunk-jwnbwemq.js} +1 -1
- package/dist/{chunk-zhcs8m2a.js → chunk-k14nr7rz.js} +1 -1
- package/dist/{chunk-hg2afckn.js → chunk-ka2xspj3.js} +1 -1
- package/dist/{chunk-mygq61f5.js → chunk-ka5wtqmw.js} +1 -1
- package/dist/{chunk-6vswphz4.js → chunk-kdkv0j67.js} +1 -1
- package/dist/{chunk-d5cqnwdd.js → chunk-kexk6z9s.js} +1 -1
- package/dist/{chunk-9wrrr7g3.js → chunk-kgtbm5rp.js} +1 -1
- package/dist/{chunk-qeyw5za9.js → chunk-ksqba0cq.js} +1 -1
- package/dist/chunk-kz149fx5.js +2 -0
- package/dist/chunk-mhety3pf.js +2 -0
- package/dist/{chunk-m31n9pkr.js → chunk-msmhta0w.js} +1 -1
- package/dist/chunk-mvj75wef.js +2 -0
- package/dist/{chunk-cbgh359m.js → chunk-n43zq50e.js} +1 -1
- package/dist/{chunk-g912mb7x.js → chunk-nnv8wytm.js} +1 -1
- package/dist/chunk-nvb9nsqv.js +2 -0
- package/dist/chunk-ps7nfwq5.js +2 -0
- package/dist/{chunk-hay1rzb0.js → chunk-qhnyrwz2.js} +268 -267
- package/dist/{chunk-fczfdsab.js → chunk-r7qap4bh.js} +2 -2
- package/dist/chunk-raxr83fs.js +60 -0
- package/dist/{chunk-jfzfrmzy.js → chunk-rtaa4ys9.js} +1 -1
- package/dist/{chunk-jxxv18a0.js → chunk-ry1key0g.js} +1 -1
- package/dist/{chunk-ankp4reb.js → chunk-s3951qwp.js} +1 -1
- package/dist/{chunk-9c835qjn.js → chunk-s3pvp8qv.js} +1 -1
- package/dist/chunk-smtve243.js +2 -0
- package/dist/{chunk-sart9ehj.js → chunk-snmtft92.js} +1 -1
- package/dist/chunk-szdwkfzq.js +2 -0
- package/dist/{chunk-zs5y7xnt.js → chunk-t5kwx6fa.js} +1 -1
- package/dist/{chunk-39qzhpn6.js → chunk-ttkt7xhd.js} +2 -2
- package/dist/{chunk-rrankpmj.js → chunk-ttny9g8k.js} +1 -1
- package/dist/chunk-v33qvj8y.js +2 -0
- package/dist/{chunk-30nbe9hr.js → chunk-v7b5ny0x.js} +2 -2
- package/dist/{chunk-d19tvdvv.js → chunk-vhan24as.js} +1 -1
- package/dist/chunk-vpbw6g2t.js +2 -0
- package/dist/{chunk-1c2j4eby.js → chunk-w1dxgs78.js} +1 -1
- package/dist/{chunk-hgjjnjas.js → chunk-w764f6g4.js} +2 -2
- package/dist/{chunk-bd9wrcq1.js → chunk-w8hkprzv.js} +1 -1
- package/dist/{chunk-ghw5p1yk.js → chunk-wm86mmgq.js} +1 -1
- package/dist/{chunk-d57gb0v2.js → chunk-wwghzbbg.js} +1 -1
- package/dist/{chunk-kxavsh3m.js → chunk-xcsf7my7.js} +1 -1
- package/dist/chunk-xfdckfqr.js +2 -0
- package/dist/{chunk-hrcxfvh1.js → chunk-y4dd2n2n.js} +1 -1
- package/dist/{chunk-7skk34dh.js → chunk-ybct46zd.js} +1 -1
- package/dist/chunk-z8yh03mr.js +2 -0
- package/dist/{chunk-t3qb9s6s.js → chunk-zdzd2jb4.js} +1 -1
- package/dist/{chunk-7gqbr8nr.js → chunk-zr1r73p3.js} +1 -1
- package/dist/cli.js +14 -14
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/database.js +1 -1
- package/dist/expressions.d.ts +10 -1
- package/dist/expressions.js +42 -11
- package/dist/includes.js +19 -1
- package/dist/pwa.js +2 -2
- package/dist/safe-evaluator.d.ts +18 -0
- package/dist/safe-evaluator.js +100 -17
- package/dist/seo.js +34 -4
- package/dist/ssg.js +2 -2
- package/dist/visual-testing.js +1 -1
- package/package.json +5 -5
- package/dist/chunk-02hm88m5.js +0 -2
- package/dist/chunk-2h94c5hm.js +0 -60
- package/dist/chunk-3z6bqqr7.js +0 -2
- package/dist/chunk-43p1qq7g.js +0 -2
- package/dist/chunk-4jgr954p.js +0 -2
- package/dist/chunk-51j2aqvb.js +0 -2
- package/dist/chunk-5qfpcgcs.js +0 -2
- package/dist/chunk-6hcc4973.js +0 -2
- package/dist/chunk-8z0n5mtg.js +0 -2
- package/dist/chunk-976g5qe5.js +0 -2
- package/dist/chunk-9px4y692.js +0 -2
- package/dist/chunk-a07chbgj.js +0 -2
- package/dist/chunk-b1hd8kvy.js +0 -2
- package/dist/chunk-c3tmzx7q.js +0 -2
- package/dist/chunk-ckzhp09g.js +0 -2
- package/dist/chunk-dgpjxmhs.js +0 -2
- package/dist/chunk-hzav4hyd.js +0 -2
- package/dist/chunk-jjq9q9jr.js +0 -2
- package/dist/chunk-kbw2qzqx.js +0 -2
- package/dist/chunk-kdxvraec.js +0 -2
- package/dist/chunk-krfjb7b8.js +0 -2
- package/dist/chunk-nws8fbde.js +0 -2
- package/dist/chunk-pr14wjkn.js +0 -2
- package/dist/chunk-rpfcnq8n.js +0 -2
- package/dist/chunk-rst1rw09.js +0 -2
- package/dist/chunk-snt2773t.js +0 -2
- package/dist/chunk-vd3h9z7e.js +0 -2
- package/dist/chunk-wbecqx03.js +0 -2
- package/dist/chunk-xd5ahrtn.js +0 -2
- package/dist/chunk-xq1swv2e.js +0 -2
- package/dist/chunk-xzgvcrnz.js +0 -2
- package/dist/chunk-yyebm8q4.js +0 -2
- package/dist/chunk-zbtfhxhn.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{cw as Te,dw as u}from"./chunk-jryjwara.js";function F(e){return e.split(/[\\/]/).filter(Boolean).slice(0,-1).some((a)=>m.includes(a))}function y(e){return F(e.replace(/^\//,""))}var m;var x=u(()=>{m=["components","layouts","partials","emails"]});import d from"fs";import v from"path";function S(e,t){let a=e.filter((o)=>!y(o.pattern)),r=["// Auto-generated by STX - do not edit"];if(a.length===0)r.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{r.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let o of a){let i=[];for(let c of o.params){let h=o.pattern.includes(`:${c}?`)?"?":"";i.push(`${c}${h}: string`)}let l=i.join("; ");r.push(` '${o.pattern}': { ${l} }`)}r.push(" }","}","","export {}","")}let n=r.join(`
|
|
3
3
|
`),s=v.join(t,"route-types.d.ts");try{if(d.existsSync(s)&&d.readFileSync(s,"utf8")===n)return;d.mkdirSync(t,{recursive:!0}),d.writeFileSync(s,n)}catch{}}function k(e,t,a){let r=process.cwd(),n=v.relative(r,a),s=e.filter((i)=>!y(i.pattern)),o=["// Auto-generated by stx \u2014 do not edit",`// Source: ${n||"pages"}/`,"","export const routes = ["];for(let i of s){let l=v.relative(r,i.filePath).replace(/\\/g,"/"),c=JSON.stringify(i.params),h=i.layout?`, layout: '${v.relative(r,i.layout).replace(/\\/g,"/")}'`:"";o.push(` { pattern: '${i.pattern}', filePath: '${l}', isDynamic: ${i.isDynamic}, params: ${c}${h} },`)}o.push("] as const",""),o.push("export type RouteName = typeof routes[number]['pattern']",""),d.mkdirSync(t,{recursive:!0}),d.writeFileSync(v.join(t,"routes.ts"),o.join(`
|
|
4
4
|
`))}var M=u(()=>{x()});import D from"path";function A(e,t){let r=D.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(D.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function w(e){let t=[],a="",r=0;while(r<e.length){let n=e.slice(r),s=/^\/:([^/?*]+)\?/.exec(n);if(s){t.push(s[1]),a+="(?:/([^/]+))?",r+=s[0].length;continue}let o=/^:([^/?*]+)\*/.exec(n);if(o){t.push(o[1]),a+="(.+)",r+=o[0].length;continue}let i=/^:([^/?*]+)/.exec(n);if(i){t.push(i[1]),a+="([^/]+)",r+=i[0].length;continue}a+=e[r].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),r+=1}return{regex:new RegExp(`^${a}$`),params:t}}function W(e,t){let a=e===""?"/":e;for(let r of t){let n=a.match(r.regex);if(n){let s={};return r.params.forEach((o,i)=>{s[o]=n[i+1]}),{route:r,params:s}}}return null}function K(e){let t=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return w(t)}var I=()=>{};import ke from"fs";import N from"path";function C(e,t){let a=[],r=N.dirname(e);while(r.startsWith(t)||r===t){let n=N.join(r,"_layout.stx");if(ke.existsSync(n))a.unshift(n);if(r===t)break;r=N.dirname(r)}return a}var B=()=>{};import P from"fs";import p from"path";function $(e,t){let a=[];if(!P.existsSync(e))return a;let r=P.readdirSync(e,{withFileTypes:!0});for(let n of r){let s=p.join(e,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(m.includes(n.name))continue;a.push(...$(s,t))}else if(n.isFile()){let o=p.extname(n.name);if(t.includes(o)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(s)}}}return a}class T{routes;pagesDir;pagesDirs;config;constructor(e,t={}){this.config=t;let a=t.pagesDirs&&t.pagesDirs.length>0?t.pagesDirs:[t.pagesDir||"pages"];this.pagesDirs=a.map((o)=>p.resolve(e,o)),this.pagesDir=this.pagesDirs[0];let r=t.extensions||[".stx"],n=new Set;this.routes=[];for(let o of this.pagesDirs){let i=$(o,r),l=new Map;for(let c of i){let h=A(c,o),g=t.pagesDirs?h.replace(/:[\w]+/g,":param"):h;if(t.pagesDirs&&l.has(g))throw Error(`Conflicting layer pages for ${h}: ${l.get(g)} and ${c}`);if(l.set(g,c),n.has(g))continue;n.add(g);let{regex:Se,params:V}=w(h),O=t.layouts!==!1?C(c,o):[];this.routes.push({pattern:h,regex:Se,params:V,filePath:c,isDynamic:V.length>0,layout:O.length>0?O[O.length-1]:void 0})}}this.routes.sort((o,i)=>{if(!o.isDynamic&&i.isDynamic)return-1;if(o.isDynamic&&!i.isDynamic)return 1;let l=o.pattern.split("/").length,c=i.pattern.split("/").length;if(l!==c)return c-l;return o.pattern.localeCompare(i.pattern)});let s=p.resolve(e,t.stateDir||process.env.STX_DIR?.trim()||".stx");S(this.routes,s),k(this.routes,s,this.pagesDir)}match(e){let t=e===""?"/":e;for(let a of this.routes){let r=t.match(a.regex);if(r){let n={};return a.params.forEach((s,o)=>{n[s]=r[o+1]}),{route:a,params:n}}}return null}resolve(e,t){let a=this.routes.find((n)=>n.pattern===e||n.filePath.includes(e));if(!a)return"#not-found";let r=a.pattern;if(t)for(let[n,s]of Object.entries(t))r=r.replace(`:${n}`,encodeURIComponent(s));return r}addRoute(e){this.routes.push(e),this.routes.sort((t,a)=>{if(!t.isDynamic&&a.isDynamic)return-1;if(t.isDynamic&&!a.isDynamic)return 1;return t.pattern.localeCompare(a.pattern)})}getLayout(e){return e.layout??null}}function z(e,t){return new T(e,t)}function J(e,t){let a=[`${t}.stx`,"error.stx"];for(let r of a){let n=p.join(e,r);if(P.existsSync(n))return n}return null}function Y(e,t){return e.map((a)=>{let r=p.relative(t,a.filePath),n=a.isDynamic?" (dynamic)":"";return`${a.pattern} \u2192 ${r}${n}`})}var Z=u(()=>{M();I();B();x()});function Q(e){R=e.replace(/\/$/,"")}function ee(e,t,a={}){f[e]={path:t,name:e,params:a}}function te(e){for(let[t,a]of Object.entries(e))if(typeof a==="string")f[t]={path:a,name:t};else f[t]={...a,name:t}}function re(e,t={},a=!1){let r=f[e];if(!r)return console.warn(`Route [${e}] not defined.`),"#undefined-route";let n={...r.params,...t},s=r.path;s=s.replace(/:(\w+)/g,(i,l)=>{let c=n[l];if(c===void 0)return console.warn(`Missing parameter [${l}] for route [${e}].`),`:${l}`;return delete n[l],encodeURIComponent(String(c))});let o=Object.entries(n);if(o.length>0){let i=o.map(([l,c])=>`${encodeURIComponent(l)}=${encodeURIComponent(String(c))}`).join("&");s+=(s.includes("?")?"&":"?")+i}return a&&R?`${R}${s}`:s}function ae(){for(let e of Object.keys(f))delete f[e];R=""}var f,R="";var ne=u(()=>{f={}});import oe from"fs";import se from"path";function ie(e,t={}){return{type:"redirect",path:e,options:{replace:t.replace??!1,external:t.external??!1,redirectCode:t.redirectCode??302}}}function le(e){return{type:"abort",error:typeof e==="string"?{statusCode:500,message:e}:e}}function ce(e,t={}){return{handler:e,mode:t.mode??"universal"}}function G(e){let t={};if(!e)return t;let a=e.split(";");for(let r of a){let[n,...s]=r.split("=");if(n){let o=n.trim(),i=s.join("=").trim();if(o)t[o]=decodeURIComponent(i)}}return t}function E(e,t,a={}){let r=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(a.expires){let n=typeof a.expires==="number"?new Date(Date.now()+a.expires*1000):a.expires;r+=`; Expires=${n.toUTCString()}`}if(a.path)r+=`; Path=${a.path}`;if(a.domain)r+=`; Domain=${a.domain}`;if(a.secure)r+="; Secure";if(a.httpOnly)r+="; HttpOnly";if(a.sameSite)r+=`; SameSite=${a.sameSite}`;return r}function U(e,t){let a=e.headers.get("cookie")||"",r=G(a);return{get(n){return r[n]},set(n,s,o={}){r[n]=s,t.append("Set-Cookie",E(n,s,o))},delete(n){delete r[n],t.append("Set-Cookie",E(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function X(){return{get(e){if(typeof document>"u")return;return G(document.cookie)[e]},set(e,t,a={}){if(typeof document>"u")return;document.cookie=E(e,t,a)},delete(e){if(typeof document>"u")return;document.cookie=E(e,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return G(document.cookie)}}}function j(){let e=typeof window<"u"&&typeof window.localStorage<"u";return{get(t){if(!e)return null;try{return window.localStorage.getItem(t)}catch{return null}},set(t,a){if(!e)return;try{window.localStorage.setItem(t,a)}catch{}},remove(t){if(!e)return;try{window.localStorage.removeItem(t)}catch{}},isAvailable(){return e}}}function L(e,t){b.set(e,t)}function q(e){return b.get(e)}function ue(e){return b.has(e)}function he(){b.clear()}function de(){return Array.from(b.keys())}async function pe(e,t="middleware"){let a=se.resolve(e,t);if(!oe.existsSync(a))return;let r=oe.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let s=n.replace(/\.(ts|js)$/,""),o=se.join(a,n);try{let l=(await import(o)).default;if(l&&typeof l.handler==="function")L(s,l);else if(typeof l==="function")L(s,{handler:l,mode:"universal"})}catch(i){console.warn(`Failed to load middleware '${s}' from ${o}:`,i)}}}function Ae(e){let t={};if(!e)return t;let a=new URLSearchParams(e);for(let[r,n]of a)t[r]=n;return t}function fe(e,t,a,r=""){return{path:e,params:t,query:Ae(r),fullPath:r?`${e}?${r}`:e,meta:a}}function ge(e,t,a,r){let n=r?.isServer??typeof window>"u",s=!n,o=new Headers;return{to:e,from:t,isClient:s,isServer:n,cookies:n&&a?U(a,o):X(),storage:j(),state:{},request:a,responseHeaders:o}}async function me(e,t){let a=Array.isArray(e)?e:[e],r=t.isServer;for(let n of a){let s=q(n);if(!s)return console.error(`Route middleware '${n}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${n}' is not registered`}},state:t.state,responseHeaders:t.responseHeaders};if(s.mode==="server"&&!r)continue;try{let o=await s.handler(t);if(o){if(o.type==="redirect")return{passed:!1,redirect:o,state:t.state,responseHeaders:t.responseHeaders};if(o.type==="abort")return{passed:!1,abort:o,state:t.state,responseHeaders:t.responseHeaders}}}catch(o){return console.error(`Error in middleware '${n}':`,o),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:o instanceof Error?o.message:"Middleware error"}},state:t.state,responseHeaders:t.responseHeaders}}}return{passed:!0,state:t.state,responseHeaders:t.responseHeaders}}var b;var ye=u(()=>{b=new Map});function H(e){let a=e.replace(/\\/g,"/").split("/").filter(Boolean),r=a.lastIndexOf("layouts"),n=r>=0?a[r+1]:a.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function ve(e){let t=e.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),a=e.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=e.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),n=t?.[1]||r?.[1]||"";return{layout:n,group:a?.[1]||H(n)}}var we=()=>{};function Ce(e){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return e}}function be(){if(_)return _;return _=Ce(`
|
|
5
5
|
;(function(){
|
|
@@ -1997,4 +1997,4 @@ else {
|
|
|
1997
1997
|
if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
|
|
1998
1998
|
})();
|
|
1999
1999
|
`),_}var _;var xe=()=>{};var Re={};Te(Re,{setAppUrl:()=>Q,runMiddleware:()=>me,route:()=>re,resolveLayoutChain:()=>C,resetRoutes:()=>ae,registerMiddleware:()=>L,patternToRegex:()=>w,navigateTo:()=>ie,matchRoute:()=>W,loadMiddlewareFromDirectory:()=>pe,isNonPageRoutePattern:()=>y,isNonPageRoutePath:()=>F,hasMiddleware:()=>ue,getRouterScript:()=>be,getMiddlewareNames:()=>de,getMiddleware:()=>q,generateRouteTypes:()=>S,generateRouteManifest:()=>k,formatRoutes:()=>Y,findErrorPage:()=>J,filePathToPattern:()=>A,extractLayoutMetadata:()=>ve,deriveLayoutGroup:()=>H,defineRoutes:()=>te,defineRoute:()=>ee,defineMiddleware:()=>ce,createStorageManager:()=>j,createServerCookieManager:()=>U,createRouter:()=>z,createRouteLocation:()=>fe,createMiddlewareContext:()=>ge,createClientCookieManager:()=>X,clearMiddleware:()=>he,bracketPathToRegex:()=>K,abortNavigation:()=>le,Router:()=>T,NON_PAGE_DIRS:()=>m});var Ee=u(()=>{Z();I();ne();ye();B();we();M();x();xe()});
|
|
2000
|
-
export{m as
|
|
2000
|
+
export{m as jv,F as kv,y as lv,S as mv,k as nv,A as ov,w as pv,W as qv,K as rv,C as sv,T as tv,z as uv,J as vv,Y as wv,Q as xv,ee as yv,te as zv,re as Av,ae as Bv,ie as Cv,le as Dv,ce as Ev,U as Fv,X as Gv,j as Hv,L as Iv,q as Jv,ue as Kv,he as Lv,de as Mv,pe as Nv,fe as Ov,ge as Pv,me as Qv,H as Rv,ve as Sv,we as Tv,be as Uv,Re as Vv,Ee as Wv};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ht as bq}from"./chunk-at84gyvf.js";import{ew as k}from"./chunk-jryjwara.js";var fq={1001:{message:"Unclosed directive: {{directive}}",help:"Make sure to close the directive with the appropriate end tag"},1002:{message:"Unclosed expression at position {{position}}",help:"Check for missing closing braces }}"},1003:{message:"Invalid directive syntax: {{directive}}",help:"Review the directive documentation for correct syntax"},1004:{message:"Malformed expression: {{expression}}",help:"Check for syntax errors in your expression"},1005:{message:"Unexpected token: {{token}}",help:"Remove or fix the unexpected token"},1101:{message:"Undefined variable: {{variable}}",help:"Make sure the variable is defined in the template context"},1102:{message:"Type error: {{details}}",help:"Check that you are using the correct types"},1103:{message:"Evaluation error: {{details}}",help:"Review the expression for errors"},1104:{message:"Infinite loop detected in {{location}}",help:"Check your loop conditions"},1105:{message:"Circular reference detected: {{path}}",help:"Remove the circular dependency"},1201:{message:"Unsafe expression blocked: {{expression}}",help:"This expression contains potentially dangerous code"},1202:{message:"Path traversal attempt blocked: {{path}}",help:"Use only relative paths within allowed directories"},1203:{message:"Potential XSS attempt blocked",help:"Sanitize user input before rendering"},1204:{message:"Code injection attempt blocked: {{code}}",help:"Avoid executing dynamic code"},1205:{message:"Prohibited DOM API usage: {{api}}",help:"Use STX.useRefs(), STX.useRef(), STX.el() and other STX helpers instead of direct DOM manipulation"},1301:{message:"File not found: {{path}}",help:"Check that the file exists and the path is correct"},1302:{message:"Error reading file: {{path}}",help:"Check file permissions and encoding"},1303:{message:"Invalid file path: {{path}}",help:"Use a valid file path"},1304:{message:"Permission denied: {{path}}",help:"Check file permissions"},1401:{message:"Invalid configuration: {{details}}",help:"Review your stx.config.ts file"},1402:{message:"Missing required configuration: {{key}}",help:"Add the required configuration option"},1403:{message:"Deprecated configuration: {{key}}",help:"Update to the new configuration format"},1501:{message:"Component not found: {{name}}",help:"Check that the component exists in your components directory"},1502:{message:"Invalid props for component {{name}}: {{details}}",help:"Check the component prop requirements"},1503:{message:"Error rendering component {{name}}: {{details}}",help:"Check the component template for errors"},1601:{message:"Filter not found: {{filter}}",help:"Register the filter or check the filter name"},1602:{message:"Invalid arguments for filter {{filter}}: {{details}}",help:"Check the filter documentation for correct arguments"},1603:{message:"Expression evaluation timed out",help:"Simplify the expression or increase the timeout"}},b={},$q="en";function hq(q){$q=q}function uq(){return $q}function dq(q){b={...b,...q}}function pq(){b={}}function Xq(q,Q={}){let J=b[q]||fq[q]||{message:`Unknown error (code: ${q})`},Z=J.message,$=J.help;for(let[Y,G]of Object.entries(Q)){let X=`{{${Y}}}`;if(Z=Z.replace(new RegExp(X,"g"),G),$)$=$.replace(new RegExp(X,"g"),G)}return{message:Z,help:$}}function mq(q,Q={}){let{message:J,help:Z}=Xq(q,Q);return Z?`${J}
|
|
3
|
+
Help: ${Z}`:J}var U={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603};function u(q){for(let[Q,J]of Object.entries(U))if(J===q)return Q;return}function cq(){return!1}function L(){return!cq()||process.env.STX_DEBUG==="true"}function GQ(){return!1}import lq from"path";var Yq={showRelativePaths:!1,enableAutoRecovery:L(),logRecoveryWarnings:!0},T={...Yq};function iq(q){T={...T,...q}}function E(){return{...T}}function sq(){T={...Yq}}function C(q){if(!T.showRelativePaths||!q)return q;let Q=T.baseDir||process.cwd();try{let J=lq.relative(Q,q);return J.startsWith("..")?q:J}catch{return q}}class N extends Error{code;filePath;line;column;context;numericCode;constructor(q,Q,J,Z,$,Y,G){super(q);this.code=Q;this.filePath=J;this.line=Z;this.column=$;this.context=Y;if(this.name="StxError",this.numericCode=G||U.EVALUATION_ERROR,this.filePath)this.filePath=C(this.filePath)}}class Hq extends N{constructor(q,Q,J,Z,$,Y){super(q,"stx_SYNTAX_ERROR",Q,J,Z,$,Y||U.INVALID_DIRECTIVE_SYNTAX);this.name="StxSyntaxError"}}class Gq extends N{constructor(q,Q,J,Z,$,Y){super(q,"stx_RUNTIME_ERROR",Q,J,Z,$,Y||U.EVALUATION_ERROR);this.name="StxRuntimeError"}}class Wq extends N{constructor(q,Q,J,Z,$,Y){super(q,"stx_SECURITY_ERROR",Q,J,Z,$,Y||U.UNSAFE_EXPRESSION);this.name="StxSecurityError"}}class Bq extends N{constructor(q,Q,J,Z,$,Y){super(q,"stx_FILE_ERROR",Q,J,Z,$,Y||U.FILE_NOT_FOUND);this.name="StxFileError"}}class Vq extends N{isFatal=!0;constructor(q,Q,J,Z,$,Y){super(q,"stx_VALIDATION_ERROR",Q,J,Z,$,Y||U.DOM_API_VIOLATION);this.name="StxValidationError"}}function d(q){let{type:Q,message:J,code:Z,filePath:$,line:Y,column:G,template:X,offset:H,snippet:W,suggestion:B,format:V="text"}=q,w=Y,M=G;if(!w&&X&&H!==void 0){let I=Fq(X,H);w=I.line,M=I.column}let j=$?C($):void 0,D=Z?u(Z):void 0,K={type:Q,code:Z,codeName:D,message:J,filePath:j,line:w,column:M,snippet:W,suggestion:B,timestamp:new Date().toISOString()},F;switch(V){case"html":F=rq(K);break;case"json":F=JSON.stringify(K,null,2);break;case"console":F=oq(K,X,H);break;case"text":default:F=nq(K,X,H);break}return{formatted:F,data:K}}function nq(q,Q,J){let Z=[],$=q.code?` [${q.codeName||q.code}]`:"";if(Z.push(`[${q.type} Error${$}]`),q.filePath){let Y=q.filePath;if(q.line){if(Y+=`:${q.line}`,q.column)Y+=`:${q.column}`}Z.push(`at ${Y}`)}if(Z.push(`
|
|
4
|
+
${q.message}`),Q&&q.line){let Y=aq(Q,q.line,2);if(Y)Z.push(`
|
|
5
|
+
${Y}`)}if(q.snippet)Z.push(`
|
|
6
|
+
Snippet: ${q.snippet}`);if(q.suggestion)Z.push(`
|
|
7
|
+
Suggestion: ${q.suggestion}`);return Z.join(" ")}function rq(q){let Q=q.code?` [${q.code}]`:"",J=q.filePath?` in ${q.filePath}${q.line?`:${q.line}`:""}`:"",Z=`<!-- [${q.type} Error${Q}]${J}: ${wq(q.message)}`;if(q.suggestion)Z+=` | Suggestion: ${wq(q.suggestion)}`;return Z+=" -->",Z}function oq(q,Q,J){let W=[],B=q.code?` [${q.codeName||q.code}]`:"";if(W.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${q.type} Error${B} \u2501\u2501\u2501${"\x1B[0m"}`),q.filePath){let V=`\x1B[36m${q.filePath}\x1B[0m`;if(q.line){if(V+=`\x1B[90m:${q.line}\x1B[0m`,q.column)V+=`\x1B[90m:${q.column}\x1B[0m`}W.push(`
|
|
8
|
+
\x1B[90mat\x1B[0m ${V}`)}if(W.push(`
|
|
9
|
+
|
|
10
|
+
${q.message}`),Q&&q.line){let V=tq(Q,q.line,2);if(V)W.push(`
|
|
11
|
+
|
|
12
|
+
\x1B[90mContext:\x1B[0m
|
|
13
|
+
${V}`)}if(q.suggestion)W.push(`
|
|
14
|
+
|
|
15
|
+
\x1B[33mSuggestion:\x1B[0m ${q.suggestion}`);return W.push(`
|
|
16
|
+
${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),W.join("")}function aq(q,Q,J){let Z=q.split(`
|
|
17
|
+
`),$=Math.max(0,Q-J-1),Y=Math.min(Z.length-1,Q+J-1),G=[];for(let X=$;X<=Y;X++){let H=(X+1).toString().padStart(4),W=X===Q-1?">":" ";G.push(`${W}${H} | ${Z[X]}`)}return G.join(`
|
|
18
|
+
`)}function tq(q,Q,J){let Z=q.split(`
|
|
19
|
+
`),$=Math.max(0,Q-J-1),Y=Math.min(Z.length-1,Q+J-1),G="\x1B[90m",X="\x1B[31m",H="\x1B[0m",W=[];for(let B=$;B<=Y;B++){let V=(B+1).toString().padStart(4),w=B===Q-1,M=w?"\x1B[31m>\x1B[0m":" ",j=w?`\x1B[31m${Z[B]}\x1B[0m`:`\x1B[90m${Z[B]}\x1B[0m`;W.push(`${M}\x1B[90m${V}\x1B[0m | ${j}`)}return W.join(`
|
|
20
|
+
`)}function wq(q){return q.replace(/--/g,"- -").replace(/>/g,">")}function Fq(q,Q){let Z=q.substring(0,Q).split(`
|
|
21
|
+
`);return{line:Z.length,column:Z[Z.length-1].length}}function y(q,Q,J){return d({type:q,message:Q,code:J,format:"html"}).formatted}function eq(q,Q,J,Z,$){return d({type:q,message:Q,code:$,filePath:J,line:Z,format:"console"}).formatted}function qJ(q,Q,J){let Z=J.template.split(`
|
|
22
|
+
`),$=Fq(J.template,J.offset),Y=`[${q} Error at line ${$.line} in ${J.filePath}]: ${Q}
|
|
23
|
+
|
|
24
|
+
`,G=Math.max(0,$.line-3),X=Math.min(Z.length-1,$.line+2);Y+=`Context:
|
|
25
|
+
`;for(let H=G;H<=X;H++){let W=H+1,B=Z[H]||"",V=H===$.line-1?">":" ";Y+=`${V} ${W.toString().padStart(3)}: ${B}
|
|
26
|
+
`}if($.line-1<Z.length){let H=" ".repeat($.column+5);Y+=`${H}^
|
|
27
|
+
`}return Y}function JJ(q,Q,J){try{return q()}catch(Z){if(J&&Z instanceof Error)J(Z);return Q}}async function QJ(q,Q,J){try{return await q()}catch(Z){if(J&&Z instanceof Error)J(Z);return Q}}var ZJ={isEnabled(){return E().enableAutoRecovery},fixCommonSyntaxErrors(q){let Q=E();if(!Q.enableAutoRecovery)return{fixed:q,fixes:[]};let J=q,Z=[],$=(J.match(/\{\{/g)||[]).length,Y=(J.match(/\}\}/g)||[]).length;if($>Y){let X=$-Y;J+="}}".repeat(X),Z.push(`Added ${X} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let X of G){let H=(J.match(new RegExp(`@${X}\\b`,"g"))||[]).length,W=(J.match(new RegExp(`@end${X}\\b`,"g"))||[]).length;if(H>W){let B=H-W;for(let V=0;V<B;V++)J+=`
|
|
28
|
+
@end${X}`;Z.push(`Added ${B} missing @end${X}`)}}if(Z.length>0&&Q.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),Z.forEach((X)=>console.warn(` - ${X}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:J,fixes:Z}},createFallbackContent(q,Q){if(L())return`<!-- ${q} failed: ${Q.message} -->`;return"<!-- stx rendering error -->"}};class p{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor(q={}){this.maxErrors=q.maxErrors??1000,this.enableFileLogging=q.enableFileLogging??!1,this.logFilePath=q.logFilePath??".stx/errors.log",this.logFormat=q.logFormat??"json",this.maxFileSize=q.maxFileSize??10485760,this.maxLogFiles=q.maxLogFiles??5,this.minLevel=q.minLevel??"all"}configure(q){if(q.maxErrors!==void 0)this.maxErrors=q.maxErrors;if(q.enableFileLogging!==void 0)this.enableFileLogging=q.enableFileLogging;if(q.logFilePath!==void 0)this.logFilePath=q.logFilePath;if(q.logFormat!==void 0)this.logFormat=q.logFormat;if(q.maxFileSize!==void 0)this.maxFileSize=q.maxFileSize;if(q.maxLogFiles!==void 0)this.maxLogFiles=q.maxLogFiles;if(q.minLevel!==void 0)this.minLevel=q.minLevel}log(q,Q,J="error"){let Z={timestamp:new Date,error:q,context:Q,level:J};if(this.errors.push(Z),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(J))this.writeToFile(Z)}shouldLog(q){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return q==="error"||q==="warning";if(this.minLevel==="error")return q==="error";return!0}formatEntry(q){if(this.logFormat==="json")return JSON.stringify({timestamp:q.timestamp.toISOString(),level:q.level||"error",type:q.error.constructor.name,message:q.error.message,stack:q.error.stack,context:q.context});let Q=[`[${q.timestamp.toISOString()}] [${(q.level||"error").toUpperCase()}] ${q.error.constructor.name}: ${q.error.message}`];if(q.error.stack)Q.push(` Stack: ${q.error.stack.split(`
|
|
29
|
+
`).slice(1).join(`
|
|
30
|
+
`)}`);if(q.context)Q.push(` Context: ${JSON.stringify(q.context)}`);return Q.join(`
|
|
31
|
+
`)}writeToFile(q){this.writeQueue=this.writeQueue.then(async()=>{try{let Q=await import("fs"),Z=(await import("path")).dirname(this.logFilePath);if(!Q.existsSync(Z))Q.mkdirSync(Z,{recursive:!0});await this.rotateIfNeeded(Q);let $=`${this.formatEntry(q)}
|
|
32
|
+
`;Q.appendFileSync(this.logFilePath,$,"utf-8")}catch(Q){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",Q)}})}async rotateIfNeeded(q){try{if(!q.existsSync(this.logFilePath))return;if(q.statSync(this.logFilePath).size<this.maxFileSize)return;for(let J=this.maxLogFiles-1;J>=1;J--){let Z=`${this.logFilePath}.${J}`,$=`${this.logFilePath}.${J+1}`;if(q.existsSync(Z))if(J>=this.maxLogFiles-1)q.unlinkSync(Z);else q.renameSync(Z,$)}if(this.maxLogFiles<=1)q.writeFileSync(this.logFilePath,"");else q.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(Q){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",Q)}}getRecentErrors(q=10){return this.errors.slice(-q)}getErrorsByType(q){return this.errors.filter((Q)=>Q.error.constructor.name===q)}getErrorsByLevel(q){return this.errors.filter((Q)=>Q.level===q)}clear(){this.errors.length=0}async clearLogFile(){try{let q=await import("fs");if(q.existsSync(this.logFilePath))q.writeFileSync(this.logFilePath,"","utf-8")}catch(q){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",q)}}getStats(){let q={},Q={error:0,warning:0,info:0};for(let J of this.errors){let Z=J.error.constructor.name;q[Z]=(q[Z]||0)+1;let $=J.level||"error";Q[$]=(Q[$]||0)+1}return{total:this.errors.length,byType:q,byLevel:Q}}async exportToFile(q,Q="json"){let J=await import("fs"),$=(await import("path")).dirname(q);if(!J.existsSync($))J.mkdirSync($,{recursive:!0});if(Q==="json"){let Y=this.errors.map((G)=>({timestamp:G.timestamp.toISOString(),level:G.level||"error",type:G.error.constructor.name,message:G.error.message,stack:G.error.stack,context:G.context}));J.writeFileSync(q,JSON.stringify(Y,null,2),"utf-8")}else{let Y=this.errors.map((G)=>this.formatEntry(G));J.writeFileSync(q,Y.join(`
|
|
33
|
+
|
|
34
|
+
`),"utf-8")}}async flush(){await this.writeQueue}}var $J=new p,XJ={isDevelopment(){return L()},logDetailedError(q,Q){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",q.message),console.error("Stack:",q.stack),Q)console.error("Context:",Q);console.error("========================")},createErrorReport(q,Q){let J=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${q.message}`,`Type: ${q.constructor.name}`,`Stack: ${q.stack}`];if(Q)J.push(`Context: ${JSON.stringify(Q,null,2)}`);return J.push("========================"),J.join(`
|
|
35
|
+
`)}};import m from"path";var c={isValidFilePath(q,Q){let J=q.replace(/\\/g,"/");if(J.includes("\x00"))return!1;if(J.includes("../")||J.includes("..\\")||J===".."||J.startsWith("../")||J.endsWith("/..")||J.includes("/..\\")||J.includes("\\../"))return!1;if(/^[a-z][a-z0-9+.-]*:/i.test(J))return!1;if(J.startsWith("/")){if(["/etc/","/root/","/var/","/usr/","/bin/","/sbin/","/proc/","/sys/","/dev/","/boot/","/home/","/private/","/Library/","/System/"].some((Y)=>J===Y.slice(0,-1)||J.startsWith(Y)))return!1}if(/^[a-z]:/i.test(J)){if(["Windows/","Windows\\","System32/","System32\\","Program Files/","Program Files\\"].some((Y)=>J.includes(Y)))return!1}if(Q){let $=m.resolve(Q,q),Y=m.resolve(Q);if(!$.startsWith(Y+m.sep)&&$!==Y)return!1}return!0},isValidVariableName(q){return/^[a-z_$]\w*$/i.test(q)},isValidDirectiveName(q){return/^[a-z][\w-]*$/i.test(q)},isSafeContent(q){return![/<script[^>]*>[\s\S]*?<\/script>/i,/javascript:/i,/data:text\/html/i,/vbscript:/i,/on\w+\s*=/i].some((J)=>J.test(q))}};function YJ(q){let Q={"&":"&","<":"<",">":">",'"':""","'":"'"};return q.replace(/[&<>"']/g,(J)=>Q[J]||J)}function v(q,Q={}){let{allowHtml:J=!1,maxLength:Z=1e4,allowSpecialChars:$=!0,customSanitizer:Y}=Q,G=[],X=q,H=!1;if(Y){let B=Y(X);if(B!==X)X=B,H=!0}if(X.includes("\x00"))X=X.replace(/\0/g,""),H=!0,G.push("Null bytes removed from parameter");if(X.length>Z)X=X.substring(0,Z),H=!0,G.push(`Parameter truncated to ${Z} characters`);if(!J&&/<[^>]+>/.test(X))X=YJ(X),H=!0,G.push("HTML content was escaped");let W=[{pattern:/javascript:/gi,replacement:"",name:"javascript: URI"},{pattern:/vbscript:/gi,replacement:"",name:"vbscript: URI"},{pattern:/data:text\/html/gi,replacement:"",name:"data:text/html URI"}];for(let{pattern:B,replacement:V,name:w}of W)if(B.test(X))X=X.replace(B,V),H=!0,G.push(`Removed ${w} from parameter`);if(!$){let B=X;if(X=X.split("").filter((V)=>{let w=V.charCodeAt(0);return w>=32&&w!==127}).join(""),X!==B)H=!0,G.push("Control characters removed")}return{value:X,modified:H,warnings:G}}function HJ(q,Q){let J=q.replace(/\0/g,"");J=J.replace(/\\/g,"/"),J=J.replace(/^[a-z][a-z0-9+.-]*:/i,"");while(J.includes("../")||J.includes("./"))J=J.replace(/\.\.\//g,"").replace(/\.\//g,"");if(!c.isValidFilePath(J,Q))return null;return J}function GJ(q){let Q=[],J=q.trim(),Z=J!==q,$=[{pattern:/\beval\s*\(/gi,name:"eval()"},{pattern:/\bFunction\s*\(/gi,name:"Function()"},{pattern:/\bsetTimeout\s*\(/gi,name:"setTimeout()"},{pattern:/\bsetInterval\s*\(/gi,name:"setInterval()"},{pattern:/\bimport\s*\(/gi,name:"dynamic import()"},{pattern:/\brequire\s*\(/gi,name:"require()"},{pattern:/\b__proto__\b/gi,name:"__proto__"},{pattern:/\bconstructor\b/gi,name:"constructor"},{pattern:/\bprototype\b/gi,name:"prototype"}];for(let{pattern:Y,name:G}of $)if(Y.test(J))Q.push(`Potentially dangerous pattern detected: ${G}`);if(J.includes("\x00"))J=J.replace(/\0/g,""),Z=!0,Q.push("Null bytes removed from expression");return{value:J,modified:Z,warnings:Q}}function WJ(q,Q={}){return q.map((J)=>v(J,Q))}function Mq(q){let Q={};for(let[J,Z]of Object.entries(q)){if(!c.isValidVariableName(J))continue;if(typeof Z==="string"){let $=v(Z);Q[J]=$.value}else if(Array.isArray(Z))Q[J]=Z.map(($)=>typeof $==="string"?v($).value:$);else if(typeof Z==="object"&&Z!==null)Q[J]=Mq(Z);else Q[J]=Z}return Q}var BJ={maxSanitizeDepth:10,allowBracketNotation:!1},Uq={...BJ};var g=/\bnew\s+/,f="__stx_safe_ctors",_q=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,g,/\bdelete\s+/,/\bthis\b/],VJ=new Set(["eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this",f]),Iq=new Set(["__proto__","constructor","prototype"]),wJ=/[\w)\]]\s*\[\s*['"]/;function Oq(q){let Q="",J=[],Z=null,$=!1;for(let Y=0;Y<q.length;Y++){let G=q[Y];if($){$=!1;continue}if(G==="\\"&&Z){$=!0;continue}if(Z){if(Z==="`"&&G==="$"&&Y+1<q.length&&q[Y+1]==="{"){let X=1;Y+=2;while(Y<q.length&&X>0){if(q[Y]==="{")X++;else if(q[Y]==="}")X--;if(X>0)Q+=q[Y],J.push(Y),Y++}continue}if(G===Z)Z=null;continue}if(G==='"'||G==="'"||G==="`"){Z=G;continue}Q+=G,J.push(Y)}return{text:Q,map:J}}function FJ(q){return Oq(q).text}var Aq=["Collator","DateTimeFormat","DisplayNames","ListFormat","Locale","NumberFormat","PluralRules","RelativeTimeFormat","Segmenter"],Nq=(()=>{let q={Date,URL,URLSearchParams},Q=Intl;for(let J of Aq)if(typeof Q[J]==="function")q[`Intl_${J}`]=Q[J];return Object.freeze(Object.assign(Object.create(null),q))})(),MJ=/^new(\s+)(Date|URLSearchParams|URL|Intl\s*\.\s*([A-Z_a-z]\w*))\s*\(/,jq=/(?<![\w$])new(?![\w$])/g,Dq=`only new Date(), new URL(), new URLSearchParams() and new Intl.{${Aq.join(",")}}() are allowed`;function jJ(q){let{text:Q,map:J}=Oq(q),Z=[];jq.lastIndex=0;let $;while(($=jq.exec(Q))!==null){let G=$.index;if(/(?<!\.)\.\s*$/.test(Q.slice(0,G)))continue;let X=MJ.exec(Q.slice(G)),H=X?.[3],W=!X?null:H?`Intl_${H}`:X[2];if(!X||!W||!(W in Nq))throw new O(`matched /${g.source}/; ${Dq}`,q);let B=G+X[0].length,V=J[G],w=J[B-1]+1;if(q.slice(V,w)!==Q.slice(G,B))throw new O(`matched /${g.source}/; ${Dq}`,q);let M=V+3+X[1].length;Z.push({start:M,end:M+X[2].length,key:W})}let Y=q;for(let G=Z.length-1;G>=0;G--){let X=Z[G];Y=`${Y.slice(0,X.start)}${f}.${X.key}${Y.slice(X.end)}`}return{source:Y,usesSafeConstructors:Z.length>0}}class O extends Error{rule;expression;constructor(q,Q,J){super(J??`Potentially unsafe expression (${q}): ${Q}`);this.name="UnsafeExpressionError",this.rule=q,this.expression=Q}}function SQ(q){try{return i(q),null}catch(Q){return Q instanceof O?Q.rule:Q instanceof Error?Q.message:String(Q)}}function DJ(q,Q){let J=/[$A-Z_a-z][$\w]*/g,Z;while((Z=J.exec(q))!==null){let $=Z[0],Y=q[Z.index-1];if(VJ.has($))throw new O(`matched /\\b${$}\\b/; identifier ${$}`,Q);if(Y==="."&&Iq.has($))throw new O(`matched /.${$}/; property ${$}`,Q)}}function zJ(q){let Q=/\[\s*(['"])(.*?)\1\s*\]/g,J;while((J=Q.exec(q))!==null){let Z=J[2];if(!Iq.has(Z))continue;let $=q.slice(0,J.index).match(/\S(?=\s*$)/)?.[0],Y=q.slice(J.index+J[0].length).match(/^\s*(\S)/)?.[1];if(!(($==="{"||$===",")&&Y===":"))throw new O(`bracket key ${J[2]}`,q)}}function i(q){let Q=q.trim(),J=FJ(Q);DJ(J,Q),zJ(Q);for(let Z of _q){if(Z===g)continue;if(Z.test(J))throw new O(`matched /${Z.source}/`,Q)}if(!Uq.allowBracketNotation&&wJ.test(Q))throw new O("bracket notation with a string key; enable with configureSafeEvaluator({ allowBracketNotation: true })",Q,`Bracket notation with strings not allowed: ${Q}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return jJ(Q)}function KJ(q){return i(q),q.trim()}function UJ(q){let Q={};Q.Math=Math,Q.JSON=JSON,Q.Date=Date,Q.String=String,Q.Number=Number,Q.Boolean=Boolean,Q.Array=Array,Q.parseInt=Number.parseInt,Q.parseFloat=Number.parseFloat,Q.isNaN=Number.isNaN,Q.isFinite=Number.isFinite,Q.encodeURIComponent=encodeURIComponent,Q.decodeURIComponent=decodeURIComponent;for(let[J,Z]of Object.entries(q)){if(J.startsWith("__")||_q.some(($)=>$.test(J)))continue;if(Z&&typeof Z==="object"&&!Array.isArray(Z))Q[J]=l(Z);else Q[J]=Z}return Q}function l(q,Q=0){if(Q>=Uq.maxSanitizeDepth)return"[Object too deep]";if(q===null||typeof q!=="object")return q;if(Array.isArray(q))return q.map((Z)=>l(Z,Q+1));if(q instanceof Date||q instanceof RegExp||q instanceof Map||q instanceof Set||q instanceof Error)return q;let J={};for(let[Z,$]of Object.entries(q)){if(Z.startsWith("__")||Z==="constructor"||Z==="prototype")continue;if($&&typeof $==="object")J[Z]=l($,Q+1);else J[Z]=$}return J}function _J(q,Q){try{let J=UJ(Q),Z=Object.keys(J),$=Object.values(J);return NJ(q,Z)(...$)}catch{return}}function bQ(q){try{return KJ(q),!0}catch{return!1}}function s(q,Q){try{let J=_J(q,Q);if(J&&typeof J==="object"&&!Array.isArray(J))return J;return{}}catch{return{}}}var kq=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"]),IJ=2000,x=new Map;function zq(q,Q){let J=`${q.join(",")}\x00${Q}`,Z=x.get(J);if(Z)return Z;let $=Function(...q,Q);if(x.size>=IJ)x.clear();return x.set(J,$),$}function EQ(q){return q.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:)/g,"$1$2").match(/\b[a-zA-Z_$][\w$]*\b/g)||[]}var OJ=/^[A-Za-z_$][\w$]*$/;function AJ(q){return OJ.test(q)&&!kq.has(q)}function NJ(q,Q){let{source:J,usesSafeConstructors:Z}=i(q),$=[];for(let W=0;W<Q.length;W++){if(!AJ(Q[W]))continue;if(Q[W]===f)continue;$.push({key:Q[W],index:W})}$.sort((W,B)=>W.key.localeCompare(B.key));let Y=$.map((W)=>W.key),G=$.map((W)=>W.index),X=`
|
|
36
|
+
'use strict';
|
|
37
|
+
try {
|
|
38
|
+
return ${J};
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
if (e instanceof TypeError) {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
throw e;
|
|
45
|
+
}
|
|
46
|
+
`;return kJ(Z?(W)=>{let B=zq([f,...Y,...W],X);return(...V)=>B(Nq,...V)}:(W)=>zq([...Y,...W],X),Y,Q,$,G)}function kJ(q,Q,J,Z,$){let Y=q([]),G=Z.every((H,W)=>H.index===W);if(Q.length===J.length&&G)return Kq(Y,Q,q);return Kq((...H)=>{let W=Array($.length);for(let B=0;B<$.length;B++)W[B]=H[$[B]];return Y(...W)},Q,q,(H)=>{Y=q(H)})}function Kq(q,Q,J,Z){let Y=/^(\w+) is not defined$/,G=q,X=[],H=new Set(Q);return(...W)=>{for(let B=0;B<=8;B++)try{return G(...W)}catch(V){let w=V instanceof Error?V.message:"",M=Y.exec(w);if(!(V instanceof ReferenceError)||!M)return;let j=M[1];if(H.has(j)||kq.has(j))return;if(H.add(j),X.push(j),Z)Z(X);else G=J(X)}return}}function CQ(q){let Q=q.trim(),J=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let Z of J)if(Z.test(Q))return!1;return!0}import r from"path";var P;async function TJ(){if(P!==void 0)return P;try{P=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{P=null}return P}var t={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},z={},_={},A={};function fQ(q){if(q)delete z[q];else for(let Q of Object.keys(z))delete z[Q]}function hQ(){let q=Object.entries(z).map(([Q,J])=>({locale:Q,loadedAt:new Date(J.loadedAt),keyCount:Lq(J.translations)}));return{size:Object.keys(z).length,locales:Object.keys(z),entries:q}}function Lq(q,Q=0){for(let J of Object.values(q))if(Q++,J&&typeof J==="object"&&!Array.isArray(J))Q=Lq(J,Q);return Q}function RJ(q,Q=0){if(Q<=0)return!1;return Date.now()-q.loadedAt>Q}function uQ(q){if(z[q])return"loaded";return A[q]||"idle"}function dQ(q){return A[q]==="loading"}function pQ(q){return!!z[q]}async function LJ(q,Q){let{locales:J,parallel:Z=!0,priority:$={},onLocaleLoaded:Y,onComplete:G,onError:X}=q,H=Z?J:[...J].sort((W,B)=>($[B]||0)-($[W]||0));if(Z){let W=H.map(async(B)=>{try{await h(B,Q),Y?.(B)}catch(V){X?.(B,V instanceof Error?V:Error(String(V)))}});await Promise.all(W)}else for(let W of H)try{await h(W,Q),Y?.(W)}catch(B){X?.(W,B instanceof Error?B:Error(String(B)))}G?.()}function mQ(q,Q){queueMicrotask(()=>{LJ(q,Q).catch((J)=>{if(Q.debug)console.error("Background preload error:",J)})})}async function h(q,Q){if({...t,...Q.i18n}.cache&&z[q]){let $=z[q],Y=Q.i18n?.cacheMaxAge??0;if(!RJ($,Y))return $.translations}if(_[q]?.state==="loading")return _[q].promise;A[q]="loading";let Z=o(q,Q).then(($)=>{return A[q]="loaded",delete _[q],$}).catch(($)=>{throw A[q]="error",_[q]={promise:Z,state:"error",error:$ instanceof Error?$:Error(String($))},$});return _[q]={promise:Z,state:"loading"},Z}function PJ(q){return z[q]?.translations}async function cQ(q,Q){let J=PJ(q);if(J)return J;return h(q,Q)}async function lQ(q,Q){if(z[q])return z[q].translations;if(_[q]){if(Q)return Promise.race([_[q].promise,new Promise((J,Z)=>setTimeout(()=>Z(Error(`Timeout waiting for locale: ${q}`)),Q))]);return _[q].promise}throw Error(`Locale "${q}" is not loading. Call loadTranslationLazy first.`)}function iQ(){return Object.entries(A).filter(([q,Q])=>Q==="loading").map(([q])=>q)}function sQ(q){if(q)delete _[q],delete A[q];else{for(let Q of Object.keys(_))delete _[Q];for(let Q of Object.keys(A))delete A[Q]}}async function o(q,Q){let J={...t,...Q.i18n},Z=r.isAbsolute(J.translationsDir)?J.translationsDir:r.resolve(Q.root||process.cwd(),J.translationsDir);try{let $=await TJ(),Y=$?await $(q,{translationsDir:Z,defaultLocale:J.defaultLocale,sources:yJ(J.format)}):await SJ(q,J,Z);if(Y===void 0){if(q!==J.defaultLocale)return o(J.defaultLocale,Q);return{}}let G=Y;if(J.cache)z[q]={translations:G,loadedAt:Date.now(),locale:q};return G}catch($){if(Q.debug)console.error(`Error loading translation file for locale "${q}":`,$);if(q!==J.defaultLocale)return o(J.defaultLocale,Q);return{}}}async function SJ(q,Q,J){let Z=r.join(J,`${q}${bJ(Q.format)}`);try{let $=await import(Z);return $.default||$}catch($){try{let Y=await Bun.file(Z).text();if(Q.format==="yaml"||Q.format==="yml")return EJ(Y);if(Q.format==="json")return JSON.parse(Y);throw $}catch{return}}}function bJ(q){switch(q){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function EJ(q){let Q={},J=q.split(`
|
|
47
|
+
`),Z=[{obj:Q,indent:-1}];for(let $ of J){let Y=$.replace(/#.*$/,"").trimEnd();if(!Y.trim())continue;let G=Y.search(/\S/);if(G===-1)continue;while(Z.length>1&&Z[Z.length-1].indent>=G)Z.pop();let X=Z[Z.length-1].obj,H=Y.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(H){let[,,W,B]=H,V=W.trim(),w=B.trim();if(w==="")X[V]={},Z.push({obj:X[V],indent:G});else X[V]=CJ(w)}}return Q}function CJ(q){if(q.startsWith("'")&&q.endsWith("'")||q.startsWith('"')&&q.endsWith('"'))return q.slice(1,-1);let Q=q.toLowerCase();if(Q==="true"||Q==="yes")return!0;if(Q==="false"||Q==="no")return!1;if(Q==="null"||Q==="~")return null;let J=Number(q);if(!Number.isNaN(J)&&q!=="")return J;return q}function yJ(q){switch(q){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function vJ(q,Q){return h(q,Q)}function xJ(q,Q){for(let J of q){let Z=J.trim(),$=Z.match(/^\{(\d+)\}\s*(.*)$/);if($){let G=Number.parseInt($[1],10);if(Q===G)return $[2];continue}let Y=Z.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(Y){let G=Number.parseInt(Y[1],10),X=Y[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(Y[2],10);if(Q>=G&&Q<=X)return Y[3];continue}}if(q.length===2)return Q===1?q[0].trim():q[1].trim();if(Q<q.length)return q[Q].trim();return q[q.length-1].trim()}function gJ(q,Q={}){return Pq(q,Q)}function Pq(q,Q){let J="",Z=0;while(Z<q.length)if(q[Z]==="{"){let $=fJ(q,Z);if($===-1){J+=q[Z],Z++;continue}let Y=q.slice(Z+1,$);J+=hJ(Y,Q),Z=$+1}else if(q[Z]==="'"&&Z+1<q.length)if(q[Z+1]==="'")J+="'",Z+=2;else if(q[Z+1]==="{"||q[Z+1]==="}")J+=q[Z+1],Z+=2;else J+=q[Z],Z++;else J+=q[Z],Z++;return J}function fJ(q,Q){let J=0;for(let Z=Q;Z<q.length;Z++)if(q[Z]==="{")J++;else if(q[Z]==="}"){if(J--,J===0)return Z}return-1}function hJ(q,Q){let J=uJ(q);if(J.length===0)return`{${q}}`;let Z=J[0].trim(),$=Q[Z];if(J.length===1)return $!==void 0?String($):`{${Z}}`;switch(J[1].trim().toLowerCase()){case"plural":return dJ($,J.slice(2).join(","),Q);case"select":return mJ($,J.slice(2).join(","));case"selectordinal":return cJ($,J.slice(2).join(","));case"number":return iJ($,J[2]?.trim());case"date":return sJ($,J[2]?.trim());case"time":return nJ($,J[2]?.trim());default:return $!==void 0?String($):`{${q}}`}}function uJ(q){let Q=[],J="",Z=0;for(let $=0;$<q.length;$++){let Y=q[$];if(Y==="{")Z++,J+=Y;else if(Y==="}")Z--,J+=Y;else if(Y===","&&Z===0)Q.push(J),J="";else J+=Y}if(J)Q.push(J);return Q}function dJ(q,Q,J){let Z=Number(q)||0,$=e(Q),Y=`=${Z}`;if($[Y])return n($[Y],Z,J);let G=pJ(Z);if($[G])return n($[G],Z,J);if($.other)return n($.other,Z,J);return String(Z)}function n(q,Q,J){let Z=q.replace(/#/g,String(Q));return Pq(Z,J)}function pJ(q){let Q=Math.abs(q),J=Math.floor(Q),Z=String(q).includes(".")?String(q).split(".")[1].length:0;if(J===1&&Z===0)return"one";return"other"}function mJ(q,Q){let J=String(q||""),Z=e(Q);if(Z[J])return Z[J];return Z.other||String(q)}function cJ(q,Q){let J=Number(q)||0,Z=e(Q),$=lJ(J);if(Z[$])return Z[$].replace(/#/g,String(J));if(Z.other)return Z.other.replace(/#/g,String(J));return String(J)}function lJ(q){let Q=Math.abs(q),J=Q%10,Z=Q%100;if(J===1&&Z!==11)return"one";if(J===2&&Z!==12)return"two";if(J===3&&Z!==13)return"few";return"other"}function e(q){let Q={},J=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,Z=J.exec(q);while(Z!==null)Q[Z[1]]=Z[2],Z=J.exec(q);return Q}function iJ(q,Q){let J=Number(q);if(Number.isNaN(J))return String(q);switch(Q){case"integer":return Math.floor(J).toLocaleString();case"percent":return`${(J*100).toFixed(0)}%`;case"currency":return J.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return J.toLocaleString()}}function sJ(q,Q){let J=q instanceof Date?q:new Date(String(q));if(Number.isNaN(J.getTime()))return String(q);let Z={};switch(Q){case"short":Z.dateStyle="short";break;case"medium":Z.dateStyle="medium";break;case"long":Z.dateStyle="long";break;case"full":Z.dateStyle="full";break;default:Z.dateStyle="medium"}return J.toLocaleDateString(void 0,Z)}function nJ(q,Q){let J=q instanceof Date?q:new Date(String(q));if(Number.isNaN(J.getTime()))return String(q);let Z={};switch(Q){case"short":Z.timeStyle="short";break;case"medium":Z.timeStyle="medium";break;case"long":Z.timeStyle="long";break;case"full":Z.timeStyle="full";break;default:Z.timeStyle="short"}return J.toLocaleTimeString(void 0,Z)}function rJ(q){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(q)}function a(q,Q,J=!0,Z={}){let $=q.split("."),Y=Q;for(let X of $){if(Y===void 0||Y===null)break;Y=Y[X]}if(Y===void 0||Y===null)return J?q:"";let G=String(Y);if(rJ(G))return gJ(G,Z);if(G.includes("|")&&"count"in Z){let X=Number(Z.count),H=G.split("|");G=xJ(H,X)}for(let[X,H]of Object.entries(Z)){let W=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${W}`,"g"),String(H))}return G}var Tq=new Set(["ar","arc","ckb","dv","fa","he","khw","ks","nqo","prs","ps","sd","syr","ug","ur","uz-af","yi"]),oJ=new Set(["adlm","arab","aran","hebr","nkoo","rohg","syrc","thaa","yezi"]);function qq(q){if(!q)return"ltr";let Q=q.trim().toLowerCase().replace(/_/g,"-").split("-"),J=Q[0];if(!J)return"ltr";let Z=Q[1]?.length===4?Q[1]:void 0;if(Z)return oJ.has(Z)?"rtl":"ltr";if(Q.length>1&&Tq.has(`${J}-${Q[1]}`))return"rtl";return Tq.has(J)?"rtl":"ltr"}function nQ(q){return qq(q)==="rtl"}async function rQ(q,Q,J,Z){let $=q,Y=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...t,...Z.i18n},X=await vJ(G.locale,Z);Q.__translations=X,Q.__locale=G.locale,Q.__i18nConfig=G,$=await Rq($,Y,async(B,V,w,M,j)=>{try{let D={};if(w)try{let F=[()=>JSON.parse(w),()=>{let I=`{"data":${w}}`,R=JSON.parse(I);return typeof R.data==="object"?R.data:{}},()=>{return s(w,Q)}];for(let I of F)try{if(D=I(),Object.keys(D).length>0)break}catch{}}catch(F){if(Z.debug)console.error("Error parsing parameters for @translate directive:",F)}return a(V,X,G.fallbackToKey,D)||M.trim()}catch(D){if(Z.debug)console.error("Error processing @translate directive:",D);return y("Translate",`Error in @translate('${V}'): ${D instanceof Error?D.message:String(D)}`,U.EVALUATION_ERROR)}});let H=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(Z.debug){console.warn(`Processing translations in template. Sections: ${$.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let B=[...$.matchAll(H)];console.warn(`Found ${B.length} @translate matches`),B.forEach((V,w)=>console.warn(`Match ${w}: ${V[0]}, Key: ${V[1]}, Params: ${V[2]||"none"}`))}return $=await Rq($,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(B,V,w,M)=>{try{let j={};if(w)try{let D=[()=>JSON.parse(w),()=>{let K=`{"data":${w}}`,F=JSON.parse(K);return typeof F.data==="object"?F.data:{}},()=>{return s(w,Q)}];for(let K of D)try{if(j=K(),Object.keys(j).length>0)break}catch{}}catch(D){if(Z.debug)console.error("Error parsing parameters for @translate directive:",D)}return a(V,X,G.fallbackToKey,j)}catch(j){if(Z.debug)console.error("Error processing @translate directive:",j);return y("Translate",`Error in @translate('${V}'): ${j instanceof Error?j.message:String(j)}`,U.EVALUATION_ERROR)}}),$}async function Rq(q,Q,J){let Z=[];return q.replace(Q,(Y,...G)=>{let X=J(Y,...G).then((H)=>({match:Y,replacement:H}));return Z.push(X),Y}),(await Promise.all(Z)).reduce((Y,{match:G,replacement:X})=>Y.replace(G,X),q)}function oQ(q,Q=!0){return(J,Z={})=>{return a(J,q,Q,Z)}}import Sq from"path";function Jq(q,Q){if(!q||qq(q)!=="rtl")return!1;return!Q||Q.trim().toLowerCase()!=="rtl"}function Eq(q){if(!q)return!1;return q.trim().split(/\s+/)[0]?.toLowerCase()==="presentation"||q.trim().split(/\s+/)[0]?.toLowerCase()==="none"}function S(q,Q){let J=new RegExp(`\\b${Q}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(q);if(!J)return null;return J[2]??J[3]??J[4]??null}function JZ(q,Q,J,Z){let $=q;$=$.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,X,H)=>{let B={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[X]||"Make this element accessible";return`<!-- a11y-hint: ${H||B} -->`});let Y=/@screenReader\(([^@]*)\)@endScreenReader/g;return $=$.replace(Y,(G,X)=>{return`<span class="sr-only">${X.trim()}</span>`}),$=$.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(G,X,H)=>{return`<span id="${`desc-${X}`}" class="sr-only">${H}</span>`}),$}function QZ(){return`
|
|
48
|
+
.sr-only {
|
|
49
|
+
position: absolute;
|
|
50
|
+
width: 1px;
|
|
51
|
+
height: 1px;
|
|
52
|
+
padding: 0;
|
|
53
|
+
margin: -1px;
|
|
54
|
+
overflow: hidden;
|
|
55
|
+
clip: rect(0, 0, 0, 0);
|
|
56
|
+
white-space: nowrap;
|
|
57
|
+
border-width: 0;
|
|
58
|
+
}
|
|
59
|
+
`.trim()}function aJ(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function Cq(q){let Q=new Map,J=q.replace(/<(\/?)([A-Z][\w:.-]*)(?=[\s/>])/g,($,Y,G)=>{let X=Q.get(G);if(!X)X=`stx-a11y-component-${Q.size}`,Q.set(G,X);return`<${Y}${X}`}),Z=new Map([...Q.entries()].map(([$,Y])=>[Y,$]));return{protectedSource:J,restore:($)=>$.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(Y,G,X)=>{let H=Z.get(X);return H?`<${G}${H}`:Y})}}function tJ(q,Q){let J=[],Z=/<img\s+([^>]*)>/gi,$;$=Z.exec(q);while($!==null){let F=$[1];if(!/\balt\s*=/i.test(F))J.push({type:"missing-alt",element:$[0].substring(0,100),message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"});$=Z.exec(q)}let Y=/<button([^>]*)>\s*<\/button>/gi;$=Y.exec(q);while($!==null){let F=$[1];if(!/\baria-label\s*=/i.test(F)&&!/\btitle\s*=/i.test(F))J.push({type:"missing-accessible-name",element:$[0].substring(0,100),message:"Empty button missing accessible name",impact:"critical",help:"Add text content, aria-label, or title",helpUrl:"https://web.dev/learn/accessibility/aria-html/"});$=Y.exec(q)}let G=/<a\s+([^>]*)>\s*<\/a>/gi;$=G.exec(q);while($!==null){let F=$[1];if(!/\baria-label\s*=/i.test(F)&&!/\btitle\s*=/i.test(F))J.push({type:"link-missing-text",element:$[0].substring(0,100),message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"});$=G.exec(q)}let X=/<(input|select|textarea)\s+([^>]*)>/gi;$=X.exec(q);while($!==null){let F=$[2];if(/\btype\s*=\s*["']hidden["']/i.test(F)){$=X.exec(q);continue}let I=/\baria-label\s*=/i.test(F)||/\baria-labelledby\s*=/i.test(F),R=F.match(/\bid\s*=\s*["']([^"']+)["']/i);if(!I){let yq=R&&new RegExp(`<label[^>]*\\bfor\\s*=\\s*["']${R[1]}["']`,"i").test(q),Qq=$.index,Zq=q.substring(0,Qq),YQ=q.substring(Qq),vq=(Zq.match(/<label\b/gi)||[]).length,xq=(Zq.match(/<\/label>/gi)||[]).length,gq=vq>xq;if(!yq&&!gq)J.push({type:"input-missing-label",element:$[0].substring(0,100),message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})}$=X.exec(q)}let H=/<h([1-6])[^>]*>/gi,W=[];$=H.exec(q);while($!==null)W.push(Number.parseInt($[1],10)),$=H.exec(q);let B=0;for(let F of W){if(B>0&&F>B+1)J.push({type:"heading-skip",element:`<h${F}>`,message:`Heading level skipped from h${B} to h${F}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});B=F}if(/<html\b/i.test(q)&&!/<html[^>]*\slang\s*=/i.test(q))J.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});let V=q.match(/<html\b([^>]*)>/i);if(V&&Jq(S(V[1],"lang"),S(V[1],"dir")))J.push({type:"missing-dir",element:V[0].substring(0,100),message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});let w=/<table([^>]*)>([\s\S]*?)<\/table>/gi;$=w.exec(q);while($!==null){let F=$[2];if(!Eq(S($[1],"role"))&&!/<th\b/i.test(F))J.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});$=w.exec(q)}let M=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;$=M.exec(q);while($!==null){if(!/\bmuted\b/i.test($[0]))J.push({type:"autoplay-audio",element:`<${$[1]}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"});$=M.exec(q)}let j=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;$=j.exec(q);while($!==null)J.push({type:"positive-tabindex",element:`tabindex="${$[1]}"`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"}),$=j.exec(q);let D=/<iframe\s+([^>]*)>/gi;$=D.exec(q);while($!==null){let F=$[1];if(!/\btitle\s*=/i.test(F)&&!/\baria-label\s*=/i.test(F))J.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"});$=D.exec(q)}let K=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;$=K.exec(q);while($!==null){let F=$[1].toLowerCase(),I=$[2];if(F!=="button"&&!/\btabindex\s*=/i.test(I))J.push({type:"button-not-focusable",element:$[0].substring(0,100),message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"});$=K.exec(q)}return J}async function eJ(q,Q){let{protectedSource:J}=Cq(q);if(!aJ())return tJ(J,Q);let Z=[];try{let $=globalThis.document.createElement("div");$.innerHTML=J,$.querySelectorAll("img").forEach((H)=>{if(!H.hasAttribute("alt"))Z.push({type:"missing-alt",element:`<${H.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),$.querySelectorAll('button, a, [role="button"]').forEach((H)=>{if(!(H.hasAttribute("aria-label")||H.hasAttribute("aria-labelledby")||H.textContent&&H.textContent.trim().length>0))Z.push({type:"missing-accessible-name",element:`<${H.outerHTML}>`,message:"Interactive element missing accessible name",impact:"critical",help:"Add text content, aria-label, or aria-labelledby",helpUrl:"https://web.dev/learn/accessibility/aria-html/"})}),$.querySelectorAll("input, select, textarea").forEach((H)=>{let W=H.getAttribute("id"),B=W&&$.querySelector(`label[for="${W}"]`),V=H.hasAttribute("aria-label")||H.hasAttribute("aria-labelledby"),w=H.closest("label")!==null;if(!B&&!V&&!w)Z.push({type:"input-missing-label",element:`<${H.outerHTML}>`,message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})});let Y=Array.from($.querySelectorAll("h1, h2, h3, h4, h5, h6")),G=0;for(let H of Y){let W=Number.parseInt(H.tagName.charAt(1));if(G>0&&W>G+1)Z.push({type:"heading-skip",element:`<${H.outerHTML}>`,message:`Heading level skipped from h${G} to h${W}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});G=W}let X=$.querySelector("html");if(J.includes("<html")&&X&&!X.hasAttribute("lang"))Z.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});if(X&&Jq(X.getAttribute("lang"),X.getAttribute("dir")))Z.push({type:"missing-dir",element:"<html>",message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});if($.querySelectorAll("a").forEach((H)=>{let W=H.textContent&&H.textContent.trim().length>0,B=H.hasAttribute("aria-label")||H.hasAttribute("aria-labelledby"),V=H.hasAttribute("title"),w=H.querySelector("img[alt]");if(!W&&!B&&!V&&!w)Z.push({type:"link-missing-text",element:`<${H.outerHTML}>`,message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"})}),J.includes("<nav")||J.includes("<header")){if(!$.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&$.querySelectorAll("a").length>5)Z.push({type:"missing-skip-link",element:"<nav>",message:"Consider adding a skip navigation link",impact:"minor",help:"Add a skip link to allow keyboard users to bypass navigation",helpUrl:"https://web.dev/learn/accessibility/focus/#skip-links"})}if($.querySelectorAll("table").forEach((H)=>{if(Eq(H.getAttribute("role")))return;let W=H.querySelector("caption");if(!H.querySelector("th"))Z.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});if(!W&&!H.hasAttribute("aria-label")&&!H.hasAttribute("aria-labelledby"))Z.push({type:"table-missing-caption",element:"<table>",message:"Table missing caption or accessible name",impact:"minor",help:"Add a caption element or aria-label to describe the table",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"})}),$.querySelectorAll('[style*="color"]').forEach((H)=>{let W=H.getAttribute("style")||"";if(W.includes("color:")&&!W.includes("background"))Z.push({type:"potential-contrast-issue",element:`<${H.tagName.toLowerCase()}>`,message:"Element has inline color style - verify contrast ratio",impact:"minor",help:"Ensure text has sufficient contrast ratio (4.5:1 for normal text)",helpUrl:"https://web.dev/learn/accessibility/color-contrast/"})}),$.querySelectorAll("video[autoplay], audio[autoplay]").forEach((H)=>{if(!H.hasAttribute("muted"))Z.push({type:"autoplay-audio",element:`<${H.tagName.toLowerCase()}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"})}),$.querySelectorAll("[tabindex]").forEach((H)=>{if(Number.parseInt(H.getAttribute("tabindex")||"0")>0)Z.push({type:"positive-tabindex",element:`<${H.tagName.toLowerCase()}>`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"})}),$.querySelectorAll('[role="button"]').forEach((H)=>{if(!H.hasAttribute("tabindex"))Z.push({type:"button-not-focusable",element:`<${H.outerHTML}>`,message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"})}),J.includes("<body")&&!$.querySelector('main, [role="main"]'))Z.push({type:"missing-main-landmark",element:"<body>",message:"Document missing main landmark region",impact:"moderate",help:"Add a main element to identify the primary content",helpUrl:"https://web.dev/learn/accessibility/structure/#landmarks"});$.querySelectorAll("iframe").forEach((H)=>{if(!H.hasAttribute("title")&&!H.hasAttribute("aria-label"))Z.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"})})}catch($){console.error(`Error checking accessibility in ${Q}:`,$)}return Z}async function qQ(q,Q={}){let J={},{recursive:Z=!0,ignorePaths:$=[]}=Q,Y=Array.isArray(q)?q:[q],G=await bq(Y,{recursive:Z,ignorePaths:$}),X=[];for(let H of G)try{let W=await Bun.file(H).text();if(H.endsWith("good-a11y.stx"))continue;let B=await eJ(W,H);if(X.push(H),B.length>0)J[H]=B}catch(W){console.error(`Error scanning ${H}:`,W)}return{results:J,scannedFiles:X}}async function ZZ(q,Q={}){return(await qQ(q,Q)).results}var JQ={fixMissingAlt:!0,fixMissingLabels:!0,fixMissingFormLabels:!0,fixTableHeaders:!0,fixMissingLang:!0,fixMissingDir:!0,fixPositiveTabindex:!0,fixButtonFocusable:!0,defaultLang:"en"};function QQ(q,Q={}){let J={...JQ,...Q},Z=[],{protectedSource:$,restore:Y}=Cq(q),G=$;if(J.fixMissingAlt)G=G.replace(/<img([^>]*?)(?<!\balt\s*=\s*["'][^"']*["'])(\s*\/?>)/gi,(X,H,W)=>{if(/\balt\s*=/i.test(H))return X;let B=X,V=`<img${H} alt=""${W}`;return Z.push({type:"missing-alt",description:"Added empty alt attribute to image",before:B,after:V}),V});if(J.fixMissingLabels)G=G.replace(/<button([^>]*)>\s*<\/button>/gi,(X,H)=>{if(/\baria-label\s*=/i.test(H)||/\btitle\s*=/i.test(H))return X;let W=X,B=`<button${H} aria-label="Button"></button>`;return Z.push({type:"missing-accessible-name",description:"Added aria-label to empty button",before:W,after:B}),B}),G=G.replace(/<a([^>]*)>\s*(<(?:i|span|svg)[^>]*(?:class="[^"]*icon[^"]*")?[^>]*>.*?<\/(?:i|span|svg)>)?\s*<\/a>/gi,(X,H,W)=>{if(/\baria-label\s*=/i.test(H)||/\btitle\s*=/i.test(H))return X;if(!W&&X.replace(/<a[^>]*>|<\/a>/gi,"").trim())return X;let B=X,V=`<a${H} aria-label="Link">${W||""}</a>`;return Z.push({type:"missing-accessible-name",description:"Added aria-label to link without text",before:B,after:V}),V});if(J.fixMissingFormLabels)G=G.replace(/<(input|select|textarea)([^>]*)>/gi,(X,H,W)=>{if(/\baria-label\s*=/i.test(W)||/\baria-labelledby\s*=/i.test(W))return X;if(/\btype\s*=\s*["']hidden["']/i.test(W))return X;let B=W.match(/\bname\s*=\s*["']([^"']+)["']/i),V=W.match(/\bid\s*=\s*["']([^"']+)["']/i),w=B?.[1]||V?.[1]||H,M=X,j=`<${H}${W} aria-label="${w}">`;return Z.push({type:"input-missing-label",description:`Added aria-label to ${H} element`,before:M,after:j}),j});if(J.fixMissingLang)G=G.replace(/<html([^>]*)>/gi,(X,H)=>{if(/\blang\s*=/i.test(H))return X;let W=X,B=`<html${H} lang="${J.defaultLang}">`;return Z.push({type:"missing-lang",description:`Added lang="${J.defaultLang}" to html element`,before:W,after:B}),B});if(J.fixMissingDir)G=G.replace(/<html([^>]*)>/gi,(X,H)=>{let W=S(H,"lang");if(!Jq(W,S(H,"dir")))return X;let B=/\bdir\s*=/i.test(H)?`<html${H.replace(/\bdir\s*=\s*(["'])[^"']*\1/i,'dir="rtl"')}>`:`<html${H} dir="rtl">`;return Z.push({type:"missing-dir",description:`Added dir="rtl" to html element (lang="${W}" is right-to-left)`,before:X,after:B}),B});if(J.fixPositiveTabindex)G=G.replace(/\btabindex\s*=\s*["']([1-9]\d*)["']/gi,(X,H)=>{let W=X,B='tabindex="0"';return Z.push({type:"positive-tabindex",description:`Changed tabindex="${H}" to tabindex="0"`,before:W,after:'tabindex="0"'}),'tabindex="0"'});if(J.fixButtonFocusable)G=G.replace(/<([a-z]+)(\s[^>]*role\s*=\s*["']button["'][^>]*)>/gi,(X,H,W)=>{if(/\btabindex\s*=/i.test(W))return X;if(H.toLowerCase()==="button")return X;let B=X,V=`<${H}${W} tabindex="0">`;return Z.push({type:"button-not-focusable",description:'Added tabindex="0" to element with role="button"',before:B,after:V}),V});if(J.fixTableHeaders)G=G.replace(/<th([^>]*)>/gi,(X,H)=>{if(/\bscope\s*=/i.test(H))return X;let W=X,B=`<th${H} scope="col">`;return Z.push({type:"table-missing-scope",description:'Added scope="col" to table header',before:W,after:B}),B});return{original:q,fixed:Y(G),fixCount:Z.length,fixes:Z}}async function ZQ(q,Q={},J=!1){let Z=await Bun.file(q).text(),$=QQ(Z,Q);if(J&&$.fixCount>0)await Bun.write(q,$.fixed);return $}async function $Z(q,Q={},J={}){let Z={},{recursive:$=!0,ignorePaths:Y=[],writeBack:G=!1,extensions:X=[".stx",".html",".htm"]}=J,H=X.length===1?`*${X[0]}`:`*{${X.join(",")}}`,W=Sq.join(q,$?`**/${H}`:H),B=new Bun.Glob(W);for await(let V of B.scan()){if(Y.some((M)=>V.includes(Sq.normalize(M))))continue;try{let M=await ZQ(V,Q,G);if(M.fixCount>0)Z[V]=M}catch(M){console.error(`Error fixing ${V}:`,M)}}return Z}var $Q={name:"a11y",handler:(q,Q,J,Z)=>{if(!Q.length)return q;let $=Q[0].replace(/['"]/g,""),Y=Q.length>1?Q[1].replace(/['"]/g,""):"",X={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[$]||"Make this element accessible";return`<!-- a11y-hint: ${Y||X} -->${q}`},hasEndTag:!1},XQ={name:"screenReader",handler:(q)=>{return`<span class="sr-only">${q}</span>`},hasEndTag:!0};function XZ(){return[$Q,XQ]}
|
|
60
|
+
export{hq as Fr,uq as Gr,dq as Hr,pq as Ir,Xq as Jr,mq as Kr,U as Lr,u as Mr,cq as Nr,L as Or,GQ as Pr,iq as Qr,E as Rr,sq as Sr,C as Tr,N as Ur,Hq as Vr,Gq as Wr,Wq as Xr,Bq as Yr,Vq as Zr,d as _r,y as $r,eq as as,qJ as bs,JJ as cs,QJ as ds,ZJ as es,p as fs,$J as gs,XJ as hs,c as is,v as js,HJ as ks,GJ as ls,WJ as ms,Mq as ns,SQ as os,KJ as ps,_J as qs,bQ as rs,s as ss,EQ as ts,AJ as us,NJ as vs,CQ as ws,t as xs,fQ as ys,hQ as zs,uQ as As,dQ as Bs,pQ as Cs,LJ as Ds,mQ as Es,h as Fs,PJ as Gs,cQ as Hs,lQ as Is,iQ as Js,sQ as Ks,vJ as Ls,gJ as Ms,rJ as Ns,a as Os,qq as Ps,nQ as Qs,rQ as Rs,oQ as Ss,Eq as Ts,S as Us,JZ as Vs,QZ as Ws,aJ as Xs,tJ as Ys,eJ as Zs,qQ as _s,ZZ as $s,QQ as at,ZQ as bt,$Z as ct,$Q as dt,XQ as et,XZ as ft};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Au as
|
|
2
|
+
import{Au as b,Bu as c,Cu as d,Du as e,Eu as f,Fu as g,Gu as h,Hu as i,Iu as j,Ju as k,Ku as l,Lu as m,Mu as n,Nu as o,Ou as p,zu as a}from"./chunk-w1dxgs78.js";import"./chunk-jryjwara.js";export{i as useTitle,f as useSeoMeta,i as usePageTitle,d as useHead,g as seoMetaToHeadConfig,c as resetHead,k as renderHtmlAttrs,j as renderHead,l as renderBodyAttrs,o as processTitleDirective,p as processMetaDirective,n as processHeadDirective,e as mergeHeadConfigs,b as getPageMeta,a as getHead,h as definePageMeta,m as applyHead};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
import I from"fs";import F from"path";import{createHash as w}from"crypto";var H=["pages","components","layouts","partials","composables"],Y=new Set;function u(j){try{return Y.has(I.realpathSync(j))}catch{return Y.has(F.resolve(j))}}var L=new Set(["extends","root",...H.map((j)=>`${j}Dir`),"publicDir","stateDir","cachePath"]),Z=(j)=>j!==null&&typeof j==="object"&&(Object.getPrototypeOf(j)===Object.prototype||Object.getPrototypeOf(j)===null);function _(j,z,A=""){if(Array.isArray(z))return["middleware","plugins"].includes(A)?[...Array.isArray(j)?j:[],...z]:[...z];if(!Z(z))return z;let E={...Z(j)?j:{}};for(let[B,G]of Object.entries(z)){if(["__proto__","constructor","prototype"].includes(B))throw Error(`Invalid layer config key: ${B}`);E[B]=_(E[B],G,B)}return E}function $(j){for(let z of["stx.config.ts","stx.config.js","stx.config.mjs",".config/stx.config.ts",".config/stx.ts","ui.config.ts"]){let A=F.join(j,z);if(I.existsSync(A))return I.realpathSync(A)}throw Error(`Application layer has no stx.config.ts: ${j}`)}function S(j,z,A){if(typeof j!=="string"||!j||/^(?:https?:|git[+:])/.test(j))throw Error(`Invalid application layer ${JSON.stringify(j)} in ${z}; use a local path or installed package`);if(j.startsWith(".")||F.isAbsolute(j)){let B=F.resolve(z,j);return I.statSync(B).isDirectory()?$(B):I.realpathSync(B)}let E=z;while(!0){let B=F.join(E,"node_modules",j),G=F.join(B,"package.json");if(I.existsSync(G)){A.add(I.realpathSync(G));let T=JSON.parse(I.readFileSync(G,"utf8"));return T.stx?.layer?I.realpathSync(F.resolve(B,T.stx.layer)):$(B)}let J=F.dirname(E);if(J===E)break;E=J}throw Error(`Cannot resolve application layer ${JSON.stringify(j)} from ${z}`)}async function C(j,z){let A=await Bun.build({entrypoints:[j],target:"bun",format:"esm",splitting:!1,plugins:[{name:"stx-layer-config",setup(G){G.onResolve({filter:/^[^./]/},(J)=>{if(J.path.startsWith("node:"))return{path:J.path,external:!0};return{path:Bun.resolveSync(J.path,J.resolveDir),external:!0}}),G.onLoad({filter:/./},(J)=>{let T=I.realpathSync(J.path);z.add(T),Y.add(T);return})}}]});if(!A.success)throw Error(`Cannot load layer ${j}: ${A.logs.join(`
|
|
3
3
|
`)}`);let E=A.outputs.find((G)=>G.kind==="entry-point");if(!E||A.outputs.length!==1)throw Error(`Unsupported layer config output: ${j}`);let B=(await import(`data:text/javascript;base64,${Buffer.from(await E.text()).toString("base64")}`)).default;if(!Z(B))throw Error(`Layer ${j} must default-export a config object`);return B}async function v(j,z){let A=new Set,E=[],B=[],G=new Set,J=[];async function T(q,M){if(q=I.realpathSync(q),J.includes(q))throw Error(`Application layer cycle: ${[...J,q].join(" -> ")}`);if(G.has(q))return;G.add(q),J.push(q);let U=await C(q,A);M??=F.basename(F.dirname(q))===".config"?F.dirname(F.dirname(q)):F.dirname(q),M=I.realpathSync(M);let D=F.resolve(M,U.root??"."),K=Object.fromEntries(H.map((Q)=>[Q,F.resolve(D,U[`${Q}Dir`]??(Q==="composables"?"functions":Q))]));E.push({root:M,configFile:q,resources:K});let N={...U};if(N.plugins)N.plugins=N.plugins.map((Q)=>{let W=typeof Q==="string"?Q:Q[0],X=W.startsWith(".")?F.resolve(M,W):F.isAbsolute(W)?W:Bun.resolveSync(W,M);return A.add(I.realpathSync(X)),typeof Q==="string"?X:[X,Q[1]]});if(typeof N.css==="string")N.css=F.resolve(M,N.css);if(N.serverApi)N.serverApi={...typeof N.serverApi==="object"?N.serverApi:{},dir:F.resolve(M,typeof N.serverApi==="object"?N.serverApi.dir??"server/api":"server/api")};if(B.push(N),U.extends!==void 0&&!Array.isArray(U.extends))throw Error(`extends in ${q} must be an array`);for(let Q of U.extends??[])await T(S(Q,M,A));J.pop()}await T($(j),j);for(let q of["package.json","bun.lock","package-lock.json","pnpm-lock.yaml"]){let M=F.join(j,q);if(I.existsSync(M))A.add(I.realpathSync(M))}let O=_({},z);for(let q=B.length-1;q>=0;q--){let M=q===0?B[q]:Object.fromEntries(Object.entries(B[q]).filter(([U])=>!L.has(U)));O=_(O,M)}let V={layers:E,configDependencies:[...A].sort()};return O._layerGraph=V,O._layerPageDirs=E.map((q)=>q.resources.pages),O._layerComponentDirs=E.map((q)=>q.resources.components),O._layerLayoutDirs=E.map((q)=>q.resources.layouts),O._layerPartialDirs=E.map((q)=>q.resources.partials),O._layerComposableDirs=E.map((q)=>q.resources.composables),await R(V,j),{config:O,graph:V}}async function R(j,z){let A=new Map,E=[];for(let B of j.layers)for(let[G,J]of Object.entries(B.resources)){if(!I.existsSync(J))continue;let T=new Bun.Glob(G==="composables"?"**/*.ts":"**/*.stx");for(let O of[...T.scanSync({cwd:J})].sort()){let V=`${G}/${O}`,q=F.join(J,O),M=A.get(V);if(M)E.push({resource:V,winner:M,shadowed:q});else A.set(V,q)}}Object.assign(j,{overrides:E}),await Bun.write(F.join(z,".stx/layers.json"),JSON.stringify(j,null,2))}function P(j){let z=new Set(j.configDependencies);function A(E){if(!I.existsSync(E))return;z.add(E);for(let B of I.readdirSync(E,{withFileTypes:!0}).sort((G,J)=>G.name.localeCompare(J.name))){if(B.name.startsWith(".")||B.name==="node_modules")continue;let G=F.join(E,B.name);if(B.isDirectory())A(G);else if(B.isFile())z.add(G)}}for(let E of j.layers)for(let B of Object.values(E.resources))A(B);return[...z].sort()}function h(j){return x(P(j))}function y(j){return x(j.configDependencies)}function x(j){return j.map((z)=>{try{let A=I.statSync(z);return`${z}:${A.mtimeMs}:${A.size}`}catch{return`${z}:missing`}}).join(`
|
|
4
4
|
`)}function g(j){return j.layers.map((z)=>({config:F.relative(z.root,z.configFile),files:P({layers:[z],configDependencies:j.configDependencies.filter((A)=>A.startsWith(`${z.root}${F.sep}`))}).filter((A)=>I.statSync(A).isFile()).map((A)=>({path:F.relative(z.root,A).replaceAll(F.sep,"/"),sha256:w("sha256").update(I.readFileSync(A)).digest("hex")}))}))}
|
|
5
|
-
export{u as
|
|
5
|
+
export{u as eu,v as fu,R as gu,h as hu,y as iu,g as ju};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{oq as M,sq as x}from"./chunk-qhnyrwz2.js";import{yt as T}from"./chunk-ewcxfn7m.js";import{ew as N}from"./chunk-jryjwara.js";import V from"fs";import Z from"path";var y=new Map,W=new Map;async function R(j){let z;for(let J=0;J<3;J++)try{let X=(await V.promises.stat(j)).mtime.getTime(),Q=W.get(j);if(Q&&Q.mtime===X)return Q.content;let Y=await Bun.file(j).text(),K=(await V.promises.stat(j)).mtime.getTime();if(K!==X)continue;return W.set(j,{content:Y,mtime:K}),Y}catch(I){z=I;break}throw W.delete(j),Error(`File not found: ${j}${z?` (${z.message})`:""}`)}function S(j){W.delete(j)}function _(j){for(let B of W.keys())if(B.startsWith(j))W.delete(B)}var q=null,w=null,G=null;function C(j){G=j}async function b(j=!1){let B=G??await import("./chunk-ka2xspj3.js");if(j)return B.generateSignalsRuntimeDev();if(q===null)q=B.generateSignalsRuntime();return q}var D=null;async function A(){if(D===null){let{getRouterScript:j}=await import("./chunk-j3ajrx2n.js");D=j()}return D}var L={};async function g(j,B=!1){let z=j==="runtime"?await b(B):await A(),J=j==="runtime"&&B?"runtime-debug":j,I=L[J];if(!I||I.content!==z)I={content:z,hash:Bun.hash(z).toString(16).padStart(16,"0").slice(0,16)},L[J]=I;return{content:z,hash:I.hash,url:`/_stx/${j}.${I.hash}.js`}}function u(){W.clear(),x(),T(),q=null,w=null,D=null}function O(j){let B={debug:j.debug===!0,middleware:(j.middleware??[]).map((z)=>({name:z.name,timing:z.timing,handler:String(z.handler)})),customDirectives:(j.customDirectives??[]).map((z)=>({name:z.name,hasEndTag:z.hasEndTag===!0,handler:String(z.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(B)).digest("hex")}async function P(j,B){try{if(!B.cachePath)return null;let z=Z.resolve(B.cachePath),J=Z.join(z,`${U(j)}.html`),I=Z.join(z,`${U(j)}.meta.json`);if(!await M(J)||!await M(I))return null;let X=await Bun.file(I).text(),Q=JSON.parse(X);if(Q.cacheVersion!==B.cacheVersion)return null;if(Q.optionsSignature!==O(B))return null;if((await V.promises.stat(j)).mtime.getTime()>Q.mtime)return null;for(let $ of Q.dependencies)if(await M($)){if((await V.promises.stat($)).mtime.getTime()>Q.mtime)return null}else return null;return await Bun.file(J).text()}catch(z){return console.warn(`Cache error for ${j}:`,z),null}}async function p(j,B,z,J){try{if(!J.cachePath)return;let I=Z.resolve(J.cachePath);await V.promises.mkdir(I,{recursive:!0});let X=Z.join(I,`${U(j)}.html`),Q=Z.join(I,`${U(j)}.meta.json`),Y=await V.promises.stat(j);await Bun.write(X,B);let $={sourcePath:j,mtime:Y.mtime.getTime(),dependencies:Array.from(z),cacheVersion:J.cacheVersion,optionsSignature:O(J),generatedAt:Date.now()};await Bun.write(Q,JSON.stringify($,null,2)),y.set(j,{output:B,mtime:Y.mtime.getTime(),dependencies:z})}catch(I){console.warn(`Failed to cache template ${j}:`,I)}}var v=16;function U(j){return new Bun.CryptoHasher("sha1").update(j).digest("hex").substring(0,v)}
|
|
3
3
|
export{y as Uj,R as Vj,S as Wj,_ as Xj,C as Yj,b as Zj,A as _j,g as $j,u as ak,P as bk,p as ck,U as dk};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{ew as y}from"./chunk-jryjwara.js";function S4(){if(typeof Notification<"u"&&Notification.permission==="granted")return!0;return!1}function jZ(){return typeof window<"u"&&typeof document<"u"}async function w4(){if(typeof Notification>"u")return!1;if(Notification.permission==="granted")return!0;if(Notification.permission==="denied")return!1;return await Notification.requestPermission()==="granted"}var g=new Map;function B4(){return`alert-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function f4(Z){switch(Z){case"info":return"ℹ";case"success":return"✔";case"warning":return"⚠";case"error":return"✖";default:return"ℹ"}}function v4(Z="top-right"){if(!jZ())throw Error("Toast container requires browser environment");try{let $=document.querySelector(`.stx-toast-container[data-position="${Z}"]`);if($)return $}catch{}let Y=document.createElement("div");Y.className=`stx-toast-container ${Z}`,Y.dataset.position=Z;try{if(document.body)document.body.appendChild(Y)}catch{}return Y}function y4(Z){let{options:Y}=Z,$=f4(Y.type),J=Y.type||"info",Q=Y.duration!==0;return`
|
|
3
3
|
<div class="stx-toast ${J}" data-alert-id="${Z.id}" role="alert" aria-live="polite">
|
|
4
4
|
<div class="stx-toast-icon">${$}</div>
|
|
5
5
|
<div class="stx-toast-content">
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{$p as e,Yp as b,Zp as c,_p as d,vo as a}from"./chunk-qhnyrwz2.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-ewcxfn7m.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-w764f6g4.js";import"./chunk-18p8dqya.js";import"./chunk-w1dxgs78.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-r7qap4bh.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{d as validateClientScript,c as processOnceDirective,b as processJsonDirective,e as processDirectives,a as injectRouterScript};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Af as a,Bf as b,Cf as c,Df as d,Ef as e,Ff as f,Gf as g,Hf as h,If as i,Jf as j,Kf as k,Lf as l,Mf as m,Nf as n,Of as o,Pf as p,Qf as q}from"./chunk-
|
|
2
|
+
import{Af as a,Bf as b,Cf as c,Df as d,Ef as e,Ff as f,Gf as g,Hf as h,If as i,Jf as j,Kf as k,Lf as l,Mf as m,Nf as n,Of as o,Pf as p,Qf as q}from"./chunk-zdzd2jb4.js";import"./chunk-jryjwara.js";export{h as resizeAndConvert,f as processImage,d as isSharpAvailable,m as isImageFile,e as isImageBackendAvailable,l as groupVariantsByFormat,o as getTotalSize,n as getMimeType,g as getImageMetadata,k as getFallbackVariant,i as generateSrcSet,j as generateSizes,p as formatSize,q as ImageProcessingError,a as DEFAULT_WIDTHS,c as DEFAULT_QUALITY,b as DEFAULT_FORMATS};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Wf as a}from"./chunk-kgtbm5rp.js";import"./chunk-ffexgxm3.js";import"./chunk-e5yebhrk.js";import"./chunk-dvvx1wny.js";import"./chunk-w8hkprzv.js";import"./chunk-t41aaehf.js";import"./chunk-09zjty4k.js";import"./chunk-3qc0h6bj.js";import"./chunk-qhnyrwz2.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-ewcxfn7m.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-w764f6g4.js";import"./chunk-18p8dqya.js";import"./chunk-w1dxgs78.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-r7qap4bh.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{a as buildForProduction};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ai as e,wi as a,xi as b,yi as c,zi as d}from"./chunk-c79nfdyj.js";import"./chunk-
|
|
2
|
+
import{Ai as e,wi as a,xi as b,yi as c,zi as d}from"./chunk-c79nfdyj.js";import"./chunk-jryjwara.js";export{a as processAsyncDirectives,c as isAsyncComponent,e as generateAsyncComponentRuntime,d as generateAsyncComponentCSS,b as defineAsyncComponent};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{$p as w,Jo as x,Qo as k,Zl as A,_l as b,bn as T,cn as y,do as M,om as B,qm as F,vo as R,wr as P}from"./chunk-qhnyrwz2.js";import{ew as v}from"./chunk-jryjwara.js";function j(K){return K.endsWith(".md")||K.endsWith(".markdown")}function C(K){let z=[];_(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let G=[...z];_(/<code\b[^>]*>[\s\S]*?<\/code>/gi,G);function _(J,Y){let $;while(($=J.exec(K))!==null){let q=$.index,N=q+$[0].length;if(Y?.some((X)=>q>=X.start&&N<=X.end))continue;z.push({start:q,end:N})}}if(z.length===0)return K;z.sort((J,Y)=>J.start-Y.start);let U="",Q=0;for(let J of z){if(J.start<Q)continue;U+=K.slice(Q,J.start),U+=`@raw${K.slice(J.start,J.end)}@endraw`,Q=J.end}return U+=K.slice(Q),U}async function D(K,z={}){let{data:G,content:_}=A(K),Q=await(z.renderer??((J)=>b(J)))(_);return{html:C(Q),frontmatter:G??{}}}import{dirname as f,resolve as H}from"path";function S(K){let z=K,G=M(K);if(G)z=G.content.trim();let _=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,U=[],Q=[],J=[],Y=(N)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(N),$;while(($=_.exec(K))!==null){let N=$[1],X=$[2],E=$[0],Z=N.includes("server");if(Y(X))J.push(E);else if(Z)Q.push(X);else U.push(E)}let q=z;{let N=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,X,E=[];while((X=N.exec(q))!==null){let Z=X.index+X[0].length,L=q.indexOf("</script>",Z);if(L===-1)continue;E.push({start:X.index,end:L+9}),N.lastIndex=L+9}for(let Z=E.length-1;Z>=0;Z--)q=q.substring(0,E[Z].start)+q.substring(E[Z].end)}for(let N of U)q=q.replace(N,"");return{templateContent:q,serverScripts:Q,clientScripts:U,signalsScripts:J}}function g(K,z){return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -14,5 +14,5 @@ ${Q.join(`
|
|
|
14
14
|
`)}`}else{if(G.processClientScripts!==!1&&Q.length>0){let N=Y.__stx_event_bindings||[],X=B(Y),Z=(await Promise.all(Q.map(async(I)=>{let W=I.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!W)return I;return await F(W[1],{eventBindings:N,templateContent:q,serverData:X,filePath:z})}))).join(`
|
|
15
15
|
`);if(q.match(/(<\/body>)/i))q=q.replace(/(<\/body>)/i,`${Z}
|
|
16
16
|
$1`);else q+=`
|
|
17
|
-
${Z}`}q=await R(q)}if(G.wrapInDocument){if(!q.trim().toLowerCase().startsWith("<!doctype")&&!q.trim().toLowerCase().startsWith("<html"))q=g(q,G.title)}if(G.injectCSS)try{let{injectCss:N}=await import("./chunk-
|
|
17
|
+
${Z}`}q=await R(q)}if(G.wrapInDocument){if(!q.trim().toLowerCase().startsWith("<!doctype")&&!q.trim().toLowerCase().startsWith("<html"))q=g(q,G.title)}if(G.injectCSS)try{let{injectCss:N}=await import("./chunk-3qfz82gw.js");q=await N(q)}catch{}return q}
|
|
18
18
|
export{j as xk,C as yk,D as zk,o as Ak,r as Bk,V as Ck};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import y from"fs";import V from"path";var B=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^<>()]*>)?\s*\(/,X=/(?:^|\n)\s*(?:import|export)\s+(?:[^'"]*?\sfrom\s+)?['"](\.[^'"]*)['"]/g,D=["",".ts",".tsx",".js",".jsx",".mts",".mjs","/index.ts","/index.js"],g=3;function H(j,q){let J=V.resolve(V.dirname(q),j);for(let Q of D){let z=J+Q;try{if(y.statSync(z).isFile())return z}catch{}}return null}function K(j,q,J=0,Q=new Set){if(!q||J>=g)return!1;for(let z of j.matchAll(X)){let Z=H(z[1],q);if(!Z||Q.has(Z))continue;Q.add(Z);let $;try{$=y.readFileSync(Z,"utf8")}catch{continue}if(B.test($))return!0;if(K($,Z,J+1,Q))return!0}return!1}var Y=["batch","clearServerData","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refresh","registerStoresClient","setRouteParams","state","untrack","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useModel","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],R=["onMount","onDestroy"];function A(j="const",q=[],J){let Q=q.length?Y.filter((z)=>!q.includes(z)):Y;if(J!==void 0)Q=Q.filter((z)=>{let Z=z.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${Z}(?![\\w$])`).test(J)});return`${j} { ${Q.join(", ")} } = window.stx;`}var k=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"],E={useServerData:{category:"server-only",reason:"loads and serializes request-scoped data from <script server>; clients consume it through a keyed useFetch/useAsyncData."},redirect:{category:"server-only",reason:"returns an HTTP Response for <script server>/edge/build; use navigate() on the client."},useAsyncData:{category:"browser-composable",reason:"inlined on demand from src/composables when a script references it; reachable, not a bare global."},Teleport:{category:"compile-time-directive",reason:"template tag resolved by processTeleportDirectives; not a script callable."},StxModalBuiltin:{category:"builtin-component",reason:"builtin component used as a template tag; drive open/close from the modal store."},StxToastBuiltin:{category:"builtin-component",reason:"builtin component used as a template tag; push toasts via the toast store."},useForm:{category:"browser-composable",reason:"reactive form primitive; lives in src/composables/use-form.ts and is inlined on demand when a <script client> references it (#1846)."},defineForm:{category:"browser-composable",reason:"deprecated alias of useForm, kept for a minor (#1843). Same delivery path \u2014 inlined on demand from src/composables/use-form.ts."},validateFields:{category:"isomorphic-import",reason:"pure validation helper; import it directly, not auto-delivered to <script client> (per client-api-delivery.test.ts)."},validateField:{category:"isomorphic-import",reason:"singular pure validation helper; same explicit-import boundary as validateFields."}},x=Y.filter((j)=>!k.includes(j));function O(j){if(!j)return!1;return x.some((q)=>new RegExp(`\\b${q}\\s*(?:<[^>]*>)?\\s*\\(`).test(j))}var M=[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],C=/\s@[a-z][\w.:-]*\s*=/i;function T(j,q){if(!j)return!1;let J=U(j);return F(J,q)}function F(j,q){if(M.some((J)=>J.test(j)))return!0;if(O(j))return!0;return P(j,q)}function P(j,q){if(!q)return!1;for(let J of j.matchAll(/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script\s*>/gi))if(K(J[1],q))return!0;return!1}function d(j,q){if(!j)return!1;let J=U(j);return C.test(J)||F(J,q)}var u=["if","else-if","elseif","else","for","show","key","text","html","model","ref"];function _(j){return u.includes(j.toLowerCase())}var G=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],b=["x-init","x-transition","x-effect","x-on"],p=[...G,...b];function c(){return`{${G.map((j)=>`'${j}':1`).join(",")}}`}var v=65536,S=4,w=new Map;function r(){w.clear()}function U(j){if(!j)return j;if(!j.includes("<!--")&&!/<(?:pre|code)\b/i.test(j))return j;let q=j.length>=v;if(q){let z=w.get(j);if(z!==void 0)return z}let J=(z)=>z.replace(/(<[^>]*>)|([^<]+)/g,(Z,$,W)=>$??" ".repeat(W.length)),Q=j.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(z,Z,$,W)=>Z+J($)+W).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(z,Z,$,W)=>Z+J($)+W).replace(/<!--[\s\S]*?-->/g,(z)=>" ".repeat(z.length));if(q){while(w.size>=S){let z=w.keys().next();if(z.done)break;w.delete(z.value)}w.set(j,Q)}return Q}
|
|
3
|
-
export{K as
|
|
3
|
+
export{K as Tu,Y as Uu,R as Vu,A as Wu,k as Xu,E as Yu,x as Zu,O as _u,T as $u,d as av,u as bv,_ as cv,G as dv,b as ev,p as fv,c as gv,r as hv,U as iv};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
`),B;try{let{bundleClientScript:j}=await import("./chunk-
|
|
2
|
+
import{ew as H}from"./chunk-jryjwara.js";import P from"path";var $=/__stxModules\["((?:[^"\\]|\\.)*)"\]/g;function G(...v){let w=new Set;for(let q of v){if(!q||!q.includes("__stxModules["))continue;for(let z of q.matchAll($))try{w.add(JSON.parse(`"${z[1]}"`))}catch{}}return[...w].sort()}async function T(v,w={}){if(v.length===0)return null;let q=process.cwd(),z=[],J=[];v.forEach((j,X)=>{let Z=j.startsWith("npm:")?j.slice(4):P.resolve(q,j),N=`__stxRegistered${X}`,O=JSON.stringify(j);z.push(`import * as ${N} from ${JSON.stringify(Z)};`),J.push(`if (!globalThis.__stxModules[${O}]) globalThis.__stxModules[${O}] = ${N};`)});let L=[...z,"globalThis.__stxModules = globalThis.__stxModules || {};",...J].join(`
|
|
3
|
+
`),B;try{let{bundleClientScript:j}=await import("./chunk-g812bscg.js");B=await j(L,P.join(q,".stx-module-registry.ts"),{projectRoot:q,minify:w.minify,externalizeUserModules:!1})}catch(j){return console.warn("[stx] could not build the page module registry (#1957):",j),null}let{transformAutoImports:Q,generateAutoImportDestructuring:U}=await import("./chunk-9ypp0a8t.js"),F=Q(B),V=U(F.stxImports,F.browserImports),{transformStoreImports:W}=await import("./chunk-9aw5d4rr.js");B=W(F.code);let M=JSON.stringify(new Bun.CryptoHasher("md5").update(L).digest("hex").slice(0,12));return[";(function() {"," var __stxBundles = globalThis.__stxModuleBundles || (globalThis.__stxModuleBundles = {});",` if (__stxBundles[${M}]) return;`,` __stxBundles[${M}] = true;`,V,B,"})();"].join(`
|
|
4
4
|
`)}export{G as registeredModuleIdsIn,T as buildModuleRegistryScript};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$e as c,Ze as a,_e as b,af as d,bf as e,cf as f,df as g,ef as h,ff as i,gf as j,hf as k,if as l,jf as m,kf as n,lf as o}from"./chunk-ym3r8ktq.js";import"./chunk-
|
|
2
|
+
import{$e as c,Ze as a,_e as b,af as d,bf as e,cf as f,df as g,ef as h,ff as i,gf as j,hf as k,if as l,jf as m,kf as n,lf as o}from"./chunk-ym3r8ktq.js";import"./chunk-jryjwara.js";export{k as writeNetlifyConfig,n as initNetlify,l as hasNetlifyConfig,g as getTotalSize,h as generateNetlifyToml,f as formatSize,e as filterRequiredFiles,i as detectProjectConfig,m as deploy,a as createNetlifyClient,d as createFileManifest,j as createDefaultNetlifyConfig,c as collectDeployFiles,b as calculateSha1,o as DeployError};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
var K={},Y=[],O={};function I(){return K}function h(){return O}function D(){K={},Y.length=0,O={}}function U(j){K=Q(K,j)}function Q(j,z){return{title:z.title??j.title,titleTemplate:z.titleTemplate??j.titleTemplate,base:z.base??j.base,meta:[...j.meta||[],...z.meta||[]],link:[...j.link||[],...z.link||[]],script:[...j.script||[],...z.script||[]],style:[...j.style||[],...z.style||[]],htmlAttrs:{...j.htmlAttrs,...z.htmlAttrs},bodyAttrs:{...j.bodyAttrs,...z.bodyAttrs}}}function Z(j){U(_(j))}function _(j){let z=[];if(j.description)z.push({name:"description",content:j.description});if(j.keywords){let L=Array.isArray(j.keywords)?j.keywords.join(", "):j.keywords;z.push({name:"keywords",content:L})}if(j.author)z.push({name:"author",content:j.author});if(j.robots)z.push({name:"robots",content:j.robots});let A=j.ogTitle??j.title,B=j.ogDescription??j.description;if(A)z.push({property:"og:title",content:A});if(B)z.push({property:"og:description",content:B});if(j.ogImage)z.push({property:"og:image",content:j.ogImage});if(j.ogUrl)z.push({property:"og:url",content:j.ogUrl});if(j.ogType)z.push({property:"og:type",content:j.ogType});if(j.ogSiteName)z.push({property:"og:site_name",content:j.ogSiteName});if(j.ogLocale)z.push({property:"og:locale",content:j.ogLocale});let E=j.twitterTitle??j.title,F=j.twitterDescription??j.description,J=j.twitterImage??j.ogImage;if(j.twitterCard)z.push({name:"twitter:card",content:j.twitterCard});if(E)z.push({name:"twitter:title",content:E});if(F)z.push({name:"twitter:description",content:F});if(J)z.push({name:"twitter:image",content:J});if(j.twitterSite)z.push({name:"twitter:site",content:j.twitterSite});if(j.twitterCreator)z.push({name:"twitter:creator",content:j.twitterCreator});if(j.articleAuthor)z.push({property:"article:author",content:j.articleAuthor});if(j.articlePublishedTime)z.push({property:"article:published_time",content:j.articlePublishedTime});if(j.articleModifiedTime)z.push({property:"article:modified_time",content:j.articleModifiedTime});if(j.articleSection)z.push({property:"article:section",content:j.articleSection});if(j.articleTags)for(let L of j.articleTags)z.push({property:"article:tag",content:L});let G=[];if(j.canonical)G.push({rel:"canonical",href:j.canonical});return{title:j.title,titleTemplate:j.titleTemplate,meta:z,link:G}}function S(j){if(O={...O,...j},j.title||j.description)Z({title:j.title,description:j.description})}function P(j){let z=typeof j==="function"?j():j;U({title:z})}function C(j=K){let z=[];if(j.title){let A=j.title;if(j.titleTemplate)A=typeof j.titleTemplate==="function"?j.titleTemplate(A):j.titleTemplate.replace("%s",A);z.push(`<title>${N(A)}</title>`)}if(j.base){let A=Object.entries(j.base).map(([B,E])=>`${B}="${N(E)}"`).join(" ");z.push(`<base ${A}>`)}for(let A of j.meta||[]){let B=Object.entries(A).filter(([E,F])=>F!==void 0).map(([E,F])=>{return`${E==="httpEquiv"?"http-equiv":E}="${N(String(F))}"`}).join(" ");z.push(`<meta ${B}>`)}for(let A of j.link||[]){let B=Object.entries(A).filter(([E,F])=>F!==void 0).map(([E,F])=>`${E}="${N(String(F))}"`).join(" ");z.push(`<link ${B}>`)}for(let A of j.script||[]){let{content:B,...E}=A,F=Object.entries(E).filter(([J,G])=>G!==void 0).map(([J,G])=>{if(typeof G==="boolean")return G?J:"";return`${J}="${N(String(G))}"`}).filter(Boolean).join(" ");if(B)z.push(`<script ${F}>${B}</script>`);else z.push(`<script ${F}></script>`)}for(let A of j.style||[]){let B=A.type?` type="${A.type}"`:"";z.push(`<style${B}>${A.content}</style>`)}return z.join(`
|
|
3
3
|
`)}function M(j=K){if(!j.htmlAttrs)return"";return Object.entries(j.htmlAttrs).map(([z,A])=>`${z}="${N(A)}"`).join(" ")}function V(j=K){if(!j.bodyAttrs)return"";return Object.entries(j.bodyAttrs).map(([z,A])=>`${z}="${N(A)}"`).join(" ")}function N(j){return j.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function w(j=K){if(typeof document>"u")return;if(j.title){let z=j.title;if(j.titleTemplate)z=typeof j.titleTemplate==="function"?j.titleTemplate(z):j.titleTemplate.replace("%s",z);document.title=z}for(let z of j.meta||[]){let A=z.name?`meta[name="${z.name}"]`:z.property?`meta[property="${z.property}"]`:null;if(A){let B=document.querySelector(A);if(!B){if(B=document.createElement("meta"),z.name)B.setAttribute("name",z.name);if(z.property)B.setAttribute("property",z.property);document.head.appendChild(B)}B.setAttribute("content",z.content)}}for(let z of j.link||[]){let A=`link[rel="${z.rel}"]${z.href?`[href="${z.href}"]`:""}`,B=document.querySelector(A);if(!B)B=document.createElement("link"),document.head.appendChild(B);for(let[E,F]of Object.entries(z))if(F!==void 0)B.setAttribute(E,String(F))}if(j.htmlAttrs)for(let[z,A]of Object.entries(j.htmlAttrs))if(z==="class")for(let B of String(A).split(/\s+/).filter(Boolean))document.documentElement.classList.add(B);else document.documentElement.setAttribute(z,A);if(j.bodyAttrs)for(let[z,A]of Object.entries(j.bodyAttrs))document.body.setAttribute(z,A)}function y(j){let z="";return{content:j.replace(/@head\s*([\s\S]*?)@endhead/g,(B,E)=>{return z+=E.trim()+`
|
|
4
|
-
`,""}),headContent:z.trim()}}function x(j,z){return j.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(A,B,E,F)=>{let J=B?E:z[(F||"").trim()]??F,G=z.__stx_runtime_head??{};return z.__stx_runtime_head=Q(G,{title:J}),""})}function T(j,z){return j.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(A,B,E,F,J,G)=>{let L=F?J:G,R=F?L:z[(L||"").trim()]??L,W=E.includes(":")?{property:E,content:R}:{name:E,content:R},X=z.__stx_runtime_head??{};return z.__stx_runtime_head=Q(X,{meta:[W]}),""})}export{I as
|
|
4
|
+
`,""}),headContent:z.trim()}}function x(j,z){return j.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(A,B,E,F)=>{let J=B?E:z[(F||"").trim()]??F,G=z.__stx_runtime_head??{};return z.__stx_runtime_head=Q(G,{title:J}),""})}function T(j,z){return j.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(A,B,E,F,J,G)=>{let L=F?J:G,R=F?L:z[(L||"").trim()]??L,W=E.includes(":")?{property:E,content:R}:{name:E,content:R},X=z.__stx_runtime_head??{};return z.__stx_runtime_head=Q(X,{meta:[W]}),""})}export{I as zu,h as Au,D as Bu,U as Cu,Q as Du,Z as Eu,_ as Fu,S as Gu,P as Hu,C as Iu,M as Ju,V as Ku,w as Lu,y as Mu,x as Nu,T as Ou};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{tu as H,wu as F}from"./chunk-18p8dqya.js";import{ew as I}from"./chunk-jryjwara.js";import J from"fs";import z from"path";async function N(w,A,j){if(w.__stx_runtime_config)return;let b=H();if(b||j){w.__stx_runtime_config=b??F(j);return}let q=z.dirname(z.resolve(A));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((D)=>J.existsSync(z.join(q,D)))){let{loadStxConfig:D}=await import("./chunk-fh97a60e.js"),G=await D(q);if(G.runtimeConfig)w.__stx_runtime_config=F(G.runtimeConfig);return}let B=z.dirname(q);if(B===q)return;q=B}}async function O(w,A){function j(b){if(b===null)return"null";if(Array.isArray(b))return`Array<${b.length?[...new Set(b.map(j))].join(" | "):"unknown"}>`;if(typeof b==="object")return`{ ${Object.entries(b).map(([q,B])=>`readonly ${JSON.stringify(q)}: ${j(B)}`).join("; ")} }`;return typeof b}await Bun.write(z.join(w,".stx/runtime-config.d.ts"),`import '@stacksjs/stx/runtime-config'
|
|
3
3
|
declare module '@stacksjs/stx/runtime-config' { interface PublicRuntimeConfig ${j(A.public??{})} }
|
|
4
4
|
`),await Bun.write(z.join(w,".stx/runtime-config-server.d.ts"),`import '@stacksjs/stx/runtime-config-server'
|
|
5
5
|
declare module '@stacksjs/stx/runtime-config-server' { interface PrivateRuntimeConfig ${j(A.private??{})} }
|
|
6
6
|
`)}
|
|
7
|
-
export{N as
|
|
7
|
+
export{N as qu,O as ru};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Gj as B,Hj as R,Ij as H,Jj as S,Kj as F,Lj as M,Pj as E,Qj as P,Rj as O,Sj as I}from"./chunk-t41aaehf.js";import{
|
|
2
|
+
import{Gj as B,Hj as R,Ij as H,Jj as S,Kj as F,Lj as M,Pj as E,Qj as P,Rj as O,Sj as I}from"./chunk-t41aaehf.js";import{gv as L}from"./chunk-ttny9g8k.js";var w=null;function j(){return w}function f(z,W){if(w)w.provides.set(z,W);else V.set(z,W)}function k(z,W){let Q=w;while(Q){if(Q.provides.has(z))return Q.provides.get(z);Q=Q.parent}if(V.has(z))return V.get(z);return W}var V=new Map;function v(z,W){V.set(z,W)}function U(z){let W=w,Q=W?.el,Z=Array.isArray(z)?z:z&&typeof z==="object"?Object.keys(z):[];if(Q&&Z.length>0){let $=Q.__stx_component_emits||=Object.create(null);for(let Y of Z)$[Y]=!0}let _=($,...Y)=>{if(typeof document>"u")return;if(Q){let X=Q.__stx_component_emits||=Object.create(null);X[$]=!0,Q.dispatchEvent(new CustomEvent($,{detail:Y.length===1?Y[0]:Y,bubbles:!0,cancelable:!0}))}};if(W)W.emit=_;return _}function g(z){if(w)w.exposed=z}function m(z){let W=Promise.resolve();return z?W.then(z):W}function y(z){if(w)w.errorCapturedHooks.push(z)}function h(z,W,Q){let Z=W?.parent;while(Z){for(let _ of Z.errorCapturedHooks)if(_(z,W,Q)===!1)return;Z=Z.parent}}function p(){return w?.slots??{}}function u(){return w?.slots??{}}function l(){return w?.attrs??{}}function d(z){let W=z.__provides?new Map(Object.entries(z.__provides)):new Map;return{...z,__provides:W,__provide(Q,Z){W.set(Q,Z)},__inject(Q,Z){if(W.has(Q))return W.get(Q);if(z.__provides){let _=z.__provides instanceof Map?z.__provides:new Map(Object.entries(z.__provides));if(_.has(Q))return _.get(Q)}return Z}}}function i(){return`
|
|
3
3
|
// STX Composition API Runtime
|
|
4
4
|
(function() {
|
|
5
5
|
const _provides = new Map();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Eh as a,Fh as b,Gh as c,Hh as d,Ih as e,Jh as f,Kh as g,Lh as h}from"./chunk-64djh88a.js";import"./chunk-
|
|
2
|
+
import{Eh as a,Fh as b,Gh as c,Hh as d,Ih as e,Jh as f,Kh as g,Lh as h}from"./chunk-64djh88a.js";import"./chunk-jryjwara.js";export{g as timingPlugin,c as pluginManager,a as definePlugin,f as debugPlugin,h as createVariablesPlugin,e as createFilterPlugin,d as createDirectivePlugin,b as PluginManager};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Bi as a,Ci as b,Di as c,Ei as d,Fi as e,Gi as f,Hi as g}from"./chunk-ej8mv2k6.js";import"./chunk-
|
|
2
|
+
import{Bi as a,Ci as b,Di as c,Ei as d,Fi as e,Gi as f,Hi as g}from"./chunk-ej8mv2k6.js";import"./chunk-jryjwara.js";export{c as shouldCacheComponent,a as processKeepAliveDirectives,g as onDeactivated,f as onActivated,e as generateKeepAliveRuntime,d as generateKeepAliveCSS,b as createKeepAliveCache};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
function A(h){let q=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;h=h.replace(q,(w,j)=>{return`const { ${j.split(",").map((k)=>k.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
|
|
3
3
|
`});let v=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return h=h.replace(v,(w,j)=>{return`const { ${j.split(",").map((k)=>k.trim()).filter(Boolean).join(", ")} } = window.__composables
|
|
4
4
|
`}),h}function B(h){return h.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}
|
|
5
|
-
export{A as
|
|
5
|
+
export{A as Pu,B as Qu};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Pi as a,Qi as b}from"./chunk-4k0h6sca.js";import"./chunk-xwxdwqn9.js";import"./chunk-79nj87t6.js";import"./chunk-3qc0h6bj.js";import"./chunk-qhnyrwz2.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-ewcxfn7m.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-w764f6g4.js";import"./chunk-18p8dqya.js";import"./chunk-w1dxgs78.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-r7qap4bh.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{a as getStoreScript,b as clearStoreCache};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-jryjwara.js";function F(){return`<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
|
|
3
3
|
(function() {
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{bw as W,cw as k,dw as G}from"./chunk-jryjwara.js";import A from"fs";import B from"path";function h(j){let q=0;for(let K=0;K<j.length;K++){let Q=j[K];q=(q<<5)-q+Q,q=q&q}return Math.abs(q).toString(16).padStart(8,"0")}function u(j,q){let K=B.basename(j);for(let Q of q)if(Q.startsWith("*.")){let Y=Q.slice(1);if(K.endsWith(Y))return!0}else if(Q.includes("*")){let Y=new RegExp(`^${Q.replace(/\*/g,".*")}$`);if(Y.test(K)||Y.test(j))return!0}else if(K===Q||j.includes(Q))return!0;return!1}function f(j,q,K){let Q=B.extname(j).toLowerCase(),Y=l[Q],X=(K.maxFileSizeKB||500)*1024;if(q>X)return!1;if(K.exclude&&u(j,K.exclude))return!1;if(K.include&&K.include.length>0){for(let Z of K.include)if(Z.startsWith("*.")){if(j.endsWith(Z.slice(1)))return!0}else if(j.includes(Z))return!0}if(Y&&K[Y]===!0)return!0;if(!Y)return!1;return!1}function T(j,q,K,Q){let Y=A.readdirSync(j,{withFileTypes:!0});for(let X of Y){let Z=B.join(j,X.name);if(X.isDirectory()){if(["node_modules",".git",".stx"].includes(X.name))continue;T(Z,q,K,Q)}else if(X.isFile()){let O=A.statSync(Z),_=B.relative(q,Z);if(f(_,O.size,K)){let $=A.readFileSync(Z),L=h($),V=`/${_.replace(/\\/g,"/")}`;Q.push({url:V,revision:L,size:O.size})}}}}function U(j,q){let K=q.pwa?.precache,Q=[];if(!K?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!A.existsSync(j))return{entries:[],totalSize:0,fileCount:0};T(j,j,K,Q),Q.sort((X,Z)=>X.url.localeCompare(Z.url));let Y=Q.reduce((X,Z)=>X+Z.size,0);return{entries:Q,totalSize:Y,fileCount:Q.length}}function J(j){if(j.entries.length===0)return"[]";return`[
|
|
3
3
|
${j.entries.map((K)=>` { url: '${K.url}', revision: '${K.revision}' }`).join(`,
|
|
4
4
|
`)}
|
|
5
5
|
]`}function E(j){if(j<1024)return`${j} B`;if(j<1048576)return`${(j/1024).toFixed(1)} KB`;return`${(j/1048576).toFixed(2)} MB`}var l;var F=G(()=>{l={".html":"includeHtml",".htm":"includeHtml",".js":"includeJs",".mjs":"includeJs",".css":"includeCss",".png":"includeImages",".jpg":"includeImages",".jpeg":"includeImages",".gif":"includeImages",".webp":"includeImages",".svg":"includeImages",".ico":"includeImages",".woff":"includeFonts",".woff2":"includeFonts",".ttf":"includeFonts",".eot":"includeFonts",".otf":"includeFonts"}});function g(j){let q={"cache-first":{className:"CacheFirst",importFrom:"workbox-strategies"},"network-first":{className:"NetworkFirst",importFrom:"workbox-strategies"},"stale-while-revalidate":{className:"StaleWhileRevalidate",importFrom:"workbox-strategies"},"network-only":{className:"NetworkOnly",importFrom:"workbox-strategies"},"cache-only":{className:"CacheOnly",importFrom:"workbox-strategies"}};return q[j]||q["network-first"]}function R(j){return g(j).className}function M(j){let q=j.pwa;if(!q?.enabled)return"";let K=q.routes||[],Q=q.cacheStorage,Y=[];for(let X of K){let Z=R(X.strategy),O=[];if(X.maxAgeSeconds||X.maxEntries||Q?.maxEntries){let $=X.maxEntries||Q?.maxEntries||100,L=X.maxAgeSeconds||(Q?.maxAge?Q.maxAge*24*60*60:void 0);O.push(`new ExpirationPlugin({
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{$i as e,Xi as a,Yi as b,Zi as c,_i as d,aj as f,bj as g,cj as h,dj as i,ej as j,fj as k,gj as l,hj as m,ij as n}from"./chunk-aftse9mb.js";import"./chunk-qhnyrwz2.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-ewcxfn7m.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-w764f6g4.js";import"./chunk-18p8dqya.js";import"./chunk-w1dxgs78.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-r7qap4bh.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{i as streamingSuspenseDirective,m as streamToResponse,g as streamTemplateSimple,a as streamTemplate,d as renderStreamingPage,k as registerStreamingDirectives,e as processStreamDirectives,l as processSectionDirectives,j as islandDirective,n as generateHydrationRuntime,f as extractStreamBoundaries,h as createStreamRenderer,b as buildSuspenseResolveScript,c as SUSPENSE_RESOLVER_RUNTIME};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{ew as l}from"./chunk-jryjwara.js";import U from"fs";import G from"path";import I from"os";import H from"crypto";import{generatePlaceholder as m,processImage as g}from"ts-images";var d=[320,640,768,1024,1280,1536,1920],h=["webp","jpeg"],b=80,u=[".jpg",".jpeg",".png",".webp",".avif",".gif",".svg"],P={webp:"image/webp",avif:"image/avif",jpeg:"image/jpeg",png:"image/png"},N=null,W=!1;async function Y(){if(W)return N;W=!0;try{let J=await import("sharp");return N=J.default||J,N}catch{return null}}async function e(){return await Y()!==null}async function t(){return!0}async function JJ(J,K={}){let{widths:Z=d,formats:$=h,quality:q=b,fit:C="cover",placeholder:X="none",outputDir:Q=".stx/images",baseUrl:_="/images"}=K,j,x;if(typeof J==="string"){if(x=J,!await Bun.file(J).exists())throw new L(`Image not found: ${J}`,"NOT_FOUND");j=await Bun.file(J).arrayBuffer().then((V)=>Buffer.from(V))}else x="buffer-input",j=J;let w=H.createHash("sha256").update(j).digest("hex").slice(0,12),y=await O(j),{width:B,height:D}=y,A=B/D;await U.promises.mkdir(Q,{recursive:!0});let T=[],v=G.basename(x,G.extname(x)),z=Z.filter((V)=>V<=B);if(!z.includes(B)&&B<=Math.max(...Z))z.push(B);z.sort((V,R)=>V-R);for(let V of z){let R=Math.round(V/A);for(let F of $){let S=`${v}-${V}w-${w}.${F}`,k=G.join(Q,S),c=`${_}/${S}`,E=await n(j,{width:V,height:R,format:F,quality:q,fit:C});await Bun.write(k,E),T.push({path:k,url:c,width:V,height:R,format:F,size:E.length})}}let M;if(X!=="none")M=await o(j,X);return{src:x,variants:T,placeholder:M,width:B,height:D,aspectRatio:A,hash:w}}async function O(J){let K=typeof J==="string"?Buffer.from(await Bun.file(J).arrayBuffer()):J,Z=await Y();if(Z){let q=await Z(K).metadata();return{width:q.width||0,height:q.height||0,format:q.format||"unknown",hasAlpha:q.hasAlpha}}return p(K)}function p(J){if(J[0]===137&&J[1]===80&&J[2]===78&&J[3]===71){let K=J.readUInt32BE(16),Z=J.readUInt32BE(20);return{width:K,height:Z,format:"png",hasAlpha:!0}}if(J[0]===255&&J[1]===216){let K=2;while(K<J.length){if(J[K]!==255)break;let Z=J[K+1];if(Z>=192&&Z<=207&&Z!==196&&Z!==200&&Z!==204){let q=J.readUInt16BE(K+5);return{width:J.readUInt16BE(K+7),height:q,format:"jpeg",hasAlpha:!1}}let $=J.readUInt16BE(K+2);K+=2+$}}if(J.toString("utf8",0,4)==="RIFF"&&J.toString("utf8",8,12)==="WEBP"){let K=J.toString("utf8",12,16);if(K==="VP8 "){let Z=J.readUInt16LE(26)&16383,$=J.readUInt16LE(28)&16383;return{width:Z,height:$,format:"webp",hasAlpha:!1}}if(K==="VP8L"){let Z=J.readUInt32LE(21),$=(Z&16383)+1,q=(Z>>14&16383)+1;return{width:$,height:q,format:"webp",hasAlpha:!0}}}if(J.toString("utf8",0,3)==="GIF"){let K=J.readUInt16LE(6),Z=J.readUInt16LE(8);return{width:K,height:Z,format:"gif",hasAlpha:!0}}throw new L("Unable to parse image dimensions","PARSE_ERROR")}async function n(J,K){let Z=await Y();if(Z){let q=Z(J).resize(K.width,K.height,{fit:K.fit});switch(K.format){case"webp":q=q.webp({quality:K.quality});break;case"avif":q=q.avif({quality:K.quality});break;case"jpeg":q=q.jpeg({quality:K.quality});break;case"png":q=q.png({quality:K.quality});break}return q.toBuffer()}let $=G.join(I.tmpdir(),`stx-img-${H.randomBytes(8).toString("hex")}.${K.format}`);try{return await g({input:J,output:$,format:K.format,quality:K.quality,resize:{width:K.width,height:K.height,fit:K.fit}}),Buffer.from(await Bun.file($).arrayBuffer())}finally{await U.promises.unlink($).catch(()=>{})}}async function o(J,K){let Z=await Y();if(K==="blur"&&Z){let X=(await Z(J).resize(20).blur(10).toBuffer()).toString("base64"),Q=await O(J);return`data:${P[Q.format]||"image/jpeg"};base64,${X}`}if(K==="dominant-color"&&Z){let{dominant:C}=await Z(J).resize(1,1).toBuffer().then(async(X)=>{let Q=await Z(X).metadata();return{dominant:{r:128,g:128,b:128}}}).catch(()=>({dominant:{r:128,g:128,b:128}}));return`rgb(${C.r}, ${C.g}, ${C.b})`}let $=await O(J),q=G.join(I.tmpdir(),`stx-ph-${H.randomBytes(8).toString("hex")}.${$.format==="unknown"?"bin":$.format}`);try{await Bun.write(q,J);let C=K==="blur"?"blur":K==="thumbhash"?"thumbhash":"dominant-color",Q=await m(q,{strategy:C,width:C==="thumbhash"?void 0:32});if(K==="dominant-color"&&Q.dominantColor)return Q.dominantColor;if(Q.dataURL)return Q.dataURL;return"rgb(128, 128, 128)"}catch{return"rgb(128, 128, 128)"}finally{await U.promises.unlink(q).catch(()=>{})}}function KJ(J,K){return(K?J.filter(($)=>$.format===K):J).sort(($,q)=>$.width-q.width).map(($)=>`${$.url} ${$.width}w`).join(", ")}function ZJ(J){if(!J||Object.keys(J).length===0)return"100vw";return Object.entries(J).sort((Z,$)=>{let q=Number.parseInt(Z[0].replace(/\D/g,""))||0;return(Number.parseInt($[0].replace(/\D/g,""))||0)-q}).map(([Z,$])=>`(max-width: ${Z}) ${$}`).join(", ")+", 100vw"}function $J(J){let K=J.filter(($)=>$.format==="jpeg");if(K.length===0)return J[Math.floor(J.length/2)];let Z=K.sort(($,q)=>$.width-q.width);return Z[Math.floor(Z.length/2)]}function qJ(J){let K=new Map;for(let Z of J){let $=K.get(Z.format)||[];$.push(Z),K.set(Z.format,$)}return K}function CJ(J){let K=G.extname(J).toLowerCase();return u.includes(K)}function QJ(J){return P[J]||"application/octet-stream"}function VJ(J){return J.reduce((K,Z)=>K+Z.size,0)}function XJ(J){if(J<1024)return`${J} B`;if(J<1048576)return`${(J/1024).toFixed(1)} KB`;return`${(J/1048576).toFixed(2)} MB`}class L extends Error{code;constructor(J,K){super(J);this.name="ImageProcessingError",this.code=K}}
|
|
3
3
|
export{d as Af,h as Bf,b as Cf,e as Df,t as Ef,JJ as Ff,O as Gf,n as Hf,KJ as If,ZJ as Jf,$J as Kf,qJ as Lf,CJ as Mf,QJ as Nf,VJ as Of,XJ as Pf,L as Qf};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{su as a,tu as b,uu as c,vu as d,wu as e,xu as f,yu as g}from"./chunk-18p8dqya.js";import"./chunk-jryjwara.js";export{a as withRuntimeConfig,c as useServerRuntimeConfig,d as useRuntimeConfig,f as runtimeConfigTag,e as resolveRuntimeConfig,g as injectRuntimeConfig,b as currentRuntimeConfig};
|