@stacksjs/stx 0.2.863 → 0.2.864
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-gp8hgpt9.js → chunk-01mwbg1r.js} +3 -3
- package/dist/{chunk-fnv94wc6.js → chunk-0v2yj490.js} +1 -1
- package/dist/chunk-0zxzcrns.js +2 -0
- package/dist/chunk-18qvx7b0.js +2 -0
- package/dist/{chunk-zr22gtpf.js → chunk-1smbjj34.js} +1 -1
- package/dist/chunk-28nk2zej.js +2 -0
- package/dist/chunk-2mgajzam.js +2 -0
- package/dist/{chunk-k7dxm48r.js → chunk-4w8a7f8t.js} +1 -1
- package/dist/chunk-53797jvm.js +2 -0
- package/dist/{chunk-zsnmk5me.js → chunk-5dvkphbe.js} +1 -1
- package/dist/{chunk-v408qsze.js → chunk-5kkq2eqr.js} +1 -1
- package/dist/{chunk-xfd3yqgj.js → chunk-6mhj42gz.js} +12 -12
- package/dist/chunk-6nzdsh2c.js +2 -0
- package/dist/{chunk-ks5p5w6z.js → chunk-6y066pr2.js} +1 -1
- package/dist/chunk-709hfmpj.js +2 -0
- package/dist/{chunk-8502xb4n.js → chunk-79y9amt1.js} +7 -7
- package/dist/{chunk-8v1zpdef.js → chunk-7chzhef2.js} +1 -1
- package/dist/{chunk-5s1fb8z4.js → chunk-7wpk300q.js} +1 -1
- package/dist/{chunk-sj3ry5ck.js → chunk-7xhwqc0c.js} +7 -1
- package/dist/{chunk-z383x16t.js → chunk-8010hzhm.js} +1 -1
- package/dist/{chunk-yhc1c4tr.js → chunk-83qwwnye.js} +52 -52
- package/dist/{chunk-mfa07erx.js → chunk-83tvkw4y.js} +1 -1
- package/dist/{chunk-1grdbpsk.js → chunk-8ay0nq31.js} +2 -2
- package/dist/{chunk-2c18y094.js → chunk-8v8eawjw.js} +1 -1
- package/dist/{chunk-5p1k2h5q.js → chunk-8yybk485.js} +1 -1
- package/dist/chunk-9cwag0tk.js +2 -0
- package/dist/{chunk-vwwpbhd2.js → chunk-a98jgxkb.js} +1 -1
- package/dist/chunk-aef82ns3.js +2 -0
- package/dist/{chunk-ztbexx3h.js → chunk-axkgbc0k.js} +1 -1
- package/dist/chunk-az12j7cr.js +2 -0
- package/dist/{chunk-46ddesnf.js → chunk-b666d8m6.js} +1 -1
- package/dist/{chunk-y190sh29.js → chunk-brs63ht2.js} +9 -9
- package/dist/chunk-byve4g2y.js +2 -0
- package/dist/{chunk-jfmj0wsy.js → chunk-cdbmfe7d.js} +1 -1
- package/dist/{chunk-az5xw3w8.js → chunk-cjy9cdm0.js} +1 -1
- package/dist/chunk-cwjt04kc.js +2 -0
- package/dist/chunk-d10cq130.js +2 -0
- package/dist/{chunk-32ty2zx6.js → chunk-df0ry01a.js} +1 -1
- package/dist/{chunk-qxw9h564.js → chunk-ehd68fc7.js} +1 -1
- package/dist/{chunk-yr1zx78b.js → chunk-epct9fqd.js} +2 -2
- package/dist/{chunk-reeaknf2.js → chunk-eq40b4n4.js} +1 -1
- package/dist/{chunk-58sh82aj.js → chunk-ez6e7rh1.js} +1 -1
- package/dist/chunk-f0b3ca2n.js +2 -0
- package/dist/chunk-f52b9hjv.js +2 -0
- package/dist/{chunk-bx5d87xx.js → chunk-f6ypmk8x.js} +1 -1
- package/dist/{chunk-s9df8srx.js → chunk-fd1bpv35.js} +3 -3
- package/dist/{chunk-wk4wg6sn.js → chunk-fh8jzm4b.js} +2 -2
- package/dist/{chunk-0xtda6aw.js → chunk-fmzyrg2e.js} +1 -1
- package/dist/{chunk-qa5y30sy.js → chunk-g0xn80gz.js} +7 -7
- package/dist/{chunk-gw7t6a3t.js → chunk-gheba4nb.js} +1 -1
- package/dist/{chunk-hc6111md.js → chunk-h4rjzbek.js} +4 -4
- package/dist/{chunk-w468n41y.js → chunk-hpfq5qe4.js} +18 -18
- package/dist/{chunk-xymr4ys9.js → chunk-jbgj2hph.js} +1 -1
- package/dist/{chunk-15m7jnc0.js → chunk-jwghpcqn.js} +1 -1
- package/dist/{chunk-x512h2gv.js → chunk-kh6njq2r.js} +2 -2
- package/dist/{chunk-jgra00m8.js → chunk-kh7hbgx6.js} +1 -1
- package/dist/{chunk-d0afg5f7.js → chunk-ma1tf68v.js} +1 -1
- package/dist/{chunk-wtfamngc.js → chunk-mrw6vmqy.js} +4 -4
- package/dist/{chunk-dtarm8x9.js → chunk-nack2xs5.js} +4 -4
- package/dist/{chunk-ntbe5q5x.js → chunk-ndez5ee8.js} +2 -2
- package/dist/{chunk-h816ta81.js → chunk-p8x0a0fp.js} +2 -2
- package/dist/{chunk-pyckafsb.js → chunk-pfs0gv2a.js} +1 -1
- package/dist/{chunk-gjngg182.js → chunk-pghp2tkv.js} +8 -8
- package/dist/{chunk-g4gcf4jn.js → chunk-ppfp1w98.js} +1 -1
- package/dist/{chunk-xcjvx6zt.js → chunk-ptxptv29.js} +1 -1
- package/dist/{chunk-021tjkd6.js → chunk-q22fpqtr.js} +1 -1
- package/dist/chunk-qcvfzskb.js +2 -0
- package/dist/{chunk-5zzrrxns.js → chunk-qjbjn6vz.js} +4 -4
- package/dist/{chunk-dpmayc2w.js → chunk-r0v2chpn.js} +2 -2
- package/dist/{chunk-b6w0f610.js → chunk-rme1a5qv.js} +19 -19
- package/dist/{chunk-669b2bya.js → chunk-rw5492e2.js} +3 -3
- package/dist/{chunk-czca8yds.js → chunk-sxdzpv90.js} +1 -1
- package/dist/{chunk-2n932qtv.js → chunk-syzggy76.js} +1 -1
- package/dist/{chunk-nttsc0aw.js → chunk-t2a6j64z.js} +5 -5
- package/dist/{chunk-qmkaqjba.js → chunk-t9r644tq.js} +1 -1
- package/dist/{chunk-x3p4emdp.js → chunk-tbq6msyc.js} +1 -1
- package/dist/chunk-v7jjrz5k.js +2 -0
- package/dist/{chunk-prrvggcy.js → chunk-vkj9fem6.js} +1 -1
- package/dist/chunk-w463vqkh.js +2 -0
- package/dist/{chunk-p0tkhd12.js → chunk-w8qr5414.js} +1 -1
- package/dist/{chunk-y036cwc7.js → chunk-wcvzsyf1.js} +2 -2
- package/dist/chunk-wxng15a3.js +2 -0
- package/dist/{chunk-yakdcak2.js → chunk-x5n2jc6m.js} +1 -1
- package/dist/{chunk-qbghf76y.js → chunk-x64afx6z.js} +2 -2
- package/dist/chunk-xsscsar3.js +3 -0
- package/dist/{chunk-r4v4vswq.js → chunk-y69k2fww.js} +1 -1
- package/dist/chunk-yrstc4z4.js +2 -0
- package/dist/chunk-z6c4c951.js +2 -0
- package/dist/{chunk-85zmxbt0.js → chunk-zdrn7wp0.js} +4 -4
- package/dist/cli.js +13 -13
- package/dist/client/signals-component-props-runtime.js +7 -1
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/native/floating-actions-web.d.ts +20 -0
- package/dist/native/floating-actions-web.js +177 -0
- package/dist/native/floating-actions.d.ts +8 -1
- package/dist/native/floating-actions.js +1 -1
- package/dist/native/primitives/FloatingActions.stx +22 -2
- package/dist/pwa.js +3 -3
- package/dist/site-builder/build.d.ts +6 -0
- package/dist/site-builder/build.js +13 -3
- package/dist/site-builder/types.d.ts +3 -0
- package/dist/ssg.js +4 -4
- package/package.json +5 -5
- package/dist/chunk-0bfgsv31.js +0 -2
- package/dist/chunk-36j129p1.js +0 -2
- package/dist/chunk-7mjf144y.js +0 -2
- package/dist/chunk-a4cn8rf4.js +0 -2
- package/dist/chunk-ap84eenm.js +0 -2
- package/dist/chunk-as2ffje6.js +0 -2
- package/dist/chunk-c0t2tdfk.js +0 -2
- package/dist/chunk-caxqwrnc.js +0 -2
- package/dist/chunk-d9vzfbdp.js +0 -2
- package/dist/chunk-e634vffz.js +0 -3
- package/dist/chunk-g65dptx2.js +0 -2
- package/dist/chunk-kw11yydy.js +0 -2
- package/dist/chunk-ns04v3am.js +0 -2
- package/dist/chunk-p2etn78y.js +0 -2
- package/dist/chunk-r23zq8yk.js +0 -2
- package/dist/chunk-rqmb09ss.js +0 -2
- package/dist/chunk-sz6d3v6b.js +0 -2
- package/dist/chunk-va07zs9v.js +0 -2
- package/dist/chunk-vc42mvjn.js +0 -2
- package/dist/chunk-xzdkjkyp.js +0 -2
- package/dist/chunk-ybkwnscv.js +0 -2
- package/dist/chunk-z3gz5fy4.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import c from"fs";import i from"path";import{createHash as k}from"crypto";var j=["pages","components","layouts","partials","composables"],w=new Set;function Nc(e){try{return w.has(c.realpathSync(e))}catch{return w.has(i.resolve(e))}}var _=new Set(["extends","root",...j.map((e)=>`${e}Dir`),"publicDir","stateDir","cachePath"]),x=(e)=>e!==null&&typeof e==="object"&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null);function b(e,n,r=""){if(Array.isArray(n))return["middleware","plugins"].includes(r)?[...Array.isArray(e)?e:[],...n]:[...n];if(!x(n))return n;let o={...x(e)?e:{}};for(let[s,a]of Object.entries(n)){if(["__proto__","constructor","prototype"].includes(s))throw Error(`Invalid layer config key: ${s}`);o[s]=b(o[s],a,s)}return o}function v(e){for(let n of["stx.config.ts","stx.config.js","stx.config.mjs",".config/stx.config.ts",".config/stx.ts","ui.config.ts"]){let r=i.join(e,n);if(c.existsSync(r))return c.realpathSync(r)}throw Error(`Application layer has no stx.config.ts: ${e}`)}function E(e,n,r){if(typeof e!=="string"||!e||/^(?:https?:|git[+:])/.test(e))throw Error(`Invalid application layer ${JSON.stringify(e)} in ${n}; use a local path or installed package`);if(e.startsWith(".")||i.isAbsolute(e)){let s=i.resolve(n,e);return c.statSync(s).isDirectory()?v(s):c.realpathSync(s)}let o=n;while(!0){let s=i.join(o,"node_modules",e),a=i.join(s,"package.json");if(c.existsSync(a)){r.add(c.realpathSync(a));let g=JSON.parse(c.readFileSync(a,"utf8"));return g.stx?.layer?c.realpathSync(i.resolve(s,g.stx.layer)):v(s)}let p=i.dirname(o);if(p===o)break;o=p}throw Error(`Cannot resolve application layer ${JSON.stringify(e)} from ${n}`)}async function C(e,n){let r=await Bun.build({entrypoints:[e],target:"bun",format:"esm",splitting:!1,plugins:[{name:"stx-layer-config",setup(a){a.onResolve({filter:/^[^./]/},(p)=>{if(p.path.startsWith("node:"))return{path:p.path,external:!0};return{path:Bun.resolveSync(p.path,p.resolveDir),external:!0}}),a.onLoad({filter:/./},(p)=>{let g=c.realpathSync(p.path);n.add(g),w.add(g);return})}}]});if(!r.success)throw Error(`Cannot load layer ${e}: ${r.logs.join(`
|
|
3
|
-
`)}`);let o=r.outputs.find((a)=>a.kind==="entry-point");if(!o||r.outputs.length!==1)throw Error(`Unsupported layer config output: ${e}`);let s=(await import(`data:text/javascript;base64,${Buffer.from(await o.text()).toString("base64")}`)).default;if(!x(s))throw Error(`Layer ${e} must default-export a config object`);return s}async function
|
|
4
|
-
`)}function
|
|
5
|
-
export{Nc,
|
|
3
|
+
`)}`);let o=r.outputs.find((a)=>a.kind==="entry-point");if(!o||r.outputs.length!==1)throw Error(`Unsupported layer config output: ${e}`);let s=(await import(`data:text/javascript;base64,${Buffer.from(await o.text()).toString("base64")}`)).default;if(!x(s))throw Error(`Layer ${e} must default-export a config object`);return s}async function Dc(e,n){let r=new Set,o=[],s=[],a=new Set,p=[];async function g(t,l){if(t=c.realpathSync(t),p.includes(t))throw Error(`Application layer cycle: ${[...p,t].join(" -> ")}`);if(a.has(t))return;a.add(t),p.push(t);let d=await C(t,r);l??=i.basename(i.dirname(t))===".config"?i.dirname(i.dirname(t)):i.dirname(t),l=c.realpathSync(l);let D=i.resolve(l,d.root??"."),L=Object.fromEntries(j.map((y)=>[y,i.resolve(D,d[`${y}Dir`]??(y==="composables"?"functions":y))]));o.push({root:l,configFile:t,resources:L});let u={...d};if(u.plugins)u.plugins=u.plugins.map((y)=>{let h=typeof y==="string"?y:y[0],S=h.startsWith(".")?i.resolve(l,h):i.isAbsolute(h)?h:Bun.resolveSync(h,l);return r.add(c.realpathSync(S)),typeof y==="string"?S:[S,y[1]]});if(typeof u.css==="string")u.css=i.resolve(l,u.css);if(u.serverApi)u.serverApi={...typeof u.serverApi==="object"?u.serverApi:{},dir:i.resolve(l,typeof u.serverApi==="object"?u.serverApi.dir??"server/api":"server/api")};if(s.push(u),d.extends!==void 0&&!Array.isArray(d.extends))throw Error(`extends in ${t} must be an array`);for(let y of d.extends??[])await g(E(y,l,r));p.pop()}await g(v(e),e);for(let t of["package.json","bun.lock","package-lock.json","pnpm-lock.yaml"]){let l=i.join(e,t);if(c.existsSync(l))r.add(c.realpathSync(l))}let f=b({},n);for(let t=s.length-1;t>=0;t--){let l=t===0?s[t]:Object.fromEntries(Object.entries(s[t]).filter(([d])=>!_.has(d)));f=b(f,l)}let m={layers:o,configDependencies:[...r].sort()};return f._layerGraph=m,f._layerPageDirs=o.map((t)=>t.resources.pages),f._layerComponentDirs=o.map((t)=>t.resources.components),f._layerLayoutDirs=o.map((t)=>t.resources.layouts),f._layerPartialDirs=o.map((t)=>t.resources.partials),f._layerComposableDirs=o.map((t)=>t.resources.composables),await oi(m,e),{config:f,graph:m}}async function oi(e,n){let r=new Map,o=[];for(let s of e.layers)for(let[a,p]of Object.entries(s.resources)){if(!c.existsSync(p))continue;let g=new Bun.Glob(a==="composables"?"**/*.ts":"**/*.stx");for(let f of[...g.scanSync({cwd:p})].sort()){let m=`${a}/${f}`,t=i.join(p,f),l=r.get(m);if(l)o.push({resource:m,winner:l,shadowed:t});else r.set(m,t)}}Object.assign(e,{overrides:o}),await Bun.write(i.join(n,".stx/layers.json"),JSON.stringify(e,null,2))}function A(e){let n=new Set(e.configDependencies);function r(o){if(!c.existsSync(o))return;n.add(o);for(let s of c.readdirSync(o,{withFileTypes:!0}).sort((a,p)=>a.name.localeCompare(p.name))){if(s.name.startsWith(".")||s.name==="node_modules")continue;let a=i.join(o,s.name);if(s.isDirectory())r(a);else if(s.isFile())n.add(a)}}for(let o of e.layers)for(let s of Object.values(o.resources))r(s);return[...n].sort()}function Rs(e){return O(A(e))}function As(e){return O(e.configDependencies)}function O(e){return e.map((n)=>{try{let r=c.statSync(n);return`${n}:${r.mtimeMs}:${r.size}`}catch{return`${n}:missing`}}).join(`
|
|
4
|
+
`)}function Mc(e){return e.layers.map((n)=>({config:i.relative(n.root,n.configFile),files:A({layers:[n],configDependencies:e.configDependencies.filter((r)=>r.startsWith(`${n.root}${i.sep}`))}).filter((r)=>c.statSync(r).isFile()).map((r)=>({path:i.relative(n.root,r).replaceAll(i.sep,"/"),sha256:k("sha256").update(c.readFileSync(r)).digest("hex")}))}))}
|
|
5
|
+
export{Nc,Dc,oi,Rs,As,Mc};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Tl,$l}from"./chunk-qjey0jk6.js";import{m,O,ut,p}from"./chunk-qa5y30sy.js";import{K,_r,Fs,zs,fi,mi,Hs,Lt,Be,ye,Q,Tr,$r,de,ee,L,ct,Rr,wi,Ir,We,s,g,G,En}from"./chunk-b6w0f610.js";import{n}from"./chunk-e634vffz.js";import{le}from"./chunk-xymr4ys9.js";import{pr}from"./chunk-01c16zw4.js";import{r}from"./chunk-x7redxyd.js";import{b}from"./chunk-94mpe1ny.js";import{createHash as kt}from"crypto";import Y from"fs";import Z from"path";import Le from"fs";function Ae(e,i,t){let o=Buffer.alloc(t),a=Le.readSync(e,o,0,t,i);return o.subarray(0,a)}function ze(e){if(e.length<25)return!1;let i=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(i(0,4)!=="RIFF"||i(8,12)!=="WEBP")return!1;let t=i(12,16);if(t==="VP8X")return(e[20]&16)!==0;if(t==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Ue(e){let i;try{i=Le.openSync(e,"r");let t=Ae(i,0,33);if(t.length>=3&&t[0]===255&&t[1]===216&&t[2]===255)return"none";if(t.length>=26&&t[0]===137&&t.toString("latin1",1,4)==="PNG"){let o=t[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ae(i,a,8);if(l.length<8)return"unknown";let u=l.toString("latin1",4,8);if(u==="tRNS")return"possible";if(u==="IDAT"||u==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(t.length>=25&&t.toString("latin1",0,4)==="RIFF"&&t.toString("latin1",8,12)==="WEBP"){if(ze(t))return"possible";let o=t.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(i!==void 0)Le.closeSync(i)}}import rn from"fs";import Fe from"os";import{fileURLToPath as yt}from"url";var _e=Symbol("stx.image-worker.unavailable");function sn(e=typeof Fe.availableParallelism==="function"?Fe.availableParallelism():Fe.cpus().length){return Math.max(1,Math.min(2,e-1))}var Pe=0,xt=[];async function on(){if(Pe<sn()){Pe++;return}await new Promise((e)=>xt.push(e)),Pe++}function an(){Pe--,xt.shift()?.()}var cn="@stacksjs/stx/builtins/image-warmup-worker";function ln(e=process.cwd()){let i=import.meta.url.endsWith(".ts")?"ts":"js";try{let t=new URL(`./image-warmup-worker.${i}`,import.meta.url);if(t.protocol==="file:"&&rn.existsSync(yt(t)))return yt(t)}catch{}return pr(cn,e)}var bt=!1;function fe(e){if(!bt)bt=!0,console.warn(`[stx] image worker unavailable (${e}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return _e}function Ie(e){return e instanceof Error?e.message:String(e)}async function He(e,i){let t;try{t=(await import("worker_threads")).Worker}catch(a){return fe(`could not load node:worker_threads: ${Ie(a)}`)}if(typeof t!=="function")return fe("node:worker_threads has no Worker in this runtime");let o=ln();if(!o)return fe("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await on();try{return await new Promise((a,c)=>{let l;try{l=new t(o)}catch(h){a(fe(`could not start ${o}: ${Ie(h)}`));return}let u=!1,f=!1,x=(h)=>{if(f)return;f=!0,h(),l.terminate()};l.on("message",(h)=>{if(h.type==="ready"){u=!0,l.postMessage({task:e,args:i});return}if(h.type==="result"){x(()=>a(h.value));return}let d=Error(h.error?.message??"image worker failed");if(h.error?.name)d.name=h.error.name;if(h.error?.stack)d.stack=h.error.stack;x(()=>c(d))}),l.on("error",(h)=>{x(()=>u?c(h instanceof Error?h:Error(Ie(h)||"image worker crashed")):a(fe(`the worker failed before it was ready: ${Ie(h)}`)))}),l.on("exit",(h)=>{x(()=>u?c(Error("image worker exited before it finished")):a(fe(`the worker exited with code ${h} before it was ready`)))})})}finally{an()}}var un=new Set([".avif",".jpeg",".jpg",".png",".webp"]),fn=[320,640,960,1280,1920],ve="/_stx/images",dn=`stx:${ve}:alpha-1`,gn=`stx:${ve}:opaque-1`,pn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Ee;function mn(e,i){let t=Z.dirname(Bun.resolveSync(e,i));while(t!==Z.dirname(t)){let o=Z.join(t,"package.json");if(Y.existsSync(o)){let a=JSON.parse(Y.readFileSync(o,"utf8"));if(a.name===e)return a.version}t=Z.dirname(t)}return}function vt(){if(Ee!==void 0)return Ee;let e;try{e=Z.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Ee=pn.map((i)=>{let t;try{t=e?mn(i,e):void 0}catch{}return`${i.replace("@stacksjs/","")}@${t??"unknown"}`}).join("+"),Ee}var wt=Symbol.for("stx.image-delivery");function we(){let e=globalThis;return e[wt]??={catalog:new Map,transparent:new Set},e[wt]}var $t=new Set;function hn(e){return`/${e.split(Z.sep).map(encodeURIComponent).join("/")}`}function yn(e){let i=Z.extname(e),t=e.slice(0,-i.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=kt("sha256").update(e).digest("hex").slice(0,8);return`${t||"image"}-${o}`}function St(e,i=`stx:${ve}`){let t=(o)=>`${ve}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:i,async stat(o){let a=Z.join(e,o);try{let c=await Y.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:t(o)}:null}catch{return null}},async write(o,a){let c=Z.join(e,o);await Y.promises.mkdir(Z.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await Y.promises.writeFile(l,a),await Y.promises.rename(l,c),{bytes:a.byteLength,path:c,url:t(o)}},url:t}}async function At(e,i=e){let t=await Y.promises.readdir(i,{withFileTypes:!0});t.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of t){let c=Z.join(i,a.name);if(a.isDirectory()){o.push(...await At(e,c));continue}if(!a.isFile()||!un.has(Z.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:Z.relative(e,c)})}return o}function Ct(e,i){return e.map((t)=>({key:hn(t.relativePath),input:t.absolutePath,name:yn(t.relativePath),...bn(t.absolutePath)?{options:{storage:i}}:{}}))}function bn(e){return Ue(e)==="possible"}function xn(e){for(let i=3;i<e.length;i+=4)if(e[i]!==255)return!0;return!1}async function vn(e){let i=Object.entries(e).filter(([,c])=>c.fallback.format==="png"),t=new Set,o=8;if(i.length===0)return t;let{decode:a}=await import("ts-images");for(let c=0;c<i.length;c+=8)await Promise.all(i.slice(c,c+8).map(async([l,u])=>{let f=u.variants.filter((x)=>x.format==="png").sort((x,h)=>x.width-h.width)[0];try{let x=await a(new Uint8Array(await Y.promises.readFile(f?.path??u.fallback.path)));if(xn(x.data))t.add(l)}catch{t.add(l)}}));return t}function wn(e,i){let t=[];for(let o of i){let a=e[o],c=a?.variants.filter((u)=>u.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((u)=>{let f;try{return f=Y.openSync(u.path,"r"),!ze(Ae(f,0,32))}catch{return!0}finally{if(f!==void 0)Y.closeSync(f)}}))continue;if(a.variants=a.variants.filter((u)=>u.format!=="webp"),delete a.sources.webp,t.push(o),!$t.has(o))$t.add(o),console.warn(`[stx-images] ${o} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return t}async function $n(e){let i=[],t=8;if(e.length===0)return i;let{generateThumbHash:o}=await import("ts-images");for(let a=0;a<e.length;a+=8){let c=e.slice(a,a+8),l=await Promise.all(c.map(async(u)=>{try{return await o(u.absolutePath),u}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${u.relativePath}`),null}}));i.push(...l.filter((u)=>u!==null))}return i}function qe(e){return Z.join(e,"undecodable.json")}function Sn(e){try{let i=Y.readFileSync(qe(e),"utf-8"),t=JSON.parse(i);return t&&typeof t==="object"?t:{}}catch{return{}}}function Cn(e,i){try{Y.mkdirSync(Z.dirname(qe(e)),{recursive:!0}),Y.writeFileSync(qe(e),JSON.stringify(i))}catch{}}function Rt(e){try{let i=Y.statSync(e);return{mtimeMs:i.mtimeMs,size:i.size}}catch{return}}function It(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let i=e.split(/[?#]/,1)[0];if(!i)return;try{return`/${i.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function Uo(e){let i=It(e);return i?we().catalog.get(i):void 0}function Wo(e){let i=It(e);return i?we().transparent.has(i):!1}function qo(e){let i=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),t=i(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:i(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<t).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function Gh(e){let i=Uo(e);if(!i)return;return{src:i.fallback.url,srcset:i.sources[i.fallback.format]||"",sources:qo(i).map(({format:t,srcset:o})=>({type:`image/${t}`,srcset:o})),width:i.source.width,height:i.source.height,placeholder:Wo(e)?void 0:i.placeholder?.dataUrl}}function ys(){let e=we();e.catalog=new Map,e.transparent=new Set}function Rn(e){let i=we();i.catalog=new Map(e.entries),i.transparent=new Set(e.transparent)}async function Xh(e,i,t={}){if(!e||!Y.existsSync(e))return ys(),{count:0,fingerprint:""};if(t.offThread){let y=await He("delivery",{publicDir:e,outputDir:i});if(y!==_e)return Rn(y.state),y.result}let o=await At(e);if(o.length===0)return ys(),{count:0,fingerprint:""};let a=Sn(i),c=o.filter((y)=>{let w=a[y.relativePath];if(!w)return!0;let A=Rt(y.absolutePath);return!A||A.mtimeMs!==w.mtimeMs||A.size!==w.size});if(c.length===0)return ys(),{count:0,fingerprint:""};let l=St(Z.join(i,"_stx","images"),`${dn}:${vt()}`),u={outDir:Z.join(i,"_stx","images"),storage:St(Z.join(i,"_stx","images"),`${gn}:${vt()}`),baseUrl:ve,widths:fn,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},{createImageDeliveryCatalog:f}=await import("ts-images/delivery"),x=c,h;try{h=await f({...u,entries:Ct(c,l)})}catch(y){if(x=await $n(c),x.length===c.length)throw y;let w=new Set(x.map((k)=>k.relativePath)),A=!1;for(let k of c){if(w.has(k.relativePath))continue;let R=Rt(k.absolutePath);if(!R)continue;a[k.relativePath]=R,A=!0}if(A)Cn(i,a);if(x.length===0)return ys(),{count:0,fingerprint:""};h=await f({...u,entries:Ct(x,l)})}let d=await vn(h.entries),C=wn(h.entries,d),v=we();v.catalog=new Map(Object.entries(h.entries)),v.transparent=d;let S=d.size===0&&C.length===0?h.fingerprint:kt("sha256").update(h.fingerprint).update(JSON.stringify({transparent:[...d].sort(),droppedWebp:C.sort()})).digest("hex");return{count:x.length,fingerprint:S}}class Pt{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let i of e.aliases)this.builtins.set(i.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,i,t,o){let a=fi(e,o);if(a!==void 0)return a;for(let c of mi(e,i,t,o))if(await s(c))return c;return null}}var ge=new Pt;var se="\x00stx-boolean-attribute";function Xe(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var kn=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function Ve(e){let i=e.toLowerCase();return i.startsWith("aria-")||i.startsWith("data-")||kn.has(i)}function ie(e,i){let t=[];for(let[o,a]of Object.entries(e.static)){if(i.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)t.push(g(c));continue}if(a===se){t.push(g(c));continue}t.push(`${g(c)}="${En(c,Xe(String(a)))}"`)}return t}function oe(e,i){let t=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(i.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){t.push(g(c));continue}if(typeof a==="object")continue;t.push(`${g(c)}="${En(c,Xe(String(a)))}"`)}return t}function An(e){if(e.clientReactive.to)return{value:e.clientReactive.to,reactive:!0};if(e.serverDynamic.to!==void 0)return{value:String(e.serverDynamic.to),reactive:!1};if(typeof e.static.to==="string")return{value:e.static.to,reactive:!1};return{value:"#",reactive:!1}}var Ze={name:"StxLink",aliases:["stx-link"],render(e,i,t){let o=An(e),a=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),c=typeof e.static.activeClass==="string"?e.static.activeClass:"active",l=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",u=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,f=[];if(o.reactive)f.push(`:href="${n(o.value)}"`);else f.push(`href="${n(Tr(o.value,"navigable"))}"`);if(a)f.push(`class="${n(a)}"`);if(f.push("data-stx-link"),f.push(`data-stx-active-class="${n(c)}"`),f.push(`data-stx-exact-active-class="${n(l)}"`),u)f.push("data-stx-prefetch");let x=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(x)f.push(`data-stx-active-match="${n(x)}"`);let h=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return f.push(...ie(e,h)),f.push(...oe(e,h)),`<a ${f.join(" ")}>${i}</a>`}};var In=new Map;function Ge(e){if(!e)return;let i=e.split("?")[0].split("#")[0];return In.get(i)}var Pn={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Ke=[320,640,768,1024,1280,1536,1920];function H(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let t=e.static[i];if(typeof t==="string")return t;return}function Ne(e,i,t=!1){let o=e.serverDynamic[i];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[i];if(a!==void 0)return a!=="false"&&a!==!1;return t}function Je(e){if(e.includes("(")||e.includes(","))return e;let i=e.trim().split(/\s+/),t=[];for(let o of i)if(o.includes(":")){let[a,c]=o.split(":"),l=Pn[a];if(l)t.push(`(max-width: ${l}px) ${c}`);else{let u=Number.parseInt(a);if(!Number.isNaN(u))t.push(`(max-width: ${u}px) ${c}`)}}else t.push(o);return t.join(", ")}function Ye(e,i,t,o){return i.map((a)=>`${$e(e,a,void 0,t,o)} ${a}w`).join(", ")}function _n(e,i,t,o,a){return i.map((c)=>{let l=t?t*c:void 0;return`${$e(e,l,void 0,o,a)} ${c}x`}).join(", ")}function $e(e,i,t,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(i)c.push(`w_${i}`);if(t)c.push(`h_${t}`);if(a)c.push(`f_${a}`);c.push("q_auto");let l=c.join(",");return e.replace("/upload/",`/upload/${l}/`)}if(o==="imgix"){let c=new URLSearchParams;if(i)c.set("w",String(i));if(t)c.set("h",String(t));if(a)c.set("fm",a);c.set("auto","format");let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}if(o==="bunny"){let c=new URLSearchParams;if(i)c.set("width",String(i));if(t)c.set("height",String(t));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function Nn(e){return`var s=this.style;${e.map((i)=>`s.${i}=''`).join(";")}`}function On(e,i,t="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${i}"><rect width="100%" height="100%" fill="${t}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var Qe={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,i,t){let o=H(e,"src")||"",a=Uo(o),c=H(e,"alt")||"",l=H(e,"width")||(a?String(a.source.width):void 0),u=H(e,"height")||(a?String(a.source.height):void 0),f=H(e,"sizes"),x=H(e,"srcset"),h=H(e,"densities"),d=H(e,"format"),C=Wo(o)||Ge(o)?.transparent===!0,v=H(e,"placeholder")||(a&&!C?"thumbhash":void 0),S=H(e,"placeholderColor")||"#e5e7eb",y=H(e,"provider"),w=H(e,"class")||H(e,"className")||"",A=H(e,"style")||"",k=H(e,"objectFit")||H(e,"fit"),R=H(e,"objectPosition")||H(e,"position"),E=H(e,"quality"),J=Ne(e,"lazy",!0),M=Ne(e,"preload",!1),U=Ne(e,"priority",!1),z=H(e,"loading"),N=H(e,"decoding")||"async",q=!!a||Ne(e,"picture",!1)||!!d,I=l?Number.parseInt(l):void 0,_=u?Number.parseInt(u):void 0,T=x||"",F="";if(a)T=a.sources[a.fallback.format]||"",F=f?Je(f):"100vw";else if(!T&&f&&y&&y!=="local"&&y!=="static")T=Ye(o,Ke,y,d),F=Je(f);else if(!T&&h){let V=h.split(/\s+/).map((P)=>Number.parseFloat(P.replace("x","")));T=_n(o,V,I,y,d)}else if(f)F=Je(f);let D=[];if(A)D.push(A);if(k)D.push(`object-fit:${k}`);if(R)D.push(`object-position:${R}`);if(I&&_)D.push(`aspect-ratio:${I}/${_}`);let re=[],ae=v==="blur"||v==="color"||v==="thumbhash";if(ae&&!C){let V=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:S}:Ge(o);if(V&&v==="color")D.push(`background-color:${V.color}`),re.push("backgroundColor");else if(V)D.push(`background-color:${V.color}`),D.push(`background-image:url(${V.dataUrl})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),re.push("backgroundColor","backgroundImage");else{let P=On(I||16,_||9,S);D.push(`background-image:url(${P})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),re.push("backgroundImage")}}else if(!ae&&v&&v!=="empty"&&v!=="none")D.push(`background-image:url(${n(v)})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),re.push("backgroundImage");let j=a?.fallback.url||$e(o,I,_,y,d),X=[];if(X.push(`src="${n(Tr(j,"fetched"))}"`),X.push(`alt="${n(c)}"`),l)X.push(`width="${n(l)}"`);if(u)X.push(`height="${n(u)}"`);let Re=z||(U||M?"eager":J?"lazy":"");if(Re)X.push(`loading="${n(Re)}"`);if(U)X.push('fetchpriority="high"');if(X.push(`decoding="${n(N)}"`),w)X.push(`class="${n(w)}"`);if(D.length>0)X.push(`style="${n(D.join(";"))}"`);if(T)X.push(`srcset="${n(Tr(T,"fetched"))}"`);if(F)X.push(`sizes="${n(F)}"`);let xe=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","objectFit","objectPosition","fit","position","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(re.length>0){let V=typeof e.static.onload==="string"?e.static.onload:"",P=Nn(re)+(V?`;${V}`:"");X.push(`onload="${n(P)}"`),xe.add("onload")}X.push(...ie(e,xe)),X.push(...oe(e,xe));let ue=`<img ${X.join(" ")} />`,te="";if(M){let P=d==="webp"?"image/webp":d==="avif"?"image/avif":"";te=`<link rel="preload" as="image" href="${n(j)}"${P?` type="${P}"`:""}${T?` imagesrcset="${n(T)}"`:""}${F?` imagesizes="${n(F)}"`:""} />
|
|
2
|
+
import{Tl,$l}from"./chunk-qjey0jk6.js";import{m,O,ut,p}from"./chunk-g0xn80gz.js";import{K,_r,Fs,zs,fi,mi,Hs,Lt,Be,ye,Q,Tr,$r,de,ee,L,ct,Rr,wi,Ir,We,s,g,G,En}from"./chunk-rme1a5qv.js";import{n}from"./chunk-xsscsar3.js";import{le}from"./chunk-jbgj2hph.js";import{pr}from"./chunk-01c16zw4.js";import{r}from"./chunk-x7redxyd.js";import{b}from"./chunk-94mpe1ny.js";import{createHash as kt}from"crypto";import Y from"fs";import Z from"path";import Le from"fs";function Ae(e,i,t){let o=Buffer.alloc(t),a=Le.readSync(e,o,0,t,i);return o.subarray(0,a)}function ze(e){if(e.length<25)return!1;let i=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(i(0,4)!=="RIFF"||i(8,12)!=="WEBP")return!1;let t=i(12,16);if(t==="VP8X")return(e[20]&16)!==0;if(t==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Ue(e){let i;try{i=Le.openSync(e,"r");let t=Ae(i,0,33);if(t.length>=3&&t[0]===255&&t[1]===216&&t[2]===255)return"none";if(t.length>=26&&t[0]===137&&t.toString("latin1",1,4)==="PNG"){let o=t[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ae(i,a,8);if(l.length<8)return"unknown";let u=l.toString("latin1",4,8);if(u==="tRNS")return"possible";if(u==="IDAT"||u==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(t.length>=25&&t.toString("latin1",0,4)==="RIFF"&&t.toString("latin1",8,12)==="WEBP"){if(ze(t))return"possible";let o=t.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(i!==void 0)Le.closeSync(i)}}import rn from"fs";import Fe from"os";import{fileURLToPath as yt}from"url";var _e=Symbol("stx.image-worker.unavailable");function sn(e=typeof Fe.availableParallelism==="function"?Fe.availableParallelism():Fe.cpus().length){return Math.max(1,Math.min(2,e-1))}var Pe=0,xt=[];async function on(){if(Pe<sn()){Pe++;return}await new Promise((e)=>xt.push(e)),Pe++}function an(){Pe--,xt.shift()?.()}var cn="@stacksjs/stx/builtins/image-warmup-worker";function ln(e=process.cwd()){let i=import.meta.url.endsWith(".ts")?"ts":"js";try{let t=new URL(`./image-warmup-worker.${i}`,import.meta.url);if(t.protocol==="file:"&&rn.existsSync(yt(t)))return yt(t)}catch{}return pr(cn,e)}var bt=!1;function fe(e){if(!bt)bt=!0,console.warn(`[stx] image worker unavailable (${e}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return _e}function Ie(e){return e instanceof Error?e.message:String(e)}async function He(e,i){let t;try{t=(await import("worker_threads")).Worker}catch(a){return fe(`could not load node:worker_threads: ${Ie(a)}`)}if(typeof t!=="function")return fe("node:worker_threads has no Worker in this runtime");let o=ln();if(!o)return fe("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await on();try{return await new Promise((a,c)=>{let l;try{l=new t(o)}catch(h){a(fe(`could not start ${o}: ${Ie(h)}`));return}let u=!1,f=!1,x=(h)=>{if(f)return;f=!0,h(),l.terminate()};l.on("message",(h)=>{if(h.type==="ready"){u=!0,l.postMessage({task:e,args:i});return}if(h.type==="result"){x(()=>a(h.value));return}let d=Error(h.error?.message??"image worker failed");if(h.error?.name)d.name=h.error.name;if(h.error?.stack)d.stack=h.error.stack;x(()=>c(d))}),l.on("error",(h)=>{x(()=>u?c(h instanceof Error?h:Error(Ie(h)||"image worker crashed")):a(fe(`the worker failed before it was ready: ${Ie(h)}`)))}),l.on("exit",(h)=>{x(()=>u?c(Error("image worker exited before it finished")):a(fe(`the worker exited with code ${h} before it was ready`)))})})}finally{an()}}var un=new Set([".avif",".jpeg",".jpg",".png",".webp"]),fn=[320,640,960,1280,1920],ve="/_stx/images",dn=`stx:${ve}:alpha-1`,gn=`stx:${ve}:opaque-1`,pn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Ee;function mn(e,i){let t=Z.dirname(Bun.resolveSync(e,i));while(t!==Z.dirname(t)){let o=Z.join(t,"package.json");if(Y.existsSync(o)){let a=JSON.parse(Y.readFileSync(o,"utf8"));if(a.name===e)return a.version}t=Z.dirname(t)}return}function vt(){if(Ee!==void 0)return Ee;let e;try{e=Z.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Ee=pn.map((i)=>{let t;try{t=e?mn(i,e):void 0}catch{}return`${i.replace("@stacksjs/","")}@${t??"unknown"}`}).join("+"),Ee}var wt=Symbol.for("stx.image-delivery");function we(){let e=globalThis;return e[wt]??={catalog:new Map,transparent:new Set},e[wt]}var $t=new Set;function hn(e){return`/${e.split(Z.sep).map(encodeURIComponent).join("/")}`}function yn(e){let i=Z.extname(e),t=e.slice(0,-i.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=kt("sha256").update(e).digest("hex").slice(0,8);return`${t||"image"}-${o}`}function St(e,i=`stx:${ve}`){let t=(o)=>`${ve}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:i,async stat(o){let a=Z.join(e,o);try{let c=await Y.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:t(o)}:null}catch{return null}},async write(o,a){let c=Z.join(e,o);await Y.promises.mkdir(Z.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await Y.promises.writeFile(l,a),await Y.promises.rename(l,c),{bytes:a.byteLength,path:c,url:t(o)}},url:t}}async function At(e,i=e){let t=await Y.promises.readdir(i,{withFileTypes:!0});t.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of t){let c=Z.join(i,a.name);if(a.isDirectory()){o.push(...await At(e,c));continue}if(!a.isFile()||!un.has(Z.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:Z.relative(e,c)})}return o}function Ct(e,i){return e.map((t)=>({key:hn(t.relativePath),input:t.absolutePath,name:yn(t.relativePath),...bn(t.absolutePath)?{options:{storage:i}}:{}}))}function bn(e){return Ue(e)==="possible"}function xn(e){for(let i=3;i<e.length;i+=4)if(e[i]!==255)return!0;return!1}async function vn(e){let i=Object.entries(e).filter(([,c])=>c.fallback.format==="png"),t=new Set,o=8;if(i.length===0)return t;let{decode:a}=await import("ts-images");for(let c=0;c<i.length;c+=8)await Promise.all(i.slice(c,c+8).map(async([l,u])=>{let f=u.variants.filter((x)=>x.format==="png").sort((x,h)=>x.width-h.width)[0];try{let x=await a(new Uint8Array(await Y.promises.readFile(f?.path??u.fallback.path)));if(xn(x.data))t.add(l)}catch{t.add(l)}}));return t}function wn(e,i){let t=[];for(let o of i){let a=e[o],c=a?.variants.filter((u)=>u.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((u)=>{let f;try{return f=Y.openSync(u.path,"r"),!ze(Ae(f,0,32))}catch{return!0}finally{if(f!==void 0)Y.closeSync(f)}}))continue;if(a.variants=a.variants.filter((u)=>u.format!=="webp"),delete a.sources.webp,t.push(o),!$t.has(o))$t.add(o),console.warn(`[stx-images] ${o} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return t}async function $n(e){let i=[],t=8;if(e.length===0)return i;let{generateThumbHash:o}=await import("ts-images");for(let a=0;a<e.length;a+=8){let c=e.slice(a,a+8),l=await Promise.all(c.map(async(u)=>{try{return await o(u.absolutePath),u}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${u.relativePath}`),null}}));i.push(...l.filter((u)=>u!==null))}return i}function qe(e){return Z.join(e,"undecodable.json")}function Sn(e){try{let i=Y.readFileSync(qe(e),"utf-8"),t=JSON.parse(i);return t&&typeof t==="object"?t:{}}catch{return{}}}function Cn(e,i){try{Y.mkdirSync(Z.dirname(qe(e)),{recursive:!0}),Y.writeFileSync(qe(e),JSON.stringify(i))}catch{}}function Rt(e){try{let i=Y.statSync(e);return{mtimeMs:i.mtimeMs,size:i.size}}catch{return}}function It(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let i=e.split(/[?#]/,1)[0];if(!i)return;try{return`/${i.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function Uo(e){let i=It(e);return i?we().catalog.get(i):void 0}function Wo(e){let i=It(e);return i?we().transparent.has(i):!1}function qo(e){let i=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),t=i(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:i(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<t).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function Gh(e){let i=Uo(e);if(!i)return;return{src:i.fallback.url,srcset:i.sources[i.fallback.format]||"",sources:qo(i).map(({format:t,srcset:o})=>({type:`image/${t}`,srcset:o})),width:i.source.width,height:i.source.height,placeholder:Wo(e)?void 0:i.placeholder?.dataUrl}}function ys(){let e=we();e.catalog=new Map,e.transparent=new Set}function Rn(e){let i=we();i.catalog=new Map(e.entries),i.transparent=new Set(e.transparent)}async function Xh(e,i,t={}){if(!e||!Y.existsSync(e))return ys(),{count:0,fingerprint:""};if(t.offThread){let y=await He("delivery",{publicDir:e,outputDir:i});if(y!==_e)return Rn(y.state),y.result}let o=await At(e);if(o.length===0)return ys(),{count:0,fingerprint:""};let a=Sn(i),c=o.filter((y)=>{let w=a[y.relativePath];if(!w)return!0;let A=Rt(y.absolutePath);return!A||A.mtimeMs!==w.mtimeMs||A.size!==w.size});if(c.length===0)return ys(),{count:0,fingerprint:""};let l=St(Z.join(i,"_stx","images"),`${dn}:${vt()}`),u={outDir:Z.join(i,"_stx","images"),storage:St(Z.join(i,"_stx","images"),`${gn}:${vt()}`),baseUrl:ve,widths:fn,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},{createImageDeliveryCatalog:f}=await import("ts-images/delivery"),x=c,h;try{h=await f({...u,entries:Ct(c,l)})}catch(y){if(x=await $n(c),x.length===c.length)throw y;let w=new Set(x.map((k)=>k.relativePath)),A=!1;for(let k of c){if(w.has(k.relativePath))continue;let R=Rt(k.absolutePath);if(!R)continue;a[k.relativePath]=R,A=!0}if(A)Cn(i,a);if(x.length===0)return ys(),{count:0,fingerprint:""};h=await f({...u,entries:Ct(x,l)})}let d=await vn(h.entries),C=wn(h.entries,d),v=we();v.catalog=new Map(Object.entries(h.entries)),v.transparent=d;let S=d.size===0&&C.length===0?h.fingerprint:kt("sha256").update(h.fingerprint).update(JSON.stringify({transparent:[...d].sort(),droppedWebp:C.sort()})).digest("hex");return{count:x.length,fingerprint:S}}class Pt{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let i of e.aliases)this.builtins.set(i.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,i,t,o){let a=fi(e,o);if(a!==void 0)return a;for(let c of mi(e,i,t,o))if(await s(c))return c;return null}}var ge=new Pt;var se="\x00stx-boolean-attribute";function Xe(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var kn=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function Ve(e){let i=e.toLowerCase();return i.startsWith("aria-")||i.startsWith("data-")||kn.has(i)}function ie(e,i){let t=[];for(let[o,a]of Object.entries(e.static)){if(i.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)t.push(g(c));continue}if(a===se){t.push(g(c));continue}t.push(`${g(c)}="${En(c,Xe(String(a)))}"`)}return t}function oe(e,i){let t=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(i.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){t.push(g(c));continue}if(typeof a==="object")continue;t.push(`${g(c)}="${En(c,Xe(String(a)))}"`)}return t}function An(e){if(e.clientReactive.to)return{value:e.clientReactive.to,reactive:!0};if(e.serverDynamic.to!==void 0)return{value:String(e.serverDynamic.to),reactive:!1};if(typeof e.static.to==="string")return{value:e.static.to,reactive:!1};return{value:"#",reactive:!1}}var Ze={name:"StxLink",aliases:["stx-link"],render(e,i,t){let o=An(e),a=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),c=typeof e.static.activeClass==="string"?e.static.activeClass:"active",l=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",u=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,f=[];if(o.reactive)f.push(`:href="${n(o.value)}"`);else f.push(`href="${n(Tr(o.value,"navigable"))}"`);if(a)f.push(`class="${n(a)}"`);if(f.push("data-stx-link"),f.push(`data-stx-active-class="${n(c)}"`),f.push(`data-stx-exact-active-class="${n(l)}"`),u)f.push("data-stx-prefetch");let x=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(x)f.push(`data-stx-active-match="${n(x)}"`);let h=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return f.push(...ie(e,h)),f.push(...oe(e,h)),`<a ${f.join(" ")}>${i}</a>`}};var In=new Map;function Ge(e){if(!e)return;let i=e.split("?")[0].split("#")[0];return In.get(i)}var Pn={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Ke=[320,640,768,1024,1280,1536,1920];function H(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let t=e.static[i];if(typeof t==="string")return t;return}function Ne(e,i,t=!1){let o=e.serverDynamic[i];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[i];if(a!==void 0)return a!=="false"&&a!==!1;return t}function Je(e){if(e.includes("(")||e.includes(","))return e;let i=e.trim().split(/\s+/),t=[];for(let o of i)if(o.includes(":")){let[a,c]=o.split(":"),l=Pn[a];if(l)t.push(`(max-width: ${l}px) ${c}`);else{let u=Number.parseInt(a);if(!Number.isNaN(u))t.push(`(max-width: ${u}px) ${c}`)}}else t.push(o);return t.join(", ")}function Ye(e,i,t,o){return i.map((a)=>`${$e(e,a,void 0,t,o)} ${a}w`).join(", ")}function _n(e,i,t,o,a){return i.map((c)=>{let l=t?t*c:void 0;return`${$e(e,l,void 0,o,a)} ${c}x`}).join(", ")}function $e(e,i,t,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(i)c.push(`w_${i}`);if(t)c.push(`h_${t}`);if(a)c.push(`f_${a}`);c.push("q_auto");let l=c.join(",");return e.replace("/upload/",`/upload/${l}/`)}if(o==="imgix"){let c=new URLSearchParams;if(i)c.set("w",String(i));if(t)c.set("h",String(t));if(a)c.set("fm",a);c.set("auto","format");let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}if(o==="bunny"){let c=new URLSearchParams;if(i)c.set("width",String(i));if(t)c.set("height",String(t));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function Nn(e){return`var s=this.style;${e.map((i)=>`s.${i}=''`).join(";")}`}function On(e,i,t="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${i}"><rect width="100%" height="100%" fill="${t}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var Qe={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,i,t){let o=H(e,"src")||"",a=Uo(o),c=H(e,"alt")||"",l=H(e,"width")||(a?String(a.source.width):void 0),u=H(e,"height")||(a?String(a.source.height):void 0),f=H(e,"sizes"),x=H(e,"srcset"),h=H(e,"densities"),d=H(e,"format"),C=Wo(o)||Ge(o)?.transparent===!0,v=H(e,"placeholder")||(a&&!C?"thumbhash":void 0),S=H(e,"placeholderColor")||"#e5e7eb",y=H(e,"provider"),w=H(e,"class")||H(e,"className")||"",A=H(e,"style")||"",k=H(e,"objectFit")||H(e,"fit"),R=H(e,"objectPosition")||H(e,"position"),E=H(e,"quality"),J=Ne(e,"lazy",!0),M=Ne(e,"preload",!1),U=Ne(e,"priority",!1),z=H(e,"loading"),N=H(e,"decoding")||"async",q=!!a||Ne(e,"picture",!1)||!!d,I=l?Number.parseInt(l):void 0,_=u?Number.parseInt(u):void 0,T=x||"",F="";if(a)T=a.sources[a.fallback.format]||"",F=f?Je(f):"100vw";else if(!T&&f&&y&&y!=="local"&&y!=="static")T=Ye(o,Ke,y,d),F=Je(f);else if(!T&&h){let V=h.split(/\s+/).map((P)=>Number.parseFloat(P.replace("x","")));T=_n(o,V,I,y,d)}else if(f)F=Je(f);let D=[];if(A)D.push(A);if(k)D.push(`object-fit:${k}`);if(R)D.push(`object-position:${R}`);if(I&&_)D.push(`aspect-ratio:${I}/${_}`);let re=[],ae=v==="blur"||v==="color"||v==="thumbhash";if(ae&&!C){let V=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:S}:Ge(o);if(V&&v==="color")D.push(`background-color:${V.color}`),re.push("backgroundColor");else if(V)D.push(`background-color:${V.color}`),D.push(`background-image:url(${V.dataUrl})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),re.push("backgroundColor","backgroundImage");else{let P=On(I||16,_||9,S);D.push(`background-image:url(${P})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),re.push("backgroundImage")}}else if(!ae&&v&&v!=="empty"&&v!=="none")D.push(`background-image:url(${n(v)})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),re.push("backgroundImage");let j=a?.fallback.url||$e(o,I,_,y,d),X=[];if(X.push(`src="${n(Tr(j,"fetched"))}"`),X.push(`alt="${n(c)}"`),l)X.push(`width="${n(l)}"`);if(u)X.push(`height="${n(u)}"`);let Re=z||(U||M?"eager":J?"lazy":"");if(Re)X.push(`loading="${n(Re)}"`);if(U)X.push('fetchpriority="high"');if(X.push(`decoding="${n(N)}"`),w)X.push(`class="${n(w)}"`);if(D.length>0)X.push(`style="${n(D.join(";"))}"`);if(T)X.push(`srcset="${n(Tr(T,"fetched"))}"`);if(F)X.push(`sizes="${n(F)}"`);let xe=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","objectFit","objectPosition","fit","position","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(re.length>0){let V=typeof e.static.onload==="string"?e.static.onload:"",P=Nn(re)+(V?`;${V}`:"");X.push(`onload="${n(P)}"`),xe.add("onload")}X.push(...ie(e,xe)),X.push(...oe(e,xe));let ue=`<img ${X.join(" ")} />`,te="";if(M){let P=d==="webp"?"image/webp":d==="avif"?"image/avif":"";te=`<link rel="preload" as="image" href="${n(j)}"${P?` type="${P}"`:""}${T?` imagesrcset="${n(T)}"`:""}${F?` imagesizes="${n(F)}"`:""} />
|
|
3
3
|
`}if(q){let V=[];if(a)for(let P of qo(a))V.push(`<source type="image/${P.format}" srcset="${n(P.srcset)}"${F?` sizes="${n(F)}"`:""} />`);if(!a&&(d==="avif"||d==="auto")){let P=$e(o,I,_,y,"avif"),B=T?Ye(o,Ke,y,"avif"):`${P}`;V.push(`<source type="image/avif" srcset="${n(B)}"${F?` sizes="${n(F)}"`:""} />`)}if(!a&&(d==="webp"||d==="auto")){let P=$e(o,I,_,y,"webp"),B=T?Ye(o,Ke,y,"webp"):`${P}`;V.push(`<source type="image/webp" srcset="${n(B)}"${F?` sizes="${n(F)}"`:""} />`)}return`${te}<picture>
|
|
4
4
|
${V.join(`
|
|
5
5
|
`)}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ee,lt,yi,Us,Wc,qc,bi,Kc,Gc,Ws,vi,Xc,Jc,xi,Sn}from"./chunk-
|
|
2
|
+
import{Ee,lt,yi,Us,Wc,qc,bi,Kc,Gc,Ws,vi,Xc,Jc,xi,Sn}from"./chunk-rme1a5qv.js";import{C}from"./chunk-qjey0jk6.js";import{a}from"./chunk-83qwwnye.js";import{Eo}from"./chunk-jwghpcqn.js";import{l}from"./chunk-46pxmpeb.js";import{existsSync as B,readFileSync as F}from"fs";import h from"path";var ge=new Set(["module","exports","require","$bool","$num","window","document","console","confirm","alert","fetch"]),te=Sn.filter((e)=>!ge.has(e)).sort(),ne=[...C].sort(),he=[...new Set([...te,...ne])].sort(),be=new Set(te),xe=new Set(ne),ye=new Set(he),ee=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function Se(e,t){if(t==="server")return`'${e}' is not provided by 'stx' in a <script server> block. The engine binds only its own names there (defineProps, state, useHead, ...); any other name becomes \`await import('stx')\`, which does not resolve, so the whole script fails when the page renders. Import it from '@stacksjs/stx' instead.`;return`'${e}' is not provided by 'stx' in a client <script> block. The import is replaced by the window.stx runtime, which has no '${e}', so it is undefined in the browser.`}function ie(e,t){let s=[];for(let p of t){if(p.offset===void 0)continue;let i=p.kind==="server"?be:xe;ee.lastIndex=0;for(let u of p.code.matchAll(ee)){let f=u.index+u[0].indexOf("{")+1;for(let m of u[1].matchAll(/[^,]+/g)){let b=m[0];if(/^\s*type\s/.test(b))continue;let S=/^\s*([A-Za-z_$][\w$]*)/.exec(b);if(!S)continue;let r=S[1];if(!ye.has(r)||i.has(r))continue;let d=p.offset+f+m.index+S[0].length-r.length,o=e.slice(0,d),k=o.split(`
|
|
3
3
|
`).length;s.push({line:k,column:d-(o.lastIndexOf(`
|
|
4
4
|
`)+1)+1,offset:d,length:r.length,name:r,kind:p.kind,message:Se(r,p.kind)})}}}return s}import E from"path";var ke="@stacksjs/stx-typescript-plugin";function we(e,t){let s=E.resolve(e);for(;;){let p=E.join(s,"tsconfig.json");if(t(p))return p;let i=E.dirname(s);if(i===s)return;s=i}}function re(e,t,s){let p=we(e,s);if(!p)return;let i=new Set,u=(f)=>{if(i.has(f))return;i.add(f);let m=t(f);if(!m)return;let b=m.compilerOptions?.plugins;if(Array.isArray(b)){let r=b.find((o)=>o?.name===ke),d=Array.isArray(r?.libs)?r.libs.filter((o)=>typeof o==="string"):[];return r?{configPath:f,libs:d.map((o)=>E.resolve(E.dirname(f),o))}:null}let S=typeof m.extends==="string"?[m.extends]:Array.isArray(m.extends)?m.extends:[];for(let r of[...S].reverse()){if(typeof r!=="string"||!r.startsWith("."))continue;let d=E.resolve(E.dirname(f),r.endsWith(".json")?r:`${r}.json`),o=u(d);if(o!==void 0)return o}return};return u(p)??void 0}function ya(e,t="",s="",p=t){let i=e.startLine>1?`
|
|
5
5
|
`.repeat(e.startLine-1):"",u=yi(vi(e)+e.code,p),f=Us(u.code),m=e.kind==="client"||e.kind==="plain"?Kc(t,e.code):"",b=(i+f).split(`
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{vr}from"./chunk-
|
|
2
|
+
import{vr}from"./chunk-kh6njq2r.js";import{Nr}from"./chunk-g0xn80gz.js";import{a}from"./chunk-83qwwnye.js";import{H,nt}from"./chunk-8s6s6nd0.js";import{_c}from"./chunk-hmdkf6c6.js";import{D,c}from"./chunk-fd1bpv35.js";var x=/<style\b[^>]*>/iy,R=/<\/style>/gi,b=/<script\b[^>]*>/iy,S=/<template(?=[\s>/])[^>]*>/iy,w=/<\/template\s*>/iy;function gr(e){let r=0,t=0,s=-1;while(r<e.length){let n=e.indexOf("<",r);if(n===-1)return-1;if(e.startsWith("<!--",n)){let g=e.indexOf("-->",n+4);r=g===-1?e.length:g+3;continue}x.lastIndex=n;let u=x.exec(e);if(u){R.lastIndex=n+u[0].length;let g=R.exec(e);r=g===null?e.length:g.index+8;continue}S.lastIndex=n;let o=S.exec(e);if(o){if(t===0)s=n;t++,r=n+o[0].length;continue}w.lastIndex=n;let d=w.exec(e);if(d){if(t>0)t--;r=n+d[0].length;continue}if(b.lastIndex=n,b.test(e))return t>0?s:n;r=n+1}return-1}function Z(e,r={}){return new vr(e,r).routes}import y from"path";var T=new Map;async function h(e,r){let t=e,s=r;if(!t||!s)try{let d=await a();t||=d?.pagesDir||"pages",s||=d?.root||"."}catch{t||="pages",s||="."}let n=y.isAbsolute(t)?t:y.join(s,t),u=T.get(n);if(u)return u;let o=[];try{o=Z(".",{pagesDir:n,emit:!1}).map((d)=>d.regex.source).filter(Boolean)}catch{o=[]}return T.set(n,o),o}function E(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function l(e){return E(JSON.stringify(e))}function ke(e){return e.includes("data-stx-runtime")}function Sc(e){let r=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let t=r.exec(e);t!==null;t=r.exec(e)){let s=e.slice(Math.max(0,t.index-80),t.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(s))continue;return!0}return!1}function p(e,r){let t=gr(e),s=e.search(/<!doctype\b/i);if(t!==-1&&(s===-1||t>s))return e.slice(0,t)+r+`
|
|
3
3
|
`+e.slice(t);let n=Nr(e);if(n!==null)return`${e.slice(0,n)}
|
|
4
|
-
${r}${e.slice(n)}`;if(e.includes("</head>")){let o=
|
|
4
|
+
${r}${e.slice(n)}`;if(e.includes("</head>")){let o=D(e);return e.slice(0,o)+r+`
|
|
5
5
|
`+e.slice(o)}if(H(e))return nt(e,(o)=>`${o}
|
|
6
6
|
${r}`);return`${r}
|
|
7
|
-
${e}`}async function mr(e,r){if(e.includes("data-stx-runtime")||e.includes("window.stx.state")||e.includes("STX Signals Runtime"))return e;if(r.buildMode==="serve"){let{getServeClientAsset:n}=await import("./chunk-
|
|
7
|
+
${e}`}async function mr(e,r){if(e.includes("data-stx-runtime")||e.includes("window.stx.state")||e.includes("STX Signals Runtime"))return e;if(r.buildMode==="serve"){let{getServeClientAsset:n}=await import("./chunk-ppfp1w98.js"),{url:u}=await n("runtime",r.debug===!0);return p(e,`<script data-stx-runtime src="${u}"></script>`)}if(r.buildMode==="compile")return p(e,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:t}=await import("./chunk-ppfp1w98.js"),s=await t(r.debug);return p(e,`<script data-stx-scoped data-stx-runtime>${s}</script>`)}function O(e){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(e)}function kc(e){if(e.includes("data-stx-tooltip-runtime")||!O(e))return e;let r=`<script data-stx-scoped data-stx-tooltip-runtime>${_c()}</script>`,t=c(e);if(t===-1)return`${e}
|
|
8
8
|
${r}`;return`${e.slice(0,t)}${r}
|
|
9
|
-
${e.slice(t)}`}var C=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function
|
|
9
|
+
${e.slice(t)}`}var C=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function M(e){return C.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function _e(e,r){if(!e.includes("</body>"))return e;if(M(e))return e;let t=r?.router,s="",n="";{let i={};if(t){if(t.container)i.container=t.container;if(t.interceptAllLinks!==void 0)i.interceptAllLinks=t.interceptAllLinks;if(t.progress!==void 0)i.progress=t.progress;if(t.viewTransitions!==void 0)i.viewTransitions=t.viewTransitions;if(t.viewTransitionDuration!==void 0)i.viewTransitionDuration=t.viewTransitionDuration;if(t.viewTransitionEasing!==void 0)i.viewTransitionEasing=t.viewTransitionEasing;if(t.scrollToTop!==void 0)i.scrollToTop=t.scrollToTop;if(t.scrollRestoration!==void 0)i.scrollRestoration=t.scrollRestoration;if(t.prefetch!==void 0)i.prefetch=t.prefetch;if(t.cache!==void 0)i.cache=t.cache;if(t.progressColor!==void 0)i.progressColor=t.progressColor;if(t.progressHeight!==void 0)i.progressHeight=t.progressHeight;if(t.prefetchVisible!==void 0)i.prefetchVisible=t.prefetchVisible;if(t.prefetchVisibleMax!==void 0)i.prefetchVisibleMax=t.prefetchVisibleMax;if(t.prefetchBudgetBytes!==void 0)i.prefetchBudgetBytes=t.prefetchBudgetBytes;if(t.keepOpening!==void 0)i.keepOpening=t.keepOpening}try{let f=await h(r?.pagesDir,r?.root);if(f.length>0)if(r?.buildMode==="serve"){let{registerServeModuleBundle:_}=await import("./chunk-ppfp1w98.js");n=`<script data-stx-owned-routes src="${_(`(window.__stxRouterConfig=window.__stxRouterConfig||{}).ownedRoutes=${l(f)};
|
|
10
10
|
`)}"></script>
|
|
11
11
|
`}else i.ownedRoutes=f}catch{}if(Object.keys(i).length>0)s=`<script>window.__stxRouterConfig=${l(i)};</script>
|
|
12
|
-
`}let{getCachedRouterScript:u,getServeClientAsset:o}=await import("./chunk-
|
|
12
|
+
`}let{getCachedRouterScript:u,getServeClientAsset:o}=await import("./chunk-ppfp1w98.js"),d=r?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':r?.buildMode==="serve"?`<script data-stx-router src="${(await o("router")).url}"></script>`:`<script data-stx-router>${await u()}</script>`,g=c(e);return e.slice(0,g)+s+n+d+`
|
|
13
13
|
</body>`+e.slice(g+7)}
|
|
14
14
|
export{gr,Z,ke,Sc,mr,kc,_e};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Zh,vs,Yo,xs,fr,Zo,Qo,Zf,Ss,ks,_s,ei,xc,Qf,Ct}from"./chunk-
|
|
2
|
+
import{Zh,vs,Yo,xs,fr,Zo,Qo,Zf,Ss,ks,_s,ei,xc,Qf,Ct}from"./chunk-wcvzsyf1.js";import"./chunk-t2a6j64z.js";import"./chunk-5dvkphbe.js";import"./chunk-83qwwnye.js";import"./chunk-y69k2fww.js";import"./chunk-tnp2ta5q.js";import"./chunk-rw5492e2.js";import"./chunk-83tvkw4y.js";import"./chunk-kh6njq2r.js";import{q}from"./chunk-rme1a5qv.js";import"./chunk-4w8a7f8t.js";import"./chunk-k32q90b2.js";import"./chunk-g0xn80gz.js";import"./chunk-farh4p7f.js";import"./chunk-qjey0jk6.js";export{Zf as bindLoopInterpolations,Zh as clearScriptScanCache,Ss as convertServerLoopAttributesToDirectives,Zo as convertSignalDirectivesToAttributes,ks as convertSignalLoopsToAttributes,fr as extractClientSignalNames,q as extractExports,xc as findMarkupIndexOutsideScripts,xs as hasSignalsSyntax,Yo as parseLoopExpression,Qo as preEvalLiteralReactiveIfs,_s as processScriptSetup,ei as processSignals,Qf as rewriteStxImportSpecifiers,vs as scanScriptTags,Ct as stripStxRuntimeImports};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Sn,mg,hg,yg,bg,wg,h,vg,_i,xg,ol,il}from"./chunk-
|
|
2
|
+
import{Sn,mg,hg,yg,bg,wg,h,vg,_i,xg,ol,il}from"./chunk-rme1a5qv.js";import"./chunk-4w8a7f8t.js";import"./chunk-k32q90b2.js";import"./chunk-g0xn80gz.js";import"./chunk-farh4p7f.js";import"./chunk-qjey0jk6.js";export{Sn as STX_ENGINE_BINDING_NAMES,_i as convertToCommonJS,ol as extractScriptFromTemplate,h as extractVariables,il as hasVariables,vg as isCompleteImport,wg as isMissingBindingFailure,yg as isModuleResolutionFailure,bg as isSyntaxFailure,xg as splitDeclaration,mg as stripTypeScript,hg as withoutStxReferrer};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{La,ja,Ba,Fa,Bh}from"./chunk-pghp2tkv.js";import"./chunk-79y9amt1.js";import"./chunk-ndez5ee8.js";import"./chunk-vvzys1x7.js";import"./chunk-6mhj42gz.js";import"./chunk-brs63ht2.js";import"./chunk-h4rjzbek.js";import"./chunk-q1wxgw5s.js";import"./chunk-sxdzpv90.js";import"./chunk-xsscsar3.js";import"./chunk-6y066pr2.js";import"./chunk-jbgj2hph.js";import"./chunk-wcvzsyf1.js";import"./chunk-t2a6j64z.js";import"./chunk-5dvkphbe.js";import"./chunk-q22fpqtr.js";import"./chunk-83qwwnye.js";import"./chunk-y69k2fww.js";import"./chunk-tnp2ta5q.js";import"./chunk-rw5492e2.js";import"./chunk-83tvkw4y.js";import"./chunk-kh6njq2r.js";import"./chunk-rme1a5qv.js";import"./chunk-4w8a7f8t.js";import"./chunk-k32q90b2.js";import"./chunk-g0xn80gz.js";import"./chunk-farh4p7f.js";import"./chunk-qjey0jk6.js";export{La as buildNative,Bh as default,ja as findCraftBinary,Fa as getAvailableFormats,Ba as getAvailableTargets};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{R}from"./chunk-
|
|
2
|
+
import{R}from"./chunk-rme1a5qv.js";import{i}from"./chunk-6mhj42gz.js";import p from"fs";import g from"path";import*as y from"readline";var e={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},u={help:{description:"Show available commands",usage:"help [command]",handler:async(t,o)=>{if(t[0]&&u[t[0]]){let n=u[t[0]];console.log(`
|
|
3
3
|
${e.bold}${t[0]}${e.reset} - ${n.description}`),console.log(` Usage: ${e.cyan}${n.usage}${e.reset}
|
|
4
4
|
`)}else{console.log(`
|
|
5
5
|
${e.bold}Available Commands:${e.reset}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{dm}from"./chunk-epct9fqd.js";import"./chunk-zdrn7wp0.js";import"./chunk-ez6e7rh1.js";import"./chunk-fh8jzm4b.js";import"./chunk-xsscsar3.js";import"./chunk-t2a6j64z.js";import"./chunk-83qwwnye.js";import"./chunk-y69k2fww.js";import"./chunk-tnp2ta5q.js";import"./chunk-rw5492e2.js";import"./chunk-83tvkw4y.js";import"./chunk-kh6njq2r.js";import"./chunk-rme1a5qv.js";import"./chunk-4w8a7f8t.js";import"./chunk-k32q90b2.js";import"./chunk-g0xn80gz.js";import"./chunk-farh4p7f.js";import"./chunk-qjey0jk6.js";export{dm as startProductionServer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{yo,pa,Jr,bo,wo,
|
|
2
|
+
import{yo,pa,Jr,bo,wo,Mn,Qt,fa,Yr,Zr,vo,xo,pm,fm,bt}from"./chunk-nack2xs5.js";export{bt as DeployError,pa as calculateSha1,Jr as collectDeployFiles,Zr as createDefaultNetlifyConfig,bo as createFileManifest,yo as createNetlifyClient,pm as deploy,Yr as detectProjectConfig,wo as filterRequiredFiles,Mn as formatSize,fa as generateNetlifyToml,Qt as getTotalSize,xo as hasNetlifyConfig,fm as initNetlify,vo as writeNetlifyConfig};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ft,El}from"./chunk-qjey0jk6.js";import{N}from"./chunk-farh4p7f.js";import{q,Bs,o,ue,X,w,Uc,zt,kn,Ve,Ue}from"./chunk-
|
|
2
|
+
import{ft,El}from"./chunk-qjey0jk6.js";import{N}from"./chunk-farh4p7f.js";import{q,Bs,o,ue,X,w,Uc,zt,kn,Ve,Ue}from"./chunk-rme1a5qv.js";import{mr}from"./chunk-t2a6j64z.js";import{H}from"./chunk-8s6s6nd0.js";import{hn}from"./chunk-5dvkphbe.js";var U=`(?:"[^"]*"|'[^']*'|[^>"'])*`,G=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,Q=65536,J=4,M=new Map;function Zh(){M.clear()}function K(e){let c=[];for(let t of w(e,X)){let n=t.token.match(/^<script\b([^>]*)>/i),s=t.token.match(/<\/script\s*>$/i);if(!n||!s)continue;let u=n[0].length,f=t.token.length-s[0].length;c.push(Object.freeze({fullMatch:t.token,attrs:n[1],body:t.token.slice(u,f),start:t.start,end:t.end}))}return c}function vs(e,c={}){let t=e.length>=Q,n=t?M.get(e):void 0;if(n===void 0){if(n=K(e),t)Uc(M,J),M.set(e,n)}let s=c.skipAttrs;if(!s)return n.slice();let u=[];for(let f of n)if(s.lastIndex=0,!s.test(f.attrs))u.push(f);return u}function Yo(e){let c=e.trim(),t=c.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(t){let s=t[1].trim(),u=t[2].trim(),{itemVar:f,indexVar:i}=D(u);if(f)return{style:"as",iterable:s,itemVar:f,indexVar:i}}let n=c.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(n){let s=n[1].trim(),u=n[2].trim(),{itemVar:f,indexVar:i}=D(s);if(f)return{style:"in",iterable:u,itemVar:f,indexVar:i}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function D(e){let c=e.trim(),t=c.match(/^(\w+)\s*=>\s*(\w+)$/);if(t)return{itemVar:t[2],indexVar:t[1]};let n=c.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(n)return{itemVar:n[1],indexVar:n[2]||null};let s=c.match(/^(\w+)\s*,\s*(\w+)$/);if(s)return{itemVar:s[1],indexVar:s[2]};let u=c.match(/^(\w+)$/);if(u)return{itemVar:u[1],indexVar:null};return{itemVar:null,indexVar:null}}function xs(e,c){return El(e,c)}function Y(e){let c=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,t=0,n;while((n=c.exec(e))!==null){let s=n[1];if(s.startsWith("if"))t++;else if(s==="endif")t--;else if(t===0)return!0}return!1}function fr(e){let c=new Set,t=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,n=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel)\s*(?:<[^>]*>)?\s*\(/g,s;while((s=t.exec(e))!==null){let u=s[1],f;while((f=n.exec(u))!==null)c.add(f[1])}return c}function ee(e){if(!/[:@]for\s*=/.test(e)&&!/\bx-for\s*=/.test(e))return[];let c=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${U})>`,"iy"),t=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,n=w(e,(u,f)=>{c.lastIndex=f;let i=c.exec(u);if(!i||i.index!==f||!t.test(i[2]))return-1;return c.lastIndex}),s=[];for(let u of n){c.lastIndex=0;let f=c.exec(u.token);if(!f)continue;let i=f[2].match(t),p=Yo(i?.[1]??i?.[2]??""),m=[p.itemVar,p.indexVar].filter(Boolean);if(m.length===0)continue;let r=f[1],g=/\/\s*>$/.test(u.token)||O.has(r.toLowerCase())?u.end:j(e,u.start,r,u.end);if(g!==-1)s.push({start:u.start,end:g,vars:new Set(m)})}return s}var z=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);function te(e){return e.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function W(e,c,t,n){if(!e)return!1;let s=te(e),u=!1,f=!1,i=!1,p=/([a-zA-Z_$][\w$]*)/g,m;while((m=p.exec(s))!==null){let l=m[1];if(s.slice(0,m.index).trimEnd().endsWith("."))continue;if(z.has(l))continue;if(c.has(l)||n?.has(l))u=!0;else if(t&&l in t)f=!0}let r=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,a;while((a=r.exec(s))!==null){let l=a[1];if(s.slice(0,a.index).trimEnd().endsWith("."))continue;if(z.has(l)||t&&l in t)continue;i=!0}return(u||i)&&!f}function L(e,c,t){let n=t===void 0?` ${c}`:` ${c}="${t.replace(/"/g,""")}"`,s=e.trim(),u=s.match(G);if(u&&ne(u[3],u[1])){let[,f,i,p]=u;return`<${f}${i}${n}>${p}</${f}>`}return`<template${n}>${s}</template>`}function ne(e,c){let t=new RegExp(`<(/)?${c}(?=[\\s/>])`,"gi"),n=0,s;while((s=t.exec(e))!==null)if(s[1]){if(n--,n<0)return!1}else n++;return!0}function Zo(e,c){let t=fr(e);function n(s){let u=s,f=ee(s),i=(a)=>{let g=new Set;for(let l of f)if(a>l.start&&a<l.end)for(let d of l.vars)g.add(d);return g},p=/@if\s*\(/g,m,r=[];while((m=p.exec(u))!==null){let a=m.index,g=a+m[0].length,l=1,d=g;while(d<u.length&&l>0){if(u[d]==="(")l++;else if(u[d]===")")l--;d++}if(l!==0)continue;let b=u.substring(g,d-1).trim(),S=d,E=1,y=S,x=/@(if\s*\(|endif)/g;x.lastIndex=S;let h;while((h=x.exec(u))!==null)if(h[1].startsWith("if"))E++;else if(h[1]==="endif"){if(E--,E===0){y=h.index+h[0].length;break}}if(E!==0)continue;let R=u.substring(S,y-6).trim(),A;if(Y(R)){let C=hn(u.substring(a,y));if(C.length===0)continue;let T=C[0].branches.filter((_)=>_.type!=="else"),k=i(a);if(!(T.length>0&&T.every((_)=>W(_.condition,t,c,k))))continue;A=C[0].branches.map((_)=>{let V=n(_.content);if(_.type==="elseif")return L(V,"@else-if",_.condition??"");if(_.type==="else")return L(V,"@else");return L(V,"@if",_.condition??"")}).join(`
|
|
3
3
|
`)}else{if(!W(b,t,c,i(a)))continue;A=L(n(R),"@if",b)}r.push({start:a,end:y,replacement:A}),p.lastIndex=y}for(let a=r.length-1;a>=0;a--){let{start:g,end:l,replacement:d}=r[a];u=u.substring(0,g)+d+u.substring(l)}return u}return n(e)}function se(e){let c=e.trim();if(c==="")return;if(c==="true")return!0;if(c==="false")return!1;if(c==="null")return!1;if(c==="undefined")return!1;if(c==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(c)){let s=Number(c);return s!==0&&!Number.isNaN(s)}let t=c.match(/^'((?:\\.|[^'\\])*)'$/);if(t)return t[1].length>0;let n=c.match(/^"((?:\\.|[^"\\])*)"$/);if(n)return n[1].length>0;return}var O=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),B=/<(script|style)\b/iy,re=/<\/script/gi,ie=/<\/style/gi;function j(e,c,t,n){if(O.has(t.toLowerCase()))return n;let s=t.toLowerCase(),u=e.length,f=1,i=n;while(i<u){let p=e.indexOf("<",i);if(p===-1)return-1;if(i=p,e.startsWith("<!--",i)){let g=e.indexOf("-->",i+4);if(g===-1)return-1;i=g+3;continue}B.lastIndex=i;let m=B.exec(e);if(m){let g=e.indexOf(">",i);if(g===-1)return-1;if(e[g-1]==="/"){i=g+1;continue}let l=m[1].toLowerCase()==="script"?re:ie;l.lastIndex=i;let d=l.exec(e);if(d===null)return-1;let b=e.indexOf(">",d.index);if(b===-1)return-1;i=b+1;continue}if(e[i+1]==="/"){let g=/^<\/([a-z][\w-]*)\s*>/i.exec(e.slice(i,i+64));if(!g){i++;continue}if(g[1].toLowerCase()===s){if(f--,i+=g[0].length,f===0)return i;continue}i+=g[0].length;continue}let r=/^<([a-z][\w-]*)\b/i.exec(e.slice(i,i+64));if(!r){i++;continue}let a=e.indexOf(">",i);if(a===-1)return-1;if(r[1].toLowerCase()===s){let g=e.slice(i,a+1);if(!(/\/\s*>$/.test(g)||O.has(s)))f++}i=a+1}return-1}var oe=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function ce(e,c){let t=c,n=e.length;for(;;){while(t<n&&e[t]!=="<")t++;if(t>=n)return!1;if(e.startsWith("<!--",t)){let f=e.indexOf("-->",t+4);if(f===-1)return!1;t=f+3;continue}break}if(e[t+1]==="/")return!1;let s=e.indexOf(">",t);if(s===-1)return!1;let u=e.slice(t,s+1);return oe.test(u)}function Qo(e){if(!e.includes(":if")&&!e.includes(":show")&&!e.includes("x-if")&&!e.includes("x-show")&&!e.includes("@if=")&&!e.includes("@show="))return e;let c=[],t=/<([a-zA-Z][\w-]*)/y,n=/\s/,s=new Set([":if",":show","x-if","x-show","@if","@show"]);w(e,(r,a)=>{t.lastIndex=a;let g=t.exec(r);if(!g||/^(?:script|style)$/i.test(g[1]))return-1;let l=t.lastIndex,d;while(l<r.length){let b=l;while(l<r.length&&n.test(r[l]))l++;let S=l;if(r[S]==="/"){S++;while(S<r.length&&n.test(r[S]))S++}if(r[S]===">"){if(d)c.push({start:a,end:S+1,tag:g[1],...d});return-1}if(l===b)return-1;let E=l;while(l<r.length&&!n.test(r[l])&&r[l]!=="="&&r[l]!==">")l++;if(l===E)return-1;let y=r.slice(E,l);if(y.startsWith("@")&&y.includes("("))return-1;let x=l,h=l;while(h<r.length&&n.test(r[h]))h++;if(r[h]!=="="){l=x;continue}h++;while(h<r.length&&n.test(r[h]))h++;let R=r[h];if(R==='"'||R==="'"){let A=r.indexOf(R,h+1);if(A===-1)return-1;if(!d&&R==='"'&&s.has(y))d={attrName:y,attrStart:b,attrEnd:A+1,value:r.slice(h+1,A)};l=A+1}else{l=h;while(l<r.length&&!n.test(r[l])&&r[l]!==">")l++}}return-1});let u=[],f=-1;for(let r of c){let{start:a,end:g,tag:l,attrName:d,value:b}=r;if(a<f)continue;let S=se(b);if(S===void 0)continue;let x=/\/\s*>$/.test(e.slice(a,g))||O.has(l.toLowerCase())?g:j(e,a,l,g);if(x===-1)continue;if((d===":if"||d==="x-if"||d==="@if")&&ce(e,x))continue;if(S===!0){let R=e.slice(a,r.attrStart)+e.slice(r.attrEnd,g);u.push({start:a,end:g,replacement:R});continue}u.push({start:a,end:x,replacement:""}),f=x}if(u.length===0)return e;u.sort((r,a)=>r.start-a.start);let i=[],p=-1;for(let r of u){if(r.start<p)continue;i.push(r),p=r.end}let m=e;for(let r=i.length-1;r>=0;r--){let{start:a,end:g,replacement:l}=i[r];m=m.substring(0,a)+l+m.substring(g)}return m}var Z=[":for","@for","x-for"];function Zf(e){let c=/(\s)((?::|@|x-|v-)[\w.:-]+)\s*=\s*"([^"]*\{\{[^"]*)"/g;return e.replace(c,(t,n,s,u)=>{let f=u.replace(/'((?:[^'\\]|\\.)*)'/g,(i,p)=>{if(!p.includes("{{"))return i;return`\`${p.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{\s*([^}]+?)\s*\}\}/g,(r,a)=>`\${${a}}`)}\``});return`${n}${s}="${f}"`})}function Ss(e,c){if(!c||Object.keys(c).length===0)return e;if(!Z.some((i)=>e.includes(`${i}=`)))return e;let t=fr(e);if(Array.isArray(c.__stx_client_signal_names)){for(let i of c.__stx_client_signal_names)if(typeof i==="string")t.add(i)}let n=e,s=[],u=/<([a-zA-Z][\w-]*)((?:[^>"']|"[^"]*"|'[^']*')*)>/g,f;while((f=u.exec(n))!==null){let[i,p,m]=f,r=f.index,a=r+i.length,g=Z.map((A)=>({attr:A,m:new RegExp(`\\s${A}="([^"]*)"`).exec(m)})).find((A)=>A.m!==null);if(!g||!g.m)continue;let l=Yo(g.m[1]);if(!l.iterable||!l.itemVar)continue;let d=l.iterable.trim().split(/[.[(]/)[0].trim();if(!d||t.has(d)||!(d in c))continue;let b=j(n,r,p,a);if(b===-1)continue;let S=m.replace(new RegExp(`\\s${g.attr}="[^"]*"`),"").replace(/\s:key="[^"]*"/,"").replace(/\sx-cloak(?=\s|$)/,""),E=n.slice(a,b-`</${p}>`.length),y={...c,[l.itemVar]:void 0};if(l.indexVar)y[l.indexVar]=void 0;let x=Ss(E,y),h=l.indexVar?`${l.iterable} as ${l.indexVar} => ${l.itemVar}`:`${l.iterable} as ${l.itemVar}`,R=p.toLowerCase()==="template"?x:`<${p}${S}>${x}</${p}>`;s.push({start:r,end:b,replacement:`@foreach(${h})${R}@endforeach`}),u.lastIndex=b}for(let i=s.length-1;i>=0;i--){let{start:p,end:m,replacement:r}=s[i];n=n.slice(0,p)+r+n.slice(m)}return n}function ks(e,c){let t=e,n=/@(for|foreach)\s*\(/g,s,u=[],f=[];while((s=n.exec(t))!==null){let i=s[1],p=s.index,m=p+s[0].length,r=1,a=m;while(a<t.length&&r>0){if(t[a]==="(")r++;else if(t[a]===")")r--;a++}if(r!==0)continue;let g=t.substring(m,a-1).trim(),l=a,d=Yo(g),b=i==="for"?"@endfor":"@endforeach",S=1,E=l,y=i==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${i}\\s*\\(|end${i})`,"g");y.lastIndex=l;let x;while((x=y.exec(t))!==null)if(x[1].startsWith(i))S++;else if(S--,S===0){E=x.index+x[0].length;break}if(S!==0)continue;let h=()=>{let v=[d.itemVar,d.indexVar].filter(Boolean);if(v.length)f.push({start:p,end:E,vars:v})};if(d.iterable){let v=d.iterable.trim();if(v.startsWith("[")||v.startsWith("{")||v.startsWith("'")||v.startsWith('"')||v.startsWith("`")||/^-?\d/.test(v)){h();continue}let I=v.split(/[.[(]/)[0].trim(),_=c?I in c:!1,V=f.some((P)=>p>P.start&&p<P.end&&P.vars.includes(I));if(I&&(_||V)){h();continue}}if(d.style==="as")g=d.indexVar?`(${d.itemVar}, ${d.indexVar}) in ${d.iterable}`:`${d.itemVar} in ${d.iterable}`;let R=t.substring(l,E-b.length).trim(),A=c?{...c}:{};if(d.itemVar)delete A[d.itemVar];if(d.indexVar)delete A[d.indexVar];let C=Zf(ks(R,A)),T=C.match(G),k;if(T){let[,v,I,_]=T;k=`<${v}${I} @for="${g}">${_}</${v}>`}else k=`<template @for="${g}">${C}</template>`;u.push({start:p,end:E,replacement:k}),n.lastIndex=E}for(let i=u.length-1;i>=0;i--){let{start:p,end:m,replacement:r}=u[i];t=t.substring(0,p)+r+t.substring(m)}return t}function ae(e){let c=new Set,t=[],n=0,s=0,u=e.length,f=(r)=>{let a=n+1;while(a<u){let g=e[a];if(g==="\\"){a+=2;continue}if(g===r)return a+1;a++}return u},i=()=>{let r=n+2;while(r<u&&e[r]!==`
|
|
4
4
|
`)r++;return r},p=()=>{let r=n+2;while(r<u-1){if(e[r]==="*"&&e[r+1]==="/")return r+2;r++}return u},m=(r)=>{let a=r,g=0;while(a<u){let l=e[a];if(l==="/"&&e[a+1]==="/"){let d=a+2;while(d<u&&e[d]!==`
|
|
5
|
-
`)d++;a=d;continue}if(l==="/"&&e[a+1]==="*"){let d=a+2;while(d<u-1&&!(e[d]==="*"&&e[d+1]==="/"))d++;a=d+2;continue}if(l==='"'||l==="'"||l==="`"){let d=a+1;while(d<u){if(e[d]==="\\"){d+=2;continue}if(e[d]===l){d++;break}d++}a=d;continue}if(l==="("||l==="["||l==="{"){g++,a++;continue}if(l===")"||l==="]"||l==="}"){g--,a++;continue}if(l===";"&&g===0)return a+1;a++}return u};while(n<u){let r=e[n];if(r==="/"&&e[n+1]==="/"){let a=i();t.push(e.slice(n,a)),n=a;continue}if(r==="/"&&e[n+1]==="*"){let a=p();t.push(e.slice(n,a)),n=a;continue}if(r==='"'||r==="'"||r==="`"){let a=f(r);t.push(e.slice(n,a)),n=a;continue}if(r==="{"){s++,t.push(r),n++;continue}if(r==="}"){s--,t.push(r),n++;continue}if(s===0){let a=n>0?e[n-1]:"";if(a===""||/\s/.test(a)||a===";"||a==="}"||a==="{"){let l=e.slice(n).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(l){let d=l[2],b=m(n+l[0].length);if(c.has(d)){t.push(`/* stx: deduped const ${d} */`),n=b;continue}c.add(d),t.push(e.slice(n,b)),n=b;continue}}}t.push(r),n++}return t.join("")}var le=new Set(["script","style","html","head","meta","link","title","!doctype"]);function fe(e){let c=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${U})>`,"iy"),t=null,n=null;return w(e,(s,u)=>{c.lastIndex=u;let f=c.exec(s);if(!f)return-1;let i=f[1].toLowerCase();if(i==="script"||i==="style")return-1;let p=u+f[0].length-1;if(i==="body"&&n===null)n=p;if(t===null&&!le.has(i))t=p;return u+f[0].length}),n??t}function de(e,c,t,n){let s=[],u=` data-stx="${n}"`,f=0,i=!1,p=(m)=>{if(t!==null&&!i&&t>=f&&t<=m)s.push(e.slice(f,t),u,e.slice(t,m)),i=!0;else s.push(e.slice(f,m))};for(let m of c){if(m.start<f)continue;p(m.start),f=m.end}return p(e.length),s.join("")}async function _s(e,c,t,n={}){let s=vs(e,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),u=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|keptState|useCookie|useId|useModel|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,f=[],{hasUserImports:i,bundleClientScript:p}=await o("stx/client-script-bundler",()=>import("./chunk-
|
|
5
|
+
`)d++;a=d;continue}if(l==="/"&&e[a+1]==="*"){let d=a+2;while(d<u-1&&!(e[d]==="*"&&e[d+1]==="/"))d++;a=d+2;continue}if(l==='"'||l==="'"||l==="`"){let d=a+1;while(d<u){if(e[d]==="\\"){d+=2;continue}if(e[d]===l){d++;break}d++}a=d;continue}if(l==="("||l==="["||l==="{"){g++,a++;continue}if(l===")"||l==="]"||l==="}"){g--,a++;continue}if(l===";"&&g===0)return a+1;a++}return u};while(n<u){let r=e[n];if(r==="/"&&e[n+1]==="/"){let a=i();t.push(e.slice(n,a)),n=a;continue}if(r==="/"&&e[n+1]==="*"){let a=p();t.push(e.slice(n,a)),n=a;continue}if(r==='"'||r==="'"||r==="`"){let a=f(r);t.push(e.slice(n,a)),n=a;continue}if(r==="{"){s++,t.push(r),n++;continue}if(r==="}"){s--,t.push(r),n++;continue}if(s===0){let a=n>0?e[n-1]:"";if(a===""||/\s/.test(a)||a===";"||a==="}"||a==="{"){let l=e.slice(n).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(l){let d=l[2],b=m(n+l[0].length);if(c.has(d)){t.push(`/* stx: deduped const ${d} */`),n=b;continue}c.add(d),t.push(e.slice(n,b)),n=b;continue}}}t.push(r),n++}return t.join("")}var le=new Set(["script","style","html","head","meta","link","title","!doctype"]);function fe(e){let c=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${U})>`,"iy"),t=null,n=null;return w(e,(s,u)=>{c.lastIndex=u;let f=c.exec(s);if(!f)return-1;let i=f[1].toLowerCase();if(i==="script"||i==="style")return-1;let p=u+f[0].length-1;if(i==="body"&&n===null)n=p;if(t===null&&!le.has(i))t=p;return u+f[0].length}),n??t}function de(e,c,t,n){let s=[],u=` data-stx="${n}"`,f=0,i=!1,p=(m)=>{if(t!==null&&!i&&t>=f&&t<=m)s.push(e.slice(f,t),u,e.slice(t,m)),i=!0;else s.push(e.slice(f,m))};for(let m of c){if(m.start<f)continue;p(m.start),f=m.end}return p(e.length),s.join("")}async function _s(e,c,t,n={}){let s=vs(e,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),u=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|keptState|useCookie|useId|useModel|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,f=[],{hasUserImports:i,bundleClientScript:p}=await o("stx/client-script-bundler",()=>import("./chunk-yrstc4z4.js"));for(let x of s){let h=x.body;if(Ve(x.attrs))h=Ue(h);if(n.forceClientSetup||u.test(h)){f.push({content:h,start:x.start,end:x.end});continue}if(!i(h))continue;try{let R=await p(zt(h).code,c||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(u.test(R))f.push({content:h,start:x.start,end:x.end})}catch{}}if(f.length===0)return{output:e,setupCode:null};let m=`${c??""}\x00${f.map((x)=>x.content).join("\x00")}`,r=`__stx_setup_${Bun.hash(m).toString(36).slice(0,10)}`,a=[];for(let x=0;x<f.length;x++){let h=f[x].bundled??zt(f[x].content).code;if(!f[x].bundled&&i(h))h=await p(h,c||"",{projectRoot:process.cwd()});h=Ct(h);let R=N(h);a.push(`// \u2500\u2500 merged signal script #${x+1} \u2500\u2500
|
|
6
6
|
${R}`)}let g=a.join(`
|
|
7
7
|
|
|
8
8
|
`);g=ae(g);let d=q(g).split(",").map((x)=>x.trim()).filter(Boolean),b=kn(g,t),S=`
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ya,mm,ba,hm,Yl,Zl,ym,bm}from"./chunk-syzggy76.js";import"./chunk-jwghpcqn.js";import"./chunk-mrw6vmqy.js";import"./chunk-fh8jzm4b.js";import"./chunk-9zrvh3pz.js";import"./chunk-wcvzsyf1.js";import"./chunk-t2a6j64z.js";import"./chunk-5dvkphbe.js";import"./chunk-83qwwnye.js";import"./chunk-y69k2fww.js";import"./chunk-tnp2ta5q.js";import"./chunk-rw5492e2.js";import"./chunk-83tvkw4y.js";import"./chunk-kh6njq2r.js";import{lt,gg}from"./chunk-rme1a5qv.js";import"./chunk-4w8a7f8t.js";import"./chunk-k32q90b2.js";import"./chunk-g0xn80gz.js";import"./chunk-farh4p7f.js";import"./chunk-qjey0jk6.js";export{ya as buildScriptVirtualFile,mm as buildVirtualSource,lt as extractScriptBlocks,gg as extractTemplateExpressions,Yl as findRuntimeTypeDeclarations,Zl as findStxModuleDeclarations,bm as formatTypecheckDiagnostics,hm as sourcePathFor,ym as typecheckStxFiles,ba as virtualPathFor};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{R}from"./chunk-
|
|
2
|
+
import{R}from"./chunk-rme1a5qv.js";import{ge}from"./chunk-67dgp45w.js";function g(e,t){let r={};for(let n of e)r[n]=ge(t(n));return new Proxy({},{get:(n,a)=>r[a]?.(),set:(n,a,o)=>{if(r[a])r[a].set(o);else r[a]=ge(o);return!0},has:(n,a)=>(a in r),deleteProperty:(n,a)=>(delete r[a],!0),ownKeys:()=>Reflect.ownKeys(r),getOwnPropertyDescriptor:(n,a)=>(a in r)?{enumerable:!0,configurable:!0,writable:!0,value:r[a]()}:void 0})}function v(e,t){let r={};for(let n of t)r[n]=e[n];return r}function Ra(e,t){let r=Object.keys(e),n=g(r,(i)=>t?.[i]??e[i].getDefaultValue()),a=g(r,()=>[]),o=g(r,()=>!1),c=g(r,()=>!1),f=g(r,()=>!1),s=ge(!1);async function u(i){f[i]=!0;let d=await e[i].validate(n[i],n);return a[i]=d,f[i]=!1,d.length===0}async function l(){s.set(!0);let i=await Promise.all(r.map(u));return s.set(!1),i.every(Boolean)}function m(){for(let i of r)n[i]=t?.[i]??e[i].getDefaultValue(),a[i]=[],o[i]=!1,c[i]=!1}function h(i){for(let d of r)if(d in i)n[d]=i[d],c[d]=!0}function b(i,d){n[i]=d,c[i]=!0}function y(i,d=!0){if(o[i]=d,d)u(i)}function p(i){return{value:n[i],errors:a[i],touched:o[i],dirty:c[i],valid:a[i].length===0,validating:f[i]}}function V(i){return async(d)=>{d?.preventDefault?.();for(let w of r)o[w]=!0;if(await l())await i(v(n,r))}}return{values:n,errors:a,touched:o,dirty:c,get isValid(){return r.every((i)=>a[i].length===0)},get isValidating(){return s()||r.some((i)=>f[i])},get isDirty(){return r.some((i)=>c[i])},validate:l,validateField:u,reset:m,setValues:h,setFieldValue:b,setFieldTouched:y,getFieldState:p,handleSubmit:V}}var vu=Ra;class Kn{rules=[];defaultValue="";addRule(e){let t=new Kn;return t.rules=[...this.rules,e],t.defaultValue=this.defaultValue,t}required(e="This field is required"){return this.addRule({name:"required",message:e,validate:(t)=>{if(t===null||t===void 0)return e;if(typeof t==="string"&&t.trim()==="")return e;if(Array.isArray(t)&&t.length===0)return e;return!0}})}email(e="Please enter a valid email"){return this.addRule({name:"email",message:e,validate:(t)=>{if(!t)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(t))||e}})}url(e="Please enter a valid URL"){return this.addRule({name:"url",message:e,validate:(t)=>{if(!t)return!0;try{return new URL(String(t)),!0}catch{return e}}})}min(e,t){let r=t||`Must be at least ${e} characters`;return this.addRule({name:"min",message:r,validate:(n)=>{if(!n)return!0;return String(n).length>=e||r}})}max(e,t){let r=t||`Must be no more than ${e} characters`;return this.addRule({name:"max",message:r,validate:(n)=>{if(!n)return!0;return String(n).length<=e||r}})}length(e,t,r){let n=r||`Must be between ${e} and ${t} characters`;return this.addRule({name:"length",message:n,validate:(a)=>{if(!a)return!0;let o=String(a).length;return o>=e&&o<=t||n}})}pattern(e,t="Invalid format"){return this.addRule({name:"pattern",message:t,validate:(r)=>{if(!r)return!0;return e.test(String(r))||t}})}hasUppercase(e="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,e)}hasLowercase(e="Must contain a lowercase letter"){return this.pattern(/[a-z]/,e)}hasNumber(e="Must contain a number"){return this.pattern(/\d/,e)}hasSpecial(e="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,e)}alphanumeric(e="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,e)}startsWithLetter(e="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,e)}noSpaces(e="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:e,validate:(t)=>{if(!t)return!0;return!String(t).includes(" ")||e}})}number(e="Must be a number"){let t=this.addRule({name:"number",message:e,validate:(r)=>{if(!r&&r!==0)return!0;return!Number.isNaN(Number(r))||e}});return t.defaultValue=0,t}integer(e="Must be a whole number"){return this.addRule({name:"integer",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number.isInteger(Number(t))||e}})}positive(e="Must be a positive number"){return this.addRule({name:"positive",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)>0||e}})}negative(e="Must be a negative number"){return this.addRule({name:"negative",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)<0||e}})}minValue(e,t){let r=t||`Must be at least ${e}`;return this.addRule({name:"minValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)>=e||r}})}maxValue(e,t){let r=t||`Must be no more than ${e}`;return this.addRule({name:"maxValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)<=e||r}})}between(e,t,r){let n=r||`Must be between ${e} and ${t}`;return this.addRule({name:"between",message:n,validate:(a)=>{if(!a&&a!==0)return!0;let o=Number(a);return o>=e&&o<=t||n}})}matches(e,t){let r=t||`Must match ${e}`;return this.addRule({name:"matches",message:r,validate:(n,a)=>{if(!a)return!0;return n===a[e]||r}})}oneOf(e,t){let r=t||`Must be one of: ${e.join(", ")}`;return this.addRule({name:"oneOf",message:r,validate:(n)=>{if(!n)return!0;return e.includes(n)||r}})}notOneOf(e,t){let r=t||`Cannot be one of: ${e.join(", ")}`;return this.addRule({name:"notOneOf",message:r,validate:(n)=>{if(!n)return!0;return!e.includes(n)||r}})}date(e="Must be a valid date"){return this.addRule({name:"date",message:e,validate:(t)=>{if(!t)return!0;let r=new Date(String(t));return!Number.isNaN(r.getTime())||e}})}before(e,t){let r=new Date(e),n=t||`Must be before ${r.toLocaleDateString()}`;return this.addRule({name:"before",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))<r||n}})}after(e,t){let r=new Date(e),n=t||`Must be after ${r.toLocaleDateString()}`;return this.addRule({name:"after",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))>r||n}})}custom(e,t="Invalid value"){return this.addRule({name:"custom",message:t,validate:e})}async(e,t="Invalid value"){return this.addRule({name:"async",message:t,async:!0,validate:e})}when(e,t){let r=new Kn;r.rules=[...this.rules],r.defaultValue=this.defaultValue;for(let n of t.getRules())r.rules.push({...n,validate:(a,o)=>{if(!e(a,o||{}))return!0;return n.validate(a,o)}});return r}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(e){let t=new Kn;return t.rules=[...this.rules],t.defaultValue=e,t}async validate(e,t){let r=[];for(let n of this.rules){let a=await n.validate(e,t);if(a!==!0)r.push(a)}return r}validateSync(e,t){let r=[];for(let n of this.rules){if(n.async)continue;let a=n.validate(e,t);if(a!==!0)r.push(a)}return r}}var Xm=new Kn;function xu(e,t,r){let n=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>R(c,{...t,message:l},r)).join(`
|
|
3
3
|
`)}catch{return""}})}function Su(e,t,r){let n=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>R(c,{...t,message:l},r)).join(`
|
|
4
4
|
`)}catch{return""}})}function ku(e,t,r){let n=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return c}catch{return""}})}function Jm(e,t,r){let n=e;return n=xu(n,t,r),n=Su(n,t,r),n=ku(n,t,r),n}export{Ra,vu,Kn,Xm,xu,Su,ku,Jm};
|
|
@@ -825,5 +825,5 @@ self.addEventListener('message', (event) => {
|
|
|
825
825
|
event.waitUntil(registerFormSync(event.data.payload));
|
|
826
826
|
}
|
|
827
827
|
});
|
|
828
|
-
`}function Gt(e){return e.pwa?.serviceWorker?.fileName||"sw.js"}function
|
|
829
|
-
export{ao,Gt,
|
|
828
|
+
`}function Gt(e){return e.pwa?.serviceWorker?.fileName||"sw.js"}function Ml(e){return e.pwa?.enabled===!0&&e.pwa?.serviceWorker?.useWorkbox===!0}function Vg(e,a){if(!e.pwa?.enabled)return"";if(Ml(e)){let{generateWorkboxServiceWorker:t}=import.meta.require("./chunk-8arfg8kp.js");return t(e,a)}return ao(e,a)}
|
|
829
|
+
export{ao,Gt,Ml,Vg};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{O,t,u}from"./chunk-
|
|
2
|
+
import{O,t,u}from"./chunk-g0xn80gz.js";import{ne}from"./chunk-rme1a5qv.js";import{si}from"./chunk-tnp2ta5q.js";import E from"path";var S;async function W(){if(S!==void 0)return S;try{let e=await import("@stacksjs/ts-i18n");S=e.loadLocale??null}catch{S=null}return S}var T={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},v={},L={},k={};function J(e,s=0){if(s<=0)return!1;return Date.now()-e.loadedAt>s}async function G(e,s){if({...T,...s.i18n}.cache&&v[e]){let r=v[e],o=s.i18n?.cacheMaxAge??0;if(!J(r,o))return r.translations}if(L[e]?.state==="loading")return L[e].promise;k[e]="loading";let n=C(e,s).then((r)=>(k[e]="loaded",delete L[e],r)).catch((r)=>{throw k[e]="error",L[e]={promise:n,state:"error",error:r instanceof Error?r:Error(String(r))},r});return L[e]={promise:n,state:"loading"},n}async function C(e,s){let i={...T,...s.i18n},n=E.isAbsolute(i.translationsDir)?i.translationsDir:E.resolve(s.root||process.cwd(),i.translationsDir);try{let r=await W(),o=r?await r(e,{translationsDir:n,defaultLocale:i.defaultLocale,sources:ee(i.format)}):await Y(e,i,n);if(o===void 0){let c=e!==i.defaultLocale?await C(i.defaultLocale,s):{};if(i.cache)v[e]={translations:c,loadedAt:Date.now(),locale:e};return c}let l=o;if(i.cache)v[e]={translations:l,loadedAt:Date.now(),locale:e};return l}catch(r){if(s.debug)console.error(`Error loading translation file for locale "${e}":`,r);if(e!==i.defaultLocale)return C(i.defaultLocale,s);return{}}}async function Y(e,s,i){let n=E.join(i,`${e}${Z(s.format)}`);try{let r=await import(n);return r.default||r}catch(r){try{let o=await Bun.file(n).text();if(s.format==="yaml"||s.format==="yml")return Q(o);if(s.format==="json")return JSON.parse(o);throw r}catch{return}}}function Z(e){switch(e){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function Q(e){let s={},i=e.split(`
|
|
3
3
|
`),n=[{obj:s,indent:-1}];for(let r of i){let o=r.replace(/#.*$/,"").trimEnd();if(!o.trim())continue;let l=o.search(/\S/);if(l===-1)continue;while(n.length>1&&n[n.length-1].indent>=l)n.pop();let c=n[n.length-1].obj,a=o.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(a){let[,,g,p]=a,f=g.trim(),m=p.trim();if(m==="")c[f]={},n.push({obj:c[f],indent:l});else c[f]=X(m)}}return s}function X(e){if(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);let s=e.toLowerCase();if(s==="true"||s==="yes")return!0;if(s==="false"||s==="no")return!1;if(s==="null"||s==="~")return null;let i=Number(e);if(!Number.isNaN(i)&&e!=="")return i;return e}function ee(e){switch(e){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function te(e,s){return G(e,s)}function re(e,s){for(let i of e){let n=i.trim(),r=n.match(/^\{(\d+)\}\s*(.*)$/);if(r){let l=Number.parseInt(r[1],10);if(s===l)return r[2];continue}let o=n.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(o){let l=Number.parseInt(o[1],10),c=o[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(o[2],10);if(s>=l&&s<=c)return o[3];continue}}if(e.length===2)return s===1?e[0].trim():e[1].trim();if(s<e.length)return e[s].trim();return e[e.length-1].trim()}function ie(e,s={}){return j(e,s)}function j(e,s){let i="",n=0;while(n<e.length)if(e[n]==="{"){let r=se(e,n);if(r===-1){i+=e[n],n++;continue}let o=e.slice(n+1,r);i+=ae(o,s),n=r+1}else if(e[n]==="'"&&n+1<e.length)if(e[n+1]==="'")i+="'",n+=2;else if(e[n+1]==="{"||e[n+1]==="}")i+=e[n+1],n+=2;else i+=e[n],n++;else i+=e[n],n++;return i}function se(e,s){let i=0;for(let n=s;n<e.length;n++)if(e[n]==="{")i++;else if(e[n]==="}"){if(i--,i===0)return n}return-1}function ae(e,s){let i=oe(e);if(i.length===0)return`{${e}}`;let n=i[0].trim(),r=s[n];if(i.length===1)return r!==void 0?String(r):`{${n}}`;switch(i[1].trim().toLowerCase()){case"plural":return le(r,i.slice(2).join(","),s);case"select":return ue(r,i.slice(2).join(","));case"selectordinal":return de(r,i.slice(2).join(","));case"number":return pe(r,i[2]?.trim());case"date":return fe(r,i[2]?.trim());case"time":return me(r,i[2]?.trim());default:return r!==void 0?String(r):`{${e}}`}}function oe(e){let s=[],i="",n=0;for(let r=0;r<e.length;r++){let o=e[r];if(o==="{")n++,i+=o;else if(o==="}")n--,i+=o;else if(o===","&&n===0)s.push(i),i="";else i+=o}if(i)s.push(i);return s}function le(e,s,i){let n=Number(e)||0,r=P(s),o=`=${n}`;if(r[o])return R(r[o],n,i);let l=ce(n);if(r[l])return R(r[l],n,i);if(r.other)return R(r.other,n,i);return String(n)}function R(e,s,i){let n=e.replace(/#/g,String(s));return j(n,i)}function ce(e){let s=Math.abs(e),i=Math.floor(s),n=String(e).includes(".")?String(e).split(".")[1].length:0;if(i===1&&n===0)return"one";return"other"}function ue(e,s){let i=String(e||""),n=P(s);if(n[i])return n[i];return n.other||String(e)}function de(e,s){let i=Number(e)||0,n=P(s),r=ge(i);if(n[r])return n[r].replace(/#/g,String(i));if(n.other)return n.other.replace(/#/g,String(i));return String(i)}function ge(e){let s=Math.abs(e),i=s%10,n=s%100;if(i===1&&n!==11)return"one";if(i===2&&n!==12)return"two";if(i===3&&n!==13)return"few";return"other"}function P(e){let s={},i=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,n=i.exec(e);while(n!==null)s[n[1]]=n[2],n=i.exec(e);return s}function pe(e,s){let i=Number(e);if(Number.isNaN(i))return String(e);switch(s){case"integer":return Math.floor(i).toLocaleString();case"percent":return`${(i*100).toFixed(0)}%`;case"currency":return i.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return i.toLocaleString()}}function fe(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let n={};switch(s){case"short":n.dateStyle="short";break;case"medium":n.dateStyle="medium";break;case"long":n.dateStyle="long";break;case"full":n.dateStyle="full";break;default:n.dateStyle="medium"}return i.toLocaleDateString(void 0,n)}function me(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let n={};switch(s){case"short":n.timeStyle="short";break;case"medium":n.timeStyle="medium";break;case"long":n.timeStyle="long";break;case"full":n.timeStyle="full";break;default:n.timeStyle="short"}return i.toLocaleTimeString(void 0,n)}function be(e){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(e)}function N(e,s,i=!0,n={}){let r=e.split("."),o=s;for(let c of r){if(o===void 0||o===null)break;o=o[c]}if(o===void 0||o===null)return i?e:"";let l=String(o);if(be(l))return ie(l,n);if(l.includes("|")&&"count"in n){let c=Number(n.count),a=l.split("|");l=re(a,c)}for(let[c,a]of Object.entries(n)){let g=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");l=l.replace(new RegExp(`:${g}`,"g"),()=>String(a))}return l}var D=new Set(["ar","arc","ckb","dv","fa","he","khw","ks","nqo","prs","ps","sd","syr","ug","ur","uz-af","yi"]),he=new Set(["adlm","arab","aran","hebr","nkoo","rohg","syrc","thaa","yezi"]);function q(e){if(!e)return"ltr";let s=e.trim().toLowerCase().replace(/_/g,"-").split("-"),i=s[0];if(!i)return"ltr";let n=s[1]?.length===4?s[1]:void 0;if(n)return he.has(n)?"rtl":"ltr";if(s.length>1&&D.has(`${i}-${s[1]}`))return"rtl";return D.has(i)?"rtl":"ltr"}async function Rc(e,s,i,n){let r=e,o=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,l={...T,...n.i18n},c=await te(l.locale,n);s.__translations=c,s.__locale=l.locale,s.__i18nConfig=l,r=await F(r,o,async(p,f,m,w,h)=>{try{let b={};if(m)try{let d=[()=>JSON.parse(m),()=>{let x=`{"data":${m}}`,A=JSON.parse(x);return typeof A.data==="object"?A.data:{}},()=>O(m,s)];for(let x of d)try{if(b=x(),Object.keys(b).length>0)break}catch{}}catch(d){if(n.debug)console.error("Error parsing parameters for @translate directive:",d)}let y=N(f,c,l.fallbackToKey,b);return y?ne(r,h,y,!1,p.length):w.trim()}catch(b){if(n.debug)console.error("Error processing @translate directive:",b);return u("Translate",`Error in @translate('${f}'): ${b instanceof Error?b.message:String(b)}`,t.EVALUATION_ERROR)}});let a=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(n.debug){console.warn(`Processing translations in template. Sections: ${r.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let p=[...r.matchAll(a)];console.warn(`Found ${p.length} @translate matches`),p.forEach((f,m)=>console.warn(`Match ${m}: ${f[0]}, Key: ${f[1]}, Params: ${f[2]||"none"}`))}return r=await F(r,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(p,f,m,w)=>{try{let h={};if(m)try{let b=[()=>JSON.parse(m),()=>{let y=`{"data":${m}}`,d=JSON.parse(y);return typeof d.data==="object"?d.data:{}},()=>O(m,s)];for(let y of b)try{if(h=y(),Object.keys(h).length>0)break}catch{}}catch(b){if(n.debug)console.error("Error parsing parameters for @translate directive:",b)}return ne(r,w,N(f,c,l.fallbackToKey,h),!1,p.length)}catch(h){if(n.debug)console.error("Error processing @translate directive:",h);return u("Translate",`Error in @translate('${f}'): ${h instanceof Error?h.message:String(h)}`,t.EVALUATION_ERROR)}}),r}async function F(e,s,i){let n=[];return e.replace(s,(o,...l)=>{let c=i(o,...l).then((a)=>({match:o,replacement:a}));return n.push(c),o}),(await Promise.all(n)).reduce((o,{match:l,replacement:c})=>o.replace(l,()=>c),e)}function _(e,s){if(!e||q(e)!=="rtl")return!1;return!s||s.trim().toLowerCase()!=="rtl"}function V(e){if(!e)return!1;return e.trim().split(/\s+/)[0]?.toLowerCase()==="presentation"||e.trim().split(/\s+/)[0]?.toLowerCase()==="none"}function I(e,s){let i=new RegExp(`\\b${s}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(e);if(!i)return null;return i[2]??i[3]??i[4]??null}function Ac(e,s,i,n){let r=e;r=r.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,c,a)=>{let p={"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"}[c]||"Make this element accessible";return`<!-- a11y-hint: ${a||p} -->`});let o=/@screenReader\(([^@]*)\)@endScreenReader/g;return r=r.replace(o,(l,c)=>`<span class="sr-only">${c.trim()}</span>`),r=r.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(l,c,a)=>`<span id="${`desc-${c}`}" class="sr-only">${a}</span>`),r}function ye(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function xe(e){let s=new Map,i=e.replace(/<(\/?)([A-Z][\w:.-]*)(?=[\s/>])/g,(r,o,l)=>{let c=s.get(l);if(!c)c=`stx-a11y-component-${s.size}`,s.set(l,c);return`<${o}${c}`}),n=new Map([...s.entries()].map(([r,o])=>[o,r]));return{protectedSource:i,restore:(r)=>r.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(o,l,c)=>{let a=n.get(c);return a?`<${l}${a}`:o})}}function we(e,s){let i=[],n=/<img\s+([^>]*)>/gi,r;r=n.exec(e);while(r!==null){let d=r[1];if(!/\balt\s*=/i.test(d))i.push({type:"missing-alt",element:r[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/"});r=n.exec(e)}let o=/<button([^>]*)>\s*<\/button>/gi;r=o.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"missing-accessible-name",element:r[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/"});r=o.exec(e)}let l=/<a\s+([^>]*)>\s*<\/a>/gi;r=l.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"link-missing-text",element:r[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"});r=l.exec(e)}let c=/<(input|select|textarea)\s+([^>]*)>/gi;r=c.exec(e);while(r!==null){let d=r[2];if(/\btype\s*=\s*["']hidden["']/i.test(d)){r=c.exec(e);continue}let x=/\baria-label\s*=/i.test(d)||/\baria-labelledby\s*=/i.test(d),A=d.match(/\bid\s*=\s*["']([^"']+)["']/i);if(!x){let B=A&&new RegExp(`<label[^>]*\\bfor\\s*=\\s*["']${A[1]}["']`,"i").test(e),U=r.index,M=e.substring(0,U),Se=e.substring(U),H=(M.match(/<label\b/gi)||[]).length,z=(M.match(/<\/label>/gi)||[]).length,K=H>z;if(!B&&!K)i.push({type:"input-missing-label",element:r[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/"})}r=c.exec(e)}let a=/<h([1-6])[^>]*>/gi,g=[];r=a.exec(e);while(r!==null)g.push(Number.parseInt(r[1],10)),r=a.exec(e);let p=0;for(let d of g){if(p>0&&d>p+1)i.push({type:"heading-skip",element:`<h${d}>`,message:`Heading level skipped from h${p} to h${d}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});p=d}if(/<html\b/i.test(e)&&!/<html[^>]*\slang\s*=/i.test(e))i.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 f=e.match(/<html\b([^>]*)>/i);if(f&&_(I(f[1],"lang"),I(f[1],"dir")))i.push({type:"missing-dir",element:f[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 m=/<table([^>]*)>([\s\S]*?)<\/table>/gi;r=m.exec(e);while(r!==null){let d=r[2];if(!V(I(r[1],"role"))&&!/<th\b/i.test(d))i.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"});r=m.exec(e)}let w=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;r=w.exec(e);while(r!==null){if(!/\bmuted\b/i.test(r[0]))i.push({type:"autoplay-audio",element:`<${r[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"});r=w.exec(e)}let h=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;r=h.exec(e);while(r!==null)i.push({type:"positive-tabindex",element:`tabindex="${r[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"}),r=h.exec(e);let b=/<iframe\s+([^>]*)>/gi;r=b.exec(e);while(r!==null){let d=r[1];if(!/\btitle\s*=/i.test(d)&&!/\baria-label\s*=/i.test(d))i.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"});r=b.exec(e)}let y=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;r=y.exec(e);while(r!==null){let d=r[1].toLowerCase(),x=r[2];if(d!=="button"&&!/\btabindex\s*=/i.test(x))i.push({type:"button-not-focusable",element:r[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/"});r=y.exec(e)}return i}async function Ae(e,s){let{protectedSource:i}=xe(e);if(!ye())return we(i,s);let n=[];try{let r=globalThis.document.createElement("div");r.innerHTML=i,r.querySelectorAll("img").forEach((a)=>{if(!a.hasAttribute("alt"))n.push({type:"missing-alt",element:`<${a.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),r.querySelectorAll('button, a, [role="button"]').forEach((a)=>{if(!(a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby")||a.textContent&&a.textContent.trim().length>0))n.push({type:"missing-accessible-name",element:`<${a.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/"})}),r.querySelectorAll("input, select, textarea").forEach((a)=>{let g=a.getAttribute("id"),p=g&&r.querySelector(`label[for="${g}"]`),f=a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby"),m=a.closest("label")!==null;if(!p&&!f&&!m)n.push({type:"input-missing-label",element:`<${a.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 o=Array.from(r.querySelectorAll("h1, h2, h3, h4, h5, h6")),l=0;for(let a of o){let g=Number.parseInt(a.tagName.charAt(1));if(l>0&&g>l+1)n.push({type:"heading-skip",element:`<${a.outerHTML}>`,message:`Heading level skipped from h${l} to h${g}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});l=g}let c=r.querySelector("html");if(i.includes("<html")&&c&&!c.hasAttribute("lang"))n.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(c&&_(c.getAttribute("lang"),c.getAttribute("dir")))n.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(r.querySelectorAll("a").forEach((a)=>{let g=a.textContent&&a.textContent.trim().length>0,p=a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby"),f=a.hasAttribute("title"),m=a.querySelector("img[alt]");if(!g&&!p&&!f&&!m)n.push({type:"link-missing-text",element:`<${a.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"})}),i.includes("<nav")||i.includes("<header")){if(!r.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&r.querySelectorAll("a").length>5)n.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(r.querySelectorAll("table").forEach((a)=>{if(V(a.getAttribute("role")))return;let g=a.querySelector("caption");if(!a.querySelector("th"))n.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(!g&&!a.hasAttribute("aria-label")&&!a.hasAttribute("aria-labelledby"))n.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"})}),r.querySelectorAll('[style*="color"]').forEach((a)=>{let g=a.getAttribute("style")||"";if(g.includes("color:")&&!g.includes("background"))n.push({type:"potential-contrast-issue",element:`<${a.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/"})}),r.querySelectorAll("video[autoplay], audio[autoplay]").forEach((a)=>{if(!a.hasAttribute("muted"))n.push({type:"autoplay-audio",element:`<${a.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"})}),r.querySelectorAll("[tabindex]").forEach((a)=>{if(Number.parseInt(a.getAttribute("tabindex")||"0")>0)n.push({type:"positive-tabindex",element:`<${a.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"})}),r.querySelectorAll('[role="button"]').forEach((a)=>{if(!a.hasAttribute("tabindex"))n.push({type:"button-not-focusable",element:`<${a.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/"})}),i.includes("<body")&&!r.querySelector('main, [role="main"]'))n.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"});r.querySelectorAll("iframe").forEach((a)=>{if(!a.hasAttribute("title")&&!a.hasAttribute("aria-label"))n.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(r){console.error(`Error checking accessibility in ${s}:`,r)}return n}async function Pc(e,s={}){let i={},{recursive:n=!0,ignorePaths:r=[]}=s,o=Array.isArray(e)?e:[e],l=await si(o,{recursive:n,ignorePaths:r}),c=[];for(let a of l)try{let g=await Bun.file(a).text();if(a.endsWith("good-a11y.stx"))continue;let p=await Ae(g,a);if(c.push(a),p.length>0)i[a]=p}catch(g){console.error(`Error scanning ${a}:`,g)}return{results:i,scannedFiles:c}}var Ic={name:"a11y",handler:(e,s,i,n)=>{if(!s.length)return e;let r=s[0].replace(/['"]/g,""),o=s.length>1?s[1].replace(/['"]/g,""):"",c={"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"}[r]||"Make this element accessible";return`<!-- a11y-hint: ${o||c} -->${e}`},hasEndTag:!1},Oc={name:"screenReader",handler:(e)=>`<span class="sr-only">${e}</span>`,hasEndTag:!0};
|
|
4
4
|
export{Rc,Ac,Pc,Ic,Oc};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Nf,Df,xe,Mf,pc,cn,ln,Fh,fc,un,ir,Lf,jf,Bf,ds,Ff,zf,gc,dn,Hf,pn,mc,zh}from"./chunk-mrw6vmqy.js";import"./chunk-fh8jzm4b.js";import"./chunk-9zrvh3pz.js";import"./chunk-83qwwnye.js";import"./chunk-y69k2fww.js";import"./chunk-tnp2ta5q.js";import"./chunk-rw5492e2.js";import"./chunk-83tvkw4y.js";import"./chunk-kh6njq2r.js";import"./chunk-rme1a5qv.js";import"./chunk-4w8a7f8t.js";import"./chunk-k32q90b2.js";import"./chunk-g0xn80gz.js";import"./chunk-farh4p7f.js";import"./chunk-qjey0jk6.js";export{ir as MODULE_SPECIFIER_PREFIX,gc as assertBundleBuildCanSettle,Nf as bundleCacheDir,Df as bundleCacheEntryLimit,zh as bundleClientEntriesSplit,pn as bundleClientScript,ln as clearBundleFailures,xe as clientBundleDependencies,cn as getBundleFailures,un as hasUserImports,zf as isWithinBundlerCallback,dn as moduleSubstitutionKey,jf as normalizeRegistrySpecifiers,Hf as queueClientBundleBuild,pc as recordBundleFailure,Lf as registryIdForPath,fc as resolveBundlerFallback,Bf as rewriteRegistryImports,Fh as setBundlerFallbackMode,Mf as shouldLogBundlerDiagnostics,mc as tempBuildName,ds as withModuleSubstitutes,Ff as withinBundlerCallback};
|