@stacksjs/stx 0.2.849 → 0.2.851
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-036pnz1y.js +2 -0
- package/dist/{chunk-rqjskxpw.js → chunk-0dnetjh8.js} +31 -31
- package/dist/{chunk-09412heg.js → chunk-0rszcb0m.js} +13 -13
- package/dist/chunk-1qdhwjs4.js +2 -0
- package/dist/{chunk-z57xq46m.js → chunk-2d7e5g92.js} +4 -4
- package/dist/{chunk-wp14sf2j.js → chunk-2j2qzv8g.js} +1 -1
- package/dist/{chunk-nws4zm4k.js → chunk-2rg9pqmh.js} +4 -4
- package/dist/chunk-2vfhzn8m.js +2 -0
- package/dist/chunk-30y1dbcf.js +2 -0
- package/dist/chunk-3gyq9rjx.js +2 -0
- package/dist/chunk-3m3jny87.js +2 -0
- package/dist/chunk-3w9xhs7k.js +2 -0
- package/dist/chunk-3wt0nh3p.js +2 -0
- package/dist/{chunk-v929r67j.js → chunk-422eg7vs.js} +1 -1
- package/dist/{chunk-jh36gqcq.js → chunk-422r7zkx.js} +2 -2
- package/dist/{chunk-yqjmqndq.js → chunk-45yytzyd.js} +6 -6
- package/dist/chunk-4e6wkjtx.js +2 -0
- package/dist/{chunk-c7qej674.js → chunk-4jf18yed.js} +56 -56
- package/dist/chunk-5bbwdv4y.js +3 -0
- package/dist/{chunk-fx8jjasv.js → chunk-5gfg2tqg.js} +4 -4
- package/dist/chunk-5yy40vxk.js +2 -0
- package/dist/chunk-67bn31a3.js +2 -0
- package/dist/{chunk-ct54e34a.js → chunk-69kbw21c.js} +1 -1
- package/dist/{chunk-54p27ney.js → chunk-69nhstnz.js} +5 -5
- package/dist/{chunk-63sqdcr6.js → chunk-6dqafrq5.js} +9 -9
- package/dist/chunk-6ekgf3b3.js +2 -0
- package/dist/{chunk-y1cneng3.js → chunk-6p62jjzm.js} +2 -2
- package/dist/chunk-6rk18x14.js +2 -0
- package/dist/chunk-7hnt9a2e.js +2 -0
- package/dist/{chunk-jmshgw0t.js → chunk-7hv190bd.js} +4 -4
- package/dist/chunk-80bb89fh.js +2 -0
- package/dist/{chunk-he9dzchk.js → chunk-833y1ndd.js} +1 -1
- package/dist/{chunk-93c08def.js → chunk-88392kaj.js} +5 -5
- package/dist/{chunk-t4dkcf28.js → chunk-8cvgm13s.js} +2 -2
- package/dist/chunk-8k6cd1e0.js +2 -0
- package/dist/chunk-8qqrrbap.js +2 -0
- package/dist/chunk-8spe7avc.js +2 -0
- package/dist/{chunk-2ts9pb6s.js → chunk-8vjr3atq.js} +2 -2
- package/dist/chunk-8wnkh2ss.js +2 -0
- package/dist/chunk-93kdj0t4.js +2 -0
- package/dist/chunk-9frv1kpd.js +2 -0
- package/dist/chunk-9pzbesp6.js +2 -0
- package/dist/{chunk-yrmppd8r.js → chunk-a2fngjfx.js} +1 -1
- package/dist/chunk-a7v1j7td.js +2 -0
- package/dist/{chunk-zfb2wnha.js → chunk-aas25pac.js} +3 -3
- package/dist/chunk-acbx3jn5.js +2 -0
- package/dist/{chunk-0wms5teg.js → chunk-agbkv9ab.js} +2 -2
- package/dist/{chunk-wdwx2aa6.js → chunk-amerebya.js} +2 -2
- package/dist/{chunk-b1q40vq4.js → chunk-anva219c.js} +2 -2
- package/dist/chunk-apq33h4w.js +2 -0
- package/dist/{chunk-tj533808.js → chunk-ark6w80h.js} +2 -2
- package/dist/{chunk-trgbdydw.js → chunk-axga9ebe.js} +2 -2
- package/dist/chunk-c90qz5w0.js +2 -0
- package/dist/{chunk-4fc8zs15.js → chunk-caehra7e.js} +5 -5
- package/dist/chunk-cct2fzth.js +42 -0
- package/dist/chunk-cwt26rvt.js +3 -0
- package/dist/chunk-dx31vsyf.js +2 -0
- package/dist/{chunk-0zgxxhvs.js → chunk-dy31f39m.js} +5 -5
- package/dist/{chunk-jaf44web.js → chunk-e105xsee.js} +1 -1
- package/dist/{chunk-8vkywnpx.js → chunk-e6qam3x3.js} +7 -7
- package/dist/{chunk-2j3gttzf.js → chunk-e85wsz8y.js} +1 -1
- package/dist/{chunk-tbcvarvy.js → chunk-e9qgyvz5.js} +2 -2
- package/dist/chunk-evyspfm5.js +2 -0
- package/dist/{chunk-rtsshvpt.js → chunk-eyp7rr70.js} +52 -52
- package/dist/{chunk-gpkxphqz.js → chunk-ezzskm4a.js} +2 -2
- package/dist/chunk-f4x21pqx.js +2 -0
- package/dist/{chunk-6xcmeev9.js → chunk-f5n871gp.js} +5 -5
- package/dist/{chunk-81ysx0tc.js → chunk-fffjjgnt.js} +2 -2
- package/dist/chunk-fj18grh2.js +2 -0
- package/dist/{chunk-wzyc9da7.js → chunk-frhdk0p9.js} +2 -2
- package/dist/chunk-frhh6jd3.js +2 -0
- package/dist/{chunk-b3n1m4m5.js → chunk-g046t3hb.js} +1 -1
- package/dist/chunk-g1gqysb4.js +2 -0
- package/dist/{chunk-emf6ee94.js → chunk-gsrdjmw9.js} +2 -2
- package/dist/{chunk-r96ahk8s.js → chunk-gwdffrz6.js} +9 -9
- package/dist/chunk-h7rcb74n.js +2 -0
- package/dist/{chunk-jcwtw3hd.js → chunk-h9gjt73q.js} +2 -2
- package/dist/{chunk-ke76eaat.js → chunk-hdep0xcy.js} +6 -6
- package/dist/chunk-htsqfx9m.js +2 -0
- package/dist/chunk-j3x3e353.js +2 -0
- package/dist/{chunk-88a7qaw8.js → chunk-j5pgwqwp.js} +3 -3
- package/dist/chunk-j882bpqq.js +2 -0
- package/dist/{chunk-rwc322gq.js → chunk-j8f4tb4p.js} +2 -2
- package/dist/chunk-jxzcwjx4.js +2 -0
- package/dist/chunk-k1pyzf9e.js +2 -0
- package/dist/{chunk-eg2p1cyw.js → chunk-k47addf7.js} +29 -29
- package/dist/{chunk-qpz9jrvw.js → chunk-k7dvn2r8.js} +2 -2
- package/dist/{chunk-fa3ygt8c.js → chunk-kd06c90f.js} +4 -4
- package/dist/chunk-kf5fsz9b.js +3 -0
- package/dist/chunk-knapnbwv.js +2 -0
- package/dist/{chunk-9sjtph54.js → chunk-krtkxnz6.js} +2 -2
- package/dist/{chunk-25m74mh1.js → chunk-m05pqmcj.js} +5 -5
- package/dist/chunk-m276y4f3.js +2 -0
- package/dist/{chunk-cww1zk8y.js → chunk-m710wkr4.js} +1 -1
- package/dist/{chunk-3m5v3ynh.js → chunk-m9kkd9f2.js} +3 -3
- package/dist/{chunk-y6wbbmp3.js → chunk-ngdye54z.js} +3 -3
- package/dist/{chunk-b147ejha.js → chunk-nqv66ehx.js} +3 -3
- package/dist/chunk-p2gsezmj.js +2 -0
- package/dist/{chunk-ynnd6nnt.js → chunk-p4ytnee6.js} +105 -102
- package/dist/chunk-p9sbpbhg.js +2 -0
- package/dist/chunk-pg2dxnry.js +2 -0
- package/dist/{chunk-3qyz80d6.js → chunk-pkq96sqk.js} +6 -6
- package/dist/chunk-q2d8x7p1.js +2 -0
- package/dist/{chunk-xr9rf0e6.js → chunk-q5rw0d2m.js} +3 -3
- package/dist/{chunk-tm5t3hh3.js → chunk-qa4vs1qg.js} +3 -3
- package/dist/{chunk-jm0qsr3s.js → chunk-qev14f76.js} +6 -6
- package/dist/{chunk-tb5h85ag.js → chunk-qjc3qjyf.js} +2 -2
- package/dist/{chunk-1k12cc65.js → chunk-qk2herh9.js} +13 -13
- package/dist/{chunk-qay7pgnq.js → chunk-r0k5jbvk.js} +1 -1
- package/dist/{chunk-bttvkzxh.js → chunk-s0pnyd2f.js} +6 -6
- package/dist/{chunk-dv9q56r7.js → chunk-s37af6rd.js} +2 -2
- package/dist/{chunk-2xf323h9.js → chunk-scaawv2r.js} +3 -3
- package/dist/{chunk-c541s99z.js → chunk-t23jn83r.js} +4 -4
- package/dist/{chunk-fez9828r.js → chunk-t74qb5ej.js} +3 -3
- package/dist/{chunk-bsw6hd14.js → chunk-taf784yy.js} +2 -2
- package/dist/chunk-tdtwqydq.js +2 -0
- package/dist/{chunk-ga650crj.js → chunk-tm1ec751.js} +9 -9
- package/dist/{chunk-f2zgh4xr.js → chunk-tr5r70yr.js} +12 -12
- package/dist/chunk-ty915d4h.js +2 -0
- package/dist/{chunk-46t924aw.js → chunk-v4bqmzj9.js} +2 -2
- package/dist/chunk-vk9zpckc.js +2 -0
- package/dist/chunk-vvr19nq7.js +2 -0
- package/dist/{chunk-ema1c29k.js → chunk-w032x0zm.js} +2 -2
- package/dist/chunk-wjf69hmc.js +2 -0
- package/dist/{chunk-90mm5bf8.js → chunk-wn8qkcaw.js} +4 -4
- package/dist/{chunk-mnncq81c.js → chunk-wtahqbxe.js} +8 -8
- package/dist/{chunk-ma9yq04p.js → chunk-wzv7k91a.js} +2 -2
- package/dist/chunk-x4077p94.js +2 -0
- package/dist/chunk-x9a2agqk.js +2 -0
- package/dist/{chunk-83dxfhkw.js → chunk-xj5jdy7n.js} +7 -7
- package/dist/{chunk-9qxx2teq.js → chunk-xndr2dx9.js} +6 -6
- package/dist/chunk-xsavnbkv.js +2 -0
- package/dist/{chunk-k7e3e149.js → chunk-xz4yq7gh.js} +102 -102
- package/dist/chunk-ydjy26ch.js +2 -0
- package/dist/{chunk-k44qj40k.js → chunk-ym5qgw03.js} +2 -2
- package/dist/{chunk-8bxws458.js → chunk-yvfzvygh.js} +3 -3
- package/dist/chunk-yx37mvy7.js +2 -0
- package/dist/chunk-yza0mj53.js +20 -0
- package/dist/{chunk-na1x46xm.js → chunk-z0qfspzg.js} +3 -3
- package/dist/chunk-z278w3cb.js +2 -0
- package/dist/chunk-z33esms3.js +3 -0
- package/dist/{chunk-9mbyhepc.js → chunk-zjm67zx2.js} +5 -5
- package/dist/chunk-znfzh6fm.js +2 -0
- package/dist/chunk-zwy89pzx.js +2 -0
- package/dist/chunk-zz1n2ake.js +2 -0
- package/dist/cli.js +20 -20
- package/dist/component-renderer.d.ts +1 -0
- package/dist/component-renderer.js +28 -4
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/pwa.js +3 -3
- package/dist/safe-evaluator.d.ts +10 -0
- package/dist/safe-evaluator.js +24 -5
- package/dist/server-bindings.d.ts +11 -0
- package/dist/server-bindings.js +27 -0
- package/dist/ssg.js +15 -15
- package/dist/stx-virtual-ts.d.ts +38 -0
- package/dist/stx-virtual-ts.js +132 -5
- package/dist/typecheck.d.ts +1 -1
- package/dist/typecheck.js +5 -4
- package/package.json +5 -5
- package/dist/chunk-056rsqc6.js +0 -20
- package/dist/chunk-0d4zhbjz.js +0 -2
- package/dist/chunk-0ey7kc6t.js +0 -3
- package/dist/chunk-11snc6n0.js +0 -2
- package/dist/chunk-1menbxwb.js +0 -2
- package/dist/chunk-1pf4y2yr.js +0 -2
- package/dist/chunk-2sxmmjt1.js +0 -2
- package/dist/chunk-34afrhts.js +0 -2
- package/dist/chunk-37bzsnr7.js +0 -2
- package/dist/chunk-3m6n90sk.js +0 -2
- package/dist/chunk-4q4mtrc5.js +0 -2
- package/dist/chunk-5bm8hmwd.js +0 -2
- package/dist/chunk-5r2z29n8.js +0 -2
- package/dist/chunk-660preb9.js +0 -2
- package/dist/chunk-6hd83cj4.js +0 -2
- package/dist/chunk-740njbwc.js +0 -2
- package/dist/chunk-77fs8281.js +0 -2
- package/dist/chunk-7c73t536.js +0 -2
- package/dist/chunk-84gg2atb.js +0 -2
- package/dist/chunk-86z8zrn9.js +0 -3
- package/dist/chunk-9c6yvh3p.js +0 -2
- package/dist/chunk-9f0pv6sz.js +0 -2
- package/dist/chunk-9fxeqf0e.js +0 -2
- package/dist/chunk-atsjexk0.js +0 -2
- package/dist/chunk-bcefawtc.js +0 -2
- package/dist/chunk-bkqqa8aw.js +0 -2
- package/dist/chunk-bmds786f.js +0 -2
- package/dist/chunk-c0azgkss.js +0 -2
- package/dist/chunk-cbz7jtzf.js +0 -2
- package/dist/chunk-e1n286mv.js +0 -2
- package/dist/chunk-evdskc25.js +0 -2
- package/dist/chunk-f8akfzzn.js +0 -2
- package/dist/chunk-f8wmxwa3.js +0 -2
- package/dist/chunk-fseqwysr.js +0 -2
- package/dist/chunk-gg48cgx3.js +0 -2
- package/dist/chunk-h8zb6cek.js +0 -2
- package/dist/chunk-hc4ydhw0.js +0 -2
- package/dist/chunk-j08r18x1.js +0 -2
- package/dist/chunk-j539dz72.js +0 -2
- package/dist/chunk-jqngvqby.js +0 -2
- package/dist/chunk-k33kgf8a.js +0 -2
- package/dist/chunk-kz7ha54c.js +0 -2
- package/dist/chunk-m7cbkrz6.js +0 -2
- package/dist/chunk-md8dj6tb.js +0 -2
- package/dist/chunk-na1v2jcy.js +0 -2
- package/dist/chunk-p2fkggw4.js +0 -3
- package/dist/chunk-pqqyjvq9.js +0 -2
- package/dist/chunk-q18508s2.js +0 -2
- package/dist/chunk-qczgdzjk.js +0 -2
- package/dist/chunk-r40g6785.js +0 -2
- package/dist/chunk-r6085mp4.js +0 -2
- package/dist/chunk-rke4q3jk.js +0 -2
- package/dist/chunk-rrnvbwac.js +0 -2
- package/dist/chunk-shnw9geh.js +0 -42
- package/dist/chunk-te1wksa0.js +0 -2
- package/dist/chunk-v11hvvxc.js +0 -2
- package/dist/chunk-vasvns9e.js +0 -2
- package/dist/chunk-vdb3p2v3.js +0 -2
- package/dist/chunk-vm2y05sr.js +0 -2
- package/dist/chunk-x2wn6mpd.js +0 -2
- package/dist/chunk-x45mp78q.js +0 -2
- package/dist/chunk-xa2qfe51.js +0 -3
- package/dist/chunk-xsmyhp5f.js +0 -2
- package/dist/chunk-zecffe6a.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ln,No,Mo,Do,Oh,Lo}from"./chunk-69nhstnz.js";import"./chunk-2rg9pqmh.js";import"./chunk-8cvgm13s.js";import"./chunk-v4bqmzj9.js";export{Mo as buildServerApi,Oh as createServerApi,ln as discoverServerApi,No as generateApiTypes,Lo as isServerApiSource,Do as productionApiDispatcher};
|
|
@@ -159,7 +159,7 @@ else {
|
|
|
159
159
|
stxIslands.initIslands();
|
|
160
160
|
}
|
|
161
161
|
})();
|
|
162
|
-
</script>`}function b(e){let t=e.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(t)return t[1];let n=e.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(n)return n[1];return null}function w(e,t){let n={},r=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,i;while((i=r.exec(e))!==null){let d=i[1],o=i[2];if(o in t)n[d]=t[o];else n[d]=o}return n}function
|
|
162
|
+
</script>`}function b(e){let t=e.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(t)return t[1];let n=e.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(n)return n[1];return null}function w(e,t){let n={},r=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,i;while((i=r.exec(e))!==null){let d=i[1],o=i[2];if(o in t)n[d]=t[o];else n[d]=o}return n}function ru(){let e=new Map;return{islands:e,register(t){e.set(t.id,t)},get(t){return e.get(t)},async hydrate(t){let n=e.get(t);if(!n||n.hydrated)return;if(n.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:t,component:n.component}}))},async hydrateAll(){let t=Array.from(e.values()).filter((n)=>!n.hydrated).map((n)=>this.hydrate(n.id));await Promise.all(t)}}}function I(e){return`
|
|
163
163
|
<script data-hydrate="${e}">
|
|
164
164
|
(function() {
|
|
165
165
|
const island = document.querySelector('[data-island="${e}"]');
|
|
@@ -311,7 +311,7 @@ else {
|
|
|
311
311
|
});
|
|
312
312
|
})();
|
|
313
313
|
</script>
|
|
314
|
-
`}function
|
|
314
|
+
`}function su(e,t={},n){let r=e,i=!1,d=/@client:(load|idle|visible|media|only|hover|event)/i.test(e);if(r=u(r,"load",t),r=u(r,"idle",t),r=u(r,"visible",t),r=u(r,"media",t),r=M(r),r=u(r,"hover",t),r=u(r,"event",t),i=d&&r!==e,i)r+=`
|
|
315
315
|
`+v();return r}function u(e,t,n){let r=new RegExp(`@client:${t}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return e.replace(r,(i,d,o)=>{let a={strategy:t};if(d)try{let E=d.split(",").map((h)=>h.trim());for(let h of E){let[m,g]=h.split(":").map((p)=>p.trim());if(m&&g){let p=g.replace(/^['"]|['"]$/g,"");a[m]=p}}}catch{}let s=`island-${Math.random().toString(36).substring(2,9)}`,y=b(o.trim()),f=w(o.trim(),n),c=[];if(a.rootMargin)c.push(`data-root-margin="${a.rootMargin}"`);if(a.threshold!==void 0)c.push(`data-threshold="${a.threshold}"`);if(a.media)c.push(`data-media="${a.media}"`);if(a.event)c.push(`data-event="${a.event}"`);if(y)c.push(`data-component="${y}"`);let x=Object.keys(f).length>0?`
|
|
316
316
|
<script type="application/json" data-island-props="${s}">${JSON.stringify(f)}</script>`:"",l="";switch(t){case"load":l=I(s);break;case"idle":l=L(s,a);break;case"visible":l=C(s,a);break;case"media":l=S(s,a);break;case"hover":l=k(s);break;case"event":l=H(s,a);break}return`
|
|
317
317
|
<div data-island="${s}"
|
|
@@ -342,7 +342,7 @@ else {
|
|
|
342
342
|
}
|
|
343
343
|
})();
|
|
344
344
|
</script>
|
|
345
|
-
`})}function
|
|
345
|
+
`})}function ou(){return`
|
|
346
346
|
/* Island base styles */
|
|
347
347
|
.stx-island {
|
|
348
348
|
display: contents;
|
|
@@ -383,9 +383,9 @@ else {
|
|
|
383
383
|
.stx-island.hydrated {
|
|
384
384
|
opacity: 1;
|
|
385
385
|
}
|
|
386
|
-
`}function
|
|
386
|
+
`}function iu(e){if(typeof window>"u")return;let t=document.querySelector(`[data-island="${e}"]`);if(!t||t.classList.contains("hydrated"))return;t.classList.add("hydrated"),t.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function au(e){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${e}"]:not(.hydrated)`).forEach((n)=>{n.classList.add("hydrated"),n.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function cu(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach((t)=>{t.classList.add("hydrated"),t.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function lu(e){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${e}"]`)?.classList.contains("hydrated")??!1}function uu(e){return new Promise((t)=>{if(typeof window>"u"){t();return}let n=document.querySelector(`[data-island="${e}"]`);if(!n){t();return}if(n.classList.contains("hydrated")){t();return}n.addEventListener("stx:hydrated",()=>t(),{once:!0})})}function du(e){return e.replace(/@static\s*([\s\S]*?)@endstatic/gi,(t,n)=>`<div class="stx-static">${n.trim()}</div>`)}function pu(e){let t=e.map((n)=>({id:n.id,component:n.component,strategy:n.options.strategy,props:n.props}));return`
|
|
387
387
|
<script type="application/json" id="stx-island-manifest">
|
|
388
388
|
${JSON.stringify(t)}
|
|
389
389
|
</script>
|
|
390
|
-
`}var
|
|
391
|
-
export{
|
|
390
|
+
`}var Bm={processPartialHydrationDirectives:su,processStaticDirectives:du,generatePartialHydrationCSS:ou,generateIslandManifest:pu,createIslandRegistry:ru,hydrateIsland:iu,hydrateByStrategy:au,hydrateAll:cu,isHydrated:lu,onHydrated:uu};
|
|
391
|
+
export{ru,su,ou,iu,au,cu,lu,uu,du,pu,Bm};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Dl,la,Ll,jl,ua,Bl,Fl,zl,Hl,da,Vl,om}from"./chunk-f5n871gp.js";import{va,Kl}from"./chunk-8vjr3atq.js";import{ee,te,ne,jn,he,$e,Yr,ht,Yt,Bn,Fn,zn,re,Hn,Vn,Zr}from"./chunk-422r7zkx.js";import{Zl}from"./chunk-fffjjgnt.js";import"./chunk-t74qb5ej.js";export{te as DEFAULT_FORMATS,ne as DEFAULT_QUALITY,ee as DEFAULT_WIDTHS,Zr as ImageProcessingError,jl as clearImageCache,ua as createImageDirective,Kl as createImageHandler,Fl as createImagePlugin,om as defaultImageConfig,Vn as formatSize,da as generateImageManifest,Yt as generateSizes,ht as generateSrcSet,Bn as getFallbackVariant,Yr as getImageMetadata,re as getMimeType,Hn as getTotalSize,Fn as groupVariantsByFormat,va as handleImageRequest,Bl as imageDirective,he as isImageBackendAvailable,zn as isImageFile,jn as isSharpAvailable,Hl as optimizeDirectory,zl as optimizeImage,la as parseImageComponent,$e as processImage,Ll as processImageComponents,Dl as renderImageComponent,Zl as rewriteImagesWithSiblings,Vl as writeImageManifest};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{P,t,l}from"./chunk-
|
|
3
|
-
`),n=[{obj:s,indent:-1}];for(let r of i){let o=r.replace(/#.*$/,"").trimEnd();if(!o.trim())continue;let c=o.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,a=o.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(a){let[,,g,p]=a,f=g.trim(),m=p.trim();if(m==="")u[f]={},n.push({obj:u[f],indent:c});else u[f]=ee(m)}}return s}function ee(e){if(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);let s=e.toLowerCase();if(s==="true"||s==="yes")return!0;if(s==="false"||s==="no")return!1;if(s==="null"||s==="~")return null;let i=Number(e);if(!Number.isNaN(i)&&e!=="")return i;return e}function te(e){switch(e){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function re(e,s){return G(e,s)}function ne(e,s){for(let i of e){let n=i.trim(),r=n.match(/^\{(\d+)\}\s*(.*)$/);if(r){let c=Number.parseInt(r[1],10);if(s===c)return r[2];continue}let o=n.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(o){let c=Number.parseInt(o[1],10),u=o[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(o[2],10);if(s>=c&&s<=u)return o[3];continue}}if(e.length===2)return s===1?e[0].trim():e[1].trim();if(s<e.length)return e[s].trim();return e[e.length-1].trim()}function ie(e,s={}){return j(e,s)}function j(e,s){let i="",n=0;while(n<e.length)if(e[n]==="{"){let r=se(e,n);if(r===-1){i+=e[n],n++;continue}let o=e.slice(n+1,r);i+=ae(o,s),n=r+1}else if(e[n]==="'"&&n+1<e.length)if(e[n+1]==="'")i+="'",n+=2;else if(e[n+1]==="{"||e[n+1]==="}")i+=e[n+1],n+=2;else i+=e[n],n++;else i+=e[n],n++;return i}function se(e,s){let i=0;for(let n=s;n<e.length;n++)if(e[n]==="{")i++;else if(e[n]==="}"){if(i--,i===0)return n}return-1}function ae(e,s){let i=oe(e);if(i.length===0)return`{${e}}`;let n=i[0].trim(),r=s[n];if(i.length===1)return r!==void 0?String(r):`{${n}}`;switch(i[1].trim().toLowerCase()){case"plural":return le(r,i.slice(2).join(","),s);case"select":return ue(r,i.slice(2).join(","));case"selectordinal":return de(r,i.slice(2).join(","));case"number":return pe(r,i[2]?.trim());case"date":return fe(r,i[2]?.trim());case"time":return me(r,i[2]?.trim());default:return r!==void 0?String(r):`{${e}}`}}function oe(e){let s=[],i="",n=0;for(let r=0;r<e.length;r++){let o=e[r];if(o==="{")n++,i+=o;else if(o==="}")n--,i+=o;else if(o===","&&n===0)s.push(i),i="";else i+=o}if(i)s.push(i);return s}function le(e,s,i){let n=Number(e)||0,r=I(s),o=`=${n}`;if(r[o])return R(r[o],n,i);let c=ce(n);if(r[c])return R(r[c],n,i);if(r.other)return R(r.other,n,i);return String(n)}function R(e,s,i){let n=e.replace(/#/g,String(s));return j(n,i)}function ce(e){let s=Math.abs(e),i=Math.floor(s),n=String(e).includes(".")?String(e).split(".")[1].length:0;if(i===1&&n===0)return"one";return"other"}function ue(e,s){let i=String(e||""),n=I(s);if(n[i])return n[i];return n.other||String(e)}function de(e,s){let i=Number(e)||0,n=I(s),r=ge(i);if(n[r])return n[r].replace(/#/g,String(i));if(n.other)return n.other.replace(/#/g,String(i));return String(i)}function ge(e){let s=Math.abs(e),i=s%10,n=s%100;if(i===1&&n!==11)return"one";if(i===2&&n!==12)return"two";if(i===3&&n!==13)return"few";return"other"}function I(e){let s={},i=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,n=i.exec(e);while(n!==null)s[n[1]]=n[2],n=i.exec(e);return s}function pe(e,s){let i=Number(e);if(Number.isNaN(i))return String(e);switch(s){case"integer":return Math.floor(i).toLocaleString();case"percent":return`${(i*100).toFixed(0)}%`;case"currency":return i.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return i.toLocaleString()}}function fe(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let n={};switch(s){case"short":n.dateStyle="short";break;case"medium":n.dateStyle="medium";break;case"long":n.dateStyle="long";break;case"full":n.dateStyle="full";break;default:n.dateStyle="medium"}return i.toLocaleDateString(void 0,n)}function me(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let n={};switch(s){case"short":n.timeStyle="short";break;case"medium":n.timeStyle="medium";break;case"long":n.timeStyle="long";break;case"full":n.timeStyle="full";break;default:n.timeStyle="short"}return i.toLocaleTimeString(void 0,n)}function be(e){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(e)}function O(e,s,i=!0,n={}){let r=e.split("."),o=s;for(let u of r){if(o===void 0||o===null)break;o=o[u]}if(o===void 0||o===null)return i?e:"";let c=String(o);if(be(c))return ie(c,n);if(c.includes("|")&&"count"in n){let u=Number(n.count),a=c.split("|");c=ne(a,u)}for(let[u,a]of Object.entries(n)){let g=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");c=c.replace(new RegExp(`:${g}`,"g"),()=>String(a))}return c}var D=new Set(["ar","arc","ckb","dv","fa","he","khw","ks","nqo","prs","ps","sd","syr","ug","ur","uz-af","yi"]),he=new Set(["adlm","arab","aran","hebr","nkoo","rohg","syrc","thaa","yezi"]);function q(e){if(!e)return"ltr";let s=e.trim().toLowerCase().replace(/_/g,"-").split("-"),i=s[0];if(!i)return"ltr";let n=s[1]?.length===4?s[1]:void 0;if(n)return he.has(n)?"rtl":"ltr";if(s.length>1&&D.has(`${i}-${s[1]}`))return"rtl";return D.has(i)?"rtl":"ltr"}async function xc(e,s,i,n){let r=e,o=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,c={...T,...n.i18n},u=await re(c.locale,n);s.__translations=u,s.__locale=c.locale,s.__i18nConfig=c,r=await F(r,o,async(p,f,m,w,h)=>{try{let b={};if(m)try{let d=[()=>JSON.parse(m),()=>{let x=`{"data":${m}}`,A=JSON.parse(x);return typeof A.data==="object"?A.data:{}},()=>P(m,s)];for(let x of d)try{if(b=x(),Object.keys(b).length>0)break}catch{}}catch(d){if(n.debug)console.error("Error parsing parameters for @translate directive:",d)}let y=O(f,u,c.fallbackToKey,b);return y?Q(r,h,y,!1,p.length):w.trim()}catch(b){if(n.debug)console.error("Error processing @translate directive:",b);return l("Translate",`Error in @translate('${f}'): ${b instanceof Error?b.message:String(b)}`,t.EVALUATION_ERROR)}});let a=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(n.debug){console.warn(`Processing translations in template. Sections: ${r.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let p=[...r.matchAll(a)];console.warn(`Found ${p.length} @translate matches`),p.forEach((f,m)=>console.warn(`Match ${m}: ${f[0]}, Key: ${f[1]}, Params: ${f[2]||"none"}`))}return r=await F(r,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(p,f,m,w)=>{try{let h={};if(m)try{let b=[()=>JSON.parse(m),()=>{let y=`{"data":${m}}`,d=JSON.parse(y);return typeof d.data==="object"?d.data:{}},()=>P(m,s)];for(let y of b)try{if(h=y(),Object.keys(h).length>0)break}catch{}}catch(b){if(n.debug)console.error("Error parsing parameters for @translate directive:",b)}return Q(r,w,O(f,u,c.fallbackToKey,h),!1,p.length)}catch(h){if(n.debug)console.error("Error processing @translate directive:",h);return l("Translate",`Error in @translate('${f}'): ${h instanceof Error?h.message:String(h)}`,t.EVALUATION_ERROR)}}),r}async function F(e,s,i){let n=[];return e.replace(s,(o,...c)=>{let u=i(o,...c).then((a)=>({match:o,replacement:a}));return n.push(u),o}),(await Promise.all(n)).reduce((o,{match:c,replacement:u})=>o.replace(c,()=>u),e)}function _(e,s){if(!e||q(e)!=="rtl")return!1;return!s||s.trim().toLowerCase()!=="rtl"}function V(e){if(!e)return!1;return e.trim().split(/\s+/)[0]?.toLowerCase()==="presentation"||e.trim().split(/\s+/)[0]?.toLowerCase()==="none"}function U(e,s){let i=new RegExp(`\\b${s}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(e);if(!i)return null;return i[2]??i[3]??i[4]??null}function Sc(e,s,i,n){let r=e;r=r.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(c,u,a)=>{let p={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[u]||"Make this element accessible";return`<!-- a11y-hint: ${a||p} -->`});let o=/@screenReader\(([^@]*)\)@endScreenReader/g;return r=r.replace(o,(c,u)=>`<span class="sr-only">${u.trim()}</span>`),r=r.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(c,u,a)=>`<span id="${`desc-${u}`}" class="sr-only">${a}</span>`),r}function ye(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function xe(e){let s=new Map,i=e.replace(/<(\/?)([A-Z][\w:.-]*)(?=[\s/>])/g,(r,o,c)=>{let u=s.get(c);if(!u)u=`stx-a11y-component-${s.size}`,s.set(c,u);return`<${o}${u}`}),n=new Map([...s.entries()].map(([r,o])=>[o,r]));return{protectedSource:i,restore:(r)=>r.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(o,c,u)=>{let a=n.get(u);return a?`<${c}${a}`:o})}}function we(e,s){let i=[],n=/<img\s+([^>]*)>/gi,r;r=n.exec(e);while(r!==null){let d=r[1];if(!/\balt\s*=/i.test(d))i.push({type:"missing-alt",element:r[0].substring(0,100),message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"});r=n.exec(e)}let o=/<button([^>]*)>\s*<\/button>/gi;r=o.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"missing-accessible-name",element:r[0].substring(0,100),message:"Empty button missing accessible name",impact:"critical",help:"Add text content, aria-label, or title",helpUrl:"https://web.dev/learn/accessibility/aria-html/"});r=o.exec(e)}let 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))i.push({type:"link-missing-text",element:r[0].substring(0,100),message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"});r=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),M=r.index,N=e.substring(0,M),Se=e.substring(M),H=(N.match(/<label\b/gi)||[]).length,z=(N.match(/<\/label>/gi)||[]).length,K=H>z;if(!B&&!K)i.push({type:"input-missing-label",element:r[0].substring(0,100),message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})}r=u.exec(e)}let a=/<h([1-6])[^>]*>/gi,g=[];r=a.exec(e);while(r!==null)g.push(Number.parseInt(r[1],10)),r=a.exec(e);let p=0;for(let d of g){if(p>0&&d>p+1)i.push({type:"heading-skip",element:`<h${d}>`,message:`Heading level skipped from h${p} to h${d}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});p=d}if(/<html\b/i.test(e)&&!/<html[^>]*\slang\s*=/i.test(e))i.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});let f=e.match(/<html\b([^>]*)>/i);if(f&&_(U(f[1],"lang"),U(f[1],"dir")))i.push({type:"missing-dir",element:f[0].substring(0,100),message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});let m=/<table([^>]*)>([\s\S]*?)<\/table>/gi;r=m.exec(e);while(r!==null){let d=r[2];if(!V(U(r[1],"role"))&&!/<th\b/i.test(d))i.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});r=m.exec(e)}let w=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;r=w.exec(e);while(r!==null){if(!/\bmuted\b/i.test(r[0]))i.push({type:"autoplay-audio",element:`<${r[1]}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"});r=w.exec(e)}let h=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;r=h.exec(e);while(r!==null)i.push({type:"positive-tabindex",element:`tabindex="${r[1]}"`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"}),r=h.exec(e);let b=/<iframe\s+([^>]*)>/gi;r=b.exec(e);while(r!==null){let d=r[1];if(!/\btitle\s*=/i.test(d)&&!/\baria-label\s*=/i.test(d))i.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"});r=b.exec(e)}let y=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;r=y.exec(e);while(r!==null){let d=r[1].toLowerCase(),x=r[2];if(d!=="button"&&!/\btabindex\s*=/i.test(x))i.push({type:"button-not-focusable",element:r[0].substring(0,100),message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"});r=y.exec(e)}return i}async function Ae(e,s){let{protectedSource:i}=xe(e);if(!ye())return we(i,s);let n=[];try{let r=globalThis.document.createElement("div");r.innerHTML=i,r.querySelectorAll("img").forEach((a)=>{if(!a.hasAttribute("alt"))n.push({type:"missing-alt",element:`<${a.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),r.querySelectorAll('button, a, [role="button"]').forEach((a)=>{if(!(a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby")||a.textContent&&a.textContent.trim().length>0))n.push({type:"missing-accessible-name",element:`<${a.outerHTML}>`,message:"Interactive element missing accessible name",impact:"critical",help:"Add text content, aria-label, or aria-labelledby",helpUrl:"https://web.dev/learn/accessibility/aria-html/"})}),r.querySelectorAll("input, select, textarea").forEach((a)=>{let g=a.getAttribute("id"),p=g&&r.querySelector(`label[for="${g}"]`),f=a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby"),m=a.closest("label")!==null;if(!p&&!f&&!m)n.push({type:"input-missing-label",element:`<${a.outerHTML}>`,message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})});let o=Array.from(r.querySelectorAll("h1, h2, h3, h4, h5, h6")),c=0;for(let a of o){let g=Number.parseInt(a.tagName.charAt(1));if(c>0&&g>c+1)n.push({type:"heading-skip",element:`<${a.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(i.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&&_(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((a)=>{let g=a.textContent&&a.textContent.trim().length>0,p=a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby"),f=a.hasAttribute("title"),m=a.querySelector("img[alt]");if(!g&&!p&&!f&&!m)n.push({type:"link-missing-text",element:`<${a.outerHTML}>`,message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"})}),i.includes("<nav")||i.includes("<header")){if(!r.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&r.querySelectorAll("a").length>5)n.push({type:"missing-skip-link",element:"<nav>",message:"Consider adding a skip navigation link",impact:"minor",help:"Add a skip link to allow keyboard users to bypass navigation",helpUrl:"https://web.dev/learn/accessibility/focus/#skip-links"})}if(r.querySelectorAll("table").forEach((a)=>{if(V(a.getAttribute("role")))return;let g=a.querySelector("caption");if(!a.querySelector("th"))n.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});if(!g&&!a.hasAttribute("aria-label")&&!a.hasAttribute("aria-labelledby"))n.push({type:"table-missing-caption",element:"<table>",message:"Table missing caption or accessible name",impact:"minor",help:"Add a caption element or aria-label to describe the table",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"})}),r.querySelectorAll('[style*="color"]').forEach((a)=>{let g=a.getAttribute("style")||"";if(g.includes("color:")&&!g.includes("background"))n.push({type:"potential-contrast-issue",element:`<${a.tagName.toLowerCase()}>`,message:"Element has inline color style - verify contrast ratio",impact:"minor",help:"Ensure text has sufficient contrast ratio (4.5:1 for normal text)",helpUrl:"https://web.dev/learn/accessibility/color-contrast/"})}),r.querySelectorAll("video[autoplay], audio[autoplay]").forEach((a)=>{if(!a.hasAttribute("muted"))n.push({type:"autoplay-audio",element:`<${a.tagName.toLowerCase()}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"})}),r.querySelectorAll("[tabindex]").forEach((a)=>{if(Number.parseInt(a.getAttribute("tabindex")||"0")>0)n.push({type:"positive-tabindex",element:`<${a.tagName.toLowerCase()}>`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"})}),r.querySelectorAll('[role="button"]').forEach((a)=>{if(!a.hasAttribute("tabindex"))n.push({type:"button-not-focusable",element:`<${a.outerHTML}>`,message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"})}),i.includes("<body")&&!r.querySelector('main, [role="main"]'))n.push({type:"missing-main-landmark",element:"<body>",message:"Document missing main landmark region",impact:"moderate",help:"Add a main element to identify the primary content",helpUrl:"https://web.dev/learn/accessibility/structure/#landmarks"});r.querySelectorAll("iframe").forEach((a)=>{if(!a.hasAttribute("title")&&!a.hasAttribute("aria-label"))n.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"})})}catch(r){console.error(`Error checking accessibility in ${s}:`,r)}return n}async function kc(e,s={}){let i={},{recursive:n=!0,ignorePaths:r=[]}=s,o=Array.isArray(e)?e:[e],c=await ti(o,{recursive:n,ignorePaths:r}),u=[];for(let a of c)try{let g=await Bun.file(a).text();if(a.endsWith("good-a11y.stx"))continue;let p=await Ae(g,a);if(u.push(a),p.length>0)i[a]=p}catch(g){console.error(`Error scanning ${a}:`,g)}return{results:i,scannedFiles:u}}var _c={name:"a11y",handler:(e,s,i,n)=>{if(!s.length)return e;let r=s[0].replace(/['"]/g,""),o=s.length>1?s[1].replace(/['"]/g,""):"",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: ${o||u} -->${e}`},hasEndTag:!1},Cc={name:"screenReader",handler:(e)=>`<span class="sr-only">${e}</span>`,hasEndTag:!0};
|
|
4
|
-
export{
|
|
2
|
+
import{P,t,l}from"./chunk-k47addf7.js";import{Q}from"./chunk-p4ytnee6.js";import{ti}from"./chunk-jtccqpwa.js";import E from"path";var S;async function W(){if(S!==void 0)return S;try{let e=await import("@stacksjs/ts-i18n");S=e.loadLocale??null}catch{S=null}return S}var T={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},v={},L={},k={};function J(e,s=0){if(s<=0)return!1;return Date.now()-e.loadedAt>s}async function G(e,s){if({...T,...s.i18n}.cache&&v[e]){let r=v[e],o=s.i18n?.cacheMaxAge??0;if(!J(r,o))return r.translations}if(L[e]?.state==="loading")return L[e].promise;k[e]="loading";let n=C(e,s).then((r)=>(k[e]="loaded",delete L[e],r)).catch((r)=>{throw k[e]="error",L[e]={promise:n,state:"error",error:r instanceof Error?r:Error(String(r))},r});return L[e]={promise:n,state:"loading"},n}async function C(e,s){let i={...T,...s.i18n},n=E.isAbsolute(i.translationsDir)?i.translationsDir:E.resolve(s.root||process.cwd(),i.translationsDir);try{let r=await W(),o=r?await r(e,{translationsDir:n,defaultLocale:i.defaultLocale,sources:te(i.format)}):await Y(e,i,n);if(o===void 0){let u=e!==i.defaultLocale?await C(i.defaultLocale,s):{};if(i.cache)v[e]={translations:u,loadedAt:Date.now(),locale:e};return u}let c=o;if(i.cache)v[e]={translations:c,loadedAt:Date.now(),locale:e};return c}catch(r){if(s.debug)console.error(`Error loading translation file for locale "${e}":`,r);if(e!==i.defaultLocale)return C(i.defaultLocale,s);return{}}}async function Y(e,s,i){let n=E.join(i,`${e}${Z(s.format)}`);try{let r=await import(n);return r.default||r}catch(r){try{let o=await Bun.file(n).text();if(s.format==="yaml"||s.format==="yml")return X(o);if(s.format==="json")return JSON.parse(o);throw r}catch{return}}}function Z(e){switch(e){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function X(e){let s={},i=e.split(`
|
|
3
|
+
`),n=[{obj:s,indent:-1}];for(let r of i){let o=r.replace(/#.*$/,"").trimEnd();if(!o.trim())continue;let c=o.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,a=o.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(a){let[,,g,p]=a,f=g.trim(),m=p.trim();if(m==="")u[f]={},n.push({obj:u[f],indent:c});else u[f]=ee(m)}}return s}function ee(e){if(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);let s=e.toLowerCase();if(s==="true"||s==="yes")return!0;if(s==="false"||s==="no")return!1;if(s==="null"||s==="~")return null;let i=Number(e);if(!Number.isNaN(i)&&e!=="")return i;return e}function te(e){switch(e){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function re(e,s){return G(e,s)}function ne(e,s){for(let i of e){let n=i.trim(),r=n.match(/^\{(\d+)\}\s*(.*)$/);if(r){let c=Number.parseInt(r[1],10);if(s===c)return r[2];continue}let o=n.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(o){let c=Number.parseInt(o[1],10),u=o[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(o[2],10);if(s>=c&&s<=u)return o[3];continue}}if(e.length===2)return s===1?e[0].trim():e[1].trim();if(s<e.length)return e[s].trim();return e[e.length-1].trim()}function ie(e,s={}){return j(e,s)}function j(e,s){let i="",n=0;while(n<e.length)if(e[n]==="{"){let r=se(e,n);if(r===-1){i+=e[n],n++;continue}let o=e.slice(n+1,r);i+=ae(o,s),n=r+1}else if(e[n]==="'"&&n+1<e.length)if(e[n+1]==="'")i+="'",n+=2;else if(e[n+1]==="{"||e[n+1]==="}")i+=e[n+1],n+=2;else i+=e[n],n++;else i+=e[n],n++;return i}function se(e,s){let i=0;for(let n=s;n<e.length;n++)if(e[n]==="{")i++;else if(e[n]==="}"){if(i--,i===0)return n}return-1}function ae(e,s){let i=oe(e);if(i.length===0)return`{${e}}`;let n=i[0].trim(),r=s[n];if(i.length===1)return r!==void 0?String(r):`{${n}}`;switch(i[1].trim().toLowerCase()){case"plural":return le(r,i.slice(2).join(","),s);case"select":return ue(r,i.slice(2).join(","));case"selectordinal":return de(r,i.slice(2).join(","));case"number":return pe(r,i[2]?.trim());case"date":return fe(r,i[2]?.trim());case"time":return me(r,i[2]?.trim());default:return r!==void 0?String(r):`{${e}}`}}function oe(e){let s=[],i="",n=0;for(let r=0;r<e.length;r++){let o=e[r];if(o==="{")n++,i+=o;else if(o==="}")n--,i+=o;else if(o===","&&n===0)s.push(i),i="";else i+=o}if(i)s.push(i);return s}function le(e,s,i){let n=Number(e)||0,r=I(s),o=`=${n}`;if(r[o])return R(r[o],n,i);let c=ce(n);if(r[c])return R(r[c],n,i);if(r.other)return R(r.other,n,i);return String(n)}function R(e,s,i){let n=e.replace(/#/g,String(s));return j(n,i)}function ce(e){let s=Math.abs(e),i=Math.floor(s),n=String(e).includes(".")?String(e).split(".")[1].length:0;if(i===1&&n===0)return"one";return"other"}function ue(e,s){let i=String(e||""),n=I(s);if(n[i])return n[i];return n.other||String(e)}function de(e,s){let i=Number(e)||0,n=I(s),r=ge(i);if(n[r])return n[r].replace(/#/g,String(i));if(n.other)return n.other.replace(/#/g,String(i));return String(i)}function ge(e){let s=Math.abs(e),i=s%10,n=s%100;if(i===1&&n!==11)return"one";if(i===2&&n!==12)return"two";if(i===3&&n!==13)return"few";return"other"}function I(e){let s={},i=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,n=i.exec(e);while(n!==null)s[n[1]]=n[2],n=i.exec(e);return s}function pe(e,s){let i=Number(e);if(Number.isNaN(i))return String(e);switch(s){case"integer":return Math.floor(i).toLocaleString();case"percent":return`${(i*100).toFixed(0)}%`;case"currency":return i.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return i.toLocaleString()}}function fe(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let n={};switch(s){case"short":n.dateStyle="short";break;case"medium":n.dateStyle="medium";break;case"long":n.dateStyle="long";break;case"full":n.dateStyle="full";break;default:n.dateStyle="medium"}return i.toLocaleDateString(void 0,n)}function me(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let n={};switch(s){case"short":n.timeStyle="short";break;case"medium":n.timeStyle="medium";break;case"long":n.timeStyle="long";break;case"full":n.timeStyle="full";break;default:n.timeStyle="short"}return i.toLocaleTimeString(void 0,n)}function be(e){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(e)}function O(e,s,i=!0,n={}){let r=e.split("."),o=s;for(let u of r){if(o===void 0||o===null)break;o=o[u]}if(o===void 0||o===null)return i?e:"";let c=String(o);if(be(c))return ie(c,n);if(c.includes("|")&&"count"in n){let u=Number(n.count),a=c.split("|");c=ne(a,u)}for(let[u,a]of Object.entries(n)){let g=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");c=c.replace(new RegExp(`:${g}`,"g"),()=>String(a))}return c}var D=new Set(["ar","arc","ckb","dv","fa","he","khw","ks","nqo","prs","ps","sd","syr","ug","ur","uz-af","yi"]),he=new Set(["adlm","arab","aran","hebr","nkoo","rohg","syrc","thaa","yezi"]);function q(e){if(!e)return"ltr";let s=e.trim().toLowerCase().replace(/_/g,"-").split("-"),i=s[0];if(!i)return"ltr";let n=s[1]?.length===4?s[1]:void 0;if(n)return he.has(n)?"rtl":"ltr";if(s.length>1&&D.has(`${i}-${s[1]}`))return"rtl";return D.has(i)?"rtl":"ltr"}async function Sc(e,s,i,n){let r=e,o=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,c={...T,...n.i18n},u=await re(c.locale,n);s.__translations=u,s.__locale=c.locale,s.__i18nConfig=c,r=await F(r,o,async(p,f,m,w,h)=>{try{let b={};if(m)try{let d=[()=>JSON.parse(m),()=>{let x=`{"data":${m}}`,A=JSON.parse(x);return typeof A.data==="object"?A.data:{}},()=>P(m,s)];for(let x of d)try{if(b=x(),Object.keys(b).length>0)break}catch{}}catch(d){if(n.debug)console.error("Error parsing parameters for @translate directive:",d)}let y=O(f,u,c.fallbackToKey,b);return y?Q(r,h,y,!1,p.length):w.trim()}catch(b){if(n.debug)console.error("Error processing @translate directive:",b);return l("Translate",`Error in @translate('${f}'): ${b instanceof Error?b.message:String(b)}`,t.EVALUATION_ERROR)}});let a=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(n.debug){console.warn(`Processing translations in template. Sections: ${r.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let p=[...r.matchAll(a)];console.warn(`Found ${p.length} @translate matches`),p.forEach((f,m)=>console.warn(`Match ${m}: ${f[0]}, Key: ${f[1]}, Params: ${f[2]||"none"}`))}return r=await F(r,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(p,f,m,w)=>{try{let h={};if(m)try{let b=[()=>JSON.parse(m),()=>{let y=`{"data":${m}}`,d=JSON.parse(y);return typeof d.data==="object"?d.data:{}},()=>P(m,s)];for(let y of b)try{if(h=y(),Object.keys(h).length>0)break}catch{}}catch(b){if(n.debug)console.error("Error parsing parameters for @translate directive:",b)}return Q(r,w,O(f,u,c.fallbackToKey,h),!1,p.length)}catch(h){if(n.debug)console.error("Error processing @translate directive:",h);return l("Translate",`Error in @translate('${f}'): ${h instanceof Error?h.message:String(h)}`,t.EVALUATION_ERROR)}}),r}async function F(e,s,i){let n=[];return e.replace(s,(o,...c)=>{let u=i(o,...c).then((a)=>({match:o,replacement:a}));return n.push(u),o}),(await Promise.all(n)).reduce((o,{match:c,replacement:u})=>o.replace(c,()=>u),e)}function _(e,s){if(!e||q(e)!=="rtl")return!1;return!s||s.trim().toLowerCase()!=="rtl"}function V(e){if(!e)return!1;return e.trim().split(/\s+/)[0]?.toLowerCase()==="presentation"||e.trim().split(/\s+/)[0]?.toLowerCase()==="none"}function U(e,s){let i=new RegExp(`\\b${s}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(e);if(!i)return null;return i[2]??i[3]??i[4]??null}function kc(e,s,i,n){let r=e;r=r.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(c,u,a)=>{let p={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[u]||"Make this element accessible";return`<!-- a11y-hint: ${a||p} -->`});let o=/@screenReader\(([^@]*)\)@endScreenReader/g;return r=r.replace(o,(c,u)=>`<span class="sr-only">${u.trim()}</span>`),r=r.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(c,u,a)=>`<span id="${`desc-${u}`}" class="sr-only">${a}</span>`),r}function ye(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function xe(e){let s=new Map,i=e.replace(/<(\/?)([A-Z][\w:.-]*)(?=[\s/>])/g,(r,o,c)=>{let u=s.get(c);if(!u)u=`stx-a11y-component-${s.size}`,s.set(c,u);return`<${o}${u}`}),n=new Map([...s.entries()].map(([r,o])=>[o,r]));return{protectedSource:i,restore:(r)=>r.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(o,c,u)=>{let a=n.get(u);return a?`<${c}${a}`:o})}}function we(e,s){let i=[],n=/<img\s+([^>]*)>/gi,r;r=n.exec(e);while(r!==null){let d=r[1];if(!/\balt\s*=/i.test(d))i.push({type:"missing-alt",element:r[0].substring(0,100),message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"});r=n.exec(e)}let o=/<button([^>]*)>\s*<\/button>/gi;r=o.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"missing-accessible-name",element:r[0].substring(0,100),message:"Empty button missing accessible name",impact:"critical",help:"Add text content, aria-label, or title",helpUrl:"https://web.dev/learn/accessibility/aria-html/"});r=o.exec(e)}let 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))i.push({type:"link-missing-text",element:r[0].substring(0,100),message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"});r=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),M=r.index,N=e.substring(0,M),Se=e.substring(M),H=(N.match(/<label\b/gi)||[]).length,z=(N.match(/<\/label>/gi)||[]).length,K=H>z;if(!B&&!K)i.push({type:"input-missing-label",element:r[0].substring(0,100),message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})}r=u.exec(e)}let a=/<h([1-6])[^>]*>/gi,g=[];r=a.exec(e);while(r!==null)g.push(Number.parseInt(r[1],10)),r=a.exec(e);let p=0;for(let d of g){if(p>0&&d>p+1)i.push({type:"heading-skip",element:`<h${d}>`,message:`Heading level skipped from h${p} to h${d}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});p=d}if(/<html\b/i.test(e)&&!/<html[^>]*\slang\s*=/i.test(e))i.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});let f=e.match(/<html\b([^>]*)>/i);if(f&&_(U(f[1],"lang"),U(f[1],"dir")))i.push({type:"missing-dir",element:f[0].substring(0,100),message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});let m=/<table([^>]*)>([\s\S]*?)<\/table>/gi;r=m.exec(e);while(r!==null){let d=r[2];if(!V(U(r[1],"role"))&&!/<th\b/i.test(d))i.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});r=m.exec(e)}let w=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;r=w.exec(e);while(r!==null){if(!/\bmuted\b/i.test(r[0]))i.push({type:"autoplay-audio",element:`<${r[1]}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"});r=w.exec(e)}let h=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;r=h.exec(e);while(r!==null)i.push({type:"positive-tabindex",element:`tabindex="${r[1]}"`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"}),r=h.exec(e);let b=/<iframe\s+([^>]*)>/gi;r=b.exec(e);while(r!==null){let d=r[1];if(!/\btitle\s*=/i.test(d)&&!/\baria-label\s*=/i.test(d))i.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"});r=b.exec(e)}let y=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;r=y.exec(e);while(r!==null){let d=r[1].toLowerCase(),x=r[2];if(d!=="button"&&!/\btabindex\s*=/i.test(x))i.push({type:"button-not-focusable",element:r[0].substring(0,100),message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"});r=y.exec(e)}return i}async function Ae(e,s){let{protectedSource:i}=xe(e);if(!ye())return we(i,s);let n=[];try{let r=globalThis.document.createElement("div");r.innerHTML=i,r.querySelectorAll("img").forEach((a)=>{if(!a.hasAttribute("alt"))n.push({type:"missing-alt",element:`<${a.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),r.querySelectorAll('button, a, [role="button"]').forEach((a)=>{if(!(a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby")||a.textContent&&a.textContent.trim().length>0))n.push({type:"missing-accessible-name",element:`<${a.outerHTML}>`,message:"Interactive element missing accessible name",impact:"critical",help:"Add text content, aria-label, or aria-labelledby",helpUrl:"https://web.dev/learn/accessibility/aria-html/"})}),r.querySelectorAll("input, select, textarea").forEach((a)=>{let g=a.getAttribute("id"),p=g&&r.querySelector(`label[for="${g}"]`),f=a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby"),m=a.closest("label")!==null;if(!p&&!f&&!m)n.push({type:"input-missing-label",element:`<${a.outerHTML}>`,message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})});let o=Array.from(r.querySelectorAll("h1, h2, h3, h4, h5, h6")),c=0;for(let a of o){let g=Number.parseInt(a.tagName.charAt(1));if(c>0&&g>c+1)n.push({type:"heading-skip",element:`<${a.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(i.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&&_(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((a)=>{let g=a.textContent&&a.textContent.trim().length>0,p=a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby"),f=a.hasAttribute("title"),m=a.querySelector("img[alt]");if(!g&&!p&&!f&&!m)n.push({type:"link-missing-text",element:`<${a.outerHTML}>`,message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"})}),i.includes("<nav")||i.includes("<header")){if(!r.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&r.querySelectorAll("a").length>5)n.push({type:"missing-skip-link",element:"<nav>",message:"Consider adding a skip navigation link",impact:"minor",help:"Add a skip link to allow keyboard users to bypass navigation",helpUrl:"https://web.dev/learn/accessibility/focus/#skip-links"})}if(r.querySelectorAll("table").forEach((a)=>{if(V(a.getAttribute("role")))return;let g=a.querySelector("caption");if(!a.querySelector("th"))n.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});if(!g&&!a.hasAttribute("aria-label")&&!a.hasAttribute("aria-labelledby"))n.push({type:"table-missing-caption",element:"<table>",message:"Table missing caption or accessible name",impact:"minor",help:"Add a caption element or aria-label to describe the table",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"})}),r.querySelectorAll('[style*="color"]').forEach((a)=>{let g=a.getAttribute("style")||"";if(g.includes("color:")&&!g.includes("background"))n.push({type:"potential-contrast-issue",element:`<${a.tagName.toLowerCase()}>`,message:"Element has inline color style - verify contrast ratio",impact:"minor",help:"Ensure text has sufficient contrast ratio (4.5:1 for normal text)",helpUrl:"https://web.dev/learn/accessibility/color-contrast/"})}),r.querySelectorAll("video[autoplay], audio[autoplay]").forEach((a)=>{if(!a.hasAttribute("muted"))n.push({type:"autoplay-audio",element:`<${a.tagName.toLowerCase()}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"})}),r.querySelectorAll("[tabindex]").forEach((a)=>{if(Number.parseInt(a.getAttribute("tabindex")||"0")>0)n.push({type:"positive-tabindex",element:`<${a.tagName.toLowerCase()}>`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"})}),r.querySelectorAll('[role="button"]').forEach((a)=>{if(!a.hasAttribute("tabindex"))n.push({type:"button-not-focusable",element:`<${a.outerHTML}>`,message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"})}),i.includes("<body")&&!r.querySelector('main, [role="main"]'))n.push({type:"missing-main-landmark",element:"<body>",message:"Document missing main landmark region",impact:"moderate",help:"Add a main element to identify the primary content",helpUrl:"https://web.dev/learn/accessibility/structure/#landmarks"});r.querySelectorAll("iframe").forEach((a)=>{if(!a.hasAttribute("title")&&!a.hasAttribute("aria-label"))n.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"})})}catch(r){console.error(`Error checking accessibility in ${s}:`,r)}return n}async function _c(e,s={}){let i={},{recursive:n=!0,ignorePaths:r=[]}=s,o=Array.isArray(e)?e:[e],c=await ti(o,{recursive:n,ignorePaths:r}),u=[];for(let a of c)try{let g=await Bun.file(a).text();if(a.endsWith("good-a11y.stx"))continue;let p=await Ae(g,a);if(u.push(a),p.length>0)i[a]=p}catch(g){console.error(`Error scanning ${a}:`,g)}return{results:i,scannedFiles:u}}var Cc={name:"a11y",handler:(e,s,i,n)=>{if(!s.length)return e;let r=s[0].replace(/['"]/g,""),o=s.length>1?s[1].replace(/['"]/g,""):"",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: ${o||u} -->${e}`},hasEndTag:!1},Ec={name:"screenReader",handler:(e)=>`<span class="sr-only">${e}</span>`,hasEndTag:!0};
|
|
4
|
+
export{Sc,kc,_c,Cc,Ec};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import y from"fs";import R from"path";var S="_stx";function F(e){return Bun.hash(e).toString(16).slice(0,8)}function k(e){let t=[],n=(i)=>{for(let s of y.readdirSync(i,{withFileTypes:!0})){let r=R.join(i,s.name);if(s.isDirectory())n(r);else if(s.isFile()&&r.endsWith(".html"))t.push(r)}};if(y.existsSync(e))n(e);return t}var z=[{pattern:/<script\b([^>]*\bdata-stx-runtime\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"runtime",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(e)=>`<script data-stx-runtime src="${e}"></script>`},{pattern:/<script\b([^>]*\bdata-stx-router\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"router",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(e)=>`<script data-stx-router src="${e}"></script>`},{pattern:/<style\b([^>]*\bdata-css=(?:"generated"|'generated')[^>]*)>([\s\S]*?)<\/style>/gi,prefix:"css",extension:"css",contentType:"text/css; charset=utf-8",replace:(e)=>`<link data-css="generated" rel="stylesheet" href="${e}">`}];function I(e,t=`/${S}`){let n=[],i=new Set,s=0,r=e;for(let o of z)r=r.replace(o.pattern,(g,u,c)=>{if(/\b(?:src|href)\s*=/.test(u)||!c.trim())return g;let a=`${o.prefix}.${F(c)}.${o.extension}`;if(!i.has(a))i.add(a),n.push({filename:a,contents:c,contentType:o.contentType});return s+=c.length,o.replace(`${t}/${a}`)});return{html:r,assets:n,bytesInlined:s}}function
|
|
2
|
+
import y from"fs";import R from"path";var S="_stx";function F(e){return Bun.hash(e).toString(16).slice(0,8)}function k(e){let t=[],n=(i)=>{for(let s of y.readdirSync(i,{withFileTypes:!0})){let r=R.join(i,s.name);if(s.isDirectory())n(r);else if(s.isFile()&&r.endsWith(".html"))t.push(r)}};if(y.existsSync(e))n(e);return t}var z=[{pattern:/<script\b([^>]*\bdata-stx-runtime\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"runtime",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(e)=>`<script data-stx-runtime src="${e}"></script>`},{pattern:/<script\b([^>]*\bdata-stx-router\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"router",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(e)=>`<script data-stx-router src="${e}"></script>`},{pattern:/<style\b([^>]*\bdata-css=(?:"generated"|'generated')[^>]*)>([\s\S]*?)<\/style>/gi,prefix:"css",extension:"css",contentType:"text/css; charset=utf-8",replace:(e)=>`<link data-css="generated" rel="stylesheet" href="${e}">`}];function I(e,t=`/${S}`){let n=[],i=new Set,s=0,r=e;for(let o of z)r=r.replace(o.pattern,(g,u,c)=>{if(/\b(?:src|href)\s*=/.test(u)||!c.trim())return g;let a=`${o.prefix}.${F(c)}.${o.extension}`;if(!i.has(a))i.add(a),n.push({filename:a,contents:c,contentType:o.contentType});return s+=c.length,o.replace(`${t}/${a}`)});return{html:r,assets:n,bytesInlined:s}}function sc(e){let t={pages:0,assets:0,bytesInlined:0},n=R.join(e,S),i=new Set;for(let s of k(e)){let r=y.readFileSync(s,"utf8"),{html:o,assets:g,bytesInlined:u}=I(r);if(o===r)continue;for(let c of g){if(i.has(c.filename))continue;i.add(c.filename),y.mkdirSync(n,{recursive:!0}),y.writeFileSync(R.join(n,c.filename),c.contents),t.assets++}y.writeFileSync(s,o),t.bytesInlined+=u,t.pages++}return t}import h from"fs";import T from"path";var L=1024,N=/<(script|style)\b([^>]*)>([\s\S]*?)<\/\1>/gi,_=new Set(["","module","text/javascript","application/javascript","module/javascript"]);function B(e){return Bun.hash(e).toString(16).slice(0,8)}function C(e){let t=[],n=(i)=>{for(let s of h.readdirSync(i,{withFileTypes:!0})){let r=T.join(i,s.name);if(s.isDirectory())n(r);else if(s.isFile()&&r.endsWith(".html"))t.push(r)}};if(h.existsSync(e))n(e);return t}function O(e,t){let n=e.match(new RegExp(`\\b${t}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i"));if(!n)return;return n[2]??n[3]??n[4]??""}function H(e,t,n){if(n.length<L)return!1;if(/\b(?:src|href)\s*=/i.test(t))return!1;if(e.toLowerCase()==="script"){if(!_.has((O(t,"type")??"").trim().toLowerCase()))return!1;return!0}return!0}function D(e){let t=[];for(let n of e.matchAll(/<template\b[^>]*>[\s\S]*?<\/template>/gi))t.push([n.index,n.index+n[0].length]);return t}function oc(e){let t={pages:0,assets:0,bytesInlined:0},n=C(e);if(n.length<2)return t;let i=new Map,s=new Map;for(let a of n){let f=h.readFileSync(a,"utf8");i.set(a,f);let M=D(f);for(let d of f.matchAll(N)){let[x,p,l,m]=d;if(!H(p,l,m))continue;if(M.some(([j,A])=>d.index>=j&&d.index<A))continue;let w=`${p.toLowerCase()}\x00${m}`,b=s.get(w);if(b)b.push({file:a,whole:x,tag:p,attrs:l,body:m});else s.set(w,[{file:a,whole:x,tag:p,attrs:l,body:m}])}}let r=[...s.values()].filter((a)=>new Set(a.map((f)=>f.file)).size>1);if(r.length===0)return t;let o=T.join(e,S),g=new Map(i),u=new Map,c=[];for(let a of r){let{tag:f,body:M}=a[0],d=f.toLowerCase()==="script",x=`${d?"chunk":"style"}.${B(M)}.${d?"js":"css"}`;c.push({filename:x,contents:M,contentType:d?"text/javascript; charset=utf-8":"text/css; charset=utf-8"});let p=`/${S}/${x}`;for(let l of a){let m=d?`<script${l.attrs} src="${p}"></script>`:`<link${l.attrs} rel="stylesheet" href="${p}">`,w=g.get(l.file),b=w.replace(l.whole,()=>m);if(b===w)continue;g.set(l.file,b),u.set(l.file,(u.get(l.file)??0)+l.body.length)}}h.mkdirSync(o,{recursive:!0});for(let a of c)h.writeFileSync(T.join(o,a.filename),a.contents),t.assets++;for(let[a,f]of g){if(f===i.get(a))continue;h.writeFileSync(a,f),t.pages++,t.bytesInlined+=u.get(a)??0}return t}import E from"fs";import v from"path";var K="layout-types.d.ts";function P(e){let t=[],n=(i,s)=>{let r;try{r=E.readdirSync(i,{withFileTypes:!0})}catch{return}for(let o of r){if(o.name.startsWith("."))continue;let g=v.join(i,o.name);if(o.isDirectory())n(g,s?`${s}/${o.name}`:o.name);else if(o.isFile()&&o.name.endsWith(".stx")&&o.name!=="_layout.stx"){let u=o.name.slice(0,-4);t.push(s?`${s}/${u}`:u)}}};return n(e,""),t.sort()}function W(e){let t=["// Auto-generated by stx \u2014 do not edit.","//","// Makes `definePageMeta({ layout })` reject a name with no layout behind it.","// Include this file in your tsconfig (it lives in the stx state directory,","// `.stx/` by default) for the check to apply.",""];if(e.length===0)return t.push("// No layouts found \u2014 `layout` stays typed as `string`.","export {}",""),t.join(`
|
|
3
3
|
`);return t.push("declare module '@stacksjs/stx' {"," interface KnownLayouts {",...e.map((n)=>` '${n}': true`)," }","}","","export {}",""),t.join(`
|
|
4
|
-
`)}function
|
|
5
|
-
export{
|
|
4
|
+
`)}function ic(e,t){if(!e)return[];let n=v.isAbsolute(e)?e:v.resolve(process.cwd(),e),i=P(n),s=W(i),r=v.join(t,K);try{if(E.existsSync(r)&&E.readFileSync(r,"utf8")===s)return i;E.mkdirSync(t,{recursive:!0}),E.writeFileSync(r,s)}catch{}return i}
|
|
5
|
+
export{sc,oc,ic};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
function o(t,i){let n=t[i],e=i+1;while(e<t.length){if(t[e]==="\\"){e+=2;continue}if(t[e]===n)return e+1;e++}return t.length}function b(t,i){let n=i+1;while(n<t.length){if(t[n]==="\\"){n+=2;continue}if(t[n]==="`")return n+1;if(t[n]==="$"&&t[n+1]==="{"){if(n=
|
|
3
|
-
`)e++;continue}if(l==="/"&&t[e+1]==="*"){e+=2;while(e<t.length&&t.slice(e,e+2)!=="*/")e++;e+=2;continue}if(l==="/"&&a(
|
|
4
|
-
`)return-1;if(
|
|
2
|
+
function o(t,i){let n=t[i],e=i+1;while(e<t.length){if(t[e]==="\\"){e+=2;continue}if(t[e]===n)return e+1;e++}return t.length}function b(t,i){let n=i+1;while(n<t.length){if(t[n]==="\\"){n+=2;continue}if(t[n]==="`")return n+1;if(t[n]==="$"&&t[n+1]==="{"){if(n=cl(t,n+2),n<t.length)n++;continue}n++}return t.length}function cl(t,i){let n=1,e=i,s="{",f="";while(e<t.length){let l=t[e];if(l==="\\"){e+=2;continue}if(l==='"'||l==="'"){e=o(t,e),s=h,f="";continue}if(l==="`"){e=b(t,e),s=h,f="";continue}if(l==="/"&&t[e+1]==="/"){while(e<t.length&&t[e]!==`
|
|
3
|
+
`)e++;continue}if(l==="/"&&t[e+1]==="*"){e+=2;while(e<t.length&&t.slice(e,e+2)!=="*/")e++;e+=2;continue}if(l==="/"&&a(s,f)){let u=w(t,e);if(u!==-1){e=u,s=h,f="";continue}}if(l==="{")n++;else if(l==="}"){if(n--,n===0)return e}if(/[\w$]/.test(l))f=/[\w$]/.test(s)?f+l:l,s=l;else if(!/\s/.test(l))s=l,f="";e++}return t.length}var m=new Set(["return","typeof","instanceof","in","of","new","delete","void","throw","case","do","else","yield","await"]);function a(t,i){if(i)return m.has(i);return!(t===")"||t==="]"||t===h)}var h="\x00";function w(t,i){let n=i+1,e=!1;while(n<t.length){let s=t[n];if(s===`
|
|
4
|
+
`)return-1;if(s==="\\"){n+=2;continue}if(s==="[")e=!0;else if(s==="]")e=!1;else if(s==="/"&&!e){n++;while(n<t.length&&/[a-z]/i.test(t[n]))n++;return n}n++}return-1}function r(t){let i="",n=0,e="",s="";while(n<t.length){let f=t.slice(n,n+2);if(f==="//"){while(n<t.length&&t[n]!==`
|
|
5
5
|
`)i+=" ",n++;continue}if(f==="/*"){while(n<t.length&&t.slice(n,n+2)!=="*/")i+=t[n]===`
|
|
6
6
|
`?`
|
|
7
7
|
`:" ",n++;i+=" ",n+=2;continue}let l=t[n];if(l==='"'||l==="'"){let u=l;i+=" ",n++;while(n<t.length&&t[n]!==u){if(t[n]==="\\"){i+=" ",n+=2;continue}i+=t[n]===`
|
|
8
8
|
`?`
|
|
9
|
-
`:" ",n++}i+=" ",n++,e=h,
|
|
9
|
+
`:" ",n++}i+=" ",n++,e=h,s="";continue}if(l==="/"&&a(e,s)){let u=w(t,n);if(u!==-1){i+=`/${" ".repeat(u-n-2)}/`,n=u,e=h,s="";continue}}if(l==="`"){i+=" ",n++;while(n<t.length&&t[n]!=="`"){if(t[n]==="\\"){i+=" ",n+=2;continue}if(t[n]==="$"&&t[n+1]==="{"){let u=n+2,g=cl(t,u);if(i+=" ",i+=r(t.slice(u,g)),g<t.length)i+=" ";n=g+1;continue}i+=t[n]===`
|
|
10
10
|
`?`
|
|
11
|
-
`:" ",n++}i+=" ",n++,e=h,
|
|
12
|
-
export{
|
|
11
|
+
`:" ",n++}i+=" ",n++,e=h,s="";continue}if(i+=l,n++,/[\w$]/.test(l))s=/[\w$]/.test(e)?s+l:l,e=l;else if(!/\s/.test(l))e=l,s=""}return i}function me(t){let i=new Uint16Array(t.length),n=0,e=!0;for(let s=0;s<t.length;s++){let f=t[s];if(f===")"||f==="]"||f==="}")if(n===0)e=!1;else n--;if(i[s]=n,f==="("||f==="["||f==="{")n++}return{depths:i,balanced:e&&n===0}}
|
|
12
|
+
export{cl,r,me};
|
|
@@ -72,7 +72,7 @@ else {
|
|
|
72
72
|
${t}
|
|
73
73
|
})();
|
|
74
74
|
</script>
|
|
75
|
-
`}function
|
|
75
|
+
`}function Zm(i,n,o){f=0;let l=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return i.replace(l,(t,e,s)=>{let a=v(),r=p(t,e,s),d=r.placeholder?`<div data-defer-placeholder>${r.placeholder}</div>`:"",c=r.loading?`<div data-defer-loading style="display: none;">${r.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',g=r.error?`<div data-defer-error style="display: none;">${r.error}</div>`:"",u=`<div data-defer-content style="display: none;">${r.content}</div>`,h=E(a,r);return`
|
|
76
76
|
<div id="${a}" class="stx-defer" data-defer-trigger="${r.trigger}">
|
|
77
77
|
${d}
|
|
78
78
|
${c}
|
|
@@ -81,4 +81,4 @@ else {
|
|
|
81
81
|
</div>
|
|
82
82
|
${h}
|
|
83
83
|
`})}
|
|
84
|
-
export{
|
|
84
|
+
export{Zm};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{rs,ss}from"./chunk-
|
|
2
|
+
import{rs,ss}from"./chunk-0dnetjh8.js";import{y}from"./chunk-p4ytnee6.js";import{a}from"./chunk-eyp7rr70.js";import{Ge,se}from"./chunk-t74qb5ej.js";import{nc}from"./chunk-7hv190bd.js";import{B}from"./chunk-ybq56wam.js";import{g}from"./chunk-0dve54ne.js";import{existsSync as z,mkdirSync as S,copyFileSync as P,chmodSync as I,rmSync as ve}from"fs";import{join as c,basename as xe,resolve as X}from"path";import{spawn as _}from"child_process";import{platform as ye}from"os";function O(e,r,i){let n=new RegExp(`</${r}\\s*>`,"iy"),s=y(e,(t,o)=>(n.lastIndex=o,n.exec(t)?n.lastIndex:-1))[0];return s?e.slice(0,s.start)+i+e.slice(s.start):null}var vu=`
|
|
3
3
|
<script>
|
|
4
4
|
(function() {
|
|
5
5
|
'use strict';
|
|
@@ -468,7 +468,7 @@ else if (data.type === 'event' && data.method) {
|
|
|
468
468
|
}
|
|
469
469
|
})();
|
|
470
470
|
</script>
|
|
471
|
-
`;function
|
|
471
|
+
`;function $a(e={}){let{debug:r=!1,timeout:i=30000}=e;return vu.replace("debug: false,",`debug: ${r},`).replace("timeout: 30000",`timeout: ${i}`)}function Eh(){return!1}function Th(e,r={}){let i=/@craft(?:\(([\s\S]*?)\))?/g;return e.replace(i,(n,s)=>{let t={};if(s)try{t=JSON.parse(s.replace(/'/g,'"'))}catch{try{t=Function(`return ${s}`)()}catch{console.warn(`[stx] Invalid @craft config: ${s}`)}}return $a(t)})}function Ra(e,r={}){if(e.includes("__craftBridgeInitialized"))return e;let i=$a(r),n=O(e,"head",`${i}
|
|
472
472
|
`);if(n!==null)return n;let s=B(e);if(s){let t=s.index+s.tag.length;return e.slice(0,t)+`
|
|
473
473
|
${i}`+e.slice(t)}return i+e}var To={button:{nativeType:"craft-button",fallbackTag:"button",fallbackClasses:"craft-button",nativeProps:["variant","size","disabled","loading"]},"text-input":{nativeType:"craft-text-input",fallbackTag:"input",fallbackClasses:"craft-text-input",nativeProps:["placeholder","value","type","disabled","readonly"]},textarea:{nativeType:"craft-textarea",fallbackTag:"textarea",fallbackClasses:"craft-textarea",nativeProps:["placeholder","value","rows","disabled","readonly"]},checkbox:{nativeType:"craft-checkbox",fallbackTag:"input",fallbackClasses:"craft-checkbox",nativeProps:["checked","disabled","label"],render:(e,r)=>{let i=e.checked?"checked":"",n=e.disabled?"disabled":"";return`<label class="craft-checkbox-wrapper">
|
|
474
474
|
<input type="checkbox" class="craft-checkbox" ${i} ${n}>
|
|
@@ -902,7 +902,7 @@ ${i}`+e.slice(t)}return i+e}var To={button:{nativeType:"craft-button",fallbackTa
|
|
|
902
902
|
}
|
|
903
903
|
}
|
|
904
904
|
</style>
|
|
905
|
-
`,
|
|
905
|
+
`,Aa=`
|
|
906
906
|
<script id="craft-component-runtime">
|
|
907
907
|
(function() {
|
|
908
908
|
if (window.__stxCraftComponentRuntime) return;
|
|
@@ -1006,9 +1006,9 @@ ${i}`+e.slice(t)}return i+e}var To={button:{nativeType:"craft-button",fallbackTa
|
|
|
1006
1006
|
document.addEventListener('craft:nativeui:ready', initializeCraftComponents);
|
|
1007
1007
|
})();
|
|
1008
1008
|
</script>
|
|
1009
|
-
`;function
|
|
1010
|
-
`)??ns+e;if(!e.includes("craft-component-runtime"))e=O(e,"body",`${
|
|
1011
|
-
`)??e+
|
|
1009
|
+
`;function Pa(e,r={}){let{classPrefix:i="craft"}=r;if(!e.includes("craft-component-styles"))e=O(e,"head",`${ns}
|
|
1010
|
+
`)??ns+e;if(!e.includes("craft-component-runtime"))e=O(e,"body",`${Aa}
|
|
1011
|
+
`)??e+Aa;return e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(n,s,t)=>N("sidebar",s,t.trim(),r,i)),e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(n,s)=>N("sidebar",s,"",r,i)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(n,s,t)=>N(s,t,"",r,i)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(n,s,t,o)=>N(s,t,o.trim(),r,i)),e}function N(e,r,i,n,s){let t=n.components?.[e]||To[e];if(!t)return console.warn(`[stx] Unknown Craft component: @craft-${e}`),`<div class="${s}-unknown" data-component="${e}">${i}</div>`;let o=F(r),d=[t.fallbackClasses||`${s}-${e}`];if(o.class)d.push(o.class),delete o.class;if(t.render)return o.__fallbackClasses=d.join(" "),t.render(o,i);let f=ue(o,t,d);if(["input","hr","br","img"].includes(t.fallbackTag))return`<${t.fallbackTag} ${f}>`;return`<${t.fallbackTag} ${f}>${i}</${t.fallbackTag}>`}function F(e){let r={},i=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,n;while((n=i.exec(e))!==null){let[s,t,o,d]=n,f=o??d;if(s.startsWith(":"))r[t]=f;else if(s.startsWith("@"))r[`on${t.charAt(0).toUpperCase()}${t.slice(1)}`]=f;else if(f===void 0)r[t]=!0;else r[t]=f}return r}function te(e,r){let i=R(String(e.id||`craft-sidebar-${fe(r||JSON.stringify(e))}`)),n=ce(e.spaces)||oe(r),s=n.length?[]:le(e.sections)||j(r),t=String(e.selectedSpace||n[0]?.id||""),o=n.find((v)=>v.id===t)||n[0],d=String(e.selectedItem||e.selected||(n.length?o?.sections[0]?.items[0]?.id:s[0]?.items[0]?.id)||""),f={id:i,variant:String(e.variant||"desktop"),material:String(e.material||"sidebar"),backgroundEffect:String(e.backgroundEffect||"shimmer"),allowsVibrancy:e.allowsVibrancy!==!1&&e.allowsVibrancy!=="false",materialOpacity:Number(e.materialOpacity??0.68),materialDarkOpacity:e.materialDarkOpacity===void 0?void 0:Number(e.materialDarkOpacity),minWidth:e.minWidth===void 0?240:Number(e.minWidth),maxWidth:e.maxWidth===void 0?340:Number(e.maxWidth),canCollapse:e.canCollapse!==!1&&e.canCollapse!=="false",searchPlaceholder:e.searchPlaceholder?String(e.searchPlaceholder):void 0,selectedItem:d,sections:s,spaces:n,selectedSpace:t||void 0},p=String(e.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),l=Number(e.width||e.sidebarWidth||286),u=e.native===!1||e.native==="false"?"false":"true",b=f.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${T(f.searchPlaceholder)}"></div>`:"",m;if(n.length)m=de(n,t,d);else if(s.length)m=s.map((v)=>L(v,d)).join("");else m=r;return`<aside class="${x(p)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${x(i)}" data-native="${u}" style="--craft-sidebar-width:${l}px">
|
|
1012
1012
|
${b}
|
|
1013
1013
|
${m}
|
|
1014
1014
|
</aside>
|
|
@@ -1029,7 +1029,7 @@ ${i}`+e.slice(t)}return i+e}var To={button:{nativeType:"craft-button",fallbackTa
|
|
|
1029
1029
|
${e.icon?`<span class="craft-sidebar-item-icon" data-icon="${x(e.icon)}"${i}></span>`:""}
|
|
1030
1030
|
<span class="craft-sidebar-item-label">${T(e.label)}</span>
|
|
1031
1031
|
${e.badge?`<span class="craft-sidebar-item-badge">${T(e.badge)}</span>`:""}
|
|
1032
|
-
</button>`}function R(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function fe(e){let r=5381;for(let i=0;i<e.length;i++)r=r*33^e.charCodeAt(i);return(r>>>0).toString(36)}function T(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function x(e){return T(e).replace(/`/g,"`")}function pe(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function ue(e,r,i){let n=[];n.push(`class="${i.join(" ")}"`),n.push(`data-craft="${r.nativeType}"`);for(let[s,t]of Object.entries(e))if(t===!0)n.push(s);else if(t!==!1&&t!==void 0&&t!==null){let o=String(t).replace(/"/g,""");n.push(`${s}="${o}"`)}return n.join(" ")}function
|
|
1032
|
+
</button>`}function R(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function fe(e){let r=5381;for(let i=0;i<e.length;i++)r=r*33^e.charCodeAt(i);return(r>>>0).toString(36)}function T(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function x(e){return T(e).replace(/`/g,"`")}function pe(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function ue(e,r,i){let n=[];n.push(`class="${i.join(" ")}"`),n.push(`data-craft="${r.nativeType}"`);for(let[s,t]of Object.entries(e))if(t===!0)n.push(s);else if(t!==!1&&t!==void 0&&t!==null){let o=String(t).replace(/"/g,""");n.push(`${s}="${o}"`)}return n.join(" ")}function $h(e,r){To[e]=r}function Rh(){return{...To}}import{chmodSync as be,copyFileSync as ge,mkdtempSync as V,rmSync as me,writeFileSync as J}from"fs";import{tmpdir as W}from"os";import{join as D}from"path";function we(e){let r=Bun.spawnSync(["/usr/bin/plutil","-extract","Entitlements","xml1","-o","-","-"],{stdin:e});if(r.exitCode!==0)throw Error(`Could not extract the macOS profile entitlements: ${r.stderr.toString().trim()||r.stdout.toString().trim()}`);let i=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-","-"],{stdin:r.stdout});if(i.exitCode!==0)throw Error(`Could not convert the macOS profile entitlements: ${i.stderr.toString().trim()||i.stdout.toString().trim()}`);let n=JSON.parse(i.stdout.toString());if(!n||typeof n!=="object"||Array.isArray(n))throw Error("The macOS profile entitlements must be a dictionary.");return n}function he(e,r){let i=D(r,"Contents","embedded.provisionprofile");ge(e,i),be(i,420)}async function Q(e,r=[],i={}){if(process.platform!=="darwin")return;let n=i.entitlements,s;try{if(i.provisioningProfile){if(!i.identity||i.identity==="-")throw Error("A provisioning profile requires a signing identity.");let p=Bun.spawnSync(["/usr/bin/security","cms","-D","-i",i.provisioningProfile]);if(p.exitCode!==0)throw Error("Could not decode the macOS provisioning profile.");let l=we(p.stdout),u={};if(i.entitlements){let b=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-",i.entitlements]);if(b.exitCode!==0)throw Error("Could not read the app entitlements plist.");u=JSON.parse(b.stdout.toString())}for(let b of["com.apple.application-identifier","com.apple.developer.team-identifier"])if(l[b])u[b]=l[b];if(s=V(D(W(),"stx-entitlements-")),n=D(s,"entitlements.plist"),J(n,JSON.stringify(u)),Bun.spawnSync(["/usr/bin/plutil","-convert","xml1",n]).exitCode!==0)throw Error("Could not generate the provisioned app entitlements.");he(i.provisioningProfile,e)}let t;if(r.length){let p=!1;if(n){let l=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-",n]);if(l.exitCode!==0)throw Error("Could not read native parent entitlements.");p=JSON.parse(l.stdout.toString())["com.apple.security.app-sandbox"]===!0}if(s??=V(D(W(),"stx-entitlements-")),t=D(s,"helper.entitlements.plist"),J(t,JSON.stringify({"com.apple.security.cs.allow-jit":!0,...p?{"com.apple.security.app-sandbox":!0,"com.apple.security.inherit":!0}:{}})),Bun.spawnSync(["/usr/bin/plutil","-convert","xml1",t]).exitCode!==0)throw Error("Could not generate native helper entitlements.")}for(let p of[...r,e]){let l=i.hardenedRuntime?["--options","runtime"]:[];if(p===e&&n)l.push("--entitlements",n);if(p!==e&&t)l.push("--entitlements",t);let u=i.identity&&i.identity!=="-"?"--timestamp":"--timestamp=none",b=Bun.spawn(["/usr/bin/codesign","--force","--sign",i.identity||"-",u,...l,p],{stdout:"pipe",stderr:"pipe"}),[m,v]=await Promise.all([new Response(b.stderr).text(),b.exited]);if(v!==0)throw Error(`Could not sign native bundle ${p}: ${m.trim()}`)}let o=Bun.spawn(["/usr/bin/codesign","--verify","--strict",e],{stdout:"pipe",stderr:"pipe"}),[d,f]=await Promise.all([new Response(o.stderr).text(),o.exited]);if(f!==0)throw Error(`Invalid native bundle signature: ${d.trim()}`)}finally{if(s)me(s,{recursive:!0,force:!0})}}var Y=(e)=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");function G(e){let r=new Set,i=(n,s,t)=>{if(typeof n==="string")return`${s}<string>${Y(n)}</string>`;if(typeof n==="boolean")return`${s}<${n}/>`;if(typeof n==="number"){if(!Number.isFinite(n))throw TypeError(`Non-finite Info.plist number at ${t}`);let o=Number.isSafeInteger(n)?"integer":"real";return`${s}<${o}>${n}</${o}>`}if(n!==null&&typeof n==="object"){let o=Array.isArray(n);if(!o&&Object.getPrototypeOf(n)!==Object.prototype&&Object.getPrototypeOf(n)!==null)throw TypeError(`Unsupported Info.plist value at ${t}`);if(r.has(n))throw TypeError(`Cyclic Info.plist value at ${t}`);r.add(n);try{let d=o?"array":"dict",f=`${s} `,p=o?Array.from(n,(l,u)=>i(l,f,`${t}[${u}]`)):Object.entries(n).map(([l,u])=>`${f}<key>${Y(l)}</key>
|
|
1033
1033
|
${i(u,f,`${t}.${l}`)}`);return p.length?`${s}<${d}>
|
|
1034
1034
|
${p.join(`
|
|
1035
1035
|
`)}
|
|
@@ -1038,8 +1038,8 @@ ${s}</${d}>`:`${s}<${d}/>`}finally{r.delete(n)}}throw TypeError(`Unsupported Inf
|
|
|
1038
1038
|
<plist version="1.0">
|
|
1039
1039
|
${i(e,"","infoPlist")}
|
|
1040
1040
|
</plist>
|
|
1041
|
-
`}async function
|
|
1042
|
-
</head>`)}let d=e.name||xe(e.input,".stx"),f=e.version||"1.0.0",p=e.craftPath||
|
|
1041
|
+
`}async function Ia(e){if(e.window?.cornerRadius!==void 0&&(!Number.isFinite(e.window.cornerRadius)||e.window.cornerRadius<0||e.window.cornerRadius>128))throw Error("Native window cornerRadius must be between 0 and 128");let r=Date.now();try{if(!await Bun.file(e.input).exists())return{success:!1,target:e.target||q(),format:e.format||"app",error:`Input file not found: ${e.input}`};let i=e.target||q(),n=e.format||Be(i);if(e.backend&&i!=="macos")throw Error("Native backend bundles currently support macOS only.");if(e.backend&&!z(X(e.backend.entry)))throw Error(`Native backend not found: ${e.backend.entry}`);let s=e.output||c(process.cwd(),"dist","native");if(!z(s))S(s,{recursive:!0});let t=await a(process.cwd()),o=await nc(e.input,{context:e.context,options:{...t,isDev:!1},injectCSS:!0});if(o=Ra(o,{debug:e.verbose}),o=Pa(o),!o.includes("craft-component-styles")){if(o.includes("</head>"))o=o.replace("</head>",`${ns}
|
|
1042
|
+
</head>`)}let d=e.name||xe(e.input,".stx"),f=e.version||"1.0.0",p=e.craftPath||Oa(e.runtimeProfile);if(!p)return{success:!1,target:i,format:n,error:"Craft native binary not found on PATH. Run pantry install craft, or specify craftPath for framework development."};if(e.runtimeProfile==="webview"){if(i!=="macos")throw Error("The webview runtime profile is currently available on macOS only.");let u=Bun.spawnSync([p,"--runtime-profile"],{stdout:"pipe",stderr:"pipe",timeout:1e4});if(u.exitCode!==0||u.stdout.toString().trim()!=="webview")throw Error("The requested Craft webview runtime is unavailable. Upgrade Craft with Pantry before building.")}if(p=rs(e.craftPath,e.runtimeProfile),e.verbose)console.log(`\uD83D\uDCE6 Building native app for ${i}...`),console.log(` Input: ${e.input}`),console.log(` Output: ${s}`),console.log(` Craft: ${p}`);let l;switch(i){case"macos":l=await Se(o,d,f,s,n,e,p);break;case"windows":l=await $e(o,d,f,s,n,e,p);break;case"linux":l=await Te(o,d,f,s,n,e,p);break;case"ios":l=await Pe(o,d,f,s,e,p);break;case"android":l=await Ie(o,d,f,s,e,p);break;default:l={success:!1,target:i,format:n,error:`Unsupported target: ${i}`}}return l.duration=Date.now()-r,l}catch(i){return{success:!1,target:e.target||q(),format:e.format||"app",error:i.message,duration:Date.now()-r}}}async function Se(e,r,i,n,s,t,o){let d=t.bundleId||`com.stx.${r.toLowerCase().replace(/[^a-z0-9]/g,"")}`,f=c(n,`${r}.app`),p=c(f,"Contents"),l=c(p,"MacOS"),u=c(p,"Resources");ve(f,{recursive:!0,force:!0}),S(l,{recursive:!0}),S(u,{recursive:!0});let b=c(u,"index.html");await Bun.write(b,e);let m="";if(t.sidebar?.enabled&&t.sidebar?.config)m=c(u,"sidebar-config.json"),await Bun.write(m,JSON.stringify(t.sidebar.config));let v=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",k=t.menubarOnly??t.systemTray,h=t.bundleStyle||(await ke(o)?"executable":"launcher");if(t.backend){if(!await Ce(o))throw Error("This Craft runtime does not support bundled backends. Upgrade Craft before building this app.");P(o,c(l,r)),I(c(l,r),493);let C=Ge("native-backend");try{let w=c(C,"launcher.ts"),M=c(import.meta.dir,"native-backend"+(import.meta.path.endsWith(".ts")?".ts":".js"));await Bun.write(w,`import { runNativeBackend } from ${JSON.stringify(M)}
|
|
1043
1043
|
import * as backend from ${JSON.stringify(X(t.backend.entry))}
|
|
1044
1044
|
await runNativeBackend({ html: ${JSON.stringify(e)}, fetch: backend.default, shutdown: Reflect.get(backend, "shutdown"),
|
|
1045
1045
|
maxRequestBodySize: ${t.backend.maxRequestBodySize??33554432} })
|
|
@@ -1076,7 +1076,7 @@ Name=${r}
|
|
|
1076
1076
|
Exec=${u}
|
|
1077
1077
|
Terminal=false
|
|
1078
1078
|
Categories=Utility;
|
|
1079
|
-
`;if(await Bun.write(c(d,`${r.toLowerCase()}.desktop`),b),s==="deb"){let m=c(n,`${r.toLowerCase()}_${i}_amd64.deb`),v=await Oe(d,m,r,i,t);if(!v.success)return{success:!1,target:"linux",format:"deb",error:v.error};return{success:!0,target:"linux",format:"deb",outputPath:m}}if(s==="appimage"){let m=c(n,`${r}-${i}-x86_64.AppImage`),v=await De(d,m,r,t);if(!v.success)return{success:!1,target:"linux",format:"appimage",error:v.error};return{success:!0,target:"linux",format:"appimage",outputPath:m}}return{success:!0,target:"linux",format:"app",outputPath:d}}async function Pe(e,r,i,n,s,t){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${r}' to create an iOS project.`}}async function Ie(e,r,i,n,s,t){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${r}' to create an Android project.`}}function
|
|
1079
|
+
`;if(await Bun.write(c(d,`${r.toLowerCase()}.desktop`),b),s==="deb"){let m=c(n,`${r.toLowerCase()}_${i}_amd64.deb`),v=await Oe(d,m,r,i,t);if(!v.success)return{success:!1,target:"linux",format:"deb",error:v.error};return{success:!0,target:"linux",format:"deb",outputPath:m}}if(s==="appimage"){let m=c(n,`${r}-${i}-x86_64.AppImage`),v=await De(d,m,r,t);if(!v.success)return{success:!1,target:"linux",format:"appimage",error:v.error};return{success:!0,target:"linux",format:"appimage",outputPath:m}}return{success:!0,target:"linux",format:"app",outputPath:d}}async function Pe(e,r,i,n,s,t){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${r}' to create an iOS project.`}}async function Ie(e,r,i,n,s,t){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${r}' to create an Android project.`}}function Oa(e="full"){let r=process.env.CRAFT_BIN;if(r){if(!z(r))throw Error(`CRAFT_BIN points to a missing file: ${r}`);return r}return Bun.which(e==="webview"?"craft-webview":"craft",{PATH:process.env.PATH??"",cwd:process.cwd()})}function q(){switch(ye()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function Be(e){switch(e){case"macos":return"app";case"windows":return"zip";case"linux":return"appimage";case"ios":return"ipa";case"android":return"apk";default:return"app"}}async function Re(e,r,i){return ss({appBundlePath:e,outputPath:r,volumeName:i})}async function Ee(e,r){return new Promise((i)=>{let n=_("zip",["-r",r,"."],{cwd:e});n.on("close",(s)=>{if(s===0)i({success:!0});else i({success:!1,error:`zip exited with code ${s}`})}),n.on("error",(s)=>{i({success:!1,error:s.message})})})}async function Oe(e,r,i,n,s){return new Promise((t)=>{let o=Ge("deb");try{let d=c(o,"pkg"),f=c(d,"DEBIAN"),p=c(d,"usr","bin"),l=c(d,"usr","share","applications"),u=c(d,"usr","share",i.toLowerCase());S(f,{recursive:!0}),S(p,{recursive:!0}),S(l,{recursive:!0}),S(u,{recursive:!0});let b=g("fs").readdirSync(e);for(let h of b)P(c(e,h),c(u,h));let m=`#!/bin/bash
|
|
1080
1080
|
exec /usr/share/${i.toLowerCase()}/${i.toLowerCase()} "$@"`;g("fs").writeFileSync(c(p,i.toLowerCase()),m),I(c(p,i.toLowerCase()),493);let v=`Package: ${i.toLowerCase()}
|
|
1081
1081
|
Version: ${n}
|
|
1082
1082
|
Section: utils
|
|
@@ -1085,7 +1085,7 @@ Architecture: amd64
|
|
|
1085
1085
|
Depends: libgtk-3-0, libwebkit2gtk-4.0-37
|
|
1086
1086
|
Maintainer: ${s.author||"Unknown"}
|
|
1087
1087
|
Description: ${s.description||i}
|
|
1088
|
-
`;g("fs").writeFileSync(c(f,"control"),v);let k=_("dpkg-deb",["--build",d,r]);k.on("close",(h)=>{if(se(o),h===0)t({success:!0});else t({success:!1,error:`dpkg-deb exited with code ${h}`})}),k.on("error",(h)=>{se(o),t({success:!1,error:h.message})})}catch(d){se(o),t({success:!1,error:d.message})}})}async function De(e,r,i,n){return new Promise((s)=>{let t=
|
|
1088
|
+
`;g("fs").writeFileSync(c(f,"control"),v);let k=_("dpkg-deb",["--build",d,r]);k.on("close",(h)=>{if(se(o),h===0)t({success:!0});else t({success:!1,error:`dpkg-deb exited with code ${h}`})}),k.on("error",(h)=>{se(o),t({success:!1,error:h.message})})}catch(d){se(o),t({success:!1,error:d.message})}})}async function De(e,r,i,n){return new Promise((s)=>{let t=Ge("appimage");try{let o=c(t,`${i}.AppDir`),d=c(o,"usr"),f=c(d,"bin"),p=c(d,"share");S(f,{recursive:!0}),S(p,{recursive:!0});let l=c(p,i.toLowerCase());S(l,{recursive:!0});let u=g("fs").readdirSync(e);for(let h of u)P(c(e,h),c(l,h));let b=`#!/bin/bash
|
|
1089
1089
|
SELF=$(readlink -f "$0")
|
|
1090
1090
|
HERE=\${SELF%/*}
|
|
1091
1091
|
export PATH="\${HERE}/usr/bin:\${PATH}"
|
|
@@ -1097,5 +1097,5 @@ Exec=${i.toLowerCase()}
|
|
|
1097
1097
|
Terminal=false
|
|
1098
1098
|
Categories=Utility;
|
|
1099
1099
|
Icon=${i.toLowerCase()}
|
|
1100
|
-
`;g("fs").writeFileSync(c(o,`${i.toLowerCase()}.desktop`),m);let v=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(g("fs").writeFileSync(c(o,`${i.toLowerCase()}.png`),v),n.icon&&z(n.icon))P(n.icon,c(o,`${i.toLowerCase()}.png`));let k=_("appimagetool",[o,r],{env:{...process.env,ARCH:"x86_64"}});k.on("close",(h)=>{if(se(t),h===0)I(r,493),s({success:!0});else s({success:!1,error:`appimagetool exited with code ${h}. Install from https://appimage.github.io/appimagetool/`})}),k.on("error",(h)=>{se(t),s({success:!1,error:`appimagetool not found: ${h.message}`})})}catch(o){se(t),s({success:!1,error:o.message})}})}function
|
|
1101
|
-
export{
|
|
1100
|
+
`;g("fs").writeFileSync(c(o,`${i.toLowerCase()}.desktop`),m);let v=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(g("fs").writeFileSync(c(o,`${i.toLowerCase()}.png`),v),n.icon&&z(n.icon))P(n.icon,c(o,`${i.toLowerCase()}.png`));let k=_("appimagetool",[o,r],{env:{...process.env,ARCH:"x86_64"}});k.on("close",(h)=>{if(se(t),h===0)I(r,493),s({success:!0});else s({success:!1,error:`appimagetool exited with code ${h}. Install from https://appimage.github.io/appimagetool/`})}),k.on("error",(h)=>{se(t),s({success:!1,error:`appimagetool not found: ${h.message}`})})}catch(o){se(t),s({success:!1,error:o.message})}})}function Na(){return[q()]}function Ma(e){switch(e){case"macos":return["app","dmg","pkg"];case"windows":return["app","zip","msi"];case"linux":return["app","deb","rpm","appimage"];case"ios":return["ipa"];case"android":return["apk"];default:return["app"]}}var qe={buildNative:Ia,getAvailableTargets:Na,getAvailableFormats:Ma,detectPlatform:q},Ah=qe;
|
|
1101
|
+
export{vu,$a,Eh,Th,Ra,To,ns,Aa,Pa,$h,Rh,Ia,Oa,Na,Ma,Ah};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ee,te,ne,jn,he,$e,Yr,
|
|
2
|
+
import{ee,te,ne,jn,he,$e,Yr,Yl,ht,Yt,Bn,Fn,zn,re,Hn,Vn,Zr}from"./chunk-422r7zkx.js";import"./chunk-t74qb5ej.js";export{te as DEFAULT_FORMATS,ne as DEFAULT_QUALITY,ee as DEFAULT_WIDTHS,Zr as ImageProcessingError,Vn as formatSize,Yt as generateSizes,ht as generateSrcSet,Bn as getFallbackVariant,Yr as getImageMetadata,re as getMimeType,Hn as getTotalSize,Fn as groupVariantsByFormat,he as isImageBackendAvailable,zn as isImageFile,jn as isSharpAvailable,$e as processImage,Yl as resizeAndConvert};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Ut}from"./chunk-t23jn83r.js";function ro(e){let n=e.pwa;if(!n?.enabled)return"";let r=n.manifest,t=n.icons?.outputDir?`/${n.icons.outputDir}`:"/pwa-icons",o=Ut(e),i=`
|
|
3
3
|
<!-- stx PWA Meta Tags -->
|
|
4
4
|
<link rel="manifest" href="/manifest.json">
|
|
5
5
|
<meta name="theme-color" content="${a(r?.themeColor||"#000000")}">
|
|
@@ -43,12 +43,12 @@ if ('serviceWorker' in navigator) {
|
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
</script>
|
|
46
|
-
<!-- End stx PWA -->`,i}function
|
|
46
|
+
<!-- End stx PWA -->`,i}function ji(e,n){let r=n.pwa;if(!r?.enabled||r.autoInject===!1)return e;if(e.includes("<!-- stx PWA Meta Tags -->"))return e;if(!e.includes("</head>")){let o=e.lastIndexOf("</body>");if(o!==-1){let i=ro(n);return e.slice(0,o)+i+`
|
|
47
47
|
`+e.slice(o)}return e+ro(n)}let t=ro(n);return e.replace("</head>",`${t}
|
|
48
|
-
</head>`)}function
|
|
48
|
+
</head>`)}function Pg(e){if(!e.pwa?.enabled)return"";return`<script>
|
|
49
49
|
if ('serviceWorker' in navigator) {
|
|
50
50
|
window.addEventListener('load', function() {
|
|
51
|
-
navigator.serviceWorker.register('/${
|
|
51
|
+
navigator.serviceWorker.register('/${Ut(e)}')
|
|
52
52
|
.then(function(registration) {
|
|
53
53
|
console.log('[PWA] Service Worker registered:', registration.scope);
|
|
54
54
|
})
|
|
@@ -57,5 +57,5 @@ if ('serviceWorker' in navigator) {
|
|
|
57
57
|
});
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
-
</script>`}function
|
|
61
|
-
export{ro,
|
|
60
|
+
</script>`}function Ig(){return'<link rel="manifest" href="/manifest.json">'}function Og(e){return`<meta name="theme-color" content="${a(e)}">`}function a(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}
|
|
61
|
+
export{ro,ji,Pg,Ig,Og};
|