@stacksjs/stx 0.2.567 → 0.2.570

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 (198) hide show
  1. package/dist/chunk-0mw3d5fc.js +2 -0
  2. package/dist/{chunk-fpa1nq88.js → chunk-0pzbg1bt.js} +2 -2
  3. package/dist/chunk-0zq4btre.js +3 -0
  4. package/dist/chunk-1sh80b1c.js +2 -0
  5. package/dist/chunk-1xyhdpbn.js +2 -0
  6. package/dist/chunk-20nrvpps.js +2 -0
  7. package/dist/chunk-2j7tr8wj.js +2 -0
  8. package/dist/chunk-2mxhp1yy.js +2 -0
  9. package/dist/{chunk-gjx5256r.js → chunk-2t3bhp2j.js} +5 -5
  10. package/dist/chunk-32yj7sbw.js +2 -0
  11. package/dist/{chunk-c765y72x.js → chunk-35kmebz9.js} +4 -4
  12. package/dist/{chunk-203rr1c8.js → chunk-3m01ym55.js} +2 -2
  13. package/dist/chunk-3ss3vfad.js +2 -0
  14. package/dist/{chunk-kch9a9v1.js → chunk-3tzkqf6e.js} +2 -2
  15. package/dist/{chunk-4zb2ga7p.js → chunk-3wcwtqx1.js} +2 -2
  16. package/dist/chunk-4zp2zzch.js +2 -0
  17. package/dist/chunk-503w9dn3.js +2 -0
  18. package/dist/{chunk-18270qgd.js → chunk-5hxsdkvp.js} +2 -2
  19. package/dist/{chunk-ngcjy2dj.js → chunk-6m406xsn.js} +1 -1
  20. package/dist/chunk-6yja1c8e.js +2 -0
  21. package/dist/{chunk-mb59b499.js → chunk-724zsgbk.js} +5 -5
  22. package/dist/chunk-74va4kza.js +2 -0
  23. package/dist/chunk-74w81h3v.js +2 -0
  24. package/dist/chunk-85j8cxfd.js +2 -0
  25. package/dist/chunk-8bwp2m95.js +2 -0
  26. package/dist/{chunk-z2n1rtj5.js → chunk-8rj08x1d.js} +1 -1
  27. package/dist/{chunk-90qywh24.js → chunk-8yn9wxzt.js} +4 -4
  28. package/dist/{chunk-2ernwctg.js → chunk-8zmahjqg.js} +6 -6
  29. package/dist/chunk-98xp5rfe.js +2 -0
  30. package/dist/chunk-9ah35e2w.js +2 -0
  31. package/dist/chunk-9d1bs55s.js +2 -0
  32. package/dist/{chunk-7wyyjdks.js → chunk-9d6dr0dr.js} +2 -2
  33. package/dist/{chunk-dmf1jmge.js → chunk-9k6r7f3c.js} +4 -4
  34. package/dist/chunk-9rts16ta.js +2 -0
  35. package/dist/{chunk-m6m19hwd.js → chunk-9zf49tqg.js} +4 -4
  36. package/dist/{chunk-d1mqedk0.js → chunk-a2mztbta.js} +3 -3
  37. package/dist/{chunk-k2dgwy05.js → chunk-a849hqna.js} +2 -2
  38. package/dist/chunk-ajezxt0s.js +2 -0
  39. package/dist/chunk-bf572npc.js +2 -0
  40. package/dist/{chunk-g1epk002.js → chunk-brkq2s62.js} +3 -3
  41. package/dist/{chunk-7m0r2qs2.js → chunk-c1ys37c9.js} +2 -2
  42. package/dist/{chunk-tc01jkfc.js → chunk-chythmea.js} +1 -1
  43. package/dist/chunk-cqeccn7x.js +2 -0
  44. package/dist/{chunk-g8tx0yf8.js → chunk-d8jdr1k4.js} +4 -4
  45. package/dist/{chunk-8txqk9nq.js → chunk-dajh1369.js} +2 -2
  46. package/dist/{chunk-tsmbstj6.js → chunk-dgr561sc.js} +4 -4
  47. package/dist/{chunk-39tkfkp7.js → chunk-dkyqkkpj.js} +3 -3
  48. package/dist/chunk-dsdxa5x1.js +2 -0
  49. package/dist/{chunk-ghnkphy4.js → chunk-ebg20d8s.js} +2 -2
  50. package/dist/chunk-ectcp21m.js +2 -0
  51. package/dist/chunk-ewcnyvcd.js +2 -0
  52. package/dist/chunk-ez7r18ef.js +2 -0
  53. package/dist/{chunk-wy4hfmjs.js → chunk-fas9k7sw.js} +5 -5
  54. package/dist/chunk-ffgsaf9e.js +2 -0
  55. package/dist/chunk-fnnhekdc.js +2 -0
  56. package/dist/chunk-g8b74qvn.js +2 -0
  57. package/dist/chunk-ge87hcgb.js +2 -0
  58. package/dist/chunk-gra2v7xz.js +2 -0
  59. package/dist/{chunk-8afnq4qx.js → chunk-gwabvrc3.js} +3 -3
  60. package/dist/{chunk-6sf4v894.js → chunk-he2et28k.js} +4 -4
  61. package/dist/{chunk-n6va14bt.js → chunk-hvzznc50.js} +2 -2
  62. package/dist/{chunk-m8qgr307.js → chunk-j3vwyzvb.js} +3 -3
  63. package/dist/{chunk-s1xxkzc9.js → chunk-je0jxvmj.js} +4 -4
  64. package/dist/chunk-jg9fydw8.js +2 -0
  65. package/dist/{chunk-wsdn5fxe.js → chunk-jvm6agq7.js} +3 -3
  66. package/dist/{chunk-z06npyzn.js → chunk-k0shfsfx.js} +3 -3
  67. package/dist/{chunk-f46a7pvn.js → chunk-kaaxb9c5.js} +2 -2
  68. package/dist/{chunk-jbmhdyzz.js → chunk-knpzph55.js} +2 -2
  69. package/dist/{chunk-xw8kzm6b.js → chunk-kz131809.js} +148 -148
  70. package/dist/{chunk-8nr1kras.js → chunk-mbj9dbrh.js} +6 -6
  71. package/dist/chunk-mg8yjzkr.js +2 -0
  72. package/dist/chunk-mjkw1esn.js +2 -0
  73. package/dist/{chunk-7ze47qgv.js → chunk-mw2dravv.js} +5 -5
  74. package/dist/chunk-n0ra4mv3.js +2 -0
  75. package/dist/{chunk-pzasxhwz.js → chunk-ncq5n15k.js} +1 -1
  76. package/dist/{chunk-325p135t.js → chunk-nebtks7j.js} +9 -9
  77. package/dist/{chunk-01s01ten.js → chunk-nmy7mcbd.js} +4 -4
  78. package/dist/chunk-nspfk500.js +2 -0
  79. package/dist/chunk-nwyp2xaf.js +2 -0
  80. package/dist/{chunk-125rc958.js → chunk-nz0krznq.js} +2 -2
  81. package/dist/chunk-pdk87hhe.js +2 -0
  82. package/dist/{chunk-55hfvmvv.js → chunk-q8nw82pz.js} +9 -9
  83. package/dist/{chunk-wm11csdm.js → chunk-qh0es7mk.js} +2 -2
  84. package/dist/{chunk-9tcvkbb5.js → chunk-qw4fjtt1.js} +2 -2
  85. package/dist/{chunk-5grx48s2.js → chunk-r17t24jr.js} +2 -2
  86. package/dist/{chunk-tfeenp4h.js → chunk-r8h9b3f8.js} +94 -77
  87. package/dist/chunk-re030f77.js +2 -0
  88. package/dist/{chunk-68b64sj4.js → chunk-rh606w0q.js} +1 -1
  89. package/dist/chunk-rn80ctkd.js +2 -0
  90. package/dist/{chunk-3hkv4e7t.js → chunk-rrce2fyv.js} +1 -1
  91. package/dist/{chunk-saf7kypg.js → chunk-rtc17gy5.js} +2 -2
  92. package/dist/chunk-s7dzs6yg.js +2 -0
  93. package/dist/chunk-t1tqn3xx.js +2 -0
  94. package/dist/{chunk-ss78553t.js → chunk-tc5zk2ka.js} +1 -1
  95. package/dist/{chunk-rgage0vm.js → chunk-tdv9np5t.js} +2 -2
  96. package/dist/{chunk-mm1vvk49.js → chunk-tgwdk0gt.js} +4 -4
  97. package/dist/chunk-tma2vac1.js +2 -0
  98. package/dist/chunk-v0chatw1.js +2 -0
  99. package/dist/{chunk-8cpqy9ea.js → chunk-v9gy8rda.js} +41 -41
  100. package/dist/chunk-v9mkambt.js +2 -0
  101. package/dist/chunk-vwjqbn5y.js +2 -0
  102. package/dist/{chunk-ev3qnr9q.js → chunk-w8vg3te3.js} +4 -4
  103. package/dist/{chunk-1hrj0t0j.js → chunk-wemq37qe.js} +10 -10
  104. package/dist/{chunk-9ya4tdpz.js → chunk-wjazf68a.js} +2 -2
  105. package/dist/chunk-wrvksj26.js +2 -0
  106. package/dist/{chunk-nm0y4qjg.js → chunk-wvjpvs89.js} +3 -3
  107. package/dist/{chunk-6vnnx536.js → chunk-xjr67xvb.js} +2 -2
  108. package/dist/chunk-xkxwg6d4.js +2 -0
  109. package/dist/chunk-xspkz804.js +2 -0
  110. package/dist/chunk-xwqyw7zt.js +2 -0
  111. package/dist/chunk-y3kp87w1.js +2 -0
  112. package/dist/{chunk-wwn9dh6p.js → chunk-y3mmeywt.js} +2 -2
  113. package/dist/chunk-ya39wk58.js +2 -0
  114. package/dist/chunk-ygbdfzqn.js +2 -0
  115. package/dist/chunk-ypswj8sv.js +2 -0
  116. package/dist/chunk-yqzhev40.js +2 -0
  117. package/dist/{chunk-mt8sew7a.js → chunk-ywah1c30.js} +10 -10
  118. package/dist/chunk-z1tnn2pm.js +2 -0
  119. package/dist/{chunk-n1xcmhjw.js → chunk-z3smaz4z.js} +3 -3
  120. package/dist/{chunk-jra9r8fq.js → chunk-zckbg2vb.js} +1 -1
  121. package/dist/cli.js +18 -18
  122. package/dist/client/signals-helpers-runtime.d.ts +1 -1
  123. package/dist/client/signals-helpers-runtime.js +1 -8
  124. package/dist/client/signals-notify-runtime.d.ts +2 -0
  125. package/dist/client/signals-notify-runtime.js +26 -0
  126. package/dist/client/signals-process-element-runtime.js +8 -4
  127. package/dist/client/signals-reactive-core-bootstrap-runtime.js +2 -0
  128. package/dist/client/signals-state-runtime.d.ts +1 -1
  129. package/dist/client/signals-state-runtime.js +12 -18
  130. package/dist/config.d.ts +16 -0
  131. package/dist/config.js +12 -3
  132. package/dist/craft-entry.js +2 -2
  133. package/dist/craft.js +2 -2
  134. package/dist/pwa.js +3 -3
  135. package/dist/reactive-tracking.d.ts +17 -0
  136. package/dist/reactive-tracking.js +23 -0
  137. package/dist/reactivity.js +3 -11
  138. package/dist/signals-api.js +13 -11
  139. package/dist/signals-notify-runtime.d.ts +2 -0
  140. package/dist/ssg.js +3 -3
  141. package/package.json +5 -5
  142. package/dist/chunk-04qvjcsr.js +0 -2
  143. package/dist/chunk-2xbrrc5a.js +0 -2
  144. package/dist/chunk-2yypassp.js +0 -2
  145. package/dist/chunk-375skn32.js +0 -2
  146. package/dist/chunk-3wyxe996.js +0 -2
  147. package/dist/chunk-4mmdpb46.js +0 -2
  148. package/dist/chunk-4q5d5r7s.js +0 -2
  149. package/dist/chunk-5ytg0wbc.js +0 -2
  150. package/dist/chunk-6qyters0.js +0 -2
  151. package/dist/chunk-6yn90mq9.js +0 -2
  152. package/dist/chunk-7d2vyre0.js +0 -2
  153. package/dist/chunk-7pewegtw.js +0 -2
  154. package/dist/chunk-7w0qa3n0.js +0 -2
  155. package/dist/chunk-8d788kvt.js +0 -2
  156. package/dist/chunk-bdhtq3vs.js +0 -2
  157. package/dist/chunk-brnapchc.js +0 -2
  158. package/dist/chunk-c78327kx.js +0 -2
  159. package/dist/chunk-d19w3e4x.js +0 -2
  160. package/dist/chunk-da649d3k.js +0 -2
  161. package/dist/chunk-da9avgd9.js +0 -2
  162. package/dist/chunk-e3njkecx.js +0 -2
  163. package/dist/chunk-efzc1nw8.js +0 -2
  164. package/dist/chunk-fm4w1r9e.js +0 -2
  165. package/dist/chunk-gan95hj0.js +0 -2
  166. package/dist/chunk-hg7amzgz.js +0 -2
  167. package/dist/chunk-hmk7z0z6.js +0 -2
  168. package/dist/chunk-hn105xy3.js +0 -2
  169. package/dist/chunk-jq079mrx.js +0 -2
  170. package/dist/chunk-jr149mmp.js +0 -2
  171. package/dist/chunk-kwxy0e3r.js +0 -2
  172. package/dist/chunk-kza3nxr0.js +0 -2
  173. package/dist/chunk-m9cmc6np.js +0 -2
  174. package/dist/chunk-m9r4x7e6.js +0 -2
  175. package/dist/chunk-mahv855w.js +0 -2
  176. package/dist/chunk-mbwdn96z.js +0 -2
  177. package/dist/chunk-mdxg95mq.js +0 -2
  178. package/dist/chunk-mqje968d.js +0 -2
  179. package/dist/chunk-n2g9mj2h.js +0 -2
  180. package/dist/chunk-n2nha538.js +0 -2
  181. package/dist/chunk-nebw444s.js +0 -2
  182. package/dist/chunk-nmt7kw0e.js +0 -2
  183. package/dist/chunk-pq8mz4ma.js +0 -2
  184. package/dist/chunk-pxes1ft6.js +0 -2
  185. package/dist/chunk-qajc13zq.js +0 -2
  186. package/dist/chunk-qtnqmw1n.js +0 -2
  187. package/dist/chunk-r3zdgeah.js +0 -2
  188. package/dist/chunk-r5htacg5.js +0 -2
  189. package/dist/chunk-rf2rwddd.js +0 -2
  190. package/dist/chunk-s833fbvf.js +0 -2
  191. package/dist/chunk-sgvszh9s.js +0 -2
  192. package/dist/chunk-t5r3s1wj.js +0 -2
  193. package/dist/chunk-tjprg6kq.js +0 -2
  194. package/dist/chunk-v0dzrwg8.js +0 -2
  195. package/dist/chunk-vtz9empe.js +0 -2
  196. package/dist/chunk-wa6nzq5b.js +0 -2
  197. package/dist/chunk-ymdy7b8z.js +0 -3
  198. package/dist/chunk-ytdzgctp.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Hi,Ui,Vi}from"./chunk-7m0r2qs2.js";import{V,Nn,Yt,Hr,Ur,Ln,Zt,Qt,Vr,jn}from"./chunk-ymdy7b8z.js";function z(t,s,i,a,c){let y=!0,h=new Set,f=(l)=>a.get?a.get(l):l,d=()=>f(t());return Object.defineProperty(d,"_isSignal",{value:!0}),Object.defineProperty(d,"modifiers",{get:s}),d.set=(l)=>{if(!y)return;let v=s(),g=a.set?a.set(l,v):l;if(v.trim&&typeof g==="string")g=g.trim();if(v.number&&typeof g==="string"&&g!==""){let n=Number(g);if(!Number.isNaN(n))g=n}if(Object.is(t(),g))return;t.set(g),i(g)},d.update=(l)=>d.set(l(d())),d.input=(l)=>{if(!s().lazy)d.set(l)},d.change=(l)=>{if(s().lazy)d.set(l)},d.subscribe=(l)=>{if(!y)return()=>{};let v=t.subscribe((g,n)=>l(f(g),f(n)));return h.add(v),()=>{v(),h.delete(v)}},Object.defineProperty(d,"value",{get:d,set:d.set}),c(()=>{y=!1,h.forEach((l)=>l()),h.clear()}),d}function W(t,s=!0,i){if(!s||!t||typeof window>"u")return;let a=window;if(!a.__STX_DATA__){let y=document.querySelector("script[data-stx-server-data]");try{let h=JSON.parse(y?.textContent||"{}");a.__STX_DATA__=h&&typeof h==="object"&&!Array.isArray(h)?h:{}}catch{a.__STX_DATA__={}}}let c=a.__STX_DATA__;if(c&&Object.prototype.hasOwnProperty.call(c,t))try{return{data:i?i(c[t]):c[t]}}catch(y){return{data:null,error:y instanceof Error?y:Error(String(y))}}return}function X(t){if(typeof window>"u")return;let s=window;if(t===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__[t]}}function Q(t){let s=null;try{s=typeof indexedDB<"u"?indexedDB:null}catch{s=null}if(!s)return null;let i=s,a=t||"stx-kept",c=null,y=()=>{if(!c)c=new Promise((f,d)=>{let l=i.open(a,1);l.onupgradeneeded=()=>{l.result.createObjectStore("kv")},l.onsuccess=()=>f(l.result),l.onerror=()=>d(l.error),l.onblocked=()=>d(Error("blocked"))}),c.catch(()=>{c=null});return c},h=(f,d)=>y().then((l)=>new Promise((v,g)=>{let n=l.transaction("kv",f),o=d(n.objectStore("kv"));n.oncomplete=()=>v(o?o.result:void 0),n.onerror=()=>g(n.error),n.onabort=()=>g(n.error)}));return{get:(f)=>h("readonly",(d)=>d.get(f)),set:(f,d)=>h("readwrite",(l)=>{l.put(d,f)}),remove:(f)=>h("readwrite",(d)=>{d.delete(f)}),removePrefix:(f)=>h("readwrite",(d)=>{d.delete(IDBKeyRange.bound(f,`${f}\uFFFF`))})}}function Y(t,s){let i=t||{},a=null;if(i.storage!==void 0)a=i.storage;else try{a=typeof localStorage<"u"?localStorage:null}catch{a=null}let c=null,y=i.backend!==void 0;if(y)c=i.backend||null;let h=()=>{if(y)return c;y=!0;try{c=s?s():null}catch{c=null}if(c){let e=c;e.get("__stx_probe__").catch(()=>{if(c===e)c=null})}return c},f=i.limit||32768,d=i.defer||((e)=>{let r=typeof requestIdleCallback==="function"?requestIdleCallback:null;if(r)r(e,{timeout:200});else setTimeout(e,16)}),l=new Map,v=new Set,g=new Map,n=!1,o=Promise.resolve(),m=(e)=>{try{return JSON.parse(e)}catch{return e}},p=(e,r)=>{if(!a)return!1;try{return a.setItem(e,r),!0}catch{return!1}},T=(e)=>{try{if(a)a.removeItem(e)}catch{}},k=()=>{if(n=!1,!g.size)return o;let e=Array.from(g.entries());return g.clear(),o=o.then(()=>Promise.all(e.map(([r,u])=>{if(!c){v.delete(r);try{p(r,JSON.stringify(u===void 0?null:u))}catch{}return}let x;try{return x={v:u},c.set(r,x).catch(()=>{let w;try{w=JSON.stringify(u)}catch{return}return c?c.set(r,{j:w}).catch(()=>{p(r,w)}):void 0})}catch{return}}))).then(()=>{}),o},C=(e,r)=>{if(g.set(e,r),v.add(e),n)return;n=!0,d(()=>{k()})},O=(e)=>{if(!e||typeof e!=="object")return;let r=e;if("v"in r)return{value:r.v};if(typeof r.j==="string")return{value:m(r.j)};return},E={peek(e){if(l.has(e))return{value:l.get(e)};let r=null;try{r=a?a.getItem(e):null}catch{r=null}if(r===null||r===void 0)return;let u=m(r);return l.set(e,u),{value:u}},load(e){let r=E.peek(e),u=r?null:h();if(r||!u)return Promise.resolve(r);return u.get(e).then((x)=>{if(l.has(e))return{value:l.get(e)};let w=O(x);if(w)l.set(e,w.value),v.add(e);return w},()=>{return})},set(e,r){if(l.set(e,r),c&&v.has(e)){C(e,r);return}let u;try{u=JSON.stringify(r===void 0?null:r)}catch{return}if(u.length<=f&&p(e,u))return;if(!h()){if(u.length>f)p(e,u);return}T(e),C(e,r)},forget(e){for(let u of Array.from(l.keys()))if(u.indexOf(e)===0)l.delete(u);for(let u of Array.from(g.keys()))if(u.indexOf(e)===0)g.delete(u);for(let u of Array.from(v))if(u.indexOf(e)===0)v.delete(u);try{if(a)for(let u=a.length-1;u>=0;u--){let x=a.key(u);if(x&&x.indexOf(e)===0)a.removeItem(x)}}catch{}let r=h();if(!r)return o;return o=o.then(()=>r.removePrefix(e)).catch(()=>{}),o},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 J(t,s){if(!t)return!1;if(t===s.key)return!0;if(!s.url)return!1;if(t===s.url)return!0;try{let i=typeof location<"u"&&location.origin&&location.origin!=="null"?location.origin:"http://localhost",a=new URL(t,i),c=new URL(s.url,i);if(a.origin!==c.origin||a.pathname!==c.pathname)return!1;return!a.search||a.search===c.search}catch{return!1}}function Z(t){let s=t.prefix||"stx:kept:",i=t.matches||((n,o)=>n===o.key||n===o.url),a=new Set,c=new Map,y,h=(n)=>n===void 0?y:n,f=(n,o)=>{let m=h(o);if(m===!1||m===null||m==="")return null;return`${s}${m===void 0?"":`${m}:`}query:${n}`},d=(n)=>{let o=n&&n.value;if(!o||typeof o!=="object"||!("d"in o))return;return{data:o.d,at:Number(o.at)||0}},l=()=>{let n=globalThis;return n.__stx_outboxes instanceof Map?n.__stx_outboxes:null},v={setScope(n){y=n},scope:()=>y,keyFor:f,seed(n,o){let m=f(n,o);return m?d(t.kept.peek(m)):void 0},restore(n,o){let m=f(n,o);return m?t.kept.load(m).then(d):Promise.resolve(void 0)},persist(n,o,m){let p=f(n,m);if(p)t.kept.set(p,{d:o,at:Date.now()})},overlay(n,o,m){let p=l();if(!p||!p.size)return o;let T=o;return p.forEach((k)=>{try{T=k.overlay(n,T,m)}catch{}}),T},watch(n){return a.add(n),()=>{a.delete(n)}},cachedQuery(n,o){let m=c.get(n);if(m){if(o&&m.__options)m.__options(o);return m}let p=o||{},T=p.initial===void 0?null:p.initial,k=()=>typeof p.scope==="function"?p.scope():p.scope,C=()=>(typeof p.url==="function"?p.url():p.url)||null,O=()=>({key:n,url:C()}),E=k(),e=T,r=0,u=null,x=v.seed(n,E);if(x)e=x.data;let w=t.state(v.overlay(O(),e)),U=t.state(!1),j=t.state(!1),q=t.state(null),M=t.state(x?x.at:0),I=0,P=()=>{w.set(v.overlay(O(),e))},K=(b)=>{let _=I;v.restore(n,b).then((N)=>{if(!N||_!==I||r)return;e=N.data,M.set(N.at),P()})};if(!x)K(E);let gt=()=>{let b=k();if(b===E)return;E=b,I++,u=null,r=0;let _=v.seed(n,E);if(e=_?_.data:T,M.set(_?_.at:0),P(),!_)K(E)},vt=(b)=>{let _=C(),N=p.timeoutMs||15000,A=typeof AbortController<"u"?new AbortController:null,S=null,yt=new Promise((R,L)=>{S=setTimeout(()=>{if(A)A.abort();L(Error("The request took too long."))},N)}),G;if(p.load)G=p.load({force:b,url:_,signal:A?A.signal:void 0});else if(_){let R=p.fetch||((D,F)=>fetch(D,F)),L={method:"GET",headers:{Accept:"application/json"}};if(b)L.cache="no-cache";if(A)L.signal=A.signal;G=R(_,L).then((D)=>{if(!D.ok)return D.json().catch(()=>null).then((F)=>{throw Error(F&&(F.error||F.message)||`Request failed (${D.status})`)});return D.json()})}else return Promise.resolve(w());return Promise.race([G,yt]).then((R)=>{if(S)clearTimeout(S);return p.transform?p.transform(R):R},(R)=>{if(S)clearTimeout(S);throw R})},B=(b)=>{if(u)return u;let _=I;if(j.set(!0),r===0&&!M())U.set(!0);let N=()=>{if(_!==I)return;u=null,j.set(!1),U.set(!1)},A=vt(b).then((S)=>{if(_!==I)return w();return e=S,r=Date.now(),M.set(r),q.set(null),v.persist(n,S,E),P(),N(),w()},(S)=>{if(_===I)q.set(S&&S.message?S.message:"Could not load.");return N(),w()});return u=A,A},H={data:w,loading:U,isFetching:j,error:q,updatedAt:M,get key(){return n},load(b){if(gt(),!b&&r&&Date.now()-r<(p.staleTime||0))return Promise.resolve(w());return B(!!b)},refresh(){return H.load(!0)},set(b){e=typeof b==="function"?b(e):b,v.persist(n,e,E),P()},invalidate(){r=0},__options(b){p={...p,...b}}};if(a.add({target:O,updated:()=>{if(r||M())B(!1)},outbox:(b)=>{if(b)e=v.overlay(O(),e,b.id),r=0,B(!0);P()}}),c.set(n,H),p.immediate)H.load();return H}},g=typeof window<"u"?window:typeof addEventListener==="function"?globalThis:null;if(t.listen!==!1&&g&&typeof g.addEventListener==="function")g.addEventListener("stx:updated",(n)=>{let o=n.detail||{};if(o.kind!=="api"||typeof o.url!=="string")return;a.forEach((m)=>{if(i(o.url,m.target()))m.updated()})}),g.addEventListener("stx:outbox",(n)=>{let o=n.detail||{},m=o.sent&&typeof o.sent.id==="string"?o.sent:null;a.forEach((p)=>{if(m){let T=Array.isArray(m.affects)?m.affects:[],k=p.target();if(!T.some((C)=>i(C,k)))return}p.outbox(m)})});return v}var ee=` function useColorMode(options) {
2
+ import{Ui,Vi,Wi}from"./chunk-c1ys37c9.js";import{V,Nn,Yt,Hr,Ur,Ln,Zt,Qt,Vr,jn}from"./chunk-0zq4btre.js";function z(t,s,i,a,c){let y=!0,h=new Set,f=(l)=>a.get?a.get(l):l,d=()=>f(t());return Object.defineProperty(d,"_isSignal",{value:!0}),Object.defineProperty(d,"modifiers",{get:s}),d.set=(l)=>{if(!y)return;let v=s(),g=a.set?a.set(l,v):l;if(v.trim&&typeof g==="string")g=g.trim();if(v.number&&typeof g==="string"&&g!==""){let n=Number(g);if(!Number.isNaN(n))g=n}if(Object.is(t(),g))return;t.set(g),i(g)},d.update=(l)=>d.set(l(d())),d.input=(l)=>{if(!s().lazy)d.set(l)},d.change=(l)=>{if(s().lazy)d.set(l)},d.subscribe=(l)=>{if(!y)return()=>{};let v=t.subscribe((g,n)=>l(f(g),f(n)));return h.add(v),()=>{v(),h.delete(v)}},Object.defineProperty(d,"value",{get:d,set:d.set}),c(()=>{y=!1,h.forEach((l)=>l()),h.clear()}),d}function W(t,s=!0,i){if(!s||!t||typeof window>"u")return;let a=window;if(!a.__STX_DATA__){let y=document.querySelector("script[data-stx-server-data]");try{let h=JSON.parse(y?.textContent||"{}");a.__STX_DATA__=h&&typeof h==="object"&&!Array.isArray(h)?h:{}}catch{a.__STX_DATA__={}}}let c=a.__STX_DATA__;if(c&&Object.prototype.hasOwnProperty.call(c,t))try{return{data:i?i(c[t]):c[t]}}catch(y){return{data:null,error:y instanceof Error?y:Error(String(y))}}return}function X(t){if(typeof window>"u")return;let s=window;if(t===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__[t]}}function Q(t){let s=null;try{s=typeof indexedDB<"u"?indexedDB:null}catch{s=null}if(!s)return null;let i=s,a=t||"stx-kept",c=null,y=()=>{if(!c)c=new Promise((f,d)=>{let l=i.open(a,1);l.onupgradeneeded=()=>{l.result.createObjectStore("kv")},l.onsuccess=()=>f(l.result),l.onerror=()=>d(l.error),l.onblocked=()=>d(Error("blocked"))}),c.catch(()=>{c=null});return c},h=(f,d)=>y().then((l)=>new Promise((v,g)=>{let n=l.transaction("kv",f),o=d(n.objectStore("kv"));n.oncomplete=()=>v(o?o.result:void 0),n.onerror=()=>g(n.error),n.onabort=()=>g(n.error)}));return{get:(f)=>h("readonly",(d)=>d.get(f)),set:(f,d)=>h("readwrite",(l)=>{l.put(d,f)}),remove:(f)=>h("readwrite",(d)=>{d.delete(f)}),removePrefix:(f)=>h("readwrite",(d)=>{d.delete(IDBKeyRange.bound(f,`${f}\uFFFF`))})}}function Y(t,s){let i=t||{},a=null;if(i.storage!==void 0)a=i.storage;else try{a=typeof localStorage<"u"?localStorage:null}catch{a=null}let c=null,y=i.backend!==void 0;if(y)c=i.backend||null;let h=()=>{if(y)return c;y=!0;try{c=s?s():null}catch{c=null}if(c){let e=c;e.get("__stx_probe__").catch(()=>{if(c===e)c=null})}return c},f=i.limit||32768,d=i.defer||((e)=>{let r=typeof requestIdleCallback==="function"?requestIdleCallback:null;if(r)r(e,{timeout:200});else setTimeout(e,16)}),l=new Map,v=new Set,g=new Map,n=!1,o=Promise.resolve(),m=(e)=>{try{return JSON.parse(e)}catch{return e}},p=(e,r)=>{if(!a)return!1;try{return a.setItem(e,r),!0}catch{return!1}},T=(e)=>{try{if(a)a.removeItem(e)}catch{}},k=()=>{if(n=!1,!g.size)return o;let e=Array.from(g.entries());return g.clear(),o=o.then(()=>Promise.all(e.map(([r,u])=>{if(!c){v.delete(r);try{p(r,JSON.stringify(u===void 0?null:u))}catch{}return}let x;try{return x={v:u},c.set(r,x).catch(()=>{let w;try{w=JSON.stringify(u)}catch{return}return c?c.set(r,{j:w}).catch(()=>{p(r,w)}):void 0})}catch{return}}))).then(()=>{}),o},C=(e,r)=>{if(g.set(e,r),v.add(e),n)return;n=!0,d(()=>{k()})},O=(e)=>{if(!e||typeof e!=="object")return;let r=e;if("v"in r)return{value:r.v};if(typeof r.j==="string")return{value:m(r.j)};return},E={peek(e){if(l.has(e))return{value:l.get(e)};let r=null;try{r=a?a.getItem(e):null}catch{r=null}if(r===null||r===void 0)return;let u=m(r);return l.set(e,u),{value:u}},load(e){let r=E.peek(e),u=r?null:h();if(r||!u)return Promise.resolve(r);return u.get(e).then((x)=>{if(l.has(e))return{value:l.get(e)};let w=O(x);if(w)l.set(e,w.value),v.add(e);return w},()=>{return})},set(e,r){if(l.set(e,r),c&&v.has(e)){C(e,r);return}let u;try{u=JSON.stringify(r===void 0?null:r)}catch{return}if(u.length<=f&&p(e,u))return;if(!h()){if(u.length>f)p(e,u);return}T(e),C(e,r)},forget(e){for(let u of Array.from(l.keys()))if(u.indexOf(e)===0)l.delete(u);for(let u of Array.from(g.keys()))if(u.indexOf(e)===0)g.delete(u);for(let u of Array.from(v))if(u.indexOf(e)===0)v.delete(u);try{if(a)for(let u=a.length-1;u>=0;u--){let x=a.key(u);if(x&&x.indexOf(e)===0)a.removeItem(x)}}catch{}let r=h();if(!r)return o;return o=o.then(()=>r.removePrefix(e)).catch(()=>{}),o},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 J(t,s){if(!t)return!1;if(t===s.key)return!0;if(!s.url)return!1;if(t===s.url)return!0;try{let i=typeof location<"u"&&location.origin&&location.origin!=="null"?location.origin:"http://localhost",a=new URL(t,i),c=new URL(s.url,i);if(a.origin!==c.origin||a.pathname!==c.pathname)return!1;return!a.search||a.search===c.search}catch{return!1}}function Z(t){let s=t.prefix||"stx:kept:",i=t.matches||((n,o)=>n===o.key||n===o.url),a=new Set,c=new Map,y,h=(n)=>n===void 0?y:n,f=(n,o)=>{let m=h(o);if(m===!1||m===null||m==="")return null;return`${s}${m===void 0?"":`${m}:`}query:${n}`},d=(n)=>{let o=n&&n.value;if(!o||typeof o!=="object"||!("d"in o))return;return{data:o.d,at:Number(o.at)||0}},l=()=>{let n=globalThis;return n.__stx_outboxes instanceof Map?n.__stx_outboxes:null},v={setScope(n){y=n},scope:()=>y,keyFor:f,seed(n,o){let m=f(n,o);return m?d(t.kept.peek(m)):void 0},restore(n,o){let m=f(n,o);return m?t.kept.load(m).then(d):Promise.resolve(void 0)},persist(n,o,m){let p=f(n,m);if(p)t.kept.set(p,{d:o,at:Date.now()})},overlay(n,o,m){let p=l();if(!p||!p.size)return o;let T=o;return p.forEach((k)=>{try{T=k.overlay(n,T,m)}catch{}}),T},watch(n){return a.add(n),()=>{a.delete(n)}},cachedQuery(n,o){let m=c.get(n);if(m){if(o&&m.__options)m.__options(o);return m}let p=o||{},T=p.initial===void 0?null:p.initial,k=()=>typeof p.scope==="function"?p.scope():p.scope,C=()=>(typeof p.url==="function"?p.url():p.url)||null,O=()=>({key:n,url:C()}),E=k(),e=T,r=0,u=null,x=v.seed(n,E);if(x)e=x.data;let w=t.state(v.overlay(O(),e)),U=t.state(!1),j=t.state(!1),q=t.state(null),M=t.state(x?x.at:0),I=0,P=()=>{w.set(v.overlay(O(),e))},K=(b)=>{let _=I;v.restore(n,b).then((N)=>{if(!N||_!==I||r)return;e=N.data,M.set(N.at),P()})};if(!x)K(E);let vt=()=>{let b=k();if(b===E)return;E=b,I++,u=null,r=0;let _=v.seed(n,E);if(e=_?_.data:T,M.set(_?_.at:0),P(),!_)K(E)},yt=(b)=>{let _=C(),N=p.timeoutMs||15000,A=typeof AbortController<"u"?new AbortController:null,S=null,bt=new Promise((R,L)=>{S=setTimeout(()=>{if(A)A.abort();L(Error("The request took too long."))},N)}),G;if(p.load)G=p.load({force:b,url:_,signal:A?A.signal:void 0});else if(_){let R=p.fetch||((D,F)=>fetch(D,F)),L={method:"GET",headers:{Accept:"application/json"}};if(b)L.cache="no-cache";if(A)L.signal=A.signal;G=R(_,L).then((D)=>{if(!D.ok)return D.json().catch(()=>null).then((F)=>{throw Error(F&&(F.error||F.message)||`Request failed (${D.status})`)});return D.json()})}else return Promise.resolve(w());return Promise.race([G,bt]).then((R)=>{if(S)clearTimeout(S);return p.transform?p.transform(R):R},(R)=>{if(S)clearTimeout(S);throw R})},B=(b)=>{if(u)return u;let _=I;if(j.set(!0),r===0&&!M())U.set(!0);let N=()=>{if(_!==I)return;u=null,j.set(!1),U.set(!1)},A=yt(b).then((S)=>{if(_!==I)return w();return e=S,r=Date.now(),M.set(r),q.set(null),v.persist(n,S,E),P(),N(),w()},(S)=>{if(_===I)q.set(S&&S.message?S.message:"Could not load.");return N(),w()});return u=A,A},H={data:w,loading:U,isFetching:j,error:q,updatedAt:M,get key(){return n},load(b){if(vt(),!b&&r&&Date.now()-r<(p.staleTime||0))return Promise.resolve(w());return B(!!b)},refresh(){return H.load(!0)},set(b){e=typeof b==="function"?b(e):b,v.persist(n,e,E),P()},invalidate(){r=0},__options(b){p={...p,...b}}};if(a.add({target:O,updated:()=>{if(r||M())B(!1)},outbox:(b)=>{if(b)e=v.overlay(O(),e,b.id),r=0,B(!0);P()}}),c.set(n,H),p.immediate)H.load();return H}},g=typeof window<"u"?window:typeof addEventListener==="function"?globalThis:null;if(t.listen!==!1&&g&&typeof g.addEventListener==="function")g.addEventListener("stx:updated",(n)=>{let o=n.detail||{};if(o.kind!=="api"||typeof o.url!=="string")return;a.forEach((m)=>{if(i(o.url,m.target()))m.updated()})}),g.addEventListener("stx:outbox",(n)=>{let o=n.detail||{},m=o.sent&&typeof o.sent.id==="string"?o.sent:null;a.forEach((p)=>{if(m){let T=Array.isArray(m.affects)?m.affects:[],k=p.target();if(!T.some((C)=>i(C,k)))return}p.outbox(m)})});return v}var ee=` function useColorMode(options) {
3
3
  options = options || {};
4
4
  // The pre-paint boot script (stacksjs/stx#1794) publishes the app's
5
5
  // configured options here. Reading them makes a bare useColorMode() agree
@@ -3647,14 +3647,7 @@ catch (e) {
3647
3647
  const depsMap = targetMap.get(target);
3648
3648
  if (!depsMap) return;
3649
3649
  const deps = depsMap.get(key);
3650
- if (deps) {
3651
- if (isBatching) {
3652
- deps.forEach(effect => pendingEffects.add(effect));
3653
- }
3654
- else {
3655
- deps.forEach(effect => effect());
3656
- }
3657
- }
3650
+ if (deps) notifySubscribers(deps);
3658
3651
  }
3659
3652
  `;var Ce=` // \u2500\u2500 Host \u2500\u2500
3660
3653
  //
@@ -6526,7 +6519,32 @@ finally {
6526
6519
  reset: function() { data.set(null); error.set(null); loading.set(false); }
6527
6520
  };
6528
6521
  }
6529
- `;function We(t,s,i){return`${t} // ==========================================================================
6522
+ `;var We=` // ==========================================================================
6523
+ // Notify
6524
+ // ==========================================================================
6525
+
6526
+ // Gather the effects a change reaches, walking through derived values.
6527
+ function collectSubscribers(subscribers, into) {
6528
+ subscribers.forEach(function(sub) {
6529
+ if (sub._stxCollect) sub._stxCollect(into);
6530
+ else into.add(sub);
6531
+ });
6532
+ }
6533
+
6534
+ // Two phases: mark every derived value on the way stale and gather the
6535
+ // effects reached, then run each once. Running them as found ran an effect
6536
+ // that reads a signal both directly and through a derived twice for one
6537
+ // change, the first time against the derived's old value.
6538
+ function notifySubscribers(subscribers) {
6539
+ if (isBatching) {
6540
+ collectSubscribers(subscribers, pendingEffects);
6541
+ return;
6542
+ }
6543
+ const reached = new Set();
6544
+ collectSubscribers(subscribers, reached);
6545
+ reached.forEach(function(e) { e(); });
6546
+ }
6547
+ `;function Xe(t,s,i){return`${t} // ==========================================================================
6530
6548
  // Reactive Core
6531
6549
  // ==========================================================================
6532
6550
 
@@ -6535,6 +6553,7 @@ ${s}
6535
6553
  const effectStack = [];
6536
6554
  const pendingEffects = new Set();
6537
6555
  let isBatching = false;
6556
+ ${We}
6538
6557
 
6539
6558
  // DevTools Phase 2 (#1747): dev-mode reactivity instrumentation. OFF by
6540
6559
  // default \u2014 even in the dev runtime \u2014 so set()/effect-run stay zero-overhead
@@ -6553,7 +6572,7 @@ ${s}
6553
6572
  function __stxDevtoolsRecordQuery(rec) { if (!__stxDevtoolsTracking) return; __stxDevtoolsQueries.push(rec); if (__stxDevtoolsQueries.length > 100) __stxDevtoolsQueries.shift(); }
6554
6573
  ${i}
6555
6574
  let activeDisposers = null; // Array | null \u2014 when non-null, effects auto-register their dispose fn
6556
- const targetMap = new WeakMap();`}var Xe=` // Vue-compat aliases
6575
+ const targetMap = new WeakMap();`}var Qe=` // Vue-compat aliases
6557
6576
  var ref = state;
6558
6577
 
6559
6578
  // reactive() used to be a bare alias of state(), which made it the most
@@ -6619,7 +6638,7 @@ ${i}
6619
6638
  }
6620
6639
  var computed = derived;
6621
6640
  var watch = $watch;
6622
- var watchEffect = function(fn) { return effect(fn); };`;var Qe=` // ==========================================================================
6641
+ var watchEffect = function(fn) { return effect(fn); };`;var Ye=` // ==========================================================================
6623
6642
  // Pipe Syntax Support (Feature #2)
6624
6643
  // ==========================================================================
6625
6644
 
@@ -6795,7 +6814,7 @@ else {
6795
6814
 
6796
6815
  return value;
6797
6816
  }
6798
- `;function Ye(t,s,i){return` // skipChildren: this element's bindings only, because something else already
6817
+ `;function Je(t,s,i){return` // skipChildren: this element's bindings only, because something else already
6799
6818
  // knows where the rest are. The manifest path passes it for every entry, so
6800
6819
  // the tree is never walked; see processFromManifest.
6801
6820
  function processElement(el, scope = componentScope, skipChildren) {
@@ -7403,8 +7422,12 @@ else if (name === 'ref' || name === ':ref' || name === 'x-ref' || name === 'data
7403
7422
  var shorthandFn = parseEventShorthand(value, eventCapturedScope);
7404
7423
  if (shorthandFn) { shorthandFn(handlerEvent); return; }
7405
7424
  // Check if any scope values are signals (x-data pattern)
7425
+ // A derived value reads like a signal in a handler, as it does in a
7426
+ // binding: \`pick(selectedPackage)\` passes the package. Leaving it
7427
+ // out handed the handler the derived's getter function, so
7428
+ // \`selectedPackage.trainer_id\` was undefined with nothing said.
7406
7429
  var hasSignals = Object.values(eventCapturedScope).some(function(v) {
7407
- return v && typeof v === 'function' && v._isSignal;
7430
+ return v && typeof v === 'function' && (v._isSignal || v._isDerived);
7408
7431
  });
7409
7432
  // Only use signal read/write proxy for DIRECT assignment expressions
7410
7433
  // like "count = count + 1" or "open = !open". Function calls like
@@ -7413,7 +7436,7 @@ else if (name === 'ref' || name === ':ref' || name === 'x-ref' || name === 'data
7413
7436
  var isDirectAssignment = hasSignals && /^[a-zA-Z_$]\\w*\\s*=/.test(value.trim()) && !value.trim().startsWith('==');
7414
7437
  if (isDirectAssignment) {
7415
7438
  var getVars = Object.keys(eventCapturedScope).map(function(k) {
7416
- return 'var ' + k + ' = __s["' + k + '"] && typeof __s["' + k + '"] === "function" && __s["' + k + '"]._isSignal ? __s["' + k + '"]() : __s["' + k + '"]';
7439
+ return 'var ' + k + ' = __s["' + k + '"] && typeof __s["' + k + '"] === "function" && (__s["' + k + '"]._isSignal || __s["' + k + '"]._isDerived) ? __s["' + k + '"]() : __s["' + k + '"]';
7417
7440
  }).join(';');
7418
7441
  var setVars = Object.keys(eventCapturedScope).filter(function(k) {
7419
7442
  var v = eventCapturedScope[k];
@@ -7439,11 +7462,11 @@ else if (name === 'ref' || name === ':ref' || name === 'x-ref' || name === 'data
7439
7462
  // handler like \`pick(option.value)\` receives the whole item.
7440
7463
  // It is not an error, so it lands silently: the wrong value is
7441
7464
  // stored and only surfaces much later.
7442
- if (v && typeof v === 'function' && v._isSignal && !v._isStxLoopItem
7465
+ if (v && typeof v === 'function' && ((v._isSignal && !v._isStxLoopItem) || v._isDerived)
7443
7466
  && (expressionCallsSignal(value, k) || expressionUsesSignalApi(value, k))) {
7444
7467
  return 'var ' + k + ' = __s["' + k + '"]';
7445
7468
  }
7446
- return 'var ' + k + ' = __s["' + k + '"] && typeof __s["' + k + '"] === "function" && __s["' + k + '"]._isSignal ? __s["' + k + '"]() : __s["' + k + '"]';
7469
+ return 'var ' + k + ' = __s["' + k + '"] && typeof __s["' + k + '"] === "function" && (__s["' + k + '"]._isSignal || __s["' + k + '"]._isDerived) ? __s["' + k + '"]() : __s["' + k + '"]';
7447
7470
  }).join(';');
7448
7471
  var fn3 = __stxCompile(['__s', '$event'], unwrapVars + ';' + value);
7449
7472
  fn3(eventCapturedScope, handlerEvent);
@@ -7488,7 +7511,7 @@ catch (e) {
7488
7511
  processElement(child, scope);
7489
7512
  });
7490
7513
  }
7491
- }`}var Je=` // ==========================================================================
7514
+ }`}var Ze=` // ==========================================================================
7492
7515
  // Auto-unwrap Signals (Feature #1)
7493
7516
  // ==========================================================================
7494
7517
 
@@ -7565,7 +7588,7 @@ catch (e) {
7565
7588
  },
7566
7589
  });
7567
7590
  }
