@stacksjs/stx 0.2.769 → 0.2.770

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.
Files changed (219) hide show
  1. package/dist/{chunk-80gg1k0h.js → chunk-07thf07b.js} +2 -2
  2. package/dist/chunk-0cvpkj9g.js +2 -0
  3. package/dist/{chunk-528b302x.js → chunk-0h3sf5tp.js} +5 -5
  4. package/dist/chunk-0qgdex7z.js +2 -0
  5. package/dist/{chunk-dbpzrkmj.js → chunk-1925kbjc.js} +1 -1
  6. package/dist/chunk-1hb8q271.js +2 -0
  7. package/dist/chunk-1se5y83a.js +2 -0
  8. package/dist/{chunk-nr3pepv1.js → chunk-2bm97z09.js} +3 -3
  9. package/dist/chunk-2p301rsb.js +2 -0
  10. package/dist/{chunk-1a4vpk9x.js → chunk-2vbgm9t4.js} +6 -6
  11. package/dist/chunk-33gccrx0.js +2 -0
  12. package/dist/chunk-3754her2.js +2 -0
  13. package/dist/{chunk-rj9dcjeg.js → chunk-392rrp28.js} +2 -2
  14. package/dist/chunk-3jkbs3fc.js +2 -0
  15. package/dist/{chunk-9y6hbdfh.js → chunk-3png7zhs.js} +4 -4
  16. package/dist/chunk-3vankrf5.js +2 -0
  17. package/dist/{chunk-mg38q3jh.js → chunk-3y26rjq6.js} +10 -10
  18. package/dist/{chunk-ysfeg3cn.js → chunk-477gjb2b.js} +2 -2
  19. package/dist/chunk-4jzyd8k0.js +2 -0
  20. package/dist/{chunk-wp4nqnn7.js → chunk-4qng287p.js} +1 -1
  21. package/dist/chunk-4tvty67c.js +2 -0
  22. package/dist/chunk-4xaz5jbs.js +2 -0
  23. package/dist/{chunk-s2py8kg7.js → chunk-4xzk9529.js} +2 -2
  24. package/dist/chunk-53md2scd.js +2 -0
  25. package/dist/chunk-56sek7x7.js +2 -0
  26. package/dist/chunk-5g5v7yns.js +2 -0
  27. package/dist/chunk-5gg5jc76.js +2 -0
  28. package/dist/{chunk-7s9wx19m.js → chunk-5s2dwh5z.js} +11 -11
  29. package/dist/{chunk-py818vbj.js → chunk-5t33zwwg.js} +1 -1
  30. package/dist/{chunk-s6ss1qnq.js → chunk-618d3ng3.js} +6 -6
  31. package/dist/chunk-68j6zb7n.js +2 -0
  32. package/dist/{chunk-fz717vpc.js → chunk-6b32wt31.js} +30 -30
  33. package/dist/{chunk-30kemrry.js → chunk-6cd5dyje.js} +22 -22
  34. package/dist/{chunk-8x4gmead.js → chunk-6k4tbms6.js} +6 -6
  35. package/dist/{chunk-napd81ht.js → chunk-6nf4xhv0.js} +5 -5
  36. package/dist/{chunk-n5dd6rpt.js → chunk-6sa5adg6.js} +2 -2
  37. package/dist/chunk-6wf0ter4.js +2 -0
  38. package/dist/{chunk-5fab5wt2.js → chunk-70nwqsf6.js} +4 -4
  39. package/dist/chunk-75st1ttq.js +2 -0
  40. package/dist/{chunk-nrh8t8re.js → chunk-79x0812m.js} +2 -2
  41. package/dist/chunk-7ctvfad1.js +2 -0
  42. package/dist/{chunk-2w16z2y1.js → chunk-7g29avcd.js} +5 -5
  43. package/dist/{chunk-vp8sjx6w.js → chunk-7h0mjwkq.js} +5 -5
  44. package/dist/{chunk-a81m2ewb.js → chunk-7t1medmh.js} +2 -2
  45. package/dist/{chunk-ddpt7ejx.js → chunk-7wwfaj6b.js} +3 -3
  46. package/dist/{chunk-xj1k9bx9.js → chunk-7y0v5dry.js} +2 -2
  47. package/dist/chunk-83aq0n9s.js +2 -0
  48. package/dist/{chunk-jb1c4e49.js → chunk-83fh7j8g.js} +2 -2
  49. package/dist/{chunk-342e6mhn.js → chunk-91q55gjp.js} +3 -3
  50. package/dist/{chunk-ggvnmmv3.js → chunk-9ewhnwcg.js} +4 -4
  51. package/dist/chunk-9vgkp3nj.js +2 -0
  52. package/dist/chunk-9vqj5jzp.js +2 -0
  53. package/dist/chunk-a50kn0hn.js +2 -0
  54. package/dist/{chunk-pzt3g2m0.js → chunk-amnydj3d.js} +1 -1
  55. package/dist/chunk-bpbhjn4w.js +2 -0
  56. package/dist/chunk-bqyj88qr.js +2 -0
  57. package/dist/{chunk-ztbk9yqv.js → chunk-bwzjjxnj.js} +4 -4
  58. package/dist/{chunk-cz3trbvn.js → chunk-cak9fp9b.js} +7 -7
  59. package/dist/chunk-cgv3r6q9.js +2 -0
  60. package/dist/{chunk-j34wqxb1.js → chunk-cn7zpm1x.js} +5 -5
  61. package/dist/{chunk-0hf0mtaf.js → chunk-cqfyby1t.js} +2 -2
  62. package/dist/{chunk-zj32s5na.js → chunk-ddhazq2g.js} +3 -3
  63. package/dist/{chunk-zmesddf4.js → chunk-ddjkt87h.js} +1 -1
  64. package/dist/{chunk-t70s45hc.js → chunk-dmj9gk6d.js} +2 -2
  65. package/dist/chunk-e6zv6p3x.js +2 -0
  66. package/dist/chunk-e96jbmkj.js +3 -0
  67. package/dist/{chunk-33jagtss.js → chunk-eb8dv03t.js} +3 -3
  68. package/dist/{chunk-cyd10m6m.js → chunk-edetp97r.js} +5 -5
  69. package/dist/chunk-ej4wf9m5.js +2 -0
  70. package/dist/{chunk-zv924m9g.js → chunk-erjp2w63.js} +5 -5
  71. package/dist/chunk-exfgfjf6.js +2 -0
  72. package/dist/chunk-fvg2p9z0.js +2 -0
  73. package/dist/chunk-fxvhkz72.js +2 -0
  74. package/dist/chunk-g6m3q9n4.js +2 -0
  75. package/dist/{chunk-r3qez0ph.js → chunk-gn5v004x.js} +7 -7
  76. package/dist/{chunk-90n5kb78.js → chunk-gzcg563a.js} +3 -3
  77. package/dist/{chunk-rk2v0wzs.js → chunk-gzxjayvp.js} +6 -6
  78. package/dist/chunk-h2ymq7fa.js +2 -0
  79. package/dist/{chunk-kc3kt59e.js → chunk-hgm6f2t2.js} +2 -2
  80. package/dist/chunk-j1nyasyk.js +2 -0
  81. package/dist/chunk-j46nvncc.js +2 -0
  82. package/dist/chunk-jjvrm2j8.js +2 -0
  83. package/dist/chunk-kh0szwf3.js +2 -0
  84. package/dist/chunk-krdc3c87.js +7 -0
  85. package/dist/chunk-krw4m6j1.js +2 -0
  86. package/dist/{chunk-2bb4g9qr.js → chunk-m207mdpy.js} +2 -2
  87. package/dist/{chunk-jgmmg2fw.js → chunk-mcct58gb.js} +5 -5
  88. package/dist/{chunk-zg43k117.js → chunk-mdw5sbbt.js} +2 -2
  89. package/dist/chunk-mvfj17fr.js +2 -0
  90. package/dist/{chunk-wb2ej5by.js → chunk-ngzdcvry.js} +1 -1
  91. package/dist/{chunk-pqgk9mxp.js → chunk-nj2q40p8.js} +2 -2
  92. package/dist/chunk-nmjgcw4g.js +2 -0
  93. package/dist/{chunk-ev4zxhpd.js → chunk-nnzmbfjq.js} +2 -2
  94. package/dist/{chunk-586xes7a.js → chunk-nwhv1889.js} +3 -3
  95. package/dist/{chunk-1g5fg1ys.js → chunk-p1mbbdwj.js} +2 -2
  96. package/dist/chunk-p454tj1h.js +2 -0
  97. package/dist/{chunk-3g8cnsbk.js → chunk-pgkcbm6g.js} +2 -2
  98. package/dist/{chunk-s5kfndxv.js → chunk-pkyb284z.js} +2 -2
  99. package/dist/{chunk-5q97egpw.js → chunk-prxe37hj.js} +41 -41
  100. package/dist/{chunk-qdysx0fd.js → chunk-q3c130w6.js} +13 -13
  101. package/dist/chunk-q4m5p4wx.js +2 -0
  102. package/dist/chunk-q85s8ne0.js +2 -0
  103. package/dist/chunk-qe3hrbge.js +2 -0
  104. package/dist/{chunk-hpdb8vkt.js → chunk-qk61pv1v.js} +4 -4
  105. package/dist/chunk-qq4ee7px.js +2 -0
  106. package/dist/chunk-qr5ddqbf.js +3 -0
  107. package/dist/{chunk-q69dvpg1.js → chunk-qsc5nse5.js} +1 -1
  108. package/dist/{chunk-4rtr07x9.js → chunk-qtja7fpr.js} +2 -2
  109. package/dist/{chunk-a2yptg7r.js → chunk-rc4zsymn.js} +2 -2
  110. package/dist/chunk-rfp5f55f.js +2 -0
  111. package/dist/{chunk-tykyhmyx.js → chunk-rjh7ptw5.js} +1 -1
  112. package/dist/{chunk-7yx2ztt5.js → chunk-rkz3k2td.js} +3 -3
  113. package/dist/{chunk-1e67szzk.js → chunk-s3m1ggsn.js} +6 -6
  114. package/dist/{chunk-4qrr2mdd.js → chunk-s8p958da.js} +53 -53
  115. package/dist/{chunk-a627f39k.js → chunk-ssd9g1wz.js} +1 -1
  116. package/dist/{chunk-p7cvn8q9.js → chunk-tahdfsp4.js} +2 -2
  117. package/dist/chunk-th7amyq4.js +2 -0
  118. package/dist/chunk-v95kersm.js +2 -0
  119. package/dist/{chunk-jd84zgn3.js → chunk-vht2rhrj.js} +4 -4
  120. package/dist/{chunk-7vqq2w3x.js → chunk-vke28xq8.js} +2 -2
  121. package/dist/{chunk-p7h4y7mk.js → chunk-w07n2ddj.js} +2 -2
  122. package/dist/chunk-w1sjp421.js +2 -0
  123. package/dist/chunk-w5d936jr.js +2 -0
  124. package/dist/{chunk-zjar9jdd.js → chunk-wabahwkj.js} +2 -2
  125. package/dist/{chunk-msy46ges.js → chunk-x0qtgyqr.js} +5 -5
  126. package/dist/{chunk-znhzrjbm.js → chunk-x148cxrj.js} +4 -4
  127. package/dist/chunk-x3xtyr95.js +2 -0
  128. package/dist/{chunk-h8yk9qm7.js → chunk-xaqtk05e.js} +2 -2
  129. package/dist/chunk-xb16yy2x.js +2 -0
  130. package/dist/{chunk-knvt4bap.js → chunk-xr28hjkp.js} +6 -6
  131. package/dist/{chunk-ecakhzkq.js → chunk-y6hyndrt.js} +7 -7
  132. package/dist/chunk-yavspk55.js +2 -0
  133. package/dist/{chunk-rfzfk8zd.js → chunk-yjzczm2s.js} +10 -10
  134. package/dist/chunk-yrh9yfnv.js +2 -0
  135. package/dist/chunk-ysm6gaq9.js +2 -0
  136. package/dist/{chunk-svrjbeyq.js → chunk-ytjhb81r.js} +3 -3
  137. package/dist/{chunk-07c8rk93.js → chunk-yzbdm457.js} +2 -2
  138. package/dist/{chunk-fxy7jjnv.js → chunk-z1br7qeb.js} +4 -4
  139. package/dist/chunk-z515xymr.js +2 -0
  140. package/dist/{chunk-mkk8k3nd.js → chunk-z5vkzbct.js} +4 -4
  141. package/dist/chunk-z6xfmrtc.js +2 -0
  142. package/dist/{chunk-hxyarbb6.js → chunk-z846tgfe.js} +3 -3
  143. package/dist/chunk-za7v4w04.js +2 -0
  144. package/dist/chunk-zb8wv7sc.js +2 -0
  145. package/dist/{chunk-enzrpxsj.js → chunk-zsfr4dv9.js} +4 -4
  146. package/dist/cli.js +19 -19
  147. package/dist/craft-entry.js +2 -2
  148. package/dist/craft.js +2 -2
  149. package/dist/message-catalogs.d.ts +6 -0
  150. package/dist/message-catalogs.js +12 -8
  151. package/dist/process.js +18 -4
  152. package/dist/pwa.js +3 -3
  153. package/dist/ssg.js +4 -4
  154. package/dist/types/config-types.d.ts +1 -0
  155. package/dist/web-modules.d.ts +9 -0
  156. package/dist/web-modules.js +47 -0
  157. package/package.json +5 -5
  158. package/dist/chunk-01484snf.js +0 -2
  159. package/dist/chunk-096g00ba.js +0 -2
  160. package/dist/chunk-0ga7sn1k.js +0 -2
  161. package/dist/chunk-0nhk9p9r.js +0 -2
  162. package/dist/chunk-1nzg53pv.js +0 -2
  163. package/dist/chunk-1respkkp.js +0 -2
  164. package/dist/chunk-20dsfgmq.js +0 -2
  165. package/dist/chunk-3k6tem86.js +0 -2
  166. package/dist/chunk-3pma2q0h.js +0 -2
  167. package/dist/chunk-4cr8bep2.js +0 -2
  168. package/dist/chunk-4ew0291t.js +0 -2
  169. package/dist/chunk-5ftthxab.js +0 -2
  170. package/dist/chunk-5ttj2c0h.js +0 -2
  171. package/dist/chunk-5wp7s24b.js +0 -3
  172. package/dist/chunk-9v21mwfs.js +0 -2
  173. package/dist/chunk-b6kfq08s.js +0 -2
  174. package/dist/chunk-b94xf9vs.js +0 -2
  175. package/dist/chunk-bjggcj45.js +0 -2
  176. package/dist/chunk-bk3b5jyw.js +0 -2
  177. package/dist/chunk-bntw35k0.js +0 -2
  178. package/dist/chunk-bt01gdaj.js +0 -2
  179. package/dist/chunk-bwkw2dw3.js +0 -2
  180. package/dist/chunk-ctmadzad.js +0 -2
  181. package/dist/chunk-cwmjqker.js +0 -2
  182. package/dist/chunk-dbx628ra.js +0 -2
  183. package/dist/chunk-ddwsms1t.js +0 -2
  184. package/dist/chunk-dpjf62qw.js +0 -2
  185. package/dist/chunk-e4bsnxsj.js +0 -2
  186. package/dist/chunk-f8jwrvky.js +0 -2
  187. package/dist/chunk-h8yy3y3p.js +0 -2
  188. package/dist/chunk-hddwx35m.js +0 -2
  189. package/dist/chunk-hfcmbbkq.js +0 -2
  190. package/dist/chunk-hyqsvw1b.js +0 -2
  191. package/dist/chunk-j5dd5ncz.js +0 -7
  192. package/dist/chunk-j835421z.js +0 -2
  193. package/dist/chunk-mhc72pp2.js +0 -2
  194. package/dist/chunk-nsxg0t06.js +0 -2
  195. package/dist/chunk-p66fgjeb.js +0 -2
  196. package/dist/chunk-phjfsm8d.js +0 -2
  197. package/dist/chunk-pts7jpqc.js +0 -2
  198. package/dist/chunk-qcjtfrzm.js +0 -2
  199. package/dist/chunk-qr6jyd08.js +0 -2
  200. package/dist/chunk-rqpktvkn.js +0 -2
  201. package/dist/chunk-s1a69a8q.js +0 -2
  202. package/dist/chunk-s922mx0k.js +0 -2
  203. package/dist/chunk-spmbnchd.js +0 -2
  204. package/dist/chunk-t1gk6y8z.js +0 -2
  205. package/dist/chunk-t3cdnbq1.js +0 -2
  206. package/dist/chunk-t96gj0ey.js +0 -2
  207. package/dist/chunk-vcks4gwd.js +0 -2
  208. package/dist/chunk-vg6p0zst.js +0 -2
  209. package/dist/chunk-vjsyf8m1.js +0 -2
  210. package/dist/chunk-vq88tjma.js +0 -2
  211. package/dist/chunk-vqa2s0v4.js +0 -2
  212. package/dist/chunk-wtqj99tg.js +0 -2
  213. package/dist/chunk-xqa8f03q.js +0 -2
  214. package/dist/chunk-y7a0y5jq.js +0 -2
  215. package/dist/chunk-ydj0r3kw.js +0 -2
  216. package/dist/chunk-ydq170j1.js +0 -2
  217. package/dist/chunk-ytzzth34.js +0 -2
  218. package/dist/chunk-yz30cgyx.js +0 -2
  219. package/dist/chunk-yz85drm8.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{K}from"./chunk-zjar9jdd.js";import Ne 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 Y(e){for(let[n,r]of Object.entries(t))if(r===e)return n;return}import at from"path";var ct={showRelativePaths:!1,enableAutoRecovery:K(),logRecoveryWarnings:!0},J={...ct};function M(){return{...J}}function P(e){if(!J.showRelativePaths||!e)return e;let n=J.baseDir||process.cwd();try{let r=at.relative(n,e);return r.startsWith("..")?e:r}catch{return e}}class L 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=P(this.filePath)}}class ae extends L{constructor(e,n,r,i,s,o){super(e,"stx_RUNTIME_ERROR",n,r,i,s,o||t.EVALUATION_ERROR);this.name="StxRuntimeError"}}class Cr extends L{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 q extends L{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 he(e){let{type:n,message:r,code:i,filePath:s,line:o,column:a,template:l,offset:p,snippet:g,suggestion:h,format:m="text"}=e,y=o,b=a;if(!y&&l&&p!==void 0){let G=dt(l,p);y=G.line,b=G.column}let S=s?P(s):void 0,x=i?Y(i):void 0,C={type:n,code:i,codeName:x,message:r,filePath:S,line:y,column:b,snippet:g,suggestion:h,timestamp:new Date().toISOString()},A;switch(m){case"html":A=ut(C);break;case"json":A=JSON.stringify(C,null,2);break;case"console":A=gt(C,l,p);break;case"text":default:A=lt(C,l,p);break}return{formatted:A,data:C}}function lt(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(`
2
+ import{K}from"./chunk-wabahwkj.js";import Ne 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 Y(e){for(let[n,r]of Object.entries(t))if(r===e)return n;return}import at from"path";var ct={showRelativePaths:!1,enableAutoRecovery:K(),logRecoveryWarnings:!0},J={...ct};function M(){return{...J}}function P(e){if(!J.showRelativePaths||!e)return e;let n=J.baseDir||process.cwd();try{let r=at.relative(n,e);return r.startsWith("..")?e:r}catch{return e}}class L 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=P(this.filePath)}}class ae extends L{constructor(e,n,r,i,s,o){super(e,"stx_RUNTIME_ERROR",n,r,i,s,o||t.EVALUATION_ERROR);this.name="StxRuntimeError"}}class Cr extends L{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 q extends L{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 he(e){let{type:n,message:r,code:i,filePath:s,line:o,column:a,template:l,offset:p,snippet:g,suggestion:h,format:m="text"}=e,y=o,b=a;if(!y&&l&&p!==void 0){let G=dt(l,p);y=G.line,b=G.column}let S=s?P(s):void 0,x=i?Y(i):void 0,C={type:n,code:i,codeName:x,message:r,filePath:S,line:y,column:b,snippet:g,suggestion:h,timestamp:new Date().toISOString()},A;switch(m){case"html":A=ut(C);break;case"json":A=JSON.stringify(C,null,2);break;case"console":A=gt(C,l,p);break;case"text":default:A=lt(C,l,p);break}return{formatted:A,data:C}}function lt(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
3
  ${e.message}`),n&&e.line){let o=pt(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(`
@@ -17,7 +17,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
17
17
  `)}function ft(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",l="\x1B[31m",p="\x1B[0m",g=[];for(let h=s;h<=o;h++){let m=(h+1).toString().padStart(4),y=h===n-1,b=y?"\x1B[31m>\x1B[0m":" ",S=y?`\x1B[31m${i[h]}\x1B[0m`:`\x1B[90m${i[h]}\x1B[0m`;g.push(`${b}\x1B[90m${m}\x1B[0m | ${S}`)}return g.join(`
19
19
  `)}function me(e){return e.replace(/--/g,"- -").replace(/>/g,"&gt;")}function dt(e,n){let i=e.substring(0,n).split(`
20
- `);return{line:i.length,column:i[i.length-1].length}}function c(e,n,r){return he({type:e,message:n,code:r,format:"html"}).formatted}async function ke(e,n,r){try{return await e()}catch(i){if(r&&i instanceof Error)r(i);return n}}var vi={isEnabled(){return M().enableAutoRecovery},fixCommonSyntaxErrors(e){let n=M();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 l=s-o;r+="}}".repeat(l),i.push(`Added ${l} missing closing braces '}}'`)}let a=["if","foreach","for","switch","section"];for(let l of a){let p=(r.match(new RegExp(`@${l}\\b`,"g"))||[]).length,g=(r.match(new RegExp(`@end${l}\\b`,"g"))||[]).length;if(p>g){let h=p-g;for(let m=0;m<h;m++)r+=`
20
+ `);return{line:i.length,column:i[i.length-1].length}}function c(e,n,r){return he({type:e,message:n,code:r,format:"html"}).formatted}async function ke(e,n,r){try{return await e()}catch(i){if(r&&i instanceof Error)r(i);return n}}var xi={isEnabled(){return M().enableAutoRecovery},fixCommonSyntaxErrors(e){let n=M();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 l=s-o;r+="}}".repeat(l),i.push(`Added ${l} missing closing braces '}}'`)}let a=["if","foreach","for","switch","section"];for(let l of a){let p=(r.match(new RegExp(`@${l}\\b`,"g"))||[]).length,g=(r.match(new RegExp(`@end${l}\\b`,"g"))||[]).length;if(p>g){let h=p-g;for(let m=0;m<h;m++)r+=`
21
21
  @end${l}`;i.push(`Added ${h} missing @end${l}`)}}if(i.length>0&&n.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),i.forEach((l)=>console.warn(` - ${l}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:r,fixes:i}},createFallbackContent(e,n){if(K())return`<!-- ${e} failed: ${n.message} -->`;return"<!-- stx rendering error -->"}};class Z{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(`
@@ -25,7 +25,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
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
27
  `),"utf-8")}}async flush(){await this.writeQueue}}var B=new Z,xn={isDevelopment(){return K()},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 w(e,n,r,i=0){let s=0,o=i,a=null,l=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]==="{"){l++,o+=2;continue}if(l>0&&g==="}"){l--,o++;continue}if(g==="`"&&a==="`"&&l===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 Zc(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}}var mt={maxSanitizeDepth:10,allowBracketNotation:!1},Se={...mt};var j=/\bnew\s+/,z="__stx_safe_ctors",ve=["Bun","Deno","Buffer","fetch","atob","btoa","console","Response","Request","Headers","WebAssembly","structuredClone","queueMicrotask","crypto","performance","navigator","Worker","WebSocket","BroadcastChannel","EventSource","XMLHttpRequest","localStorage","sessionStorage"],Q=[...ve,"Function","setTimeout","setInterval","setImmediate","process","require","exports","module","window","document","global","globalThis","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry"],ye=Q.map(()=>{return}),ee=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})),ne=[/\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*\(/,j,/\bdelete\s+/,/\bthis\b/,/\\u(?:\{[\dA-Fa-f]+\}|[\dA-Fa-f]{4})/],re=new Set([...ve,"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",z]),ie=new Set(["__proto__","constructor","prototype"]);function $e(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 l=1;o+=2;while(o<e.length&&l>0){if(e[o]==="{")l++;else if(e[o]==="}")l--;if(l>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 Re(e){return $e(e).text}var Ce=["Collator","DateTimeFormat","DisplayNames","ListFormat","Locale","NumberFormat","PluralRules","RelativeTimeFormat","Segmenter"],Te=(()=>{let e={Date,URL,URLSearchParams},n=Intl;for(let r of Ce)if(typeof n[r]==="function")e[`Intl_${r}`]=n[r];return Object.freeze(Object.assign(Object.create(null),e))})(),ht=/^new(\s+)(Date|URLSearchParams|URL|Intl\s*\.\s*([A-Z_a-z]\w*))\s*\(/,Ee=/(?<![\w$])new(?![\w$])/g,be=`only new Date(), new URL(), new URLSearchParams() and new Intl.{${Ce.join(",")}}() are allowed`;function yt(e){let{text:n,map:r}=$e(e),i=[];Ee.lastIndex=0;let s;while((s=Ee.exec(n))!==null){let a=s.index;if(/(?<!\.)\.\s*$/.test(n.slice(0,a)))continue;let l=ht.exec(n.slice(a)),p=l?.[3],g=!l?null:p?`Intl_${p}`:l[2];if(!l||!g||!(g in Te))throw new k(`matched /${j.source}/; ${be}`,e);let h=a+l[0].length,m=r[a],y=r[h-1]+1;if(e.slice(m,y)!==n.slice(a,h))throw new k(`matched /${j.source}/; ${be}`,e);let b=m+3+l[1].length;i.push({start:b,end:b+l[2].length,key:g})}let o=e;for(let a=i.length-1;a>=0;a--){let l=i[a];o=`${o.slice(0,l.start)}${z}.${l.key}${o.slice(l.end)}`}return{source:o,usesSafeConstructors:i.length>0}}class k 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 Hs(e){try{return se(e),null}catch(n){return n instanceof k?n.rule:n instanceof Error?n.message:String(n)}}function Ae(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(re.has(s))throw new k(`matched /\\b${s}\\b/; identifier ${s}`,n);if(o==="."&&ie.has(s))throw new k(`matched /.${s}/; property ${s}`,n)}}function Ie(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 l=s[1].trim(),p=/^'(?:[^'\\]|\\.)*'$/.test(l),g=/^"(?:[^"\\]|\\.)*"$/.test(l);if(/^\d+$/.test(l))continue;if(p||g){let m=l.slice(1,-1);if(ie.has(m))throw new k(`bracket key ${m}`,e);if(!Se.allowBracketNotation)throw new k("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(l)){i.add(l);continue}throw new k("dynamic bracket notation is not allowed",e)}return[...i]}function se(e){let n=e.trim(),r=Re(n);Ae(r,n);let i=Ie(n);for(let s of ne){if(s===j)continue;if(s.test(r))throw new k(`matched /${s.source}/`,n)}return{...yt(n),dynamicKeys:i}}function wi(e){return se(e),e.trim()}var Vs=Symbol("stx.sanitizeCache"),Et=4000,F=new Map;function bt(e){let n=F.get(e);if(n===void 0){if(n=ne.some((r)=>r.test(e)),F.size>=Et)F.clear();F.set(e,n)}return n}function H(e){let n={},r=e[Vs];n.Math=Math,n.JSON=JSON,n.Date=Date,n.String=String,n.Number=Number,n.Boolean=Boolean,n.Array=Array,n.Object=ee,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("__")||bt(i))continue;if(s&&typeof s==="object"&&!Array.isArray(s)){let o=r?.get(s);if(o===void 0)o=te(s),r?.set(s,o);n[i]=o}else n[i]=s}return n}function te(e,n=0){if(n>=Se.maxSanitizeDepth)return"[Object too deep]";if(e===null||typeof e!=="object")return e;if(Array.isArray(e))return e.map((i)=>te(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]=te(s,n+1);else r[i]=s}return r}function u(e,n){try{let r=H(n),i=Object.keys(r),s=Object.values(r);return d(e,i)(...s)}catch{return}}function f(e){try{return wi(e),!0}catch{return!1}}function Yc(e,n){try{let r=H(n),i=Object.keys(r),s=Object.values(r),o=!1,l=d(e,i,()=>{o=!0})(...s);return!o&&Boolean(l)}catch{return!1}}function R(e,n){try{let r=u(e,n);if(r&&typeof r==="object"&&!Array.isArray(r))return r;return{}}catch{return{}}}var Oe=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"]),xt=2000,D=new Map;function xe(e,n){let r=`${e.join(",")}\x00${n}`,i=D.get(r);if(i)return i;let s=Function(...e,n);if(D.size>=xt)D.clear();return D.set(r,s),s}function rt(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 wt=/^[A-Za-z_$][\w$]*$/;function Lt(e){return wt.test(e)&&!Oe.has(e)}function d(e,n,r){let{source:i,usesSafeConstructors:s,dynamicKeys:o}=se(e),a=[];for(let m=0;m<n.length;m++){if(!Lt(n[m]))continue;if(n[m]===z||n[m]==="Object"||re.has(n[m]))continue;a.push({key:n[m],index:m})}a.sort((m,y)=>m.key<y.key?-1:1);let l=a.map((m)=>m.key),p=a.map((m)=>m.index),g=`
28
+ `)}};function w(e,n,r,i=0){let s=0,o=i,a=null,l=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]==="{"){l++,o+=2;continue}if(l>0&&g==="}"){l--,o++;continue}if(g==="`"&&a==="`"&&l===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 Qc(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}}var mt={maxSanitizeDepth:10,allowBracketNotation:!1},Se={...mt};var j=/\bnew\s+/,z="__stx_safe_ctors",ve=["Bun","Deno","Buffer","fetch","atob","btoa","console","Response","Request","Headers","WebAssembly","structuredClone","queueMicrotask","crypto","performance","navigator","Worker","WebSocket","BroadcastChannel","EventSource","XMLHttpRequest","localStorage","sessionStorage"],Q=[...ve,"Function","setTimeout","setInterval","setImmediate","process","require","exports","module","window","document","global","globalThis","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry"],ye=Q.map(()=>{return}),ee=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})),ne=[/\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*\(/,j,/\bdelete\s+/,/\bthis\b/,/\\u(?:\{[\dA-Fa-f]+\}|[\dA-Fa-f]{4})/],re=new Set([...ve,"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",z]),ie=new Set(["__proto__","constructor","prototype"]);function $e(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 l=1;o+=2;while(o<e.length&&l>0){if(e[o]==="{")l++;else if(e[o]==="}")l--;if(l>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 Re(e){return $e(e).text}var Ce=["Collator","DateTimeFormat","DisplayNames","ListFormat","Locale","NumberFormat","PluralRules","RelativeTimeFormat","Segmenter"],Te=(()=>{let e={Date,URL,URLSearchParams},n=Intl;for(let r of Ce)if(typeof n[r]==="function")e[`Intl_${r}`]=n[r];return Object.freeze(Object.assign(Object.create(null),e))})(),ht=/^new(\s+)(Date|URLSearchParams|URL|Intl\s*\.\s*([A-Z_a-z]\w*))\s*\(/,Ee=/(?<![\w$])new(?![\w$])/g,be=`only new Date(), new URL(), new URLSearchParams() and new Intl.{${Ce.join(",")}}() are allowed`;function yt(e){let{text:n,map:r}=$e(e),i=[];Ee.lastIndex=0;let s;while((s=Ee.exec(n))!==null){let a=s.index;if(/(?<!\.)\.\s*$/.test(n.slice(0,a)))continue;let l=ht.exec(n.slice(a)),p=l?.[3],g=!l?null:p?`Intl_${p}`:l[2];if(!l||!g||!(g in Te))throw new k(`matched /${j.source}/; ${be}`,e);let h=a+l[0].length,m=r[a],y=r[h-1]+1;if(e.slice(m,y)!==n.slice(a,h))throw new k(`matched /${j.source}/; ${be}`,e);let b=m+3+l[1].length;i.push({start:b,end:b+l[2].length,key:g})}let o=e;for(let a=i.length-1;a>=0;a--){let l=i[a];o=`${o.slice(0,l.start)}${z}.${l.key}${o.slice(l.end)}`}return{source:o,usesSafeConstructors:i.length>0}}class k 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 Vs(e){try{return se(e),null}catch(n){return n instanceof k?n.rule:n instanceof Error?n.message:String(n)}}function Ae(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(re.has(s))throw new k(`matched /\\b${s}\\b/; identifier ${s}`,n);if(o==="."&&ie.has(s))throw new k(`matched /.${s}/; property ${s}`,n)}}function Ie(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 l=s[1].trim(),p=/^'(?:[^'\\]|\\.)*'$/.test(l),g=/^"(?:[^"\\]|\\.)*"$/.test(l);if(/^\d+$/.test(l))continue;if(p||g){let m=l.slice(1,-1);if(ie.has(m))throw new k(`bracket key ${m}`,e);if(!Se.allowBracketNotation)throw new k("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(l)){i.add(l);continue}throw new k("dynamic bracket notation is not allowed",e)}return[...i]}function se(e){let n=e.trim(),r=Re(n);Ae(r,n);let i=Ie(n);for(let s of ne){if(s===j)continue;if(s.test(r))throw new k(`matched /${s.source}/`,n)}return{...yt(n),dynamicKeys:i}}function vi(e){return se(e),e.trim()}var Us=Symbol("stx.sanitizeCache"),Et=4000,F=new Map;function bt(e){let n=F.get(e);if(n===void 0){if(n=ne.some((r)=>r.test(e)),F.size>=Et)F.clear();F.set(e,n)}return n}function H(e){let n={},r=e[Us];n.Math=Math,n.JSON=JSON,n.Date=Date,n.String=String,n.Number=Number,n.Boolean=Boolean,n.Array=Array,n.Object=ee,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("__")||bt(i))continue;if(s&&typeof s==="object"&&!Array.isArray(s)){let o=r?.get(s);if(o===void 0)o=te(s),r?.set(s,o);n[i]=o}else n[i]=s}return n}function te(e,n=0){if(n>=Se.maxSanitizeDepth)return"[Object too deep]";if(e===null||typeof e!=="object")return e;if(Array.isArray(e))return e.map((i)=>te(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]=te(s,n+1);else r[i]=s}return r}function u(e,n){try{let r=H(n),i=Object.keys(r),s=Object.values(r);return d(e,i)(...s)}catch{return}}function f(e){try{return vi(e),!0}catch{return!1}}function Zc(e,n){try{let r=H(n),i=Object.keys(r),s=Object.values(r),o=!1,l=d(e,i,()=>{o=!0})(...s);return!o&&Boolean(l)}catch{return!1}}function R(e,n){try{let r=u(e,n);if(r&&typeof r==="object"&&!Array.isArray(r))return r;return{}}catch{return{}}}var Oe=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"]),xt=2000,D=new Map;function xe(e,n){let r=`${e.join(",")}\x00${n}`,i=D.get(r);if(i)return i;let s=Function(...e,n);if(D.size>=xt)D.clear();return D.set(r,s),s}function rt(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 wt=/^[A-Za-z_$][\w$]*$/;function Lt(e){return wt.test(e)&&!Oe.has(e)}function d(e,n,r){let{source:i,usesSafeConstructors:s,dynamicKeys:o}=se(e),a=[];for(let m=0;m<n.length;m++){if(!Lt(n[m]))continue;if(n[m]===z||n[m]==="Object"||re.has(n[m]))continue;a.push({key:n[m],index:m})}a.sort((m,y)=>m.key<y.key?-1:1);let l=a.map((m)=>m.key),p=a.map((m)=>m.index),g=`
29
29
  'use strict';
30
30
  try {
31
31
  return ${i};
@@ -36,11 +36,11 @@ catch (e) {
36
36
  }
37
37
  throw e;
38
38
  }
39
- `;return St(kt(s?(m)=>{let y=xe([z,"Object",...Q,...l,...m],g);return(...b)=>y(Te,ee,...ye,...b)}:(m)=>{let y=xe(["Object",...Q,...l,...m],g);return(...b)=>y(ee,...ye,...b)},l,n,a,p,r),n,o)}function St(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"&&ie.has(a))return}return e(...s)}}function kt(e,n,r,i,s,o){let a=e([]),l=i.every((g,h)=>g.index===h);if(n.length===r.length&&l)return we(a,n,e,void 0,o);return we((...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 we(e,n,r,i,s){let a=/^(\w+) is not defined$/,l=e,p=[],g=new Set(n);return(...h)=>{for(let m=0;m<=8;m++)try{return l(...h)}catch(y){let b=y instanceof Error?y.message:"",S=a.exec(b);if(!(y instanceof ReferenceError)||!S)return;let x=S[1];if(g.has(x)||Oe.has(x)||re.has(x))return;if(s?.(x),g.add(x),p.push(x),i)i(p);else l=r(p)}return}}function Us(e){let n=e.trim();try{let r=Re(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;Ae(r,n),Ie(n);for(let i of ne)if(i.test(r))return!1}catch{return!1}return!0}function xi(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=w(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 jt(e,n,r,i){let s="",o=0;for(let a of xi(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 Bt(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 ce(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"?`
40
- `:a==="t"?"\t":a;continue}if(o===r)return null;if(r==="`"&&o==="$"&&n[s+1]==="{")return null;i+=o}return i}var vt=new Set(["true","false","null","undefined","typeof","void","new","in","of","instanceof","this","delete","await","async","function","return","NaN","Infinity"]);function Ft(e,n){let r=e.trim();if(!r)return{ok:!1,message:"the argument is empty",code:t.INVALID_DIRECTIVE_SYNTAX};let i=Hs(r);if(i)return{ok:!1,message:`the expression is not allowed (${i})`,code:t.UNSAFE_EXPRESSION};let s=H(n),o;try{o=d(r,Object.keys(s))(...Object.values(s))}catch(l){return{ok:!1,message:`the expression could not be evaluated: ${l instanceof Error?l.message:String(l)}`,code:t.EVALUATION_ERROR}}if(o!==void 0&&o!==null)return{ok:!0,value:o};let a=[...new Set(rt(r))].filter((l)=>!vt.has(l)&&!(l in s)&&!(l 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 He(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 st(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Le(e){if(!e)return"";return Ne.isAbsolute(e)?Ne.relative(process.cwd(),e)||e:e}function oe(e){let n=e.replace(/\s+/g," ").trim();return n.length>80?`${n.slice(0,77)}...`:n}function N(e,n,r,i,s=t.EVALUATION_ERROR){let o=i?` in ${Le(i)}`:"";return console.warn(`[stx] ${oe(n)}${o}: ${r}`),c(e,`${oe(n)}: ${r}`,s)}function Ws(e,n,r){let i=r?` in ${Le(r)}`:"";console.warn(`[stx] ${oe(e)}${i}: ${n}`)}function Si(){return{afterOpen:[],beforeClose:[]}}function $t(e){return e.afterOpen.length>0||e.beforeClose.length>0}function Qc(e,n){if(!$t(n))return e;let r=n.afterOpen.join(""),i=n.beforeClose.join(""),s=e.lastIndexOf("</head>"),o=r?Er(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 Me=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy;function Er(e){let n=/<head\b[^>]*>/i.exec(e);if(!n)return null;let r=n.index+n[0].length;Me.lastIndex=r;let i=Me.exec(e);return i?r+i[0].length:r}var ue="data-stx-color-mode-boot",Pe="__STX_COLOR_MODE__",Rt=new Set(["light","dark","auto","system"]),Ct=new Set(["auto","system"]),Tt=/^[a-z][\w:-]*$/i,At=/^[\w-]+$/;function _t(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(!Rt.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"||!At.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"||!Tt.test(s)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(s)}`);if(o!==null&&!Ct.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 It(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function ge(e={}){let n=_t(e),r=It(n),i=`(function(){"use strict";var o=window.${Pe};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.${Pe}={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 ${ue}>${i}</script>`}function Tr(e,n={}){if(e.includes(ue))return e;let r=le(e);if(r===null)return e;let i=ge(n);return`${e.slice(0,r)}
39
+ `;return St(kt(s?(m)=>{let y=xe([z,"Object",...Q,...l,...m],g);return(...b)=>y(Te,ee,...ye,...b)}:(m)=>{let y=xe(["Object",...Q,...l,...m],g);return(...b)=>y(ee,...ye,...b)},l,n,a,p,r),n,o)}function St(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"&&ie.has(a))return}return e(...s)}}function kt(e,n,r,i,s,o){let a=e([]),l=i.every((g,h)=>g.index===h);if(n.length===r.length&&l)return we(a,n,e,void 0,o);return we((...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 we(e,n,r,i,s){let a=/^(\w+) is not defined$/,l=e,p=[],g=new Set(n);return(...h)=>{for(let m=0;m<=8;m++)try{return l(...h)}catch(y){let b=y instanceof Error?y.message:"",S=a.exec(b);if(!(y instanceof ReferenceError)||!S)return;let x=S[1];if(g.has(x)||Oe.has(x)||re.has(x))return;if(s?.(x),g.add(x),p.push(x),i)i(p);else l=r(p)}return}}function Ws(e){let n=e.trim();try{let r=Re(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;Ae(r,n),Ie(n);for(let i of ne)if(i.test(r))return!1}catch{return!1}return!0}function Si(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=w(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 jt(e,n,r,i){let s="",o=0;for(let a of Si(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 Bt(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 ce(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"?`
40
+ `:a==="t"?"\t":a;continue}if(o===r)return null;if(r==="`"&&o==="$"&&n[s+1]==="{")return null;i+=o}return i}var vt=new Set(["true","false","null","undefined","typeof","void","new","in","of","instanceof","this","delete","await","async","function","return","NaN","Infinity"]);function Ft(e,n){let r=e.trim();if(!r)return{ok:!1,message:"the argument is empty",code:t.INVALID_DIRECTIVE_SYNTAX};let i=Vs(r);if(i)return{ok:!1,message:`the expression is not allowed (${i})`,code:t.UNSAFE_EXPRESSION};let s=H(n),o;try{o=d(r,Object.keys(s))(...Object.values(s))}catch(l){return{ok:!1,message:`the expression could not be evaluated: ${l instanceof Error?l.message:String(l)}`,code:t.EVALUATION_ERROR}}if(o!==void 0&&o!==null)return{ok:!0,value:o};let a=[...new Set(rt(r))].filter((l)=>!vt.has(l)&&!(l in s)&&!(l 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 He(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 st(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Le(e){if(!e)return"";return Ne.isAbsolute(e)?Ne.relative(process.cwd(),e)||e:e}function oe(e){let n=e.replace(/\s+/g," ").trim();return n.length>80?`${n.slice(0,77)}...`:n}function N(e,n,r,i,s=t.EVALUATION_ERROR){let o=i?` in ${Le(i)}`:"";return console.warn(`[stx] ${oe(n)}${o}: ${r}`),c(e,`${oe(n)}: ${r}`,s)}function qs(e,n,r){let i=r?` in ${Le(r)}`:"";console.warn(`[stx] ${oe(e)}${i}: ${n}`)}function ki(){return{afterOpen:[],beforeClose:[]}}function $t(e){return e.afterOpen.length>0||e.beforeClose.length>0}function el(e,n){if(!$t(n))return e;let r=n.afterOpen.join(""),i=n.beforeClose.join(""),s=e.lastIndexOf("</head>"),o=r?Er(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 Me=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy;function Er(e){let n=/<head\b[^>]*>/i.exec(e);if(!n)return null;let r=n.index+n[0].length;Me.lastIndex=r;let i=Me.exec(e);return i?r+i[0].length:r}var ue="data-stx-color-mode-boot",Pe="__STX_COLOR_MODE__",Rt=new Set(["light","dark","auto","system"]),Ct=new Set(["auto","system"]),Tt=/^[a-z][\w:-]*$/i,At=/^[\w-]+$/;function _t(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(!Rt.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"||!At.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"||!Tt.test(s)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(s)}`);if(o!==null&&!Ct.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 It(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function ge(e={}){let n=_t(e),r=It(n),i=`(function(){"use strict";var o=window.${Pe};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.${Pe}={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 ${ue}>${i}</script>`}function Tr(e,n={}){if(e.includes(ue))return e;let r=le(e);if(r===null)return e;let i=ge(n);return`${e.slice(0,r)}
41
41
  ${i}${e.slice(r)}`}var le=Er,Ot=new RegExp(`<script\\b[^>]*\\b${ue}\\b[^>]*>[\\s\\S]*?<\\/script>`,"i"),Fe=/<meta\b[^>]*\bcharset\b[^>]*>/gi,De=/<\/head>/gi;function Nt(e){let n=/<head\b[^>]*>/i.exec(e);if(!n)return e;let r=n.index+n[0].length;De.lastIndex=r;let i=De.exec(e),s=i?i.index:e.length;Fe.lastIndex=r;let o=Fe.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)}
42
- ${o[0]}${e.slice(r,o.index)}${e.slice(a,s)}${e.slice(s)}`}function el(e){return Mt(Nt(e))}function Mt(e){let n=Ot.exec(e);if(!n)return e;let r=le(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=le(i);if(s===null)return e;return`${i.slice(0,s)}
43
- ${n[0]}${i.slice(s)}`}var Pt="[data-stx-component-wrapper]:not([stx-hydrate]){display:contents}",Be=`<style data-stx-cloak>[x-cloak]{display:none !important}${Pt}</style>`,U="data-stx-html-attrs",V="data-stx-html-class",Ue=/^[A-Za-z_:][\w:.-]*$/;function v(e){return String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Dt(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ot(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 zt(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 _(e,n){return Object.entries(e).filter(([r])=>!n?.(r)).map(([r,i])=>`${r}="${v(String(i))}"`).join(" ")}function W(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 We(e){let n=_(e,(r)=>r==="content");return`<script${n?` ${n}`:""}>${W(e)}</script>`}function Ht(e={},n="en"){let r=[],i=[],s="",o=n;for(let[l,p]of Object.entries(e||{})){if(p==null)continue;let g=l.trim();if(!Ue.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}="${v(String(p))}"`),i.push(g)}let a=` lang="${v(o)}"`;if(s)a+=` class="${v(s)}"`;if(a+=r.join(""),s)a+=` ${V}="${v(s)}"`;if(i.length)a+=` ${U}="${v(i.join(" "))}"`;return a}function tl(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 $r(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 l=[],p=[];for(let[h,m]of Object.entries(n)){if(m==null)continue;let y=h.trim();if(!Ue.test(y))continue;let b=y.toLowerCase();if(b==="class"){let S=(i.class||"").split(/\s+/).filter(Boolean);for(let x of String(m).split(/\s+/).filter(Boolean))if(!S.includes(x))S.push(x),l.push(x);if(!("class"in i))s.push("class");i.class=S.join(" ");continue}if(!(y in i))s.push(y);if(i[y]=String(m),b!=="lang")p.push(y)}if(l.length){if(!(V in i))s.push(V);i[V]=l.join(" ")}if(p.length){if(!(U in i))s.push(U);i[U]=p.join(" ")}let g=s.map((h)=>` ${h}="${v(i[h])}"`).join("");return e.replace(r[0],()=>`<html${g}>`)}function nl(e){if(e.includes("data-stx-cloak"))return null;if(e.lastIndexOf("</head>")===-1)return null;return`${Be}
42
+ ${o[0]}${e.slice(r,o.index)}${e.slice(a,s)}${e.slice(s)}`}function tl(e){return Mt(Nt(e))}function Mt(e){let n=Ot.exec(e);if(!n)return e;let r=le(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=le(i);if(s===null)return e;return`${i.slice(0,s)}
43
+ ${n[0]}${i.slice(s)}`}var Pt="[data-stx-component-wrapper]:not([stx-hydrate]){display:contents}",Be=`<style data-stx-cloak>[x-cloak]{display:none !important}${Pt}</style>`,U="data-stx-html-attrs",V="data-stx-html-class",Ue=/^[A-Za-z_:][\w:.-]*$/;function v(e){return String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Dt(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ot(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 zt(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 _(e,n){return Object.entries(e).filter(([r])=>!n?.(r)).map(([r,i])=>`${r}="${v(String(i))}"`).join(" ")}function W(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 We(e){let n=_(e,(r)=>r==="content");return`<script${n?` ${n}`:""}>${W(e)}</script>`}function Ht(e={},n="en"){let r=[],i=[],s="",o=n;for(let[l,p]of Object.entries(e||{})){if(p==null)continue;let g=l.trim();if(!Ue.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}="${v(String(p))}"`),i.push(g)}let a=` lang="${v(o)}"`;if(s)a+=` class="${v(s)}"`;if(a+=r.join(""),s)a+=` ${V}="${v(s)}"`;if(i.length)a+=` ${U}="${v(i.join(" "))}"`;return a}function nl(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 $r(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 l=[],p=[];for(let[h,m]of Object.entries(n)){if(m==null)continue;let y=h.trim();if(!Ue.test(y))continue;let b=y.toLowerCase();if(b==="class"){let S=(i.class||"").split(/\s+/).filter(Boolean);for(let x of String(m).split(/\s+/).filter(Boolean))if(!S.includes(x))S.push(x),l.push(x);if(!("class"in i))s.push("class");i.class=S.join(" ");continue}if(!(y in i))s.push(y);if(i[y]=String(m),b!=="lang")p.push(y)}if(l.length){if(!(V in i))s.push(V);i[V]=l.join(" ")}if(p.length){if(!(U in i))s.push(U);i[U]=p.join(" ")}let g=s.map((h)=>` ${h}="${v(i[h])}"`).join("");return e.replace(r[0],()=>`<html${g}>`)}function rl(e){if(e.includes("data-stx-cloak"))return null;if(e.lastIndexOf("</head>")===-1)return null;return`${Be}
44
44
  `}function Ut(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 l=o.match(/^<script\b[^>]*>/i);if(l){let m=e.toLowerCase().indexOf("</script>",r+l[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 l=o.match(/^<meta\b[^>]*>/i);if(l&&n.includes(l[0])){s+=l[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 Vt(e,n={},r={}){let{title:i="stx App",lang:s="en",meta:o=[],link:a=[],script:l=[],headRaw:p="",htmlAttrs:g={},bodyClass:h="",bodyAttrs:m={}}=n,y=r.title||i,b=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],S=new Set(o.map(ot).filter(Boolean)),{body:x,hoisted:C}=Ut(e),A=new Set(C.flatMap((E)=>{let O=zt(E);return O?[ot(O)].filter(Boolean):[]})),Ye=[...b.filter((E)=>!S.has(ot(E))),...o].filter((E)=>!A.has(ot(E))).map((E)=>` <meta ${_(E)}>`).join(`
45
45
  `),Je=a.map((E)=>` <link ${_(E)}>`).join(`
46
46
  `),Ze=l.map((E)=>{if(E.src)return` <script ${_(E,(O)=>O==="content")}></script>`;if(E.content)return` ${We(E)}`;return""}).filter(Boolean).join(`
@@ -54,8 +54,8 @@ ${nt.join(`
54
54
  ${it.join(`
55
55
  `)}
56
56
  </body>
57
- </html>`}var pe=/\s+/y,fe=/<(script|style)\b[^>]*>/iy,Wt=/<\/script>/gi,Xt=/<\/style>/gi,je=/<!DOCTYPE\b/iy,ze=/<html[\s>]/iy;function Sn(e){let n=0;while(n<e.length){if(pe.lastIndex=n,pe.exec(e)){n=pe.lastIndex;continue}if(e.startsWith("<!--",n)){let s=e.indexOf("-->",n);if(s===-1)return!1;n=s+3;continue}fe.lastIndex=n;let i=fe.exec(e);if(i){let s=i[1].toLowerCase()==="script"?Wt:Xt;s.lastIndex=fe.lastIndex;let o=s.exec(e);if(o===null)return!1;n=o.index+o[0].length;continue}if(je.lastIndex=n,je.test(e))return!0;return ze.lastIndex=n,ze.test(e)}return!1}function ki(e){return Sn(e)}function rl(e,n={}){let r=e.lastIndexOf("</head>");if(r===-1)return e;let{meta:i=[],link:s=[],script:o=[],headRaw:a=""}=n,l=e.slice(0,r),p=[];for(let g of i){let h=ot(g);if(h&&l.includes(h))continue;p.push(` <meta ${_(g)}>`)}for(let g of s){if(g.href&&l.includes(`href="${g.href}"`))continue;p.push(` <link ${_(g)}>`)}for(let g of o)if(g.src){if(l.includes(`src="${g.src}"`))continue;p.push(` <script ${_(g,(h)=>h==="content")}></script>`)}else if(g.content){if(l.includes(W(g)))continue;p.push(` ${We(g)}`)}if(a&&!l.includes(a))p.push(` ${a}`);if(p.length===0)return e;return`${e.slice(0,r)}${p.join(`
57
+ </html>`}var pe=/\s+/y,fe=/<(script|style)\b[^>]*>/iy,Wt=/<\/script>/gi,Xt=/<\/style>/gi,je=/<!DOCTYPE\b/iy,ze=/<html[\s>]/iy;function Sn(e){let n=0;while(n<e.length){if(pe.lastIndex=n,pe.exec(e)){n=pe.lastIndex;continue}if(e.startsWith("<!--",n)){let s=e.indexOf("-->",n);if(s===-1)return!1;n=s+3;continue}fe.lastIndex=n;let i=fe.exec(e);if(i){let s=i[1].toLowerCase()==="script"?Wt:Xt;s.lastIndex=fe.lastIndex;let o=s.exec(e);if(o===null)return!1;n=o.index+o[0].length;continue}if(je.lastIndex=n,je.test(e))return!0;return ze.lastIndex=n,ze.test(e)}return!1}function _i(e){return Sn(e)}function sl(e,n={}){let r=e.lastIndexOf("</head>");if(r===-1)return e;let{meta:i=[],link:s=[],script:o=[],headRaw:a=""}=n,l=e.slice(0,r),p=[];for(let g of i){let h=ot(g);if(h&&l.includes(h))continue;p.push(` <meta ${_(g)}>`)}for(let g of s){if(g.href&&l.includes(`href="${g.href}"`))continue;p.push(` <link ${_(g)}>`)}for(let g of o)if(g.src){if(l.includes(`src="${g.src}"`))continue;p.push(` <script ${_(g,(h)=>h==="content")}></script>`)}else if(g.content){if(l.includes(W(g)))continue;p.push(` ${We(g)}`)}if(a&&!l.includes(a))p.push(` ${a}`);if(p.length===0)return e;return`${e.slice(0,r)}${p.join(`
58
58
  `)}
59
- ${e.slice(r)}`}function Rr(e,n={},r={},i){if(i??ki(e))return e;return Vt(e,n,r)}var Kt=["og:","article:","book:","profile:","fb:","music:","video:"],qt=/^[a-z][\w-]*(?::[\w:-]+)?$/i;function Ar(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=Gt(e[0],n);if(typeof r!=="string")return r;let i;if(e.length===2){let o=Yt(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,l=n[o]??(st(a)?a[o]:void 0);i=l===void 0||l===null||typeof l==="object"?"":String(l)}if(!i)return{kind:"empty"};return{kind:"tag",tag:Kt.some((o)=>r.startsWith(o))?{property:r,content:i}:{name:r,content:i}}}function Gt(e,n){let r=ce(e);if(r!==null)return r.trim()?r:{kind:"error",message:"the meta name is empty",code:t.INVALID_DIRECTIVE_SYNTAX};if(qt.test(e.trim()))return e.trim();let i=Ft(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 ${He(i.value)}`,code:t.TYPE_ERROR};return i.value}function Yt(e,n){let r=ce(e);if(r!==null)return r;let i=Ft(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 ${He(s)}`,code:t.TYPE_ERROR};return String(s)}var Pr=["title","lang","meta","link","script","headRaw","htmlAttrs","bodyClass","bodyAttrs"],qs=["title","titleTemplate","base","meta","link","script","style","htmlAttrs","bodyAttrs"],qe={links:"link",metas:"meta",scripts:"script",styles:"style"},Xe=new Set,Ke=new WeakMap;function de(e){if(Xe.has(e))return;Xe.add(e),console.warn(e)}function Jt(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 Zt(e,n){let r=e.toLowerCase(),i=n.find((p)=>p.toLowerCase()===r);if(i)return i;let s=qe[r];if(s&&n.includes(s))return s;let o,a=1/0;for(let p of n){let g=Jt(r,p.toLowerCase());if(g<a)o=p,a=g}let l=Math.min(e.length,o?.length??0)<=4?1:2;return a<=l?o:void 0}function _e(e,n){if(!e||typeof e!=="object"||Array.isArray(e))return e||{};let r=Ke.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 l=qe[a];if(l&&i.includes(l)&&Array.isArray(e[a])){if(o===e)o={...e};let g=Array.isArray(o[l])?o[l]:[];o[l]=[...g,...e[a]],delete o[a],de(`[stx] ${s}.${a} is not a head key; reading it as ${s}.${l}. Rename it to \`${l}\`.`);continue}if(/^styles?$/.test(a)&&!i.includes("style")){de(`[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=Zt(a,i);de(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 Ke.set(e,o),o}var T={},Qt=[],X={};function _i(){return T}function Gh(){return X}function Jh(){T={},Qt.length=0,X={}}function sl(e){T=Ve(T,_e(e,{known:qs,source:"useHead()"}))}function Ge(e,n,r){let i=[...e||[]];for(let s of n||[]){let o=r(s),a=o?i.findIndex((l)=>r(l)===o):-1;if(a<0)i.push(s);else i[a]=s}return i}function Ve(e,n){return{title:n.title??e.title,titleTemplate:n.titleTemplate??e.titleTemplate,base:n.base??e.base,meta:Ge(e.meta,n.meta,(r)=>r.name||r.property||(r.httpEquiv?`http:${r.httpEquiv}`:void 0)),link:Ge(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 gg(e){sl(Ks(e))}function Ks(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 l=[];if(e.canonical)l.push({rel:"canonical",href:e.canonical});return{title:e.title,titleTemplate:e.titleTemplate,meta:n,link:l}}function Yh(e){if(X={...X,...e},e.title||e.description)gg({title:e.title,description:e.description})}function Zh(e){let n=typeof e==="function"?e():e;sl({title:n})}function Qh(e=T){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>${I(r)}</title>`)}if(e.base){let r=Object.entries(e.base).map(([i,s])=>`${i}="${I(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}="${I(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}="${I(String(o))}"`).join(" ");n.push(`<link ${i}>`)}for(let r of e.script||[]){let{content:i,...s}=r,o=Object.entries(s).filter(([a,l])=>l!==void 0).map(([a,l])=>{if(typeof l==="boolean")return l?a:"";return`${a}="${I(String(l))}"`}).filter(Boolean).join(" ");if(i)n.push(`<script ${o}>${W(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(`
60
- `)}function ey(e=T){if(!e.htmlAttrs)return"";return Object.entries(e.htmlAttrs).map(([n,r])=>`${n}="${I(r)}"`).join(" ")}function ty(e=T){if(!e.bodyAttrs)return"";return Object.entries(e.bodyAttrs).map(([n,r])=>`${n}="${I(r)}"`).join(" ")}function I(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function ny(e=T){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 ry(e){let n="";return{content:e.replace(/@head\s*([\s\S]*?)@endhead/g,(i,s)=>(n+=s.trim()+`
61
- `,"")),headContent:n.trim()}}function sy(e,n){return e.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(r,i,s,o)=>{let a=i?s:n[(o||"").trim()]??o,l=n.__stx_runtime_head??{};return n.__stx_runtime_head=Ve(l,{title:a}),""})}function oy(e,n,r=""){if(!e.includes("@meta"))return e;return jt(e,/(?<![\w$@])@meta\s*\(/g,(i,s)=>{let o=Ar(Bt(i),n);if(o.kind==="error")return N("Meta",s,o.message,r,o.code);if(o.kind==="tag"){let a=n.__stx_runtime_head??{};n.__stx_runtime_head=Ve(a,{meta:[o.tag]})}return""},(i)=>N("Meta",i,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX))}export{Hs,wi,Vs,u,f,Yc,R,rt,Lt,d,Us,t,ae,Cr,q,c,ke,vi,B,xn,w,Zc,xi,jt,Bt,Ft,He,st,N,Ws,Si,Qc,Er,Tr,el,ot,tl,$r,nl,Sn,ki,rl,Rr,Ar,Pr,qs,_e,_i,Gh,Jh,sl,Ve,gg,Ks,Yh,Zh,Qh,ey,ty,ny,ry,sy,oy};
59
+ ${e.slice(r)}`}function Rr(e,n={},r={},i){if(i??_i(e))return e;return Vt(e,n,r)}var Kt=["og:","article:","book:","profile:","fb:","music:","video:"],qt=/^[a-z][\w-]*(?::[\w:-]+)?$/i;function Ar(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=Gt(e[0],n);if(typeof r!=="string")return r;let i;if(e.length===2){let o=Yt(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,l=n[o]??(st(a)?a[o]:void 0);i=l===void 0||l===null||typeof l==="object"?"":String(l)}if(!i)return{kind:"empty"};return{kind:"tag",tag:Kt.some((o)=>r.startsWith(o))?{property:r,content:i}:{name:r,content:i}}}function Gt(e,n){let r=ce(e);if(r!==null)return r.trim()?r:{kind:"error",message:"the meta name is empty",code:t.INVALID_DIRECTIVE_SYNTAX};if(qt.test(e.trim()))return e.trim();let i=Ft(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 ${He(i.value)}`,code:t.TYPE_ERROR};return i.value}function Yt(e,n){let r=ce(e);if(r!==null)return r;let i=Ft(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 ${He(s)}`,code:t.TYPE_ERROR};return String(s)}var Pr=["title","lang","meta","link","script","headRaw","htmlAttrs","bodyClass","bodyAttrs"],Ks=["title","titleTemplate","base","meta","link","script","style","htmlAttrs","bodyAttrs"],qe={links:"link",metas:"meta",scripts:"script",styles:"style"},Xe=new Set,Ke=new WeakMap;function de(e){if(Xe.has(e))return;Xe.add(e),console.warn(e)}function Jt(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 Zt(e,n){let r=e.toLowerCase(),i=n.find((p)=>p.toLowerCase()===r);if(i)return i;let s=qe[r];if(s&&n.includes(s))return s;let o,a=1/0;for(let p of n){let g=Jt(r,p.toLowerCase());if(g<a)o=p,a=g}let l=Math.min(e.length,o?.length??0)<=4?1:2;return a<=l?o:void 0}function _e(e,n){if(!e||typeof e!=="object"||Array.isArray(e))return e||{};let r=Ke.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 l=qe[a];if(l&&i.includes(l)&&Array.isArray(e[a])){if(o===e)o={...e};let g=Array.isArray(o[l])?o[l]:[];o[l]=[...g,...e[a]],delete o[a],de(`[stx] ${s}.${a} is not a head key; reading it as ${s}.${l}. Rename it to \`${l}\`.`);continue}if(/^styles?$/.test(a)&&!i.includes("style")){de(`[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=Zt(a,i);de(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 Ke.set(e,o),o}var T={},Qt=[],X={};function Ci(){return T}function Jh(){return X}function Yh(){T={},Qt.length=0,X={}}function ol(e){T=Ve(T,_e(e,{known:Ks,source:"useHead()"}))}function Ge(e,n,r){let i=[...e||[]];for(let s of n||[]){let o=r(s),a=o?i.findIndex((l)=>r(l)===o):-1;if(a<0)i.push(s);else i[a]=s}return i}function Ve(e,n){return{title:n.title??e.title,titleTemplate:n.titleTemplate??e.titleTemplate,base:n.base??e.base,meta:Ge(e.meta,n.meta,(r)=>r.name||r.property||(r.httpEquiv?`http:${r.httpEquiv}`:void 0)),link:Ge(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 mg(e){ol(Xs(e))}function Xs(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 l=[];if(e.canonical)l.push({rel:"canonical",href:e.canonical});return{title:e.title,titleTemplate:e.titleTemplate,meta:n,link:l}}function Zh(e){if(X={...X,...e},e.title||e.description)mg({title:e.title,description:e.description})}function Qh(e){let n=typeof e==="function"?e():e;ol({title:n})}function ey(e=T){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>${I(r)}</title>`)}if(e.base){let r=Object.entries(e.base).map(([i,s])=>`${i}="${I(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}="${I(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}="${I(String(o))}"`).join(" ");n.push(`<link ${i}>`)}for(let r of e.script||[]){let{content:i,...s}=r,o=Object.entries(s).filter(([a,l])=>l!==void 0).map(([a,l])=>{if(typeof l==="boolean")return l?a:"";return`${a}="${I(String(l))}"`}).filter(Boolean).join(" ");if(i)n.push(`<script ${o}>${W(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(`
60
+ `)}function ty(e=T){if(!e.htmlAttrs)return"";return Object.entries(e.htmlAttrs).map(([n,r])=>`${n}="${I(r)}"`).join(" ")}function ny(e=T){if(!e.bodyAttrs)return"";return Object.entries(e.bodyAttrs).map(([n,r])=>`${n}="${I(r)}"`).join(" ")}function I(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function ry(e=T){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 sy(e){let n="";return{content:e.replace(/@head\s*([\s\S]*?)@endhead/g,(i,s)=>(n+=s.trim()+`
61
+ `,"")),headContent:n.trim()}}function oy(e,n){return e.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(r,i,s,o)=>{let a=i?s:n[(o||"").trim()]??o,l=n.__stx_runtime_head??{};return n.__stx_runtime_head=Ve(l,{title:a}),""})}function iy(e,n,r=""){if(!e.includes("@meta"))return e;return jt(e,/(?<![\w$@])@meta\s*\(/g,(i,s)=>{let o=Ar(Bt(i),n);if(o.kind==="error")return N("Meta",s,o.message,r,o.code);if(o.kind==="tag"){let a=n.__stx_runtime_head??{};n.__stx_runtime_head=Ve(a,{meta:[o.tag]})}return""},(i)=>N("Meta",i,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX))}export{Vs,vi,Us,u,f,Zc,R,rt,Lt,d,Ws,t,ae,Cr,q,c,ke,xi,B,xn,w,Qc,Si,jt,Bt,Ft,He,st,N,qs,ki,el,Er,Tr,tl,ot,nl,$r,rl,Sn,_i,sl,Rr,Ar,Pr,Ks,_e,Ci,Jh,Yh,ol,Ve,mg,Xs,Zh,Qh,ey,ty,ny,ry,sy,oy,iy};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{w}from"./chunk-7s9wx19m.js";function Ye(e,r){let n=v(e,r);return n.ok?{expression:n.expression,endPos:n.endPos}:null}function v(e,r){let n=r;while(n<e.length&&/\s/.test(e[n]))n++;if(e[n]!=="(")return{ok:!1,reason:"missing-open-paren",pos:n};let c=w(e,"(",")",n);if(c===-1)return{ok:!1,reason:"unclosed-paren",pos:n};return{ok:!0,expression:e.slice(n+1,c),endPos:c+1}}function y(e,r){let n=e.lastIndexOf("<",r);if(n===-1)return!1;return n>e.lastIndexOf(">",r)}function wt(e,r,n,c){let o=1,i=c,u=new RegExp(`@${r}\\s*\\(`,"g"),a=new RegExp(`@${n}(?![a-z])`,"g");while(i<e.length&&o>0){u.lastIndex=i,a.lastIndex=i;let p=u.exec(e),t=a.exec(e),s=p?p.index:1/0,f=t?t.index:1/0;if(s<f)o++,i=s+p[0].length;else if(f<1/0){if(o--,o===0)return f;i=f+t[0].length}else break}return-1}function P(e,r){let n=e.slice(r).match(/^@if\s*/);if(!n)return null;let c=r+n[0].length,o=Ye(e,c);if(!o)return null;let i=o.endPos,u=wt(e,"if","endif",i);if(u===-1)return null;let a=e.slice(i,u),p=[],t=0,s="if",f=o.expression,l=0,x=0;while(t<a.length){let h=a.indexOf("@",t);if(h===-1)break;t=h;let d=a.substring(h);if(y(a,h)){t++;continue}if(/^@if\s*\(/.test(d)){x++,t++;continue}if(/^@endif(?![a-z])/.test(d)){x--,t+=6;continue}if(x===0){let g=d.match(/^@elseif\s*/);if(g){p.push({type:s,condition:f,content:a.substring(l,t),start:i+l,end:i+t});let m=t+g[0].length,b=Ye(a,m);if(!b){t++;continue}s="elseif",f=b.expression,t=b.endPos,l=t;continue}else if(/^@else(?![a-z])/.test(d)){p.push({type:s,condition:f,content:a.substring(l,t),start:i+l,end:i+t}),s="else",f=void 0,t+=5,l=t;continue}}t++}return p.push({type:s,condition:f,content:a.slice(l),start:i+l,end:i+a.length}),{fullMatch:e.slice(r,u+6),branches:p,start:r,end:u+6}}function cn(e){let r=[],n=/@if\s*\(/g,c=n.exec(e);while(c!==null){if(r.some((u)=>c.index>u.start&&c.index<u.end)){c=n.exec(e);continue}let i=P(e,c.index);if(i)r.push(i),n.lastIndex=i.end;c=n.exec(e)}return r}function ms(e,r,n){let c=[],o=new RegExp(`@${r}\\s*\\(`,"g"),i=o.exec(e);while(i!==null){if(c.some((d)=>i.index>d.start&&i.index<d.end)){i=o.exec(e);continue}let a=i.index,p=a+i[0].length-1,t=w(e,"(",")",p);if(t===-1){i=o.exec(e);continue}let s=e.slice(p+1,t),f=t+1,l=wt(e,r,n,f);if(l===-1){i=o.exec(e);continue}let x=e.slice(f,l),h=l+`@${n}`.length;c.push({fullMatch:e.slice(a,h),name:r,params:s,content:x,start:a,end:h}),o.lastIndex=h,i=o.exec(e)}return c}function Vo(e,r){let n=e.slice(r).match(/^@switch\s*/);if(!n)return null;let c=r+n[0].length,o=Ye(e,c);if(!o)return null;let i=o.endPos,u=wt(e,"switch","endswitch",i);if(u===-1)return null;let a=e.slice(i,u),p=[],t=0,s=null,f=0;while(t<a.length){let l=a.slice(t),x=l.match(/^@switch\s*\(/),h=l.match(/^@endswitch(?![a-z])/);if(x){if(f++,s)s.content+=x[0];t+=x[0].length;continue}if(h){if(f--,s)s.content+=h[0];t+=h[0].length;continue}if(f>0){if(s)s.content+=a[t];t++;continue}let d=l.match(/^@case\s*/),g=l.match(/^@default(?![a-z])/),m=l.match(/^@break(?![a-z])/);if(d&&l.startsWith("@case")){if(s)p.push(s);let b=t+d[0].length,E=Ye(a,b);if(!E){t++;continue}s={type:"case",value:E.expression,content:""},t=E.endPos}else if(g&&l.startsWith("@default")){if(s)p.push(s);s={type:"default",content:""},t+=g[0].length}else if(m&&l.startsWith("@break"))t+=m[0].length;else{if(s)s.content+=a[t];t++}}if(s)p.push(s);return{fullMatch:e.slice(r,u+10),expression:o.expression,cases:p,start:r,end:u+10}}export{Ye,wt,cn,ms,Vo};
2
+ import{w}from"./chunk-5s2dwh5z.js";function Ye(e,r){let n=v(e,r);return n.ok?{expression:n.expression,endPos:n.endPos}:null}function v(e,r){let n=r;while(n<e.length&&/\s/.test(e[n]))n++;if(e[n]!=="(")return{ok:!1,reason:"missing-open-paren",pos:n};let c=w(e,"(",")",n);if(c===-1)return{ok:!1,reason:"unclosed-paren",pos:n};return{ok:!0,expression:e.slice(n+1,c),endPos:c+1}}function y(e,r){let n=e.lastIndexOf("<",r);if(n===-1)return!1;return n>e.lastIndexOf(">",r)}function wt(e,r,n,c){let o=1,i=c,u=new RegExp(`@${r}\\s*\\(`,"g"),a=new RegExp(`@${n}(?![a-z])`,"g");while(i<e.length&&o>0){u.lastIndex=i,a.lastIndex=i;let p=u.exec(e),t=a.exec(e),s=p?p.index:1/0,f=t?t.index:1/0;if(s<f)o++,i=s+p[0].length;else if(f<1/0){if(o--,o===0)return f;i=f+t[0].length}else break}return-1}function P(e,r){let n=e.slice(r).match(/^@if\s*/);if(!n)return null;let c=r+n[0].length,o=Ye(e,c);if(!o)return null;let i=o.endPos,u=wt(e,"if","endif",i);if(u===-1)return null;let a=e.slice(i,u),p=[],t=0,s="if",f=o.expression,l=0,x=0;while(t<a.length){let h=a.indexOf("@",t);if(h===-1)break;t=h;let d=a.substring(h);if(y(a,h)){t++;continue}if(/^@if\s*\(/.test(d)){x++,t++;continue}if(/^@endif(?![a-z])/.test(d)){x--,t+=6;continue}if(x===0){let g=d.match(/^@elseif\s*/);if(g){p.push({type:s,condition:f,content:a.substring(l,t),start:i+l,end:i+t});let m=t+g[0].length,b=Ye(a,m);if(!b){t++;continue}s="elseif",f=b.expression,t=b.endPos,l=t;continue}else if(/^@else(?![a-z])/.test(d)){p.push({type:s,condition:f,content:a.substring(l,t),start:i+l,end:i+t}),s="else",f=void 0,t+=5,l=t;continue}}t++}return p.push({type:s,condition:f,content:a.slice(l),start:i+l,end:i+a.length}),{fullMatch:e.slice(r,u+6),branches:p,start:r,end:u+6}}function cn(e){let r=[],n=/@if\s*\(/g,c=n.exec(e);while(c!==null){if(r.some((u)=>c.index>u.start&&c.index<u.end)){c=n.exec(e);continue}let i=P(e,c.index);if(i)r.push(i),n.lastIndex=i.end;c=n.exec(e)}return r}function hs(e,r,n){let c=[],o=new RegExp(`@${r}\\s*\\(`,"g"),i=o.exec(e);while(i!==null){if(c.some((d)=>i.index>d.start&&i.index<d.end)){i=o.exec(e);continue}let a=i.index,p=a+i[0].length-1,t=w(e,"(",")",p);if(t===-1){i=o.exec(e);continue}let s=e.slice(p+1,t),f=t+1,l=wt(e,r,n,f);if(l===-1){i=o.exec(e);continue}let x=e.slice(f,l),h=l+`@${n}`.length;c.push({fullMatch:e.slice(a,h),name:r,params:s,content:x,start:a,end:h}),o.lastIndex=h,i=o.exec(e)}return c}function Uo(e,r){let n=e.slice(r).match(/^@switch\s*/);if(!n)return null;let c=r+n[0].length,o=Ye(e,c);if(!o)return null;let i=o.endPos,u=wt(e,"switch","endswitch",i);if(u===-1)return null;let a=e.slice(i,u),p=[],t=0,s=null,f=0;while(t<a.length){let l=a.slice(t),x=l.match(/^@switch\s*\(/),h=l.match(/^@endswitch(?![a-z])/);if(x){if(f++,s)s.content+=x[0];t+=x[0].length;continue}if(h){if(f--,s)s.content+=h[0];t+=h[0].length;continue}if(f>0){if(s)s.content+=a[t];t++;continue}let d=l.match(/^@case\s*/),g=l.match(/^@default(?![a-z])/),m=l.match(/^@break(?![a-z])/);if(d&&l.startsWith("@case")){if(s)p.push(s);let b=t+d[0].length,E=Ye(a,b);if(!E){t++;continue}s={type:"case",value:E.expression,content:""},t=E.endPos}else if(g&&l.startsWith("@default")){if(s)p.push(s);s={type:"default",content:""},t+=g[0].length}else if(m&&l.startsWith("@break"))t+=m[0].length;else{if(s)s.content+=a[t];t++}}if(s)p.push(s);return{fullMatch:e.slice(r,u+10),expression:o.expression,cases:p,start:r,end:u+10}}export{Ye,wt,cn,hs,Uo};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- function da(v,c){let{itemHeight:l,containerHeight:u,overscan:s=3,keyProperty:b="id",dynamicHeight:d=!1,estimatedItemHeight:g=l,direction:x="vertical"}=c,e=[...v],t=0,n=new Map;function f(){if(d)return h();let i=Math.max(0,Math.floor(t/l)-s),r=Math.ceil(u/l),m=Math.min(e.length-1,i+r+s*2);return{startIndex:i,endIndex:m}}function h(){let i=0,r=0,m=e.length-1;for(let p=0;p<e.length;p++){let M=n.get(p)||g;if(i+M>t){r=Math.max(0,p-s);break}i+=M}i=0;for(let p=0;p<e.length;p++){let M=n.get(p)||g;if(i+=M,i>t+u){m=Math.min(e.length-1,p+s);break}}return{startIndex:r,endIndex:m}}function w(){if(d){let i=0;for(let r=0;r<e.length;r++)i+=n.get(r)||g;return i}return e.length*l}function y(i){if(d){let r=0;for(let m=0;m<i;m++)r+=n.get(m)||g;return r}return i*l}function S(){let{startIndex:i,endIndex:r}=f();return{startIndex:i,endIndex:r,scrollTop:t,totalHeight:w(),visibleItems:e.slice(i,r+1),itemHeights:new Map(n)}}function L(i,r="auto"){let m=y(i);a(m,r)}function a(i,r="auto"){t=Math.max(0,Math.min(i,w()-u))}function o(){f()}function H(i){e=[...i],n.clear(),o()}function I(){e=[],n.clear()}return{scrollToIndex:L,scrollToOffset:a,getState:S,refresh:o,setItems:H,destroy:I}}function pa(v,c={},l){let u=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return v.replace(u,(s,b,d,g)=>{let x=b.trim(),e=c[x];if(!e||!Array.isArray(e))return`<!-- virtualList: items "${x}" not found or not an array -->`;let t={itemHeight:50,containerHeight:400,overscan:3};if(d)try{let a=d.trim(),o=Function(`return ${a}`)();t={...t,...o}}catch{}let n=`vlist-${Math.random().toString(36).substring(2,9)}`,f=Math.ceil(t.containerHeight/t.itemHeight),h=t.overscan||3,w=0,y=Math.min(e.length-1,f+h),S="";for(let a=w;a<=y&&a<e.length;a++){let o=e[a],H=g.replace(/\{\{\s*item\s*\}\}/g,typeof o==="object"?JSON.stringify(o):String(o)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(I,i)=>{if(typeof o==="object"&&o!==null)return String(o[i]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(a));S+=`
2
+ function pa(v,c){let{itemHeight:l,containerHeight:u,overscan:s=3,keyProperty:b="id",dynamicHeight:d=!1,estimatedItemHeight:g=l,direction:x="vertical"}=c,e=[...v],t=0,n=new Map;function f(){if(d)return h();let i=Math.max(0,Math.floor(t/l)-s),r=Math.ceil(u/l),m=Math.min(e.length-1,i+r+s*2);return{startIndex:i,endIndex:m}}function h(){let i=0,r=0,m=e.length-1;for(let p=0;p<e.length;p++){let M=n.get(p)||g;if(i+M>t){r=Math.max(0,p-s);break}i+=M}i=0;for(let p=0;p<e.length;p++){let M=n.get(p)||g;if(i+=M,i>t+u){m=Math.min(e.length-1,p+s);break}}return{startIndex:r,endIndex:m}}function w(){if(d){let i=0;for(let r=0;r<e.length;r++)i+=n.get(r)||g;return i}return e.length*l}function y(i){if(d){let r=0;for(let m=0;m<i;m++)r+=n.get(m)||g;return r}return i*l}function S(){let{startIndex:i,endIndex:r}=f();return{startIndex:i,endIndex:r,scrollTop:t,totalHeight:w(),visibleItems:e.slice(i,r+1),itemHeights:new Map(n)}}function L(i,r="auto"){let m=y(i);a(m,r)}function a(i,r="auto"){t=Math.max(0,Math.min(i,w()-u))}function o(){f()}function H(i){e=[...i],n.clear(),o()}function I(){e=[],n.clear()}return{scrollToIndex:L,scrollToOffset:a,getState:S,refresh:o,setItems:H,destroy:I}}function fa(v,c={},l){let u=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return v.replace(u,(s,b,d,g)=>{let x=b.trim(),e=c[x];if(!e||!Array.isArray(e))return`<!-- virtualList: items "${x}" not found or not an array -->`;let t={itemHeight:50,containerHeight:400,overscan:3};if(d)try{let a=d.trim(),o=Function(`return ${a}`)();t={...t,...o}}catch{}let n=`vlist-${Math.random().toString(36).substring(2,9)}`,f=Math.ceil(t.containerHeight/t.itemHeight),h=t.overscan||3,w=0,y=Math.min(e.length-1,f+h),S="";for(let a=w;a<=y&&a<e.length;a++){let o=e[a],H=g.replace(/\{\{\s*item\s*\}\}/g,typeof o==="object"?JSON.stringify(o):String(o)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(I,i)=>{if(typeof o==="object"&&o!==null)return String(o[i]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(a));S+=`
3
3
  <div class="virtual-item ${t.itemClass||""}"
4
4
  style="position: absolute; top: ${a*t.itemHeight}px; height: ${t.itemHeight}px; width: 100%;"
5
5
  data-index="${a}">
@@ -76,7 +76,7 @@ function da(v,c){let{itemHeight:l,containerHeight:u,overscan:s=3,keyProperty:b="
76
76
  };
77
77
  })();
78
78
  </script>
79
- `})}function zl(){return`
79
+ `})}function Vl(){return`
80
80
  .virtual-list-container {
81
81
  position: relative;
82
82
  overflow-y: auto;
@@ -124,7 +124,7 @@ function da(v,c){let{itemHeight:l,containerHeight:u,overscan:s=3,keyProperty:b="
124
124
  0% { background-position: 200% 0; }
125
125
  100% { background-position: -200% 0; }
126
126
  }
127
- `}function Hl(v,c){let l=null,u=()=>{if(!l)l=da(v(),c);return l};return{visibleItems:()=>u().getState().visibleItems,totalHeight:()=>u().getState().totalHeight,containerProps:()=>({style:{height:`${c.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(s)=>{let b=s.target;if(l)l.scrollToOffset(b.scrollTop)}}),itemProps:(s)=>({style:{position:"absolute",top:`${s*c.itemHeight}px`,height:`${c.itemHeight}px`,width:"100%"},"data-index":s}),scrollToIndex:(s)=>{u().scrollToIndex(s)}}}function Vl(v,c={},l){let u=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return v.replace(u,(s,b,d,g,x)=>{let e=b.trim(),t=c[e];if(!t||!Array.isArray(t))return`<!-- infiniteList: items "${e}" not found or not an array -->`;let n={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(d)try{let w=Function(`return ${d.trim()}`)();n={...n,...w}}catch{}let f=`ilist-${Math.random().toString(36).substring(2,9)}`,h=pa(`@virtualList(${e}, ${JSON.stringify({itemHeight:n.itemHeight,containerHeight:n.containerHeight,overscan:n.overscan,containerClass:n.containerClass})})${g}@endvirtualList`,c);return h=h.replace("</script>",`
127
+ `}function Ul(v,c){let l=null,u=()=>{if(!l)l=pa(v(),c);return l};return{visibleItems:()=>u().getState().visibleItems,totalHeight:()=>u().getState().totalHeight,containerProps:()=>({style:{height:`${c.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(s)=>{let b=s.target;if(l)l.scrollToOffset(b.scrollTop)}}),itemProps:(s)=>({style:{position:"absolute",top:`${s*c.itemHeight}px`,height:`${c.itemHeight}px`,width:"100%"},"data-index":s}),scrollToIndex:(s)=>{u().scrollToIndex(s)}}}function Wl(v,c={},l){let u=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return v.replace(u,(s,b,d,g,x)=>{let e=b.trim(),t=c[e];if(!t||!Array.isArray(t))return`<!-- infiniteList: items "${e}" not found or not an array -->`;let n={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(d)try{let w=Function(`return ${d.trim()}`)();n={...n,...w}}catch{}let f=`ilist-${Math.random().toString(36).substring(2,9)}`,h=fa(`@virtualList(${e}, ${JSON.stringify({itemHeight:n.itemHeight,containerHeight:n.containerHeight,overscan:n.overscan,containerClass:n.containerClass})})${g}@endvirtualList`,c);return h=h.replace("</script>",`
128
128
  // Infinite scroll detection
129
129
  container.addEventListener('scroll', function() {
130
130
  const scrollBottom = container.scrollTop + container.clientHeight;
@@ -142,7 +142,7 @@ function da(v,c){let{itemHeight:l,containerHeight:u,overscan:s=3,keyProperty:b="
142
142
  ${x}
143
143
  </div>
144
144
  </div>
145
- `})}function Ul(v,c={},l){let u=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return v.replace(u,(s,b,d,g)=>{let x=b.trim(),e=c[x];if(!e||!Array.isArray(e))return`<!-- virtualGrid: items "${x}" not found or not an array -->`;let t={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(d)try{let o=Function(`return ${d.trim()}`)();t={...t,...o}}catch{}let n=`vgrid-${Math.random().toString(36).substring(2,9)}`,f=Math.ceil(e.length/t.columns),h=f*(t.rowHeight+(t.gap||0)),w=Math.ceil(t.containerHeight/(t.rowHeight+(t.gap||0))),y=t.overscan||2,S=0,L=Math.min(f-1,w+y),a="";for(let o=S;o<=L;o++)for(let H=0;H<t.columns;H++){let I=o*t.columns+H;if(I>=e.length)break;let i=e[I],r=H*(100/t.columns),m=o*(t.rowHeight+(t.gap||0)),p=g.replace(/\{\{\s*item\s*\}\}/g,typeof i==="object"?JSON.stringify(i):String(i)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(M,T)=>{if(typeof i==="object"&&i!==null)return String(i[T]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(I));a+=`
145
+ `})}function ql(v,c={},l){let u=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return v.replace(u,(s,b,d,g)=>{let x=b.trim(),e=c[x];if(!e||!Array.isArray(e))return`<!-- virtualGrid: items "${x}" not found or not an array -->`;let t={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(d)try{let o=Function(`return ${d.trim()}`)();t={...t,...o}}catch{}let n=`vgrid-${Math.random().toString(36).substring(2,9)}`,f=Math.ceil(e.length/t.columns),h=f*(t.rowHeight+(t.gap||0)),w=Math.ceil(t.containerHeight/(t.rowHeight+(t.gap||0))),y=t.overscan||2,S=0,L=Math.min(f-1,w+y),a="";for(let o=S;o<=L;o++)for(let H=0;H<t.columns;H++){let I=o*t.columns+H;if(I>=e.length)break;let i=e[I],r=H*(100/t.columns),m=o*(t.rowHeight+(t.gap||0)),p=g.replace(/\{\{\s*item\s*\}\}/g,typeof i==="object"?JSON.stringify(i):String(i)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(M,T)=>{if(typeof i==="object"&&i!==null)return String(i[T]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(I));a+=`
146
146
  <div class="virtual-grid-item"
147
147
  style="position: absolute; top: ${m}px; left: ${r}%; width: calc(${100/t.columns}% - ${t.gap||0}px); height: ${t.rowHeight}px;"
148
148
  data-index="${I}">
@@ -212,5 +212,5 @@ function da(v,c){let{itemHeight:l,containerHeight:u,overscan:s=3,keyProperty:b="
212
212
  });
213
213
  })();
214
214
  </script>
215
- `})}var bm={createVirtualList:da,processVirtualListDirectives:pa,processInfiniteListDirectives:Vl,processVirtualGridDirectives:Ul,generateVirtualListCSS:zl,useVirtualList:Hl};
216
- export{da,pa,zl,Hl,Vl,Ul,bm};
215
+ `})}var _m={createVirtualList:pa,processVirtualListDirectives:fa,processInfiniteListDirectives:Wl,processVirtualGridDirectives:ql,generateVirtualListCSS:Vl,useVirtualList:Ul};
216
+ export{pa,fa,Vl,Ul,Wl,ql,_m};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ho,rh,sh}from"./chunk-7wwfaj6b.js";import"./chunk-70nwqsf6.js";import"./chunk-edetp97r.js";import"./chunk-wmnzapn8.js";import"./chunk-y6hyndrt.js";import"./chunk-mcct58gb.js";import"./chunk-5t33zwwg.js";import"./chunk-yjzczm2s.js";import"./chunk-ytjhb81r.js";import"./chunk-79x0812m.js";import"./chunk-bwzjjxnj.js";import"./chunk-cak9fp9b.js";import"./chunk-z1br7qeb.js";import"./chunk-s8p958da.js";import"./chunk-392rrp28.js";import"./chunk-p1mbbdwj.js";import"./chunk-5s2dwh5z.js";import"./chunk-4833k99b.js";import"./chunk-yzbdm457.js";export{sh as clearComposableCache,rh as getComposableScript,ho as listComposableModules};