@stacksjs/stx 0.2.826 → 0.2.830
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-02zvytqx.js +2 -0
- package/dist/{chunk-bt0amey5.js → chunk-04z1xyrb.js} +2 -2
- package/dist/{chunk-8ycrmsba.js → chunk-0fthaykk.js} +3 -3
- package/dist/chunk-0hnrc2z3.js +2 -0
- package/dist/chunk-0jhem1jn.js +2 -0
- package/dist/{chunk-f0txsdpa.js → chunk-0rvntfhj.js} +3 -3
- package/dist/chunk-17zrprh0.js +2 -0
- package/dist/chunk-1bpx9b0m.js +2 -0
- package/dist/{chunk-wy0gghvh.js → chunk-1vzncfka.js} +2 -2
- package/dist/{chunk-h864en4b.js → chunk-267rpvw5.js} +7 -7
- package/dist/{chunk-2vqpz4qv.js → chunk-2qngyyaz.js} +2 -2
- package/dist/{chunk-7yb82rm6.js → chunk-2x9zhezb.js} +2 -2
- package/dist/{chunk-981z8va1.js → chunk-3p7r3ajd.js} +2 -2
- package/dist/chunk-42c92rp3.js +2 -0
- package/dist/{chunk-vwtejkb5.js → chunk-47rbtjp1.js} +50 -50
- package/dist/chunk-48jzgbbs.js +2 -0
- package/dist/chunk-4a3r1kh1.js +43 -0
- package/dist/chunk-4hq9v6hq.js +2 -0
- package/dist/chunk-4z0jpzdq.js +3 -0
- package/dist/{chunk-6qvn1h09.js → chunk-5201w0f1.js} +3 -3
- package/dist/{chunk-21syn2j5.js → chunk-54anhwg5.js} +2 -2
- package/dist/chunk-5nwmwmjg.js +2 -0
- package/dist/chunk-67nq6csk.js +2 -0
- package/dist/chunk-6aak0b7c.js +2 -0
- package/dist/chunk-6fh00yz2.js +2 -0
- package/dist/chunk-6jpmjvbs.js +2 -0
- package/dist/{chunk-7sh9fa3q.js → chunk-6k26n0sj.js} +2 -2
- package/dist/chunk-6r4teng3.js +2 -0
- package/dist/{chunk-d6d2s7n6.js → chunk-6tjm38e4.js} +2 -2
- package/dist/{chunk-06hc6rs6.js → chunk-716jrdcg.js} +1 -1
- package/dist/chunk-72n804gy.js +2 -0
- package/dist/{chunk-3yh6y00f.js → chunk-7k9yahng.js} +6 -6
- package/dist/chunk-7kecdwv3.js +25 -0
- package/dist/{chunk-wf0n9gpj.js → chunk-7p8m82pj.js} +4 -4
- package/dist/{chunk-t9vwggkw.js → chunk-7zf4a66r.js} +6 -6
- package/dist/{chunk-x5vxkypk.js → chunk-8d7vh5kq.js} +6 -6
- package/dist/{chunk-e648sx8w.js → chunk-8fys3apk.js} +2 -2
- package/dist/chunk-8kb9t029.js +2 -0
- package/dist/chunk-8n8vj099.js +2 -0
- package/dist/{chunk-r9e0r6jx.js → chunk-8y8kgw9s.js} +3 -3
- package/dist/chunk-a5m09xb5.js +2 -0
- package/dist/{chunk-gjf8cjdt.js → chunk-ac9ncbfw.js} +3 -3
- package/dist/chunk-ahd8jdzx.js +2 -0
- package/dist/chunk-ay7ggc4k.js +2 -0
- package/dist/{chunk-mv3yhspn.js → chunk-b1q40vq4.js} +2 -2
- package/dist/{chunk-1d67wtj4.js → chunk-b5syjezp.js} +3 -3
- package/dist/{chunk-3axb6t08.js → chunk-b7tb00nz.js} +2 -2
- package/dist/chunk-bmm6vtsx.js +2 -0
- package/dist/{chunk-8ttmzcxb.js → chunk-c9mdvpf5.js} +29 -29
- package/dist/{chunk-5emrarpf.js → chunk-car6nhfe.js} +2 -2
- package/dist/{chunk-e4jwhmpb.js → chunk-cca18z35.js} +31 -31
- package/dist/{chunk-he5njpsd.js → chunk-cdm6yc10.js} +1 -1
- package/dist/chunk-cfrgrnej.js +2 -0
- package/dist/{chunk-vzbyn4nh.js → chunk-ckg6q98b.js} +5 -5
- package/dist/{chunk-eycaj8mk.js → chunk-ckqgk94e.js} +2 -2
- package/dist/{chunk-k81trehg.js → chunk-cv1zc9dg.js} +2 -2
- package/dist/chunk-cw8vpk41.js +2 -0
- package/dist/chunk-db1c0c3c.js +2 -0
- package/dist/{chunk-928y0wer.js → chunk-ddxbc914.js} +105 -105
- package/dist/chunk-dptjfnvq.js +2 -0
- package/dist/chunk-e240xqcn.js +2 -0
- package/dist/{chunk-cxz4cdcn.js → chunk-e75dntfb.js} +2 -2
- package/dist/{chunk-wceg59n0.js → chunk-ekh3mxyp.js} +2 -2
- package/dist/{chunk-4mj9dem1.js → chunk-em8tv6nz.js} +2 -2
- package/dist/{chunk-7qk4exw1.js → chunk-ema1c29k.js} +2 -2
- package/dist/{chunk-w45njn1r.js → chunk-en0xmvkx.js} +2 -2
- package/dist/{chunk-z23arg8m.js → chunk-f49x34sr.js} +2 -2
- package/dist/{chunk-8w9spdbn.js → chunk-f6b7av6b.js} +9 -9
- package/dist/{chunk-8p86mpfv.js → chunk-f6wwwgsf.js} +2 -2
- package/dist/{chunk-9gmceny5.js → chunk-f7jgda7x.js} +5 -5
- package/dist/chunk-fb90n0by.js +2 -0
- package/dist/{chunk-b4x5ndt9.js → chunk-fwktw49p.js} +4 -4
- package/dist/{chunk-y2bf32vg.js → chunk-fykcqp0m.js} +10 -10
- package/dist/chunk-g4qzy5hv.js +2 -0
- package/dist/chunk-g4yyfmje.js +2 -0
- package/dist/{chunk-tksjakyv.js → chunk-gcf97wgx.js} +1 -1
- package/dist/chunk-gg48cgx3.js +2 -0
- package/dist/chunk-gh439e80.js +2 -0
- package/dist/{chunk-tgk2hcxv.js → chunk-h5pmh5h3.js} +6 -6
- package/dist/{chunk-076fj387.js → chunk-hd378dgy.js} +1 -1
- package/dist/{chunk-9kj5p5jq.js → chunk-j14fd8kd.js} +8 -8
- package/dist/chunk-jp6sbk05.js +2 -0
- package/dist/chunk-k6ye0159.js +3 -0
- package/dist/{chunk-sk0tmtd3.js → chunk-kny4jmyq.js} +13 -13
- package/dist/chunk-kshem79d.js +2 -0
- package/dist/chunk-m3tnxk01.js +2 -0
- package/dist/chunk-m9bbhg46.js +3 -0
- package/dist/chunk-m9dj8pgb.js +2 -0
- package/dist/{chunk-bq7cfqk3.js → chunk-mww0j2w4.js} +2 -2
- package/dist/{chunk-qj4r08jb.js → chunk-mxvevxb8.js} +4 -4
- package/dist/{chunk-btxnrqxf.js → chunk-myje6fhm.js} +5 -5
- package/dist/{chunk-1f7d1c0y.js → chunk-mypygxdm.js} +2 -2
- package/dist/{chunk-76eh43e9.js → chunk-nfpsaaqm.js} +2 -2
- package/dist/chunk-pe5qqem0.js +2 -0
- package/dist/{chunk-rptnx3s6.js → chunk-pj2t51hn.js} +29 -29
- package/dist/chunk-pj49gnc8.js +2 -0
- package/dist/{chunk-67kbsav0.js → chunk-q5pwvr98.js} +1 -1
- package/dist/{chunk-2nj9aewf.js → chunk-qadce16v.js} +1 -1
- package/dist/chunk-qg2tpvdw.js +2 -0
- package/dist/{chunk-d9yjpdyn.js → chunk-qkemyc40.js} +6 -6
- package/dist/{chunk-q7zwv88b.js → chunk-qnrgfm9v.js} +2 -2
- package/dist/{chunk-b64y3yh0.js → chunk-qw780t39.js} +10 -10
- package/dist/{chunk-0scyzg9r.js → chunk-qy6dtm1a.js} +25 -26
- package/dist/{chunk-cmf6ar8v.js → chunk-r14j0fx3.js} +5 -5
- package/dist/{chunk-p1sfwzmb.js → chunk-r4ncb4h4.js} +1 -1
- package/dist/chunk-rb8rdpnt.js +2 -0
- package/dist/chunk-rgdyf3af.js +3 -0
- package/dist/{chunk-xpy9yjyx.js → chunk-rkdsgfhd.js} +13 -13
- package/dist/{chunk-bfbh0hfn.js → chunk-rmygv0n0.js} +6 -6
- package/dist/{chunk-mfy2ayv0.js → chunk-ryxkgt1j.js} +3 -3
- package/dist/{chunk-n7arptzc.js → chunk-s53wjw7y.js} +3 -3
- package/dist/chunk-s5bwrq6g.js +2 -0
- package/dist/{chunk-p1fpferp.js → chunk-s5dhvnnd.js} +6 -6
- package/dist/{chunk-q45xwvf6.js → chunk-t04jw3j4.js} +3 -3
- package/dist/{chunk-4qhz8q0d.js → chunk-t37tszbc.js} +22 -22
- package/dist/chunk-t59bc7na.js +3 -0
- package/dist/{chunk-f05tmz4z.js → chunk-taws6jfs.js} +9 -9
- package/dist/{chunk-bwsz6sv4.js → chunk-tgdswtya.js} +5 -5
- package/dist/chunk-tx02ffyc.js +2 -0
- package/dist/chunk-txzap6yn.js +2 -0
- package/dist/chunk-v1mwhvf8.js +2 -0
- package/dist/chunk-v8wtfrbr.js +2 -0
- package/dist/chunk-vb4xzz5c.js +2 -0
- package/dist/chunk-vcsvhbtj.js +2 -0
- package/dist/{chunk-me6kgvsm.js → chunk-vpnyqf0h.js} +1 -1
- package/dist/{chunk-mwxbdpb1.js → chunk-vyv76w55.js} +2 -2
- package/dist/chunk-w39cfxa6.js +2 -0
- package/dist/{chunk-tjhcrj3z.js → chunk-w80efvh7.js} +11 -11
- package/dist/chunk-wb6w807m.js +2 -0
- package/dist/chunk-webf565c.js +2 -0
- package/dist/chunk-wpyhavjy.js +2 -0
- package/dist/{chunk-j3st59hv.js → chunk-wr7bmkne.js} +2 -2
- package/dist/chunk-wt7qhv5b.js +2 -0
- package/dist/{chunk-y8p85kcj.js → chunk-wvds0s9m.js} +2 -2
- package/dist/chunk-wxj5srvb.js +2 -0
- package/dist/chunk-x6nrn79w.js +2 -0
- package/dist/chunk-xdwnbr9b.js +4 -0
- package/dist/chunk-xg4ww72k.js +2 -0
- package/dist/chunk-xgjr0pzy.js +2 -0
- package/dist/{chunk-qz3fdmrc.js → chunk-xn9jg1q5.js} +3 -3
- package/dist/chunk-xrspzeqx.js +2 -0
- package/dist/chunk-y00nqtdw.js +2 -0
- package/dist/{chunk-cmnze7at.js → chunk-ybq56wam.js} +2 -2
- package/dist/{chunk-cgtpbr01.js → chunk-yex0t4q2.js} +48 -48
- package/dist/chunk-yng848qe.js +2 -0
- package/dist/{chunk-y9bj3566.js → chunk-yrw5ensv.js} +3 -3
- package/dist/{chunk-pvj0bpqg.js → chunk-z25w7kmr.js} +4 -4
- package/dist/chunk-z77hnfkb.js +2 -0
- package/dist/{chunk-8qy616yt.js → chunk-zcnehb8p.js} +8 -8
- package/dist/{chunk-x6863pzd.js → chunk-zhjr4xvv.js} +5 -5
- package/dist/chunk-zj50tqxf.js +2 -0
- package/dist/chunk-zt74q4c8.js +2 -0
- package/dist/chunk-zty254tw.js +2 -0
- package/dist/{chunk-j737tnvt.js → chunk-zvvv6x8c.js} +4 -4
- package/dist/{chunk-g25rz48g.js → chunk-zxs92ebc.js} +6 -6
- package/dist/cli.js +23 -23
- package/dist/client/signals-authoring-runtime.js +6 -7
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/loops.d.ts +2 -0
- package/dist/loops.js +22 -3
- package/dist/performance-utils.d.ts +2 -0
- package/dist/performance-utils.js +7 -0
- package/dist/process.js +16 -10
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +11 -11
- package/package.json +5 -5
- package/dist/chunk-09285y4b.js +0 -2
- package/dist/chunk-0jvrzpfs.js +0 -2
- package/dist/chunk-19gk9k01.js +0 -2
- package/dist/chunk-2c5bwrnh.js +0 -2
- package/dist/chunk-2fwssv2z.js +0 -2
- package/dist/chunk-2v3r330m.js +0 -3
- package/dist/chunk-2vk7dtvs.js +0 -2
- package/dist/chunk-30rpspzt.js +0 -43
- package/dist/chunk-3bf48zrh.js +0 -2
- package/dist/chunk-4amybnpc.js +0 -2
- package/dist/chunk-4zjxj8ex.js +0 -2
- package/dist/chunk-58e92xts.js +0 -2
- package/dist/chunk-6h1qa3hw.js +0 -2
- package/dist/chunk-7pz76f28.js +0 -2
- package/dist/chunk-82v1egn6.js +0 -2
- package/dist/chunk-897gqcby.js +0 -2
- package/dist/chunk-9z9c025j.js +0 -2
- package/dist/chunk-a8fy7jv8.js +0 -2
- package/dist/chunk-akj26p4b.js +0 -3
- package/dist/chunk-b22yj5j5.js +0 -2
- package/dist/chunk-brhas9mp.js +0 -3
- package/dist/chunk-c1e45rtv.js +0 -2
- package/dist/chunk-cgamtmxv.js +0 -2
- package/dist/chunk-d0jcw9h6.js +0 -2
- package/dist/chunk-erf2g5b2.js +0 -2
- package/dist/chunk-exke928x.js +0 -2
- package/dist/chunk-fwk0gjbq.js +0 -2
- package/dist/chunk-g4sdthck.js +0 -2
- package/dist/chunk-g8nqmnb7.js +0 -2
- package/dist/chunk-gnt36wgk.js +0 -25
- package/dist/chunk-h67pm636.js +0 -2
- package/dist/chunk-hb8jxg45.js +0 -2
- package/dist/chunk-hfgzqapw.js +0 -2
- package/dist/chunk-hhats9b3.js +0 -2
- package/dist/chunk-htdbm0sd.js +0 -2
- package/dist/chunk-j0hrk24j.js +0 -2
- package/dist/chunk-jjbdtj4w.js +0 -2
- package/dist/chunk-jzc3rw49.js +0 -2
- package/dist/chunk-jzgyrxye.js +0 -2
- package/dist/chunk-k0xdvegc.js +0 -2
- package/dist/chunk-kep17bvj.js +0 -2
- package/dist/chunk-kfn7g24h.js +0 -2
- package/dist/chunk-kq5k2qbz.js +0 -2
- package/dist/chunk-ksxtrmy2.js +0 -2
- package/dist/chunk-m934bzg2.js +0 -2
- package/dist/chunk-mfc5d181.js +0 -2
- package/dist/chunk-mmeck545.js +0 -2
- package/dist/chunk-mz6qjee1.js +0 -2
- package/dist/chunk-ndjmt3vg.js +0 -3
- package/dist/chunk-p9dma8k0.js +0 -2
- package/dist/chunk-pby6dxnc.js +0 -2
- package/dist/chunk-prt4ntb0.js +0 -2
- package/dist/chunk-q2ynwst2.js +0 -2
- package/dist/chunk-q5bct2ks.js +0 -2
- package/dist/chunk-qp7dajd2.js +0 -2
- package/dist/chunk-r2hjn9ds.js +0 -2
- package/dist/chunk-s2zsa16d.js +0 -2
- package/dist/chunk-s8b6re34.js +0 -2
- package/dist/chunk-sddp2398.js +0 -2
- package/dist/chunk-sv4emtcj.js +0 -2
- package/dist/chunk-tcyvwy8p.js +0 -2
- package/dist/chunk-tg18j1yf.js +0 -2
- package/dist/chunk-tj7dh2dz.js +0 -2
- package/dist/chunk-tsvnhc0c.js +0 -4
- package/dist/chunk-v2ps4gnx.js +0 -2
- package/dist/chunk-vafxrky2.js +0 -2
- package/dist/chunk-wpendr22.js +0 -3
- package/dist/chunk-x30gh7vt.js +0 -2
- package/dist/chunk-x5r1cty7.js +0 -2
- package/dist/chunk-zd3dsp6p.js +0 -2
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
${e.message}`),n&&e.line){let o=
|
|
2
|
+
import{X}from"./chunk-t59bc7na.js";import He from"path";var t={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603};function Q(e){for(let[n,r]of Object.entries(t))if(r===e)return n;return}import ht from"path";var yt={showRelativePaths:!1,enableAutoRecovery:X(),logRecoveryWarnings:!0},ee={...yt};function F(){return{...ee}}function j(e){if(!ee.showRelativePaths||!e)return e;let n=ee.baseDir||process.cwd();try{let r=ht.relative(n,e);return r.startsWith("..")?e:r}catch{return e}}class N extends Error{code;filePath;line;column;context;numericCode;constructor(e,n,r,i,s,o,a){super(e);this.code=n;this.filePath=r;this.line=i;this.column=s;this.context=o;if(this.name="StxError",this.numericCode=a||t.EVALUATION_ERROR,this.filePath)this.filePath=j(this.filePath)}}class ce extends N{constructor(e,n,r,i,s,o){super(e,"stx_RUNTIME_ERROR",n,r,i,s,o||t.EVALUATION_ERROR);this.name="StxRuntimeError"}}class Er extends N{constructor(e,n,r,i,s,o){super(e,"stx_FILE_ERROR",n,r,i,s,o||t.FILE_NOT_FOUND);this.name="StxFileError"}}class K extends N{isFatal=!0;constructor(e,n,r,i,s,o){super(e,"stx_VALIDATION_ERROR",n,r,i,s,o||t.DOM_API_VIOLATION);this.name="StxValidationError"}}function we(e){let{type:n,message:r,code:i,filePath:s,line:o,column:a,template:c,offset:p,snippet:g,suggestion:h,format:m="text"}=e,y=o,E=a;if(!y&&c&&p!==void 0){let Z=St(c,p);y=Z.line,E=Z.column}let v=s?j(s):void 0,w=i?Q(i):void 0,R={type:n,code:i,codeName:w,message:r,filePath:v,line:y,column:E,snippet:g,suggestion:h,timestamp:new Date().toISOString()},_;switch(m){case"html":_=Et(R);break;case"json":_=JSON.stringify(R,null,2);break;case"console":_=xt(R,c,p);break;case"text":default:_=bt(R,c,p);break}return{formatted:_,data:R}}function bt(e,n,r){let i=[],s=e.code?` [${e.codeName||e.code}]`:"";if(i.push(`[${e.type} Error${s}]`),e.filePath){let o=e.filePath;if(e.line){if(o+=`:${e.line}`,e.column)o+=`:${e.column}`}i.push(`at ${o}`)}if(i.push(`
|
|
3
|
+
${e.message}`),n&&e.line){let o=wt(n,e.line,2);if(o)i.push(`
|
|
4
4
|
${o}`)}if(e.snippet)i.push(`
|
|
5
5
|
Snippet: ${e.snippet}`);if(e.suggestion)i.push(`
|
|
6
|
-
Suggestion: ${e.suggestion}`);return i.join(" ")}function
|
|
6
|
+
Suggestion: ${e.suggestion}`);return i.join(" ")}function Et(e){let n=e.code?` [${e.code}]`:"",r=e.filePath?` in ${e.filePath}${e.line?`:${e.line}`:""}`:"",i=`<!-- [${e.type} Error${n}]${r}: ${xe(e.message)}`;if(e.suggestion)i+=` | Suggestion: ${xe(e.suggestion)}`;return i+=" -->",i}function xt(e,n,r){let g=[],h=e.code?` [${e.codeName||e.code}]`:"";if(g.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${e.type} Error${h} \u2501\u2501\u2501${"\x1B[0m"}`),e.filePath){let m=`\x1B[36m${e.filePath}\x1B[0m`;if(e.line){if(m+=`\x1B[90m:${e.line}\x1B[0m`,e.column)m+=`\x1B[90m:${e.column}\x1B[0m`}g.push(`
|
|
7
7
|
\x1B[90mat\x1B[0m ${m}`)}if(g.push(`
|
|
8
8
|
|
|
9
|
-
${e.message}`),n&&e.line){let m=
|
|
9
|
+
${e.message}`),n&&e.line){let m=vt(n,e.line,2);if(m)g.push(`
|
|
10
10
|
|
|
11
11
|
\x1B[90mContext:\x1B[0m
|
|
12
12
|
${m}`)}if(e.suggestion)g.push(`
|
|
13
13
|
|
|
14
14
|
\x1B[33mSuggestion:\x1B[0m ${e.suggestion}`);return g.push(`
|
|
15
|
-
${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),g.join("")}function
|
|
15
|
+
${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),g.join("")}function wt(e,n,r){let i=e.split(`
|
|
16
16
|
`),s=Math.max(0,n-r-1),o=Math.min(i.length-1,n+r-1),a=[];for(let c=s;c<=o;c++){let p=(c+1).toString().padStart(4),g=c===n-1?">":" ";a.push(`${g}${p} | ${i[c]}`)}return a.join(`
|
|
17
|
-
`)}function
|
|
17
|
+
`)}function vt(e,n,r){let i=e.split(`
|
|
18
18
|
`),s=Math.max(0,n-r-1),o=Math.min(i.length-1,n+r-1),a="\x1B[90m",c="\x1B[31m",p="\x1B[0m",g=[];for(let h=s;h<=o;h++){let m=(h+1).toString().padStart(4),y=h===n-1,E=y?"\x1B[31m>\x1B[0m":" ",v=y?`\x1B[31m${i[h]}\x1B[0m`:`\x1B[90m${i[h]}\x1B[0m`;g.push(`${E}\x1B[90m${m}\x1B[0m | ${v}`)}return g.join(`
|
|
19
|
-
`)}function
|
|
20
|
-
`);return{line:i.length,column:i[i.length-1].length}}function l(e,n,r){return
|
|
21
|
-
@end${c}`;i.push(`Added ${h} missing @end${c}`)}}if(i.length>0&&n.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),i.forEach((c)=>console.warn(` - ${c}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:r,fixes:i}},createFallbackContent(e,n){if(
|
|
19
|
+
`)}function xe(e){return e.replace(/--/g,"- -").replace(/>/g,">")}function St(e,n){let i=e.substring(0,n).split(`
|
|
20
|
+
`);return{line:i.length,column:i[i.length-1].length}}function l(e,n,r){return we({type:e,message:n,code:r,format:"html"}).formatted}async function _e(e,n,r){try{return await e()}catch(i){if(r&&i instanceof Error)r(i);return n}}var Ci={isEnabled(){return F().enableAutoRecovery},fixCommonSyntaxErrors(e){let n=F();if(!n.enableAutoRecovery)return{fixed:e,fixes:[]};let r=e,i=[],s=(r.match(/\{\{/g)||[]).length,o=(r.match(/\}\}/g)||[]).length;if(s>o){let c=s-o;r+="}}".repeat(c),i.push(`Added ${c} missing closing braces '}}'`)}let a=["if","foreach","for","switch","section"];for(let c of a){let p=(r.match(new RegExp(`@${c}\\b`,"g"))||[]).length,g=(r.match(new RegExp(`@end${c}\\b`,"g"))||[]).length;if(p>g){let h=p-g;for(let m=0;m<h;m++)r+=`
|
|
21
|
+
@end${c}`;i.push(`Added ${h} missing @end${c}`)}}if(i.length>0&&n.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),i.forEach((c)=>console.warn(` - ${c}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:r,fixes:i}},createFallbackContent(e,n){if(X())return`<!-- ${e} failed: ${n.message} -->`;return"<!-- stx rendering error -->"}};class te{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor(e={}){this.maxErrors=e.maxErrors??1000,this.enableFileLogging=e.enableFileLogging??!1,this.logFilePath=e.logFilePath??".stx/errors.log",this.logFormat=e.logFormat??"json",this.maxFileSize=e.maxFileSize??10485760,this.maxLogFiles=e.maxLogFiles??5,this.minLevel=e.minLevel??"all"}configure(e){if(e.maxErrors!==void 0)this.maxErrors=e.maxErrors;if(e.enableFileLogging!==void 0)this.enableFileLogging=e.enableFileLogging;if(e.logFilePath!==void 0)this.logFilePath=e.logFilePath;if(e.logFormat!==void 0)this.logFormat=e.logFormat;if(e.maxFileSize!==void 0)this.maxFileSize=e.maxFileSize;if(e.maxLogFiles!==void 0)this.maxLogFiles=e.maxLogFiles;if(e.minLevel!==void 0)this.minLevel=e.minLevel}log(e,n,r="error"){let i={timestamp:new Date,error:e,context:n,level:r};if(this.errors.push(i),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(r))this.writeToFile(i)}shouldLog(e){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return e==="error"||e==="warning";if(this.minLevel==="error")return e==="error";return!0}formatEntry(e){if(this.logFormat==="json")return JSON.stringify({timestamp:e.timestamp.toISOString(),level:e.level||"error",type:e.error.constructor.name,message:e.error.message,stack:e.error.stack,context:e.context});let n=[`[${e.timestamp.toISOString()}] [${(e.level||"error").toUpperCase()}] ${e.error.constructor.name}: ${e.error.message}`];if(e.error.stack)n.push(` Stack: ${e.error.stack.split(`
|
|
22
22
|
`).slice(1).join(`
|
|
23
23
|
`)}`);if(e.context)n.push(` Context: ${JSON.stringify(e.context)}`);return n.join(`
|
|
24
24
|
`)}writeToFile(e){this.writeQueue=this.writeQueue.then(async()=>{try{let n=await import("fs"),r=await import("path"),i=r.dirname(this.logFilePath);if(!n.existsSync(i))n.mkdirSync(i,{recursive:!0});await this.rotateIfNeeded(n);let s=`${this.formatEntry(e)}
|
|
25
25
|
`;n.appendFileSync(this.logFilePath,s,"utf-8")}catch(n){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",n)}})}async rotateIfNeeded(e){try{if(!e.existsSync(this.logFilePath))return;if(e.statSync(this.logFilePath).size<this.maxFileSize)return;for(let r=this.maxLogFiles-1;r>=1;r--){let i=`${this.logFilePath}.${r}`,s=`${this.logFilePath}.${r+1}`;if(e.existsSync(i))if(r>=this.maxLogFiles-1)e.unlinkSync(i);else e.renameSync(i,s)}if(this.maxLogFiles<=1)e.writeFileSync(this.logFilePath,"");else e.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(n){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",n)}}getRecentErrors(e=10){return this.errors.slice(-e)}getErrorsByType(e){return this.errors.filter((n)=>n.error.constructor.name===e)}getErrorsByLevel(e){return this.errors.filter((n)=>n.level===e)}clear(){this.errors.length=0}async clearLogFile(){try{let e=await import("fs");if(e.existsSync(this.logFilePath))e.writeFileSync(this.logFilePath,"","utf-8")}catch(e){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",e)}}getStats(){let e={},n={error:0,warning:0,info:0};for(let r of this.errors){let i=r.error.constructor.name;e[i]=(e[i]||0)+1;let s=r.level||"error";n[s]=(n[s]||0)+1}return{total:this.errors.length,byType:e,byLevel:n}}async exportToFile(e,n="json"){let r=await import("fs"),i=await import("path"),s=i.dirname(e);if(!r.existsSync(s))r.mkdirSync(s,{recursive:!0});if(n==="json"){let o=this.errors.map((a)=>({timestamp:a.timestamp.toISOString(),level:a.level||"error",type:a.error.constructor.name,message:a.error.message,stack:a.error.stack,context:a.context}));r.writeFileSync(e,JSON.stringify(o,null,2),"utf-8")}else{let o=this.errors.map((a)=>this.formatEntry(a));r.writeFileSync(e,o.join(`
|
|
26
26
|
|
|
27
|
-
`),"utf-8")}}async flush(){await this.writeQueue}}var
|
|
28
|
-
`)}};function x(e,n,r,i=0){let s=0,o=i,a=null,c=0,p=!1;while(o<e.length){let g=e[o];if(a&&p){p=!1,o++;continue}if(a&&g==="\\"){p=!0,o++;continue}if(p=!1,(g==='"'||g==="'"||g==="`")&&!a){a=g,o++;continue}if(g===a&&a!=="`"){a=null,o++;continue}if(a==="`"&&g==="$"&&e[o+1]==="{"){c++,o+=2;continue}if(c>0&&g==="}"){c--,o++;continue}if(g==="`"&&a==="`"&&c===0){a=null,o++;continue}if(a){o++;continue}if(g===n)s++;else if(g===r){if(s--,s===0)return o}o++}return-1}function
|
|
27
|
+
`),"utf-8")}}async flush(){await this.writeQueue}}var z=new te,kn={isDevelopment(){return X()},logDetailedError(e,n){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",e.message),console.error("Stack:",e.stack),n)console.error("Context:",n);console.error("========================")},createErrorReport(e,n){let r=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${e.message}`,`Type: ${e.constructor.name}`,`Stack: ${e.stack}`];if(n)r.push(`Context: ${JSON.stringify(n,null,2)}`);return r.push("========================"),r.join(`
|
|
28
|
+
`)}};function x(e,n,r,i=0){let s=0,o=i,a=null,c=0,p=!1;while(o<e.length){let g=e[o];if(a&&p){p=!1,o++;continue}if(a&&g==="\\"){p=!0,o++;continue}if(p=!1,(g==='"'||g==="'"||g==="`")&&!a){a=g,o++;continue}if(g===a&&a!=="`"){a=null,o++;continue}if(a==="`"&&g==="$"&&e[o+1]==="{"){c++,o+=2;continue}if(c>0&&g==="}"){c--,o++;continue}if(g==="`"&&a==="`"&&c===0){a=null,o++;continue}if(a){o++;continue}if(g===n)s++;else if(g===r){if(s--,s===0)return o}o++}return-1}function ol(e,n){let r=n,i={paren:0,bracket:0,brace:0},s=null,o=0;while(r<e.length){let a=e[r];if((r>0?e[r-1]:"")==="\\"&&s){r++;continue}if((a==='"'||a==="'")&&!s){s=a,r++;continue}if(a===s&&s!=="`"){s=null,r++;continue}if(a==="`"&&!s){s="`",r++;continue}if(a==="`"&&s==="`"&&o===0){s=null,r++;continue}if(s==="`"&&a==="$"&&e[r+1]==="{"){o++,r+=2;continue}if(o>0){if(a==="{")o++;else if(a==="}")o--;r++;continue}if(s){r++;continue}if(i.paren===0&&i.bracket===0&&i.brace===0){if(e.slice(r,r+2)==="}}"||e.slice(r,r+3)==="!!}")break;if(a===","||a===";")break}if(a==="(")i.paren++;else if(a===")"){if(i.paren--,i.paren<0)break}else if(a==="[")i.bracket++;else if(a==="]"){if(i.bracket--,i.bracket<0)break}else if(a==="{")i.brace++;else if(a==="}"){if(i.brace--,i.brace<0)break}r++}return{expression:e.slice(n,r),endPos:r}}class T{cache=new Map;maxSize;options;sizes;bytes=0;constructor(e=100,n){this.maxSize=e,this.options=n??null,this.sizes=n?new Map:null}get byteSize(){return this.bytes}setMaxBytes(e){if(!this.options)return;this.options={...this.options,maxBytes:e};while(this.bytes>e&&this.cache.size>0){let n=this.cache.keys().next().value;if(n===void 0)break;this.delete(n)}}get(e){if(!this.cache.has(e))return;let n=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,n),n}set(e,n){if(this.cache.has(e))this.delete(e);let r=this.options?this.options.sizeOf(n):0;if(this.options&&r>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+r>this.options.maxBytes)){let i=this.cache.keys().next().value;if(i===void 0)break;this.delete(i)}if(this.cache.set(e,n),this.sizes)this.sizes.set(e,r),this.bytes+=r}has(e){return this.cache.has(e)}delete(e){if(this.sizes){let n=this.sizes.get(e);if(n!==void 0)this.bytes-=n,this.sizes.delete(e)}return this.cache.delete(e)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var M=new Map,Tt=500;function jt(e,n){if(n?.includes("g"))return new RegExp(e,n);let r=`${e}:${n||""}`;if(!M.has(r)){if(M.size>=Tt){let i=M.keys().next().value;if(i)M.delete(i)}M.set(r,new RegExp(e,n))}return M.get(r)}class Se{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(e){let n=Array.from(new Set(e)),r=n.sort().join(","),i=this.pool.find((c)=>c.context.join(",")===r);if(i)return i.func;let s=this.fnCache,o=this.fnCacheMaxSize,a=(...c)=>(p)=>{try{let g=`${r}:${p}`,h=s.get(g);if(!h){if(s.size>=o){let m=s.keys().next().value;if(m)s.delete(m)}h=Function(...n,`
|
|
29
29
|
'use strict';
|
|
30
30
|
try {
|
|
31
31
|
return ${p};
|
|
@@ -36,7 +36,7 @@ catch (e) {
|
|
|
36
36
|
}
|
|
37
37
|
throw e;
|
|
38
38
|
}
|
|
39
|
-
`),s.set(g,h)}return h(...c)}catch{return}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:a,context:n.slice()});return a}clear(){this.pool.length=0,this.fnCache.clear()}}var er=new we;class ve{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(e){this.enabled=e}isEnabled(){return this.enabled}setBudget(e,n){this.budgets.set(e,{warnThreshold:0.8,action:"warn",...n})}setBudgets(e){for(let[n,r]of Object.entries(e))this.setBudget(n,r)}removeBudget(e){this.budgets.delete(e)}getBudgets(){let e={};for(let[n,r]of this.budgets.entries())e[n]=r;return e}onViolation(e){this.violationHandlers.push(e)}offViolation(e){let n=this.violationHandlers.indexOf(e);if(n!==-1)this.violationHandlers.splice(n,1)}time(e,n){if(!this.enabled)return n();let r=performance.now(),i=n(),s=performance.now()-r;return this.recordTime(e,s),this.checkBudget(e,s),i}async timeAsync(e,n){if(!this.enabled)return n();let r=performance.now(),i=await n(),s=performance.now()-r;return this.recordTime(e,s),this.checkBudget(e,s),i}checkBudget(e,n){let r=this.budgets.get(e);if(!r)return;let i=n/r.maxTime*100,s=r.warnThreshold!==void 0?n>=r.maxTime*r.warnThreshold&&n<r.maxTime:!1,o=n>=r.maxTime;if(!s&&!o)return;let a={label:e,actualTime:n,budgetTime:r.maxTime,exceedancePercent:i,timestamp:new Date,isWarning:s};this.violations.push(a);while(this.violations.length>this.maxViolations)this.violations.shift();for(let p of this.violationHandlers)try{p(a)}catch{}let c=s?`[Performance Warning] "${e}" took ${n.toFixed(2)}ms (${i.toFixed(1)}% of ${r.maxTime}ms budget)`:`[Performance Budget Exceeded] "${e}" took ${n.toFixed(2)}ms (exceeded ${r.maxTime}ms budget by ${(i-100).toFixed(1)}%)`;switch(r.action){case"log":console.log(c);break;case"warn":console.warn(c);break;case"error":console.error(c);break;case"throw":if(o)throw Error(c);else console.warn(c);break}}recordTime(e,n){let r=this.metrics.get(e);if(r)r.count++,r.totalTime+=n,r.maxTime=Math.max(r.maxTime,n),r.minTime=Math.min(r.minTime,n);else this.metrics.set(e,{count:1,totalTime:n,maxTime:n,minTime:n})}getStats(e){if(e){let r=this.metrics.get(e);if(!r)return{};let i=this.budgets.get(e);return{count:r.count,avgTime:r.totalTime/r.count,totalTime:r.totalTime,maxTime:r.maxTime,minTime:r.minTime,budget:i?.maxTime,budgetUtilization:i?r.totalTime/r.count/i.maxTime*100:void 0}}let n={};for(let[r,i]of this.metrics.entries()){let s=this.budgets.get(r);n[r]={count:i.count,avgTime:i.totalTime/i.count,totalTime:i.totalTime,maxTime:i.maxTime,minTime:i.minTime,budget:s?.maxTime,budgetUtilization:s?i.totalTime/i.count/s.maxTime*100:void 0}}return n}getViolations(e){if(e)return this.violations.filter((n)=>n.label===e);return[...this.violations]}getViolationStats(){let e={},n=0,r=0;for(let i of this.violations)if(e[i.label]=(e[i.label]||0)+1,i.isWarning)n++;else r++;return{total:this.violations.length,byLabel:e,warnings:n,errors:r}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var te=null;function St(){if(!te)te=new ve;return te}var ie=new Proxy({},{get(e,n){return St()[n]}});var Tt={maxSanitizeDepth:10,allowBracketNotation:!1},Ie={...Tt};var H=/\bnew\s+/,U="__stx_safe_ctors",Oe=["Bun","Deno","Buffer","fetch","atob","btoa","console","Response","Request","Headers","WebAssembly","structuredClone","queueMicrotask","crypto","performance","navigator","Worker","WebSocket","BroadcastChannel","EventSource","XMLHttpRequest","localStorage","sessionStorage"],ne=[...Oe,"Function","setTimeout","setInterval","setImmediate","process","require","exports","module","window","document","global","globalThis","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry"],Se=ne.map(()=>{return}),re=Object.freeze(Object.assign(Object.create(null),{keys:Object.keys,values:Object.values,entries:Object.entries,fromEntries:Object.fromEntries,assign:Object.assign,hasOwn:Object.hasOwn,is:Object.is})),oe=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,H,/\bdelete\s+/,/\bthis\b/,/\\u(?:\{[\dA-Fa-f]+\}|[\dA-Fa-f]{4})/],ce=new Set([...Oe,"eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this",U]),le=new Set(["__proto__","constructor","prototype"]);function Pe(e){let n="",r=[],i=null,s=!1;for(let o=0;o<e.length;o++){let a=e[o];if(s){s=!1;continue}if(a==="\\"&&i){s=!0;continue}if(i){if(i==="`"&&a==="$"&&o+1<e.length&&e[o+1]==="{"){let c=1;o+=2;while(o<e.length&&c>0){if(e[o]==="{")c++;else if(e[o]==="}")c--;if(c>0)n+=e[o],r.push(o),o++}continue}if(a===i)i=null;continue}if(a==='"'||a==="'"||a==="`"){i=a;continue}n+=a,r.push(o)}return{text:n,map:r}}function Le(e){return Pe(e).text}var Me=["Collator","DateTimeFormat","DisplayNames","ListFormat","Locale","NumberFormat","PluralRules","RelativeTimeFormat","Segmenter"],Ne=(()=>{let e={Date,URL,URLSearchParams},n=Intl;for(let r of Me)if(typeof n[r]==="function")e[`Intl_${r}`]=n[r];return Object.freeze(Object.assign(Object.create(null),e))})(),kt=/^new(\s+)(Date|URLSearchParams|URL|Intl\s*\.\s*([A-Z_a-z]\w*))\s*\(/,Te=/(?<![\w$])new(?![\w$])/g,Re=`only new Date(), new URL(), new URLSearchParams() and new Intl.{${Me.join(",")}}() are allowed`;function Rt(e){let{text:n,map:r}=Pe(e),i=[];Te.lastIndex=0;let s;while((s=Te.exec(n))!==null){let a=s.index;if(/(?<!\.)\.\s*$/.test(n.slice(0,a)))continue;let c=kt.exec(n.slice(a)),p=c?.[3],g=!c?null:p?`Intl_${p}`:c[2];if(!c||!g||!(g in Ne))throw new S(`matched /${H.source}/; ${Re}`,e);let h=a+c[0].length,m=r[a],y=r[h-1]+1;if(e.slice(m,y)!==n.slice(a,h))throw new S(`matched /${H.source}/; ${Re}`,e);let E=m+3+c[1].length;i.push({start:E,end:E+c[2].length,key:g})}let o=e;for(let a=i.length-1;a>=0;a--){let c=i[a];o=`${o.slice(0,c.start)}${U}.${c.key}${o.slice(c.end)}`}return{source:o,usesSafeConstructors:i.length>0}}class S extends Error{rule;expression;constructor(e,n,r){super(r??`Potentially unsafe expression (${e}): ${n}`);this.name="UnsafeExpressionError",this.rule=e,this.expression=n}}function qs(e){try{return ue(e),null}catch(n){return n instanceof S?n.rule:n instanceof Error?n.message:String(n)}}function Fe(e,n){let r=/[$A-Z_a-z][$\w]*/g,i;while((i=r.exec(e))!==null){let s=i[0],o=e[i.index-1];if(ce.has(s))throw new S(`matched /\\b${s}\\b/; identifier ${s}`,n);if(o==="."&&le.has(s))throw new S(`matched /.${s}/; property ${s}`,n)}}function De(e,n=!0){let r=/(?:[$\w)\].]|\?\.)\s*\[([^\]]*)\]/g,i=new Set,s;while((s=r.exec(e))!==null){let o=s.index+s[0].indexOf("["),a=e.slice(0,o);if(/(?:^|[^$\w])(?:let|const|var)\s*$/.test(a))continue;let c=s[1].trim(),p=/^'(?:[^'\\]|\\.)*'$/.test(c),g=/^"(?:[^"\\]|\\.)*"$/.test(c);if(/^\d+$/.test(c))continue;if(p||g){let m=c.slice(1,-1);if(le.has(m))throw new S(`bracket key ${m}`,e);if(!Ie.allowBracketNotation)throw new S("bracket notation with a string key; enable with configureSafeEvaluator({ allowBracketNotation: true })",e,`Bracket notation with strings not allowed: ${e}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);continue}if(n&&/^[$A-Z_a-z][$\w]*$/.test(c)){i.add(c);continue}throw new S("dynamic bracket notation is not allowed",e)}return[...i]}function ue(e){let n=e.trim(),r=Le(n);Fe(r,n);let i=De(n);for(let s of oe){if(s===H)continue;if(s.test(r))throw new S(`matched /${s.source}/`,n)}return{...Rt(n),dynamicKeys:i}}function ki(e){return ue(e),e.trim()}var Ks=Symbol("stx.sanitizeCache"),$t=4000,j=new Map;function Ct(e){let n=j.get(e);if(n===void 0){if(n=oe.some((r)=>r.test(e)),j.size>=$t)j.clear();j.set(e,n)}return n}function V(e){let n={},r=e[Ks];n.Math=Math,n.JSON=JSON,n.Date=Date,n.String=String,n.Number=Number,n.Boolean=Boolean,n.Array=Array,n.Object=re,n.parseInt=Number.parseInt,n.parseFloat=Number.parseFloat,n.isNaN=Number.isNaN,n.isFinite=Number.isFinite,n.encodeURIComponent=encodeURIComponent,n.decodeURIComponent=decodeURIComponent;for(let[i,s]of Object.entries(e)){if(i.startsWith("__")||Ct(i))continue;if(s&&typeof s==="object"&&!Array.isArray(s)){let o=r?.get(s);if(o===void 0)o=se(s),r?.set(s,o);n[i]=o}else n[i]=s}return n}function se(e,n=0){if(n>=Ie.maxSanitizeDepth)return"[Object too deep]";if(e===null||typeof e!=="object")return e;if(Array.isArray(e))return e.map((i)=>se(i,n+1));if(e instanceof Date||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof Error)return e;let r={};for(let[i,s]of Object.entries(e)){if(i.startsWith("__")||i==="constructor"||i==="prototype")continue;if(s&&typeof s==="object")r[i]=se(s,n+1);else r[i]=s}return r}function u(e,n){try{let r=V(n),i=Object.keys(r),s=Object.values(r);return d(e,i)(...s)}catch{return}}function f(e){try{return ki(e),!0}catch{return!1}}function rl(e,n){try{let r=V(n),i=Object.keys(r),s=Object.values(r),o=!1,c=d(e,i,()=>{o=!0})(...s);return!o&&Boolean(c)}catch{return!1}}function A(e,n){try{let r=u(e,n);if(r&&typeof r==="object"&&!Array.isArray(r))return r;return{}}catch{return{}}}var ze=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"]),At=2000,B=new Map;function $e(e,n){let r=`${e.join(",")}\x00${n}`,i=B.get(r);if(i)return i;let s=Function(...e,n);if(B.size>=At)B.clear();return B.set(r,s),s}function st(e){return e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:)/g,"$1$2").match(/\b[a-zA-Z_$][\w$]*\b/g)||[]}var _t=/^[A-Za-z_$][\w$]*$/;function jt(e){return _t.test(e)&&!ze.has(e)}var Ce=new T(2000,{maxBytes:2097152,sizeOf:(e)=>e.sourceBytes});function d(e,n,r){let i=JSON.stringify([e,n]),s=Ce.get(i);if(!s)s=It(e,[...n]),s.sourceBytes+=i.length*2,Ce.set(i,s);return Ot(Pt(s.buildFunc,s.filteredKeys,s.contextKeys,s.validEntries,s.validIndices,r),s.contextKeys,s.dynamicKeys)}function It(e,n){let{source:r,usesSafeConstructors:i,dynamicKeys:s}=ue(e),o=[];for(let m=0;m<n.length;m++){if(!jt(n[m]))continue;if(n[m]===U||n[m]==="Object"||ce.has(n[m]))continue;o.push({key:n[m],index:m})}o.sort((m,y)=>m.key<y.key?-1:1);let a=o.map((m)=>m.key),c=o.map((m)=>m.index),p=`
|
|
39
|
+
`),s.set(g,h)}return h(...c)}catch{return}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:a,context:n.slice()});return a}clear(){this.pool.length=0,this.fnCache.clear()}}var nr=new Se;class Te{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(e){this.enabled=e}isEnabled(){return this.enabled}setBudget(e,n){this.budgets.set(e,{warnThreshold:0.8,action:"warn",...n})}setBudgets(e){for(let[n,r]of Object.entries(e))this.setBudget(n,r)}removeBudget(e){this.budgets.delete(e)}getBudgets(){let e={};for(let[n,r]of this.budgets.entries())e[n]=r;return e}onViolation(e){this.violationHandlers.push(e)}offViolation(e){let n=this.violationHandlers.indexOf(e);if(n!==-1)this.violationHandlers.splice(n,1)}time(e,n){if(!this.enabled)return n();let r=performance.now(),i=n(),s=performance.now()-r;return this.recordTime(e,s),this.checkBudget(e,s),i}async timeAsync(e,n){if(!this.enabled)return n();let r=performance.now(),i=await n(),s=performance.now()-r;return this.recordTime(e,s),this.checkBudget(e,s),i}checkBudget(e,n){let r=this.budgets.get(e);if(!r)return;let i=n/r.maxTime*100,s=r.warnThreshold!==void 0?n>=r.maxTime*r.warnThreshold&&n<r.maxTime:!1,o=n>=r.maxTime;if(!s&&!o)return;let a={label:e,actualTime:n,budgetTime:r.maxTime,exceedancePercent:i,timestamp:new Date,isWarning:s};this.violations.push(a);while(this.violations.length>this.maxViolations)this.violations.shift();for(let p of this.violationHandlers)try{p(a)}catch{}let c=s?`[Performance Warning] "${e}" took ${n.toFixed(2)}ms (${i.toFixed(1)}% of ${r.maxTime}ms budget)`:`[Performance Budget Exceeded] "${e}" took ${n.toFixed(2)}ms (exceeded ${r.maxTime}ms budget by ${(i-100).toFixed(1)}%)`;switch(r.action){case"log":console.log(c);break;case"warn":console.warn(c);break;case"error":console.error(c);break;case"throw":if(o)throw Error(c);else console.warn(c);break}}recordTime(e,n){let r=this.metrics.get(e);if(r)r.count++,r.totalTime+=n,r.maxTime=Math.max(r.maxTime,n),r.minTime=Math.min(r.minTime,n);else this.metrics.set(e,{count:1,totalTime:n,maxTime:n,minTime:n})}getStats(e){if(e){let r=this.metrics.get(e);if(!r)return{};let i=this.budgets.get(e);return{count:r.count,avgTime:r.totalTime/r.count,totalTime:r.totalTime,maxTime:r.maxTime,minTime:r.minTime,budget:i?.maxTime,budgetUtilization:i?r.totalTime/r.count/i.maxTime*100:void 0}}let n={};for(let[r,i]of this.metrics.entries()){let s=this.budgets.get(r);n[r]={count:i.count,avgTime:i.totalTime/i.count,totalTime:i.totalTime,maxTime:i.maxTime,minTime:i.minTime,budget:s?.maxTime,budgetUtilization:s?i.totalTime/i.count/s.maxTime*100:void 0}}return n}getViolations(e){if(e)return this.violations.filter((n)=>n.label===e);return[...this.violations]}getViolationStats(){let e={},n=0,r=0;for(let i of this.violations)if(e[i.label]=(e[i.label]||0)+1,i.isWarning)n++;else r++;return{total:this.violations.length,byLabel:e,warnings:n,errors:r}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var ne=null;function kt(){if(!ne)ne=new Te;return ne}var ae=new Proxy({},{get(e,n){return kt()[n]}});var ve=0;async function A(){if(performance.now()-ve<16)return;await new Promise((e)=>setTimeout(e,0)),ve=performance.now()}var Rt={maxSanitizeDepth:10,allowBracketNotation:!1},Pe={...Rt};var U=/\bnew\s+/,V="__stx_safe_ctors",Le=["Bun","Deno","Buffer","fetch","atob","btoa","console","Response","Request","Headers","WebAssembly","structuredClone","queueMicrotask","crypto","performance","navigator","Worker","WebSocket","BroadcastChannel","EventSource","XMLHttpRequest","localStorage","sessionStorage"],re=[...Le,"Function","setTimeout","setInterval","setImmediate","process","require","exports","module","window","document","global","globalThis","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry"],ke=re.map(()=>{return}),ie=Object.freeze(Object.assign(Object.create(null),{keys:Object.keys,values:Object.values,entries:Object.entries,fromEntries:Object.fromEntries,assign:Object.assign,hasOwn:Object.hasOwn,is:Object.is})),oe=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,U,/\bdelete\s+/,/\bthis\b/,/\\u(?:\{[\dA-Fa-f]+\}|[\dA-Fa-f]{4})/],le=new Set([...Le,"eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this",V]),ue=new Set(["__proto__","constructor","prototype"]);function Me(e){let n="",r=[],i=null,s=!1;for(let o=0;o<e.length;o++){let a=e[o];if(s){s=!1;continue}if(a==="\\"&&i){s=!0;continue}if(i){if(i==="`"&&a==="$"&&o+1<e.length&&e[o+1]==="{"){let c=1;o+=2;while(o<e.length&&c>0){if(e[o]==="{")c++;else if(e[o]==="}")c--;if(c>0)n+=e[o],r.push(o),o++}continue}if(a===i)i=null;continue}if(a==='"'||a==="'"||a==="`"){i=a;continue}n+=a,r.push(o)}return{text:n,map:r}}function Ne(e){return Me(e).text}var Fe=["Collator","DateTimeFormat","DisplayNames","ListFormat","Locale","NumberFormat","PluralRules","RelativeTimeFormat","Segmenter"],De=(()=>{let e={Date,URL,URLSearchParams},n=Intl;for(let r of Fe)if(typeof n[r]==="function")e[`Intl_${r}`]=n[r];return Object.freeze(Object.assign(Object.create(null),e))})(),$t=/^new(\s+)(Date|URLSearchParams|URL|Intl\s*\.\s*([A-Z_a-z]\w*))\s*\(/,Re=/(?<![\w$])new(?![\w$])/g,$e=`only new Date(), new URL(), new URLSearchParams() and new Intl.{${Fe.join(",")}}() are allowed`;function Ct(e){let{text:n,map:r}=Me(e),i=[];Re.lastIndex=0;let s;while((s=Re.exec(n))!==null){let a=s.index;if(/(?<!\.)\.\s*$/.test(n.slice(0,a)))continue;let c=$t.exec(n.slice(a)),p=c?.[3],g=!c?null:p?`Intl_${p}`:c[2];if(!c||!g||!(g in De))throw new S(`matched /${U.source}/; ${$e}`,e);let h=a+c[0].length,m=r[a],y=r[h-1]+1;if(e.slice(m,y)!==n.slice(a,h))throw new S(`matched /${U.source}/; ${$e}`,e);let E=m+3+c[1].length;i.push({start:E,end:E+c[2].length,key:g})}let o=e;for(let a=i.length-1;a>=0;a--){let c=i[a];o=`${o.slice(0,c.start)}${V}.${c.key}${o.slice(c.end)}`}return{source:o,usesSafeConstructors:i.length>0}}class S extends Error{rule;expression;constructor(e,n,r){super(r??`Potentially unsafe expression (${e}): ${n}`);this.name="UnsafeExpressionError",this.rule=e,this.expression=n}}function qs(e){try{return ge(e),null}catch(n){return n instanceof S?n.rule:n instanceof Error?n.message:String(n)}}function ze(e,n){let r=/[$A-Z_a-z][$\w]*/g,i;while((i=r.exec(e))!==null){let s=i[0],o=e[i.index-1];if(le.has(s))throw new S(`matched /\\b${s}\\b/; identifier ${s}`,n);if(o==="."&&ue.has(s))throw new S(`matched /.${s}/; property ${s}`,n)}}function je(e,n=!0){let r=/(?:[$\w)\].]|\?\.)\s*\[([^\]]*)\]/g,i=new Set,s;while((s=r.exec(e))!==null){let o=s.index+s[0].indexOf("["),a=e.slice(0,o);if(/(?:^|[^$\w])(?:let|const|var)\s*$/.test(a))continue;let c=s[1].trim(),p=/^'(?:[^'\\]|\\.)*'$/.test(c),g=/^"(?:[^"\\]|\\.)*"$/.test(c);if(/^\d+$/.test(c))continue;if(p||g){let m=c.slice(1,-1);if(ue.has(m))throw new S(`bracket key ${m}`,e);if(!Pe.allowBracketNotation)throw new S("bracket notation with a string key; enable with configureSafeEvaluator({ allowBracketNotation: true })",e,`Bracket notation with strings not allowed: ${e}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);continue}if(n&&/^[$A-Z_a-z][$\w]*$/.test(c)){i.add(c);continue}throw new S("dynamic bracket notation is not allowed",e)}return[...i]}function ge(e){let n=e.trim(),r=Ne(n);ze(r,n);let i=je(n);for(let s of oe){if(s===U)continue;if(s.test(r))throw new S(`matched /${s.source}/`,n)}return{...Ct(n),dynamicKeys:i}}function _i(e){return ge(e),e.trim()}var Ks=Symbol("stx.sanitizeCache"),At=4000,B=new Map;function _t(e){let n=B.get(e);if(n===void 0){if(n=oe.some((r)=>r.test(e)),B.size>=At)B.clear();B.set(e,n)}return n}function W(e){let n={},r=e[Ks];n.Math=Math,n.JSON=JSON,n.Date=Date,n.String=String,n.Number=Number,n.Boolean=Boolean,n.Array=Array,n.Object=ie,n.parseInt=Number.parseInt,n.parseFloat=Number.parseFloat,n.isNaN=Number.isNaN,n.isFinite=Number.isFinite,n.encodeURIComponent=encodeURIComponent,n.decodeURIComponent=decodeURIComponent;for(let[i,s]of Object.entries(e)){if(i.startsWith("__")||_t(i))continue;if(s&&typeof s==="object"&&!Array.isArray(s)){let o=r?.get(s);if(o===void 0)o=se(s),r?.set(s,o);n[i]=o}else n[i]=s}return n}function se(e,n=0){if(n>=Pe.maxSanitizeDepth)return"[Object too deep]";if(e===null||typeof e!=="object")return e;if(Array.isArray(e))return e.map((i)=>se(i,n+1));if(e instanceof Date||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof Error)return e;let r={};for(let[i,s]of Object.entries(e)){if(i.startsWith("__")||i==="constructor"||i==="prototype")continue;if(s&&typeof s==="object")r[i]=se(s,n+1);else r[i]=s}return r}function u(e,n){try{let r=W(n),i=Object.keys(r),s=Object.values(r);return d(e,i)(...s)}catch{return}}function f(e){try{return _i(e),!0}catch{return!1}}function sl(e,n){try{let r=W(n),i=Object.keys(r),s=Object.values(r),o=!1,c=d(e,i,()=>{o=!0})(...s);return!o&&Boolean(c)}catch{return!1}}function P(e,n){try{let r=u(e,n);if(r&&typeof r==="object"&&!Array.isArray(r))return r;return{}}catch{return{}}}var Be=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"]),It=2000,H=new Map;function Ae(e,n){let r=`${e.join(",")}\x00${n}`,i=H.get(r);if(i)return i;let s=Function(...e,n);if(H.size>=It)H.clear();return H.set(r,s),s}function ot(e){return e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:)/g,"$1$2").match(/\b[a-zA-Z_$][\w$]*\b/g)||[]}var Ot=/^[A-Za-z_$][\w$]*$/;function Bt(e){return Ot.test(e)&&!Be.has(e)}var Ie=new T(2000,{maxBytes:2097152,sizeOf:(e)=>e.sourceBytes});function d(e,n,r){let i=JSON.stringify([e,n]),s=Ie.get(i);if(!s)s=Pt(e,[...n]),s.sourceBytes+=i.length*2,Ie.set(i,s);return Lt(Mt(s.buildFunc,s.filteredKeys,s.contextKeys,s.validEntries,s.validIndices,r),s.contextKeys,s.dynamicKeys)}function Pt(e,n){let{source:r,usesSafeConstructors:i,dynamicKeys:s}=ge(e),o=[];for(let m=0;m<n.length;m++){if(!Bt(n[m]))continue;if(n[m]===V||n[m]==="Object"||le.has(n[m]))continue;o.push({key:n[m],index:m})}o.sort((m,y)=>m.key<y.key?-1:1);let a=o.map((m)=>m.key),c=o.map((m)=>m.index),p=`
|
|
40
40
|
'use strict';
|
|
41
41
|
try {
|
|
42
42
|
return ${r};
|
|
@@ -47,26 +47,26 @@ catch (e) {
|
|
|
47
47
|
}
|
|
48
48
|
throw e;
|
|
49
49
|
}
|
|
50
|
-
`,g=i?(m)=>{let y
|
|
51
|
-
`:a==="t"?"\t":a;continue}if(o===r)return null;if(r==="`"&&o==="$"&&n[s+1]==="{")return null;i+=o}return i}var
|
|
52
|
-
${i}${e.slice(r)}`}var
|
|
53
|
-
${o[0]}${e.slice(r,o.index)}${e.slice(a,s)}${e.slice(s)}`}function
|
|
54
|
-
${n[0]}${i.slice(s)}`}var
|
|
55
|
-
`}function
|
|
56
|
-
`),
|
|
57
|
-
`),
|
|
58
|
-
`),
|
|
59
|
-
<html${
|
|
50
|
+
`,g=i?(m)=>{let y=Ae([V,"Object",...re,...a,...m],p);return(...E)=>y(De,ie,...ke,...E)}:(m)=>{let y=Ae(["Object",...re,...a,...m],p);return(...E)=>y(ie,...ke,...E)},h=g([]);return{sourceBytes:e.length*2+n.reduce((m,y)=>m+y.length*2,0),contextKeys:n,filteredKeys:a,validEntries:o,validIndices:c,dynamicKeys:s,buildFunc:(m)=>m.length===0?h:g(m)}}function Lt(e,n,r){if(r.length===0)return e;let i=r.map((s)=>n.indexOf(s));return(...s)=>{for(let o of i){if(o<0)continue;let a=s[o];if(typeof a==="string"&&ue.has(a))return}return e(...s)}}function Mt(e,n,r,i,s,o){let a=e([]),c=i.every((g,h)=>g.index===h);if(n.length===r.length&&c)return Oe(a,n,e,void 0,o);return Oe((...g)=>{let h=Array(s.length);for(let m=0;m<s.length;m++)h[m]=g[s[m]];return a(...h)},n,e,(g)=>{a=e(g)},o)}function Oe(e,n,r,i,s){let a=/^(\w+) is not defined$/,c=e,p=[],g=new Set(n);return(...h)=>{for(let m=0;m<=8;m++)try{return c(...h)}catch(y){let E=y instanceof Error?y.message:"",v=a.exec(E);if(!(y instanceof ReferenceError)||!v)return;let w=v[1];if(g.has(w)||Be.has(w)||le.has(w))return;if(s?.(w),g.add(w),p.push(w),i)i(p);else c=r(p)}return}}function Xs(e){let n=e.trim();try{let r=Ne(n);if(/\b(?:eval|function|import|require|process|globalthis|window|document|fetch|bun|deno|buffer|console|reflect|proxy|prototype|constructor|this)\b/i.test(r))return!1;ze(r,n),je(n);for(let i of oe)if(i.test(r))return!1}catch{return!1}return!0}function Ei(e,n){let r=[];n.lastIndex=0;let i;while((i=n.exec(e))!==null){let s=i.index,o=s+i[0].length-1,a=x(e,"(",")",o);if(a===-1){r.push({start:s,end:-1,args:"",call:e.slice(s,Math.min(e.length,s+80))}),n.lastIndex=o+1;continue}r.push({start:s,end:a+1,args:e.slice(o+1,a),call:e.slice(s,a+1)}),n.lastIndex=a+1}return r}function Ft(e,n,r,i){let s="",o=0;for(let a of Ei(e,n)){if(s+=e.slice(o,a.start),a.end===-1){s+=i(a.call),o=a.start;continue}s+=r(a.args,a.call),o=a.end}return s+e.slice(o)}function zt(e){let n=[],r=0,i=null,s="";for(let o=0;o<e.length;o++){let a=e[o];if(i){if(s+=a,a==="\\"&&o+1<e.length){s+=e[++o];continue}if(a===i)i=null;continue}if(a==="'"||a==='"'||a==="`")i=a;else if(a==="("||a==="["||a==="{")r++;else if(a===")"||a==="]"||a==="}")r--;else if(a===","&&r===0){n.push(s.trim()),s="";continue}s+=a}if(s.trim())n.push(s.trim());return n}function de(e){let n=e.trim(),r=n[0];if(r!=="'"&&r!=='"'&&r!=="`"||n.length<2||n.at(-1)!==r)return null;let i="";for(let s=1;s<n.length-1;s++){let o=n[s];if(o==="\\"&&s+1<n.length-1){let a=n[++s];i+=a==="n"?`
|
|
51
|
+
`:a==="t"?"\t":a;continue}if(o===r)return null;if(r==="`"&&o==="$"&&n[s+1]==="{")return null;i+=o}return i}var Nt=new Set(["true","false","null","undefined","typeof","void","new","in","of","instanceof","this","delete","await","async","function","return","NaN","Infinity"]);function Ht(e,n){let r=e.trim();if(!r)return{ok:!1,message:"the argument is empty",code:t.INVALID_DIRECTIVE_SYNTAX};let i=qs(r);if(i)return{ok:!1,message:`the expression is not allowed (${i})`,code:t.UNSAFE_EXPRESSION};let s=W(n),o;try{o=d(r,Object.keys(s))(...Object.values(s))}catch(c){return{ok:!1,message:`the expression could not be evaluated: ${c instanceof Error?c.message:String(c)}`,code:t.EVALUATION_ERROR}}if(o!==void 0&&o!==null)return{ok:!0,value:o};let a=[...new Set(ot(r))].filter((c)=>!Nt.has(c)&&!(c in s)&&!(c in globalThis));if(a.length>0)return{ok:!1,message:`${a.map((p)=>`"${p}"`).join(", ")} ${a.length===1?"is":"are"} not defined here. Values a directive reads must come from <script server> or the render context; a plain <script> runs in the browser. To pass literal text, quote it.`,code:t.UNDEFINED_VARIABLE};if(o===void 0&&(r.startsWith("{")||r.startsWith("[")))return{ok:!1,message:"the expression threw while it was evaluated",code:t.EVALUATION_ERROR};return{ok:!0,value:o}}function Ve(e){if(e===null)return"null";if(Array.isArray(e))return"an array";if(typeof e==="object")return"an object";if(typeof e==="string")return`a string ("${e.length>40?`${e.slice(0,40)}...`:e}")`;return`${/^[aeiou]/.test(typeof e)?"an":"a"} ${typeof e}`}function it(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function We(e){if(!e)return"";return He.isAbsolute(e)?He.relative(process.cwd(),e)||e:e}function pe(e){let n=e.replace(/\s+/g," ").trim();return n.length>80?`${n.slice(0,77)}...`:n}function D(e,n,r,i,s=t.EVALUATION_ERROR){let o=i?` in ${We(i)}`:"";return console.warn(`[stx] ${pe(n)}${o}: ${r}`),l(e,`${pe(n)}: ${r}`,s)}function Gs(e,n,r){let i=r?` in ${We(r)}`:"";console.warn(`[stx] ${pe(e)}${i}: ${n}`)}function Ti(){return{afterOpen:[],beforeClose:[]}}function Dt(e){return e.afterOpen.length>0||e.beforeClose.length>0}function il(e,n){if(!Dt(n))return e;let r=n.afterOpen.join(""),i=n.beforeClose.join(""),s=e.lastIndexOf("</head>"),o=r?Tr(e):null,a=i&&s!==-1?s:null;if(o===null&&a===null)return e;if(o!==null&&a!==null)return`${e.slice(0,o)}${r}${e.slice(o,a)}${i}${e.slice(a)}`;if(o!==null)return`${e.slice(0,o)}${r}${e.slice(o)}`;return`${e.slice(0,a)}${i}${e.slice(a)}`}var Ke=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy;function Tr(e){let n=/<head\b[^>]*>/i.exec(e);if(!n)return null;let r=n.index+n[0].length;Ke.lastIndex=r;let i=Ke.exec(e);return i?r+i[0].length:r}var me="data-stx-color-mode-boot",Xe="__STX_COLOR_MODE__",Ut=new Set(["light","dark","auto","system"]),Vt=new Set(["auto","system"]),Wt=/^[a-z][\w:-]*$/i,Kt=/^[\w-]+$/;function Xt(e){let n=e.storageKey??"stx-color-mode",r=e.initialMode??"auto",i=e.darkClass===void 0?"dark":e.darkClass,s=e.attribute??null,o=e.autoValue??null,a=e.respectExisting===!0;if(typeof n!=="string"||n.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!Ut.has(r))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(r)}`);if(i!==null&&(typeof i!=="string"||!Kt.test(i)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(i)}`);if(s!==null&&(typeof s!=="string"||!Wt.test(s)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(s)}`);if(o!==null&&!Vt.has(o))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(o)}`);if(i===null&&s===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");if(a&&s===null)throw Error("colorMode.respectExisting needs an attribute to read \u2014 the dark class alone cannot say whether a mode was chosen");return{storageKey:n,initialMode:r==="system"?"auto":r,darkClass:i,attribute:s,autoValue:o,respectExisting:a}}function qt(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function he(e={}){let n=Xt(e),r=qt(n),i=`(function(){"use strict";var o=window.${Xe};if(o&&typeof o.sync==="function"){o.sync();return}var c=${r};var r=document.documentElement;function read(){var p=c.initialMode,a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}return{p:p,a:a}}function sys(){try{return matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){return"light"}}function stamp(m){if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}}var s=read();var f=null;if(c.respectExisting&&c.attribute){var x=r.getAttribute(c.attribute);if(x==="light"||x==="dark")f=x}var m=f||(s.p==="auto"?sys():s.p);var p=s.p;stamp(m);var g=null;function sync(){var t=read(),n=f||(t.p==="auto"?sys():t.p);var moved=n!==m,chose=t.p!==p;if(moved){r.style.setProperty("transition","none","important");stamp(n);void r.offsetHeight;r.style.removeProperty("transition")}else stamp(n);m=n;p=t.p;if(g){g.mode=n;g.preference=t.p;if(t.a)g.autoValue=t.a}if(moved||chose){try{window.dispatchEvent(new CustomEvent("stx:color-mode",{detail:{mode:n,preference:t.p}}))}catch(e){}}}try{g=window.${Xe}={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:s.a||"auto",respectExisting:c.respectExisting,forced:f,preference:p,mode:m,watching:true,sync:sync}}catch(e){}try{var q=matchMedia("(prefers-color-scheme: dark)");if(q.addEventListener)q.addEventListener("change",sync);else if(q.addListener)q.addListener(sync)}catch(e){}try{addEventListener("pageshow",sync);addEventListener("storage",function(e){if(e.key===null||e.key===c.storageKey)sync()});document.addEventListener("visibilitychange",function(){if(document.visibilityState==="visible")sync()})}catch(e){}}());`;return`<script ${me}>${i}</script>`}function $r(e,n={}){if(e.includes(me))return e;let r=fe(e);if(r===null)return e;let i=he(n);return`${e.slice(0,r)}
|
|
52
|
+
${i}${e.slice(r)}`}var fe=Tr,Gt=new RegExp(`<script\\b[^>]*\\b${me}\\b[^>]*>[\\s\\S]*?<\\/script>`,"i"),qe=/<meta\b[^>]*\bcharset\b[^>]*>/gi,Ge=/<\/head>/gi;function Yt(e){let n=/<head\b[^>]*>/i.exec(e);if(!n)return e;let r=n.index+n[0].length;Ge.lastIndex=r;let i=Ge.exec(e),s=i?i.index:e.length;qe.lastIndex=r;let o=qe.exec(e);if(!o||o.index>=s)return e;if(e.slice(r,o.index).trim()==="")return e;let a=o.index+o[0].length;return`${e.slice(0,r)}
|
|
53
|
+
${o[0]}${e.slice(r,o.index)}${e.slice(a,s)}${e.slice(s)}`}function al(e){return Jt(Yt(e))}function Jt(e){let n=Gt.exec(e);if(!n)return e;let r=fe(e);if(r===null)return e;if(n.index<=r||e.slice(r,n.index).trim()==="")return e;let i=e.slice(0,n.index)+e.slice(n.index+n[0].length),s=fe(i);if(s===null)return e;return`${i.slice(0,s)}
|
|
54
|
+
${n[0]}${i.slice(s)}`}var Zt="[data-stx-component-wrapper]:not([stx-hydrate]){display:contents}",Ze=`<style data-stx-cloak>[x-cloak]{display:none !important}${Zt}</style>`,q="data-stx-html-attrs",G="data-stx-html-class",Qe=/^[A-Za-z_:][\w:.-]*$/;function k(e){return String(e).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Qt(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function at(e){if(e.name)return`name="${e.name}"`;if(e.property)return`property="${e.property}"`;if(e.charset!=null)return"charset=";if(e["http-equiv"])return`http-equiv="${e["http-equiv"]}"`;return""}function en(e){let n=/^\s*<meta\b([^>]*)>/i.exec(e);if(!n)return null;let r={};for(let i of n[1].matchAll(/([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g))r[i[1].toLowerCase()]=i[2]??i[3]??i[4]??"";return r}function I(e,n){return Object.entries(e).filter(([r])=>!n?.(r)).map(([r,i])=>`${r}="${k(String(i))}"`).join(" ")}function Y(e){let n=String(e.content),r=typeof e.type==="string"?e.type.trim().toLowerCase():"";return/json$|^importmap$/.test(r)?n.replace(/<\//g,"<\\/"):n}function et(e){let n=I(e,(r)=>r==="content");return`<script${n?` ${n}`:""}>${Y(e)}</script>`}function tn(e={},n="en"){let r=[],i=[],s="",o=n;for(let[c,p]of Object.entries(e||{})){if(p==null)continue;let g=c.trim();if(!Qe.test(g))continue;let h=g.toLowerCase();if(h==="lang"){o=String(p);continue}if(h==="class"){s=String(p).trim();continue}r.push(` ${g}="${k(String(p))}"`),i.push(g)}let a=` lang="${k(o)}"`;if(s)a+=` class="${k(s)}"`;if(a+=r.join(""),s)a+=` ${G}="${k(s)}"`;if(i.length)a+=` ${q}="${k(i.join(" "))}"`;return a}function cl(e={},n={}){let r={...e,...n};if(e.class&&n.class){let i=e.class.split(/\s+/).filter(Boolean);for(let s of n.class.split(/\s+/).filter(Boolean))if(!i.includes(s))i.push(s);r.class=i.join(" ")}return r}function Rr(e,n={}){if(!n||Object.keys(n).length===0)return e;let r=e.match(/<html\b([^>]*)>/i);if(!r)return e;let i={},s=[],o=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,a;while((a=o.exec(r[1]))!==null){let h=a[1];if(!(h in i))s.push(h);i[h]=a[2]??a[3]??a[4]??""}let c=[],p=[];for(let[h,m]of Object.entries(n)){if(m==null)continue;let y=h.trim();if(!Qe.test(y))continue;let E=y.toLowerCase();if(E==="class"){let v=(i.class||"").split(/\s+/).filter(Boolean);for(let w of String(m).split(/\s+/).filter(Boolean))if(!v.includes(w))v.push(w),c.push(w);if(!("class"in i))s.push("class");i.class=v.join(" ");continue}if(!(y in i))s.push(y);if(i[y]=String(m),E!=="lang")p.push(y)}if(c.length){if(!(G in i))s.push(G);i[G]=c.join(" ")}if(p.length){if(!(q in i))s.push(q);i[q]=p.join(" ")}let g=s.map((h)=>` ${h}="${k(i[h])}"`).join("");return e.replace(r[0],()=>`<html${g}>`)}function ll(e){if(e.includes("data-stx-cloak"))return null;if(e.lastIndexOf("</head>")===-1)return null;return`${Ze}
|
|
55
|
+
`}function nn(e){let n=[],r=0;while(r<e.length){let o=e.slice(r),a=o.match(/^\s+/);if(a){r+=a[0].length;continue}if(o.startsWith("<!--")){let m=e.indexOf("-->",r);if(m===-1)break;r=m+3;continue}let c=o.match(/^<script\b[^>]*>/i);if(c){let m=e.toLowerCase().indexOf("</script>",r+c[0].length);if(m===-1)break;r=m+9;continue}let p=o.match(/^<link\b[^>]*>/i);if(p){n.push(p[0]),r+=p[0].length;continue}let g=o.match(/^<meta\b[^>]*>/i);if(g){n.push(g[0]),r+=g[0].length;continue}let h=o.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(h){n.push(h[0]),r+=h[0].length;continue}break}if(n.length===0)return{body:e,hoisted:n};let i="",s=0;while(s<e.length&&s<r){let o=e.slice(s),a=o.match(/^<link\b[^>]*>/i);if(a&&n.includes(a[0])){s+=a[0].length;continue}let c=o.match(/^<meta\b[^>]*>/i);if(c&&n.includes(c[0])){s+=c[0].length;continue}let p=o.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(p&&n.includes(p[0])){s+=p[0].length;continue}i+=e[s],s++}return i+=e.slice(r),{body:i,hoisted:n}}function rn(e,n={},r={}){let{title:i="stx App",lang:s="en",meta:o=[],link:a=[],script:c=[],headRaw:p="",htmlAttrs:g={},bodyClass:h="",bodyAttrs:m={}}=n,y=r.title||i,E=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],v=new Set(o.map(at).filter(Boolean)),{body:w,hoisted:R}=nn(e),_=new Set(R.flatMap((b)=>{let L=en(b);return L?[at(L)].filter(Boolean):[]})),ct=[...E.filter((b)=>!v.has(at(b))),...o].filter((b)=>!_.has(at(b))).map((b)=>` <meta ${I(b)}>`).join(`
|
|
56
|
+
`),lt=a.map((b)=>` <link ${I(b)}>`).join(`
|
|
57
|
+
`),ut=c.map((b)=>{if(b.src)return` <script ${I(b,(L)=>L==="content")}></script>`;if(b.content)return` ${et(b)}`;return""}).filter(Boolean).join(`
|
|
58
|
+
`),gt=tn(g,s),pt=Object.entries(m).map(([b,L])=>` ${b}="${k(String(L))}"`).join(""),dt=h?` class="${k(h)}"`:"",ft=[ct,r.colorMode?` ${he(r.colorMode)}`:"",` <title>${r.titleIsHtml?y:Qt(y)}</title>`,` ${Ze}`,lt,ut,p?` ${p}`:"",...(r.styles||[]).map((b)=>` ${b}`),...R.map((b)=>` ${b}`),...(r.headScripts||[]).map((b)=>` ${b}`),r.headStack||""].filter(Boolean),mt=[w,...(r.bodyScripts||[]).map((b)=>b),r.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
|
|
59
|
+
<html${gt}>
|
|
60
60
|
<head>
|
|
61
|
-
${
|
|
61
|
+
${ft.join(`
|
|
62
62
|
`)}
|
|
63
63
|
</head>
|
|
64
|
-
<body${
|
|
65
|
-
${
|
|
64
|
+
<body${dt}${pt}>
|
|
65
|
+
${mt.join(`
|
|
66
66
|
`)}
|
|
67
67
|
</body>
|
|
68
|
-
</html>`}var
|
|
68
|
+
</html>`}var ye=/\s+/y,be=/<(script|style)\b[^>]*>/iy,sn=/<\/script>/gi,on=/<\/style>/gi,Ye=/<!DOCTYPE\b/iy,Je=/<html[\s>]/iy;function _n(e){let n=0;while(n<e.length){if(ye.lastIndex=n,ye.exec(e)){n=ye.lastIndex;continue}if(e.startsWith("<!--",n)){let s=e.indexOf("-->",n);if(s===-1)return!1;n=s+3;continue}be.lastIndex=n;let i=be.exec(e);if(i){let s=i[1].toLowerCase()==="script"?sn:on;s.lastIndex=be.lastIndex;let o=s.exec(e);if(o===null)return!1;n=o.index+o[0].length;continue}if(Ye.lastIndex=n,Ye.test(e))return!0;return Je.lastIndex=n,Je.test(e)}return!1}function $i(e){return _n(e)}function ul(e,n={}){let r=e.lastIndexOf("</head>");if(r===-1)return e;let{meta:i=[],link:s=[],script:o=[],headRaw:a=""}=n,c=e.slice(0,r),p=[];for(let g of i){let h=at(g);if(h&&c.includes(h))continue;p.push(` <meta ${I(g)}>`)}for(let g of s){if(g.href&&c.includes(`href="${g.href}"`))continue;p.push(` <link ${I(g)}>`)}for(let g of o)if(g.src){if(c.includes(`src="${g.src}"`))continue;p.push(` <script ${I(g,(h)=>h==="content")}></script>`)}else if(g.content){if(c.includes(Y(g)))continue;p.push(` ${et(g)}`)}if(a&&!c.includes(a))p.push(` ${a}`);if(p.length===0)return e;return`${e.slice(0,r)}${p.join(`
|
|
69
69
|
`)}
|
|
70
|
-
${e.slice(r)}`}function Ar(e,n={},r={},i){if(i
|
|
71
|
-
`)}function
|
|
72
|
-
`,"")),headContent:n.trim()}}function
|
|
70
|
+
${e.slice(r)}`}function Ar(e,n={},r={},i){if(i??$i(e))return e;return rn(e,n,r)}var an=["og:","article:","book:","profile:","fb:","music:","video:"],cn=/^[a-z][\w-]*(?::[\w:-]+)?$/i;function Pr(e,n){if(e.length<1)return{kind:"error",message:"meta directive requires at least the meta name",code:t.INVALID_DIRECTIVE_SYNTAX};if(e.length>2)return{kind:"error",message:`@meta takes a name and a value, got ${e.length} arguments`,code:t.INVALID_DIRECTIVE_SYNTAX};let r=ln(e[0],n);if(typeof r!=="string")return r;let i;if(e.length===2){let o=un(e[1],n);if(typeof o!=="string")return o;i=o}else{let o=r.includes(":")?r.slice(r.indexOf(":")+1):r,a=n.openGraph,c=n[o]??(it(a)?a[o]:void 0);i=c===void 0||c===null||typeof c==="object"?"":String(c)}if(!i)return{kind:"empty"};return{kind:"tag",tag:an.some((o)=>r.startsWith(o))?{property:r,content:i}:{name:r,content:i}}}function ln(e,n){let r=de(e);if(r!==null)return r.trim()?r:{kind:"error",message:"the meta name is empty",code:t.INVALID_DIRECTIVE_SYNTAX};if(cn.test(e.trim()))return e.trim();let i=Ht(e,n);if(!i.ok)return{kind:"error",message:`meta name: ${i.message}`,code:i.code};if(typeof i.value!=="string"||!i.value.trim())return{kind:"error",message:`the meta name must be a non-empty string, got ${Ve(i.value)}`,code:t.TYPE_ERROR};return i.value}function un(e,n){let r=de(e);if(r!==null)return r;let i=Ht(e,n);if(!i.ok)return{kind:"error",message:i.message,code:i.code};let s=i.value;if(s===void 0||s===null||s===!1)return"";if(Array.isArray(s))return s.filter((o)=>o!==void 0&&o!==null&&o!=="").map(String).join(", ");if(typeof s==="object"&&!(s instanceof Date))return{kind:"error",message:`the content must be text, got ${Ve(s)}`,code:t.TYPE_ERROR};return String(s)}var Ir=["title","lang","meta","link","script","headRaw","htmlAttrs","bodyClass","bodyAttrs"],Js=["title","titleTemplate","base","meta","link","script","style","htmlAttrs","bodyAttrs"],rt={links:"link",metas:"meta",scripts:"script",styles:"style"},tt=new Set,nt=new WeakMap;function Ee(e){if(tt.has(e))return;tt.add(e),console.warn(e)}function gn(e,n){let r=Array.from({length:n.length+1},(i,s)=>s);for(let i=1;i<=e.length;i++){let s=r[0];r[0]=i;for(let o=1;o<=n.length;o++){let a=r[o];r[o]=Math.min(r[o]+1,r[o-1]+1,s+(e[i-1]===n[o-1]?0:1)),s=a}}return r[n.length]}function pn(e,n){let r=e.toLowerCase(),i=n.find((p)=>p.toLowerCase()===r);if(i)return i;let s=rt[r];if(s&&n.includes(s))return s;let o,a=1/0;for(let p of n){let g=gn(r,p.toLowerCase());if(g<a)o=p,a=g}let c=Math.min(e.length,o?.length??0)<=4?1:2;return a<=c?o:void 0}function Ce(e,n){if(!e||typeof e!=="object"||Array.isArray(e))return e||{};let r=nt.get(e);if(r)return r;let{known:i,source:s}=n,o=e;for(let a of Object.keys(e)){if(i.includes(a))continue;let c=rt[a];if(c&&i.includes(c)&&Array.isArray(e[a])){if(o===e)o={...e};let g=Array.isArray(o[c])?o[c]:[];o[c]=[...g,...e[a]],delete o[a],Ee(`[stx] ${s}.${a} is not a head key; reading it as ${s}.${c}. Rename it to \`${c}\`.`);continue}if(/^styles?$/.test(a)&&!i.includes("style")){Ee(`[stx] ${s}.${a} is not a head key and is ignored. Use \`link\` with rel: 'stylesheet', or \`headRaw\` for an inline <style>.`);continue}let p=pn(a,i);Ee(p?`[stx] ${s}.${a} is not a head key and is ignored. Did you mean \`${p}\`?`:`[stx] ${s}.${a} is not a head key and is ignored. Known keys: ${i.join(", ")}.`)}return nt.set(e,o),o}var C={},dn=[],J={};function Ri(){return C}function sy(){return J}function oy(){C={},dn.length=0,J={}}function dl(e){C=Ue(C,Ce(e,{known:Js,source:"useHead()"}))}function st(e,n,r){let i=[...e||[]];for(let s of n||[]){let o=r(s),a=o?i.findIndex((c)=>r(c)===o):-1;if(a<0)i.push(s);else i[a]=s}return i}function Ue(e,n){return{title:n.title??e.title,titleTemplate:n.titleTemplate??e.titleTemplate,base:n.base??e.base,meta:st(e.meta,n.meta,(r)=>r.name||r.property||(r.httpEquiv?`http:${r.httpEquiv}`:void 0)),link:st(e.link,n.link,(r)=>["icon","apple-touch-icon","canonical"].includes(r.rel||"")?[r.rel,r.type,r.media,r.sizes].join(":"):void 0),script:[...e.script||[],...n.script||[]],style:[...e.style||[],...n.style||[]],htmlAttrs:{...e.htmlAttrs,...n.htmlAttrs},bodyAttrs:{...e.bodyAttrs,...n.bodyAttrs}}}function kg(e){dl(Ys(e))}function Ys(e){let n=[];if(e.description)n.push({name:"description",content:e.description});if(e.keywords){let p=Array.isArray(e.keywords)?e.keywords.join(", "):e.keywords;n.push({name:"keywords",content:p})}if(e.author)n.push({name:"author",content:e.author});if(e.robots)n.push({name:"robots",content:e.robots});let r=e.ogTitle??e.title,i=e.ogDescription??e.description;if(r)n.push({property:"og:title",content:r});if(i)n.push({property:"og:description",content:i});if(e.ogImage){if(n.push({property:"og:image",content:e.ogImage}),e.ogImageType)n.push({property:"og:image:type",content:e.ogImageType});if(e.ogImageWidth)n.push({property:"og:image:width",content:String(e.ogImageWidth)});if(e.ogImageHeight)n.push({property:"og:image:height",content:String(e.ogImageHeight)});if(e.ogImageAlt)n.push({property:"og:image:alt",content:e.ogImageAlt})}if(e.ogUrl)n.push({property:"og:url",content:e.ogUrl});if(e.ogType)n.push({property:"og:type",content:e.ogType});if(e.ogSiteName)n.push({property:"og:site_name",content:e.ogSiteName});if(e.ogLocale)n.push({property:"og:locale",content:e.ogLocale});if(e.profileFirstName)n.push({property:"profile:first_name",content:e.profileFirstName});if(e.profileLastName)n.push({property:"profile:last_name",content:e.profileLastName});if(e.profileUsername)n.push({property:"profile:username",content:e.profileUsername});let s=e.twitterTitle??e.title,o=e.twitterDescription??e.description,a=e.twitterImage??e.ogImage;if(e.twitterCard)n.push({name:"twitter:card",content:e.twitterCard});if(s)n.push({name:"twitter:title",content:s});if(o)n.push({name:"twitter:description",content:o});if(a){n.push({name:"twitter:image",content:a});let p=e.twitterImageAlt??(e.twitterImage?void 0:e.ogImageAlt);if(p)n.push({name:"twitter:image:alt",content:p})}if(e.twitterSite)n.push({name:"twitter:site",content:e.twitterSite});if(e.twitterCreator)n.push({name:"twitter:creator",content:e.twitterCreator});if(e.articleAuthor)n.push({property:"article:author",content:e.articleAuthor});if(e.articlePublishedTime)n.push({property:"article:published_time",content:e.articlePublishedTime});if(e.articleModifiedTime)n.push({property:"article:modified_time",content:e.articleModifiedTime});if(e.articleSection)n.push({property:"article:section",content:e.articleSection});if(e.articleTags)for(let p of e.articleTags)n.push({property:"article:tag",content:p});let c=[];if(e.canonical)c.push({rel:"canonical",href:e.canonical});return{title:e.title,titleTemplate:e.titleTemplate,meta:n,link:c}}function iy(e){if(J={...J,...e},e.title||e.description)kg({title:e.title,description:e.description})}function ay(e){let n=typeof e==="function"?e():e;dl({title:n})}function cy(e=C){let n=[];if(e.title){let r=e.title;if(e.titleTemplate)r=typeof e.titleTemplate==="function"?e.titleTemplate(r):e.titleTemplate.replace("%s",r);n.push(`<title>${O(r)}</title>`)}if(e.base){let r=Object.entries(e.base).map(([i,s])=>`${i}="${O(s)}"`).join(" ");n.push(`<base ${r}>`)}for(let r of e.meta||[]){let i=Object.entries(r).filter(([s,o])=>o!==void 0).map(([s,o])=>`${s==="httpEquiv"?"http-equiv":s}="${O(String(o))}"`).join(" ");n.push(`<meta ${i}>`)}for(let r of e.link||[]){let i=Object.entries(r).filter(([s,o])=>o!==void 0).map(([s,o])=>`${s}="${O(String(o))}"`).join(" ");n.push(`<link ${i}>`)}for(let r of e.script||[]){let{content:i,...s}=r,o=Object.entries(s).filter(([a,c])=>c!==void 0).map(([a,c])=>{if(typeof c==="boolean")return c?a:"";return`${a}="${O(String(c))}"`}).filter(Boolean).join(" ");if(i)n.push(`<script ${o}>${Y(r)}</script>`);else n.push(`<script ${o}></script>`)}for(let r of e.style||[]){let i=r.type?` type="${r.type}"`:"";n.push(`<style${i}>${r.content}</style>`)}return n.join(`
|
|
71
|
+
`)}function ly(e=C){if(!e.htmlAttrs)return"";return Object.entries(e.htmlAttrs).map(([n,r])=>`${n}="${O(r)}"`).join(" ")}function uy(e=C){if(!e.bodyAttrs)return"";return Object.entries(e.bodyAttrs).map(([n,r])=>`${n}="${O(r)}"`).join(" ")}function O(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function dy(e=C){if(typeof document>"u")return;if(e.title){let n=e.title;if(e.titleTemplate)n=typeof e.titleTemplate==="function"?e.titleTemplate(n):e.titleTemplate.replace("%s",n);document.title=n}for(let n of e.meta||[]){let r=n.name?`meta[name="${n.name}"]`:n.property?`meta[property="${n.property}"]`:null;if(r){let i=document.querySelector(r);if(!i){if(i=document.createElement("meta"),n.name)i.setAttribute("name",n.name);if(n.property)i.setAttribute("property",n.property);document.head.appendChild(i)}i.setAttribute("content",n.content)}}for(let n of e.link||[]){let r=`link[rel="${n.rel}"]${n.href?`[href="${n.href}"]`:""}`,i=document.querySelector(r);if(!i)i=document.createElement("link"),document.head.appendChild(i);for(let[s,o]of Object.entries(n))if(o!==void 0)i.setAttribute(s,String(o))}if(e.htmlAttrs)for(let[n,r]of Object.entries(e.htmlAttrs))if(n==="class")for(let i of String(r).split(/\s+/).filter(Boolean))document.documentElement.classList.add(i);else document.documentElement.setAttribute(n,r);if(e.bodyAttrs)for(let[n,r]of Object.entries(e.bodyAttrs))document.body.setAttribute(n,r)}function py(e){let n="";return{content:e.replace(/@head\s*([\s\S]*?)@endhead/g,(i,s)=>(n+=s.trim()+`
|
|
72
|
+
`,"")),headContent:n.trim()}}function fy(e,n){return e.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(r,i,s,o)=>{let a=i?s:n[(o||"").trim()]??o,c=n.__stx_runtime_head??{};return n.__stx_runtime_head=Ue(c,{title:a}),""})}function gy(e,n,r=""){if(!e.includes("@meta"))return e;return Ft(e,/(?<![\w$@])@meta\s*\(/g,(i,s)=>{let o=Pr(zt(i),n);if(o.kind==="error")return D("Meta",s,o.message,r,o.code);if(o.kind==="tag"){let a=n.__stx_runtime_head??{};n.__stx_runtime_head=Ue(a,{meta:[o.tag]})}return""},(i)=>D("Meta",i,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX))}export{T,jt,ae,A,qs,_i,Ks,u,f,sl,P,ot,Bt,d,Xs,t,ce,Er,K,l,_e,Ci,z,kn,x,ol,Ei,Ft,zt,Ht,Ve,it,D,Gs,Ti,il,Tr,$r,al,at,cl,Rr,ll,_n,$i,ul,Ar,Pr,Ir,Js,Ce,Ri,sy,oy,dl,Ue,kg,Ys,iy,ay,cy,ly,uy,dy,py,fy,gy};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import n from"fs";import a from"path";import{fileURLToPath as s}from"url";var i;function
|
|
3
|
-
export{
|
|
2
|
+
import n from"fs";import a from"path";import{fileURLToPath as s}from"url";var i;function rt(){if(i)return i;let t="unknown";try{t=String(JSON.parse(n.readFileSync(new URL("../package.json",import.meta.url),"utf8")).version)}catch{}if(import.meta.url.endsWith(".ts"))try{let o=a.dirname(s(import.meta.url)),e=0;for(let r of n.readdirSync(o,{recursive:!0,withFileTypes:!0}))if(r.isFile()&&r.name.endsWith(".ts"))e=Math.max(e,n.statSync(a.join(r.parentPath,r.name)).mtimeMs);t+=`+src.${Math.trunc(e)}`}catch{}return i=t,t}
|
|
3
|
+
export{rt};
|