7568
- `;function Ze(t){return` // Component mount system
7591
+ `;function et(t){return` // Component mount system
7569
7592
  var mountQueue = [];
7570
7593
 
7571
7594
  // MERGE, never replace (#1804). Three client bundles assign window.stx and
@@ -7682,7 +7705,7 @@ ${t}
7682
7705
  _scopes: {}, // Component-level scopes
7683
7706
  _scopeCounter: 0, // Counter for generating unique scope IDs during SPA navigation
7684
7707
  _latestSetup: window.__stx_latestSetup || null, // Latest SFC setup function (including scripts parsed before the runtime)
7685
- _stores: new Map(), // Global store registry \u2014 survives SPA navigation`}var et=` // ==========================================================================
7708
+ _stores: new Map(), // Global store registry \u2014 survives SPA navigation`}var tt=` // ==========================================================================
7686
7709
  // Template Refs (useRef)
7687
7710
  // ==========================================================================
7688
7711
 
@@ -7714,7 +7737,7 @@ ${t}
7714
7737
  Object.defineProperty(read, 'value', { get: read, enumerable: true });
7715
7738
  return read;
7716
7739
  }
7717
- `;var tt=` // ==========================================================================
7740
+ `;var nt=` // ==========================================================================
7718
7741
  // Scope Disposal
