@stacksjs/stx 0.2.754 → 0.2.755

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-v49jajzw.js → chunk-024m1xmd.js} +6 -6
  2. package/dist/{chunk-c3vsnz9h.js → chunk-0dsykna3.js} +5 -5
  3. package/dist/{chunk-n3t2cd17.js → chunk-0dt7ax79.js} +2 -2
  4. package/dist/{chunk-qksbf2gt.js → chunk-0fweckq5.js} +6 -6
  5. package/dist/{chunk-yax8wz93.js → chunk-0md73jp8.js} +2 -2
  6. package/dist/{chunk-5hrm7rtx.js → chunk-0tgrqhkr.js} +12 -12
  7. package/dist/{chunk-p4h5c79q.js → chunk-0vvb78yj.js} +5 -5
  8. package/dist/{chunk-67z3kesf.js → chunk-1a2cwee1.js} +2 -2
  9. package/dist/chunk-1gan06yr.js +2 -0
  10. package/dist/chunk-1menbxwb.js +2 -0
  11. package/dist/chunk-1n2d3cy5.js +2 -0
  12. package/dist/{chunk-pnpd7gz7.js → chunk-1tmq09ch.js} +3 -3
  13. package/dist/{chunk-kyk4ekng.js → chunk-236bdf7y.js} +2 -2
  14. package/dist/chunk-2vc2pkyz.js +2 -0
  15. package/dist/chunk-33bp9m4c.js +2 -0
  16. package/dist/chunk-361yezje.js +2 -0
  17. package/dist/{chunk-7t9wj2m4.js → chunk-3ap06zzx.js} +1 -1
  18. package/dist/{chunk-c0v9ng82.js → chunk-3z38swhv.js} +7 -7
  19. package/dist/{chunk-02c0zcaw.js → chunk-41sq06t2.js} +2 -2
  20. package/dist/chunk-45cvagp1.js +2 -0
  21. package/dist/{chunk-9hfk5wf1.js → chunk-4fc8zs15.js} +5 -5
  22. package/dist/{chunk-jq6gggcz.js → chunk-4zta7ay1.js} +2 -2
  23. package/dist/{chunk-srjhnk6w.js → chunk-5evgz54v.js} +30 -30
  24. package/dist/chunk-5f0wwwmw.js +2 -0
  25. package/dist/chunk-5h71xbzk.js +2 -0
  26. package/dist/{chunk-1rxzn4yx.js → chunk-5q2tfrcw.js} +2 -2
  27. package/dist/{chunk-3yz7fafy.js → chunk-5wcgg5t4.js} +1 -1
  28. package/dist/chunk-5z9a1vzw.js +2 -0
  29. package/dist/chunk-67jf2e8x.js +2 -0
  30. package/dist/chunk-6b7je8dc.js +2 -0
  31. package/dist/chunk-6fxjs3ay.js +3 -0
  32. package/dist/chunk-6n5jnd97.js +2 -0
  33. package/dist/chunk-6wvnfdqq.js +2 -0
  34. package/dist/{chunk-6qtzwqgc.js → chunk-6ywa41tr.js} +2 -2
  35. package/dist/{chunk-vzn029zn.js → chunk-73b6sst8.js} +3 -3
  36. package/dist/chunk-78jkbaz3.js +2 -0
  37. package/dist/{chunk-g7shwb6q.js → chunk-7djnbbeb.js} +6 -6
  38. package/dist/chunk-7e9hfrtb.js +2 -0
  39. package/dist/{chunk-g1sqap6x.js → chunk-7mm5mvg0.js} +2 -2
  40. package/dist/{chunk-g019qe9x.js → chunk-7r5vhqtz.js} +4 -4
  41. package/dist/chunk-7tc5fj96.js +2 -0
  42. package/dist/{chunk-myr79xxf.js → chunk-7ycf8a8d.js} +2 -2
  43. package/dist/{chunk-r3v1zaj0.js → chunk-81ysx0tc.js} +2 -2
  44. package/dist/chunk-82q0fy52.js +2 -0
  45. package/dist/chunk-8q5ec4s1.js +2 -0
  46. package/dist/{chunk-ext2gx7h.js → chunk-8w0cwcvk.js} +81 -81
  47. package/dist/{chunk-1mra8ejy.js → chunk-8wbcy0cn.js} +3 -3
  48. package/dist/{chunk-tn6gp72a.js → chunk-8wbgq43c.js} +3 -3
  49. package/dist/chunk-8ysk095d.js +2 -0
  50. package/dist/{chunk-hnzfzm0k.js → chunk-90gx5qxn.js} +4 -4
  51. package/dist/{chunk-h7y2pmd9.js → chunk-9q1kkfv1.js} +6 -6
  52. package/dist/{chunk-hc6m2t92.js → chunk-9r3ehqtx.js} +2 -2
  53. package/dist/chunk-9vbrj55v.js +2 -0
  54. package/dist/chunk-bcefawtc.js +2 -0
  55. package/dist/chunk-bd6s91p9.js +2 -0
  56. package/dist/chunk-bhkqzz91.js +2 -0
  57. package/dist/{chunk-36yq547r.js → chunk-bkkwdh13.js} +2 -2
  58. package/dist/chunk-bx1mjwhb.js +2 -0
  59. package/dist/{chunk-bd4c8af4.js → chunk-c3dphs36.js} +1 -1
  60. package/dist/{chunk-rt5as4t6.js → chunk-c85j39f7.js} +3 -3
  61. package/dist/{chunk-snfmgp7a.js → chunk-cb4ybh7g.js} +4 -4
  62. package/dist/{chunk-41yjah34.js → chunk-cmaxdd8d.js} +2 -2
  63. package/dist/{chunk-amwxbvdp.js → chunk-d2vsw1j7.js} +2 -2
  64. package/dist/{chunk-t9zvpsn7.js → chunk-d73hh5ar.js} +1 -1
  65. package/dist/{chunk-rzqd4t77.js → chunk-df8cbgf0.js} +2 -2
  66. package/dist/{chunk-8mkxge3a.js → chunk-dvakr9p9.js} +4 -4
  67. package/dist/chunk-dw0m259e.js +2 -0
  68. package/dist/chunk-dx4g2ec9.js +2 -0
  69. package/dist/chunk-evdskc25.js +2 -0
  70. package/dist/{chunk-neh3kewg.js → chunk-fa3ygt8c.js} +4 -4
  71. package/dist/{chunk-7p9nczea.js → chunk-fmxtnva8.js} +2 -2
  72. package/dist/{chunk-k7p9wkw3.js → chunk-fxftc455.js} +2 -2
  73. package/dist/{chunk-f66c2nzj.js → chunk-g223zsce.js} +3 -3
  74. package/dist/{chunk-vfe8xj8g.js → chunk-g22absm0.js} +2 -2
  75. package/dist/{chunk-dg1h0d9r.js → chunk-g45p4y4v.js} +3 -3
  76. package/dist/{chunk-6j2h3vf1.js → chunk-g5sctfwa.js} +10 -10
  77. package/dist/chunk-gppv6fez.js +2 -0
  78. package/dist/chunk-grjr8shp.js +2 -0
  79. package/dist/chunk-gz1w4cpp.js +2 -0
  80. package/dist/chunk-gzbmfwxr.js +42 -0
  81. package/dist/chunk-h0qtmmq3.js +2 -0
  82. package/dist/{chunk-tqp1pg1k.js → chunk-h6sewvt2.js} +4 -4
  83. package/dist/chunk-hb34m4pp.js +2 -0
  84. package/dist/chunk-hwvtpx3p.js +2 -0
  85. package/dist/{chunk-312jcg9x.js → chunk-j2hm8v8b.js} +4 -4
  86. package/dist/{chunk-8kdk28b4.js → chunk-j3d9zknp.js} +6 -6
  87. package/dist/{chunk-m8jfjzwb.js → chunk-j5p191zq.js} +7 -7
  88. package/dist/chunk-k3kav39s.js +2 -0
  89. package/dist/chunk-k46j2maz.js +2 -0
  90. package/dist/{chunk-mdsrnd6s.js → chunk-k4dn3ry6.js} +4 -4
  91. package/dist/{chunk-6268m3ss.js → chunk-k9m36nyw.js} +5 -5
  92. package/dist/chunk-ka2f844k.js +2 -0
  93. package/dist/chunk-kh4dr6gd.js +2 -0
  94. package/dist/{chunk-cnqhxt5y.js → chunk-kjfzkac7.js} +7 -7
  95. package/dist/{chunk-v4dswyqt.js → chunk-m0shnhth.js} +3 -3
  96. package/dist/{chunk-qeh8f4bk.js → chunk-m6w75sq2.js} +2 -2
  97. package/dist/{chunk-8ckjb7w8.js → chunk-mpmx0n3q.js} +28 -28
  98. package/dist/chunk-myd82d80.js +2 -0
  99. package/dist/chunk-nek0q523.js +130 -0
  100. package/dist/{chunk-4nmb776w.js → chunk-nmy72s6r.js} +2 -2
  101. package/dist/{chunk-pew1jk57.js → chunk-np8knskz.js} +1 -1
  102. package/dist/{chunk-5s8bt976.js → chunk-nsjkmpjf.js} +1 -1
  103. package/dist/chunk-nvbjcgzd.js +2 -0
  104. package/dist/{chunk-664tnv9e.js → chunk-nzy4set0.js} +5 -5
  105. package/dist/chunk-p13dxvaj.js +2 -0
  106. package/dist/{chunk-6fhcmg96.js → chunk-p2v0r96k.js} +2 -2
  107. package/dist/{chunk-qn580gr9.js → chunk-p33w8zst.js} +3 -3
  108. package/dist/chunk-pht5z7wa.js +2 -0
  109. package/dist/{chunk-x2w2m5fs.js → chunk-ppvdbstz.js} +3 -3
  110. package/dist/chunk-pwdk7jbx.js +2 -0
  111. package/dist/{chunk-ecf9tftk.js → chunk-pydmzvpq.js} +1 -1
  112. package/dist/{chunk-ftk2jdg8.js → chunk-q0f28539.js} +2 -2
  113. package/dist/chunk-qekyxjy6.js +2 -0
  114. package/dist/{chunk-fgg1stc0.js → chunk-qpb80r4b.js} +2 -2
  115. package/dist/{chunk-smpb39kv.js → chunk-qxrsm48h.js} +5 -5
  116. package/dist/chunk-r10eadgn.js +2 -0
  117. package/dist/chunk-r8184e10.js +2 -0
  118. package/dist/{chunk-n3g8fy3f.js → chunk-rshaz0df.js} +1 -1
  119. package/dist/{chunk-r6s35xw9.js → chunk-sj2a5twe.js} +2 -2
  120. package/dist/chunk-tcrpa52j.js +2 -0
  121. package/dist/{chunk-t6d7t825.js → chunk-thr1m7k7.js} +18 -18
  122. package/dist/{chunk-jk1kg30f.js → chunk-txgd0sj1.js} +5 -5
  123. package/dist/{chunk-tary163t.js → chunk-v0s52tmv.js} +2 -2
  124. package/dist/{chunk-fvbgbmm4.js → chunk-vc4jww9y.js} +13 -13
  125. package/dist/chunk-vp1p250v.js +2 -0
  126. package/dist/{chunk-mcdwjq8t.js → chunk-vpa4xzz3.js} +1 -1
  127. package/dist/chunk-vqrg5j83.js +2 -0
  128. package/dist/chunk-vzdfq3b5.js +2 -0
  129. package/dist/chunk-wzh4ene8.js +2 -0
  130. package/dist/{chunk-9rwqhrgw.js → chunk-x5sy0tym.js} +6 -6
  131. package/dist/chunk-x5vwkccx.js +2 -0
  132. package/dist/chunk-x6cmj5sa.js +2 -0
  133. package/dist/chunk-xnrfz4c3.js +2 -0
  134. package/dist/{chunk-5bkha4ej.js → chunk-xrzghjvy.js} +2 -2
  135. package/dist/{chunk-evpyaw33.js → chunk-xzz36k99.js} +2 -2
  136. package/dist/chunk-yaabhcss.js +2 -0
  137. package/dist/chunk-yazqtmq4.js +2 -0
  138. package/dist/{chunk-178recpt.js → chunk-yd2nj0rv.js} +1 -1
  139. package/dist/{chunk-0p6fpsw5.js → chunk-z5kdmget.js} +3 -3
  140. package/dist/{chunk-z0tnqt43.js → chunk-zqmvhg37.js} +10 -10
  141. package/dist/chunk-zygpvm1x.js +2 -0
  142. package/dist/chunk-zz247c1r.js +2 -0
  143. package/dist/cli.js +19 -19
  144. package/dist/component-image-usage.d.ts +2 -0
  145. package/dist/component-image-usage.js +13 -0
  146. package/dist/component-renderer.js +7 -2
  147. package/dist/craft-entry.js +2 -2
  148. package/dist/craft.js +2 -2
  149. package/dist/native/compiler/inline-style.js +16 -6
  150. package/dist/native/compiler/ir.d.ts +2 -0
  151. package/dist/native/compiler/render-screen.js +1 -1
  152. package/dist/native/components/primitives.d.ts +2 -0
  153. package/dist/native/prop-names.js +2 -0
  154. package/dist/native/runtime/browser-renderer.js +6 -0
  155. package/dist/pwa.js +3 -3
  156. package/dist/ssg.js +4 -4
  157. package/dist/utils.js +2 -1
  158. package/package.json +5 -5
  159. package/dist/chunk-02kkd7fy.js +0 -2
  160. package/dist/chunk-051evb5w.js +0 -2
  161. package/dist/chunk-0qqsnhz1.js +0 -2
  162. package/dist/chunk-0vmyr7kz.js +0 -2
  163. package/dist/chunk-1019v091.js +0 -2
  164. package/dist/chunk-1h9mcnvn.js +0 -2
  165. package/dist/chunk-1kdtapc1.js +0 -2
  166. package/dist/chunk-3a42s01p.js +0 -2
  167. package/dist/chunk-3w3avjyv.js +0 -2
  168. package/dist/chunk-59512t1y.js +0 -2
  169. package/dist/chunk-5w3qwnqc.js +0 -2
  170. package/dist/chunk-6561951c.js +0 -2
  171. package/dist/chunk-65wvwbnm.js +0 -2
  172. package/dist/chunk-69pcfw3y.js +0 -2
  173. package/dist/chunk-6jtjhx7w.js +0 -2
  174. package/dist/chunk-6x112bw3.js +0 -2
  175. package/dist/chunk-8kmhzsn7.js +0 -2
  176. package/dist/chunk-8wnjaz0x.js +0 -2
  177. package/dist/chunk-a6cwnhcw.js +0 -2
  178. package/dist/chunk-b5xc3cvz.js +0 -2
  179. package/dist/chunk-bwhv3fhm.js +0 -2
  180. package/dist/chunk-c7v9tw77.js +0 -2
  181. package/dist/chunk-cgyddqxw.js +0 -2
  182. package/dist/chunk-cs5gf4zp.js +0 -2
  183. package/dist/chunk-dex01879.js +0 -2
  184. package/dist/chunk-dkeceysd.js +0 -2
  185. package/dist/chunk-e1n4shdk.js +0 -2
  186. package/dist/chunk-e82k0mkx.js +0 -2
  187. package/dist/chunk-ejp9rg4j.js +0 -42
  188. package/dist/chunk-er1dnztv.js +0 -2
  189. package/dist/chunk-f0kbpzbb.js +0 -2
  190. package/dist/chunk-f83dksbn.js +0 -2
  191. package/dist/chunk-fcm67yad.js +0 -2
  192. package/dist/chunk-fk7gs41v.js +0 -2
  193. package/dist/chunk-g4gnq2zj.js +0 -2
  194. package/dist/chunk-gsawyk8q.js +0 -2
  195. package/dist/chunk-ha0ecbc9.js +0 -3
  196. package/dist/chunk-j0emb851.js +0 -2
  197. package/dist/chunk-k83z4nyg.js +0 -2
  198. package/dist/chunk-kg4zjb7a.js +0 -2
  199. package/dist/chunk-mjam7gyj.js +0 -2
  200. package/dist/chunk-nhm3qamb.js +0 -2
  201. package/dist/chunk-p2pbfen5.js +0 -2
  202. package/dist/chunk-pzryv3sz.js +0 -2
  203. package/dist/chunk-rhygq40y.js +0 -2
  204. package/dist/chunk-s4fr9cx8.js +0 -2
  205. package/dist/chunk-sp5c1pgg.js +0 -2
  206. package/dist/chunk-tyb22n6n.js +0 -2
  207. package/dist/chunk-vqjbqm6c.js +0 -2
  208. package/dist/chunk-vw6vw9gw.js +0 -2
  209. package/dist/chunk-vyznvnew.js +0 -2
  210. package/dist/chunk-xa1hsasb.js +0 -2
  211. package/dist/chunk-xc03bd64.js +0 -2
  212. package/dist/chunk-y100kb3n.js +0 -2
  213. package/dist/chunk-ycxwf633.js +0 -2
  214. package/dist/chunk-ydx3j69d.js +0 -2
  215. package/dist/chunk-ymbdctx1.js +0 -2
  216. package/dist/chunk-yp49yswk.js +0 -130
  217. package/dist/chunk-yq3p5y7y.js +0 -2
  218. package/dist/chunk-z3ggbhhc.js +0 -2
  219. package/dist/chunk-z5tejqpn.js +0 -2
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{k}from"./chunk-ext2gx7h.js";import{le}from"./chunk-rzqd4t77.js";function g(e,t){let r={};for(let n of e)r[n]=le(t(n));return new Proxy({},{get:(n,a)=>r[a]?.(),set:(n,a,o)=>{if(r[a])r[a].set(o);else r[a]=le(o);return!0},has:(n,a)=>(a in r),deleteProperty:(n,a)=>(delete r[a],!0),ownKeys:()=>Reflect.ownKeys(r),getOwnPropertyDescriptor:(n,a)=>(a in r)?{enumerable:!0,configurable:!0,writable:!0,value:r[a]()}:void 0})}function v(e,t){let r={};for(let n of t)r[n]=e[n];return r}function ia(e,t){let r=Object.keys(e),n=g(r,(i)=>t?.[i]??e[i].getDefaultValue()),a=g(r,()=>[]),o=g(r,()=>!1),c=g(r,()=>!1),f=g(r,()=>!1),s=le(!1);async function u(i){f[i]=!0;let d=await e[i].validate(n[i],n);return a[i]=d,f[i]=!1,d.length===0}async function l(){s.set(!0);let i=await Promise.all(r.map(u));return s.set(!1),i.every(Boolean)}function m(){for(let i of r)n[i]=t?.[i]??e[i].getDefaultValue(),a[i]=[],o[i]=!1,c[i]=!1}function h(i){for(let d of r)if(d in i)n[d]=i[d],c[d]=!0}function b(i,d){n[i]=d,c[i]=!0}function y(i,d=!0){if(o[i]=d,d)u(i)}function p(i){return{value:n[i],errors:a[i],touched:o[i],dirty:c[i],valid:a[i].length===0,validating:f[i]}}function V(i){return async(d)=>{d?.preventDefault?.();for(let w of r)o[w]=!0;if(await l())await i(v(n,r))}}return{values:n,errors:a,touched:o,dirty:c,get isValid(){return r.every((i)=>a[i].length===0)},get isValidating(){return s()||r.some((i)=>f[i])},get isDirty(){return r.some((i)=>c[i])},validate:l,validateField:u,reset:m,setValues:h,setFieldValue:b,setFieldTouched:y,getFieldState:p,handleSubmit:V}}var ql=ia;class jn{rules=[];defaultValue="";addRule(e){let t=new jn;return t.rules=[...this.rules,e],t.defaultValue=this.defaultValue,t}required(e="This field is required"){return this.addRule({name:"required",message:e,validate:(t)=>{if(t===null||t===void 0)return e;if(typeof t==="string"&&t.trim()==="")return e;if(Array.isArray(t)&&t.length===0)return e;return!0}})}email(e="Please enter a valid email"){return this.addRule({name:"email",message:e,validate:(t)=>{if(!t)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(t))||e}})}url(e="Please enter a valid URL"){return this.addRule({name:"url",message:e,validate:(t)=>{if(!t)return!0;try{return new URL(String(t)),!0}catch{return e}}})}min(e,t){let r=t||`Must be at least ${e} characters`;return this.addRule({name:"min",message:r,validate:(n)=>{if(!n)return!0;return String(n).length>=e||r}})}max(e,t){let r=t||`Must be no more than ${e} characters`;return this.addRule({name:"max",message:r,validate:(n)=>{if(!n)return!0;return String(n).length<=e||r}})}length(e,t,r){let n=r||`Must be between ${e} and ${t} characters`;return this.addRule({name:"length",message:n,validate:(a)=>{if(!a)return!0;let o=String(a).length;return o>=e&&o<=t||n}})}pattern(e,t="Invalid format"){return this.addRule({name:"pattern",message:t,validate:(r)=>{if(!r)return!0;return e.test(String(r))||t}})}hasUppercase(e="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,e)}hasLowercase(e="Must contain a lowercase letter"){return this.pattern(/[a-z]/,e)}hasNumber(e="Must contain a number"){return this.pattern(/\d/,e)}hasSpecial(e="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,e)}alphanumeric(e="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,e)}startsWithLetter(e="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,e)}noSpaces(e="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:e,validate:(t)=>{if(!t)return!0;return!String(t).includes(" ")||e}})}number(e="Must be a number"){let t=this.addRule({name:"number",message:e,validate:(r)=>{if(!r&&r!==0)return!0;return!Number.isNaN(Number(r))||e}});return t.defaultValue=0,t}integer(e="Must be a whole number"){return this.addRule({name:"integer",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number.isInteger(Number(t))||e}})}positive(e="Must be a positive number"){return this.addRule({name:"positive",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)>0||e}})}negative(e="Must be a negative number"){return this.addRule({name:"negative",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)<0||e}})}minValue(e,t){let r=t||`Must be at least ${e}`;return this.addRule({name:"minValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)>=e||r}})}maxValue(e,t){let r=t||`Must be no more than ${e}`;return this.addRule({name:"maxValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)<=e||r}})}between(e,t,r){let n=r||`Must be between ${e} and ${t}`;return this.addRule({name:"between",message:n,validate:(a)=>{if(!a&&a!==0)return!0;let o=Number(a);return o>=e&&o<=t||n}})}matches(e,t){let r=t||`Must match ${e}`;return this.addRule({name:"matches",message:r,validate:(n,a)=>{if(!a)return!0;return n===a[e]||r}})}oneOf(e,t){let r=t||`Must be one of: ${e.join(", ")}`;return this.addRule({name:"oneOf",message:r,validate:(n)=>{if(!n)return!0;return e.includes(n)||r}})}notOneOf(e,t){let r=t||`Cannot be one of: ${e.join(", ")}`;return this.addRule({name:"notOneOf",message:r,validate:(n)=>{if(!n)return!0;return!e.includes(n)||r}})}date(e="Must be a valid date"){return this.addRule({name:"date",message:e,validate:(t)=>{if(!t)return!0;let r=new Date(String(t));return!Number.isNaN(r.getTime())||e}})}before(e,t){let r=new Date(e),n=t||`Must be before ${r.toLocaleDateString()}`;return this.addRule({name:"before",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))<r||n}})}after(e,t){let r=new Date(e),n=t||`Must be after ${r.toLocaleDateString()}`;return this.addRule({name:"after",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))>r||n}})}custom(e,t="Invalid value"){return this.addRule({name:"custom",message:t,validate:e})}async(e,t="Invalid value"){return this.addRule({name:"async",message:t,async:!0,validate:e})}when(e,t){let r=new jn;r.rules=[...this.rules],r.defaultValue=this.defaultValue;for(let n of t.getRules())r.rules.push({...n,validate:(a,o)=>{if(!e(a,o||{}))return!0;return n.validate(a,o)}});return r}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(e){let t=new jn;return t.rules=[...this.rules],t.defaultValue=e,t}async validate(e,t){let r=[];for(let n of this.rules){let a=await n.validate(e,t);if(a!==!0)r.push(a)}return r}validateSync(e,t){let r=[];for(let n of this.rules){if(n.async)continue;let a=n.validate(e,t);if(a!==!0)r.push(a)}return r}}var Zg=new jn;function Kl(e,t,r){let n=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>k(c,{...t,message:l},r)).join(`
3
- `)}catch{return""}})}function Gl(e,t,r){let n=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>k(c,{...t,message:l},r)).join(`
4
- `)}catch{return""}})}function Xl(e,t,r){let n=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return c}catch{return""}})}function Qg(e,t,r){let n=e;return n=Kl(n,t,r),n=Gl(n,t,r),n=Xl(n,t,r),n}export{ia,ql,jn,Zg,Kl,Gl,Xl,Qg};
2
+ import{k}from"./chunk-8w0cwcvk.js";import{le}from"./chunk-df8cbgf0.js";function g(e,t){let r={};for(let n of e)r[n]=le(t(n));return new Proxy({},{get:(n,a)=>r[a]?.(),set:(n,a,o)=>{if(r[a])r[a].set(o);else r[a]=le(o);return!0},has:(n,a)=>(a in r),deleteProperty:(n,a)=>(delete r[a],!0),ownKeys:()=>Reflect.ownKeys(r),getOwnPropertyDescriptor:(n,a)=>(a in r)?{enumerable:!0,configurable:!0,writable:!0,value:r[a]()}:void 0})}function v(e,t){let r={};for(let n of t)r[n]=e[n];return r}function aa(e,t){let r=Object.keys(e),n=g(r,(i)=>t?.[i]??e[i].getDefaultValue()),a=g(r,()=>[]),o=g(r,()=>!1),c=g(r,()=>!1),f=g(r,()=>!1),s=le(!1);async function u(i){f[i]=!0;let d=await e[i].validate(n[i],n);return a[i]=d,f[i]=!1,d.length===0}async function l(){s.set(!0);let i=await Promise.all(r.map(u));return s.set(!1),i.every(Boolean)}function m(){for(let i of r)n[i]=t?.[i]??e[i].getDefaultValue(),a[i]=[],o[i]=!1,c[i]=!1}function h(i){for(let d of r)if(d in i)n[d]=i[d],c[d]=!0}function b(i,d){n[i]=d,c[i]=!0}function y(i,d=!0){if(o[i]=d,d)u(i)}function p(i){return{value:n[i],errors:a[i],touched:o[i],dirty:c[i],valid:a[i].length===0,validating:f[i]}}function V(i){return async(d)=>{d?.preventDefault?.();for(let w of r)o[w]=!0;if(await l())await i(v(n,r))}}return{values:n,errors:a,touched:o,dirty:c,get isValid(){return r.every((i)=>a[i].length===0)},get isValidating(){return s()||r.some((i)=>f[i])},get isDirty(){return r.some((i)=>c[i])},validate:l,validateField:u,reset:m,setValues:h,setFieldValue:b,setFieldTouched:y,getFieldState:p,handleSubmit:V}}var Kl=aa;class jn{rules=[];defaultValue="";addRule(e){let t=new jn;return t.rules=[...this.rules,e],t.defaultValue=this.defaultValue,t}required(e="This field is required"){return this.addRule({name:"required",message:e,validate:(t)=>{if(t===null||t===void 0)return e;if(typeof t==="string"&&t.trim()==="")return e;if(Array.isArray(t)&&t.length===0)return e;return!0}})}email(e="Please enter a valid email"){return this.addRule({name:"email",message:e,validate:(t)=>{if(!t)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(t))||e}})}url(e="Please enter a valid URL"){return this.addRule({name:"url",message:e,validate:(t)=>{if(!t)return!0;try{return new URL(String(t)),!0}catch{return e}}})}min(e,t){let r=t||`Must be at least ${e} characters`;return this.addRule({name:"min",message:r,validate:(n)=>{if(!n)return!0;return String(n).length>=e||r}})}max(e,t){let r=t||`Must be no more than ${e} characters`;return this.addRule({name:"max",message:r,validate:(n)=>{if(!n)return!0;return String(n).length<=e||r}})}length(e,t,r){let n=r||`Must be between ${e} and ${t} characters`;return this.addRule({name:"length",message:n,validate:(a)=>{if(!a)return!0;let o=String(a).length;return o>=e&&o<=t||n}})}pattern(e,t="Invalid format"){return this.addRule({name:"pattern",message:t,validate:(r)=>{if(!r)return!0;return e.test(String(r))||t}})}hasUppercase(e="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,e)}hasLowercase(e="Must contain a lowercase letter"){return this.pattern(/[a-z]/,e)}hasNumber(e="Must contain a number"){return this.pattern(/\d/,e)}hasSpecial(e="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,e)}alphanumeric(e="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,e)}startsWithLetter(e="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,e)}noSpaces(e="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:e,validate:(t)=>{if(!t)return!0;return!String(t).includes(" ")||e}})}number(e="Must be a number"){let t=this.addRule({name:"number",message:e,validate:(r)=>{if(!r&&r!==0)return!0;return!Number.isNaN(Number(r))||e}});return t.defaultValue=0,t}integer(e="Must be a whole number"){return this.addRule({name:"integer",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number.isInteger(Number(t))||e}})}positive(e="Must be a positive number"){return this.addRule({name:"positive",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)>0||e}})}negative(e="Must be a negative number"){return this.addRule({name:"negative",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)<0||e}})}minValue(e,t){let r=t||`Must be at least ${e}`;return this.addRule({name:"minValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)>=e||r}})}maxValue(e,t){let r=t||`Must be no more than ${e}`;return this.addRule({name:"maxValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)<=e||r}})}between(e,t,r){let n=r||`Must be between ${e} and ${t}`;return this.addRule({name:"between",message:n,validate:(a)=>{if(!a&&a!==0)return!0;let o=Number(a);return o>=e&&o<=t||n}})}matches(e,t){let r=t||`Must match ${e}`;return this.addRule({name:"matches",message:r,validate:(n,a)=>{if(!a)return!0;return n===a[e]||r}})}oneOf(e,t){let r=t||`Must be one of: ${e.join(", ")}`;return this.addRule({name:"oneOf",message:r,validate:(n)=>{if(!n)return!0;return e.includes(n)||r}})}notOneOf(e,t){let r=t||`Cannot be one of: ${e.join(", ")}`;return this.addRule({name:"notOneOf",message:r,validate:(n)=>{if(!n)return!0;return!e.includes(n)||r}})}date(e="Must be a valid date"){return this.addRule({name:"date",message:e,validate:(t)=>{if(!t)return!0;let r=new Date(String(t));return!Number.isNaN(r.getTime())||e}})}before(e,t){let r=new Date(e),n=t||`Must be before ${r.toLocaleDateString()}`;return this.addRule({name:"before",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))<r||n}})}after(e,t){let r=new Date(e),n=t||`Must be after ${r.toLocaleDateString()}`;return this.addRule({name:"after",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))>r||n}})}custom(e,t="Invalid value"){return this.addRule({name:"custom",message:t,validate:e})}async(e,t="Invalid value"){return this.addRule({name:"async",message:t,async:!0,validate:e})}when(e,t){let r=new jn;r.rules=[...this.rules],r.defaultValue=this.defaultValue;for(let n of t.getRules())r.rules.push({...n,validate:(a,o)=>{if(!e(a,o||{}))return!0;return n.validate(a,o)}});return r}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(e){let t=new jn;return t.rules=[...this.rules],t.defaultValue=e,t}async validate(e,t){let r=[];for(let n of this.rules){let a=await n.validate(e,t);if(a!==!0)r.push(a)}return r}validateSync(e,t){let r=[];for(let n of this.rules){if(n.async)continue;let a=n.validate(e,t);if(a!==!0)r.push(a)}return r}}var Qg=new jn;function Gl(e,t,r){let n=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>k(c,{...t,message:l},r)).join(`
3
+ `)}catch{return""}})}function Xl(e,t,r){let n=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>k(c,{...t,message:l},r)).join(`
4
+ `)}catch{return""}})}function Jl(e,t,r){let n=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return c}catch{return""}})}function em(e,t,r){let n=e;return n=Gl(n,t,r),n=Xl(n,t,r),n=Jl(n,t,r),n}export{aa,Kl,jn,Qg,Gl,Xl,Jl,em};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{pi,js,u,f,R,nt,d,Bs,t,c,b}from"./chunk-5hrm7rtx.js";import{ve,Rt,J,I,Nt,Z,k}from"./chunk-ext2gx7h.js";import{sr}from"./chunk-cnqhxt5y.js";import{se}from"./chunk-tary163t.js";import{ls}from"./chunk-5s8bt976.js";var de=1000,pe=!1;function he(n,r){let l=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,e="",o=0,i;while((i=l.exec(n))!==null){let g=i.index+i[0].length,y=i.index+i[0].indexOf("("),x=b(n,"(",")",y);if(x===-1)continue;let p=n.slice(g,x).trim();if(!p)continue;if(!Object.keys(r).some((a)=>new RegExp(`(?:^|[^\\w$.])${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(p)))continue;let m;try{let a=R(p,r);if(!a||typeof a!=="object")continue;m=JSON.stringify(a)}catch{continue}e+=n.slice(o,g)+m,o=x,l.lastIndex=x}return o===0?n:e+n.slice(o)}function me(n,r){let l=/@component\s*\(/g,e=n,o,i=[];while((o=l.exec(e))!==null){let g=o.index,y=g+o[0].length-1,x=1,p=y+1;while(p<e.length&&x>0){if(e[p]==="(")x++;else if(e[p]===")"){if(x--,x===0)break}p++}if(x!==0)continue;let s=e.substring(y+1,p),m=p+1,a=s.match(/^\s*['"]([^'"]+)['"]/);if(!a)continue;let E=a[1],h=s.slice(a[0].length),w=h.match(/^\s*,\s*/);if(!w)continue;let S=h.slice(w[0].length).trim();if(!S)continue;try{let v=R(S,r),W=JSON.stringify(v),F=`@component('${E}', ${W})`;i.push({start:g,end:m,replacement:F})}catch{continue}}for(let g=i.length-1;g>=0;g--){let{start:y,end:x,replacement:p}=i[g];e=e.substring(0,y)+p+e.substring(x)}return e}function oe(n,r,l){let e=n,o=new RegExp(`${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),i;while((i=o.exec(e))!==null){let g=i.index,y=g+i[0].length-1,x=1,p=y+1,s=null,m=!1;while(p<e.length&&x>0){let h=e[p];if(m){m=!1,p++;continue}if(h==="\\"&&s){m=!0,p++;continue}if(s){if(h===s)s=null;p++;continue}if(h==='"'||h==="'"||h==="`"){s=h,p++;continue}if(h==="(")x++;else if(h===")"){if(x--,x===0)break}p++}if(x!==0)break;let a=e.substring(y+1,p),E=l(a);e=e.substring(0,g)+E+e.substring(p+1)}return e}function be(n,r){let l=n;return l=l.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(e,o)=>{if(o in r)return`:${o}="${o}"`;return e}),l=l.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(e,o,i)=>{try{if(I(i,r.__stx_client_signal_names||[]))return e;let g=Object.keys(r),y=Object.values(r);pi(i);let x=!1,s=d(i,g,()=>{x=!0})(...y);if(x)return e;let m=JSON.stringify(s);if(m===void 0){if(!nt(i).some((h)=>!(h in r)))return"";return e}let a=Buffer.from(m,"utf8").toString("base64");return`__stx_${o}="${a}"`}catch(g){return e}}),l}var ee="<!--__STX_BREAK__-->",ne="<!--__STX_CONTINUE__-->";function le(n,r){let l=/\{\{\{?|\{!!|@(break|continue)(?![\w$])/g,e="",o=0;for(let i=l.exec(n);i;i=l.exec(n)){if(!i[1]){let p=i[0].length===3&&i[0]==="{{{"?3:2,s=i[0]==="{!!"?n.indexOf("!!}",l.lastIndex):ve(n,i.index,p);if(s<0)break;l.lastIndex=s+(i[0]==="{!!"?3:p);continue}let g=l.lastIndex,y=!0,x=/^\s*\(/.exec(n.slice(g));if(x){let p=g+x[0].length-1,s=b(n,"(",")",p);if(s<0)break;g=s+1;try{let m=`!!(${n.slice(p+1,s).trim()})`;y=f(m)?Boolean(d(m,Object.keys(r))(...Object.values(r))):Boolean(u(m,r))}catch{y=!1}}if(e+=n.slice(o,i.index),y)return e+(i[1]==="break"?ee:ne);o=g,l.lastIndex=g}return e+n.slice(o)}function ae(n){let r=(o)=>o.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),l="",e=0;return Nt(n,(o,i,g)=>(l+=ie(r(n.slice(e,g))),l+=`\${__stxRenderLoopValue(${g}, (${i}), ${o.length})}`,e=g+o.length,o)),l+ie(r(n.slice(e)))}function ue(n,r,l,e){return Z(n,r,l==null?"":String(l),!1,e)}function ie(n){let r=n;return r=oe(r,"@break",(l)=>{let e=l.trim();if(!Bs(e))return"";return`\`; if (${e}) { break; } result += \``}),r=oe(r,"@continue",(l)=>{let e=l.trim();if(!Bs(e))return"";return`\`; if (${e}) { continue; } result += \``}),r=r.replace(/@break(?!\()/g,"`; break; result += `"),r=r.replace(/@continue(?!\()/g,"`; continue; result += `"),r}function xe(n){let r=/@forelse\s*\(/g,l,e=[],o=/@foreach\s*\(/g,i=/@endforeach/g,g;while((g=o.exec(n))!==null)e.push({pos:g.index,delta:1});while((g=i.exec(n))!==null)e.push({pos:g.index,delta:-1});e.sort((s,m)=>s.pos-m.pos);let y=[],x=0;for(let s of e)x+=s.delta,y.push({pos:s.pos,depth:x});function p(s){let m=0,a=y.length-1,E=0;while(m<=a){let h=m+a>>1;if(y[h].pos<=s)E=y[h].depth,m=h+1;else a=h-1}return E}while((l=r.exec(n))!==null){if(p(l.index)>0)continue;let s=l.index,m=l.index+l[0].length-1,a=1,E=m+1,h=-1;while(E<n.length&&a>0){if(n[E]==="(")a++;else if(n[E]===")"){if(a--,a===0){h=E;break}}E++}if(h===-1)continue;let w=n.substring(m+1,h),S=Rt(w);if(!S)continue;let{arrayExpr:v,itemVar:W}=S,F=h+1,A=1,B=F,D=/@forelse\s*\(/g,L=/@endforelse/g,V=-1;while(A>0&&B<n.length){D.lastIndex=B,L.lastIndex=B;let P=D.exec(n),_=L.exec(n);if(!_)break;if(P&&P.index<_.index)A++,B=P.index+P[0].length;else{if(A--,A===0){V=_.index;break}B=_.index+11}}if(V===-1)continue;let O=n.substring(F,V),K=V+11,U=-1,z=0,N=0;while(N<O.length){let P=O.indexOf("@",N);if(P===-1)break;let _=O.substring(P);if(/^@forelse\s*\(/.test(_))z++,N=P+1;else if(_.startsWith("@endforelse"))z--,N=P+11;else if(z===0&&_.startsWith("@empty")){if(O.length<=P+6||!/[a-z]/i.test(O[P+6])){U=P;break}N=P+1}else N=P+1}if(U===-1)continue;return{start:s,end:K,arrayExpr:v,itemVar:W,foreachContent:O.substring(0,U),emptyContent:O.substring(U+6)}}return null}function ce(n,r){let l=n;while(!0){let e=xe(l);if(!e)break;let{start:o,end:i,arrayExpr:g,itemVar:y,foreachContent:x,emptyContent:p}=e;try{let s;if(f(g))s=d(g,Object.keys(r))(...Object.values(r));else s=u(g,r);let m;if(!Array.isArray(s)||s.length===0)m=p;else m=`@foreach (${g} as ${y})${x}@endforeach`;l=l.substring(0,o)+m+l.substring(i)}catch(s){let m=s instanceof Error?s.message:String(s),a=c("Forelse",`Error in @forelse(${g} as ${y}): ${m}`,t.EVALUATION_ERROR);l=l.substring(0,o)+a+l.substring(i)}}return l}var fe="<!--stx:foreach-not-iterable:",ye=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function Ee(n,r){return`${fe}${encodeURIComponent(n)}|${encodeURIComponent(r)}-->`}function _e(n,r){console.warn(`[stx] @foreach(${n}) in ${r}: ${n} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function Zr(n){if(!n.includes(fe))return n;return n.replace(ye,(r,l,e)=>(_e(decodeURIComponent(l),decodeURIComponent(e)),""))}function rr(n,r,l,e,o=!1){let i=n,g=new Set(r.__stx_client_signal_names||[]);for(let s of sr(n))g.add(s);if(g.size)r={...r,__stx_client_signal_names:[...g]};i=ce(i,r);function y(s){let m=/@foreach\s*\(/g,a;while((a=m.exec(s))!==null){let E=a.index,h=a.index+a[0].length-1,w=1,S=h+1,v=-1;while(S<s.length&&w>0){if(s[S]==="(")w++;else if(s[S]===")"){if(w--,w===0){v=S;break}}S++}if(v===-1)continue;let W=s.substring(h+1,v),F=Rt(W);if(!F)continue;let A=E,{arrayExpr:B,itemVar:D}=F,L=v+1,V=1,O=L,K=/@foreach\s*\(/g,U=/@endforeach/g;while(V>0&&O<s.length){K.lastIndex=O,U.lastIndex=O;let z=K.exec(s),N=U.exec(s);if(!N)break;if(z&&z.index<N.index)V++,O=z.index+z[0].length;else{if(V--,V===0){let P=s.substring(L,N.index),_=N.index+11;return{start:A,end:_,arrayExpr:B,itemVar:D,content:P}}O=N.index+11}}}return null}function x(s,m){let a=s;while(!0){let E=y(a);if(!E)break;let{start:h,end:w,arrayExpr:S,itemVar:v,content:W}=E;try{let F=S.trim(),A;if(f(F))A=d(F,Object.keys(m))(...Object.values(m));else A=u(F,m);let B=!1;if(!Array.isArray(A))if(A instanceof Map)A=Array.from(A),B=!0;else if(A instanceof Set)A=Array.from(A);else if(typeof A==="string")A=Array.from(A);else if(A&&typeof A==="object"&&!(A instanceof Date)&&!(A instanceof RegExp))A=Object.entries(A),B=!0;else{let _=Ee(F,l)+c("Foreach",`Error in @foreach: ${F} is not iterable`,t.TYPE_ERROR);a=a.substring(0,h)+_+a.substring(w);continue}let D=e?.loops?.useAltLoopVariable??pe,L=v.trim(),V=null,O,K=!1;if(L.includes("=>")){let _=L.split("=>").map((j)=>j.trim());if(_.length===2&&_[0]&&_[1])V=_[0],O=_[1];else O=L}else if(!L.startsWith("[")&&!L.startsWith("{")&&L.includes(",")){let _=L.split(",").map((j)=>j.trim());if(_.length===2&&_[0]&&_[1])O=_[0],V=_[1],K=!0;else O=L}else O=L;let U="",z=new Set(J(`${S} as ${v}`)),N=A,P=m[js]??new WeakMap;for(let _=0;_<N.length;_++){let j=N[_],te={index:_,iteration:_+1,first:_===0,last:_===N.length-1,count:N.length},M={...m,loop:te,$loop:te,[js]:P};if(Array.isArray(m.__stx_client_signal_names))M.__stx_client_signal_names=m.__stx_client_signal_names.filter((H)=>!z.has(H));if(O.startsWith("[")&&O.endsWith("]")){let H=O.slice(1,-1).split(",").map((T)=>T.trim());if(Array.isArray(j))H.forEach((T,X)=>{if(T)M[T]=j[X]});else M[O]=j}else if(O.startsWith("{")&&O.endsWith("}")){let H=O.slice(1,-1).split(",").map((T)=>T.trim()).filter(Boolean);if(j!==null&&typeof j==="object")H.forEach((T)=>{let X=T.indexOf(":"),Q=(X===-1?T:T.slice(0,X)).trim(),re=X===-1?Q:T.slice(X+1).trim();if(Q&&re)M[re]=j[Q]});else M[O]=j}else M[O]=j;if(V)if(!K&&B&&Array.isArray(j)&&j.length===2)M[V]=j[0],M[O]=j[1];else M[V]=_;let C=ce(W,M);C=rr(C,M,l,e,!0),C=se(C,M,l),C=le(C,M);let q=C.indexOf(ee),G=C.indexOf(ne),Y=q<0?G:G<0?q:Math.min(q,G);if(Y>=0)C=C.slice(0,Y);if(C=k(C,M,l),C=be(C,M),C=me(C,M),C=he(C,M),U+=C,Y>=0&&Y===q)break}a=a.substring(0,h)+U+a.substring(w)}catch(F){let A=c("Foreach",`Error in @foreach(${S.trim()} as ${v.trim()}): ${F instanceof Error?F.message:String(F)}`,t.EVALUATION_ERROR);a=a.substring(0,h)+A+a.substring(w)}}return a}i=x(i,r),i=$e(i,r,l,e);let p=e?.loops?.maxWhileIterations??de;return i=we(i,r,p),o?i:Zr(i)}function vf(n){let r=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(n);if(!r||/^(?:const|let|var)$/.test(r[2]))return n;return`${r[1]}let ${n.slice(r[1].length)}`}function ge(n){return Bs(n)}function $e(n,r,l,e){let o=n,i=!0;while(i){i=!1;let g=o.match(/@for\s*\(/);if(!g||g.index===void 0)break;let y=g.index,x=y+g[0].length-1,p=b(o,"(",")",x);if(p===-1)break;let s=vf(o.slice(x+1,p)),m=p+1,a=ls(o.slice(y),"for","endfor");if(a.length===0)break;let E=a[0].content,h=y+a[0].end;if(!ge(s)){let w=c("For",`Unsafe expression in @for: ${s}`,t.UNSAFE_EXPRESSION);o=o.substring(0,y)+w+o.substring(h),i=!0;continue}try{let w=Ae(s),S=/@(?:for|foreach|if|unless)\s*\(/.test(E);if(w.length>0&&S){let D=Re({forExpr:s,content:E,iterVarNames:w,context:r,filePath:l,options:e});o=o.substring(0,y)+D+o.substring(h),i=!0;continue}let v=Object.keys(r),W=Object.values(r),F=ae(E),B=Function(...v,"__stxRenderLoopValue",`
2
+ import{fi,Bs,u,f,R,nt,d,Fs,t,c,b}from"./chunk-0tgrqhkr.js";import{ve,Rt,J,I,Nt,Z,k}from"./chunk-8w0cwcvk.js";import{sr}from"./chunk-kjfzkac7.js";import{se}from"./chunk-v0s52tmv.js";import{us}from"./chunk-nsjkmpjf.js";var de=1000,pe=!1;function he(n,r){let l=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,e="",o=0,i;while((i=l.exec(n))!==null){let g=i.index+i[0].length,y=i.index+i[0].indexOf("("),x=b(n,"(",")",y);if(x===-1)continue;let p=n.slice(g,x).trim();if(!p)continue;if(!Object.keys(r).some((a)=>new RegExp(`(?:^|[^\\w$.])${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(p)))continue;let m;try{let a=R(p,r);if(!a||typeof a!=="object")continue;m=JSON.stringify(a)}catch{continue}e+=n.slice(o,g)+m,o=x,l.lastIndex=x}return o===0?n:e+n.slice(o)}function me(n,r){let l=/@component\s*\(/g,e=n,o,i=[];while((o=l.exec(e))!==null){let g=o.index,y=g+o[0].length-1,x=1,p=y+1;while(p<e.length&&x>0){if(e[p]==="(")x++;else if(e[p]===")"){if(x--,x===0)break}p++}if(x!==0)continue;let s=e.substring(y+1,p),m=p+1,a=s.match(/^\s*['"]([^'"]+)['"]/);if(!a)continue;let E=a[1],h=s.slice(a[0].length),w=h.match(/^\s*,\s*/);if(!w)continue;let S=h.slice(w[0].length).trim();if(!S)continue;try{let v=R(S,r),W=JSON.stringify(v),F=`@component('${E}', ${W})`;i.push({start:g,end:m,replacement:F})}catch{continue}}for(let g=i.length-1;g>=0;g--){let{start:y,end:x,replacement:p}=i[g];e=e.substring(0,y)+p+e.substring(x)}return e}function oe(n,r,l){let e=n,o=new RegExp(`${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),i;while((i=o.exec(e))!==null){let g=i.index,y=g+i[0].length-1,x=1,p=y+1,s=null,m=!1;while(p<e.length&&x>0){let h=e[p];if(m){m=!1,p++;continue}if(h==="\\"&&s){m=!0,p++;continue}if(s){if(h===s)s=null;p++;continue}if(h==='"'||h==="'"||h==="`"){s=h,p++;continue}if(h==="(")x++;else if(h===")"){if(x--,x===0)break}p++}if(x!==0)break;let a=e.substring(y+1,p),E=l(a);e=e.substring(0,g)+E+e.substring(p+1)}return e}function be(n,r){let l=n;return l=l.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(e,o)=>{if(o in r)return`:${o}="${o}"`;return e}),l=l.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(e,o,i)=>{try{if(I(i,r.__stx_client_signal_names||[]))return e;let g=Object.keys(r),y=Object.values(r);fi(i);let x=!1,s=d(i,g,()=>{x=!0})(...y);if(x)return e;let m=JSON.stringify(s);if(m===void 0){if(!nt(i).some((h)=>!(h in r)))return"";return e}let a=Buffer.from(m,"utf8").toString("base64");return`__stx_${o}="${a}"`}catch(g){return e}}),l}var ee="<!--__STX_BREAK__-->",ne="<!--__STX_CONTINUE__-->";function le(n,r){let l=/\{\{\{?|\{!!|@(break|continue)(?![\w$])/g,e="",o=0;for(let i=l.exec(n);i;i=l.exec(n)){if(!i[1]){let p=i[0].length===3&&i[0]==="{{{"?3:2,s=i[0]==="{!!"?n.indexOf("!!}",l.lastIndex):ve(n,i.index,p);if(s<0)break;l.lastIndex=s+(i[0]==="{!!"?3:p);continue}let g=l.lastIndex,y=!0,x=/^\s*\(/.exec(n.slice(g));if(x){let p=g+x[0].length-1,s=b(n,"(",")",p);if(s<0)break;g=s+1;try{let m=`!!(${n.slice(p+1,s).trim()})`;y=f(m)?Boolean(d(m,Object.keys(r))(...Object.values(r))):Boolean(u(m,r))}catch{y=!1}}if(e+=n.slice(o,i.index),y)return e+(i[1]==="break"?ee:ne);o=g,l.lastIndex=g}return e+n.slice(o)}function ae(n){let r=(o)=>o.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),l="",e=0;return Nt(n,(o,i,g)=>(l+=ie(r(n.slice(e,g))),l+=`\${__stxRenderLoopValue(${g}, (${i}), ${o.length})}`,e=g+o.length,o)),l+ie(r(n.slice(e)))}function ue(n,r,l,e){return Z(n,r,l==null?"":String(l),!1,e)}function ie(n){let r=n;return r=oe(r,"@break",(l)=>{let e=l.trim();if(!Fs(e))return"";return`\`; if (${e}) { break; } result += \``}),r=oe(r,"@continue",(l)=>{let e=l.trim();if(!Fs(e))return"";return`\`; if (${e}) { continue; } result += \``}),r=r.replace(/@break(?!\()/g,"`; break; result += `"),r=r.replace(/@continue(?!\()/g,"`; continue; result += `"),r}function xe(n){let r=/@forelse\s*\(/g,l,e=[],o=/@foreach\s*\(/g,i=/@endforeach/g,g;while((g=o.exec(n))!==null)e.push({pos:g.index,delta:1});while((g=i.exec(n))!==null)e.push({pos:g.index,delta:-1});e.sort((s,m)=>s.pos-m.pos);let y=[],x=0;for(let s of e)x+=s.delta,y.push({pos:s.pos,depth:x});function p(s){let m=0,a=y.length-1,E=0;while(m<=a){let h=m+a>>1;if(y[h].pos<=s)E=y[h].depth,m=h+1;else a=h-1}return E}while((l=r.exec(n))!==null){if(p(l.index)>0)continue;let s=l.index,m=l.index+l[0].length-1,a=1,E=m+1,h=-1;while(E<n.length&&a>0){if(n[E]==="(")a++;else if(n[E]===")"){if(a--,a===0){h=E;break}}E++}if(h===-1)continue;let w=n.substring(m+1,h),S=Rt(w);if(!S)continue;let{arrayExpr:v,itemVar:W}=S,F=h+1,A=1,B=F,D=/@forelse\s*\(/g,L=/@endforelse/g,V=-1;while(A>0&&B<n.length){D.lastIndex=B,L.lastIndex=B;let P=D.exec(n),_=L.exec(n);if(!_)break;if(P&&P.index<_.index)A++,B=P.index+P[0].length;else{if(A--,A===0){V=_.index;break}B=_.index+11}}if(V===-1)continue;let O=n.substring(F,V),K=V+11,U=-1,z=0,N=0;while(N<O.length){let P=O.indexOf("@",N);if(P===-1)break;let _=O.substring(P);if(/^@forelse\s*\(/.test(_))z++,N=P+1;else if(_.startsWith("@endforelse"))z--,N=P+11;else if(z===0&&_.startsWith("@empty")){if(O.length<=P+6||!/[a-z]/i.test(O[P+6])){U=P;break}N=P+1}else N=P+1}if(U===-1)continue;return{start:s,end:K,arrayExpr:v,itemVar:W,foreachContent:O.substring(0,U),emptyContent:O.substring(U+6)}}return null}function ce(n,r){let l=n;while(!0){let e=xe(l);if(!e)break;let{start:o,end:i,arrayExpr:g,itemVar:y,foreachContent:x,emptyContent:p}=e;try{let s;if(f(g))s=d(g,Object.keys(r))(...Object.values(r));else s=u(g,r);let m;if(!Array.isArray(s)||s.length===0)m=p;else m=`@foreach (${g} as ${y})${x}@endforeach`;l=l.substring(0,o)+m+l.substring(i)}catch(s){let m=s instanceof Error?s.message:String(s),a=c("Forelse",`Error in @forelse(${g} as ${y}): ${m}`,t.EVALUATION_ERROR);l=l.substring(0,o)+a+l.substring(i)}}return l}var fe="<!--stx:foreach-not-iterable:",ye=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function Ee(n,r){return`${fe}${encodeURIComponent(n)}|${encodeURIComponent(r)}-->`}function _e(n,r){console.warn(`[stx] @foreach(${n}) in ${r}: ${n} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function Qr(n){if(!n.includes(fe))return n;return n.replace(ye,(r,l,e)=>(_e(decodeURIComponent(l),decodeURIComponent(e)),""))}function rr(n,r,l,e,o=!1){let i=n,g=new Set(r.__stx_client_signal_names||[]);for(let s of sr(n))g.add(s);if(g.size)r={...r,__stx_client_signal_names:[...g]};i=ce(i,r);function y(s){let m=/@foreach\s*\(/g,a;while((a=m.exec(s))!==null){let E=a.index,h=a.index+a[0].length-1,w=1,S=h+1,v=-1;while(S<s.length&&w>0){if(s[S]==="(")w++;else if(s[S]===")"){if(w--,w===0){v=S;break}}S++}if(v===-1)continue;let W=s.substring(h+1,v),F=Rt(W);if(!F)continue;let A=E,{arrayExpr:B,itemVar:D}=F,L=v+1,V=1,O=L,K=/@foreach\s*\(/g,U=/@endforeach/g;while(V>0&&O<s.length){K.lastIndex=O,U.lastIndex=O;let z=K.exec(s),N=U.exec(s);if(!N)break;if(z&&z.index<N.index)V++,O=z.index+z[0].length;else{if(V--,V===0){let P=s.substring(L,N.index),_=N.index+11;return{start:A,end:_,arrayExpr:B,itemVar:D,content:P}}O=N.index+11}}}return null}function x(s,m){let a=s;while(!0){let E=y(a);if(!E)break;let{start:h,end:w,arrayExpr:S,itemVar:v,content:W}=E;try{let F=S.trim(),A;if(f(F))A=d(F,Object.keys(m))(...Object.values(m));else A=u(F,m);let B=!1;if(!Array.isArray(A))if(A instanceof Map)A=Array.from(A),B=!0;else if(A instanceof Set)A=Array.from(A);else if(typeof A==="string")A=Array.from(A);else if(A&&typeof A==="object"&&!(A instanceof Date)&&!(A instanceof RegExp))A=Object.entries(A),B=!0;else{let _=Ee(F,l)+c("Foreach",`Error in @foreach: ${F} is not iterable`,t.TYPE_ERROR);a=a.substring(0,h)+_+a.substring(w);continue}let D=e?.loops?.useAltLoopVariable??pe,L=v.trim(),V=null,O,K=!1;if(L.includes("=>")){let _=L.split("=>").map((j)=>j.trim());if(_.length===2&&_[0]&&_[1])V=_[0],O=_[1];else O=L}else if(!L.startsWith("[")&&!L.startsWith("{")&&L.includes(",")){let _=L.split(",").map((j)=>j.trim());if(_.length===2&&_[0]&&_[1])O=_[0],V=_[1],K=!0;else O=L}else O=L;let U="",z=new Set(J(`${S} as ${v}`)),N=A,P=m[Bs]??new WeakMap;for(let _=0;_<N.length;_++){let j=N[_],te={index:_,iteration:_+1,first:_===0,last:_===N.length-1,count:N.length},M={...m,loop:te,$loop:te,[Bs]:P};if(Array.isArray(m.__stx_client_signal_names))M.__stx_client_signal_names=m.__stx_client_signal_names.filter((H)=>!z.has(H));if(O.startsWith("[")&&O.endsWith("]")){let H=O.slice(1,-1).split(",").map((T)=>T.trim());if(Array.isArray(j))H.forEach((T,X)=>{if(T)M[T]=j[X]});else M[O]=j}else if(O.startsWith("{")&&O.endsWith("}")){let H=O.slice(1,-1).split(",").map((T)=>T.trim()).filter(Boolean);if(j!==null&&typeof j==="object")H.forEach((T)=>{let X=T.indexOf(":"),Q=(X===-1?T:T.slice(0,X)).trim(),re=X===-1?Q:T.slice(X+1).trim();if(Q&&re)M[re]=j[Q]});else M[O]=j}else M[O]=j;if(V)if(!K&&B&&Array.isArray(j)&&j.length===2)M[V]=j[0],M[O]=j[1];else M[V]=_;let C=ce(W,M);C=rr(C,M,l,e,!0),C=se(C,M,l),C=le(C,M);let q=C.indexOf(ee),G=C.indexOf(ne),Y=q<0?G:G<0?q:Math.min(q,G);if(Y>=0)C=C.slice(0,Y);if(C=k(C,M,l),C=be(C,M),C=me(C,M),C=he(C,M),U+=C,Y>=0&&Y===q)break}a=a.substring(0,h)+U+a.substring(w)}catch(F){let A=c("Foreach",`Error in @foreach(${S.trim()} as ${v.trim()}): ${F instanceof Error?F.message:String(F)}`,t.EVALUATION_ERROR);a=a.substring(0,h)+A+a.substring(w)}}return a}i=x(i,r),i=$e(i,r,l,e);let p=e?.loops?.maxWhileIterations??de;return i=we(i,r,p),o?i:Qr(i)}function wf(n){let r=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(n);if(!r||/^(?:const|let|var)$/.test(r[2]))return n;return`${r[1]}let ${n.slice(r[1].length)}`}function ge(n){return Fs(n)}function $e(n,r,l,e){let o=n,i=!0;while(i){i=!1;let g=o.match(/@for\s*\(/);if(!g||g.index===void 0)break;let y=g.index,x=y+g[0].length-1,p=b(o,"(",")",x);if(p===-1)break;let s=wf(o.slice(x+1,p)),m=p+1,a=us(o.slice(y),"for","endfor");if(a.length===0)break;let E=a[0].content,h=y+a[0].end;if(!ge(s)){let w=c("For",`Unsafe expression in @for: ${s}`,t.UNSAFE_EXPRESSION);o=o.substring(0,y)+w+o.substring(h),i=!0;continue}try{let w=Ae(s),S=/@(?:for|foreach|if|unless)\s*\(/.test(E);if(w.length>0&&S){let D=Re({forExpr:s,content:E,iterVarNames:w,context:r,filePath:l,options:e});o=o.substring(0,y)+D+o.substring(h),i=!0;continue}let v=Object.keys(r),W=Object.values(r),F=ae(E),B=Function(...v,"__stxRenderLoopValue",`
3
3
  let result = '';
4
4
  for (${s}) {
5
5
  result += \`${F}\`;
@@ -9,7 +9,7 @@ import{pi,js,u,f,R,nt,d,Bs,t,c,b}from"./chunk-5hrm7rtx.js";import{ve,Rt,J,I,Nt,Z
9
9
  for (${r}) {
10
10
  if (!__renderIteration([${e.join(", ")}])) break;
11
11
  }
12
- `)(...x,(a)=>{let E={...o};e.forEach((W,F)=>{E[W]=a[F]});let h=rr(l,E,p,g,!0);h=se(h,E,p),h=le(h,E);let w=h.indexOf(ee),S=h.indexOf(ne),v=w<0?S:S<0?w:Math.min(w,S);if(v>=0)h=h.slice(0,v);return s+=k(h,E,p),v<0||v!==w}),s}function we(n,r,l){let e=n,o=!0;while(o){o=!1;let i=e.match(/@while\s*\(/);if(!i||i.index===void 0)break;let g=i.index,y=g+i[0].length-1,x=b(e,"(",")",y);if(x===-1)break;let p=e.slice(y+1,x),s=ls(e.slice(g),"while","endwhile");if(s.length===0)break;let m=s[0].content,a=g+s[0].end;if(!ge(p)){let E=c("While",`Unsafe expression in @while: ${p}`,t.UNSAFE_EXPRESSION);e=e.substring(0,g)+E+e.substring(a),o=!0;continue}try{let E=Object.keys(r),h=Object.values(r),w=ae(m),v=Function(...E,"__stxRenderLoopValue",`
12
+ `)(...x,(a)=>{let E={...o};e.forEach((W,F)=>{E[W]=a[F]});let h=rr(l,E,p,g,!0);h=se(h,E,p),h=le(h,E);let w=h.indexOf(ee),S=h.indexOf(ne),v=w<0?S:S<0?w:Math.min(w,S);if(v>=0)h=h.slice(0,v);return s+=k(h,E,p),v<0||v!==w}),s}function we(n,r,l){let e=n,o=!0;while(o){o=!1;let i=e.match(/@while\s*\(/);if(!i||i.index===void 0)break;let g=i.index,y=g+i[0].length-1,x=b(e,"(",")",y);if(x===-1)break;let p=e.slice(y+1,x),s=us(e.slice(g),"while","endwhile");if(s.length===0)break;let m=s[0].content,a=g+s[0].end;if(!ge(p)){let E=c("While",`Unsafe expression in @while: ${p}`,t.UNSAFE_EXPRESSION);e=e.substring(0,g)+E+e.substring(a),o=!0;continue}try{let E=Object.keys(r),h=Object.values(r),w=ae(m),v=Function(...E,"__stxRenderLoopValue",`
13
13
  let result = '';
14
14
  let maxIterations = ${l}; // Configurable safety limit
15
15
  let counter = 0;
@@ -22,4 +22,4 @@ import{pi,js,u,f,R,nt,d,Bs,t,c,b}from"./chunk-5hrm7rtx.js";import{ve,Rt,J,I,Nt,Z
22
22
  }
23
23
  return result;
24
24
  `)(...h,(W,F,A)=>ue(m,W,F,A));e=e.substring(0,g)+v+e.substring(a),o=!0}catch(E){let h=c("While",`Error in @while(${p}): ${E instanceof Error?E.message:String(E)}`,t.EVALUATION_ERROR);e=e.substring(0,g)+h+e.substring(a),o=!0}}return e}
25
- export{Zr,rr,vf};
25
+ export{Qr,rr,wf};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{gt,Fn,zm}from"./chunk-90gx5qxn.js";import{le,zn,Hm,Hn,co,Ur,Wr,Vm,Um,Wm,Vn,Un,lo,qr,qm}from"./chunk-df8cbgf0.js";import"./chunk-236bdf7y.js";export{co as batch,zm as default,zn as derived,Hn as effect,gt as generateSignalsRuntime,Fn as generateSignalsRuntimeDev,Un as isDerived,Vn as isSignal,Hm as memo,Wr as onDestroy,Ur as onMount,qr as peek,Wm as pendingLifecycleCounts,Um as runDestroyCallbacks,Vm as runMountCallbacks,le as state,lo as untrack,qm as useOptimistic};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{nl,rl,sl}from"./chunk-kyk4ekng.js";import{le,zn,Hn,ao,Vr,Ur,Vn,Un,co,Wr}from"./chunk-rzqd4t77.js";function z(e,s,i,a,d,y){let r=!0,u=new Set,f=(p)=>a.get?a.get(p):p,o=()=>f(e());return Object.defineProperty(o,"_isSignal",{value:!0}),Object.defineProperty(o,"modifiers",{get:s}),o.set=(p)=>{if(!r)return;let h=s(),t=a.set?a.set(p,h):p;if(h.trim&&typeof t==="string")t=t.trim();if(h.number&&typeof t==="string"&&t!==""){let l=Number(t);if(!Number.isNaN(l))t=l}if(Object.is(e(),t))return;e.set(t),i(t)},o.update=(p)=>o.set(p(o())),o.input=(p)=>{if(!s().lazy)o.set(p)},o.change=(p)=>{if(s().lazy)o.set(p)},o.subscribe=(p)=>{if(!r)return()=>{};let h=e.subscribe((t,l)=>p(f(t),f(l)));return u.add(h),()=>{h(),u.delete(h)}},Object.defineProperty(o,"value",{get:o,set:o.set}),d(()=>{r=!1,u.forEach((p)=>p()),u.clear()}),y?.(()=>{r=!0}),o}function X(e,s=!0,i){if(!s||!e||typeof window>"u")return;let a=window;if(!a.__STX_DATA__){let y=document.querySelector("script[data-stx-server-data]");try{let r=JSON.parse(y?.textContent||"{}");a.__STX_DATA__=r&&typeof r==="object"&&!Array.isArray(r)?r:{}}catch{a.__STX_DATA__={}}}let d=a.__STX_DATA__;if(d&&Object.prototype.hasOwnProperty.call(d,e))try{return{data:i?i(d[e]):d[e]}}catch(y){return{data:null,error:y instanceof Error?y:Error(String(y))}}return}function Q(e){if(typeof window>"u")return;let s=window;if(e===void 0)s.__STX_DATA__={};else{if(!s.__STX_DATA__)try{let i=JSON.parse(document.querySelector("script[data-stx-server-data]")?.textContent||"{}");s.__STX_DATA__=i&&typeof i==="object"&&!Array.isArray(i)?i:{}}catch{s.__STX_DATA__={}}if(s.__STX_DATA__)delete s.__STX_DATA__[e]}}function Y(e){let s=null;try{s=typeof indexedDB<"u"?indexedDB:null}catch{s=null}if(!s)return null;let i=s,a=e||"stx-kept",d=null,y=()=>{if(!d)d=new Promise((u,f)=>{let o=i.open(a,1);o.onupgradeneeded=()=>{o.result.createObjectStore("kv")},o.onsuccess=()=>u(o.result),o.onerror=()=>f(o.error),o.onblocked=()=>f(Error("blocked"))}),d.catch(()=>{d=null});return d},r=(u,f)=>y().then((o)=>new Promise((p,h)=>{let t=o.transaction("kv",u),l=f(t.objectStore("kv"));t.oncomplete=()=>p(l?l.result:void 0),t.onerror=()=>h(t.error),t.onabort=()=>h(t.error)}));return{get:(u)=>r("readonly",(f)=>f.get(u)),set:(u,f)=>r("readwrite",(o)=>{o.put(f,u)}),remove:(u)=>r("readwrite",(f)=>{f.delete(u)}),removePrefix:(u)=>r("readwrite",(f)=>{f.delete(IDBKeyRange.bound(u,`${u}\uFFFF`))})}}function J(e,s){let i=e||{},a=null;if(i.storage!==void 0)a=i.storage;else try{a=typeof localStorage<"u"?localStorage:null}catch{a=null}let d=null,y=i.backend!==void 0;if(y)d=i.backend||null;let r=()=>{if(y)return d;y=!0;try{d=s?s():null}catch{d=null}if(d){let n=d;n.get("__stx_probe__").catch(()=>{if(d===n)d=null})}return d},u=i.limit||32768,f=i.defer||((n)=>{let c=typeof requestIdleCallback==="function"?requestIdleCallback:null;if(c)c(n,{timeout:200});else setTimeout(n,16)}),o=new Map,p=new Set,h=new Map,t=!1,l=Promise.resolve(),g=(n)=>{try{return JSON.parse(n)}catch{return n}},m=(n,c)=>{if(!a)return!1;try{return a.setItem(n,c),!0}catch{return!1}},_=(n)=>{try{if(a)a.removeItem(n)}catch{}},k=()=>{if(t=!1,!h.size)return l;let n=Array.from(h.entries());return h.clear(),l=l.then(()=>Promise.all(n.map(([c,v])=>{if(!d){p.delete(c);try{m(c,JSON.stringify(v===void 0?null:v))}catch{}return}let x;try{return x={v},d.set(c,x).catch(()=>{let S;try{S=JSON.stringify(v)}catch{return}return d?d.set(c,{j:S}).catch(()=>{m(c,S)}):void 0})}catch{return}}))).then(()=>{}),l},N=(n,c)=>{if(h.set(n,c),p.add(n),t)return;t=!0,f(()=>{k()})},D=(n)=>{if(!n||typeof n!=="object")return;let c=n;if("v"in c)return{value:c.v};if(typeof c.j==="string")return{value:g(c.j)};return},E={peek(n){if(o.has(n))return{value:o.get(n)};let c=null;try{c=a?a.getItem(n):null}catch{c=null}if(c===null||c===void 0)return;let v=g(c);return o.set(n,v),{value:v}},load(n){let c=E.peek(n),v=c?null:r();if(c||!v)return Promise.resolve(c);return v.get(n).then((x)=>{if(o.has(n))return{value:o.get(n)};let S=D(x);if(S)o.set(n,S.value),p.add(n);return S},()=>{return})},set(n,c){if(o.set(n,c),d&&p.has(n)){N(n,c);return}let v;try{v=JSON.stringify(c===void 0?null:c)}catch{return}if(v.length<=u&&m(n,v))return;if(!r()){if(v.length>u)m(n,v);return}_(n),N(n,c)},forget(n){for(let v of Array.from(o.keys()))if(v.indexOf(n)===0)o.delete(v);for(let v of Array.from(h.keys()))if(v.indexOf(n)===0)h.delete(v);for(let v of Array.from(p))if(v.indexOf(n)===0)p.delete(v);try{if(a)for(let v=a.length-1;v>=0;v--){let x=a.key(v);if(x&&x.indexOf(n)===0)a.removeItem(x)}}catch{}let c=r();if(!c)return l;return l=l.then(()=>c.removePrefix(n)).catch(()=>{}),l},flush(){return k()}};try{if(typeof document<"u"&&document.addEventListener)document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden")k()});if(typeof addEventListener==="function")addEventListener("pagehide",()=>{k()})}catch{}return E}function Z(e,s){if(!e)return!1;if(e===s.key)return!0;if(!s.url)return!1;if(e===s.url)return!0;try{let i=typeof location<"u"&&location.origin&&location.origin!=="null"?location.origin:"http://localhost",a=new URL(e,i),d=new URL(s.url,i);if(a.origin!==d.origin||a.pathname!==d.pathname)return!1;return!a.search||a.search===d.search}catch{return!1}}function ee(e){let s=e.prefix||"stx:kept:",i=e.matches||((t,l)=>t===l.key||t===l.url),a=new Set,d=new Map,y,r=(t)=>t===void 0?y:t,u=(t,l)=>{let g=r(l);if(g===!1||g===null||g==="")return null;return`${s}${g===void 0?"":`${g}:`}query:${t}`},f=(t)=>{let l=t&&t.value;if(!l||typeof l!=="object"||!("d"in l))return;return{data:l.d,at:Number(l.at)||0}},o=()=>{let t=globalThis;return t.__stx_outboxes instanceof Map?t.__stx_outboxes:null},p={setScope(t){y=t},scope:()=>y,keyFor:u,seed(t,l){let g=u(t,l);return g?f(e.kept.peek(g)):void 0},restore(t,l){let g=u(t,l);return g?e.kept.load(g).then(f):Promise.resolve(void 0)},persist(t,l,g){let m=u(t,g);if(m)e.kept.set(m,{d:l,at:Date.now()})},overlay(t,l,g){let m=o();if(!m||!m.size)return l;let _=l;return m.forEach((k)=>{try{_=k.overlay(t,_,g)}catch{}}),_},watch(t){return a.add(t),()=>{a.delete(t)}},cachedQuery(t,l){let g=d.get(t);if(g){if(l&&g.__options)g.__options(l);return g}let m=l||{},_=m.initial===void 0?null:m.initial,k=()=>typeof m.scope==="function"?m.scope():m.scope,N=()=>(typeof m.url==="function"?m.url():m.url)||null,D=()=>({key:t,url:N()}),E=k(),n=_,c=0,v=e.sharedRequest(),x=0,S=p.seed(t,E);if(S)n=S.data;let I=e.state(p.overlay(D(),n)),U=e.state(!1),q=e.state(!1),K=e.state(null),P=e.state(S?S.at:0),R=0,F=()=>{I.set(p.overlay(D(),n))},W=(b)=>{let w=R;p.restore(t,b).then((T)=>{if(!T||w!==R||c)return;n=T.data,P.set(T.at),F()})};if(!S)W(E);let _t=()=>{let b=k();if(b===E)return;E=b,R++,x=0,q.set(!1),U.set(!1),c=0;let w=p.seed(t,E);if(n=w?w.data:_,P.set(w?w.at:0),F(),!w)W(E)},xt=(b,w)=>{let T=m.timeoutMs||15000,C=typeof AbortController<"u"?new AbortController:null,O=null,V=new Promise((M,j)=>{O=setTimeout(()=>{if(C)C.abort();j(Error("The request took too long."))},T)}),A;if(m.load)A=m.load({force:b,url:w,signal:C?C.signal:void 0});else if(w){let M=m.fetch||((L,H)=>fetch(L,H)),j={method:"GET",headers:{Accept:"application/json"}};if(b)j.cache="no-cache";if(C)j.signal=C.signal;A=M(w,j).then((L)=>{if(!L.ok)return L.json().catch(()=>null).then((H)=>{throw Error(H&&(H.error||H.message)||`Request failed (${L.status})`)});return L.json()})}else return Promise.resolve(I());return Promise.race([A,V]).then((M)=>{if(O)clearTimeout(O);return m.transform?m.transform(M):M},(M)=>{if(O)clearTimeout(O);throw M})},G=(b)=>{let w=R,T=N(),C=()=>{if(w!==R)return Promise.resolve(I());if(x++,q.set(!0),c===0&&!P())U.set(!0);let V=()=>{if(w!==R)return;if(x=Math.max(0,x-1),!x)q.set(!1),U.set(!1)};return xt(b,T).then((A)=>{if(w!==R||T!==N())return V(),I();return n=A,c=Date.now(),P.set(c),K.set(null),p.persist(t,A,E),F(),V(),I()},(A)=>{if(w===R&&T===N())K.set(A&&A.message?A.message:"Could not load.");return V(),I()})},O=`${w} ${T||""}`;return b?v.fresh(O,C):v.run(O,C)},B={data:I,loading:U,isFetching:q,error:K,updatedAt:P,get key(){return t},load(b){if(_t(),!b&&c&&Date.now()-c<(m.staleTime||0))return Promise.resolve(I());return G(!!b)},refresh(){return B.load(!0)},set(b){n=typeof b==="function"?b(n):b,p.persist(t,n,E),F()},invalidate(){c=0},__options(b){m={...m,...b}}};if(a.add({target:D,updated:()=>{if(c||P())G(!1)},outbox:(b)=>{if(b)n=p.overlay(D(),n,b.id),c=0,G(!0);F()}}),d.set(t,B),m.immediate)B.load();return B}},h=typeof window<"u"?window:typeof addEventListener==="function"?globalThis:null;if(e.listen!==!1&&h&&typeof h.addEventListener==="function")h.addEventListener("stx:updated",(t)=>{let l=t.detail||{};if(l.kind!=="api"||typeof l.url!=="string")return;a.forEach((g)=>{if(i(l.url,g.target()))g.updated()})}),h.addEventListener("stx:outbox",(t)=>{let l=t.detail||{},g=l.sent&&typeof l.sent.id==="string"?l.sent:null;a.forEach((m)=>{if(g){let _=Array.isArray(g.affects)?g.affects:[],k=m.target();if(!_.some((N)=>i(N,k)))return}m.outbox(g)})});return p}function te(e){let s=e&&e.covers||((r,u)=>Object.is(r,u)),i=[],a=[],d=0,y=(r,u)=>{let f;try{f=Promise.resolve(u())}catch(h){f=Promise.reject(h)}let o={key:r,promise:f};i.push(o);let p=()=>{let h=i.indexOf(o);if(h!==-1)i.splice(h,1)};return f.then(p,p),f};return{run(r,u){for(let f of i)if(s(f.key,r))return f.promise;for(let f of a)if(s(f.key,r))return f.promise;return y(r,u)},fresh(r,u){for(let h of a)if(s(h.key,r))return h.promise;let f=i.filter((h)=>s(h.key,r)).map((h)=>h.promise);if(!f.length)return y(r,u);let o={key:r,promise:null},p=()=>{};return o.promise=Promise.all(f.map((h)=>h.then(p,p))).then(()=>{let h=a.indexOf(o);if(h!==-1)a.splice(h,1);return y(r,u)}),a.push(o),o.promise},latest(){let r=++d;return()=>r===d},get busy(){return i.length>0||a.length>0}}}function ne(e){let s=!1,i=null,a=null,d=0;async function y(){if(s)return;i=new AbortController;try{let r=await e.request(e.endpoint,{signal:i.signal,cache:"no-store",headers:{Accept:"text/event-stream"}});if(!r.ok||!r.body||!r.headers.get("content-type")?.includes("text/event-stream"))throw Error("Broadcast stream unavailable");if(s){await r.body.cancel();return}let u=r.body.getReader(),f=new TextDecoder,o="";d=0,e.onStatus?.(!0),e.onConnected?.();try{while(!s){let{done:p,value:h}=await u.read();if(p)break;if(o+=f.decode(h,{stream:!0}).replace(/\r\n/g,`
2
+ import{rl,sl,ol}from"./chunk-236bdf7y.js";import{le,zn,Hn,co,Ur,Wr,Vn,Un,lo,qr}from"./chunk-df8cbgf0.js";function z(e,s,i,a,d,y){let r=!0,u=new Set,f=(p)=>a.get?a.get(p):p,o=()=>f(e());return Object.defineProperty(o,"_isSignal",{value:!0}),Object.defineProperty(o,"modifiers",{get:s}),o.set=(p)=>{if(!r)return;let h=s(),t=a.set?a.set(p,h):p;if(h.trim&&typeof t==="string")t=t.trim();if(h.number&&typeof t==="string"&&t!==""){let l=Number(t);if(!Number.isNaN(l))t=l}if(Object.is(e(),t))return;e.set(t),i(t)},o.update=(p)=>o.set(p(o())),o.input=(p)=>{if(!s().lazy)o.set(p)},o.change=(p)=>{if(s().lazy)o.set(p)},o.subscribe=(p)=>{if(!r)return()=>{};let h=e.subscribe((t,l)=>p(f(t),f(l)));return u.add(h),()=>{h(),u.delete(h)}},Object.defineProperty(o,"value",{get:o,set:o.set}),d(()=>{r=!1,u.forEach((p)=>p()),u.clear()}),y?.(()=>{r=!0}),o}function X(e,s=!0,i){if(!s||!e||typeof window>"u")return;let a=window;if(!a.__STX_DATA__){let y=document.querySelector("script[data-stx-server-data]");try{let r=JSON.parse(y?.textContent||"{}");a.__STX_DATA__=r&&typeof r==="object"&&!Array.isArray(r)?r:{}}catch{a.__STX_DATA__={}}}let d=a.__STX_DATA__;if(d&&Object.prototype.hasOwnProperty.call(d,e))try{return{data:i?i(d[e]):d[e]}}catch(y){return{data:null,error:y instanceof Error?y:Error(String(y))}}return}function Q(e){if(typeof window>"u")return;let s=window;if(e===void 0)s.__STX_DATA__={};else{if(!s.__STX_DATA__)try{let i=JSON.parse(document.querySelector("script[data-stx-server-data]")?.textContent||"{}");s.__STX_DATA__=i&&typeof i==="object"&&!Array.isArray(i)?i:{}}catch{s.__STX_DATA__={}}if(s.__STX_DATA__)delete s.__STX_DATA__[e]}}function Y(e){let s=null;try{s=typeof indexedDB<"u"?indexedDB:null}catch{s=null}if(!s)return null;let i=s,a=e||"stx-kept",d=null,y=()=>{if(!d)d=new Promise((u,f)=>{let o=i.open(a,1);o.onupgradeneeded=()=>{o.result.createObjectStore("kv")},o.onsuccess=()=>u(o.result),o.onerror=()=>f(o.error),o.onblocked=()=>f(Error("blocked"))}),d.catch(()=>{d=null});return d},r=(u,f)=>y().then((o)=>new Promise((p,h)=>{let t=o.transaction("kv",u),l=f(t.objectStore("kv"));t.oncomplete=()=>p(l?l.result:void 0),t.onerror=()=>h(t.error),t.onabort=()=>h(t.error)}));return{get:(u)=>r("readonly",(f)=>f.get(u)),set:(u,f)=>r("readwrite",(o)=>{o.put(f,u)}),remove:(u)=>r("readwrite",(f)=>{f.delete(u)}),removePrefix:(u)=>r("readwrite",(f)=>{f.delete(IDBKeyRange.bound(u,`${u}\uFFFF`))})}}function J(e,s){let i=e||{},a=null;if(i.storage!==void 0)a=i.storage;else try{a=typeof localStorage<"u"?localStorage:null}catch{a=null}let d=null,y=i.backend!==void 0;if(y)d=i.backend||null;let r=()=>{if(y)return d;y=!0;try{d=s?s():null}catch{d=null}if(d){let n=d;n.get("__stx_probe__").catch(()=>{if(d===n)d=null})}return d},u=i.limit||32768,f=i.defer||((n)=>{let c=typeof requestIdleCallback==="function"?requestIdleCallback:null;if(c)c(n,{timeout:200});else setTimeout(n,16)}),o=new Map,p=new Set,h=new Map,t=!1,l=Promise.resolve(),g=(n)=>{try{return JSON.parse(n)}catch{return n}},m=(n,c)=>{if(!a)return!1;try{return a.setItem(n,c),!0}catch{return!1}},_=(n)=>{try{if(a)a.removeItem(n)}catch{}},k=()=>{if(t=!1,!h.size)return l;let n=Array.from(h.entries());return h.clear(),l=l.then(()=>Promise.all(n.map(([c,v])=>{if(!d){p.delete(c);try{m(c,JSON.stringify(v===void 0?null:v))}catch{}return}let x;try{return x={v},d.set(c,x).catch(()=>{let S;try{S=JSON.stringify(v)}catch{return}return d?d.set(c,{j:S}).catch(()=>{m(c,S)}):void 0})}catch{return}}))).then(()=>{}),l},N=(n,c)=>{if(h.set(n,c),p.add(n),t)return;t=!0,f(()=>{k()})},D=(n)=>{if(!n||typeof n!=="object")return;let c=n;if("v"in c)return{value:c.v};if(typeof c.j==="string")return{value:g(c.j)};return},E={peek(n){if(o.has(n))return{value:o.get(n)};let c=null;try{c=a?a.getItem(n):null}catch{c=null}if(c===null||c===void 0)return;let v=g(c);return o.set(n,v),{value:v}},load(n){let c=E.peek(n),v=c?null:r();if(c||!v)return Promise.resolve(c);return v.get(n).then((x)=>{if(o.has(n))return{value:o.get(n)};let S=D(x);if(S)o.set(n,S.value),p.add(n);return S},()=>{return})},set(n,c){if(o.set(n,c),d&&p.has(n)){N(n,c);return}let v;try{v=JSON.stringify(c===void 0?null:c)}catch{return}if(v.length<=u&&m(n,v))return;if(!r()){if(v.length>u)m(n,v);return}_(n),N(n,c)},forget(n){for(let v of Array.from(o.keys()))if(v.indexOf(n)===0)o.delete(v);for(let v of Array.from(h.keys()))if(v.indexOf(n)===0)h.delete(v);for(let v of Array.from(p))if(v.indexOf(n)===0)p.delete(v);try{if(a)for(let v=a.length-1;v>=0;v--){let x=a.key(v);if(x&&x.indexOf(n)===0)a.removeItem(x)}}catch{}let c=r();if(!c)return l;return l=l.then(()=>c.removePrefix(n)).catch(()=>{}),l},flush(){return k()}};try{if(typeof document<"u"&&document.addEventListener)document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden")k()});if(typeof addEventListener==="function")addEventListener("pagehide",()=>{k()})}catch{}return E}function Z(e,s){if(!e)return!1;if(e===s.key)return!0;if(!s.url)return!1;if(e===s.url)return!0;try{let i=typeof location<"u"&&location.origin&&location.origin!=="null"?location.origin:"http://localhost",a=new URL(e,i),d=new URL(s.url,i);if(a.origin!==d.origin||a.pathname!==d.pathname)return!1;return!a.search||a.search===d.search}catch{return!1}}function ee(e){let s=e.prefix||"stx:kept:",i=e.matches||((t,l)=>t===l.key||t===l.url),a=new Set,d=new Map,y,r=(t)=>t===void 0?y:t,u=(t,l)=>{let g=r(l);if(g===!1||g===null||g==="")return null;return`${s}${g===void 0?"":`${g}:`}query:${t}`},f=(t)=>{let l=t&&t.value;if(!l||typeof l!=="object"||!("d"in l))return;return{data:l.d,at:Number(l.at)||0}},o=()=>{let t=globalThis;return t.__stx_outboxes instanceof Map?t.__stx_outboxes:null},p={setScope(t){y=t},scope:()=>y,keyFor:u,seed(t,l){let g=u(t,l);return g?f(e.kept.peek(g)):void 0},restore(t,l){let g=u(t,l);return g?e.kept.load(g).then(f):Promise.resolve(void 0)},persist(t,l,g){let m=u(t,g);if(m)e.kept.set(m,{d:l,at:Date.now()})},overlay(t,l,g){let m=o();if(!m||!m.size)return l;let _=l;return m.forEach((k)=>{try{_=k.overlay(t,_,g)}catch{}}),_},watch(t){return a.add(t),()=>{a.delete(t)}},cachedQuery(t,l){let g=d.get(t);if(g){if(l&&g.__options)g.__options(l);return g}let m=l||{},_=m.initial===void 0?null:m.initial,k=()=>typeof m.scope==="function"?m.scope():m.scope,N=()=>(typeof m.url==="function"?m.url():m.url)||null,D=()=>({key:t,url:N()}),E=k(),n=_,c=0,v=e.sharedRequest(),x=0,S=p.seed(t,E);if(S)n=S.data;let I=e.state(p.overlay(D(),n)),U=e.state(!1),q=e.state(!1),K=e.state(null),P=e.state(S?S.at:0),R=0,F=()=>{I.set(p.overlay(D(),n))},W=(b)=>{let w=R;p.restore(t,b).then((T)=>{if(!T||w!==R||c)return;n=T.data,P.set(T.at),F()})};if(!S)W(E);let _t=()=>{let b=k();if(b===E)return;E=b,R++,x=0,q.set(!1),U.set(!1),c=0;let w=p.seed(t,E);if(n=w?w.data:_,P.set(w?w.at:0),F(),!w)W(E)},xt=(b,w)=>{let T=m.timeoutMs||15000,C=typeof AbortController<"u"?new AbortController:null,O=null,V=new Promise((M,j)=>{O=setTimeout(()=>{if(C)C.abort();j(Error("The request took too long."))},T)}),A;if(m.load)A=m.load({force:b,url:w,signal:C?C.signal:void 0});else if(w){let M=m.fetch||((L,H)=>fetch(L,H)),j={method:"GET",headers:{Accept:"application/json"}};if(b)j.cache="no-cache";if(C)j.signal=C.signal;A=M(w,j).then((L)=>{if(!L.ok)return L.json().catch(()=>null).then((H)=>{throw Error(H&&(H.error||H.message)||`Request failed (${L.status})`)});return L.json()})}else return Promise.resolve(I());return Promise.race([A,V]).then((M)=>{if(O)clearTimeout(O);return m.transform?m.transform(M):M},(M)=>{if(O)clearTimeout(O);throw M})},G=(b)=>{let w=R,T=N(),C=()=>{if(w!==R)return Promise.resolve(I());if(x++,q.set(!0),c===0&&!P())U.set(!0);let V=()=>{if(w!==R)return;if(x=Math.max(0,x-1),!x)q.set(!1),U.set(!1)};return xt(b,T).then((A)=>{if(w!==R||T!==N())return V(),I();return n=A,c=Date.now(),P.set(c),K.set(null),p.persist(t,A,E),F(),V(),I()},(A)=>{if(w===R&&T===N())K.set(A&&A.message?A.message:"Could not load.");return V(),I()})},O=`${w} ${T||""}`;return b?v.fresh(O,C):v.run(O,C)},B={data:I,loading:U,isFetching:q,error:K,updatedAt:P,get key(){return t},load(b){if(_t(),!b&&c&&Date.now()-c<(m.staleTime||0))return Promise.resolve(I());return G(!!b)},refresh(){return B.load(!0)},set(b){n=typeof b==="function"?b(n):b,p.persist(t,n,E),F()},invalidate(){c=0},__options(b){m={...m,...b}}};if(a.add({target:D,updated:()=>{if(c||P())G(!1)},outbox:(b)=>{if(b)n=p.overlay(D(),n,b.id),c=0,G(!0);F()}}),d.set(t,B),m.immediate)B.load();return B}},h=typeof window<"u"?window:typeof addEventListener==="function"?globalThis:null;if(e.listen!==!1&&h&&typeof h.addEventListener==="function")h.addEventListener("stx:updated",(t)=>{let l=t.detail||{};if(l.kind!=="api"||typeof l.url!=="string")return;a.forEach((g)=>{if(i(l.url,g.target()))g.updated()})}),h.addEventListener("stx:outbox",(t)=>{let l=t.detail||{},g=l.sent&&typeof l.sent.id==="string"?l.sent:null;a.forEach((m)=>{if(g){let _=Array.isArray(g.affects)?g.affects:[],k=m.target();if(!_.some((N)=>i(N,k)))return}m.outbox(g)})});return p}function te(e){let s=e&&e.covers||((r,u)=>Object.is(r,u)),i=[],a=[],d=0,y=(r,u)=>{let f;try{f=Promise.resolve(u())}catch(h){f=Promise.reject(h)}let o={key:r,promise:f};i.push(o);let p=()=>{let h=i.indexOf(o);if(h!==-1)i.splice(h,1)};return f.then(p,p),f};return{run(r,u){for(let f of i)if(s(f.key,r))return f.promise;for(let f of a)if(s(f.key,r))return f.promise;return y(r,u)},fresh(r,u){for(let h of a)if(s(h.key,r))return h.promise;let f=i.filter((h)=>s(h.key,r)).map((h)=>h.promise);if(!f.length)return y(r,u);let o={key:r,promise:null},p=()=>{};return o.promise=Promise.all(f.map((h)=>h.then(p,p))).then(()=>{let h=a.indexOf(o);if(h!==-1)a.splice(h,1);return y(r,u)}),a.push(o),o.promise},latest(){let r=++d;return()=>r===d},get busy(){return i.length>0||a.length>0}}}function ne(e){let s=!1,i=null,a=null,d=0;async function y(){if(s)return;i=new AbortController;try{let r=await e.request(e.endpoint,{signal:i.signal,cache:"no-store",headers:{Accept:"text/event-stream"}});if(!r.ok||!r.body||!r.headers.get("content-type")?.includes("text/event-stream"))throw Error("Broadcast stream unavailable");if(s){await r.body.cancel();return}let u=r.body.getReader(),f=new TextDecoder,o="";d=0,e.onStatus?.(!0),e.onConnected?.();try{while(!s){let{done:p,value:h}=await u.read();if(p)break;if(o+=f.decode(h,{stream:!0}).replace(/\r\n/g,`
3
3
  `),o.length>1048576)throw Error("Broadcast frame too large");let t;while((t=o.indexOf(`
4
4
 
5
5
  `))!==-1){let l=o.slice(0,t);o=o.slice(t+2);let g=l.split(`
@@ -10640,7 +10640,7 @@ ${se}
10640
10640
  ${ue}
10641
10641
  ${me}
10642
10642
  ${Ke}
10643
- ${tt(rl(),sl(),nl())}
10643
+ ${tt(sl(),ol(),rl())}
10644
10644
 
10645
10645
  ${ft}
10646
10646
  ${it}
@@ -10693,5 +10693,5 @@ ${lt}
10693
10693
  ${ct}
10694
10694
  ${at}
10695
10695
  })();
10696
- `}var Fm={state:le,derived:zn,effect:Hn,batch:ao,onMount:Vr,onDestroy:Ur,isSignal:Vn,isDerived:Un,untrack:co,peek:Wr,generateSignalsRuntime:gt,generateSignalsRuntimeDev:Fn};
10697
- export{gt,Fn,Fm};
10696
+ `}var zm={state:le,derived:zn,effect:Hn,batch:co,onMount:Ur,onDestroy:Wr,isSignal:Vn,isDerived:Un,untrack:lo,peek:qr,generateSignalsRuntime:gt,generateSignalsRuntimeDev:Fn};
10697
+ export{gt,Fn,zm};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Ft}from"./chunk-8mkxge3a.js";function Us(e){let n=e.pwa;if(!n?.enabled)return"";let r=n.manifest,t=n.icons?.outputDir?`/${n.icons.outputDir}`:"/pwa-icons",o=Ft(e),i=`
2
+ import{Ft}from"./chunk-dvakr9p9.js";function Ws(e){let n=e.pwa;if(!n?.enabled)return"";let r=n.manifest,t=n.icons?.outputDir?`/${n.icons.outputDir}`:"/pwa-icons",o=Ft(e),i=`
3
3
  <!-- stx PWA Meta Tags -->
4
4
  <link rel="manifest" href="/manifest.json">
5
5
  <meta name="theme-color" content="${a(r?.themeColor||"#000000")}">
@@ -43,9 +43,9 @@ if ('serviceWorker' in navigator) {
43
43
  });
44
44
  }
45
45
  </script>
46
- <!-- End stx PWA -->`,i}function xi(e,n){let r=n.pwa;if(!r?.enabled||r.autoInject===!1)return e;if(e.includes("<!-- stx PWA Meta Tags -->"))return e;if(!e.includes("</head>")){let o=e.lastIndexOf("</body>");if(o!==-1){let i=Us(n);return e.slice(0,o)+i+`
47
- `+e.slice(o)}return e+Us(n)}let t=Us(n);return e.replace("</head>",`${t}
48
- </head>`)}function cg(e){if(!e.pwa?.enabled)return"";return`<script>
46
+ <!-- End stx PWA -->`,i}function Si(e,n){let r=n.pwa;if(!r?.enabled||r.autoInject===!1)return e;if(e.includes("<!-- stx PWA Meta Tags -->"))return e;if(!e.includes("</head>")){let o=e.lastIndexOf("</body>");if(o!==-1){let i=Ws(n);return e.slice(0,o)+i+`
47
+ `+e.slice(o)}return e+Ws(n)}let t=Ws(n);return e.replace("</head>",`${t}
48
+ </head>`)}function lg(e){if(!e.pwa?.enabled)return"";return`<script>
49
49
  if ('serviceWorker' in navigator) {
50
50
  window.addEventListener('load', function() {
51
51
  navigator.serviceWorker.register('/${Ft(e)}')
@@ -57,5 +57,5 @@ if ('serviceWorker' in navigator) {
57
57
  });
58
58
  });
59
59
  }
60
- </script>`}function lg(){return'<link rel="manifest" href="/manifest.json">'}function ug(e){return`<meta name="theme-color" content="${a(e)}">`}function a(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}
61
- export{Us,xi,cg,lg,ug};
60
+ </script>`}function ug(){return'<link rel="manifest" href="/manifest.json">'}function dg(e){return`<meta name="theme-color" content="${a(e)}">`}function a(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}
61
+ export{Ws,Si,lg,ug,dg};
@@ -72,7 +72,7 @@ else {
72
72
  ${t}
73
73
  })();
74
74
  </script>
75
- `}function um(i,n,o){f=0;let l=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return i.replace(l,(t,e,s)=>{let a=v(),r=p(t,e,s),d=r.placeholder?`<div data-defer-placeholder>${r.placeholder}</div>`:"",c=r.loading?`<div data-defer-loading style="display: none;">${r.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',g=r.error?`<div data-defer-error style="display: none;">${r.error}</div>`:"",u=`<div data-defer-content style="display: none;">${r.content}</div>`,h=E(a,r);return`
75
+ `}function dm(i,n,o){f=0;let l=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return i.replace(l,(t,e,s)=>{let a=v(),r=p(t,e,s),d=r.placeholder?`<div data-defer-placeholder>${r.placeholder}</div>`:"",c=r.loading?`<div data-defer-loading style="display: none;">${r.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',g=r.error?`<div data-defer-error style="display: none;">${r.error}</div>`:"",u=`<div data-defer-content style="display: none;">${r.content}</div>`,h=E(a,r);return`
76
76
  <div id="${a}" class="stx-defer" data-defer-trigger="${r.trigger}">
77
77
  ${d}
78
78
  ${c}
@@ -81,4 +81,4 @@ else {
81
81
  </div>
82
82
  ${h}
83
83
  `})}
84
- export{um};
84
+ export{dm};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Dg,Mg,Lg,jg,Tl,Bg,Fg,zg,Hg,Vg,Ug,Wg}from"./chunk-4zta7ay1.js";export{Ug as Broadcast,Wg as BroadcastServer,Tl as broadcast,Hg as broadcastPresence,zg as broadcastPrivate,Vg as channel,Dg as getBroadcastServer,jg as loadChannels,Mg as startBroadcasting,Lg as stopBroadcasting,Bg as toUser,Fg as toUsers};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Yl}from"./chunk-81ysx0tc.js";export{Yl as rewriteImagesWithSiblings};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{qg}from"./chunk-bkkwdh13.js";import"./chunk-g5sctfwa.js";import"./chunk-p33w8zst.js";import"./chunk-m6w75sq2.js";import"./chunk-cb4ybh7g.js";import"./chunk-3z38swhv.js";import"./chunk-k4dn3ry6.js";import"./chunk-8w0cwcvk.js";import"./chunk-7mm5mvg0.js";import"./chunk-sj2a5twe.js";import"./chunk-0tgrqhkr.js";import"./chunk-89h4snzd.js";import"./chunk-236bdf7y.js";export{qg as buildApp};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{j,Tf,Bo,a,P,yh,bh}from"./chunk-g5sctfwa.js";import"./chunk-p33w8zst.js";import"./chunk-m6w75sq2.js";import"./chunk-cb4ybh7g.js";import"./chunk-3z38swhv.js";import"./chunk-k4dn3ry6.js";import"./chunk-8w0cwcvk.js";import"./chunk-7mm5mvg0.js";import"./chunk-sj2a5twe.js";import"./chunk-0tgrqhkr.js";import"./chunk-89h4snzd.js";import"./chunk-236bdf7y.js";export{P as config,j as defaultConfig,yh as defineStxConfig,Bo as discoverConfig,a as loadStxConfig,Tf as resolveStxDirectories,bh as validateConfig};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{a}from"./chunk-6j2h3vf1.js";import{oo}from"./chunk-amwxbvdp.js";import p from"path";async function Wg(t={}){let l=performance.now(),s=t.root||process.cwd(),e=await a(s),o=t.ssr?.routeRules??e.routeRules??{};if(oo(o),!e.ssr&&Object.keys(o).length)throw Error("routeRules require ssr: true and the production server; flat SSG output cannot apply request/cache policies");if(!e.ssr&&(t.ssr?.serverApi??e.serverApi))throw Error("serverApi requires ssr: true; flat SSG output cannot execute API endpoints");let r=e.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${r.toUpperCase()}${e.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let u,n;if(r==="ssg"){let{generateStaticSite:i}=await import("./ssg.js");u=await i({pagesDir:p.join(e.root||".",e.pagesDir||e.build?.pagesDir||"pages"),publicDir:e.publicDir||e.build?.publicDir||"public",outputDir:e.build?.outputDir||"dist",generate404:e.build?.generate404??!0,minify:e.build?.minify??!0,cleanOutput:e.build?.cleanOutput??!0,router:e.router,...t.ssg})}else{let{buildForProduction:i}=await import("./chunk-y100kb3n.js");n=await i({root:s,outputDir:".output",debug:t.debug,...t.ssr})}let d=Math.round(performance.now()-l);return{mode:r,ssg:u,ssr:n,duration:d}}
3
- export{Wg};
2
+ import{a}from"./chunk-g5sctfwa.js";import{io}from"./chunk-d2vsw1j7.js";import p from"path";async function qg(t={}){let l=performance.now(),s=t.root||process.cwd(),e=await a(s),o=t.ssr?.routeRules??e.routeRules??{};if(io(o),!e.ssr&&Object.keys(o).length)throw Error("routeRules require ssr: true and the production server; flat SSG output cannot apply request/cache policies");if(!e.ssr&&(t.ssr?.serverApi??e.serverApi))throw Error("serverApi requires ssr: true; flat SSG output cannot execute API endpoints");let r=e.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${r.toUpperCase()}${e.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let u,n;if(r==="ssg"){let{generateStaticSite:i}=await import("./ssg.js");u=await i({pagesDir:p.join(e.root||".",e.pagesDir||e.build?.pagesDir||"pages"),publicDir:e.publicDir||e.build?.publicDir||"public",outputDir:e.build?.outputDir||"dist",generate404:e.build?.generate404??!0,minify:e.build?.minify??!0,cleanOutput:e.build?.cleanOutput??!0,router:e.router,...t.ssg})}else{let{buildForProduction:i}=await import("./chunk-r8184e10.js");n=await i({root:s,outputDir:".output",debug:t.debug,...t.ssr})}let d=Math.round(performance.now()-l);return{mode:r,ssg:u,ssr:n,duration:d}}
3
+ export{qg};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Sf,ss}from"./chunk-gzbmfwxr.js";import"./chunk-6fxjs3ay.js";import"./chunk-v0s52tmv.js";import"./chunk-nsjkmpjf.js";import{wr}from"./chunk-8w0cwcvk.js";import"./chunk-7mm5mvg0.js";import"./chunk-sj2a5twe.js";import{nt}from"./chunk-0tgrqhkr.js";import"./chunk-89h4snzd.js";import"./chunk-236bdf7y.js";export{nt as freeIdentifiers,ss as processComponents,Sf as processESImports,wr as rendersAsElement};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{at,ct,lt}from"./chunk-6ts3sthp.js";import{zt,Ht,it,Di,Vt,Ut}from"./chunk-6fhcmg96.js";import o from"fs";import i from"path";var c=[];function m(a){c=[];for(let e of a.storyFiles)if(c.push({text:e.fileName.toLowerCase(),original:e.fileName,type:"story",storyId:e.id}),c.push({text:e.relativePath.toLowerCase(),original:e.relativePath,type:"story",storyId:e.id}),e.story)for(let t of e.story.variants)c.push({text:t.title.toLowerCase(),original:t.title,type:"story",storyId:e.id,variantId:t.id})}function f(){return JSON.stringify(c)}async function F(a={}){let e=Date.now();zt();let t=await at({mode:"build"});if(!t.config.enabled){it("Story feature is disabled in config.");return}let n=await Vt(t);ct(t,n);let l=Ut(t.config,n);lt(t,l),Ht(n.length);let d=a.outDir??t.config.outDir,s=i.resolve(t.root,d);await o.promises.mkdir(s,{recursive:!0}),console.log(` Building to ${d}...`);let g=v(t);await o.promises.writeFile(i.join(s,"index.html"),g);let y={files:n.map((r)=>({id:r.id,fileName:r.fileName,relativePath:r.relativePath,treePath:r.treePath})),tree:l};await o.promises.writeFile(i.join(s,"stories.json"),JSON.stringify(y,null,2));let u={theme:t.config.theme,responsivePresets:t.config.responsivePresets,backgroundPresets:t.config.backgroundPresets};await o.promises.writeFile(i.join(s,"config.json"),JSON.stringify(u,null,2));let p=i.join(s,"stories");await o.promises.mkdir(p,{recursive:!0});for(let r of n){let b=await o.promises.readFile(r.path,"utf-8");await o.promises.writeFile(i.join(p,`${r.id}.stx`),b)}m(t);let h=f();await o.promises.writeFile(i.join(s,"search-index.json"),h);let x=Date.now()-e;Di(n.length,d,x)}function v(a){let{theme:e}=a.config,t=e.title||"STX Story";return`<!DOCTYPE html>
2
+ import{at,ct,lt}from"./chunk-6ts3sthp.js";import{zt,Ht,it,Mi,Vt,Ut}from"./chunk-p2v0r96k.js";import o from"fs";import i from"path";var c=[];function m(a){c=[];for(let e of a.storyFiles)if(c.push({text:e.fileName.toLowerCase(),original:e.fileName,type:"story",storyId:e.id}),c.push({text:e.relativePath.toLowerCase(),original:e.relativePath,type:"story",storyId:e.id}),e.story)for(let t of e.story.variants)c.push({text:t.title.toLowerCase(),original:t.title,type:"story",storyId:e.id,variantId:t.id})}function f(){return JSON.stringify(c)}async function F(a={}){let e=Date.now();zt();let t=await at({mode:"build"});if(!t.config.enabled){it("Story feature is disabled in config.");return}let n=await Vt(t);ct(t,n);let l=Ut(t.config,n);lt(t,l),Ht(n.length);let d=a.outDir??t.config.outDir,s=i.resolve(t.root,d);await o.promises.mkdir(s,{recursive:!0}),console.log(` Building to ${d}...`);let g=v(t);await o.promises.writeFile(i.join(s,"index.html"),g);let y={files:n.map((r)=>({id:r.id,fileName:r.fileName,relativePath:r.relativePath,treePath:r.treePath})),tree:l};await o.promises.writeFile(i.join(s,"stories.json"),JSON.stringify(y,null,2));let u={theme:t.config.theme,responsivePresets:t.config.responsivePresets,backgroundPresets:t.config.backgroundPresets};await o.promises.writeFile(i.join(s,"config.json"),JSON.stringify(u,null,2));let p=i.join(s,"stories");await o.promises.mkdir(p,{recursive:!0});for(let r of n){let b=await o.promises.readFile(r.path,"utf-8");await o.promises.writeFile(i.join(p,`${r.id}.stx`),b)}m(t);let h=f();await o.promises.writeFile(i.join(s,"search-index.json"),h);let x=Date.now()-e;Mi(n.length,d,x)}function v(a){let{theme:e}=a.config,t=e.title||"STX Story";return`<!DOCTYPE html>
3
3
  <html lang="en">
4
4
  <head>
5
5
  <meta charset="UTF-8">
@@ -1,8 +1,8 @@
1
1
  // @bun
2
- var uo=new Map([["craft-button",{name:"Button",zigType:"craft.Button",props:[{name:"variant",type:"string",required:!1,default:"primary"},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onclick",type:"callback",required:!1}],children:"single"}],["craft-text-input",{name:"TextInput",zigType:"craft.TextInput",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-textarea",{name:"TextArea",zigType:"craft.TextArea",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"rows",type:"number",required:!1,default:3},{name:"disabled",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-checkbox",{name:"Checkbox",zigType:"craft.Checkbox",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"label",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-select",{name:"Select",zigType:"craft.Select",props:[{name:"value",type:"string",required:!1},{name:"options",type:"array",required:!0},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-slider",{name:"Slider",zigType:"craft.Slider",props:[{name:"value",type:"number",required:!1,default:0},{name:"min",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"step",type:"number",required:!1,default:1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-toggle",{name:"Toggle",zigType:"craft.Toggle",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-modal",{name:"Modal",zigType:"craft.Modal",props:[{name:"open",type:"boolean",required:!1,default:!1},{name:"title",type:"string",required:!1},{name:"closable",type:"boolean",required:!1,default:!0},{name:"onclose",type:"callback",required:!1}],children:"multiple"}],["craft-alert",{name:"Alert",zigType:"craft.Alert",props:[{name:"variant",type:"string",required:!1,default:"info"},{name:"title",type:"string",required:!1},{name:"dismissible",type:"boolean",required:!1,default:!1}],children:"single"}],["craft-progress",{name:"ProgressBar",zigType:"craft.ProgressBar",props:[{name:"value",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"indeterminate",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-spinner",{name:"Spinner",zigType:"craft.Spinner",props:[{name:"size",type:"number",required:!1,default:24}],children:"none"}],["craft-avatar",{name:"Avatar",zigType:"craft.Avatar",props:[{name:"src",type:"string",required:!1},{name:"alt",type:"string",required:!1},{name:"size",type:"number",required:!1,default:40}],children:"none"}],["craft-badge",{name:"Badge",zigType:"craft.Badge",props:[{name:"variant",type:"string",required:!1,default:"default"}],children:"single"}],["craft-card",{name:"Card",zigType:"craft.Card",props:[{name:"padding",type:"number",required:!1,default:16}],children:"multiple"}],["craft-sidebar",{name:"Sidebar",zigType:"craft.NativeSidebar",props:[{name:"id",type:"string",required:!1},{name:"variant",type:"string",required:!1,default:"desktop"},{name:"material",type:"string",required:!1,default:"sidebar"},{name:"backgroundEffect",type:"string",required:!1,default:"shimmer"},{name:"allowsVibrancy",type:"boolean",required:!1,default:!0},{name:"materialOpacity",type:"number",required:!1,default:0.68},{name:"minWidth",type:"number",required:!1,default:240},{name:"maxWidth",type:"number",required:!1,default:340},{name:"canCollapse",type:"boolean",required:!1,default:!0},{name:"selectedItem",type:"string",required:!1},{name:"sections",type:"array",required:!1}],children:"multiple",platform:["macos"],fallback:"aside"}],["craft-sidebar-section",{name:"SidebarSection",zigType:"craft.NativeSidebarSection",props:[{name:"id",type:"string",required:!0},{name:"title",type:"string",required:!1},{name:"header",type:"string",required:!1}],children:"multiple",platform:["macos"],fallback:"section"}],["craft-sidebar-item",{name:"SidebarItem",zigType:"craft.NativeSidebarItem",props:[{name:"id",type:"string",required:!0},{name:"label",type:"string",required:!0},{name:"icon",type:"string",required:!1},{name:"badge",type:"string",required:!1},{name:"tintColor",type:"color",required:!1}],children:"none",platform:["macos"],fallback:"button"}],["craft-accordion",{name:"Accordion",zigType:"craft.Accordion",props:[{name:"title",type:"string",required:!0},{name:"open",type:"boolean",required:!1,default:!1}],children:"multiple"}],["craft-tabs",{name:"TabView",zigType:"craft.TabView",props:[{name:"activeTab",type:"number",required:!1,default:0},{name:"ontabchange",type:"callback",required:!1}],children:"multiple"}],["craft-tooltip",{name:"Tooltip",zigType:"craft.Tooltip",props:[{name:"content",type:"string",required:!0},{name:"position",type:"string",required:!1,default:"top"}],children:"single"}],["craft-date-picker",{name:"DatePicker",zigType:"craft.DatePicker",props:[{name:"value",type:"string",required:!1},{name:"min",type:"string",required:!1},{name:"max",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-time-picker",{name:"TimePicker",zigType:"craft.TimePicker",props:[{name:"value",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-color-picker",{name:"ColorPicker",zigType:"craft.ColorPicker",props:[{name:"value",type:"color",required:!1,default:"#000000"},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-data-table",{name:"DataTable",zigType:"craft.DataTable",props:[{name:"data",type:"array",required:!0},{name:"columns",type:"array",required:!0},{name:"sortable",type:"boolean",required:!1,default:!1},{name:"paginated",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-virtual-list",{name:"VirtualList",zigType:"craft.VirtualList",props:[{name:"items",type:"array",required:!0},{name:"itemHeight",type:"number",required:!1,default:48},{name:"renderItem",type:"callback",required:!0}],children:"none"}],["craft-tree-view",{name:"TreeView",zigType:"craft.TreeView",props:[{name:"data",type:"object",required:!0},{name:"expandable",type:"boolean",required:!1,default:!0}],children:"none"}]]);async function ha(e,t={}){let r=performance.now(),n={target:t.target||"universal",format:t.format||"zig",optimize:t.optimize??!0,treeShake:t.treeShake??!0,hotReload:t.hotReload??!1,debug:t.debug??!1,sourceMaps:t.sourceMaps??!1,bundle:t.bundle??!0,minify:t.minify??!1,components:t.components||uo},i=typeof e==="string"?w(e):e,o=I(i.tree,n),s=L(o),a=n.treeShake?O(o,s):o,l=new Map;if(n.target==="universal"){let c=["macos","windows","linux","ios","android"];for(let g of c){let q=u(a,{...n,target:g});l.set(g,q)}}else{let c=u(a,n);l.set(n.target,c)}let p=H(a,n,l),S=_(i,a,n),k={compilationTime:performance.now()-r,totalComponents:f(i.tree),nativeComponents:d(a),webComponents:f(i.tree)-d(a),bundleSize:p.length,treeShakenSize:n.treeShake?W(o,a):p.length,warnings:[],errors:[]},m;if(n.sourceMaps)m=B(i,a);return{code:p,platformCode:l,dependencies:s,manifest:S,sourceMaps:m,stats:k}}function w(e){let t={type:"fragment",children:[]},r=e.match(/<body[^>]*>([\s\S]*?)<\/body>/i),n=r?r[1]:e;return b(n,t),{id:T(),hash:x(e),tree:t,scripts:U(e),styles:Z(e),staticParts:new Map,dynamicParts:new Map,dependencies:[],metadata:{hasSlots:!1,hasDynamicContent:e.includes("{{"),hasEventHandlers:e.includes("onclick")||e.includes("onchange"),hasAsyncContent:!1,componentCount:0,maxDepth:0,estimatedSize:e.length}}}function b(e,t){let r=/<(@?[\w-]+)([^>]*)(?:\/>|>([\s\S]*?)<\/\1>)/g,n;while((n=r.exec(e))!==null){let[,i,o,s]=n,a=i.startsWith("@craft-"),l={type:a?"component":"element",tag:a?i.slice(1):i,props:z(o),children:[],componentName:a?i.slice(1):void 0};if(s){let p=s.replace(/<[^>]+>/g,"").trim();if(p)l.children=l.children??[],l.children.push({type:"text",text:p});b(s,l)}t.children=t.children??[],t.children.push(l)}}function z(e){let t={},r=/([\w-:@]+)(?:=["']([^"']*)["'])?/g,n;while((n=r.exec(e))!==null){let[,i,o]=n;t[i]=o??!0}return t}function I(e,t){return h(e,t)}function h(e,t){let r=e.componentName?t.components?.get(e.componentName):void 0,n="craft.View";if(r)n=r.zigType;else if(e.type==="text")n="craft.Text";else if(e.tag)n=R(e.tag);let i={};if(e.props)for(let[l,p]of Object.entries(e.props))i[l]=M(p);let o=[];if(e.children)for(let l of e.children)o.push(h(l,t));let s=new Map;if(e.props){for(let[l,p]of Object.entries(e.props))if(l.startsWith("on")&&typeof p==="string")s.set(l.slice(2).toLowerCase(),p)}let a=V(e);return{type:A(e,r),zigType:n,props:i,children:o,events:s,styles:a,id:e.hydrationKey,key:e.props?.key}}function R(e){return{div:"craft.View",span:"craft.Text",p:"craft.Text",h1:"craft.Text",h2:"craft.Text",h3:"craft.Text",h4:"craft.Text",h5:"craft.Text",h6:"craft.Text",button:"craft.Button",input:"craft.TextInput",textarea:"craft.TextArea",select:"craft.Select",img:"craft.Image",a:"craft.Link",ul:"craft.List",ol:"craft.List",li:"craft.ListItem",form:"craft.Form",label:"craft.Label",nav:"craft.View",header:"craft.View",footer:"craft.View",main:"craft.View",section:"craft.View",article:"craft.View",aside:"craft.View"}[e.toLowerCase()]||"craft.View"}function M(e){if(typeof e==="string"){if(e.startsWith("{{")&&e.endsWith("}}"))return{type:"binding",path:e.slice(2,-2).trim()};if(e.includes("(")&&e.includes(")"))return{type:"callback",handler:e};return{type:"literal",value:e}}if(typeof e==="number"||typeof e==="boolean")return{type:"literal",value:e};return{type:"literal",value:String(e)}}function A(e,t){if(t){let n=t.name.toLowerCase();if(n.includes("button"))return"button";if(n.includes("input")||n.includes("text"))return"input";if(n.includes("image")||n.includes("avatar"))return"image";if(n.includes("list")||n.includes("table"))return"list";if(n.includes("scroll"))return"scroll";return"custom"}if(e.type==="text")return"text";let r=e.tag?.toLowerCase();if(r==="button")return"button";if(r==="input"||r==="textarea")return"input";if(r==="img")return"image";if(r==="ul"||r==="ol")return"list";return"view"}function V(e){let t=e.props?.style,r={},n={};if(t){let i=t.split(";").filter(Boolean);for(let o of i){let[s,a]=o.split(":").map((l)=>l.trim());if(!s||!a)continue;switch(s){case"display":r.display=a;break;case"flex-direction":r.flexDirection=a;break;case"justify-content":r.justifyContent=j(a);break;case"align-items":r.alignItems=D(a);break;case"gap":r.gap=Number.parseInt(a,10);break;case"padding":r.padding=Number.parseInt(a,10);break;case"margin":r.margin=Number.parseInt(a,10);break;case"width":r.width=a==="auto"?"auto":Number.parseInt(a,10);break;case"height":r.height=a==="auto"?"auto":Number.parseInt(a,10);break;case"background-color":case"background":n.backgroundColor=a;break;case"border-color":n.borderColor=a;break;case"border-width":n.borderWidth=Number.parseInt(a,10);break;case"border-radius":n.borderRadius=Number.parseInt(a,10);break;case"opacity":n.opacity=Number.parseFloat(a);break}}}return{layout:r,appearance:n}}function j(e){return{"flex-start":"start","flex-end":"end",center:"center","space-between":"between","space-around":"around"}[e]||"start"}function D(e){return{"flex-start":"start","flex-end":"end",center:"center",stretch:"stretch"}[e]||"start"}function L(e){let t=[],r=new Set;function n(i,o){let s=i.id||T();if(r.has(s))return;r.add(s);let a={id:s,type:"component",path:i.zigType,dependencies:o?[o]:[],size:C(i),isStatic:P(i)};t.push(a);for(let l of i.children)n(l,s)}return n(e),t}function C(e){let t=100;return t+=Object.keys(e.props).length*20,t+=e.events.size*50,t}function P(e){for(let t of Object.values(e.props))if(t.type!=="literal")return!1;return e.events.size===0}function O(e,t){return e}function W(e,t){let r=0;function n(i){r+=C(i);for(let o of i.children)n(o)}return n(t),r}function u(e,t){switch(t.format){case"zig":return y(e,t);case"typescript":return E(e,t);case"json":return JSON.stringify(e,null,t.minify?0:2);default:return y(e,t)}}function y(e,t){let r=[];return r.push("// Auto-generated by stx compiler"),r.push("// Target: "+t.target),r.push(""),r.push('const std = @import("std");'),r.push('const craft = @import("craft");'),r.push(""),r.push("pub fn render(allocator: std.mem.Allocator) !craft.Element {"),r.push(" return try build(allocator);"),r.push("}"),r.push(""),N(e,r,0),r.join(`
2
+ var po=new Map([["craft-button",{name:"Button",zigType:"craft.Button",props:[{name:"variant",type:"string",required:!1,default:"primary"},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onclick",type:"callback",required:!1}],children:"single"}],["craft-text-input",{name:"TextInput",zigType:"craft.TextInput",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-textarea",{name:"TextArea",zigType:"craft.TextArea",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"rows",type:"number",required:!1,default:3},{name:"disabled",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-checkbox",{name:"Checkbox",zigType:"craft.Checkbox",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"label",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-select",{name:"Select",zigType:"craft.Select",props:[{name:"value",type:"string",required:!1},{name:"options",type:"array",required:!0},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-slider",{name:"Slider",zigType:"craft.Slider",props:[{name:"value",type:"number",required:!1,default:0},{name:"min",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"step",type:"number",required:!1,default:1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-toggle",{name:"Toggle",zigType:"craft.Toggle",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-modal",{name:"Modal",zigType:"craft.Modal",props:[{name:"open",type:"boolean",required:!1,default:!1},{name:"title",type:"string",required:!1},{name:"closable",type:"boolean",required:!1,default:!0},{name:"onclose",type:"callback",required:!1}],children:"multiple"}],["craft-alert",{name:"Alert",zigType:"craft.Alert",props:[{name:"variant",type:"string",required:!1,default:"info"},{name:"title",type:"string",required:!1},{name:"dismissible",type:"boolean",required:!1,default:!1}],children:"single"}],["craft-progress",{name:"ProgressBar",zigType:"craft.ProgressBar",props:[{name:"value",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"indeterminate",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-spinner",{name:"Spinner",zigType:"craft.Spinner",props:[{name:"size",type:"number",required:!1,default:24}],children:"none"}],["craft-avatar",{name:"Avatar",zigType:"craft.Avatar",props:[{name:"src",type:"string",required:!1},{name:"alt",type:"string",required:!1},{name:"size",type:"number",required:!1,default:40}],children:"none"}],["craft-badge",{name:"Badge",zigType:"craft.Badge",props:[{name:"variant",type:"string",required:!1,default:"default"}],children:"single"}],["craft-card",{name:"Card",zigType:"craft.Card",props:[{name:"padding",type:"number",required:!1,default:16}],children:"multiple"}],["craft-sidebar",{name:"Sidebar",zigType:"craft.NativeSidebar",props:[{name:"id",type:"string",required:!1},{name:"variant",type:"string",required:!1,default:"desktop"},{name:"material",type:"string",required:!1,default:"sidebar"},{name:"backgroundEffect",type:"string",required:!1,default:"shimmer"},{name:"allowsVibrancy",type:"boolean",required:!1,default:!0},{name:"materialOpacity",type:"number",required:!1,default:0.68},{name:"minWidth",type:"number",required:!1,default:240},{name:"maxWidth",type:"number",required:!1,default:340},{name:"canCollapse",type:"boolean",required:!1,default:!0},{name:"selectedItem",type:"string",required:!1},{name:"sections",type:"array",required:!1}],children:"multiple",platform:["macos"],fallback:"aside"}],["craft-sidebar-section",{name:"SidebarSection",zigType:"craft.NativeSidebarSection",props:[{name:"id",type:"string",required:!0},{name:"title",type:"string",required:!1},{name:"header",type:"string",required:!1}],children:"multiple",platform:["macos"],fallback:"section"}],["craft-sidebar-item",{name:"SidebarItem",zigType:"craft.NativeSidebarItem",props:[{name:"id",type:"string",required:!0},{name:"label",type:"string",required:!0},{name:"icon",type:"string",required:!1},{name:"badge",type:"string",required:!1},{name:"tintColor",type:"color",required:!1}],children:"none",platform:["macos"],fallback:"button"}],["craft-accordion",{name:"Accordion",zigType:"craft.Accordion",props:[{name:"title",type:"string",required:!0},{name:"open",type:"boolean",required:!1,default:!1}],children:"multiple"}],["craft-tabs",{name:"TabView",zigType:"craft.TabView",props:[{name:"activeTab",type:"number",required:!1,default:0},{name:"ontabchange",type:"callback",required:!1}],children:"multiple"}],["craft-tooltip",{name:"Tooltip",zigType:"craft.Tooltip",props:[{name:"content",type:"string",required:!0},{name:"position",type:"string",required:!1,default:"top"}],children:"single"}],["craft-date-picker",{name:"DatePicker",zigType:"craft.DatePicker",props:[{name:"value",type:"string",required:!1},{name:"min",type:"string",required:!1},{name:"max",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-time-picker",{name:"TimePicker",zigType:"craft.TimePicker",props:[{name:"value",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-color-picker",{name:"ColorPicker",zigType:"craft.ColorPicker",props:[{name:"value",type:"color",required:!1,default:"#000000"},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-data-table",{name:"DataTable",zigType:"craft.DataTable",props:[{name:"data",type:"array",required:!0},{name:"columns",type:"array",required:!0},{name:"sortable",type:"boolean",required:!1,default:!1},{name:"paginated",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-virtual-list",{name:"VirtualList",zigType:"craft.VirtualList",props:[{name:"items",type:"array",required:!0},{name:"itemHeight",type:"number",required:!1,default:48},{name:"renderItem",type:"callback",required:!0}],children:"none"}],["craft-tree-view",{name:"TreeView",zigType:"craft.TreeView",props:[{name:"data",type:"object",required:!0},{name:"expandable",type:"boolean",required:!1,default:!0}],children:"none"}]]);async function ya(e,t={}){let r=performance.now(),n={target:t.target||"universal",format:t.format||"zig",optimize:t.optimize??!0,treeShake:t.treeShake??!0,hotReload:t.hotReload??!1,debug:t.debug??!1,sourceMaps:t.sourceMaps??!1,bundle:t.bundle??!0,minify:t.minify??!1,components:t.components||po},i=typeof e==="string"?w(e):e,o=I(i.tree,n),s=L(o),a=n.treeShake?O(o,s):o,l=new Map;if(n.target==="universal"){let c=["macos","windows","linux","ios","android"];for(let g of c){let q=u(a,{...n,target:g});l.set(g,q)}}else{let c=u(a,n);l.set(n.target,c)}let p=H(a,n,l),S=_(i,a,n),k={compilationTime:performance.now()-r,totalComponents:f(i.tree),nativeComponents:d(a),webComponents:f(i.tree)-d(a),bundleSize:p.length,treeShakenSize:n.treeShake?W(o,a):p.length,warnings:[],errors:[]},m;if(n.sourceMaps)m=B(i,a);return{code:p,platformCode:l,dependencies:s,manifest:S,sourceMaps:m,stats:k}}function w(e){let t={type:"fragment",children:[]},r=e.match(/<body[^>]*>([\s\S]*?)<\/body>/i),n=r?r[1]:e;return b(n,t),{id:T(),hash:x(e),tree:t,scripts:U(e),styles:Z(e),staticParts:new Map,dynamicParts:new Map,dependencies:[],metadata:{hasSlots:!1,hasDynamicContent:e.includes("{{"),hasEventHandlers:e.includes("onclick")||e.includes("onchange"),hasAsyncContent:!1,componentCount:0,maxDepth:0,estimatedSize:e.length}}}function b(e,t){let r=/<(@?[\w-]+)([^>]*)(?:\/>|>([\s\S]*?)<\/\1>)/g,n;while((n=r.exec(e))!==null){let[,i,o,s]=n,a=i.startsWith("@craft-"),l={type:a?"component":"element",tag:a?i.slice(1):i,props:z(o),children:[],componentName:a?i.slice(1):void 0};if(s){let p=s.replace(/<[^>]+>/g,"").trim();if(p)l.children=l.children??[],l.children.push({type:"text",text:p});b(s,l)}t.children=t.children??[],t.children.push(l)}}function z(e){let t={},r=/([\w-:@]+)(?:=["']([^"']*)["'])?/g,n;while((n=r.exec(e))!==null){let[,i,o]=n;t[i]=o??!0}return t}function I(e,t){return h(e,t)}function h(e,t){let r=e.componentName?t.components?.get(e.componentName):void 0,n="craft.View";if(r)n=r.zigType;else if(e.type==="text")n="craft.Text";else if(e.tag)n=R(e.tag);let i={};if(e.props)for(let[l,p]of Object.entries(e.props))i[l]=M(p);let o=[];if(e.children)for(let l of e.children)o.push(h(l,t));let s=new Map;if(e.props){for(let[l,p]of Object.entries(e.props))if(l.startsWith("on")&&typeof p==="string")s.set(l.slice(2).toLowerCase(),p)}let a=V(e);return{type:A(e,r),zigType:n,props:i,children:o,events:s,styles:a,id:e.hydrationKey,key:e.props?.key}}function R(e){return{div:"craft.View",span:"craft.Text",p:"craft.Text",h1:"craft.Text",h2:"craft.Text",h3:"craft.Text",h4:"craft.Text",h5:"craft.Text",h6:"craft.Text",button:"craft.Button",input:"craft.TextInput",textarea:"craft.TextArea",select:"craft.Select",img:"craft.Image",a:"craft.Link",ul:"craft.List",ol:"craft.List",li:"craft.ListItem",form:"craft.Form",label:"craft.Label",nav:"craft.View",header:"craft.View",footer:"craft.View",main:"craft.View",section:"craft.View",article:"craft.View",aside:"craft.View"}[e.toLowerCase()]||"craft.View"}function M(e){if(typeof e==="string"){if(e.startsWith("{{")&&e.endsWith("}}"))return{type:"binding",path:e.slice(2,-2).trim()};if(e.includes("(")&&e.includes(")"))return{type:"callback",handler:e};return{type:"literal",value:e}}if(typeof e==="number"||typeof e==="boolean")return{type:"literal",value:e};return{type:"literal",value:String(e)}}function A(e,t){if(t){let n=t.name.toLowerCase();if(n.includes("button"))return"button";if(n.includes("input")||n.includes("text"))return"input";if(n.includes("image")||n.includes("avatar"))return"image";if(n.includes("list")||n.includes("table"))return"list";if(n.includes("scroll"))return"scroll";return"custom"}if(e.type==="text")return"text";let r=e.tag?.toLowerCase();if(r==="button")return"button";if(r==="input"||r==="textarea")return"input";if(r==="img")return"image";if(r==="ul"||r==="ol")return"list";return"view"}function V(e){let t=e.props?.style,r={},n={};if(t){let i=t.split(";").filter(Boolean);for(let o of i){let[s,a]=o.split(":").map((l)=>l.trim());if(!s||!a)continue;switch(s){case"display":r.display=a;break;case"flex-direction":r.flexDirection=a;break;case"justify-content":r.justifyContent=j(a);break;case"align-items":r.alignItems=D(a);break;case"gap":r.gap=Number.parseInt(a,10);break;case"padding":r.padding=Number.parseInt(a,10);break;case"margin":r.margin=Number.parseInt(a,10);break;case"width":r.width=a==="auto"?"auto":Number.parseInt(a,10);break;case"height":r.height=a==="auto"?"auto":Number.parseInt(a,10);break;case"background-color":case"background":n.backgroundColor=a;break;case"border-color":n.borderColor=a;break;case"border-width":n.borderWidth=Number.parseInt(a,10);break;case"border-radius":n.borderRadius=Number.parseInt(a,10);break;case"opacity":n.opacity=Number.parseFloat(a);break}}}return{layout:r,appearance:n}}function j(e){return{"flex-start":"start","flex-end":"end",center:"center","space-between":"between","space-around":"around"}[e]||"start"}function D(e){return{"flex-start":"start","flex-end":"end",center:"center",stretch:"stretch"}[e]||"start"}function L(e){let t=[],r=new Set;function n(i,o){let s=i.id||T();if(r.has(s))return;r.add(s);let a={id:s,type:"component",path:i.zigType,dependencies:o?[o]:[],size:C(i),isStatic:P(i)};t.push(a);for(let l of i.children)n(l,s)}return n(e),t}function C(e){let t=100;return t+=Object.keys(e.props).length*20,t+=e.events.size*50,t}function P(e){for(let t of Object.values(e.props))if(t.type!=="literal")return!1;return e.events.size===0}function O(e,t){return e}function W(e,t){let r=0;function n(i){r+=C(i);for(let o of i.children)n(o)}return n(t),r}function u(e,t){switch(t.format){case"zig":return y(e,t);case"typescript":return E(e,t);case"json":return JSON.stringify(e,null,t.minify?0:2);default:return y(e,t)}}function y(e,t){let r=[];return r.push("// Auto-generated by stx compiler"),r.push("// Target: "+t.target),r.push(""),r.push('const std = @import("std");'),r.push('const craft = @import("craft");'),r.push(""),r.push("pub fn render(allocator: std.mem.Allocator) !craft.Element {"),r.push(" return try build(allocator);"),r.push("}"),r.push(""),N(e,r,0),r.join(`
3
3
  `)}function N(e,t,r){let n=" ".repeat(r);if(r===0)t.push("fn build(allocator: std.mem.Allocator) !craft.Element {");let i=`node_${r}`;t.push(`${n} var ${i} = try ${e.zigType}.init(allocator);`);for(let[o,s]of Object.entries(e.props))if(s.type==="literal"){let a=typeof s.value==="string"?`"${s.value}"`:String(s.value);t.push(`${n} ${i}.set${J(o)}(${a});`)}for(let o=0;o<e.children.length;o++){let s=e.children[o];if(s.type==="text"){let a=s.props.text?.type==="literal"?String(s.props.text.value):"";t.push(`${n} try ${i}.addChild(try craft.Text.init(allocator, "${a}"));`)}else N(s,t,r+1),t.push(`${n} try ${i}.addChild(node_${r+1});`)}if(r===0)t.push(` return ${i}.element();`),t.push("}")}function E(e,t){let r=[];return r.push("// Auto-generated by stx compiler"),r.push("// Target: "+t.target),r.push(""),r.push('import { Craft } from "@stacksjs/craft";'),r.push(""),r.push("export function render(): Craft.Element {"),r.push(" return "+v(e,1)+";"),r.push("}"),r.join(`
4
4
  `)}function v(e,t){let r=" ".repeat(t),n=[];for(let[a,l]of Object.entries(e.props))if(l.type==="literal"){let p=typeof l.value==="string"?`"${l.value}"`:String(l.value);n.push(`${a}: ${p}`)}let i=n.length>0?`{ ${n.join(", ")} }`:"{}",o=e.children.map((a)=>a.type==="text"?`"${a.props.text?.type==="literal"?a.props.text.value:""}"`:v(a,t+1)),s=o.length>0?`,
5
5
  ${r} [${o.join(`,
6
6
  ${r} `)}]`:"";return`Craft.create("${e.zigType}", ${i}${s})`}function H(e,t,r){if(t.target==="universal"){let n=[];n.push("// Universal entry point"),n.push("");for(let[i,o]of r)n.push(`// --- ${i.toUpperCase()} ---`),n.push(`#if ${i.toUpperCase()}`),n.push(o),n.push("#endif"),n.push("");return n.join(`
7
- `)}return r.get(t.target)||u(e,t)}function _(e,t,r){let n=[];function i(o){n.push({name:o.zigType,hash:x(JSON.stringify(o.props)),props:Object.keys(o.props),events:Array.from(o.events.keys()),slots:[],isNative:o.zigType.startsWith("craft.")});for(let s of o.children)i(s)}return i(t),{version:"1.0.0",components:n,entry:e.id,assets:[],styles:e.styles}}function B(e,t){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}var F=0;function T(){return`id_${++F}`}function x(e){let t=0;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return Math.abs(t).toString(36)}function J(e){return e.charAt(0).toUpperCase()+e.slice(1)}function U(e){let t=[],r=/<script[^>]*>([\s\S]*?)<\/script>/gi,n;while((n=r.exec(e))!==null)t.push(n[1]);return t}function Z(e){let t=[],r=/<style[^>]*>([\s\S]*?)<\/style>/gi,n;while((n=r.exec(e))!==null)t.push(n[1]);return t}function f(e){let t=e.type==="component"?1:0;if(e.children)for(let r of e.children)t+=f(r);return t}function d(e){let t=e.zigType.startsWith("craft.")?1:0;for(let r of e.children)t+=d(r);return t}function ya(e){return{start:async()=>{console.log("[craft-compiler] Hot reload server started")},stop:async()=>{console.log("[craft-compiler] Hot reload server stopped")},notifyChange:(t)=>{console.log(`[craft-compiler] File changed: ${t}`)}}}var K={compileToNative:ha,createHotReloadServer:ya,NATIVE_COMPONENTS:uo},Ym=K;
8
- export{uo,ha,ya,Ym};
7
+ `)}return r.get(t.target)||u(e,t)}function _(e,t,r){let n=[];function i(o){n.push({name:o.zigType,hash:x(JSON.stringify(o.props)),props:Object.keys(o.props),events:Array.from(o.events.keys()),slots:[],isNative:o.zigType.startsWith("craft.")});for(let s of o.children)i(s)}return i(t),{version:"1.0.0",components:n,entry:e.id,assets:[],styles:e.styles}}function B(e,t){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}var F=0;function T(){return`id_${++F}`}function x(e){let t=0;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return Math.abs(t).toString(36)}function J(e){return e.charAt(0).toUpperCase()+e.slice(1)}function U(e){let t=[],r=/<script[^>]*>([\s\S]*?)<\/script>/gi,n;while((n=r.exec(e))!==null)t.push(n[1]);return t}function Z(e){let t=[],r=/<style[^>]*>([\s\S]*?)<\/style>/gi,n;while((n=r.exec(e))!==null)t.push(n[1]);return t}function f(e){let t=e.type==="component"?1:0;if(e.children)for(let r of e.children)t+=f(r);return t}function d(e){let t=e.zigType.startsWith("craft.")?1:0;for(let r of e.children)t+=d(r);return t}function ba(e){return{start:async()=>{console.log("[craft-compiler] Hot reload server started")},stop:async()=>{console.log("[craft-compiler] Hot reload server stopped")},notifyChange:(t)=>{console.log(`[craft-compiler] File changed: ${t}`)}}}var K={compileToNative:ya,createHotReloadServer:ba,NATIVE_COMPONENTS:po},Zm=K;
8
+ export{po,ya,ba,Zm};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import c from"fs";import i from"path";import{createHash as k}from"crypto";var j=["pages","components","layouts","partials","composables"],w=new Set;function cc(e){try{return w.has(c.realpathSync(e))}catch{return w.has(i.resolve(e))}}var _=new Set(["extends","root",...j.map((e)=>`${e}Dir`),"publicDir","stateDir","cachePath"]),x=(e)=>e!==null&&typeof e==="object"&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null);function b(e,n,r=""){if(Array.isArray(n))return["middleware","plugins"].includes(r)?[...Array.isArray(e)?e:[],...n]:[...n];if(!x(n))return n;let o={...x(e)?e:{}};for(let[s,a]of Object.entries(n)){if(["__proto__","constructor","prototype"].includes(s))throw Error(`Invalid layer config key: ${s}`);o[s]=b(o[s],a,s)}return o}function v(e){for(let n of["stx.config.ts","stx.config.js","stx.config.mjs",".config/stx.config.ts",".config/stx.ts","ui.config.ts"]){let r=i.join(e,n);if(c.existsSync(r))return c.realpathSync(r)}throw Error(`Application layer has no stx.config.ts: ${e}`)}function E(e,n,r){if(typeof e!=="string"||!e||/^(?:https?:|git[+:])/.test(e))throw Error(`Invalid application layer ${JSON.stringify(e)} in ${n}; use a local path or installed package`);if(e.startsWith(".")||i.isAbsolute(e)){let s=i.resolve(n,e);return c.statSync(s).isDirectory()?v(s):c.realpathSync(s)}let o=n;while(!0){let s=i.join(o,"node_modules",e),a=i.join(s,"package.json");if(c.existsSync(a)){r.add(c.realpathSync(a));let g=JSON.parse(c.readFileSync(a,"utf8"));return g.stx?.layer?c.realpathSync(i.resolve(s,g.stx.layer)):v(s)}let p=i.dirname(o);if(p===o)break;o=p}throw Error(`Cannot resolve application layer ${JSON.stringify(e)} from ${n}`)}async function C(e,n){let r=await Bun.build({entrypoints:[e],target:"bun",format:"esm",splitting:!1,plugins:[{name:"stx-layer-config",setup(a){a.onResolve({filter:/^[^./]/},(p)=>{if(p.path.startsWith("node:"))return{path:p.path,external:!0};return{path:Bun.resolveSync(p.path,p.resolveDir),external:!0}}),a.onLoad({filter:/./},(p)=>{let g=c.realpathSync(p.path);n.add(g),w.add(g);return})}}]});if(!r.success)throw Error(`Cannot load layer ${e}: ${r.logs.join(`
3
- `)}`);let o=r.outputs.find((a)=>a.kind==="entry-point");if(!o||r.outputs.length!==1)throw Error(`Unsupported layer config output: ${e}`);let s=(await import(`data:text/javascript;base64,${Buffer.from(await o.text()).toString("base64")}`)).default;if(!x(s))throw Error(`Layer ${e} must default-export a config object`);return s}async function lc(e,n){let r=new Set,o=[],s=[],a=new Set,p=[];async function g(t,l){if(t=c.realpathSync(t),p.includes(t))throw Error(`Application layer cycle: ${[...p,t].join(" -> ")}`);if(a.has(t))return;a.add(t),p.push(t);let d=await C(t,r);l??=i.basename(i.dirname(t))===".config"?i.dirname(i.dirname(t)):i.dirname(t),l=c.realpathSync(l);let D=i.resolve(l,d.root??"."),L=Object.fromEntries(j.map((y)=>[y,i.resolve(D,d[`${y}Dir`]??(y==="composables"?"functions":y))]));o.push({root:l,configFile:t,resources:L});let u={...d};if(u.plugins)u.plugins=u.plugins.map((y)=>{let h=typeof y==="string"?y:y[0],S=h.startsWith(".")?i.resolve(l,h):i.isAbsolute(h)?h:Bun.resolveSync(h,l);return r.add(c.realpathSync(S)),typeof y==="string"?S:[S,y[1]]});if(typeof u.css==="string")u.css=i.resolve(l,u.css);if(u.serverApi)u.serverApi={...typeof u.serverApi==="object"?u.serverApi:{},dir:i.resolve(l,typeof u.serverApi==="object"?u.serverApi.dir??"server/api":"server/api")};if(s.push(u),d.extends!==void 0&&!Array.isArray(d.extends))throw Error(`extends in ${t} must be an array`);for(let y of d.extends??[])await g(E(y,l,r));p.pop()}await g(v(e),e);for(let t of["package.json","bun.lock","package-lock.json","pnpm-lock.yaml"]){let l=i.join(e,t);if(c.existsSync(l))r.add(c.realpathSync(l))}let f=b({},n);for(let t=s.length-1;t>=0;t--){let l=t===0?s[t]:Object.fromEntries(Object.entries(s[t]).filter(([d])=>!_.has(d)));f=b(f,l)}let m={layers:o,configDependencies:[...r].sort()};return f._layerGraph=m,f._layerPageDirs=o.map((t)=>t.resources.pages),f._layerComponentDirs=o.map((t)=>t.resources.components),f._layerLayoutDirs=o.map((t)=>t.resources.layouts),f._layerPartialDirs=o.map((t)=>t.resources.partials),f._layerComposableDirs=o.map((t)=>t.resources.composables),await Fo(m,e),{config:f,graph:m}}async function Fo(e,n){let r=new Map,o=[];for(let s of e.layers)for(let[a,p]of Object.entries(s.resources)){if(!c.existsSync(p))continue;let g=new Bun.Glob(a==="composables"?"**/*.ts":"**/*.stx");for(let f of[...g.scanSync({cwd:p})].sort()){let m=`${a}/${f}`,t=i.join(p,f),l=r.get(m);if(l)o.push({resource:m,winner:l,shadowed:t});else r.set(m,t)}}Object.assign(e,{overrides:o}),await Bun.write(i.join(n,".stx/layers.json"),JSON.stringify(e,null,2))}function A(e){let n=new Set(e.configDependencies);function r(o){if(!c.existsSync(o))return;n.add(o);for(let s of c.readdirSync(o,{withFileTypes:!0}).sort((a,p)=>a.name.localeCompare(p.name))){if(s.name.startsWith(".")||s.name==="node_modules")continue;let a=i.join(o,s.name);if(s.isDirectory())r(a);else if(s.isFile())n.add(a)}}for(let o of e.layers)for(let s of Object.values(o.resources))r(s);return[...n].sort()}function ps(e){return O(A(e))}function gs(e){return O(e.configDependencies)}function O(e){return e.map((n)=>{try{let r=c.statSync(n);return`${n}:${r.mtimeMs}:${r.size}`}catch{return`${n}:missing`}}).join(`
4
- `)}function uc(e){return e.layers.map((n)=>({config:i.relative(n.root,n.configFile),files:A({layers:[n],configDependencies:e.configDependencies.filter((r)=>r.startsWith(`${n.root}${i.sep}`))}).filter((r)=>c.statSync(r).isFile()).map((r)=>({path:i.relative(n.root,r).replaceAll(i.sep,"/"),sha256:k("sha256").update(c.readFileSync(r)).digest("hex")}))}))}
5
- export{cc,lc,Fo,ps,gs,uc};
2
+ import c from"fs";import i from"path";import{createHash as k}from"crypto";var j=["pages","components","layouts","partials","composables"],w=new Set;function lc(e){try{return w.has(c.realpathSync(e))}catch{return w.has(i.resolve(e))}}var _=new Set(["extends","root",...j.map((e)=>`${e}Dir`),"publicDir","stateDir","cachePath"]),x=(e)=>e!==null&&typeof e==="object"&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null);function b(e,n,r=""){if(Array.isArray(n))return["middleware","plugins"].includes(r)?[...Array.isArray(e)?e:[],...n]:[...n];if(!x(n))return n;let o={...x(e)?e:{}};for(let[s,a]of Object.entries(n)){if(["__proto__","constructor","prototype"].includes(s))throw Error(`Invalid layer config key: ${s}`);o[s]=b(o[s],a,s)}return o}function v(e){for(let n of["stx.config.ts","stx.config.js","stx.config.mjs",".config/stx.config.ts",".config/stx.ts","ui.config.ts"]){let r=i.join(e,n);if(c.existsSync(r))return c.realpathSync(r)}throw Error(`Application layer has no stx.config.ts: ${e}`)}function E(e,n,r){if(typeof e!=="string"||!e||/^(?:https?:|git[+:])/.test(e))throw Error(`Invalid application layer ${JSON.stringify(e)} in ${n}; use a local path or installed package`);if(e.startsWith(".")||i.isAbsolute(e)){let s=i.resolve(n,e);return c.statSync(s).isDirectory()?v(s):c.realpathSync(s)}let o=n;while(!0){let s=i.join(o,"node_modules",e),a=i.join(s,"package.json");if(c.existsSync(a)){r.add(c.realpathSync(a));let g=JSON.parse(c.readFileSync(a,"utf8"));return g.stx?.layer?c.realpathSync(i.resolve(s,g.stx.layer)):v(s)}let p=i.dirname(o);if(p===o)break;o=p}throw Error(`Cannot resolve application layer ${JSON.stringify(e)} from ${n}`)}async function C(e,n){let r=await Bun.build({entrypoints:[e],target:"bun",format:"esm",splitting:!1,plugins:[{name:"stx-layer-config",setup(a){a.onResolve({filter:/^[^./]/},(p)=>{if(p.path.startsWith("node:"))return{path:p.path,external:!0};return{path:Bun.resolveSync(p.path,p.resolveDir),external:!0}}),a.onLoad({filter:/./},(p)=>{let g=c.realpathSync(p.path);n.add(g),w.add(g);return})}}]});if(!r.success)throw Error(`Cannot load layer ${e}: ${r.logs.join(`
3
+ `)}`);let o=r.outputs.find((a)=>a.kind==="entry-point");if(!o||r.outputs.length!==1)throw Error(`Unsupported layer config output: ${e}`);let s=(await import(`data:text/javascript;base64,${Buffer.from(await o.text()).toString("base64")}`)).default;if(!x(s))throw Error(`Layer ${e} must default-export a config object`);return s}async function uc(e,n){let r=new Set,o=[],s=[],a=new Set,p=[];async function g(t,l){if(t=c.realpathSync(t),p.includes(t))throw Error(`Application layer cycle: ${[...p,t].join(" -> ")}`);if(a.has(t))return;a.add(t),p.push(t);let d=await C(t,r);l??=i.basename(i.dirname(t))===".config"?i.dirname(i.dirname(t)):i.dirname(t),l=c.realpathSync(l);let D=i.resolve(l,d.root??"."),L=Object.fromEntries(j.map((y)=>[y,i.resolve(D,d[`${y}Dir`]??(y==="composables"?"functions":y))]));o.push({root:l,configFile:t,resources:L});let u={...d};if(u.plugins)u.plugins=u.plugins.map((y)=>{let h=typeof y==="string"?y:y[0],S=h.startsWith(".")?i.resolve(l,h):i.isAbsolute(h)?h:Bun.resolveSync(h,l);return r.add(c.realpathSync(S)),typeof y==="string"?S:[S,y[1]]});if(typeof u.css==="string")u.css=i.resolve(l,u.css);if(u.serverApi)u.serverApi={...typeof u.serverApi==="object"?u.serverApi:{},dir:i.resolve(l,typeof u.serverApi==="object"?u.serverApi.dir??"server/api":"server/api")};if(s.push(u),d.extends!==void 0&&!Array.isArray(d.extends))throw Error(`extends in ${t} must be an array`);for(let y of d.extends??[])await g(E(y,l,r));p.pop()}await g(v(e),e);for(let t of["package.json","bun.lock","package-lock.json","pnpm-lock.yaml"]){let l=i.join(e,t);if(c.existsSync(l))r.add(c.realpathSync(l))}let f=b({},n);for(let t=s.length-1;t>=0;t--){let l=t===0?s[t]:Object.fromEntries(Object.entries(s[t]).filter(([d])=>!_.has(d)));f=b(f,l)}let m={layers:o,configDependencies:[...r].sort()};return f._layerGraph=m,f._layerPageDirs=o.map((t)=>t.resources.pages),f._layerComponentDirs=o.map((t)=>t.resources.components),f._layerLayoutDirs=o.map((t)=>t.resources.layouts),f._layerPartialDirs=o.map((t)=>t.resources.partials),f._layerComposableDirs=o.map((t)=>t.resources.composables),await zo(m,e),{config:f,graph:m}}async function zo(e,n){let r=new Map,o=[];for(let s of e.layers)for(let[a,p]of Object.entries(s.resources)){if(!c.existsSync(p))continue;let g=new Bun.Glob(a==="composables"?"**/*.ts":"**/*.stx");for(let f of[...g.scanSync({cwd:p})].sort()){let m=`${a}/${f}`,t=i.join(p,f),l=r.get(m);if(l)o.push({resource:m,winner:l,shadowed:t});else r.set(m,t)}}Object.assign(e,{overrides:o}),await Bun.write(i.join(n,".stx/layers.json"),JSON.stringify(e,null,2))}function A(e){let n=new Set(e.configDependencies);function r(o){if(!c.existsSync(o))return;n.add(o);for(let s of c.readdirSync(o,{withFileTypes:!0}).sort((a,p)=>a.name.localeCompare(p.name))){if(s.name.startsWith(".")||s.name==="node_modules")continue;let a=i.join(o,s.name);if(s.isDirectory())r(a);else if(s.isFile())n.add(a)}}for(let o of e.layers)for(let s of Object.values(o.resources))r(s);return[...n].sort()}function gs(e){return O(A(e))}function ms(e){return O(e.configDependencies)}function O(e){return e.map((n)=>{try{let r=c.statSync(n);return`${n}:${r.mtimeMs}:${r.size}`}catch{return`${n}:missing`}}).join(`
4
+ `)}function dc(e){return e.layers.map((n)=>({config:i.relative(n.root,n.configFile),files:A({layers:[n],configDependencies:e.configDependencies.filter((r)=>r.startsWith(`${n.root}${i.sep}`))}).filter((r)=>c.statSync(r).isFile()).map((r)=>({path:i.relative(n.root,r).replaceAll(i.sep,"/"),sha256:k("sha256").update(c.readFileSync(r)).digest("hex")}))}))}
5
+ export{lc,uc,zo,gs,ms,dc};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- function Qa(){return`
2
+ function ec(){return`
3
3
  (function(){
4
4
  var tip=null,hideTimer=null,currentEl=null;
5
5
 
@@ -103,4 +103,4 @@ document.addEventListener("focusout",function(e){
103
103
  });
104
104
  })();
105
105
  `}
106
- export{Qa};
106
+ export{ec};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- function c(i){if(!i.startsWith("/")||/[?#\\]/.test(i))throw Error(`Invalid route rule pattern: ${i}`);let t=i==="/"?[]:i.slice(1).split("/");if(t.some((r,e)=>!r||r.includes("*")&&r!=="*"&&r!=="**"||r==="**"&&e!==t.length-1||r.startsWith(":")&&!/^:[\w]+$/.test(r)))throw Error(`Unsupported route rule pattern: ${i}`);return t}function oo(i){for(let[t,r]of Object.entries(i)){if(c(t),!r||typeof r!=="object"||Object.keys(r).some((e)=>e!=="rendering"&&e!=="cache"))throw Error(`Unsupported route rule for ${t}`);if(r.rendering!==void 0&&r.rendering!=="prerender"&&r.rendering!=="dynamic")throw Error(`Unsupported rendering mode for ${t}`);if(r.cache!==void 0&&r.cache!==!1){let e=r.cache;if(!e||e.public!==!0||Object.keys(e).some((n)=>!["public","maxAge","swr"].includes(n))||!Number.isFinite(e.maxAge)||e.maxAge<=0||e.swr!==void 0&&(!Number.isFinite(e.swr)||e.swr<0))throw Error(`Route cache for ${t} requires public: true, maxAge > 0 and swr >= 0`);if(r.rendering==="prerender")throw Error(`Prerendered route ${t} cannot revalidate; use dynamic rendering with cache`)}}}function Pn(i={}){oo(i);let t=(e)=>e==="**"?0:e==="*"?1:e.startsWith(":")?2:3,r=Object.entries(i).map(([e,n])=>({pattern:e,parts:c(e),rule:n}));return r.sort((e,n)=>{for(let o=0;o<Math.max(e.parts.length,n.parts.length);o++){let s=(n.parts[o]===void 0?4:t(n.parts[o]))-(e.parts[o]===void 0?4:t(e.parts[o]));if(s)return s}return e.pattern.localeCompare(n.pattern)}),(e)=>{let n=e==="/"?[]:e.replace(/\/$/,"").slice(1).split("/");return r.find(({parts:o})=>o.every((s,u)=>s==="**"||n[u]!==void 0&&(s==="*"||s.startsWith(":")||s===n[u]))&&(o.at(-1)==="**"||o.length===n.length))?.rule??{}}}
3
- export{oo,Pn};
2
+ function c(i){if(!i.startsWith("/")||/[?#\\]/.test(i))throw Error(`Invalid route rule pattern: ${i}`);let t=i==="/"?[]:i.slice(1).split("/");if(t.some((r,e)=>!r||r.includes("*")&&r!=="*"&&r!=="**"||r==="**"&&e!==t.length-1||r.startsWith(":")&&!/^:[\w]+$/.test(r)))throw Error(`Unsupported route rule pattern: ${i}`);return t}function io(i){for(let[t,r]of Object.entries(i)){if(c(t),!r||typeof r!=="object"||Object.keys(r).some((e)=>e!=="rendering"&&e!=="cache"))throw Error(`Unsupported route rule for ${t}`);if(r.rendering!==void 0&&r.rendering!=="prerender"&&r.rendering!=="dynamic")throw Error(`Unsupported rendering mode for ${t}`);if(r.cache!==void 0&&r.cache!==!1){let e=r.cache;if(!e||e.public!==!0||Object.keys(e).some((n)=>!["public","maxAge","swr"].includes(n))||!Number.isFinite(e.maxAge)||e.maxAge<=0||e.swr!==void 0&&(!Number.isFinite(e.swr)||e.swr<0))throw Error(`Route cache for ${t} requires public: true, maxAge > 0 and swr >= 0`);if(r.rendering==="prerender")throw Error(`Prerendered route ${t} cannot revalidate; use dynamic rendering with cache`)}}}function Pn(i={}){io(i);let t=(e)=>e==="**"?0:e==="*"?1:e.startsWith(":")?2:3,r=Object.entries(i).map(([e,n])=>({pattern:e,parts:c(e),rule:n}));return r.sort((e,n)=>{for(let o=0;o<Math.max(e.parts.length,n.parts.length);o++){let s=(n.parts[o]===void 0?4:t(n.parts[o]))-(e.parts[o]===void 0?4:t(e.parts[o]));if(s)return s}return e.pattern.localeCompare(n.pattern)}),(e)=>{let n=e==="/"?[]:e.replace(/\/$/,"").slice(1).split("/");return r.find(({parts:o})=>o.every((s,u)=>s==="**"||n[u]!==void 0&&(s==="*"||s.startsWith(":")||s===n[u]))&&(o.at(-1)==="**"||o.length===n.length))?.rule??{}}}
3
+ export{io,Pn};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import"./chunk-5hrm7rtx.js";import"./chunk-kyk4ekng.js";import"./chunk-89h4snzd.js";import"./chunk-ext2gx7h.js";import"./chunk-r6s35xw9.js";import"./chunk-g1sqap6x.js";import"./chunk-qeh8f4bk.js";import"./chunk-qn580gr9.js";import{l}from"./chunk-myr79xxf.js";import u from"fs";import m from"path";async function d(e,t={}){let s=Date.now(),n={total:0,passed:0,failed:0,new:0,failures:[],duration:0},i=t.snapshotDir||l(e.root,"story","snapshots");await u.promises.mkdir(i,{recursive:!0});let r=e.storyFiles;if(t.filter&&t.filter.length>0)r=r.filter((a)=>t.filter.some((o)=>a.fileName.toLowerCase().includes(o.toLowerCase())));for(let a of r)await h(a,i,t,n);return n.duration=Date.now()-s,n}async function h(e,t,s,n){let i=e.story;if(!i)return;for(let r of i.variants){n.total++;let a=m.join(t,`${e.id}-${r.id}.snap`),o=g(r.source||""),f=await w(a);if(s.update||!f){let p={storyId:e.id,variantId:r.id,component:e.fileName,timestamp:Date.now(),hash:o};if(await u.promises.writeFile(a,JSON.stringify(p,null,2)),!f)n.new++;n.passed++}else try{let p=await u.promises.readFile(a,"utf-8"),c=JSON.parse(p);if(c.hash===o)n.passed++;else n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:"Snapshot mismatch",difference:y(c.hash,o)})}catch(p){n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:`Error reading snapshot: ${p}`})}}}async function x(e,t={}){return(await d(e,{...t,update:!0})).total}function g(e){let t=0;for(let s=0;s<e.length;s++){let n=e.charCodeAt(s);t=(t<<5)-t+n,t=t&t}return t.toString(16)}function y(e,t){if(e===t)return 0;let s=Math.abs(Number.parseInt(e,16)-Number.parseInt(t,16));return Math.min(s/1e6,1)}async function w(e){try{return await u.promises.access(e),!0}catch{return!1}}function F(e){let t=[];if(t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(" STX Story Visual Regression Tests"),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),e.failures.length>0){t.push(" \u274C Failures:"),t.push("");for(let s of e.failures){if(t.push(` \u2022 ${s.component} / ${s.variantId}`),t.push(` ${s.message}`),s.difference!==void 0)t.push(` Difference: ${(s.difference*100).toFixed(2)}%`);t.push("")}}if(t.push(" Summary:"),t.push(` Total: ${e.total}`),t.push(` Passed: ${e.passed} \u2713`),t.push(` Failed: ${e.failed} \u2717`),e.new>0)t.push(` New: ${e.new} \u26A1`);return t.push(` Time: ${e.duration}ms`),t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),t.join(`
2
+ import"./chunk-0tgrqhkr.js";import"./chunk-236bdf7y.js";import"./chunk-89h4snzd.js";import"./chunk-8w0cwcvk.js";import"./chunk-sj2a5twe.js";import"./chunk-7mm5mvg0.js";import"./chunk-m6w75sq2.js";import"./chunk-p33w8zst.js";import{l}from"./chunk-7ycf8a8d.js";import u from"fs";import m from"path";async function d(e,t={}){let s=Date.now(),n={total:0,passed:0,failed:0,new:0,failures:[],duration:0},i=t.snapshotDir||l(e.root,"story","snapshots");await u.promises.mkdir(i,{recursive:!0});let r=e.storyFiles;if(t.filter&&t.filter.length>0)r=r.filter((a)=>t.filter.some((o)=>a.fileName.toLowerCase().includes(o.toLowerCase())));for(let a of r)await h(a,i,t,n);return n.duration=Date.now()-s,n}async function h(e,t,s,n){let i=e.story;if(!i)return;for(let r of i.variants){n.total++;let a=m.join(t,`${e.id}-${r.id}.snap`),o=g(r.source||""),f=await w(a);if(s.update||!f){let p={storyId:e.id,variantId:r.id,component:e.fileName,timestamp:Date.now(),hash:o};if(await u.promises.writeFile(a,JSON.stringify(p,null,2)),!f)n.new++;n.passed++}else try{let p=await u.promises.readFile(a,"utf-8"),c=JSON.parse(p);if(c.hash===o)n.passed++;else n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:"Snapshot mismatch",difference:y(c.hash,o)})}catch(p){n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:`Error reading snapshot: ${p}`})}}}async function x(e,t={}){return(await d(e,{...t,update:!0})).total}function g(e){let t=0;for(let s=0;s<e.length;s++){let n=e.charCodeAt(s);t=(t<<5)-t+n,t=t&t}return t.toString(16)}function y(e,t){if(e===t)return 0;let s=Math.abs(Number.parseInt(e,16)-Number.parseInt(t,16));return Math.min(s/1e6,1)}async function w(e){try{return await u.promises.access(e),!0}catch{return!1}}function F(e){let t=[];if(t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(" STX Story Visual Regression Tests"),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),e.failures.length>0){t.push(" \u274C Failures:"),t.push("");for(let s of e.failures){if(t.push(` \u2022 ${s.component} / ${s.variantId}`),t.push(` ${s.message}`),s.difference!==void 0)t.push(` Difference: ${(s.difference*100).toFixed(2)}%`);t.push("")}}if(t.push(" Summary:"),t.push(` Total: ${e.total}`),t.push(` Passed: ${e.passed} \u2713`),t.push(` Failed: ${e.failed} \u2717`),e.new>0)t.push(` New: ${e.new} \u26A1`);return t.push(` Time: ${e.duration}ms`),t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),t.join(`
3
3
  `)}export{F as formatTestResults,d as runVisualTests,x as updateSnapshots};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- var f=null,D=[],v=0,g=new Set;function x(){return f}function S(e){let n=f;return D.push(e),f=e,n}function h(e){D.pop(),f=e}var A=new WeakMap;function w(e,n){A.set(e,n)}function p(e,n){for(let r of e){let i=A.get(r);if(i)i(n);else n.add(r)}}function b(e){if(v>0){p(e,g);return}let n=new Set;p(e,n);for(let r of n)r()}function C(e){v++;try{e()}finally{if(v--,v===0){let n=[...g];g.clear();for(let r of n)r()}}}function m(e){let n=f;f=null;try{return e()}finally{f=n}}var k=[],T=[];function le(e){let n=e,r=new Set,i=new Set,o=()=>{let t=x();if(t)i.add(t);return n};return o.set=(t)=>{if(!Object.is(t,n)){let c=n;n=t,r.forEach((u)=>{try{u(n,c)}catch(l){console.error("[stx] subscriber error:",l)}}),b(i)}},o.update=(t)=>{o.set(t(n))},o.subscribe=(t)=>(r.add(t),()=>r.delete(t)),Object.defineProperty(o,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(o,"value",{get:()=>o(),set:(t)=>o.set(t),configurable:!0}),o}function zn(e,n={}){let r,i=!0,o=!1,t=new Set,c=typeof n.equals==="function"?n.equals:null,u=()=>{let s=S(d);try{r=e(),o=!0}finally{h(s)}i=!1},l=()=>{let s=r,y=o;try{u()}catch{return i=!0,!0}return!y||!c(s,r)},d=()=>{if(i)return;if(c&&t.size){if(l())b(t);return}i=!0,b(t)};w(d,(s)=>{if(i)return;if(c&&t.size){if(l())p(t,s);return}i=!0,p(t,s)});let a=()=>{let s=x();if(s)t.add(s);if(i)u();return r};return Object.defineProperty(a,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(a,"value",{get:()=>a(),configurable:!0}),a}function zm(e,n=Object.is){return zn(e,{equals:n})}function Hn(e,n={}){let r,i=!1,o=()=>{if(i)return;if(r){let c=r;r=void 0;try{c()}catch(u){console.error("[stx] effect cleanup error:",u)}}let t=S(o);try{let c=e();r=typeof c==="function"?c:void 0}catch(c){i=!0,console.error("[stx] effect error (the effect is disposed):",c)}finally{h(t)}};if(n.immediate!==!1)o();return()=>{if(i=!0,r){let t=r;r=void 0,t()}}}function ao(e){C(e)}function Vr(e){k.push(e)}function Ur(e){T.push(e)}function Hm(){O(k,"onMount",T)}function Vm(){O(T,"onDestroy")}function O(e,n,r){let i=e.splice(0,e.length);for(let o of i)try{let t=o();if(r&&typeof t==="function")r.push(t)}catch(t){console.error(`[stx] ${n} callback threw:`,t)}}function Um(){return{mount:k.length,destroy:T.length}}function Vn(e){return typeof e==="function"&&e._isSignal===!0}function Un(e){return typeof e==="function"&&e._isDerived===!0}function co(e){if(Vn(e)||Un(e))return m(()=>e());return e}function Wr(e){return m(e)}function Wm(e,n){let r=typeof e==="function"?e:()=>e,i=le([]),o=zn(()=>i().reduce((u,l)=>n(u,l.action),r())),t=!1;return Hn(()=>{if(r(),!t){t=!0;return}if(Wr(()=>i().length))i.set([])}),[o,(u,l)=>{let d={action:u};i.set([...i(),d]);let a=()=>{let s=i().filter((y)=>y!==d);if(s.length!==i().length)i.set(s)};if(l&&typeof l.then==="function")Promise.resolve(l).then(a,a);return a}]}
3
- export{le,zn,zm,Hn,ao,Vr,Ur,Hm,Vm,Um,Vn,Un,co,Wr,Wm};
2
+ var f=null,D=[],v=0,g=new Set;function x(){return f}function S(e){let n=f;return D.push(e),f=e,n}function h(e){D.pop(),f=e}var A=new WeakMap;function w(e,n){A.set(e,n)}function p(e,n){for(let r of e){let i=A.get(r);if(i)i(n);else n.add(r)}}function b(e){if(v>0){p(e,g);return}let n=new Set;p(e,n);for(let r of n)r()}function C(e){v++;try{e()}finally{if(v--,v===0){let n=[...g];g.clear();for(let r of n)r()}}}function m(e){let n=f;f=null;try{return e()}finally{f=n}}var k=[],T=[];function le(e){let n=e,r=new Set,i=new Set,o=()=>{let t=x();if(t)i.add(t);return n};return o.set=(t)=>{if(!Object.is(t,n)){let c=n;n=t,r.forEach((u)=>{try{u(n,c)}catch(l){console.error("[stx] subscriber error:",l)}}),b(i)}},o.update=(t)=>{o.set(t(n))},o.subscribe=(t)=>(r.add(t),()=>r.delete(t)),Object.defineProperty(o,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(o,"value",{get:()=>o(),set:(t)=>o.set(t),configurable:!0}),o}function zn(e,n={}){let r,i=!0,o=!1,t=new Set,c=typeof n.equals==="function"?n.equals:null,u=()=>{let s=S(d);try{r=e(),o=!0}finally{h(s)}i=!1},l=()=>{let s=r,y=o;try{u()}catch{return i=!0,!0}return!y||!c(s,r)},d=()=>{if(i)return;if(c&&t.size){if(l())b(t);return}i=!0,b(t)};w(d,(s)=>{if(i)return;if(c&&t.size){if(l())p(t,s);return}i=!0,p(t,s)});let a=()=>{let s=x();if(s)t.add(s);if(i)u();return r};return Object.defineProperty(a,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(a,"value",{get:()=>a(),configurable:!0}),a}function Hm(e,n=Object.is){return zn(e,{equals:n})}function Hn(e,n={}){let r,i=!1,o=()=>{if(i)return;if(r){let c=r;r=void 0;try{c()}catch(u){console.error("[stx] effect cleanup error:",u)}}let t=S(o);try{let c=e();r=typeof c==="function"?c:void 0}catch(c){i=!0,console.error("[stx] effect error (the effect is disposed):",c)}finally{h(t)}};if(n.immediate!==!1)o();return()=>{if(i=!0,r){let t=r;r=void 0,t()}}}function co(e){C(e)}function Ur(e){k.push(e)}function Wr(e){T.push(e)}function Vm(){O(k,"onMount",T)}function Um(){O(T,"onDestroy")}function O(e,n,r){let i=e.splice(0,e.length);for(let o of i)try{let t=o();if(r&&typeof t==="function")r.push(t)}catch(t){console.error(`[stx] ${n} callback threw:`,t)}}function Wm(){return{mount:k.length,destroy:T.length}}function Vn(e){return typeof e==="function"&&e._isSignal===!0}function Un(e){return typeof e==="function"&&e._isDerived===!0}function lo(e){if(Vn(e)||Un(e))return m(()=>e());return e}function qr(e){return m(e)}function qm(e,n){let r=typeof e==="function"?e:()=>e,i=le([]),o=zn(()=>i().reduce((u,l)=>n(u,l.action),r())),t=!1;return Hn(()=>{if(r(),!t){t=!0;return}if(qr(()=>i().length))i.set([])}),[o,(u,l)=>{let d={action:u};i.set([...i(),d]);let a=()=>{let s=i().filter((y)=>y!==d);if(s.length!==i().length)i.set(s)};if(l&&typeof l.then==="function")Promise.resolve(l).then(a,a);return a}]}
3
+ export{le,zn,Hm,Hn,co,Ur,Wr,Vm,Um,Wm,Vn,Un,lo,qr,qm};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Ve,Cn,Si}from"./chunk-vfe8xj8g.js";function Ws(e,a){let t=e.pwa;if(!t?.enabled)return"";let c=t.serviceWorker||{},d=t.routes||[],i=c.cacheVersion||"1.0.0",o=t.offline,l=o?.page?"/offline.html":"/offline.html",{push:r,backgroundSync:s,cacheStorage:n}=t,u=a?Ve(a,e):null,h=u?Cn(u):"[]",f=["/","/manifest.json",...o?.enabled?[l]:[],...o?.precacheAssets||[]];return`/**
2
+ import{Ve,Cn,ki}from"./chunk-g22absm0.js";function qs(e,a){let t=e.pwa;if(!t?.enabled)return"";let c=t.serviceWorker||{},d=t.routes||[],i=c.cacheVersion||"1.0.0",o=t.offline,l=o?.page?"/offline.html":"/offline.html",{push:r,backgroundSync:s,cacheStorage:n}=t,u=a?Ve(a,e):null,h=u?Cn(u):"[]",f=["/","/manifest.json",...o?.enabled?[l]:[],...o?.precacheAssets||[]];return`/**
3
3
  * Service Worker - Auto-generated by stx
4
4
  * Cache Version: ${i}
5
5
  *
@@ -13,7 +13,7 @@ import{Ve,Cn,Si}from"./chunk-vfe8xj8g.js";function Ws(e,a){let t=e.pwa;if(!t?.en
13
13
  * Additional features:
14
14
  * - Push notifications: ${r?.enabled?"enabled":"disabled"}
15
15
  * - Background sync: ${s?.enabled?"enabled":"disabled"}
16
- * - Cache limits: ${n?.maxSize?`${Si(n.maxSize*1024*1024)}`:"unlimited"}
16
+ * - Cache limits: ${n?.maxSize?`${ki(n.maxSize*1024*1024)}`:"unlimited"}
17
17
  */
18
18
 
19
19
  const CACHE_VERSION = '${i}';
@@ -825,5 +825,5 @@ self.addEventListener('message', (event) => {
825
825
  event.waitUntil(registerFormSync(event.data.payload));
826
826
  }
827
827
  });
828
- `}function Ft(e){return e.pwa?.serviceWorker?.fileName||"sw.js"}function ll(e){return e.pwa?.enabled===!0&&e.pwa?.serviceWorker?.useWorkbox===!0}function dg(e,a){if(!e.pwa?.enabled)return"";if(ll(e)){let{generateWorkboxServiceWorker:t}=import.meta.require("./chunk-ecf9tftk.js");return t(e,a)}return Ws(e,a)}
829
- export{Ws,Ft,ll,dg};
828
+ `}function Ft(e){return e.pwa?.serviceWorker?.fileName||"sw.js"}function ul(e){return e.pwa?.enabled===!0&&e.pwa?.serviceWorker?.useWorkbox===!0}function pg(e,a){if(!e.pwa?.enabled)return"";if(ul(e)){let{generateWorkboxServiceWorker:t}=import.meta.require("./chunk-pydmzvpq.js");return t(e,a)}return qs(e,a)}
829
+ export{qs,Ft,ul,pg};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{po,ya,ba,Zm}from"./chunk-c85j39f7.js";export{po as NATIVE_COMPONENTS,ya as compileToNative,ba as createHotReloadServer,Zm as default};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{mn,Bf,Ff,zf,Hf,Vf,m,Uf,si,Wf,Nc,Dc}from"./chunk-8w0cwcvk.js";import"./chunk-7mm5mvg0.js";import"./chunk-sj2a5twe.js";import"./chunk-0tgrqhkr.js";import"./chunk-89h4snzd.js";import"./chunk-236bdf7y.js";export{mn as STX_ENGINE_BINDING_NAMES,si as convertToCommonJS,Nc as extractScriptFromTemplate,m as extractVariables,Dc as hasVariables,Uf as isCompleteImport,Vf as isMissingBindingFailure,zf as isModuleResolutionFailure,Hf as isSyntaxFailure,Wf as splitDeclaration,Bf as stripTypeScript,Ff as withoutStxReferrer};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Am,Pm,Im,Om,Nm,Dm,Mm}from"./chunk-4fc8zs15.js";export{Pm as createKeepAliveCache,Om as generateKeepAliveCSS,Nm as generateKeepAliveRuntime,Dm as onActivated,Mm as onDeactivated,Am as processKeepAliveDirectives,Im as shouldCacheComponent};