@stacksjs/stx 0.2.503 → 0.2.506
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/browser-core-imports.d.ts +1 -1
- package/dist/browser-core-imports.js +1 -2
- package/dist/builtins/attrs.d.ts +2 -0
- package/dist/builtins/attrs.js +102 -0
- package/dist/{chunk-3mynjdqr.js → chunk-068ank60.js} +3 -3
- package/dist/{chunk-yvt8zszz.js → chunk-06v0c3fz.js} +1 -1
- package/dist/chunk-0eptxhzy.js +2 -0
- package/dist/{chunk-15w4adyd.js → chunk-0vnr7mz7.js} +8 -8
- package/dist/{chunk-bv7bsdfe.js → chunk-1149d93e.js} +2 -2
- package/dist/chunk-1b7dd8rn.js +2 -0
- package/dist/{chunk-0egg3666.js → chunk-1verz406.js} +5 -5
- package/dist/{chunk-7cbtcdqw.js → chunk-2etevws0.js} +2 -2
- package/dist/chunk-2h4bf7m4.js +2 -0
- package/dist/{chunk-z9fz5dby.js → chunk-2j04bc8c.js} +2 -2
- package/dist/{chunk-40jd0b4h.js → chunk-2wr0sk42.js} +1 -1
- package/dist/chunk-36rwfhnb.js +2 -0
- package/dist/{chunk-b5mcvm6y.js → chunk-38xtsdk9.js} +6 -6
- package/dist/chunk-3c9t71pc.js +2 -0
- package/dist/chunk-3pczp9c0.js +2 -0
- package/dist/{chunk-jwjggr91.js → chunk-3ynfz6h8.js} +2 -2
- package/dist/{chunk-1v86h5vn.js → chunk-46wre9ep.js} +3 -3
- package/dist/{chunk-rhrv2j36.js → chunk-4hz4g5ym.js} +2 -2
- package/dist/chunk-4w358hpx.js +2 -0
- package/dist/{chunk-33snwgdy.js → chunk-5dh041x0.js} +3 -3
- package/dist/{chunk-802qf0vz.js → chunk-5q9rmcp7.js} +1 -1
- package/dist/{chunk-qmcmjdy7.js → chunk-5tbqdz94.js} +7 -7
- package/dist/{chunk-zv0vgamy.js → chunk-5tkzfw4s.js} +3 -3
- package/dist/{chunk-25m2wqsd.js → chunk-5zm23zrb.js} +38 -12
- package/dist/{chunk-szry3s17.js → chunk-68tzytfz.js} +3 -3
- package/dist/chunk-76g4jw9g.js +2 -0
- package/dist/{chunk-93sr9q8g.js → chunk-7p6y0b47.js} +1 -1
- package/dist/chunk-7sjmpfwy.js +18 -0
- package/dist/chunk-7z28hk7r.js +2 -0
- package/dist/chunk-8nx5asjr.js +2 -0
- package/dist/chunk-8ptefdpy.js +2 -0
- package/dist/{chunk-cp7hph6f.js → chunk-8xpyzcq2.js} +1 -1
- package/dist/chunk-8zj1ebs5.js +2 -0
- package/dist/{chunk-c8psbk2e.js → chunk-91y360rc.js} +1 -1
- package/dist/chunk-96kr2xrt.js +2828 -0
- package/dist/{chunk-b77v56fz.js → chunk-9p3rtfbv.js} +9 -9
- package/dist/chunk-9xw416q3.js +2 -0
- package/dist/chunk-9z76qhdm.js +2 -0
- package/dist/{chunk-zqxqdns1.js → chunk-9z8mxp15.js} +1 -1
- package/dist/chunk-ag1j84s6.js +2 -0
- package/dist/{chunk-d4k4nyj0.js → chunk-ba88n1j7.js} +2 -2
- package/dist/chunk-c2vwq6gr.js +2 -0
- package/dist/{chunk-2kyfaa0p.js → chunk-c322rrge.js} +2 -2
- package/dist/chunk-cb1c9mvc.js +2 -0
- package/dist/chunk-ces3vdjp.js +2 -0
- package/dist/{chunk-stvqwzen.js → chunk-cprcfp0j.js} +2 -2
- package/dist/chunk-dn4tww9q.js +2 -0
- package/dist/chunk-dne8n6h3.js +3 -0
- package/dist/chunk-dv94gdv4.js +2 -0
- package/dist/chunk-e4zks32s.js +2 -0
- package/dist/{chunk-h0sd5cda.js → chunk-ea19gveh.js} +5 -5
- package/dist/{chunk-tvag2s5a.js → chunk-eacd5755.js} +1 -1
- package/dist/{chunk-8fb1mqw1.js → chunk-ej46bkaw.js} +1 -1
- package/dist/{chunk-1hpttjgq.js → chunk-fh5rp6wb.js} +1 -1
- package/dist/chunk-fkv8jmse.js +2 -0
- package/dist/{chunk-vtn0gmen.js → chunk-fwvqbx49.js} +8 -8
- package/dist/chunk-g1r4v0mc.js +3 -0
- package/dist/{chunk-2pph3dh0.js → chunk-g495xx4v.js} +5 -5
- package/dist/{chunk-vp827ah7.js → chunk-g7wgpys2.js} +4 -4
- package/dist/chunk-gw9ax7xx.js +2 -0
- package/dist/{chunk-4ssg2hn4.js → chunk-h37bbgg8.js} +1 -1
- package/dist/chunk-h3rrsq05.js +2 -0
- package/dist/{chunk-z6nm6rf1.js → chunk-h6z4s5p3.js} +1 -1
- package/dist/chunk-h87zhtw8.js +2 -0
- package/dist/chunk-h9reptxv.js +45 -0
- package/dist/{chunk-vs0ebfg5.js → chunk-hka18tmt.js} +1 -1
- package/dist/chunk-j08y5n2k.js +2 -0
- package/dist/chunk-j7nd8zfe.js +2 -0
- package/dist/{chunk-z9tvn738.js → chunk-jcmgj8kk.js} +1 -1
- package/dist/chunk-jtwx2xte.js +2 -0
- package/dist/{chunk-gvkfydq5.js → chunk-k2331dfx.js} +1 -1
- package/dist/chunk-k5syze27.js +2 -0
- package/dist/{chunk-258qj7pt.js → chunk-km9g9drp.js} +1 -1
- package/dist/{chunk-t61vdbje.js → chunk-ktvr45qg.js} +6 -6
- package/dist/chunk-kxvtyh05.js +2 -0
- package/dist/chunk-mq6expbd.js +2 -0
- package/dist/chunk-mvqhf6dn.js +2 -0
- package/dist/chunk-mz7snf2b.js +2 -0
- package/dist/chunk-n1hd2fx6.js +2 -0
- package/dist/{chunk-298s08st.js → chunk-n34kagea.js} +2 -2
- package/dist/chunk-nnrtwpvy.js +2 -0
- package/dist/chunk-pecwdp57.js +2 -0
- package/dist/{chunk-tdetcthb.js → chunk-ph1xz7k5.js} +2 -2
- package/dist/chunk-pj562qnx.js +2 -0
- package/dist/chunk-pzcw3trh.js +2 -0
- package/dist/{chunk-4mrgy3ve.js → chunk-qt31at4s.js} +4 -4
- package/dist/{chunk-4c1afy15.js → chunk-qv57r0fa.js} +1 -1
- package/dist/{chunk-qhnpc3ac.js → chunk-r14mvycg.js} +22 -22
- package/dist/chunk-r5fzxtbc.js +2 -0
- package/dist/{chunk-vg9dyc4y.js → chunk-rvwtyrj4.js} +1 -1
- package/dist/{chunk-dve4q9tg.js → chunk-s87qrma5.js} +3 -3
- package/dist/chunk-spg0fzyv.js +2 -0
- package/dist/{chunk-hqvdm4h9.js → chunk-t77pz252.js} +1 -1
- package/dist/chunk-t7djn7zd.js +2 -0
- package/dist/{chunk-tse7jzmz.js → chunk-tf239jvd.js} +1 -1
- package/dist/{chunk-gzt3ghgq.js → chunk-tkagcknf.js} +2 -2
- package/dist/{chunk-xevnx24r.js → chunk-tnxprz69.js} +2 -2
- package/dist/{chunk-81t6zr3m.js → chunk-v74acg2k.js} +2 -2
- package/dist/{chunk-f0prq6yw.js → chunk-vc1m5fr9.js} +1 -1
- package/dist/{chunk-jbvg29t0.js → chunk-vftdacyb.js} +1 -1
- package/dist/{chunk-hktvv0hd.js → chunk-vtxzaj1h.js} +2 -2
- package/dist/chunk-w925gtgg.js +2 -0
- package/dist/chunk-w9kj6t7s.js +2 -0
- package/dist/{chunk-b90y5phw.js → chunk-w9mxt96c.js} +78 -78
- package/dist/{chunk-d19vgjjt.js → chunk-x81vcxzs.js} +2 -2
- package/dist/{chunk-rmavqxd8.js → chunk-xd4zvm4x.js} +2 -2
- package/dist/{chunk-x8mp9yvn.js → chunk-xemsypk7.js} +4 -4
- package/dist/{chunk-71bbv43t.js → chunk-xx2pk2ay.js} +3 -3
- package/dist/{chunk-74j18qk0.js → chunk-y8h823cb.js} +28 -28
- package/dist/chunk-yn2d8x8m.js +3 -0
- package/dist/{chunk-hmyyq2hh.js → chunk-z2775k8r.js} +1 -1
- package/dist/{chunk-1erc0vrb.js → chunk-zz5b1g50.js} +2 -2
- package/dist/cli.js +44 -44
- package/dist/component-renderer.js +84 -36
- package/dist/composables/index.d.ts +4 -0
- package/dist/composables/index.js +5 -1
- package/dist/composables/use-timer.d.ts +8 -0
- package/dist/composables/use-timer.js +4 -0
- package/dist/config.js +24 -7
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/native/bridge/protocol.d.ts +3 -0
- package/dist/native/cli.d.ts +1 -0
- package/dist/native/cli.js +7 -2
- package/dist/native/compiler/bundle.d.ts +1 -0
- package/dist/native/compiler/bundle.js +27 -7
- package/dist/native/compiler/html-to-ir.d.ts +3 -1
- package/dist/native/compiler/html-to-ir.js +13 -0
- package/dist/native/runtime/craft-bridge.js +9 -1
- package/dist/native/runtime/craft.d.ts +2 -0
- package/dist/native/runtime/native-host.d.ts +1 -0
- package/dist/native/runtime/native-host.js +1 -0
- package/dist/native/runtime/shared-screen.d.ts +21 -0
- package/dist/native/runtime/shared-screen.js +43 -0
- package/dist/pwa.js +3 -3
- package/dist/runtime-globals.js +4 -0
- package/dist/signals.js +34 -8
- package/dist/ssg.js +2 -2
- package/dist/stx-module.d.ts +4 -0
- package/dist/stx.d.ts +8 -0
- package/dist/utils.d.ts +3 -1
- package/dist/utils.js +12 -2
- package/package.json +6 -6
- package/stx-module.d.ts +4 -0
- package/stx.d.ts +8 -0
- package/dist/chunk-0adrp7qd.js +0 -2
- package/dist/chunk-0vdxchfw.js +0 -2
- package/dist/chunk-1mrn5s5z.js +0 -2
- package/dist/chunk-2gr5zcm3.js +0 -2
- package/dist/chunk-2grygc4b.js +0 -2
- package/dist/chunk-379nn8yc.js +0 -2
- package/dist/chunk-3vqabd10.js +0 -2
- package/dist/chunk-490f2x2r.js +0 -2
- package/dist/chunk-4j2ej7er.js +0 -2
- package/dist/chunk-4rmdngzw.js +0 -2
- package/dist/chunk-52saa2nj.js +0 -2
- package/dist/chunk-69dc3tyz.js +0 -2
- package/dist/chunk-6v3p6cx1.js +0 -2
- package/dist/chunk-78vfptph.js +0 -2
- package/dist/chunk-7e6sxdp6.js +0 -2
- package/dist/chunk-7wxmsv41.js +0 -2
- package/dist/chunk-8qdvhbv7.js +0 -18
- package/dist/chunk-9mh1qq3g.js +0 -2
- package/dist/chunk-9z70zv10.js +0 -33
- package/dist/chunk-b0bgprzs.js +0 -2
- package/dist/chunk-c7cajwd2.js +0 -2
- package/dist/chunk-cg8hg6cs.js +0 -3
- package/dist/chunk-ckrpk6ak.js +0 -2
- package/dist/chunk-en0atzsp.js +0 -2
- package/dist/chunk-fxppbahx.js +0 -2
- package/dist/chunk-hhj1txvj.js +0 -2
- package/dist/chunk-j2q2pp0x.js +0 -2
- package/dist/chunk-jbj6xh7f.js +0 -3
- package/dist/chunk-jh385m2w.js +0 -2
- package/dist/chunk-kxg9q64a.js +0 -2
- package/dist/chunk-m9nr12a1.js +0 -2828
- package/dist/chunk-mdfrm5hv.js +0 -2
- package/dist/chunk-mq7vvaf4.js +0 -2
- package/dist/chunk-nfffn3s0.js +0 -2
- package/dist/chunk-nw7qvyek.js +0 -2
- package/dist/chunk-ny64ezsj.js +0 -2
- package/dist/chunk-qjba655t.js +0 -2
- package/dist/chunk-qjxxd4a0.js +0 -2
- package/dist/chunk-qsy7phd4.js +0 -2
- package/dist/chunk-rfq1jfhf.js +0 -2
- package/dist/chunk-rr41gk8b.js +0 -2
- package/dist/chunk-snyq0jj6.js +0 -2
- package/dist/chunk-sybzayv3.js +0 -2
- package/dist/chunk-v7vkqg8f.js +0 -3
- package/dist/chunk-v8m2khkq.js +0 -2
- package/dist/chunk-vbhykx9z.js +0 -2
- package/dist/chunk-xfxrh6vx.js +0 -2
- package/dist/chunk-xk2mwk61.js +0 -2
- package/dist/chunk-zbzmfqmk.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{t,i}from"./chunk-
|
|
2
|
+
import{t,i}from"./chunk-g495xx4v.js";import{Ge,Je,Ye,ue,we,E,rr,mn,fe}from"./chunk-9p3rtfbv.js";var I=/(?<![\w$@])@meta\s*\(/g,C=/(?<![\w$@])@metaTag\s*\(/g,k=/(?<![\w$@])@structuredData\s*\(/g,N=/(?<![\w$@])@seo\s*\(/g;function _(e,r){return(n)=>E(e,n,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX)}function j(e){return"property"in e?`<meta property="${l(e.property)}" content="${l(e.content)}">`:`<meta name="${l(e.name)}" content="${l(e.content)}">`}function $s(e,r,n,g){if(!e.includes("@meta"))return e;let a=Ge(e,I,(s,c)=>{let o=mn(Je(s),r);if(o.kind==="tag")return j(o.tag);if(o.kind==="empty")return"";return E("Meta",c,o.message,n,o.code)},_("Meta",n));return a=Ge(a,C,(s,c)=>{let o=Ye(s,r);if(!o.ok)return E("MetaTag",c,o.message,n,o.code);if(o.value===void 0||o.value===null)return"";if(!we(o.value))return E("MetaTag",c,`expected an object such as { name, content }, got ${ue(o.value)}`,n,t.TYPE_ERROR);let u=o.value;if(!u.name&&!u.property&&!u.httpEquiv)return E("MetaTag",c,"the tag needs a name, property or httpEquiv",n,t.INVALID_DIRECTIVE_SYNTAX);if(u.content===void 0||u.content===null||u.content===""||u.content===!1)return"";let p="<meta";if(u.name)p+=` name="${l(u.name)}"`;if(u.property)p+=` property="${l(u.property)}"`;if(u.httpEquiv)p+=` http-equiv="${l(u.httpEquiv)}"`;return p+=` content="${l(u.content)}">`,p},_("MetaTag",n)),a}function v(e){let r=(n)=>n["@context"]?{...n}:{...n,"@context":"https://schema.org"};if(we(e))return r(e);if(Array.isArray(e)&&e.length>0&&e.every(we))return e.map(r);return null}function A(e){return`<script type="application/ld+json">${JSON.stringify(e).replace(/<\//g,"<\\/")}</script>`}function Ts(e,r,n){if(!e.includes("@structuredData"))return e;return Ge(e,k,(g,a)=>{let s=Ye(g,r);if(!s.ok)return E("StructuredData",a,s.message,n,s.code);if(s.value===void 0||s.value===null)return"";let c=v(s.value);if(!c)return E("StructuredData",a,`expected an object or an array of objects, got ${ue(s.value)}`,n,t.TYPE_ERROR);try{return A(c)}catch(o){let u=o instanceof Error?o.message:String(o);return E("StructuredData",a,`the data cannot be written as JSON: ${u}`,n,t.EVALUATION_ERROR)}},_("StructuredData",n))}var L=new Set(["title","description","keywords","robots","canonical","openGraph","twitter","structuredData"]),R={image:"openGraph.image",url:"canonical or openGraph.url",type:"openGraph.type",siteName:"openGraph.siteName",locale:"openGraph.locale",og:"openGraph",author:"@meta('author', ...)"};function _s(e,r,n,g){if(!e.includes("@seo"))return e;return Ge(e,N,(a,s)=>{if(!a.trim())return E("SEO",s,"expected an object: @seo({ title, description }) or @seo(seoVariable)",n,t.INVALID_DIRECTIVE_SYNTAX);let c=Ye(a,r);if(!c.ok)return E("SEO",s,c.message,n,c.code);if(c.value===void 0||c.value===null)return"";if(!we(c.value))return E("SEO",s,`expected an object such as { title, description }, got ${ue(c.value)}`,n,t.TYPE_ERROR);try{return q(c.value,s,n)}catch(o){let u=o instanceof Error?o.message:String(o);return E("SEO",s,`Error processing @seo directive: ${u}`,n,t.EVALUATION_ERROR)}},_("SEO",n))}function b(e,r,n,g){let a=e[r];if(a===void 0||a===null||a===!1)return;if(we(a))return a;rr(n,`${r} must be an object, got ${ue(a)}; its tags were left out`,g);return}function q(e,r,n){let g=Object.keys(e).filter((o)=>!L.has(o));if(g.length>0){let o=g.map((u)=>R[u]?`${u} (use ${R[u]})`:u).join(", ");rr(r,`@seo does not read ${o}; ${g.length===1?"it was":"they were"} ignored`,n)}let a="";if(e.title)a+=`<title>${l(e.title)}</title>
|
|
3
3
|
`,a+=`<meta name="title" content="${l(e.title)}">
|
|
4
4
|
`;if(e.description)a+=`<meta name="description" content="${l(e.description)}">
|
|
5
5
|
`;if(e.keywords){let o=Array.isArray(e.keywords)?e.keywords.join(", "):e.keywords;a+=`<meta name="keywords" content="${l(o)}">
|
|
@@ -25,7 +25,7 @@ import{t,i}from"./chunk-2pph3dh0.js";import{Ge,Je,Ye,de,ve,E,rr,mn,fe}from"./chu
|
|
|
25
25
|
`}if(c.site)a+=`<meta name="twitter:site" content="${l(c.site)}">
|
|
26
26
|
`;if(c.creator)a+=`<meta name="twitter:creator" content="${l(c.creator)}">
|
|
27
27
|
`}if(e.structuredData!==void 0&&e.structuredData!==null){let o=v(e.structuredData);if(o)a+=`${A(o)}
|
|
28
|
-
`;else rr(r,`structuredData must be an object or an array of objects, got ${
|
|
28
|
+
`;else rr(r,`structuredData must be an object or an array of objects, got ${ue(e.structuredData)}; it was left out`,n)}return a.trim()}function Rs(e,r,n){if(n.seo?.enabled===!1)return e;if(e.includes("<!-- stx SEO Tags -->")||r.__stx_seo_staged===!0||n.skipDefaultSeoTags===!0)return e;let g=r.__stx_runtime_head;if(!!(g?.title||g?.meta?.some((S)=>S.property==="og:title"||S.name==="og:title"||S.name==="twitter:title"||S.name==="description")))return e;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test(e)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test(e)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test(e))return e;if(!e.includes("<head>")&&!e.includes("<head "))return e;let s=e.includes("<title>")||e.includes("</title>"),c=M(e),o=V(c),u=U(c),p="";if(r.title)p=r.title;else if(r.meta&&r.meta.title)p=r.meta.title;else if(o)p=o;else if(n.seo?.defaultConfig?.title)p=n.seo.defaultConfig.title;else p=n.defaultTitle||"stx Project";let m="";if(r.description)m=r.description;else if(r.meta&&r.meta.description)m=r.meta.description;else if(u)m=u;else if(n.seo?.defaultConfig?.description)m=n.seo.defaultConfig.description;else m=n.defaultDescription||"A website built with stx templating engine";let d="";if(r.image)d=r.image;else if(r.meta&&r.meta.image)d=r.meta.image;else if(r.openGraph&&r.openGraph.image)d=r.openGraph.image;else if(n.seo?.defaultImage)d=n.seo.defaultImage;else if(n.defaultImage)d=n.defaultImage;let f=s?"":`
|
|
29
29
|
<meta name="title" content="${l(p)}">`,D=G(c)?"":`
|
|
30
30
|
<meta name="description" content="${l(m)}">`,y=`
|
|
31
31
|
<!-- stx SEO Tags -->${f}${D}
|
|
@@ -43,7 +43,7 @@ import{t,i}from"./chunk-2pph3dh0.js";import{Ge,Je,Ye,de,ve,E,rr,mn,fe}from"./chu
|
|
|
43
43
|
${y}
|
|
44
44
|
`),h;return h.replace(/<head[^>]*>/,`$&
|
|
45
45
|
${y}
|
|
46
|
-
`)}function M(e){let r=e.search(/<\/head\s*>/i);return r===-1?e:e.slice(0,r)}function x(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�*39;|'/g,"'").replace(/&/g,"&")}function V(e){let r=e.match(/<title(?:\s[^>]*)?>([\s\S]*?)<\/title\s*>/i);return r?x(r[1].trim()):""}function O(e){return(e.match(/<meta\s[^>]*>/gi)||[]).filter((r)=>/\sname\s*=\s*["']description["']/i.test(r))}function G(e){return O(e).length>0}function U(e){for(let r of O(e)){let n=r.match(/\scontent\s*=\s*(?:"([^"]*)"|'([^']*)')/i),g=(n?.[1]??n?.[2]??"").trim();if(g)return x(g)}return""}function l(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var er={name:"meta",rawParams:!0,handler:(e,r,n,g)=>{let a=mn(r,n??{});if(a.kind==="error")return E("Meta",`@meta(${r.join(", ")})`,a.message,g,a.code);if(a.kind==="empty")return"";if(n)n.__stx_runtime_head=fe(n.__stx_runtime_head??{},{meta:[a.tag]});return""},hasEndTag:!1},tr={name:"structuredData",handler:(e,r,n,g)=>{if(e.trim()==="")return i("StructuredData","structuredData directive requires JSON-LD content",t.INVALID_DIRECTIVE_SYNTAX);try{let a=JSON.parse(e);if(!a["@context"])a["@context"]="https://schema.org";if(!a["@type"])return i("StructuredData","structuredData requires @type property",t.INVALID_DIRECTIVE_SYNTAX);return A(a)}catch(a){let s=a instanceof Error?a.message:String(a);return i("StructuredData",s,t.EVALUATION_ERROR)}},hasEndTag:!0};function
|
|
46
|
+
`)}function M(e){let r=e.search(/<\/head\s*>/i);return r===-1?e:e.slice(0,r)}function x(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�*39;|'/g,"'").replace(/&/g,"&")}function V(e){let r=e.match(/<title(?:\s[^>]*)?>([\s\S]*?)<\/title\s*>/i);return r?x(r[1].trim()):""}function O(e){return(e.match(/<meta\s[^>]*>/gi)||[]).filter((r)=>/\sname\s*=\s*["']description["']/i.test(r))}function G(e){return O(e).length>0}function U(e){for(let r of O(e)){let n=r.match(/\scontent\s*=\s*(?:"([^"]*)"|'([^']*)')/i),g=(n?.[1]??n?.[2]??"").trim();if(g)return x(g)}return""}function l(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var er={name:"meta",rawParams:!0,handler:(e,r,n,g)=>{let a=mn(r,n??{});if(a.kind==="error")return E("Meta",`@meta(${r.join(", ")})`,a.message,g,a.code);if(a.kind==="empty")return"";if(n)n.__stx_runtime_head=fe(n.__stx_runtime_head??{},{meta:[a.tag]});return""},hasEndTag:!1},tr={name:"structuredData",handler:(e,r,n,g)=>{if(e.trim()==="")return i("StructuredData","structuredData directive requires JSON-LD content",t.INVALID_DIRECTIVE_SYNTAX);try{let a=JSON.parse(e);if(!a["@context"])a["@context"]="https://schema.org";if(!a["@type"])return i("StructuredData","structuredData requires @type property",t.INVALID_DIRECTIVE_SYNTAX);return A(a)}catch(a){let s=a instanceof Error?a.message:String(a);return i("StructuredData",s,t.EVALUATION_ERROR)}},hasEndTag:!0};function Qd(){return[er,tr]}function eu(e,r){let{baseUrl:n,defaultChangefreq:g="weekly",defaultPriority:a=0.5,includeLastmod:s=!0}=r,c=n.replace(/\/$/,""),o=(m)=>m.startsWith("http")?m:`${c}${m.startsWith("/")?"":"/"}${m}`,u=e.map((m)=>{let d=o(m.loc),f=m.lastmod||(s?new Date().toISOString().split("T")[0]:void 0),D=m.changefreq||g,y=m.priority??a,h=` <url>
|
|
47
47
|
<loc>${T(d)}</loc>`;for(let w of m.alternates??[])h+=`
|
|
48
48
|
<xhtml:link rel="alternate" hreflang="${T(w.hreflang)}" href="${T(o(w.href))}"/>`;if(f)h+=`
|
|
49
49
|
<lastmod>${f}</lastmod>`;return h+=`
|
|
@@ -53,13 +53,13 @@ ${y}
|
|
|
53
53
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"${e.some((m)=>m.alternates?.length)?' xmlns:xhtml="http://www.w3.org/1999/xhtml"':""}>
|
|
54
54
|
${u.join(`
|
|
55
55
|
`)}
|
|
56
|
-
</urlset>`}function
|
|
56
|
+
</urlset>`}function tu(e,r){let n=r.replace(/\/$/,""),g=new Date().toISOString().split("T")[0];return`<?xml version="1.0" encoding="UTF-8"?>
|
|
57
57
|
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
58
58
|
${e.map((s)=>{let c=s.startsWith("http")?s:`${n}${s.startsWith("/")?"":"/"}${s}`;return` <sitemap>
|
|
59
59
|
<loc>${T(c)}</loc>
|
|
60
60
|
<lastmod>${g}</lastmod>
|
|
61
61
|
</sitemap>`}).join(`
|
|
62
62
|
`)}
|
|
63
|
-
</sitemapindex>`}async function
|
|
64
|
-
`).trim()}function
|
|
65
|
-
export{
|
|
63
|
+
</sitemapindex>`}async function nu(e,r){let{extensions:n=[".stx",".html",".htm"],ignore:g=["_*",".*","node_modules","components","partials","layouts"]}=r,a=[],s=n.length===1?`*${n[0]}`:`*{${n.join(",")}}`,c=new Bun.Glob(`**/${s}`);for await(let o of c.scan(e)){if(g.some((f)=>{if(f.startsWith("*"))return o.includes(f.slice(1));return o.startsWith(f)||o.includes(`/${f}`)}))continue;let p=o.replace(/\\/g,"/").replace(/index\.(stx|html|htm)$/,"").replace(/\.(stx|html|htm)$/,"");if(!p.startsWith("/"))p=`/${p}`;if(p!=="/"&&p.endsWith("/"))p=p.slice(0,-1);let m=`${e}/${o}`,d;try{let f=await Bun.file(m).stat();if(f)d=new Date(f.mtime).toISOString().split("T")[0]}catch{}a.push({loc:p||"/",lastmod:d,priority:p==="/"?1:0.5})}return a.sort((o,u)=>o.loc.localeCompare(u.loc)),a}function nr(e){let r=[];for(let n of e.rules){if(r.push(`User-agent: ${n.userAgent}`),n.allow)for(let g of n.allow)r.push(`Allow: ${g}`);if(n.disallow)for(let g of n.disallow)r.push(`Disallow: ${g}`);if(n.crawlDelay!==void 0)r.push(`Crawl-delay: ${n.crawlDelay}`);r.push("")}if(e.sitemap){let n=Array.isArray(e.sitemap)?e.sitemap:[e.sitemap];for(let g of n)r.push(`Sitemap: ${g}`)}if(e.host)r.push(`Host: ${e.host}`);return r.join(`
|
|
64
|
+
`).trim()}function ru(e){return nr({rules:[{userAgent:"*",allow:["/"]}],sitemap:e})}function T(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}
|
|
65
|
+
export{$s,Ts,_s,Rs,er,tr,Qd,eu,tu,nu,nr,ru};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
`)}async function Nr(t,e,a,c,r){let n=await z();if(!n)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let i=E(t);if(!await k(i))return null;let s=await
|
|
2
|
+
import{_,k,Ht,Vt,Ut}from"./chunk-tnxprz69.js";import{resolve as Q,basename as J,extname as K,join as Y}from"path";import{mkdir as Z}from"fs/promises";var N={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0};class Ar{config;constructor(t={}){this.config={...N,...t}}async get(t,e){return Ht(t,e,"video",this.config)}async set(t,e,a){return Vt(t,e,a,"video",this.config)}async clear(){return Ut("video",this.config)}updateConfig(t){this.config={...this.config,...t}}}var V=null;function T(t){if(!V)V=new Ar(t);else if(t)V.updateConfig(t);return V}async function Pr(t,e,a){let c=a?{directory:`${a.outputDir}/../.cache`}:{};return T(c).get(t,e)}async function Ir(t,e,a,c){let r=c?{directory:`${c.outputDir}/../.cache`}:{};return T(r).set(t,e,a)}async function ma(){return T().clear()}import{resolve as B,basename as D,extname as A,join as v}from"path";import{mkdir as M}from"fs/promises";async function L(){try{return await import("ts-videos")}catch{return null}}async function Dr(t,e,a,c){let r=await L();if(!r)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let n=B(t);if(!await k(n))return null;await M(a,{recursive:!0});let i=await _(n),s=D(t,A(t)),o=e.format||"webp",h=e.timestamp||0,y=`${s}-poster-${i}.${o}`,u=v(a,y),m=await r.extractThumbnails(n,{timestamps:[h],width:e.width||1280,height:e.height,format:o,quality:e.quality||85,outputDir:a,outputPattern:y.replace(`.${o}`,"")});if(m&&m.length>0){let d=m[0];return{path:u,url:`${c}/${y}`,width:d.width||e.width||1280,height:d.height||720,timestamp:h,size:d.size||0}}return null}catch(n){return console.warn(`[stx-media] Failed to generate poster: ${n}`),null}}async function Or(t,e,a,c){let r=await L();if(!r)return[];try{let n=B(t);if(!await k(n))return[];await M(a,{recursive:!0});let i=await _(n),s=D(t,A(t)),o=e.format||"webp",u=(await new r.Input(n).getInfo()).duration||60,m=e.count||10,d=e.interval||u/m,g=[];for(let f=0;f<m&&f*d<u;f++)g.push(f*d);let l=await r.extractThumbnails(n,{timestamps:g,width:e.width||320,format:o,quality:e.quality||80,outputDir:a,outputPattern:`${s}-thumb-${i}`});if(l&&l.length>0)return l.map((f,b)=>({path:f.path||v(a,`${s}-thumb-${i}-${b}.${o}`),url:`${c}/${s}-thumb-${i}-${b}.${o}`,width:f.width||e.width||320,height:f.height||180,timestamp:g[b],size:f.size||0}));return[]}catch(n){return console.warn(`[stx-media] Failed to generate thumbnails: ${n}`),[]}}async function ha(t,e,a,c){let r=await L();if(!r)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let n=B(t);if(!await k(n))return null;await M(a,{recursive:!0});let i=await _(n),s=D(t,A(t)),y=(await new r.Input(n).getInfo()).duration||60,u=e.columns||10,m=e.interval||5,d=e.thumbnailWidth||160,g=e.thumbnailHeight||90,l=e.format||"jpeg",f=Math.ceil(y/m),b=Math.ceil(f/u),S=`${s}-sprite-${i}.${l}`,w=v(a,S),C=[];for(let P=0;P<f;P++)C.push(P*m);let p=await r.extractThumbnails(n,{timestamps:C,width:d,height:g,format:l,quality:e.quality||70,outputDir:v(a,".temp")});if(!p||p.length===0)return null;try{let P=await import("ts-images"),x=u*d,ie=b*g,re=await P.createSprite({images:p.map((U)=>U.path),columns:u,padding:0,outputPath:w,format:l,quality:e.quality||70});return{url:`${c}/${S}`,path:w,columns:u,rows:b,thumbnailWidth:d,thumbnailHeight:g,interval:m,totalFrames:f}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(n){return console.warn(`[stx-media] Failed to generate sprite sheet: ${n}`),null}}import{resolve as E,basename as F,extname as W,join as R}from"path";import{mkdir as H,writeFile as q}from"fs/promises";async function z(){try{return await import("ts-videos")}catch{return null}}var j=[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000},{label:"360p",width:640,height:360,bitrate:600000,audioBitrate:64000}];async function Mr(t,e,a,c,r){let n=await z();if(!n)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let i=E(t);if(!await k(i))return null;let s=await _(i),o=F(t,W(t)),h=R(a,`${o}-${s}-hls`);await H(h,{recursive:!0});let y=e.length>0?e:j,u=r?.segmentDuration||6,g=(await new n.Input(i).getInfo()).duration||0,l=[],f=0;for(let w of y){let C=R(h,w.label);await H(C,{recursive:!0});let p=`${w.label}.m3u8`,P=R(C,p);try{let x=await n.generateHLS(i,{outputDir:C,segmentDuration:u,width:w.width,height:w.height,videoBitrate:w.bitrate,audioBitrate:w.audioBitrate,playlistName:w.label});if(x)l.push({quality:w,url:`${c}/${o}-${s}-hls/${w.label}/${p}`,path:P}),f+=x.segmentCount||Math.ceil(g/u)}catch(x){console.warn(`[stx-media] Failed to generate HLS for ${w.label}: ${x}`)}}if(l.length===0)return null;let b=R(h,"master.m3u8"),S=X(l,c,o,s);return await q(b,S),{manifestUrl:`${c}/${o}-${s}-hls/master.m3u8`,manifestPath:b,playlists:l,segmentCount:f,duration:g}}catch(i){return console.warn(`[stx-media] Failed to generate HLS manifest: ${i}`),null}}function X(t,e,a,c){let r=["#EXTM3U","#EXT-X-VERSION:3"];for(let n of t){let{quality:i}=n,s=i.bitrate+(i.audioBitrate||128000),o=`${i.width}x${i.height||Math.round(i.width*9/16)}`;r.push(`#EXT-X-STREAM-INF:BANDWIDTH=${s},RESOLUTION=${o},NAME="${i.label}"`,`${i.label}/${i.label}.m3u8`)}return r.join(`
|
|
3
|
+
`)}async function Nr(t,e,a,c,r){let n=await z();if(!n)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let i=E(t);if(!await k(i))return null;let s=await _(i),o=F(t,W(t)),h=R(a,`${o}-${s}-dash`);await H(h,{recursive:!0});let y=e.length>0?e:j,u=r?.segmentDuration||4,m=r?.minBufferTime||2,l=(await new n.Input(i).getInfo()).duration||0,f=[],b=[];for(let p of y){let P=R(h,p.label);await H(P,{recursive:!0});try{if(await n.generateDASH(i,{outputDir:P,segmentDuration:u,width:p.width,height:p.height,videoBitrate:p.bitrate,audioBitrate:p.audioBitrate})){if(f.push({bandwidth:p.bitrate,width:p.width,height:p.height||Math.round(p.width*9/16),url:`${c}/${o}-${s}-dash/${p.label}/video`}),p.audioBitrate)b.push({bandwidth:p.audioBitrate,url:`${c}/${o}-${s}-dash/${p.label}/audio`})}}catch(x){console.warn(`[stx-media] Failed to generate DASH for ${p.label}: ${x}`)}}if(f.length===0)return null;let S=R(h,"manifest.mpd"),w=G(f,b,l,u,m);await q(S,w);let C=[{type:"video",representations:f}];if(b.length>0)C.push({type:"audio",representations:b});return{manifestUrl:`${c}/${o}-${s}-dash/manifest.mpd`,manifestPath:S,adaptationSets:C,duration:l}}catch(i){return console.warn(`[stx-media] Failed to generate DASH manifest: ${i}`),null}}function G(t,e,a,c,r){let n=I(a),i=I(r),s=`<?xml version="1.0" encoding="UTF-8"?>
|
|
4
4
|
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
|
|
5
5
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
6
6
|
xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
|
|
@@ -26,4 +26,4 @@ import{T,k,Ht,Vt,Ut}from"./chunk-xevnx24r.js";import{resolve as Q,basename as J,
|
|
|
26
26
|
</Representation>
|
|
27
27
|
`}s+=` </AdaptationSet>
|
|
28
28
|
`}return s+=` </Period>
|
|
29
|
-
</MPD>`,s}function I(t){let e=Math.floor(t/3600),a=Math.floor(t%3600/60),c=Math.floor(t%60),r="PT";if(e>0)r+=`${e}H`;if(a>0)r+=`${a}M`;return r+=`${c}S`,r}async function O(){try{return await import("ts-videos")}catch{return null}}function ee(t){switch(t){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function te(t){switch(t){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function bo(t){let e=await O();if(!e)return null;try{let a=Q(t),r=await new e.Input(a).getInfo();return{duration:r.duration||0,width:r.width||0,height:r.height||0,frameRate:r.frameRate||0,bitrate:r.bitrate||0,codec:r.videoCodec||"",audioCodec:r.audioCodec}}catch(a){return console.warn(`[stx-media] Failed to analyze video: ${a}`),null}}async function ya(t,e,a,c){let r=await O();if(!r)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:t,processed:!1};let n=await Pr(t,e,a);if(n)return n;try{let i=Q(t);if(!await k(i))return{src:t,processed:!1,errors:[`Source file not found: ${t}`]};let s=a.outputDir||"dist/videos",o=a.baseUrl||"/videos";await Z(s,{recursive:!0});let h=await
|
|
29
|
+
</MPD>`,s}function I(t){let e=Math.floor(t/3600),a=Math.floor(t%3600/60),c=Math.floor(t%60),r="PT";if(e>0)r+=`${e}H`;if(a>0)r+=`${a}M`;return r+=`${c}S`,r}async function O(){try{return await import("ts-videos")}catch{return null}}function ee(t){switch(t){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function te(t){switch(t){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function bo(t){let e=await O();if(!e)return null;try{let a=Q(t),r=await new e.Input(a).getInfo();return{duration:r.duration||0,width:r.width||0,height:r.height||0,frameRate:r.frameRate||0,bitrate:r.bitrate||0,codec:r.videoCodec||"",audioCodec:r.audioCodec}}catch(a){return console.warn(`[stx-media] Failed to analyze video: ${a}`),null}}async function ya(t,e,a,c){let r=await O();if(!r)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:t,processed:!1};let n=await Pr(t,e,a);if(n)return n;try{let i=Q(t);if(!await k(i))return{src:t,processed:!1,errors:[`Source file not found: ${t}`]};let s=a.outputDir||"dist/videos",o=a.baseUrl||"/videos";await Z(s,{recursive:!0});let h=await _(i),y=J(t,K(t)),u={src:t,processed:!0,hash:h};c?.({percentage:5,stage:"analyzing"}),u.metadata=await bo(i)||void 0;let m={};if(e.quality)m.bitrate=ee(e.quality);if(e.platform)Object.assign(m,te(e.platform));if(e.transcode)Object.assign(m,e.transcode);if(Object.keys(m).length>0||e.process){c?.({percentage:10,stage:"transcoding"});let d=`${y}-${h}.mp4`,g=Y(s,d);try{let l=await ae(i,g,m,r,(f)=>c?.({percentage:10+f*0.5,stage:"transcoding"}));if(l)u.transcoded={path:g,url:`${o}/${d}`,duration:l.duration,size:l.size,video:{codec:m.codec||"h264",width:l.width,height:l.height,bitrate:l.bitrate,frameRate:l.frameRate},audio:l.audioCodec?{codec:m.audioCodec||"aac",bitrate:m.audioBitrate||128000,sampleRate:m.sampleRate||48000,channels:m.channels||2}:void 0}}catch(l){u.errors=u.errors||[],u.errors.push(`Transcoding failed: ${l}`)}}if(e.generatePoster){c?.({percentage:65,stage:"generating-poster"});let d=typeof e.generatePoster==="object"?e.generatePoster:{timestamp:0},g=await Dr(i,d,s,o);if(g)u.poster=g}if(a.thumbnails?.enabled){c?.({percentage:70,stage:"generating-thumbnails"});let d=await Or(i,a.thumbnails,s,o);if(d.length>0)u.thumbnails=d}if(e.streaming){c?.({percentage:80,stage:"generating-manifests"});let d=typeof e.streaming==="object"?e.streaming:a.streaming||{format:"hls"};if(d.format==="hls"||d.format===void 0){let g=await Mr(i,d.qualities||a.streaming?.defaultQualities||[],s,o);if(g)u.streaming={...u.streaming,hls:g}}if(d.format==="dash"){let g=await Nr(i,d.qualities||a.streaming?.defaultQualities||[],s,o);if(g)u.streaming={...u.streaming,dash:g}}}if(e.spriteSheet)c?.({percentage:90,stage:"generating-sprite-sheet"});return c?.({percentage:100,stage:"complete"}),await Ir(t,e,u,a),u}catch(i){return{src:t,processed:!1,errors:[`Processing failed: ${i}`]}}}async function ae(t,e,a,c,r){try{let i=await new c.Conversion(t,e,{videoCodec:a.codec,videoBitrate:a.bitrate,width:a.maxWidth,height:a.maxHeight,frameRate:a.frameRate,audioCodec:a.audioCodec,audioBitrate:a.audioBitrate,sampleRate:a.sampleRate,channels:a.channels}).run((s)=>{r?.(s.percentage/100)});return{duration:i.duration||0,size:i.size||0,width:i.width||a.maxWidth||0,height:i.height||a.maxHeight||0,bitrate:i.bitrate||a.bitrate||0,frameRate:i.frameRate||a.frameRate||30,audioCodec:i.audioCodec}}catch(n){return console.error(`[stx-media] Transcoding failed: ${n}`),null}}export{Ar,Pr,Ir,ma,Dr,Or,ha,Mr,Nr,bo,ya};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ni,Li,ji}from"./chunk-
|
|
2
|
+
import{Ni,Li,ji}from"./chunk-g1r4v0mc.js";import{V,Dn,Xt,jr,Br,On,Gt,Jt,Fr,Mn}from"./chunk-x81vcxzs.js";function W(r,d=!0,u){if(!d||!r||typeof window>"u")return;let s=window;if(!s.__STX_DATA__){let y=document.querySelector("script[data-stx-server-data]");try{let h=JSON.parse(y?.textContent||"{}");s.__STX_DATA__=h&&typeof h==="object"&&!Array.isArray(h)?h:{}}catch{s.__STX_DATA__={}}}let i=s.__STX_DATA__;if(i&&Object.prototype.hasOwnProperty.call(i,r))try{return{data:u?u(i[r]):i[r]}}catch(y){return{data:null,error:y instanceof Error?y:Error(String(y))}}return}function X(r){if(typeof window>"u")return;let d=window;if(r===void 0)d.__STX_DATA__={};else{if(!d.__STX_DATA__)try{let u=JSON.parse(document.querySelector("script[data-stx-server-data]")?.textContent||"{}");d.__STX_DATA__=u&&typeof u==="object"&&!Array.isArray(u)?u:{}}catch{d.__STX_DATA__={}}if(d.__STX_DATA__)delete d.__STX_DATA__[r]}}function Q(r){let d=null;try{d=typeof indexedDB<"u"?indexedDB:null}catch{d=null}if(!d)return null;let u=d,s=r||"stx-kept",i=null,y=()=>{if(!i)i=new Promise((f,l)=>{let a=u.open(s,1);a.onupgradeneeded=()=>{a.result.createObjectStore("kv")},a.onsuccess=()=>f(a.result),a.onerror=()=>l(a.error),a.onblocked=()=>l(Error("blocked"))}),i.catch(()=>{i=null});return i},h=(f,l)=>y().then((a)=>new Promise((v,g)=>{let t=a.transaction("kv",f),o=l(t.objectStore("kv"));t.oncomplete=()=>v(o?o.result:void 0),t.onerror=()=>g(t.error),t.onabort=()=>g(t.error)}));return{get:(f)=>h("readonly",(l)=>l.get(f)),set:(f,l)=>h("readwrite",(a)=>{a.put(l,f)}),remove:(f)=>h("readwrite",(l)=>{l.delete(f)}),removePrefix:(f)=>h("readwrite",(l)=>{l.delete(IDBKeyRange.bound(f,`${f}\uFFFF`))})}}function G(r,d){let u=r||{},s=null;if(u.storage!==void 0)s=u.storage;else try{s=typeof localStorage<"u"?localStorage:null}catch{s=null}let i=null,y=u.backend!==void 0;if(y)i=u.backend||null;let h=()=>{if(y)return i;y=!0;try{i=d?d():null}catch{i=null}if(i){let e=i;e.get("__stx_probe__").catch(()=>{if(i===e)i=null})}return i},f=u.limit||32768,l=u.defer||((e)=>{let n=typeof requestIdleCallback==="function"?requestIdleCallback:null;if(n)n(e,{timeout:200});else setTimeout(e,16)}),a=new Map,v=new Set,g=new Map,t=!1,o=Promise.resolve(),m=(e)=>{try{return JSON.parse(e)}catch{return e}},p=(e,n)=>{if(!s)return!1;try{return s.setItem(e,n),!0}catch{return!1}},T=(e)=>{try{if(s)s.removeItem(e)}catch{}},S=()=>{if(t=!1,!g.size)return o;let e=Array.from(g.entries());return g.clear(),o=o.then(()=>Promise.all(e.map(([n,c])=>{if(!i){v.delete(n);try{p(n,JSON.stringify(c===void 0?null:c))}catch{}return}let _;try{return _={v:c},i.set(n,_).catch(()=>{let w;try{w=JSON.stringify(c)}catch{return}return i?i.set(n,{j:w}).catch(()=>{p(n,w)}):void 0})}catch{return}}))).then(()=>{}),o},R=(e,n)=>{if(g.set(e,n),v.add(e),t)return;t=!0,l(()=>{S()})},O=(e)=>{if(!e||typeof e!=="object")return;let n=e;if("v"in n)return{value:n.v};if(typeof n.j==="string")return{value:m(n.j)};return},E={peek(e){if(a.has(e))return{value:a.get(e)};let n=null;try{n=s?s.getItem(e):null}catch{n=null}if(n===null||n===void 0)return;let c=m(n);return a.set(e,c),{value:c}},load(e){let n=E.peek(e),c=n?null:h();if(n||!c)return Promise.resolve(n);return c.get(e).then((_)=>{if(a.has(e))return{value:a.get(e)};let w=O(_);if(w)a.set(e,w.value),v.add(e);return w},()=>{return})},set(e,n){if(a.set(e,n),i&&v.has(e)){R(e,n);return}let c;try{c=JSON.stringify(n===void 0?null:n)}catch{return}if(c.length<=f&&p(e,c))return;if(!h()){if(c.length>f)p(e,c);return}T(e),R(e,n)},forget(e){for(let c of Array.from(a.keys()))if(c.indexOf(e)===0)a.delete(c);for(let c of Array.from(g.keys()))if(c.indexOf(e)===0)g.delete(c);for(let c of Array.from(v))if(c.indexOf(e)===0)v.delete(c);try{if(s)for(let c=s.length-1;c>=0;c--){let _=s.key(c);if(_&&_.indexOf(e)===0)s.removeItem(_)}}catch{}let n=h();if(!n)return o;return o=o.then(()=>n.removePrefix(e)).catch(()=>{}),o},flush(){return S()}};try{if(typeof document<"u"&&document.addEventListener)document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden")S()});if(typeof addEventListener==="function")addEventListener("pagehide",()=>{S()})}catch{}return E}function J(r,d){if(!r)return!1;if(r===d.key)return!0;if(!d.url)return!1;if(r===d.url)return!0;try{let u=typeof location<"u"&&location.origin&&location.origin!=="null"?location.origin:"http://localhost",s=new URL(r,u),i=new URL(d.url,u);if(s.origin!==i.origin||s.pathname!==i.pathname)return!1;return!s.search||s.search===i.search}catch{return!1}}function Y(r){let d=r.prefix||"stx:kept:",u=r.matches||((t,o)=>t===o.key||t===o.url),s=new Set,i=new Map,y,h=(t)=>t===void 0?y:t,f=(t,o)=>{let m=h(o);if(m===!1||m===null||m==="")return null;return`${d}${m===void 0?"":`${m}:`}query:${t}`},l=(t)=>{let o=t&&t.value;if(!o||typeof o!=="object"||!("d"in o))return;return{data:o.d,at:Number(o.at)||0}},a=()=>{let t=globalThis;return t.__stx_outboxes instanceof Map?t.__stx_outboxes:null},v={setScope(t){y=t},scope:()=>y,keyFor:f,seed(t,o){let m=f(t,o);return m?l(r.kept.peek(m)):void 0},restore(t,o){let m=f(t,o);return m?r.kept.load(m).then(l):Promise.resolve(void 0)},persist(t,o,m){let p=f(t,m);if(p)r.kept.set(p,{d:o,at:Date.now()})},overlay(t,o,m){let p=a();if(!p||!p.size)return o;let T=o;return p.forEach((S)=>{try{T=S.overlay(t,T,m)}catch{}}),T},watch(t){return s.add(t),()=>{s.delete(t)}},cachedQuery(t,o){let m=i.get(t);if(m){if(o&&m.__options)m.__options(o);return m}let p=o||{},T=p.initial===void 0?null:p.initial,S=()=>typeof p.scope==="function"?p.scope():p.scope,R=()=>(typeof p.url==="function"?p.url():p.url)||null,O=()=>({key:t,url:R()}),E=S(),e=T,n=0,c=null,_=v.seed(t,E);if(_)e=_.data;let w=r.state(v.overlay(O(),e)),H=r.state(!1),q=r.state(!1),B=r.state(null),I=r.state(_?_.at:0),N=0,P=()=>{w.set(v.overlay(O(),e))},z=(b)=>{let x=N;v.restore(t,b).then((C)=>{if(!C||x!==N||n)return;e=C.data,I.set(C.at),P()})};if(!_)z(E);let ee=()=>{let b=S();if(b===E)return;E=b,N++,c=null,n=0;let x=v.seed(t,E);if(e=x?x.data:T,I.set(x?x.at:0),P(),!x)z(E)},te=(b)=>{let x=R(),C=p.timeoutMs||15000,A=typeof AbortController<"u"?new AbortController:null,k=null,ne=new Promise((D,L)=>{k=setTimeout(()=>{if(A)A.abort();L(Error("The request took too long."))},C)}),K;if(p.load)K=p.load({force:b,url:x,signal:A?A.signal:void 0});else if(x){let D=p.fetch||((M,F)=>fetch(M,F)),L={method:"GET",headers:{Accept:"application/json"}};if(b)L.cache="no-cache";if(A)L.signal=A.signal;K=D(x,L).then((M)=>{if(!M.ok)return M.json().catch(()=>null).then((F)=>{throw Error(F&&(F.error||F.message)||`Request failed (${M.status})`)});return M.json()})}else return Promise.resolve(w());return Promise.race([K,ne]).then((D)=>{if(k)clearTimeout(k);return p.transform?p.transform(D):D},(D)=>{if(k)clearTimeout(k);throw D})},U=(b)=>{if(c)return c;let x=N;if(q.set(!0),n===0&&!I())H.set(!0);let C=()=>{if(x!==N)return;c=null,q.set(!1),H.set(!1)},A=te(b).then((k)=>{if(x!==N)return w();return e=k,n=Date.now(),I.set(n),B.set(null),v.persist(t,k,E),P(),C(),w()},(k)=>{if(x===N)B.set(k&&k.message?k.message:"Could not load.");return C(),w()});return c=A,A},j={data:w,loading:H,isFetching:q,error:B,updatedAt:I,get key(){return t},load(b){if(ee(),!b&&n&&Date.now()-n<(p.staleTime||0))return Promise.resolve(w());return U(!!b)},refresh(){return j.load(!0)},set(b){e=typeof b==="function"?b(e):b,v.persist(t,e,E),P()},invalidate(){n=0},__options(b){p={...p,...b}}};if(s.add({target:O,updated:()=>{if(n||I())U(!1)},outbox:(b)=>{if(b)e=v.overlay(O(),e,b.id),n=0,U(!0);P()}}),i.set(t,j),p.immediate)j.load();return j}},g=typeof window<"u"?window:typeof addEventListener==="function"?globalThis:null;if(r.listen!==!1&&g&&typeof g.addEventListener==="function")g.addEventListener("stx:updated",(t)=>{let o=t.detail||{};if(o.kind!=="api"||typeof o.url!=="string")return;s.forEach((m)=>{if(u(o.url,m.target()))m.updated()})}),g.addEventListener("stx:outbox",(t)=>{let o=t.detail||{},m=o.sent&&typeof o.sent.id==="string"?o.sent:null;s.forEach((p)=>{if(m){let T=Array.isArray(m.affects)?m.affects:[],S=p.target();if(!T.some((R)=>u(R,S)))return}p.outbox(m)})});return v}function Z(r,d,u,s,i){let y=!0,h=new Set,f=(a)=>s.get?s.get(a):a,l=()=>f(r());return Object.defineProperty(l,"_isSignal",{value:!0}),Object.defineProperty(l,"modifiers",{get:d}),l.set=(a)=>{if(!y)return;let v=d(),g=s.set?s.set(a,v):a;if(v.trim&&typeof g==="string")g=g.trim();if(v.number&&typeof g==="string"&&g!==""){let t=Number(g);if(!Number.isNaN(t))g=t}if(Object.is(r(),g))return;r.set(g),u(g)},l.update=(a)=>l.set(a(l())),l.input=(a)=>{if(!d().lazy)l.set(a)},l.change=(a)=>{if(d().lazy)l.set(a)},l.subscribe=(a)=>{if(!y)return()=>{};let v=r.subscribe((g,t)=>a(f(g),f(t)));return h.add(v),()=>{v(),h.delete(v)}},Object.defineProperty(l,"value",{get:l,set:l.set}),i(()=>{y=!1,h.forEach((a)=>a()),h.clear()}),l}function De(){let r=re(Kt());try{let u=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(r);return u=u.replace(/\}(var |let |const |function )/g,"};$1"),u}catch{return r}}function re(r){let d=[],u=0,s="console.log(";while(u<r.length){let i=r.indexOf(s,u);if(i===-1){d.push(r.slice(u));break}d.push(r.slice(u,i));let y=1,h=i+s.length;while(h<r.length&&y>0){let f=r[h];if(f==='"'||f==="'"||f==="`"){let l=f;h++;while(h<r.length&&r[h]!==l){if(r[h]==="\\")h++;h++}h++;continue}if(f==="(")y++;else if(f===")")y--;h++}d.push("0"),u=h}return d.join("")}function Kt(){return`
|
|
3
3
|
// STX Signals Runtime (Development Build)
|
|
4
4
|
console.log('[stx] signals runtime loading');
|
|
5
5
|
// Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
|
|
@@ -1385,7 +1385,7 @@ finally {
|
|
|
1385
1385
|
// Declarative Data Fetching (Feature #6 - useFetch)
|
|
1386
1386
|
// ==========================================================================
|
|
1387
1387
|
|
|
1388
|
-
var readHydratedData = ${
|
|
1388
|
+
var readHydratedData = ${W.toString()};
|
|
1389
1389
|
var clearServerData = ${X.toString()};
|
|
1390
1390
|
|
|
1391
1391
|
function useFetch(urlOrFn, options = {}) {
|
|
@@ -2928,6 +2928,13 @@ catch (e) {
|
|
|
2928
2928
|
} catch(e) {}
|
|
2929
2929
|
}
|
|
2930
2930
|
}
|
|
2931
|
+
// Normalize a signal returned by an interpolation expression before the
|
|
2932
|
+
// DOM coerces it to text. The proxy handles ordinary signal references,
|
|
2933
|
+
// but a helper or pipe can return the signal function itself.
|
|
2934
|
+
const maybeUnwrapSignal = (v) => {
|
|
2935
|
+
if (v && typeof v === 'function' && (v._isSignal || v._isDerived)) return v();
|
|
2936
|
+
return v;
|
|
2937
|
+
};
|
|
2931
2938
|
if (el.nodeType === Node.TEXT_NODE) {
|
|
2932
2939
|
// DOM textContent is specified as a string, but lightweight DOM
|
|
2933
2940
|
// implementations and user-created nodes can retain a numeric value
|
|
@@ -2967,13 +2974,15 @@ catch (e) {
|
|
|
2967
2974
|
const pipeResult = parsePipeExpression(expr, capturedScope);
|
|
2968
2975
|
if (pipeResult) {
|
|
2969
2976
|
const unwrapScope = createExpressionAutoUnwrapProxy(capturedScope, expr);
|
|
2970
|
-
bindingNode.textContent =
|
|
2977
|
+
bindingNode.textContent = maybeUnwrapSignal(
|
|
2978
|
+
executePipeExpression(pipeResult.valueExpr, pipeResult.pipes, unwrapScope),
|
|
2979
|
+
);
|
|
2971
2980
|
}
|
|
2972
2981
|
else {
|
|
2973
2982
|
// Use auto-unwrap proxy (Feature #1)
|
|
2974
2983
|
const unwrapScope = createExpressionAutoUnwrapProxy(capturedScope, expr);
|
|
2975
2984
|
const fn = __stxCompileScoped(capturedScope, [], 'return ' + expr);
|
|
2976
|
-
bindingNode.textContent = fn(...__stxArgs(fn, unwrapScope));
|
|
2985
|
+
bindingNode.textContent = maybeUnwrapSignal(fn(...__stxArgs(fn, unwrapScope)));
|
|
2977
2986
|
}
|
|
2978
2987
|
}
|
|
2979
2988
|
catch (e) {
|
|
@@ -2982,7 +2991,7 @@ catch (e) {
|
|
|
2982
2991
|
// Retry without auto-unwrap so signal functions remain callable.
|
|
2983
2992
|
try {
|
|
2984
2993
|
const fn = __stxCompileScoped(capturedScope, [], 'return ' + expr);
|
|
2985
|
-
bindingNode.textContent = fn(...__stxArgs(fn, capturedScope));
|
|
2994
|
+
bindingNode.textContent = maybeUnwrapSignal(fn(...__stxArgs(fn, capturedScope)));
|
|
2986
2995
|
}
|
|
2987
2996
|
catch (e2) {
|
|
2988
2997
|
if (!(e2 instanceof ReferenceError) && !(e2 instanceof TypeError)) console.warn('[STX] Expression error:', expr, e2);
|
|
@@ -3091,10 +3100,6 @@ else if (part) {
|
|
|
3091
3100
|
// appearing in the Proxy Object.keys), call it to get the value.
|
|
3092
3101
|
// Without this, :text="step" sets textContent to the stringified
|
|
3093
3102
|
// signal function instead of the value.
|
|
3094
|
-
const maybeUnwrapSignal = (v) => {
|
|
3095
|
-
if (v && typeof v === 'function' && (v._isSignal || v._isDerived)) return v();
|
|
3096
|
-
return v;
|
|
3097
|
-
};
|
|
3098
3103
|
const evalAttrExpr = (rawExpr, evaluationScope) => {
|
|
3099
3104
|
const activeScope = evaluationScope || attrCapturedScope;
|
|
3100
3105
|
// Decode HTML entities that browsers may encode in attribute values
|
|
@@ -5591,7 +5596,14 @@ else if (!value && isInserted) {
|
|
|
5591
5596
|
// the branch is bound in the first frame all the same. A branch
|
|
5592
5597
|
// shown while detached (inside content not on the page yet) waits a
|
|
5593
5598
|
// macrotask, when it has been placed.
|
|
5594
|
-
if (el.isConnected)
|
|
5599
|
+
if (el.isConnected) {
|
|
5600
|
+
// A native host sends the insertion as soon as its current
|
|
5601
|
+
// mutation turn ends. Hydrating in a later microtask would put the
|
|
5602
|
+
// handler registration in a second batch, leaving a same-turn tap
|
|
5603
|
+
// with the source expression instead of a native handler id.
|
|
5604
|
+
if (stxHost.isNative) peek(hydrateShownBranch);
|
|
5605
|
+
else queueMicrotask(function() { peek(hydrateShownBranch); });
|
|
5606
|
+
}
|
|
5595
5607
|
else setTimeout(hydrateShownBranch, 0);
|
|
5596
5608
|
}
|
|
5597
5609
|
}
|
|
@@ -5679,6 +5691,9 @@ else if (!value && isInserted) {
|
|
|
5679
5691
|
return debounced;
|
|
5680
5692
|
}
|
|
5681
5693
|
|
|
5694
|
+
// VueUse-compatible alias; both names use the same callback contract.
|
|
5695
|
+
var useDebounceFn = useDebounce;
|
|
5696
|
+
|
|
5682
5697
|
function useDebouncedValue(getter, delay) {
|
|
5683
5698
|
delay = delay || 250;
|
|
5684
5699
|
var current = getter();
|
|
@@ -5706,6 +5721,9 @@ else if (!value && isInserted) {
|
|
|
5706
5721
|
};
|
|
5707
5722
|
}
|
|
5708
5723
|
|
|
5724
|
+
// VueUse-compatible alias; keep the existing value-ref shape.
|
|
5725
|
+
var refDebounced = useDebouncedValue;
|
|
5726
|
+
|
|
5709
5727
|
function useThrottle(fn, limit) {
|
|
5710
5728
|
limit = limit || 250;
|
|
5711
5729
|
var timer = null;
|
|
@@ -5734,6 +5752,8 @@ else if (timer === null) {
|
|
|
5734
5752
|
return throttled;
|
|
5735
5753
|
}
|
|
5736
5754
|
|
|
5755
|
+
var useThrottleFn = useThrottle;
|
|
5756
|
+
|
|
5737
5757
|
function useInterval(interval, options, thirdOptions) {
|
|
5738
5758
|
// Accept the callback-first form too \u2014 useInterval(fn, 1000) is what most
|
|
5739
5759
|
// callers reach for, and silently ignoring the callback (the previous
|
|
@@ -5842,6 +5862,8 @@ else if (timer === null) {
|
|
|
5842
5862
|
};
|
|
5843
5863
|
}
|
|
5844
5864
|
|
|
5865
|
+
var useTimeoutFn = useTimeout;
|
|
5866
|
+
|
|
5845
5867
|
function useToggle(initial) {
|
|
5846
5868
|
var current = !!initial;
|
|
5847
5869
|
var listeners = [];
|
|
@@ -7737,10 +7759,14 @@ catch (e) {} }
|
|
|
7737
7759
|
watch,
|
|
7738
7760
|
watchEffect,
|
|
7739
7761
|
useDebounce,
|
|
7762
|
+
useDebounceFn,
|
|
7740
7763
|
useDebouncedValue,
|
|
7764
|
+
refDebounced,
|
|
7741
7765
|
useThrottle,
|
|
7766
|
+
useThrottleFn,
|
|
7742
7767
|
useInterval,
|
|
7743
7768
|
useTimeout,
|
|
7769
|
+
useTimeoutFn,
|
|
7744
7770
|
useToggle,
|
|
7745
7771
|
useCounter,
|
|
7746
7772
|
useClickOutside,
|
|
@@ -9776,5 +9802,5 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
|
|
|
9776
9802
|
}
|
|
9777
9803
|
}
|
|
9778
9804
|
})();
|
|
9779
|
-
`}var
|
|
9780
|
-
export{De,Kt,
|
|
9805
|
+
`}var sd={state:V,derived:Dn,effect:Xt,batch:jr,onMount:Br,onDestroy:On,isSignal:Gt,isDerived:Jt,untrack:Fr,peek:Mn,generateSignalsRuntime:De,generateSignalsRuntimeDev:Kt};
|
|
9806
|
+
export{De,Kt,sd};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{t,i,D}from"./chunk-
|
|
3
|
-
`),n=[{obj:a,indent:-1}];for(let r of s){let l=r.replace(/#.*$/,"").trimEnd();if(!l.trim())continue;let c=l.search(/\S/);if(c===-1)continue;while(n.length>1&&n[n.length-1].indent>=c)n.pop();let u=n[n.length-1].obj,o=l.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(o){let[,,g,f]=o,p=g.trim(),m=f.trim();if(m==="")u[p]={},n.push({obj:u[p],indent:c});else u[p]=X(m)}}return a}function X(e){if(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);let a=e.toLowerCase();if(a==="true"||a==="yes")return!0;if(a==="false"||a==="no")return!1;if(a==="null"||a==="~")return null;let s=Number(e);if(!Number.isNaN(s)&&e!=="")return s;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,a){return G(e,a)}function re(e,a){for(let s of e){let n=s.trim(),r=n.match(/^\{(\d+)\}\s*(.*)$/);if(r){let c=Number.parseInt(r[1],10);if(a===c)return r[2];continue}let l=n.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(l){let c=Number.parseInt(l[1],10),u=l[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(l[2],10);if(a>=c&&a<=u)return l[3];continue}}if(e.length===2)return a===1?e[0].trim():e[1].trim();if(a<e.length)return e[a].trim();return e[e.length-1].trim()}function ne(e,a={}){return j(e,a)}function j(e,a){let s="",n=0;while(n<e.length)if(e[n]==="{"){let r=ie(e,n);if(r===-1){s+=e[n],n++;continue}let l=e.slice(n+1,r);s+=se(l,a),n=r+1}else if(e[n]==="'"&&n+1<e.length)if(e[n+1]==="'")s+="'",n+=2;else if(e[n+1]==="{"||e[n+1]==="}")s+=e[n+1],n+=2;else s+=e[n],n++;else s+=e[n],n++;return s}function ie(e,a){let s=0;for(let n=a;n<e.length;n++)if(e[n]==="{")s++;else if(e[n]==="}"){if(s--,s===0)return n}return-1}function se(e,a){let s=ae(e);if(s.length===0)return`{${e}}`;let n=s[0].trim(),r=a[n];if(s.length===1)return r!==void 0?String(r):`{${n}}`;switch(s[1].trim().toLowerCase()){case"plural":return oe(r,s.slice(2).join(","),a);case"select":return ce(r,s.slice(2).join(","));case"selectordinal":return ue(r,s.slice(2).join(","));case"number":return ge(r,s[2]?.trim());case"date":return pe(r,s[2]?.trim());case"time":return fe(r,s[2]?.trim());default:return r!==void 0?String(r):`{${e}}`}}function ae(e){let a=[],s="",n=0;for(let r=0;r<e.length;r++){let l=e[r];if(l==="{")n++,s+=l;else if(l==="}")n--,s+=l;else if(l===","&&n===0)a.push(s),s="";else s+=l}if(s)a.push(s);return a}function oe(e,a,s){let n=Number(e)||0,r=P(a),l=`=${n}`;if(r[l])return R(r[l],n,s);let c=le(n);if(r[c])return R(r[c],n,s);if(r.other)return R(r.other,n,s);return String(n)}function R(e,a,s){let n=e.replace(/#/g,String(a));return j(n,s)}function le(e){let a=Math.abs(e),s=Math.floor(a),n=String(e).includes(".")?String(e).split(".")[1].length:0;if(s===1&&n===0)return"one";return"other"}function ce(e,a){let s=String(e||""),n=P(a);if(n[s])return n[s];return n.other||String(e)}function ue(e,a){let s=Number(e)||0,n=P(a),r=de(s);if(n[r])return n[r].replace(/#/g,String(s));if(n.other)return n.other.replace(/#/g,String(s));return String(s)}function de(e){let a=Math.abs(e),s=a%10,n=a%100;if(s===1&&n!==11)return"one";if(s===2&&n!==12)return"two";if(s===3&&n!==13)return"few";return"other"}function P(e){let a={},s=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,n=s.exec(e);while(n!==null)a[n[1]]=n[2],n=s.exec(e);return a}function ge(e,a){let s=Number(e);if(Number.isNaN(s))return String(e);switch(a){case"integer":return Math.floor(s).toLocaleString();case"percent":return`${(s*100).toFixed(0)}%`;case"currency":return s.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return s.toLocaleString()}}function pe(e,a){let s=e instanceof Date?e:new Date(String(e));if(Number.isNaN(s.getTime()))return String(e);let n={};switch(a){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 s.toLocaleDateString(void 0,n)}function fe(e,a){let s=e instanceof Date?e:new Date(String(e));if(Number.isNaN(s.getTime()))return String(e);let n={};switch(a){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 s.toLocaleTimeString(void 0,n)}function me(e){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(e)}function N(e,a,s=!0,n={}){let r=e.split("."),l=a;for(let u of r){if(l===void 0||l===null)break;l=l[u]}if(l===void 0||l===null)return s?e:"";let c=String(l);if(me(c))return ne(c,n);if(c.includes("|")&&"count"in n){let u=Number(n.count),o=c.split("|");c=re(o,u)}for(let[u,o]of Object.entries(n)){let g=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");c=c.replace(new RegExp(`:${g}`,"g"),String(o))}return c}var O=new Set(["ar","arc","ckb","dv","fa","he","khw","ks","nqo","prs","ps","sd","syr","ug","ur","uz-af","yi"]),be=new Set(["adlm","arab","aran","hebr","nkoo","rohg","syrc","thaa","yezi"]);function _(e){if(!e)return"ltr";let a=e.trim().toLowerCase().replace(/_/g,"-").split("-"),s=a[0];if(!s)return"ltr";let n=a[1]?.length===4?a[1]:void 0;if(n)return be.has(n)?"rtl":"ltr";if(a.length>1&&O.has(`${s}-${a[1]}`))return"rtl";return O.has(s)?"rtl":"ltr"}async function mi(e,a,s,n){let r=e,l=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,c={...T,...n.i18n},u=await te(c.locale,n);a.__translations=u,a.__locale=c.locale,a.__i18nConfig=c,r=await F(r,l,async(f,p,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:{}},()=>D(m,a)];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)}return N(p,u,c.fallbackToKey,b)||w.trim()}catch(b){if(n.debug)console.error("Error processing @translate directive:",b);return i("Translate",`Error in @translate('${p}'): ${b instanceof Error?b.message:String(b)}`,t.EVALUATION_ERROR)}});let o=/@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 f=[...r.matchAll(o)];console.warn(`Found ${f.length} @translate matches`),f.forEach((p,m)=>console.warn(`Match ${m}: ${p[0]}, Key: ${p[1]}, Params: ${p[2]||"none"}`))}return r=await F(r,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(f,p,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:{}},()=>D(m,a)];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 N(p,u,c.fallbackToKey,h)}catch(h){if(n.debug)console.error("Error processing @translate directive:",h);return i("Translate",`Error in @translate('${p}'): ${h instanceof Error?h.message:String(h)}`,t.EVALUATION_ERROR)}}),r}async function F(e,a,s){let n=[];return e.replace(a,(l,...c)=>{let u=s(l,...c).then((o)=>({match:l,replacement:o}));return n.push(u),l}),(await Promise.all(n)).reduce((l,{match:c,replacement:u})=>l.replace(c,u),e)}function q(e,a){if(!e||_(e)!=="rtl")return!1;return!a||a.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,a){let s=new RegExp(`\\b${a}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(e);if(!s)return null;return s[2]??s[3]??s[4]??null}function hi(e,a,s,n){let r=e;r=r.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(c,u,o)=>{let f={"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"}[u]||"Make this element accessible";return`<!-- a11y-hint: ${o||f} -->`});let l=/@screenReader\(([^@]*)\)@endScreenReader/g;return r=r.replace(l,(c,u)=>`<span class="sr-only">${u.trim()}</span>`),r=r.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(c,u,o)=>`<span id="${`desc-${u}`}" class="sr-only">${o}</span>`),r}function he(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function ye(e){let a=new Map,s=e.replace(/<(\/?)([A-Z][\w:.-]*)(?=[\s/>])/g,(r,l,c)=>{let u=a.get(c);if(!u)u=`stx-a11y-component-${a.size}`,a.set(c,u);return`<${l}${u}`}),n=new Map([...a.entries()].map(([r,l])=>[l,r]));return{protectedSource:s,restore:(r)=>r.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(l,c,u)=>{let o=n.get(u);return o?`<${c}${o}`:l})}}function xe(e,a){let s=[],n=/<img\s+([^>]*)>/gi,r;r=n.exec(e);while(r!==null){let d=r[1];if(!/\balt\s*=/i.test(d))s.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 l=/<button([^>]*)>\s*<\/button>/gi;r=l.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))s.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=l.exec(e)}let c=/<a\s+([^>]*)>\s*<\/a>/gi;r=c.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))s.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=c.exec(e)}let u=/<(input|select|textarea)\s+([^>]*)>/gi;r=u.exec(e);while(r!==null){let d=r[2];if(/\btype\s*=\s*["']hidden["']/i.test(d)){r=u.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),Ae=e.substring(U),H=(M.match(/<label\b/gi)||[]).length,z=(M.match(/<\/label>/gi)||[]).length,K=H>z;if(!B&&!K)s.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=u.exec(e)}let o=/<h([1-6])[^>]*>/gi,g=[];r=o.exec(e);while(r!==null)g.push(Number.parseInt(r[1],10)),r=o.exec(e);let f=0;for(let d of g){if(f>0&&d>f+1)s.push({type:"heading-skip",element:`<h${d}>`,message:`Heading level skipped from h${f} to h${d}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});f=d}if(/<html\b/i.test(e)&&!/<html[^>]*\slang\s*=/i.test(e))s.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 p=e.match(/<html\b([^>]*)>/i);if(p&&q(I(p[1],"lang"),I(p[1],"dir")))s.push({type:"missing-dir",element:p[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))s.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]))s.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)s.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))s.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))s.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 s}async function we(e,a){let{protectedSource:s}=ye(e);if(!he())return xe(s,a);let n=[];try{let r=globalThis.document.createElement("div");r.innerHTML=s,r.querySelectorAll("img").forEach((o)=>{if(!o.hasAttribute("alt"))n.push({type:"missing-alt",element:`<${o.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((o)=>{if(!(o.hasAttribute("aria-label")||o.hasAttribute("aria-labelledby")||o.textContent&&o.textContent.trim().length>0))n.push({type:"missing-accessible-name",element:`<${o.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((o)=>{let g=o.getAttribute("id"),f=g&&r.querySelector(`label[for="${g}"]`),p=o.hasAttribute("aria-label")||o.hasAttribute("aria-labelledby"),m=o.closest("label")!==null;if(!f&&!p&&!m)n.push({type:"input-missing-label",element:`<${o.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 l=Array.from(r.querySelectorAll("h1, h2, h3, h4, h5, h6")),c=0;for(let o of l){let g=Number.parseInt(o.tagName.charAt(1));if(c>0&&g>c+1)n.push({type:"heading-skip",element:`<${o.outerHTML}>`,message:`Heading level skipped from h${c} to h${g}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});c=g}let u=r.querySelector("html");if(s.includes("<html")&&u&&!u.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(u&&q(u.getAttribute("lang"),u.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((o)=>{let g=o.textContent&&o.textContent.trim().length>0,f=o.hasAttribute("aria-label")||o.hasAttribute("aria-labelledby"),p=o.hasAttribute("title"),m=o.querySelector("img[alt]");if(!g&&!f&&!p&&!m)n.push({type:"link-missing-text",element:`<${o.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"})}),s.includes("<nav")||s.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((o)=>{if(V(o.getAttribute("role")))return;let g=o.querySelector("caption");if(!o.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&&!o.hasAttribute("aria-label")&&!o.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((o)=>{let g=o.getAttribute("style")||"";if(g.includes("color:")&&!g.includes("background"))n.push({type:"potential-contrast-issue",element:`<${o.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((o)=>{if(!o.hasAttribute("muted"))n.push({type:"autoplay-audio",element:`<${o.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((o)=>{if(Number.parseInt(o.getAttribute("tabindex")||"0")>0)n.push({type:"positive-tabindex",element:`<${o.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((o)=>{if(!o.hasAttribute("tabindex"))n.push({type:"button-not-focusable",element:`<${o.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/"})}),s.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((o)=>{if(!o.hasAttribute("title")&&!o.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 ${a}:`,r)}return n}async function yi(e,a={}){let s={},{recursive:n=!0,ignorePaths:r=[]}=a,l=Array.isArray(e)?e:[e],c=await Ss(l,{recursive:n,ignorePaths:r}),u=[];for(let o of c)try{let g=await Bun.file(o).text();if(o.endsWith("good-a11y.stx"))continue;let f=await we(g,o);if(u.push(o),f.length>0)s[o]=f}catch(g){console.error(`Error scanning ${o}:`,g)}return{results:s,scannedFiles:u}}var bi={name:"a11y",handler:(e,a,s,n)=>{if(!a.length)return e;let r=a[0].replace(/['"]/g,""),l=a.length>1?a[1].replace(/['"]/g,""):"",u={"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: ${l||u} -->${e}`},hasEndTag:!1},wi={name:"screenReader",handler:(e)=>`<span class="sr-only">${e}</span>`,hasEndTag:!0};
|
|
4
|
-
export{mi,hi,yi,bi,
|
|
2
|
+
import{t,i,D}from"./chunk-g495xx4v.js";import{Ss}from"./chunk-c57j92td.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,a=0){if(a<=0)return!1;return Date.now()-e.loadedAt>a}async function G(e,a){if({...T,...a.i18n}.cache&&v[e]){let r=v[e],l=a.i18n?.cacheMaxAge??0;if(!J(r,l))return r.translations}if(L[e]?.state==="loading")return L[e].promise;k[e]="loading";let n=C(e,a).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,a){let s={...T,...a.i18n},n=E.isAbsolute(s.translationsDir)?s.translationsDir:E.resolve(a.root||process.cwd(),s.translationsDir);try{let r=await W(),l=r?await r(e,{translationsDir:n,defaultLocale:s.defaultLocale,sources:ee(s.format)}):await Y(e,s,n);if(l===void 0){let u=e!==s.defaultLocale?await C(s.defaultLocale,a):{};if(s.cache)v[e]={translations:u,loadedAt:Date.now(),locale:e};return u}let c=l;if(s.cache)v[e]={translations:c,loadedAt:Date.now(),locale:e};return c}catch(r){if(a.debug)console.error(`Error loading translation file for locale "${e}":`,r);if(e!==s.defaultLocale)return C(s.defaultLocale,a);return{}}}async function Y(e,a,s){let n=E.join(s,`${e}${Z(a.format)}`);try{let r=await import(n);return r.default||r}catch(r){try{let l=await Bun.file(n).text();if(a.format==="yaml"||a.format==="yml")return Q(l);if(a.format==="json")return JSON.parse(l);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 a={},s=e.split(`
|
|
3
|
+
`),n=[{obj:a,indent:-1}];for(let r of s){let l=r.replace(/#.*$/,"").trimEnd();if(!l.trim())continue;let c=l.search(/\S/);if(c===-1)continue;while(n.length>1&&n[n.length-1].indent>=c)n.pop();let u=n[n.length-1].obj,o=l.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(o){let[,,g,f]=o,p=g.trim(),m=f.trim();if(m==="")u[p]={},n.push({obj:u[p],indent:c});else u[p]=X(m)}}return a}function X(e){if(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);let a=e.toLowerCase();if(a==="true"||a==="yes")return!0;if(a==="false"||a==="no")return!1;if(a==="null"||a==="~")return null;let s=Number(e);if(!Number.isNaN(s)&&e!=="")return s;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,a){return G(e,a)}function re(e,a){for(let s of e){let n=s.trim(),r=n.match(/^\{(\d+)\}\s*(.*)$/);if(r){let c=Number.parseInt(r[1],10);if(a===c)return r[2];continue}let l=n.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(l){let c=Number.parseInt(l[1],10),u=l[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(l[2],10);if(a>=c&&a<=u)return l[3];continue}}if(e.length===2)return a===1?e[0].trim():e[1].trim();if(a<e.length)return e[a].trim();return e[e.length-1].trim()}function ne(e,a={}){return j(e,a)}function j(e,a){let s="",n=0;while(n<e.length)if(e[n]==="{"){let r=ie(e,n);if(r===-1){s+=e[n],n++;continue}let l=e.slice(n+1,r);s+=se(l,a),n=r+1}else if(e[n]==="'"&&n+1<e.length)if(e[n+1]==="'")s+="'",n+=2;else if(e[n+1]==="{"||e[n+1]==="}")s+=e[n+1],n+=2;else s+=e[n],n++;else s+=e[n],n++;return s}function ie(e,a){let s=0;for(let n=a;n<e.length;n++)if(e[n]==="{")s++;else if(e[n]==="}"){if(s--,s===0)return n}return-1}function se(e,a){let s=ae(e);if(s.length===0)return`{${e}}`;let n=s[0].trim(),r=a[n];if(s.length===1)return r!==void 0?String(r):`{${n}}`;switch(s[1].trim().toLowerCase()){case"plural":return oe(r,s.slice(2).join(","),a);case"select":return ce(r,s.slice(2).join(","));case"selectordinal":return ue(r,s.slice(2).join(","));case"number":return ge(r,s[2]?.trim());case"date":return pe(r,s[2]?.trim());case"time":return fe(r,s[2]?.trim());default:return r!==void 0?String(r):`{${e}}`}}function ae(e){let a=[],s="",n=0;for(let r=0;r<e.length;r++){let l=e[r];if(l==="{")n++,s+=l;else if(l==="}")n--,s+=l;else if(l===","&&n===0)a.push(s),s="";else s+=l}if(s)a.push(s);return a}function oe(e,a,s){let n=Number(e)||0,r=P(a),l=`=${n}`;if(r[l])return R(r[l],n,s);let c=le(n);if(r[c])return R(r[c],n,s);if(r.other)return R(r.other,n,s);return String(n)}function R(e,a,s){let n=e.replace(/#/g,String(a));return j(n,s)}function le(e){let a=Math.abs(e),s=Math.floor(a),n=String(e).includes(".")?String(e).split(".")[1].length:0;if(s===1&&n===0)return"one";return"other"}function ce(e,a){let s=String(e||""),n=P(a);if(n[s])return n[s];return n.other||String(e)}function ue(e,a){let s=Number(e)||0,n=P(a),r=de(s);if(n[r])return n[r].replace(/#/g,String(s));if(n.other)return n.other.replace(/#/g,String(s));return String(s)}function de(e){let a=Math.abs(e),s=a%10,n=a%100;if(s===1&&n!==11)return"one";if(s===2&&n!==12)return"two";if(s===3&&n!==13)return"few";return"other"}function P(e){let a={},s=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,n=s.exec(e);while(n!==null)a[n[1]]=n[2],n=s.exec(e);return a}function ge(e,a){let s=Number(e);if(Number.isNaN(s))return String(e);switch(a){case"integer":return Math.floor(s).toLocaleString();case"percent":return`${(s*100).toFixed(0)}%`;case"currency":return s.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return s.toLocaleString()}}function pe(e,a){let s=e instanceof Date?e:new Date(String(e));if(Number.isNaN(s.getTime()))return String(e);let n={};switch(a){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 s.toLocaleDateString(void 0,n)}function fe(e,a){let s=e instanceof Date?e:new Date(String(e));if(Number.isNaN(s.getTime()))return String(e);let n={};switch(a){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 s.toLocaleTimeString(void 0,n)}function me(e){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(e)}function N(e,a,s=!0,n={}){let r=e.split("."),l=a;for(let u of r){if(l===void 0||l===null)break;l=l[u]}if(l===void 0||l===null)return s?e:"";let c=String(l);if(me(c))return ne(c,n);if(c.includes("|")&&"count"in n){let u=Number(n.count),o=c.split("|");c=re(o,u)}for(let[u,o]of Object.entries(n)){let g=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");c=c.replace(new RegExp(`:${g}`,"g"),String(o))}return c}var O=new Set(["ar","arc","ckb","dv","fa","he","khw","ks","nqo","prs","ps","sd","syr","ug","ur","uz-af","yi"]),be=new Set(["adlm","arab","aran","hebr","nkoo","rohg","syrc","thaa","yezi"]);function _(e){if(!e)return"ltr";let a=e.trim().toLowerCase().replace(/_/g,"-").split("-"),s=a[0];if(!s)return"ltr";let n=a[1]?.length===4?a[1]:void 0;if(n)return be.has(n)?"rtl":"ltr";if(a.length>1&&O.has(`${s}-${a[1]}`))return"rtl";return O.has(s)?"rtl":"ltr"}async function mi(e,a,s,n){let r=e,l=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,c={...T,...n.i18n},u=await te(c.locale,n);a.__translations=u,a.__locale=c.locale,a.__i18nConfig=c,r=await F(r,l,async(f,p,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:{}},()=>D(m,a)];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)}return N(p,u,c.fallbackToKey,b)||w.trim()}catch(b){if(n.debug)console.error("Error processing @translate directive:",b);return i("Translate",`Error in @translate('${p}'): ${b instanceof Error?b.message:String(b)}`,t.EVALUATION_ERROR)}});let o=/@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 f=[...r.matchAll(o)];console.warn(`Found ${f.length} @translate matches`),f.forEach((p,m)=>console.warn(`Match ${m}: ${p[0]}, Key: ${p[1]}, Params: ${p[2]||"none"}`))}return r=await F(r,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(f,p,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:{}},()=>D(m,a)];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 N(p,u,c.fallbackToKey,h)}catch(h){if(n.debug)console.error("Error processing @translate directive:",h);return i("Translate",`Error in @translate('${p}'): ${h instanceof Error?h.message:String(h)}`,t.EVALUATION_ERROR)}}),r}async function F(e,a,s){let n=[];return e.replace(a,(l,...c)=>{let u=s(l,...c).then((o)=>({match:l,replacement:o}));return n.push(u),l}),(await Promise.all(n)).reduce((l,{match:c,replacement:u})=>l.replace(c,u),e)}function q(e,a){if(!e||_(e)!=="rtl")return!1;return!a||a.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,a){let s=new RegExp(`\\b${a}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(e);if(!s)return null;return s[2]??s[3]??s[4]??null}function hi(e,a,s,n){let r=e;r=r.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(c,u,o)=>{let f={"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"}[u]||"Make this element accessible";return`<!-- a11y-hint: ${o||f} -->`});let l=/@screenReader\(([^@]*)\)@endScreenReader/g;return r=r.replace(l,(c,u)=>`<span class="sr-only">${u.trim()}</span>`),r=r.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(c,u,o)=>`<span id="${`desc-${u}`}" class="sr-only">${o}</span>`),r}function he(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function ye(e){let a=new Map,s=e.replace(/<(\/?)([A-Z][\w:.-]*)(?=[\s/>])/g,(r,l,c)=>{let u=a.get(c);if(!u)u=`stx-a11y-component-${a.size}`,a.set(c,u);return`<${l}${u}`}),n=new Map([...a.entries()].map(([r,l])=>[l,r]));return{protectedSource:s,restore:(r)=>r.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(l,c,u)=>{let o=n.get(u);return o?`<${c}${o}`:l})}}function xe(e,a){let s=[],n=/<img\s+([^>]*)>/gi,r;r=n.exec(e);while(r!==null){let d=r[1];if(!/\balt\s*=/i.test(d))s.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 l=/<button([^>]*)>\s*<\/button>/gi;r=l.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))s.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=l.exec(e)}let c=/<a\s+([^>]*)>\s*<\/a>/gi;r=c.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))s.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=c.exec(e)}let u=/<(input|select|textarea)\s+([^>]*)>/gi;r=u.exec(e);while(r!==null){let d=r[2];if(/\btype\s*=\s*["']hidden["']/i.test(d)){r=u.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),Ae=e.substring(U),H=(M.match(/<label\b/gi)||[]).length,z=(M.match(/<\/label>/gi)||[]).length,K=H>z;if(!B&&!K)s.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=u.exec(e)}let o=/<h([1-6])[^>]*>/gi,g=[];r=o.exec(e);while(r!==null)g.push(Number.parseInt(r[1],10)),r=o.exec(e);let f=0;for(let d of g){if(f>0&&d>f+1)s.push({type:"heading-skip",element:`<h${d}>`,message:`Heading level skipped from h${f} to h${d}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});f=d}if(/<html\b/i.test(e)&&!/<html[^>]*\slang\s*=/i.test(e))s.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 p=e.match(/<html\b([^>]*)>/i);if(p&&q(I(p[1],"lang"),I(p[1],"dir")))s.push({type:"missing-dir",element:p[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))s.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]))s.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)s.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))s.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))s.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 s}async function we(e,a){let{protectedSource:s}=ye(e);if(!he())return xe(s,a);let n=[];try{let r=globalThis.document.createElement("div");r.innerHTML=s,r.querySelectorAll("img").forEach((o)=>{if(!o.hasAttribute("alt"))n.push({type:"missing-alt",element:`<${o.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((o)=>{if(!(o.hasAttribute("aria-label")||o.hasAttribute("aria-labelledby")||o.textContent&&o.textContent.trim().length>0))n.push({type:"missing-accessible-name",element:`<${o.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((o)=>{let g=o.getAttribute("id"),f=g&&r.querySelector(`label[for="${g}"]`),p=o.hasAttribute("aria-label")||o.hasAttribute("aria-labelledby"),m=o.closest("label")!==null;if(!f&&!p&&!m)n.push({type:"input-missing-label",element:`<${o.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 l=Array.from(r.querySelectorAll("h1, h2, h3, h4, h5, h6")),c=0;for(let o of l){let g=Number.parseInt(o.tagName.charAt(1));if(c>0&&g>c+1)n.push({type:"heading-skip",element:`<${o.outerHTML}>`,message:`Heading level skipped from h${c} to h${g}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});c=g}let u=r.querySelector("html");if(s.includes("<html")&&u&&!u.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(u&&q(u.getAttribute("lang"),u.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((o)=>{let g=o.textContent&&o.textContent.trim().length>0,f=o.hasAttribute("aria-label")||o.hasAttribute("aria-labelledby"),p=o.hasAttribute("title"),m=o.querySelector("img[alt]");if(!g&&!f&&!p&&!m)n.push({type:"link-missing-text",element:`<${o.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"})}),s.includes("<nav")||s.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((o)=>{if(V(o.getAttribute("role")))return;let g=o.querySelector("caption");if(!o.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&&!o.hasAttribute("aria-label")&&!o.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((o)=>{let g=o.getAttribute("style")||"";if(g.includes("color:")&&!g.includes("background"))n.push({type:"potential-contrast-issue",element:`<${o.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((o)=>{if(!o.hasAttribute("muted"))n.push({type:"autoplay-audio",element:`<${o.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((o)=>{if(Number.parseInt(o.getAttribute("tabindex")||"0")>0)n.push({type:"positive-tabindex",element:`<${o.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((o)=>{if(!o.hasAttribute("tabindex"))n.push({type:"button-not-focusable",element:`<${o.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/"})}),s.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((o)=>{if(!o.hasAttribute("title")&&!o.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 ${a}:`,r)}return n}async function yi(e,a={}){let s={},{recursive:n=!0,ignorePaths:r=[]}=a,l=Array.isArray(e)?e:[e],c=await Ss(l,{recursive:n,ignorePaths:r}),u=[];for(let o of c)try{let g=await Bun.file(o).text();if(o.endsWith("good-a11y.stx"))continue;let f=await we(g,o);if(u.push(o),f.length>0)s[o]=f}catch(g){console.error(`Error scanning ${o}:`,g)}return{results:s,scannedFiles:u}}var bi={name:"a11y",handler:(e,a,s,n)=>{if(!a.length)return e;let r=a[0].replace(/['"]/g,""),l=a.length>1?a[1].replace(/['"]/g,""):"",u={"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: ${l||u} -->${e}`},hasEndTag:!1},vi={name:"screenReader",handler:(e)=>`<span class="sr-only">${e}</span>`,hasEndTag:!0};
|
|
4
|
+
export{mi,hi,yi,bi,vi};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{al}from"./chunk-ph1xz7k5.js";import"./chunk-fwvqbx49.js";import"./chunk-5zm23zrb.js";import"./chunk-qt31at4s.js";import"./chunk-96kr2xrt.js";import"./chunk-68tzytfz.js";import"./chunk-c57j92td.js";import"./chunk-kp4mzspk.js";import"./chunk-v74acg2k.js";import"./chunk-zz5b1g50.js";import"./chunk-5tbqdz94.js";import"./chunk-9p3rtfbv.js";import"./chunk-g495xx4v.js";import"./chunk-ba88n1j7.js";import"./chunk-g1r4v0mc.js";import"./chunk-xd4zvm4x.js";import"./chunk-e6y6s7q8.js";export{al as buildForProduction};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{M,ce}from"./chunk-
|
|
2
|
+
import{M,ce}from"./chunk-96kr2xrt.js";import{de,C,Xe}from"./chunk-zz5b1g50.js";import{Qe,G,ke}from"./chunk-xd4zvm4x.js";import{Ae,ne,T,re,fo,Er,go,Ot}from"./chunk-fwvqbx49.js";import{Kr}from"./chunk-qt31at4s.js";import{Mt}from"./chunk-2etevws0.js";import F from"zlib";import{promisify as Z}from"util";var ee=Z(F.brotliCompress),te=Z(F.gzip),se=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],oe=["text/event-stream","multipart/x-mixed-replace"],ae=1024;function ie(t){if(!t)return!1;let e=t.toLowerCase();if(oe.some((o)=>e.startsWith(o)))return!1;return se.some((o)=>e.startsWith(o))}function pe(t){let e=new Map;for(let o of t.split(",")){let[r,...a]=o.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of a){let l=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(g);if(!l)continue;let m=Number.parseFloat(l[1]);if(Number.isFinite(m))h=m}e.set(f,h)}return e}function ue(t){if(!t)return null;let e=pe(t),o=e.get("*"),r=(a)=>e.get(a)??o??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var J=33554432,H=new Map,U=0;function le(t,e){if(e.length>J/8)return;H.set(t,e),U+=e.length;for(let[o,r]of H){if(U<=J)break;H.delete(o),U-=r.length}}async function It(t,e,o={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!ie(e.headers.get("content-type")))return e;let r=ue(t.headers.get("accept-encoding"));if(!r)return e;let a;try{a=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(a,{status:e.status,statusText:e.statusText,headers:Q(e.headers)});if(a.length<(o.threshold??ae))return f();try{let h=o.quality??5,g=`${r}:${h}:${a.length}:${Bun.hash(a)}`,l=H.get(g);if(!l)l=r==="br"?await ee(a,{params:{[F.constants.BROTLI_PARAM_QUALITY]:h,[F.constants.BROTLI_PARAM_SIZE_HINT]:a.length}}):await te(a),le(g,l);if(l.length>=a.length)return f();let m=Q(e.headers);return m.set("Content-Encoding",r),m.set("Content-Length",String(l.length)),new Response(l,{status:e.status,statusText:e.statusText,headers:m})}catch{return f()}}function Q(t){let e=new Headers(t),o=e.get("Vary");if(!o)return e.set("Vary","Accept-Encoding"),e;if(!o.split(",").some((a)=>a.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${o}, Accept-Encoding`);return e}import K from"fs";import A from"path";var{serve:me}=globalThis.Bun;class q{now;entries=new M(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,o){let r,a=async()=>{let s=r??await o();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",T(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return a();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${ne(t)?"fragment":"document"}`,g=this.entries.get(h),l=(s)=>{let S=new Headers(s.headers);return S.set("Cache-Control","private, no-store"),S.set("Age",String(Math.max(0,Math.floor((this.now()-s.created)/1000)))),new Response(s.body.slice(0),{headers:S})},m=g?(this.now()-g.created)/1000:1/0;if(g&&m<e.maxAge)return l(g);let b=this.generation,k=async()=>{let s=await o();r=s;let S=(s.headers.get("Vary")??"").toLowerCase().split(",").map((y)=>y.trim()).filter(Boolean);if(s.status!==200||s.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(s.headers.get("Cache-Control")??"")||S.some((y)=>y!=="x-stx-router"&&y!=="accept-encoding"))return null;let L=await s.clone().arrayBuffer();if(L.byteLength>1048576)return null;s.headers.set("Vary",T(s.headers.get("Vary")).Vary);let n={body:L,headers:Array.from(s.headers.entries()),created:this.now(),path:f.pathname};if(this.generation===b)this.entries.set(h,n);return n},v=this.pending.get(h);if(!v){if(this.pending.size>=1000)return a();v=k().finally(()=>{if(this.pending.get(h)===v)this.pending.delete(h)}),this.pending.set(h,v)}if(g&&m<e.maxAge+(e.swr??0))return v.catch(()=>{}),l(g);let B=await v;return B?l(B):a()}}var fe={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function Qc(t={}){let e=A.resolve(t.outputDir||".output"),o=t.port??3000,r=fo(e);if(!r)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${r.routes.length} routes...`);let a=Mt(r.routeRules),f=new q,h=Kr(e,r.apiRoutes??[]),g=Bun.file(A.join(e,"server/runtime-config.json")),l=t.runtimeConfig??(await g.exists()?await g.json():void 0),m=l?C(l):void 0,b=new Map,k=new Map,v=new Map,B=new Map;for(let n of r.routes)try{let y=A.join(e,n.compiledPath),i=JSON.parse(await Bun.file(y).text());if(m)i.html=Xe(i.html,m);b.set(n.pattern,i),v.set(n.pattern,ke(i.html)),B.set(n.pattern,ce(i.html));let _=A.join(e,n.fragmentPath);if(await Bun.file(_).exists()){let E=await Bun.file(_).text();k.set(n.pattern,m?Xe(E,m):E)}}catch(y){console.warn(`[stx] Failed to load route ${n.pattern}:`,y)}let s=new Map,S=[];for(let n of r.routes)if(n.hasParams){let{regex:y,params:i}=G(n.pattern,{page:!0});S.push({regex:y,route:n,paramNames:i})}else s.set(n.pattern,n);let L=me({port:o,async fetch(n){return It(n,await de(m??C(),async()=>{let i=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[i])return t.apiRoutes[i](n);let _=await h(n);if(_)return _;if((n.method==="GET"||n.method==="HEAD")&&i!=="/"){let p=A.resolve(e,"public"),d;try{d=decodeURIComponent(i)}catch{d=i}if(!d.includes("\x00")){let u=A.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${A.sep}`))try{if(K.existsSync(u)&&K.statSync(u).isFile()){let R=A.extname(u).toLowerCase(),j=fe[R]||"application/octet-stream",N=i.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(i);return new Response(Bun.file(u),{headers:{"Content-Type":j,"Cache-Control":N?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let E=ne(n),w=null,W={};if(w=s.get(i)||null,!w)for(let{regex:p,route:d,paramNames:u}of S){let c=i.match(p);if(c){w=d,u.forEach((R,j)=>{W[R]=c[j+1]});break}}if(!w){let p=Qe(i)?null:s.get("/404")||null;if(p){let d=b.get(p.pattern);if(d)return new Response(d.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let O=a(i),Y=Object.keys(O).length>0;return f.respond(n,O.cache,async()=>{let p=b.get(w.pattern);if(E&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let c=k.get(w.pattern);if(c){let R=v.get(w.pattern);return new Response(c,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...B.has(w.pattern)?{"X-STX-Runtime":B.get(w.pattern)?"true":"false"}:{},...R?{"X-STX-Layout":R.layout,"X-STX-Layout-Group":R.group}:{},...T(),...O.cache?{}:{"Cache-Control":Ae}}})}}let d=Er(n.method),u=b.get(w.pattern);if(!u){let c=s.get("/500")||null;if(c){let R=b.get(c.pattern);if(R)return new Response(R.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(w.prerendered&&d)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!d&&!u.hasServerScripts&&Object.keys(u.placeholders).length===0)return new Response(u.html,{status:u.status??200,headers:{"Content-Type":"text/html",...T(),"Cache-Control":"public, max-age=60"}});try{let{html:c,boundaries:R,redirect:j,cookies:N,status:I,headers:D}=await Ot(u,{params:W,request:n,method:n.method,__stx_strict_hydration:Y,__stx_runtime_config:m});if(j)return go(j,N,D);if(R&&R.length>0){let{renderStreamingPage:P,streamToResponse:z}=await import("./chunk-nnrtwpvy.js"),X=new Headers({...T(),...D,"Cache-Control":"private, no-store"});for(let V of N??[])X.append("Set-Cookie",V);if(E&&!d){let V=ke(c);X.set("X-STX-Fragment","true"),X.set("X-STX-Runtime",ce(c)?"true":"false"),X.set("X-STX-Layout",V.layout),X.set("X-STX-Layout-Group",V.group)}return z(P(E&&!d?re(c,r.routerContainer||"main"):c,R,{timeoutMs:30000}),{status:I??u.status??200,headers:X})}let x=new Headers({"Content-Type":"text/html",...T(),...O.cache?{}:{"Cache-Control":"private, no-store"}});for(let P of N??[])x.append("Set-Cookie",P);for(let[P,z]of Object.entries(D??{}))x.set(P,z);if(x.set("Vary",T(x.get("Vary")).Vary),E&&!d){let P=ke(c);return x.set("X-STX-Fragment","true"),x.set("X-STX-Runtime",ce(c)?"true":"false"),x.set("X-STX-Layout",P.layout),x.set("X-STX-Layout-Group",P.group),new Response(re(c,r.routerContainer||"main"),{status:I??u.status??200,headers:x})}return new Response(c,{status:I??u.status??200,headers:x})}catch(c){if(console.error(`[stx] Hydration error for ${i}:`,c),Y)return new Response("Internal Server Error",{status:500});return new Response(u.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${L.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${b.size} pre-loaded)`),{port:L.port,stop:()=>{f.invalidate(),L.stop()},invalidate:(n)=>f.invalidate(n)}}
|
|
3
3
|
export{It,Qc};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{jn,Me,Le,he,Jo,Vn,Z,K,an,u,n,R}from"./chunk-96kr2xrt.js";import{dirname as k,resolve as _}from"path";function h(o){return o.endsWith(".md")||o.endsWith(".markdown")}function C(o){let e=[];g(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];g(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function g(s,p){let m;while((m=s.exec(o))!==null){let t=m.index,i=t+m[0].length;if(p?.some((l)=>t>=l.start&&i<=l.end))continue;e.push({start:t,end:i})}}if(e.length===0)return o;e.sort((s,p)=>s.start-p.start);let a="",c=0;for(let s of e){if(s.start<c)continue;a+=o.slice(c,s.start),a+=`@raw${o.slice(s.start,s.end)}@endraw`,c=s.end}return a+=o.slice(c),a}async function b(o,e={}){let{data:r,content:g}=jn(o),c=await(e.renderer??((s)=>Me(s)))(g);return{html:C(c),frontmatter:r??{}}}function v(o){let e=o,r=Z(o);if(r)e=r.content.trim();let g=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,a=[],c=[],s=[],p=(i)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(i),m;while((m=g.exec(o))!==null){let i=m[1],l=m[2],f=m[0],d=i.includes("server");if(p(l))s.push(f);else if(d)c.push(l);else a.push(f)}let t=e;{let i=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,f=[];while((l=i.exec(t))!==null){let d=l.index+l[0].length,x=t.indexOf("</script>",d);if(x===-1)continue;f.push({start:l.index,end:x+9}),i.lastIndex=x+9}for(let d=f.length-1;d>=0;d--)t=t.substring(0,f[d].start)+t.substring(f[d].end)}for(let i of a)t=t.replace(i,"");return{templateContent:t,serverScripts:c,clientScripts:a,signalsScripts:s}}function M(o,e){return`<!DOCTYPE html>
|
|
3
|
+
<html lang="en">
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
<title>${(e||"stx").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
${o}
|
|
11
|
+
</body>
|
|
12
|
+
</html>`}async function Io(o,e={}){let r=_(o),g=Bun.file(r);if(!await g.exists())throw Error(`Template file not found: ${r}`);let a=await g.text(),c=null;if(h(r)){let s=await b(a,{renderer:e.markdownRenderer});a=s.html,c=s.frontmatter}if(c)e={...e,context:{...c,...e.context||{}}};if(e.layout){let s=_(e.layout),p=Bun.file(s);if(!await p.exists())throw Error(`Layout template not found: ${s}`);let{layout:m,injectCSS:t,...i}=e,l={...e.context||{}};an(l);let f=await S(a,r,{...i,context:{...l,__stx_defer_server_data:!0},injectCSS:!1}),d=await p.text(),x={...l,content:f},w={...i,context:x,injectCSS:t};return S(d,s,w)}return S(a,r,e)}async function S(o,e,r={}){let{templateContent:g,serverScripts:a,clientScripts:c}=v(o),s={...R,...r.options},p={__filename:e,__dirname:k(e),__stx:{},__stx_options:s,__stx_sfc_mode:!0,__stx_inject_css:r.injectCSS===!0,__stxServeContext:void 0,...Vn(r.context??{}),definePageMeta:()=>{},...r.context||{}};for(let i of a)await u(i,p,e);let m=new Set,t=g;if(t=await n(t,p,e,s,m),Jo(p,r.context),r.templateOnly){if(t=t.replace(/<script data-stx-scoped>[\s\S]*?<\/script>\s*/gi,""),t=t.replace(/<!-- stx SEO Tags -->[\s\S]*?(?=<)/i,""),c.length>0)t+=`
|
|
13
|
+
${c.join(`
|
|
14
|
+
`)}`}else{if(r.processClientScripts!==!1&&c.length>0){let i=p.__stx_event_bindings||[],l=Le(p),d=(await Promise.all(c.map(async(w)=>{let y=w.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!y)return w;return await he(y[1],{eventBindings:i,templateContent:t,serverData:l,filePath:e})}))).join(`
|
|
15
|
+
`);if(t.match(/(<\/body>)/i))t=t.replace(/(<\/body>)/i,`${d}
|
|
16
|
+
$1`);else t+=`
|
|
17
|
+
${d}`}t=await K(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=M(t,r.title)}if(r.injectCSS)try{let{injectCss:i}=await import("./chunk-e4zks32s.js");t=await i(t)}catch{}return t}
|
|
18
|
+
export{Io};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{nd,rd}from"./chunk-5dh041x0.js";import"./chunk-s87qrma5.js";import"./chunk-qt31at4s.js";import"./chunk-2hc5mbw8.js";import"./chunk-96kr2xrt.js";import"./chunk-68tzytfz.js";import"./chunk-c57j92td.js";import"./chunk-kp4mzspk.js";import"./chunk-v74acg2k.js";import"./chunk-zz5b1g50.js";import"./chunk-5tbqdz94.js";import"./chunk-9p3rtfbv.js";import"./chunk-g495xx4v.js";import"./chunk-ba88n1j7.js";import"./chunk-g1r4v0mc.js";import"./chunk-xd4zvm4x.js";import"./chunk-e6y6s7q8.js";export{rd as clearStoreCache,nd as getStoreScript};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{vr,eo,Tn,wr,xr,Dt,dt,to,_n,Rn,Sr,kr,el,tl,Re}from"./chunk-1verz406.js";export{Re as DeployError,eo as calculateSha1,Tn as collectDeployFiles,Rn as createDefaultNetlifyConfig,wr as createFileManifest,vr as createNetlifyClient,el as deploy,_n as detectProjectConfig,xr as filterRequiredFiles,Dt as formatSize,to as generateNetlifyToml,dt as getTotalSize,kr as hasNetlifyConfig,tl as initNetlify,Sr as writeNetlifyConfig};
|