7719
7742
  // ==========================================================================
7720
7743
 
@@ -7908,7 +7931,7 @@ ${t}
7908
7931
  delete scopes[id];
7909
7932
  }
7910
7933
  }
7911
- `;var nt=` // Helper to process elements while skipping already-processed scoped containers
7934
+ `;var rt=` // Helper to process elements while skipping already-processed scoped containers
7912
7935
  function processElementSkipScopes(el, processedScopes) {
7913
7936
  if (processedScopes.has(el)) return;
7914
7937
  if (el.nodeType === Node.TEXT_NODE) {
@@ -7949,7 +7972,7 @@ ${t}
7949
7972
  if (el.tagName !== 'SCRIPT' && el.tagName !== 'STYLE') {
7950
7973
  Array.from(el.childNodes).forEach(child => processElementSkipScopes(child, processedScopes));
7951
7974
  }
7952
- }`;var rt=` function bindShow(el, expr, passedScope = componentScope, attrName = '@show') {
7975
+ }`;var ot=` function bindShow(el, expr, passedScope = componentScope, attrName = '@show') {
7953
7976
  if (el.__stx_show_bound) return;
7954
7977
  el.__stx_show_bound = true;
7955
7978
 
@@ -8002,7 +8025,7 @@ ${t}
8002
8025
  }
8003
8026
  el.removeAttribute(attrName);
8004
8027
  }
8005
- `;var ot=` // Re-initialize components after SPA content swap.
8028
+ `;var st=` // Re-initialize components after SPA content swap.
8006
8029
  // Debounce to handle rapid re-fires (HMR triggers navigate which triggers stx:load again).
8007
8030
  var _stxLoadTimer = null;
8008
8031
  if (window.__stxLoadHandler) {
@@ -8043,7 +8066,7 @@ ${t}
8043
8066
  var departingDestroys = null;
8044
8067
  function beginSwap() {
8045
8068
  departingDestroys = (departingDestroys || []).concat(destroyCallbacks.splice(0));
8046
- }`;var st=` function _handleStxLoad() {
8069
+ }`;var at=` function _handleStxLoad() {
8047
8070
  _stxLoadTimer = null;
8048
8071
  console.log('[stx:load] START. mountQueue:', mountQueue.length, '_latestSetup:', !!window.stx._latestSetup);
8049
8072
 
@@ -8229,7 +8252,7 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
8229
8252
  // Everything that should have hydrated has now had its chance (#1773).
8230
8253
  auditHydration(container, 'stx:load');
8231
8254
  }
8232
- `;var at=` // ==========================================================================
8255
+ `;var it=` // ==========================================================================
8233
8256
  // State Signal
8234
8257
  // ==========================================================================
8235
8258
 
@@ -8260,12 +8283,7 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
8260
8283
  try { cb(value, prev); }
8261
8284
  catch (e) { console.error('[stx] subscriber error:', e); }
8262
8285
  });
8263
- if (isBatching) {
8264
- effects.forEach(effect => pendingEffects.add(effect));
8265
- }
8266
- else {
8267
- effects.forEach(effect => effect());
8268
- }
8286
+ notifySubscribers(effects);
8269
8287
  }
8270
8288
  };
8271
8289
 
@@ -8277,12 +8295,7 @@ else {
8277
8295
  try { cb(value, value); }
8278
8296
  catch (e) { console.error('[stx] subscriber error:', e); }
8279
8297
  });
8280
- if (isBatching) {
8281
- effects.forEach(effect => pendingEffects.add(effect));
8282
- }
8283
- else {
8284
- effects.forEach(effect => effect());
8285
- }
8298
+ notifySubscribers(effects);
8286
8299
  };
8287
8300
  signal.subscribe = (cb) => {
8288
8301
  subscribers.add(cb);
@@ -8312,15 +8325,19 @@ else {
8312
8325
  let isDirty = true;
8313
8326
  const effects = new Set();
8314
8327
 
8328
+ // Passes a change on to what read this value. A signal's notification
8329
+ // collects through it (_stxCollect) instead of calling it, so an effect
8330
+ // reached both directly and through here still runs once.
8315
8331
  const markDirty = () => {
8316
8332
  if (!isDirty) {
8317
8333
  isDirty = true;
8318
- if (isBatching) {
8319
- effects.forEach(e => pendingEffects.add(e));
8320
- }
8321
- else {
8322
- effects.forEach(e => e());
8323
- }
8334
+ notifySubscribers(effects);
8335
+ }
8336
+ };
8337
+ markDirty._stxCollect = (into) => {
8338
+ if (!isDirty) {
8339
+ isDirty = true;
8340
+ collectSubscribers(effects, into);
8324
8341
  }
8325
8342
  };
8326
8343
 
@@ -8353,7 +8370,7 @@ finally {
8353
8370
 
8354
8371
  return signal;
8355
8372
  }
8356
- `;var it=` // \u2500\u2500 Store System \u2500\u2500
8373
+ `;var lt=` // \u2500\u2500 Store System \u2500\u2500
8357
8374
  // Pinia-inspired, signals-based. Stores survive SPA navigation.
8358
8375
 
8359
8376
  defineStore: function(id, setupOrOptions, storeOptions) {
@@ -8813,7 +8830,7 @@ finally {
8813
8830
  }
8814
8831
  console.log('[stx:store] useStore:', id);
8815
8832
  return store;
8816
- },`;var lt=` // Storage access is guarded end to end (stacksjs/stx#1793). Every one of
8833
+ },`;var ct=` // Storage access is guarded end to end (stacksjs/stx#1793). Every one of
8817
8834
  // these can throw, and each throw took down the whole client script for the
8818
8835
  // page rather than just the composable:
8819
8836
  //
@@ -8891,7 +8908,7 @@ finally {
8891
8908
  window.addEventListener('storage', handler);
8892
8909
  onDestroy(function() { window.removeEventListener('storage', handler); });
8893
8910
  return s;
8894
- }`;var ct=` function bindStyle(el, expr, passedScope = componentScope, isVisible) {
8911
+ }`;var dt=` function bindStyle(el, expr, passedScope = componentScope, isVisible) {
8895
8912
  // Capture scope at setup time - use passed scope to preserve context
8896
8913
  const capturedScope = { ...globalHelpers, ...passedScope, ...(findElementScope(el) || {}) };
8897
8914
 
@@ -8925,7 +8942,7 @@ catch (e2) {
8925
8942
  stxHost.setStyle(el, value);
8926
8943
  });
8927
8944
  }
8928
- `;var dt=` // <Suspense> boundary (#1742). Aggregates the loading/error state of every
8945
+ `;var ut=` // <Suspense> boundary (#1742). Aggregates the loading/error state of every
8929
8946
  // descendant suspense query (useQuery/useFetch with { suspense: true }) for
8930
8947
  // which this is the nearest [data-stx-suspense] ancestor, and toggles three
8931
8948
  // regions accordingly: [data-stx-suspense-fallback] while any query is loading,
@@ -8983,7 +9000,7 @@ catch (e2) {
8983
9000
  var contentRoot = (contentEl === el) ? el : contentEl;
8984
9001
  Array.from(contentRoot.childNodes).forEach(function(child) { processElement(child, scope); });
8985
9002
  }
8986
- `;var ut=` // ==========================================================================
9003
+ `;var pt=` // ==========================================================================
8987
9004
  // Timer & Utility Composables
8988
9005
  // ==========================================================================
8989
9006
 
@@ -9360,7 +9377,7 @@ else if (timer === null) {
9360
9377
  }
9361
9378
  };
9362
9379
  }
9363
- `;var pt=` // \u2500\u2500 Tooltip runtime \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
9380
+ `;var ht=` // \u2500\u2500 Tooltip runtime \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
9364
9381
  (function() {
9365
9382
  var tip = null;
9366
9383
  function createTip() {
@@ -9399,7 +9416,7 @@ else if (timer === null) {
9399
9416
  document.addEventListener('focusin', function(e) { var el = e.target.closest('[x-tooltip]'); if (el) show(el); });
9400
9417
  document.addEventListener('focusout', function(e) { var el = e.target.closest('[x-tooltip]'); if (el) hide(); });
9401
9418
  })();
9402
- `;var ht=` // ==========================================================================
9419
+ `;var ft=` // ==========================================================================
9403
9420
  // Toast notification system
9404
9421
  // ==========================================================================
9405
9422
 
@@ -9604,7 +9621,7 @@ else if (timer === null) {
9604
9621
  removeToast(tid);
9605
9622
  }
9606
9623
  }
9607
- };`;var ft=` // \u2500\u2500 <TransitionGroup> support (#1742) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
9624
+ };`;var mt=` // \u2500\u2500 <TransitionGroup> support (#1742) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
9608
9625
  // Class-driven enter/leave + FLIP move animations for keyed :for lists whose
9609
9626
  // parent is a [data-stx-transition-group]. All helpers are self-contained and
9610
9627
  // guarded (no-ops off the happy path), and every transition has a timeout
@@ -9695,7 +9712,7 @@ else if (timer === null) {
9695
9712
  });
9696
9713
  });
9697
9714
  }
9698
- `;var mt=` // ==========================================================================
9715
+ `;var gt=` // ==========================================================================
9699
9716
  // WebSocket Composable
9700
9717
  // ==========================================================================
9701
9718
 
@@ -9832,18 +9849,18 @@ else if (timer === null) {
9832
9849
  subscribe: subscribe
9833
9850
  };
9834
9851
  }
9835
- `;function Me(){let t=bt(Jt());try{let i=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t);return i=i.replace(/\}(var |let |const |function )/g,"};$1"),i}catch{return t}}function bt(t){let s=[],i=0,a="console.log(";while(i<t.length){let c=t.indexOf(a,i);if(c===-1){s.push(t.slice(i));break}s.push(t.slice(i,c));let y=1,h=c+a.length;while(h<t.length&&y>0){let f=t[h];if(f==='"'||f==="'"||f==="`"){let d=f;h++;while(h<t.length&&t[h]!==d){if(t[h]==="\\")h++;h++}h++;continue}if(f==="(")y++;else if(f===")")y--;h++}s.push("0"),i=h}return s.join("")}function Jt(){return`${re}${Ce}
9836
- ${We(oe,we,xe)}
9852
+ `;function Me(){let t=wt(Jt());try{let i=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t);return i=i.replace(/\}(var |let |const |function )/g,"};$1"),i}catch{return t}}function wt(t){let s=[],i=0,a="console.log(";while(i<t.length){let c=t.indexOf(a,i);if(c===-1){s.push(t.slice(i));break}s.push(t.slice(i,c));let y=1,h=c+a.length;while(h<t.length&&y>0){let f=t[h];if(f==='"'||f==="'"||f==="`"){let d=f;h++;while(h<t.length&&t[h]!==d){if(t[h]==="\\")h++;h++}h++;continue}if(f==="(")y++;else if(f===")")y--;h++}s.push("0"),i=h}return s.join("")}function Jt(){return`${re}${Ce}
9853
+ ${Xe(oe,we,xe)}
9837
9854
 
9838
9855
  ${Ne}
9839
- ${Je}
9840
- ${Qe}
9841
- ${at}
9856
+ ${Ze}
9857
+ ${Ye}
9858
+ ${it}
9842
9859
  ${ye}
9843
9860
  ${Fe}
9844
- ${mt}
9861
+ ${gt}
9845
9862
  ${Se(W.toString(),X.toString())}
9846
- ${et}
9863
+ ${tt}
9847
9864
  ${Ge}
9848
9865
  ${ze}
9849
9866
  ${Ke}
@@ -9859,14 +9876,14 @@ ${ne}
9859
9876
  ${ie}
9860
9877
  ${ue}
9861
9878
  ${je}
9862
- ${Ye(Ui(),Vi(),Hi())}
9879
+ ${Je(Vi(),Wi(),Ui())}
9863
9880
 
9864
- ${dt}
9865
- ${rt}
9881
+ ${ut}
9882
+ ${ot}
9866
9883
  ${qe}
9867
9884
  ${se}
9868
- ${ct}
9869
- ${ft}
9885
+ ${dt}
9886
+ ${mt}
9870
9887
  ${He}
9871
9888
  ${le}
9872
9889
  ${Ue}
@@ -9876,26 +9893,26 @@ ${de}
9876
9893
  ${Oe}
9877
9894
  ${De}
9878
9895
  ${ae}
9879
- ${ut}
9896
+ ${pt}
9880
9897
  ${ee}
9881
- ${Xe}
9898
+ ${Qe}
9882
9899
 
9883
- ${lt}
9900
+ ${ct}
9884
9901
 
9885
9902
  ${Pe(Y.toString(),Q.toString(),Z.toString(),J.toString())}
9886
9903
  ${he}
9887
9904
  ${te(z.toString())}
9888
9905
  ${Ae}
9889
- ${ht}
9906
+ ${ft}
9890
9907
 
9891
9908
  ${$e}
9892
9909
  ${fe}
9893
9910
  ${ve}
9894
- ${pt}
9911
+ ${ht}
9895
9912
  ${Ie}
9896
- ${Ze(ce)}
9913
+ ${et(ce)}
9897
9914
 
9898
- ${it}
9915
+ ${lt}
9899
9916
 
9900
9917
  ${Be}
9901
9918
  });
@@ -9903,12 +9920,12 @@ ${Be}
9903
9920
  ${Ee}
9904
9921
  ${me}
9905
9922
  ${ge}
9906
- ${tt}
9923
+ ${nt}
9907
9924
  ${Re}
9908
9925
  ${pe}
9909
- ${ot}
9910
9926
  ${st}
9911
- ${nt}
9927
+ ${at}
9928
+ ${rt}
9912
9929
  })();
9913
- `}var ld={state:V,derived:Nn,effect:Yt,batch:Hr,onMount:Ur,onDestroy:Ln,isSignal:Zt,isDerived:Qt,untrack:Vr,peek:jn,generateSignalsRuntime:Me,generateSignalsRuntimeDev:Jt};
9914
- export{Me,Jt,ld};
9930
+ `}var dd={state:V,derived:Nn,effect:Yt,batch:Hr,onMount:Ur,onDestroy:Ln,isSignal:Zt,isDerived:Qt,untrack:Vr,peek:jn,generateSignalsRuntime:Me,generateSignalsRuntimeDev:Jt};
9931
+ export{Me,Jt,dd};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ps,Is,Os,Ds,rr,sr,iu,au,cu,lu,or,du}from"./chunk-ywah1c30.js";import"./chunk-wemq37qe.js";import"./chunk-j3vwyzvb.js";export{du as generateDefaultRobotsTxt,or as generateRobotsTxt,au as generateSitemap,cu as generateSitemapIndex,Ds as injectSeoTags,rr as metaDirective,Ps as processMetaDirectives,Os as processSeoDirective,Is as processStructuredData,iu as registerSeoDirectives,lu as scanForSitemapEntries,sr as structuredDataDirective};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{$e,Re,Ae}from"./chunk-qj4j547f.js";import{lt,dt,Te,Ks,ut,pt}from"./chunk-fpa1nq88.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();lt();let t=await $e({mode:"build"});if(!t.config.enabled){Te("Story feature is disabled in config.");return}let n=await ut(t);Re(t,n);let l=pt(t.config,n);Ae(t,l),dt(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;Ks(n.length,d,x)}function v(a){let{theme:e}=a.config,t=e.title||"STX Story";return`<!DOCTYPE html>
2
+ import{$e,Re,Ae}from"./chunk-qj4j547f.js";import{lt,dt,Te,Xs,ut,pt}from"./chunk-0pzbg1bt.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();lt();let t=await $e({mode:"build"});if(!t.config.enabled){Te("Story feature is disabled in config.");return}let n=await ut(t);Re(t,n);let l=pt(t.config,n);Ae(t,l),dt(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;Xs(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">
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Qi,io,ea,ta,ao,na,ra,sa,oa,co,ia,cl}from"./chunk-dgr561sc.js";import{wo,pa}from"./chunk-y3mmeywt.js";import{j,B,F,Bt,Z,ie,Dn,Oe,gt,Ft,zt,Ht,z,Ut,Vt,Mn}from"./chunk-qh0es7mk.js";import{Ua}from"./chunk-a849hqna.js";import"./chunk-rtc17gy5.js";export{B as DEFAULT_FORMATS,F as DEFAULT_QUALITY,j as DEFAULT_WIDTHS,Mn as ImageProcessingError,ta as clearImageCache,ao as createImageDirective,pa as createImageHandler,ra as createImagePlugin,cl as defaultImageConfig,Vt as formatSize,co as generateImageManifest,gt as generateSizes,Oe as generateSrcSet,Ft as getFallbackVariant,Dn as getImageMetadata,z as getMimeType,Ut as getTotalSize,zt as groupVariantsByFormat,wo as handleImageRequest,na as imageDirective,Z as isImageBackendAvailable,Ht as isImageFile,Bt as isSharpAvailable,oa as optimizeDirectory,sa as optimizeImage,io as parseImageComponent,ie as processImage,ea as processImageComponents,Qi as renderImageComponent,Ua as rewriteImagesWithSiblings,ia as writeImageManifest};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- function wo(e){return e}class a{plugins=new Map;sortedPlugins=[];initialized=!1;async register(e,t){if(this.plugins.has(e.name))throw Error(`Plugin "${e.name}" is already registered`);if(e.dependencies){for(let r of e.dependencies)if(!this.plugins.has(r))throw Error(`Plugin "${e.name}" depends on "${r}" which is not registered`)}if(this.plugins.set(e.name,e),e.onRegister)await e.onRegister(t);this.sortPlugins()}async unregister(e){let t=this.plugins.get(e);if(!t)return!1;for(let[r,i]of this.plugins)if(i.dependencies?.includes(e))throw Error(`Cannot unregister "${e}" because "${r}" depends on it`);if(t.onUnregister)await t.onUnregister();return this.plugins.delete(e),this.sortPlugins(),!0}get(e){return this.plugins.get(e)}has(e){return this.plugins.has(e)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let e=[];for(let t of this.sortedPlugins)if(t.registerDirectives)e.push(...t.registerDirectives());return e}getAllFilters(){let e={};for(let t of this.sortedPlugins)if(t.registerFilters)Object.assign(e,t.registerFilters());return e}async runBeforeProcess(e){return this.runHooks("beforeProcess",e)}async runAfterParse(e){return this.runHooks("afterParse",e)}async runBeforeDirective(e,t){return this.runDirectiveHooks("beforeDirective",e,t)}async runAfterDirective(e,t){return this.runDirectiveHooks("afterDirective",e,t)}async runBeforeRender(e){return this.runHooks("beforeRender",e)}async runAfterRender(e){return this.runHooks("afterRender",e)}async runOnError(e){for(let t of this.sortedPlugins)if(t.onError)try{let r=await t.onError(e);if(r){if(r.template!==void 0)e.template=r.template;if(r.context)e.context={...e.context,...r.context};if(r.metadata)e.metadata={...e.metadata,...r.metadata};if(r.skip)return e}}catch(r){console.error(`Error in plugin "${t.name}" onError hook:`,r)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort((e,t)=>(e.priority??100)-(t.priority??100))}async runHooks(e,t){let r={...t};for(let i of this.sortedPlugins){let s=i[e];if(s)try{let n=await s(r);if(n){if(n.template!==void 0)r.template=n.template;if(n.context)r.context={...r.context,...n.context};if(n.metadata)r.metadata={...r.metadata,...n.metadata};if(n.skip)break}}catch(n){console.error(`Error in plugin "${i.name}" ${e} hook:`,n)}}return r}async runDirectiveHooks(e,t,r){let i={...r};for(let s of this.sortedPlugins){let n=s[e];if(n)try{let o=await n(t,i);if(o){if(o.template!==void 0)i.template=o.template;if(o.context)i.context={...i.context,...o.context};if(o.metadata)i.metadata={...i.metadata,...o.metadata};if(o.skip)break}}catch(o){console.error(`Error in plugin "${s.name}" ${e} hook:`,o)}}return i}}var El=new a;var u=wo({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess(e){console.log("[stx-debug] beforeProcess:",e.filePath)},afterParse(e){console.log("[stx-debug] afterParse:",e.template.length,"chars")},beforeDirective(e,t){console.log("[stx-debug] beforeDirective:",e)},afterDirective(e,t){console.log("[stx-debug] afterDirective:",e)},beforeRender(e){console.log("[stx-debug] beforeRender")},afterRender(e){console.log("[stx-debug] afterRender:",e.template.length,"chars")},onError(e){console.error("[stx-debug] onError:",e.error.message,"in phase:",e.phase)}}),l=wo({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess(e){e.metadata.startTime=performance.now()},afterRender(e){let t=e.metadata.startTime;if(t){let r=performance.now()-t;console.log(`[stx-timing] Processing took ${r.toFixed(2)}ms`)}}});export{wo,El};
2
+ function vo(e){return e}class a{plugins=new Map;sortedPlugins=[];initialized=!1;async register(e,t){if(this.plugins.has(e.name))throw Error(`Plugin "${e.name}" is already registered`);if(e.dependencies){for(let r of e.dependencies)if(!this.plugins.has(r))throw Error(`Plugin "${e.name}" depends on "${r}" which is not registered`)}if(this.plugins.set(e.name,e),e.onRegister)await e.onRegister(t);this.sortPlugins()}async unregister(e){let t=this.plugins.get(e);if(!t)return!1;for(let[r,i]of this.plugins)if(i.dependencies?.includes(e))throw Error(`Cannot unregister "${e}" because "${r}" depends on it`);if(t.onUnregister)await t.onUnregister();return this.plugins.delete(e),this.sortPlugins(),!0}get(e){return this.plugins.get(e)}has(e){return this.plugins.has(e)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let e=[];for(let t of this.sortedPlugins)if(t.registerDirectives)e.push(...t.registerDirectives());return e}getAllFilters(){let e={};for(let t of this.sortedPlugins)if(t.registerFilters)Object.assign(e,t.registerFilters());return e}async runBeforeProcess(e){return this.runHooks("beforeProcess",e)}async runAfterParse(e){return this.runHooks("afterParse",e)}async runBeforeDirective(e,t){return this.runDirectiveHooks("beforeDirective",e,t)}async runAfterDirective(e,t){return this.runDirectiveHooks("afterDirective",e,t)}async runBeforeRender(e){return this.runHooks("beforeRender",e)}async runAfterRender(e){return this.runHooks("afterRender",e)}async runOnError(e){for(let t of this.sortedPlugins)if(t.onError)try{let r=await t.onError(e);if(r){if(r.template!==void 0)e.template=r.template;if(r.context)e.context={...e.context,...r.context};if(r.metadata)e.metadata={...e.metadata,...r.metadata};if(r.skip)return e}}catch(r){console.error(`Error in plugin "${t.name}" onError hook:`,r)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort((e,t)=>(e.priority??100)-(t.priority??100))}async runHooks(e,t){let r={...t};for(let i of this.sortedPlugins){let s=i[e];if(s)try{let n=await s(r);if(n){if(n.template!==void 0)r.template=n.template;if(n.context)r.context={...r.context,...n.context};if(n.metadata)r.metadata={...r.metadata,...n.metadata};if(n.skip)break}}catch(n){console.error(`Error in plugin "${i.name}" ${e} hook:`,n)}}return r}async runDirectiveHooks(e,t,r){let i={...r};for(let s of this.sortedPlugins){let n=s[e];if(n)try{let o=await n(t,i);if(o){if(o.template!==void 0)i.template=o.template;if(o.context)i.context={...i.context,...o.context};if(o.metadata)i.metadata={...i.metadata,...o.metadata};if(o.skip)break}}catch(o){console.error(`Error in plugin "${s.name}" ${e} hook:`,o)}}return i}}var El=new a;var u=vo({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess(e){console.log("[stx-debug] beforeProcess:",e.filePath)},afterParse(e){console.log("[stx-debug] afterParse:",e.template.length,"chars")},beforeDirective(e,t){console.log("[stx-debug] beforeDirective:",e)},afterDirective(e,t){console.log("[stx-debug] afterDirective:",e)},beforeRender(e){console.log("[stx-debug] beforeRender")},afterRender(e){console.log("[stx-debug] afterRender:",e.template.length,"chars")},onError(e){console.error("[stx-debug] onError:",e.error.message,"in phase:",e.phase)}}),l=vo({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess(e){e.metadata.startTime=performance.now()},afterRender(e){let t=e.metadata.startTime;if(t){let r=performance.now()-t;console.log(`[stx-timing] Processing took ${r.toFixed(2)}ms`)}}});export{vo,El};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
2
  import{existsSync as A,mkdtempSync as D,readdirSync as M,rmSync as b,statSync as g,writeFileSync as k}from"fs";import{constants as P,tmpdir as x}from"os";import{join as s}from"path";import t from"process";var _=/^stx-(?:.+-)?p(\d+)-\w{6}$/,v=".stx-keep",I=60000,N=["SIGINT","SIGTERM","SIGHUP"],i=new Set,y=new Set,c=!1,S=new Set;function p(e){try{b(e,{recursive:!0,force:!0})}catch{}}function R(){for(let e of i)p(e);i.clear(),f()}function E(){for(let e of i)p(e);i.clear()}function C(e){if(R(),t.listenerCount(e)===0)t.exit(128+(P.signals[e]??1))}var h=new Map(N.map((e)=>[e,()=>C(e)]));function G(){if(c)return;c=!0,t.on("exit",E);for(let[e,n]of h)try{t.on(e,n)}catch{}}function f(){if(!c)return;c=!1,t.off("exit",E);for(let[e,n]of h)t.off(e,n)}function K(e){try{return t.kill(e,0),!0}catch(n){return n.code==="EPERM"}}function O(e={}){let n=e.root??x(),r=e.isAlive??K,w=e.minAgeMs??I,T=e.now??Date.now(),a=[],u;try{u=M(n)}catch{return a}for(let d of u){let l=_.exec(d);if(!l)continue;let m=Number(l[1]);if(m===t.pid||r(m))continue;let o=s(n,d);try{if(!g(o).isDirectory())continue;if(T-g(o).mtimeMs<w)continue;if(A(s(o,v)))continue}catch{continue}p(o),a.push(o)}return a}function L(e){let n=e.replace(/^stx-/,"").replace(/-+$/,"");return n?`stx-${n}-p${t.pid}-`:`stx-p${t.pid}-`}function z(e=t.env){let n=e.STX_KEEP_TEMP?.trim().toLowerCase();return!!n&&n!=="0"&&n!=="false"}function Ne(e="stx",n=x()){if(!S.has(n))S.add(n),O({root:n});let r=D(s(n,L(e)));if(z())return H(r),console.warn(`[stx] STX_KEEP_TEMP: keeping ${r}`),r;return G(),i.add(r),r}function W(e){if(y.has(e))return;if(p(e),i.delete(e),i.size===0)f()}function H(e){try{k(s(e,v),`kept by pid ${t.pid}
3
- `)}catch{}if(y.add(e),i.delete(e),i.size===0)f()}async function No(e,n){let r=Ne(e);try{return await n(r)}finally{W(r)}}
4
- export{Ne,W,No};
3
+ `)}catch{}if(y.add(e),i.delete(e),i.size===0)f()}async function Lo(e,n){let r=Ne(e);try{return await n(r)}finally{W(r)}}
4
+ export{Ne,W,Lo};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Yi,Zi}from"./chunk-v9gy8rda.js";import"./chunk-brkq2s62.js";import"./chunk-nz0krznq.js";import"./chunk-je0jxvmj.js";import"./chunk-dgr561sc.js";import"./chunk-nebtks7j.js";import"./chunk-kaaxb9c5.js";import"./chunk-r17t24jr.js";import{uo}from"./chunk-8yn9wxzt.js";import"./chunk-xjr67xvb.js";import"./chunk-y3mmeywt.js";import"./chunk-hvzznc50.js";import"./chunk-rrce2fyv.js";import"./chunk-qh0es7mk.js";import"./chunk-5hxsdkvp.js";import"./chunk-zckbg2vb.js";import"./chunk-knpzph55.js";import"./chunk-2t3bhp2j.js";import"./chunk-8zmahjqg.js";import"./chunk-mbj9dbrh.js";import"./chunk-z3smaz4z.js";import"./chunk-a849hqna.js";import"./chunk-a2mztbta.js";import"./chunk-3tzkqf6e.js";import"./chunk-dkyqkkpj.js";import"./chunk-mw2dravv.js";import"./chunk-fas9k7sw.js";import"./chunk-9zf49tqg.js";import"./chunk-wvjpvs89.js";import"./chunk-r8h9b3f8.js";import"./chunk-724zsgbk.js";import"./chunk-35kmebz9.js";import"./chunk-rtc17gy5.js";import"./chunk-k0shfsfx.js";import"./chunk-tgwdk0gt.js";import"./chunk-nmy7mcbd.js";import"./chunk-ffxwsa94.js";import{be,on,an,X,d,n,Qn,R,o,ue}from"./chunk-kz131809.js";import"./chunk-gwabvrc3.js";import"./chunk-3wcwtqx1.js";import"./chunk-9k6r7f3c.js";import"./chunk-dajh1369.js";import"./chunk-ebg20d8s.js";import"./chunk-ywah1c30.js";import"./chunk-wemq37qe.js";import"./chunk-j3vwyzvb.js";import"./chunk-d4ybwtqt.js";import"./chunk-c1ys37c9.js";import"./chunk-w8vg3te3.js";import"./chunk-tdv9np5t.js";export{Qn as buildWebComponents,an as cacheTemplate,on as checkCache,uo as classifyAllScripts,Yi as createMiddleware,Zi as createRoute,R as defaultConfig,d as extractVariables,X as injectRouterScript,o as loadStxConfig,be as processClientScript,n as processDirectives,ue as readMarkdownFile};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ln,vc,us}from"./chunk-kz131809.js";import"./chunk-gwabvrc3.js";import"./chunk-3wcwtqx1.js";import"./chunk-9k6r7f3c.js";import"./chunk-dajh1369.js";import"./chunk-ebg20d8s.js";import"./chunk-ywah1c30.js";import"./chunk-wemq37qe.js";import{Ce}from"./chunk-j3vwyzvb.js";import"./chunk-d4ybwtqt.js";import"./chunk-c1ys37c9.js";import"./chunk-w8vg3te3.js";import"./chunk-tdv9np5t.js";export{Ce as freeIdentifiers,us as processComponents,vc as processESImports,ln as rendersAsElement};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
2
  import m from"path";var y=/__stxModules\["((?:[^"\\]|\\.)*)"\]/g;function I(...o){let r=new Set;for(let s of o){if(!s||!s.includes("__stxModules["))continue;for(let e of s.matchAll(y))try{r.add(JSON.parse(`"${e[1]}"`))}catch{}}return[...r].sort()}async function w(o,r={}){if(o.length===0)return null;let s=process.cwd(),e=[],a=[];o.forEach((t,c)=>{let i=t.startsWith("npm:")?t.slice(4):m.resolve(s,t),l=`__stxRegistered${c}`,p=JSON.stringify(t);e.push(`import * as ${l} from ${JSON.stringify(i)};`),a.push(`if (!globalThis.__stxModules[${p}]) globalThis.__stxModules[${p}] = ${l};`)});let d=[...e,"globalThis.__stxModules = globalThis.__stxModules || {};",...a].join(`
3
- `),n;try{let{bundleClientScript:t}=await import("./chunk-n2nha538.js");n=await t(d,m.join(s,".stx-module-registry.ts"),{projectRoot:s,minify:r.minify,externalizeUserModules:!1,collectInputs:r.collectInputs,throwOnFailure:!0})}catch(t){let{formatBuildFailure:c}=await import("./chunk-k50k9zbw.js"),i=c(t);console.warn(`[stx] could not build the page module registry (#1957): ${i}`);let l=`[stx] the page module registry did not build, so ${o.join(", ")} cannot load (#1957): ${i}`;return`;console.error(${JSON.stringify(l)});`}let{transformAutoImports:f,generateAutoImportDestructuring:_}=await import("./chunk-jq079mrx.js"),u=f(n),h=_(u.stxImports,u.browserImports),{transformStoreImports:x}=await import("./chunk-pxcmv1xz.js");n=x(u.code);let g=JSON.stringify(new Bun.CryptoHasher("md5").update(d).digest("hex").slice(0,12));return[";(function() {"," var __stxBundles = globalThis.__stxModuleBundles || (globalThis.__stxModuleBundles = {});",` if (__stxBundles[${g}]) return;`,` __stxBundles[${g}] = true;`,h,n,"})();"].join(`
3
+ `),n;try{let{bundleClientScript:t}=await import("./chunk-y3kp87w1.js");n=await t(d,m.join(s,".stx-module-registry.ts"),{projectRoot:s,minify:r.minify,externalizeUserModules:!1,collectInputs:r.collectInputs,throwOnFailure:!0})}catch(t){let{formatBuildFailure:c}=await import("./chunk-k50k9zbw.js"),i=c(t);console.warn(`[stx] could not build the page module registry (#1957): ${i}`);let l=`[stx] the page module registry did not build, so ${o.join(", ")} cannot load (#1957): ${i}`;return`;console.error(${JSON.stringify(l)});`}let{transformAutoImports:f,generateAutoImportDestructuring:_}=await import("./chunk-g8b74qvn.js"),u=f(n),h=_(u.stxImports,u.browserImports),{transformStoreImports:x}=await import("./chunk-pxcmv1xz.js");n=x(u.code);let g=JSON.stringify(new Bun.CryptoHasher("md5").update(d).digest("hex").slice(0,12));return[";(function() {"," var __stxBundles = globalThis.__stxModuleBundles || (globalThis.__stxModuleBundles = {});",` if (__stxBundles[${g}]) return;`,` __stxBundles[${g}] = true;`,h,n,"})();"].join(`
4
4
  `)}export{w as buildModuleRegistryScript,I as registeredModuleIdsIn};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
2
  var f=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),b=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);function l(i){return i.replace(/[^\n]/g," ")}function w(i){let o=i.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,l).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,l).replace(/<!--[\s\S]*?-->/g,l).replace(/\{\{\{[\s\S]*?\}\}\}/g,l).replace(/\{\{[\s\S]*?\}\}/g,l).replace(/\{!![\s\S]*?!!\}/g,l),s=new Map,r=new Map,p=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,t;while((t=p.exec(o))!==null){let e=t[1]==="/",n=t[2],a=t[3]==="/";if(f.has(n.toLowerCase()))continue;if(a)continue;if(e)r.set(n,(r.get(n)??0)+1);else{let g=s.get(n);if(g)g.count++;else{let d=o.slice(0,t.index).split(`
3
- `).length;s.set(n,{count:1,firstLine:d})}}}let c=[];for(let e of new Set([...s.keys(),...r.keys()])){if(b.has(e.toLowerCase()))continue;let n=s.get(e)?.count??0,a=r.get(e)??0;if(n!==a)c.push({tag:e,opened:n,closed:a,firstOpenLine:s.get(e)?.firstLine??0})}return c}var u=new Set;function Ws(i,o){let s;try{s=w(i)}catch{return}if(s.length===0)return;let r=`${o}:${i.length}`;if(u.has(r))return;u.add(r);let p=o?o.split(/[/\\]/).pop()||o:"template";for(let{tag:t,opened:c,closed:e,firstOpenLine:n}of s)if(c>e){let a=n?` (first opened at line ${n})`:"";console.warn(`[stx] ${p}: <${t}> ${c} opened, ${e} closed \u2014 an unclosed <${t}>${a} may swallow the content that follows it.`)}else console.warn(`[stx] ${p}: <${t}> ${c} opened, ${e} closed \u2014 ${e-c} stray </${t}>.`)}
4
- export{Ws};
3
+ `).length;s.set(n,{count:1,firstLine:d})}}}let c=[];for(let e of new Set([...s.keys(),...r.keys()])){if(b.has(e.toLowerCase()))continue;let n=s.get(e)?.count??0,a=r.get(e)??0;if(n!==a)c.push({tag:e,opened:n,closed:a,firstOpenLine:s.get(e)?.firstLine??0})}return c}var u=new Set;function qs(i,o){let s;try{s=w(i)}catch{return}if(s.length===0)return;let r=`${o}:${i.length}`;if(u.has(r))return;u.add(r);let p=o?o.split(/[/\\]/).pop()||o:"template";for(let{tag:t,opened:c,closed:e,firstOpenLine:n}of s)if(c>e){let a=n?` (first opened at line ${n})`:"";console.warn(`[stx] ${p}: <${t}> ${c} opened, ${e} closed \u2014 an unclosed <${t}>${a} may swallow the content that follows it.`)}else console.warn(`[stx] ${p}: <${t}> ${c} opened, ${e} closed \u2014 ${e-c} stray </${t}>.`)}
4
+ export{qs};