@stacksjs/stx 0.2.574 → 0.2.576

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 (175) hide show
  1. package/README.md +3 -0
  2. package/dist/chunk-08a98yqt.js +2 -0
  3. package/dist/chunk-181m21rg.js +2 -0
  4. package/dist/{chunk-nxw03sy9.js → chunk-1edvsndv.js} +2 -2
  5. package/dist/chunk-1nbn56jw.js +2 -0
  6. package/dist/{chunk-a3w3jc0t.js → chunk-1w9ngqpv.js} +3 -3
  7. package/dist/{chunk-ta50ym5j.js → chunk-1wkpxa58.js} +2 -2
  8. package/dist/{chunk-6z57saf5.js → chunk-2ry2pfpe.js} +1 -1
  9. package/dist/{chunk-ss4h5ch3.js → chunk-32gycb72.js} +1 -1
  10. package/dist/{chunk-g8dx2jew.js → chunk-34fajf1n.js} +100 -99
  11. package/dist/chunk-3bj1w990.js +2 -0
  12. package/dist/{chunk-kcq2ed1d.js → chunk-3gqrv02t.js} +2 -2
  13. package/dist/chunk-4a12azrb.js +2 -0
  14. package/dist/{chunk-e7pjsrfc.js → chunk-4z21afpp.js} +2 -2
  15. package/dist/{chunk-r5ce7mkg.js → chunk-5dm4k229.js} +2 -2
  16. package/dist/chunk-6fpynp8q.js +2 -0
  17. package/dist/{chunk-ytf3qkaw.js → chunk-6q3yszw9.js} +1 -1
  18. package/dist/{chunk-crj0yqc6.js → chunk-6rfm6b1c.js} +1 -1
  19. package/dist/chunk-6ryab0yy.js +2 -0
  20. package/dist/{chunk-3pr388w5.js → chunk-6sasxbv9.js} +1 -1
  21. package/dist/chunk-6w9km7qb.js +2 -0
  22. package/dist/{chunk-4k6cb5fg.js → chunk-6wz6f8d5.js} +3 -3
  23. package/dist/{chunk-cp5903cg.js → chunk-7j9m4d7x.js} +1 -1
  24. package/dist/{chunk-7gxn7mvd.js → chunk-7y73q42g.js} +2 -2
  25. package/dist/chunk-98r9jk2b.js +2 -0
  26. package/dist/chunk-9dgygz8d.js +2 -0
  27. package/dist/chunk-a51f04an.js +2 -0
  28. package/dist/chunk-aa52jhak.js +2 -0
  29. package/dist/chunk-agk478t4.js +3 -0
  30. package/dist/chunk-ambynnzb.js +2 -0
  31. package/dist/chunk-asbq9cgs.js +2 -0
  32. package/dist/{chunk-1n9bxdnh.js → chunk-bbdg3sqq.js} +2 -2
  33. package/dist/{chunk-69k5t6pj.js → chunk-bctjmaxg.js} +53 -53
  34. package/dist/{chunk-9yht5n7g.js → chunk-bks1fe5e.js} +1 -1
  35. package/dist/chunk-bmtsb5mr.js +2 -0
  36. package/dist/chunk-c8rd3573.js +2 -0
  37. package/dist/chunk-d4b8cgvt.js +2 -0
  38. package/dist/chunk-d7skqhrc.js +2 -0
  39. package/dist/{chunk-hqda3vcw.js → chunk-d8ek63nc.js} +1 -1
  40. package/dist/chunk-f2y8bwdd.js +2 -0
  41. package/dist/{chunk-0px2ab3m.js → chunk-fkbthywg.js} +5 -5
  42. package/dist/chunk-g9vtny6q.js +2 -0
  43. package/dist/{chunk-f0mbj8w9.js → chunk-gjp2jxrp.js} +1 -1
  44. package/dist/{chunk-gh0q6jrm.js → chunk-gpb22a8n.js} +2 -2
  45. package/dist/{chunk-anjm087t.js → chunk-h1n43e5n.js} +2 -2
  46. package/dist/{chunk-gdxhe7ae.js → chunk-h72befy4.js} +2 -2
  47. package/dist/chunk-haeb904b.js +3 -0
  48. package/dist/chunk-hcsrj8z6.js +3 -0
  49. package/dist/chunk-hj1bntaa.js +2 -0
  50. package/dist/chunk-hwy3aw5v.js +2 -0
  51. package/dist/chunk-hyafyqy6.js +2 -0
  52. package/dist/{chunk-e27njk86.js → chunk-j4zyq2ap.js} +8 -8
  53. package/dist/chunk-j75hqvgt.js +2 -0
  54. package/dist/chunk-j83ax407.js +2 -0
  55. package/dist/{chunk-e40qpeg5.js → chunk-je0cttam.js} +1 -1
  56. package/dist/{chunk-jwe7yq8m.js → chunk-jgrtvs81.js} +2 -2
  57. package/dist/chunk-k3hfwve1.js +2 -0
  58. package/dist/{chunk-3kc7af8c.js → chunk-kskyfss0.js} +2 -2
  59. package/dist/{chunk-sej3ng5k.js → chunk-mp99h8wh.js} +3 -3
  60. package/dist/{chunk-svvavwp2.js → chunk-n0kw3q6p.js} +1 -1
  61. package/dist/{chunk-0gt7e1ns.js → chunk-n829xbbq.js} +1 -1
  62. package/dist/chunk-nd3qttxh.js +2 -0
  63. package/dist/{chunk-myhh1zsm.js → chunk-ndc1bmj7.js} +1 -1
  64. package/dist/chunk-nn462qm9.js +2 -0
  65. package/dist/chunk-nr07vxm2.js +2 -0
  66. package/dist/{chunk-yhqhv8mp.js → chunk-nskvepjv.js} +414 -162
  67. package/dist/{chunk-8hp6722y.js → chunk-pqkb1m5x.js} +3 -3
  68. package/dist/chunk-q7a5pwaz.js +2 -0
  69. package/dist/{chunk-yf90vn5t.js → chunk-qfb34r6k.js} +3 -3
  70. package/dist/chunk-r51vyhms.js +2 -0
  71. package/dist/{chunk-k5rrp1bt.js → chunk-s68bqf62.js} +1 -1
  72. package/dist/{chunk-32pxa1r0.js → chunk-sf7z2ar9.js} +3 -3
  73. package/dist/{chunk-825m59jr.js → chunk-sn3htx1z.js} +1 -1
  74. package/dist/chunk-svavrmxb.js +2 -0
  75. package/dist/chunk-sw7mvg9p.js +2 -0
  76. package/dist/{chunk-06hx32h4.js → chunk-szfkkbve.js} +1 -1
  77. package/dist/{chunk-c0ewddb3.js → chunk-tasjpnbf.js} +2 -2
  78. package/dist/{chunk-3dr757vb.js → chunk-tybk9hw9.js} +7 -7
  79. package/dist/chunk-tz40t18m.js +2 -0
  80. package/dist/chunk-v1k0bdsg.js +2 -0
  81. package/dist/chunk-vd10tty0.js +2 -0
  82. package/dist/{chunk-501h1mer.js → chunk-vmetcczm.js} +4 -4
  83. package/dist/{chunk-vnh550b5.js → chunk-vnsby98n.js} +1 -1
  84. package/dist/{chunk-zfw39q56.js → chunk-vqkzhd19.js} +1 -1
  85. package/dist/{chunk-bb5a8adb.js → chunk-vw1rmevt.js} +3 -3
  86. package/dist/{chunk-71zwgxws.js → chunk-w1yft5gg.js} +1 -1
  87. package/dist/chunk-w6sa921x.js +2 -0
  88. package/dist/{chunk-1x2x3xgc.js → chunk-wvk932dp.js} +1 -1
  89. package/dist/{chunk-nc0ba89b.js → chunk-x5xwe5nr.js} +6 -6
  90. package/dist/{chunk-76437eb4.js → chunk-xh0808cd.js} +1 -1
  91. package/dist/{chunk-b10n7cpe.js → chunk-xk2v20xe.js} +2 -2
  92. package/dist/{chunk-0ppzstqj.js → chunk-xsxh7h8z.js} +2 -2
  93. package/dist/{chunk-n8hnrgen.js → chunk-y120qq1a.js} +4 -4
  94. package/dist/{chunk-byhsfnkc.js → chunk-zak5xare.js} +1 -1
  95. package/dist/chunk-zcw74jmk.js +2 -0
  96. package/dist/chunk-zxvndwaz.js +2 -0
  97. package/dist/cli.js +58 -58
  98. package/dist/client/signals-context-runtime.js +200 -0
  99. package/dist/client/signals-effect-runtime.js +12 -1
  100. package/dist/client/signals-globals-runtime.js +3 -1
  101. package/dist/client/signals-kept-runtime.d.ts +1 -1
  102. package/dist/client/signals-kept-runtime.js +8 -3
  103. package/dist/client/signals-public-api-runtime.js +2 -0
  104. package/dist/client/signals-reactive-runtime.js +0 -1
  105. package/dist/client/signals-state-runtime.js +53 -20
  106. package/dist/composables/index.d.ts +2 -0
  107. package/dist/composables/index.js +1 -0
  108. package/dist/composables/use-cached-query.js +2 -1
  109. package/dist/craft-entry.js +2 -2
  110. package/dist/craft.js +2 -2
  111. package/dist/includes.js +10 -1
  112. package/dist/index.d.ts +2 -0
  113. package/dist/index.js +1 -0
  114. package/dist/native/runtime/craft-bridge.js +31 -9
  115. package/dist/native/runtime/craft.d.ts +3 -2
  116. package/dist/native/testing.d.ts +115 -0
  117. package/dist/native/testing.js +421 -0
  118. package/dist/offline/query-cache.d.ts +2 -0
  119. package/dist/offline/query-cache.js +43 -33
  120. package/dist/pwa.js +3 -3
  121. package/dist/reactivity.d.ts +36 -1
  122. package/dist/reactivity.js +33 -9
  123. package/dist/runtime-globals.js +2 -0
  124. package/dist/shared-request.d.ts +46 -0
  125. package/dist/shared-request.js +56 -0
  126. package/dist/signals-api.d.ts +32 -6
  127. package/dist/signals-api.js +42 -18
  128. package/dist/signals.js +2 -1
  129. package/dist/ssg.js +3 -3
  130. package/dist/stx-module.d.ts +2 -0
  131. package/package.json +9 -5
  132. package/stx-module.d.ts +2 -0
  133. package/stx.d.ts +54 -4
  134. package/dist/chunk-1m5pagp3.js +0 -2
  135. package/dist/chunk-27ja2rpd.js +0 -2
  136. package/dist/chunk-2b0p7am3.js +0 -2
  137. package/dist/chunk-3k6q1481.js +0 -2
  138. package/dist/chunk-42h0kvng.js +0 -2
  139. package/dist/chunk-4eff1v2p.js +0 -2
  140. package/dist/chunk-5n2v9g2c.js +0 -2
  141. package/dist/chunk-68ygpbta.js +0 -2
  142. package/dist/chunk-6gjfres0.js +0 -2
  143. package/dist/chunk-7debnvz9.js +0 -2
  144. package/dist/chunk-a77gbp9x.js +0 -2
  145. package/dist/chunk-bgbz0wzq.js +0 -2
  146. package/dist/chunk-bgr7fqhs.js +0 -2
  147. package/dist/chunk-bjfrwcfh.js +0 -2
  148. package/dist/chunk-c6jyp7ss.js +0 -3
  149. package/dist/chunk-cdt5pg28.js +0 -2
  150. package/dist/chunk-cfh798k7.js +0 -2
  151. package/dist/chunk-dax3zkmm.js +0 -2
  152. package/dist/chunk-dn676tdp.js +0 -2
  153. package/dist/chunk-dtbj816p.js +0 -2
  154. package/dist/chunk-e23cg45k.js +0 -2
  155. package/dist/chunk-ecwpsjpd.js +0 -2
  156. package/dist/chunk-h8vk3q9n.js +0 -2
  157. package/dist/chunk-hq8vxds5.js +0 -3
  158. package/dist/chunk-j8pamkbh.js +0 -2
  159. package/dist/chunk-mfm7ezh6.js +0 -2
  160. package/dist/chunk-mp16jxcg.js +0 -2
  161. package/dist/chunk-n1c9j5qv.js +0 -2
  162. package/dist/chunk-n61v7e3s.js +0 -2
  163. package/dist/chunk-nf63pk4s.js +0 -2
  164. package/dist/chunk-p5cry5s7.js +0 -2
  165. package/dist/chunk-r8qhex33.js +0 -2
  166. package/dist/chunk-rqvn1s52.js +0 -2
  167. package/dist/chunk-sjsant53.js +0 -2
  168. package/dist/chunk-snzh9z3g.js +0 -3
  169. package/dist/chunk-ty8g61y9.js +0 -2
  170. package/dist/chunk-v1k6w4z5.js +0 -2
  171. package/dist/chunk-vm7zv0gc.js +0 -2
  172. package/dist/chunk-vnxc48en.js +0 -2
  173. package/dist/chunk-y7vbwhh7.js +0 -2
  174. package/dist/chunk-yvyypd92.js +0 -2
  175. package/dist/chunk-zpm02e15.js +0 -2
package/README.md CHANGED
@@ -325,8 +325,11 @@ stx includes a built-in signals system for client-side reactivity. Define reacti
325
325
 
326
326
  - `state(initialValue)` — creates a reactive signal. Read with `signal()`, write with `signal.set(value)`
327
327
  - `derived(fn)` — creates a computed value that auto-tracks dependencies
328
+ - `memo(fn, equals?)` / `derived(fn, { equals })` — a computed value that reaches its readers only when it changes
328
329
  - `effect(fn)` — runs a side effect whenever its tracked signals change
330
+ - `watch(source, (next, prev) => …, { immediate?, deep?, flush? })` — calls back when a signal, getter or array of them changes
329
331
  - `batch(fn)` — batches multiple signal updates into a single re-render
332
+ - `sharedRequest()` — one request for every caller (`run`), a load after a change (`fresh`), only the newest answer (`latest`)
330
333
 
331
334
  #### Dynamic Class Binding (`:class`)
332
335
 
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ne,Yt,pd}from"./chunk-nskvepjv.js";import{W,Zt,fd,Qt,Wr,qr,Fn,gd,md,hd,en,tn,Gr,zn,yd}from"./chunk-agk478t4.js";import"./chunk-haeb904b.js";export{Wr as batch,pd as default,Zt as derived,Qt as effect,Ne as generateSignalsRuntime,Yt as generateSignalsRuntimeDev,tn as isDerived,en as isSignal,fd as memo,Fn as onDestroy,qr as onMount,zn as peek,hd as pendingLifecycleCounts,md as runDestroyCallbacks,gd as runMountCallbacks,W as state,Gr as untrack,yd as useOptimistic};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{K,ns,rs,ac,Ct,Jo,ss,Yo,jd,be,cn,we}from"./chunk-34fajf1n.js";import"./chunk-7j9m4d7x.js";import"./chunk-7hr63cp5.js";import{$i,s}from"./chunk-8efe5vpm.js";import"./chunk-550q827h.js";import"./chunk-1wkpxa58.js";import"./chunk-vde4mtfr.js";import"./chunk-x5xwe5nr.js";import"./chunk-tybk9hw9.js";import"./chunk-qfb34r6k.js";import"./chunk-4xvbc0mb.js";import"./chunk-haeb904b.js";import"./chunk-h72befy4.js";import"./chunk-1edvsndv.js";export{K as BROWSER_CORE_IMPORTS,ac as STX_AUTO_IMPORTS,ns as extractAndStripCssImports,be as extractBridgeData,$i as findInterpolationEnd,Yo as generateAutoImportDestructuring,jd as generateBrowserAutoImportDestructuring,cn as generateServerDataBridge,Ct as injectBrowserCoreAutoImports,we as processClientScript,ss as referencesName,rs as renderVendorStyleTags,s as stripCommentsAndLiterals,Jo as transformAutoImports};
@@ -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 Ks(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{Ks};
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 Xs(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{Xs};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{pn,Sc,gs}from"./chunk-34fajf1n.js";import"./chunk-7j9m4d7x.js";import"./chunk-7hr63cp5.js";import"./chunk-550q827h.js";import"./chunk-1wkpxa58.js";import"./chunk-vde4mtfr.js";import"./chunk-x5xwe5nr.js";import"./chunk-tybk9hw9.js";import{_e}from"./chunk-qfb34r6k.js";import"./chunk-4xvbc0mb.js";import"./chunk-haeb904b.js";import"./chunk-h72befy4.js";import"./chunk-1edvsndv.js";export{_e as freeIdentifiers,gs as processComponents,Sc as processESImports,pn as rendersAsElement};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{y}from"./chunk-hq8vxds5.js";import{X,We,ds,us,oi,ii,ai,ci,Yn,ps,li,di,ui,Rt,o}from"./chunk-g8dx2jew.js";import{Vr}from"./chunk-1n9bxdnh.js";import{a}from"./chunk-snzh9z3g.js";import{existsSync as M,readFileSync as K}from"fs";import h from"path";var me=new Set(["module","exports","require","$bool","$num","window","document","console","confirm","alert","fetch"]),te=Rt.filter((e)=>!me.has(e)).sort(),ne=[...y].sort(),he=[...new Set([...te,...ne])].sort(),be=new Set(te),ye=new Set(ne),xe=new Set(he),ee=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function Se(e,t){if(t==="server")return`'${e}' is not provided by 'stx' in a <script server> block. The engine binds only its own names there (defineProps, state, useHead, ...); any other name becomes \`await import('stx')\`, which does not resolve, so the whole script fails when the page renders. Import it from '@stacksjs/stx' instead.`;return`'${e}' is not provided by 'stx' in a client <script> block. The import is replaced by the window.stx runtime, which has no '${e}', so it is undefined in the browser.`}function ie(e,t){let s=[];for(let u of t){if(u.offset===void 0)continue;let i=u.kind==="server"?be:ye;ee.lastIndex=0;for(let l of u.code.matchAll(ee)){let g=l.index+l[0].indexOf("{")+1;for(let m of l[1].matchAll(/[^,]+/g)){let S=m[0];if(/^\s*type\s/.test(S))continue;let x=/^\s*([A-Za-z_$][\w$]*)/.exec(S);if(!x)continue;let r=x[1];if(!xe.has(r)||i.has(r))continue;let f=u.offset+g+m.index+x[0].length-r.length,p=e.slice(0,f),w=p.split(`
2
+ import{y}from"./chunk-haeb904b.js";import{K,We,ds,us,oi,ii,ai,ci,Yn,ps,li,di,ui,Rt,o}from"./chunk-34fajf1n.js";import{Vr}from"./chunk-bbdg3sqq.js";import{a}from"./chunk-hcsrj8z6.js";import{existsSync as M,readFileSync as G}from"fs";import h from"path";var me=new Set(["module","exports","require","$bool","$num","window","document","console","confirm","alert","fetch"]),te=Rt.filter((e)=>!me.has(e)).sort(),ne=[...y].sort(),he=[...new Set([...te,...ne])].sort(),be=new Set(te),ye=new Set(ne),xe=new Set(he),ee=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function Se(e,t){if(t==="server")return`'${e}' is not provided by 'stx' in a <script server> block. The engine binds only its own names there (defineProps, state, useHead, ...); any other name becomes \`await import('stx')\`, which does not resolve, so the whole script fails when the page renders. Import it from '@stacksjs/stx' instead.`;return`'${e}' is not provided by 'stx' in a client <script> block. The import is replaced by the window.stx runtime, which has no '${e}', so it is undefined in the browser.`}function ie(e,t){let s=[];for(let u of t){if(u.offset===void 0)continue;let i=u.kind==="server"?be:ye;ee.lastIndex=0;for(let l of u.code.matchAll(ee)){let g=l.index+l[0].indexOf("{")+1;for(let m of l[1].matchAll(/[^,]+/g)){let S=m[0];if(/^\s*type\s/.test(S))continue;let x=/^\s*([A-Za-z_$][\w$]*)/.exec(S);if(!x)continue;let r=x[1];if(!xe.has(r)||i.has(r))continue;let f=u.offset+g+m.index+x[0].length-r.length,p=e.slice(0,f),w=p.split(`
3
3
  `).length;s.push({line:w,column:f-(p.lastIndexOf(`
4
4
  `)+1)+1,offset:f,length:r.length,name:r,kind:u.kind,message:Se(r,u.kind)})}}}return s}import T from"path";var ke="@stacksjs/stx-typescript-plugin";function we(e,t){let s=T.resolve(e);for(;;){let u=T.join(s,"tsconfig.json");if(t(u))return u;let i=T.dirname(s);if(i===s)return;s=i}}function se(e,t,s){let u=we(e,s);if(!u)return;let i=new Set,l=(g)=>{if(i.has(g))return;i.add(g);let m=t(g);if(!m)return;let S=m.compilerOptions?.plugins;if(Array.isArray(S)){let r=S.find((p)=>p?.name===ke),f=Array.isArray(r?.libs)?r.libs.filter((p)=>typeof p==="string"):[];return r?{configPath:g,libs:f.map((p)=>T.resolve(T.dirname(g),p))}:null}let x=typeof m.extends==="string"?[m.extends]:Array.isArray(m.extends)?m.extends:[];for(let r of[...x].reverse()){if(typeof r!=="string"||!r.startsWith("."))continue;let f=T.resolve(T.dirname(g),r.endsWith(".json")?r:`${r}.json`),p=l(f);if(p!==void 0)return p}return};return l(u)??void 0}function la(e,t="",s=""){let u=e.startLine>1?`
5
5
  `.repeat(e.startLine-1):"",i=ps(e)+us(ds(e.code)),l=e.kind==="client"||e.kind==="plain"?ai(t,e.code):"";return Yn(`${u+i}
@@ -8,8 +8,8 @@ export {}
8
8
  `,s)}var $e=new Set(["name","status","length","location","history","origin","closed","close","open","focus","blur","print","scroll","scrollTo","scrollBy","stop","top","parent","self","frames","event","external","menubar","toolbar"]);function ve(e){if(e.length===0)return"";let t=["// Generated \u2014 the composables the runtime publishes as bare globals."],s=new Set(y),u=[];for(let{file:i,names:l}of e){let g=JSON.stringify(i.replace(/\\/g,"/").replace(/\.ts$/,""));u.push(` export * from ${g}`);for(let m of l){if(s.has(m)||$e.has(m))continue;s.add(m),t.push(`declare const ${m}: typeof import(${g})[${JSON.stringify(m)}]`)}}return t.push("declare module '@composables' {",...u,"}"),t.join(`
9
9
  `)}function fo(e,t,s){return`${e}.__stx_${t}${s}.ts`}function ul(e){return e.replace(/\.__stx_(?:server|client|plain|template)\d+\.ts$/,"")}function da(){return re("stx.d.ts")}function ua(){return re("stx-module.d.ts")}function re(e){for(let t of[h.resolve(import.meta.dir,"..",e),h.resolve(import.meta.dir,"..","..",e)])if(M(t))return t;return null}var Te=/^(.*?)\((\d+),(\d+)\):\s+(error|warning)\s+TS(\d+):\s+(.*)$/;function De(e){return e>=1000&&e<2000}function oe(e){let t="",s=!1,u=!1;for(let i=0;i<e.length;i++){let l=e[i];if(s){if(t+=l,u)u=!1;else if(l==="\\")u=!0;else if(l==='"')s=!1;continue}if(l==='"'){s=!0,t+=l;continue}if(l==="/"&&e[i+1]==="/"){while(i<e.length&&e[i]!==`
10
10
  `)i++;t+=`
11
- `;continue}if(l==="/"&&e[i+1]==="*"){i+=2;while(i<e.length&&!(e[i]==="*"&&e[i+1]==="/"))i++;i++;continue}t+=l}return t.replace(/,(\s*[}\]])/g,"$1")}function Ee(e){try{return JSON.parse(oe(K(e,"utf8")))}catch{return}}function Oe(e){let t=h.resolve(e),s;for(;;){let r=h.join(t,"tsconfig.json");if(M(r)){s=r;break}let f=h.dirname(t);if(f===t)break;t=f}if(!s)return{};let u=new Set,i=s,l,g,m=s;while(i&&!u.has(i)){u.add(i);let r;try{r=JSON.parse(oe(K(i,"utf8")))}catch{break}let f=r?.compilerOptions??{};if(!l&&f.paths&&typeof f.paths==="object")l=f.paths,m=i;if(!g&&typeof f.baseUrl==="string")g=h.resolve(h.dirname(i),f.baseUrl);if(l&&g)break;i=typeof r?.extends==="string"?h.resolve(h.dirname(i),r.extends.endsWith(".json")?r.extends:`${r.extends}.json`):void 0}if(!l)return{};let S=g??h.dirname(m),x={};for(let[r,f]of Object.entries(l)){if(!Array.isArray(f))continue;x[r]=f.map((p)=>typeof p==="string"&&!h.isAbsolute(p)?h.resolve(S,p):p)}return{paths:x}}async function pl(e,t={}){let s=t.client!==!1,u=t.server!==!1,i=t.templates!==!1,l=t.componentsDir??(i?(await o()).componentsDir:void 0),g=new Map,m=new Map,S=[],x=[],r=0,f=0,p=da();for(let n of e){let c=await Bun.file(n).text(),b=We(c).filter((d)=>{if(d.kind==="server")return u;return s}),k=We(c).filter((d)=>d.kind==="server").map((d)=>d.code).join(`
12
- `);for(let d of ie(c,b))S.push({file:n,line:d.line,column:d.column,code:0,message:d.message,category:"error",blockKind:d.kind});if(s&&k){let d=b.filter((O)=>O.kind!=="server"),E=[...new Set(d.flatMap((O)=>ci(k,O.code)))];if(E.length>0)m.set(n,{names:E,line:d[0].startLine,kind:d[0].kind})}let D=h.dirname(h.resolve(n)),v=i?li(c,{runtimeGlobals:!p,originDir:D,filePath:h.resolve(n),componentsDir:l}):null,R=v?[...v.lineMap.values()].filter((d)=>d.expression).length:0;if(b.length===0&&R===0)continue;if(x.push(n),r+=b.length,f+=R,b.forEach((d,E)=>{g.set(fo(n,d.kind,E),{source:la(d,k,D),origin:n,kind:d.kind})}),v&&R>0)g.set(fo(n,"template",0),{source:v.text,origin:n,kind:"template",virtual:v})}if(g.size===0)return{diagnostics:S,checkedFiles:x,blockCount:0,expressionCount:0};let w=(t.extraLibs??[]).map((n)=>h.resolve(n)),ce=se(e.length>0?h.dirname(h.resolve(e[0])):process.cwd(),Ee,M);for(let n of ce?.libs??[])if(!w.includes(n)&&M(n))w.push(n);if(p)w.push(p);let G=p?ua():null;if(G)w.push(G);let F=`${a()}/typecheck/__stx_globals.d.ts`,ae=["// Generated \u2014 the context serve.ts injects into <script server> blocks.",oi(p?ii(K(p,"utf8")):void 0),...p?[]:["declare const window: any",...y.map((n)=>`declare const ${n}: any`)],["// Generated \u2014 the names stx auto-imports from @stacksjs/browser.",...X.map((n)=>`declare const ${n}: any`)].join(`
11
+ `;continue}if(l==="/"&&e[i+1]==="*"){i+=2;while(i<e.length&&!(e[i]==="*"&&e[i+1]==="/"))i++;i++;continue}t+=l}return t.replace(/,(\s*[}\]])/g,"$1")}function Ee(e){try{return JSON.parse(oe(G(e,"utf8")))}catch{return}}function Oe(e){let t=h.resolve(e),s;for(;;){let r=h.join(t,"tsconfig.json");if(M(r)){s=r;break}let f=h.dirname(t);if(f===t)break;t=f}if(!s)return{};let u=new Set,i=s,l,g,m=s;while(i&&!u.has(i)){u.add(i);let r;try{r=JSON.parse(oe(G(i,"utf8")))}catch{break}let f=r?.compilerOptions??{};if(!l&&f.paths&&typeof f.paths==="object")l=f.paths,m=i;if(!g&&typeof f.baseUrl==="string")g=h.resolve(h.dirname(i),f.baseUrl);if(l&&g)break;i=typeof r?.extends==="string"?h.resolve(h.dirname(i),r.extends.endsWith(".json")?r.extends:`${r.extends}.json`):void 0}if(!l)return{};let S=g??h.dirname(m),x={};for(let[r,f]of Object.entries(l)){if(!Array.isArray(f))continue;x[r]=f.map((p)=>typeof p==="string"&&!h.isAbsolute(p)?h.resolve(S,p):p)}return{paths:x}}async function pl(e,t={}){let s=t.client!==!1,u=t.server!==!1,i=t.templates!==!1,l=t.componentsDir??(i?(await o()).componentsDir:void 0),g=new Map,m=new Map,S=[],x=[],r=0,f=0,p=da();for(let n of e){let c=await Bun.file(n).text(),b=We(c).filter((d)=>{if(d.kind==="server")return u;return s}),k=We(c).filter((d)=>d.kind==="server").map((d)=>d.code).join(`
12
+ `);for(let d of ie(c,b))S.push({file:n,line:d.line,column:d.column,code:0,message:d.message,category:"error",blockKind:d.kind});if(s&&k){let d=b.filter((O)=>O.kind!=="server"),E=[...new Set(d.flatMap((O)=>ci(k,O.code)))];if(E.length>0)m.set(n,{names:E,line:d[0].startLine,kind:d[0].kind})}let D=h.dirname(h.resolve(n)),v=i?li(c,{runtimeGlobals:!p,originDir:D,filePath:h.resolve(n),componentsDir:l}):null,R=v?[...v.lineMap.values()].filter((d)=>d.expression).length:0;if(b.length===0&&R===0)continue;if(x.push(n),r+=b.length,f+=R,b.forEach((d,E)=>{g.set(fo(n,d.kind,E),{source:la(d,k,D),origin:n,kind:d.kind})}),v&&R>0)g.set(fo(n,"template",0),{source:v.text,origin:n,kind:"template",virtual:v})}if(g.size===0)return{diagnostics:S,checkedFiles:x,blockCount:0,expressionCount:0};let w=(t.extraLibs??[]).map((n)=>h.resolve(n)),ce=se(e.length>0?h.dirname(h.resolve(e[0])):process.cwd(),Ee,M);for(let n of ce?.libs??[])if(!w.includes(n)&&M(n))w.push(n);if(p)w.push(p);let X=p?ua():null;if(X)w.push(X);let F=`${a()}/typecheck/__stx_globals.d.ts`,ae=["// Generated \u2014 the context serve.ts injects into <script server> blocks.",oi(p?ii(G(p,"utf8")):void 0),...p?[]:["declare const window: any",...y.map((n)=>`declare const ${n}: any`)],["// Generated \u2014 the names stx auto-imports from @stacksjs/browser.",...K.map((n)=>`declare const ${n}: any`)].join(`
13
13
  `),ve(await Vr())].filter(Boolean).join(`
14
14
  `),_=`${a()}/typecheck`;await Bun.$`rm -rf ${_}`.quiet().nothrow(),await Bun.$`mkdir -p ${_}`.quiet().nothrow(),await Bun.write(F,ae);let N=new Map,le=0;for(let[n,c]of g){let b=`${le++}_${n.replace(/[^\w.-]+/g,"_")}`;await Bun.write(`${_}/${b}`,c.source),N.set(b,c)}let ue={target:"ESNext",module:"ESNext",moduleResolution:"bundler",strict:!0,noEmit:!0,skipLibCheck:!0,allowJs:!0,esModuleInterop:!0,resolveJsonModule:!0,lib:["ESNext","DOM","DOM.Iterable"],types:[],...Oe(e.length>0?h.dirname(h.resolve(e[0])):process.cwd()),...t.compilerOptions??{}},V=async(n,c)=>{let b=`${_}/tsconfig${c===1?"":`.${c}`}.json`;await Bun.write(b,JSON.stringify({compilerOptions:ue,files:n.map((D)=>`${_}/${D}`).concat(F,...w)},null,2));let k=Bun.spawnSync(["bun","x","tsc","-p",b,"--pretty","false"],{stdout:"pipe",stderr:"pipe"});return{output:new TextDecoder().decode(k.stdout)+new TextDecoder().decode(k.stderr),exitCode:k.exitCode??0}},J=await V([...N.keys()],1),U=J.output,I=[],W=J.exitCode,z=0,pe=new Set(w.map((n)=>n.split("/").pop())),q=0,B=new Set,H=(n)=>{for(let c of n.replace(/\n[\t ]+([^\n]*)/g," $1").split(`
15
15
  `)){let b=c.match(Te);if(!b)continue;if(z++,pe.has(b[1].split("/").pop()))q++;let[,k,D,v,R,d,E]=b,O=k.split("/").pop(),C=N.get(O);if(!C)continue;if(De(Number(d)))B.add(O);let A=Number(D),L=Number(v),Y;if(C.virtual){let P=ui(C.virtual,A,L);if(!P?.expression)continue;if(di(P,Number(d)))continue;A=P.line,L=P.column,Y=P.expression.code.trim()}I.push({file:C.origin,line:A,column:L,code:Number(d),message:E,category:R==="error"?"error":"warning",blockKind:C.kind,expression:Y})}};H(U);let de=z,fe=q;if(B.size>0&&B.size<N.size){let n=[...N.keys()].filter((c)=>!B.has(c));H((await V(n,2)).output)}if(s)for(let[n,c]of m){if(c.names.length===0)continue;I.push({file:n,line:c.line,column:1,code:0,message:`${c.names.length===1?"1 value reaches":`${c.names.length} values reach`} this block on the implicit bridge and ${c.names.length===1?"is":"are"} untyped: ${c.names.join(", ")}. Declare them with defineClientPayload({ ${c.names.join(", ")} }) in the server block to have them checked.`,category:"warning",blockKind:c.kind})}I.push(...S);let Z=new Set,j=I.filter((n)=>{let c=`${n.file}:${n.line}:${n.column}:${n.code}:${n.message}`;if(Z.has(c))return!1;return Z.add(c),!0});j.sort((n,c)=>n.file.localeCompare(c.file)||n.line-c.line||n.column-c.column);let Q=fe>0&&j.length===0,ge=Q||W!==0&&de===0?`${Q?"a file passed with --lib has errors of its own, so nothing in your code was checked":`tsc exited ${W} without reporting any diagnostic, so nothing was checked`}. `+"A syntax error in an ambient declaration file does this \u2014 skipLibCheck suppresses "+`SEMANTIC diagnostics only. tsc said:
@@ -1,7 +1,7 @@
1
1
  // @bun
2
- import{Pt,C}from"./chunk-vde4mtfr.js";import m from"fs";import e from"path";async function mn(r,o,i){if(r.__stx_runtime_config)return;let n=Pt();if(n||i){r.__stx_runtime_config=n??C(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-sjsant53.js"),c=await f(t);if(c.runtimeConfig)r.__stx_runtime_config=C(c.runtimeConfig);return}let s=e.dirname(t);if(s===t)return;t=s}}async function Ps(r,o){function i(n){if(n===null)return"null";if(Array.isArray(n))return`Array<${n.length?[...new Set(n.map(i))].join(" | "):"unknown"}>`;if(typeof n==="object")return`{ ${Object.entries(n).map(([t,s])=>`readonly ${JSON.stringify(t)}: ${i(s)}`).join("; ")} }`;return typeof n}await Bun.write(e.join(r,".stx/runtime-config.d.ts"),`import '@stacksjs/stx/runtime-config'
2
+ import{Pt,C}from"./chunk-vde4mtfr.js";import m from"fs";import e from"path";async function hn(r,o,i){if(r.__stx_runtime_config)return;let n=Pt();if(n||i){r.__stx_runtime_config=n??C(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-aa52jhak.js"),c=await f(t);if(c.runtimeConfig)r.__stx_runtime_config=C(c.runtimeConfig);return}let s=e.dirname(t);if(s===t)return;t=s}}async function Ps(r,o){function i(n){if(n===null)return"null";if(Array.isArray(n))return`Array<${n.length?[...new Set(n.map(i))].join(" | "):"unknown"}>`;if(typeof n==="object")return`{ ${Object.entries(n).map(([t,s])=>`readonly ${JSON.stringify(t)}: ${i(s)}`).join("; ")} }`;return typeof n}await Bun.write(e.join(r,".stx/runtime-config.d.ts"),`import '@stacksjs/stx/runtime-config'
3
3
  declare module '@stacksjs/stx/runtime-config' { interface PublicRuntimeConfig ${i(o.public??{})} }
4
4
  `),await Bun.write(e.join(r,".stx/runtime-config-server.d.ts"),`import '@stacksjs/stx/runtime-config-server'
5
5
  declare module '@stacksjs/stx/runtime-config-server' { interface PrivateRuntimeConfig ${i(o.private??{})} }
6
6
  `)}
7
- export{mn,Ps};
7
+ export{hn,Ps};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{$o,za,Kt,zl,Ha,Ua,Va,Hl}from"./chunk-kcq2ed1d.js";export{Kt as Validator,za as defineForm,Ha as processErrorDirective,Ua as processErrorsDirective,Hl as processFormValidationDirectives,Va as processHasErrorsDirective,$o as useForm,zl as v};
2
+ import{$o,za,Xt,zl,Ha,Ua,Va,Hl}from"./chunk-3gqrv02t.js";export{Xt as Validator,za as defineForm,Ha as processErrorDirective,Ua as processErrorsDirective,Hl as processFormValidationDirectives,Va as processHasErrorsDirective,$o as useForm,zl as v};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{p,c}from"./chunk-yf90vn5t.js";import{b}from"./chunk-g8dx2jew.js";function y(t,o){let i=1,r=o,e="<template",n="</template";while(r<t.length&&i>0){let s=t.indexOf("<",r);if(s===-1)break;if(r=s,t.startsWith(e,r)&&(r+e.length>=t.length||/[\s>\/]/.test(t[r+e.length]))){i++,r+=e.length;continue}if(t.startsWith(n,r)){let a=t.indexOf(">",r+n.length);if(a!==-1){if(i--,i===0)return a+1;r=a+1;continue}}r++}return i===0?r:-1}var w=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function x(t,o){let i=null;for(let r=o;r<t.length;r++){let e=t[r];if(i){if(e==="\\"){r++;continue}if(e===i)i=null;continue}if(e==='"'||e==="'"){i=e;continue}if(e===">")return r+1}return-1}function N(t,o,i){let r=o.toLowerCase(),e=1,n=i;while(n<t.length){let s=t.indexOf("<",n);if(s===-1)return-1;if(t.startsWith("<!--",s)){let g=t.indexOf("-->",s+4);n=g===-1?t.length:g+3;continue}let a=x(t,s+1);if(a===-1)return-1;let f=t.slice(s,a),u=f.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(u&&u[2].toLowerCase()===r){if(u[1]==="/"){if(e--,e===0)return a}else if(!/\/\s*>$/.test(f))e++}n=a}return-1}function A(t){let o=[],i=[],r=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=x(t,n+1);if(s===-1)break;let a=t.slice(n,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){e=s;continue}let u=f[2].toLowerCase();if(f[1]==="/"){let l=i.lastIndexOf(u);if(l!==-1)i.splice(l);e=s;continue}let g=/\/\s*>$/.test(a),d=i.length===0?a.match(r):null;if(d){let l=d[1]||d[2],m=a.replace(r,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),h=g||w.has(u)?-1:N(t,u,s);if(h===-1)o.push({start:n,end:s,slotName:l,element:m}),e=s;else o.push({start:n,end:h,slotName:l,element:m+t.slice(s,h)}),e=h;continue}if(!g&&!w.has(u)){if(i.push(u),u==="script"||u==="style"){let l=t.toLowerCase().indexOf(`</${u}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function O(t){let o=[],i=[],r=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=x(t,n+1);if(s===-1)break;let a=t.slice(n,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){e=s;continue}let u=f[1]==="/",g=f[2].toLowerCase();if(u){let l=i.lastIndexOf(g);if(l!==-1)i.splice(l);e=s;continue}if(g==="template"&&i.length===0){let l=a.match(r);if(l){let m=y(t,s);if(m!==-1){let h=l[1]||l[2]||l[3];o.push({start:n,end:m,slotName:h,content:t.slice(s,m-11).trim(),propsBinding:l[4]||void 0}),e=m;continue}}}if(!/\/\s*>$/.test(a)&&!w.has(g)){if(i.push(g),g==="script"||g==="style"){let l=t.toLowerCase().indexOf(`</${g}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function ha(t){let o={default:"",named:new Map},i=t,r=O(t);for(let n of r)o.named.set(n.slotName,{name:n.slotName,content:n.content,propsBinding:n.propsBinding});r.sort((n,s)=>s.start-n.start);for(let n of r)i=i.slice(0,n.start)+i.slice(n.end);let e=A(i);for(let n of e){let s=o.named.get(n.slotName);if(s)s.content+=n.element;else o.named.set(n.slotName,{name:n.slotName,content:n.element})}for(let n=e.length-1;n>=0;n--){let s=e[n];i=i.slice(0,s.start)+i.slice(s.end)}return o.default=i.trim(),o}function Rl(t){let o=t.match(/name\s*=\s*["']([^"']+)["']/),i=o?o[1]:"",r={},e=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,n;while((n=e.exec(t))!==null)r[n[1]]=n[2];let s=t.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),a=s?s[1].trim():"";return{name:i,props:r,defaultContent:a}}async function ya(t,o,i,r){if(!t)return i;let e=t.content;if(t.propsBinding&&Object.keys(o).length>0){let n=t.propsBinding.trim(),s={...r};if(n.startsWith("{")&&n.endsWith("}")){let a=n.slice(1,-1).split(",").map((f)=>f.trim()).filter(Boolean);for(let f of a){let[u,g]=f.split(":").map((l)=>l.trim()),d=g||u;if(o[u]!==void 0)s[d]=o[u]}}else s[n]=o;e=C(e,s)}return e}function C(t,o){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(i,r)=>{try{let e=r.trim(),n=k(e,o);return b(String(n??""))}catch{return`{{ ${r} }}`}})}function k(t,o){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(t)){let r=t.split("."),e=o;for(let n of r)if(e&&typeof e==="object"&&n in e)e=e[n];else return;return e}let i=t.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(i){let[,r,e,n]=i,s=o[r],a=parseInt(n,10);if(typeof s==="number")switch(e){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":return s/a}}try{if(!p(t))return;return c(t,Object.keys(o))(...Object.values(o))}catch{return}}async function ba(t,o,i){let r=t;r=await M(r,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(s,a,f,u)=>{let g=o.named.get(a),d=u?.trim()||"",l=f||"",m={},h=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,S;while((S=h.exec(l))!==null){let E=S[1],R=S[2];m[E]=k(R,i)}return await ya(g,m,d,i)});let n=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return r=r.replace(n,(s,a,f)=>{if(/\bname\s*=/.test(a||""))return s;let u=f?.trim()||"";return o.default||u}),r}async function M(t,o,i){let r=[],e=[];t.replace(o,(a,...f)=>{let u=f[f.length-2];return e.push({match:a,index:u}),r.push(i(a,...f.slice(0,-2))),a});let n=await Promise.all(r),s=t;for(let a=e.length-1;a>=0;a--){let{match:f,index:u}=e[a];s=s.slice(0,u)+n[a]+s.slice(u+f.length)}return s}function Al(t){let o=ha(t);return{defaultSlot:o.default,namedSlots:o.named}}async function Pl(t,o,i,r){return await ba(t,{default:o,named:i},r)}
2
+ import{p,c}from"./chunk-qfb34r6k.js";import{b}from"./chunk-34fajf1n.js";function y(t,o){let i=1,r=o,e="<template",n="</template";while(r<t.length&&i>0){let s=t.indexOf("<",r);if(s===-1)break;if(r=s,t.startsWith(e,r)&&(r+e.length>=t.length||/[\s>\/]/.test(t[r+e.length]))){i++,r+=e.length;continue}if(t.startsWith(n,r)){let a=t.indexOf(">",r+n.length);if(a!==-1){if(i--,i===0)return a+1;r=a+1;continue}}r++}return i===0?r:-1}var w=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function x(t,o){let i=null;for(let r=o;r<t.length;r++){let e=t[r];if(i){if(e==="\\"){r++;continue}if(e===i)i=null;continue}if(e==='"'||e==="'"){i=e;continue}if(e===">")return r+1}return-1}function N(t,o,i){let r=o.toLowerCase(),e=1,n=i;while(n<t.length){let s=t.indexOf("<",n);if(s===-1)return-1;if(t.startsWith("<!--",s)){let g=t.indexOf("-->",s+4);n=g===-1?t.length:g+3;continue}let a=x(t,s+1);if(a===-1)return-1;let f=t.slice(s,a),u=f.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(u&&u[2].toLowerCase()===r){if(u[1]==="/"){if(e--,e===0)return a}else if(!/\/\s*>$/.test(f))e++}n=a}return-1}function A(t){let o=[],i=[],r=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=x(t,n+1);if(s===-1)break;let a=t.slice(n,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){e=s;continue}let u=f[2].toLowerCase();if(f[1]==="/"){let l=i.lastIndexOf(u);if(l!==-1)i.splice(l);e=s;continue}let g=/\/\s*>$/.test(a),d=i.length===0?a.match(r):null;if(d){let l=d[1]||d[2],m=a.replace(r,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),h=g||w.has(u)?-1:N(t,u,s);if(h===-1)o.push({start:n,end:s,slotName:l,element:m}),e=s;else o.push({start:n,end:h,slotName:l,element:m+t.slice(s,h)}),e=h;continue}if(!g&&!w.has(u)){if(i.push(u),u==="script"||u==="style"){let l=t.toLowerCase().indexOf(`</${u}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function O(t){let o=[],i=[],r=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=x(t,n+1);if(s===-1)break;let a=t.slice(n,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){e=s;continue}let u=f[1]==="/",g=f[2].toLowerCase();if(u){let l=i.lastIndexOf(g);if(l!==-1)i.splice(l);e=s;continue}if(g==="template"&&i.length===0){let l=a.match(r);if(l){let m=y(t,s);if(m!==-1){let h=l[1]||l[2]||l[3];o.push({start:n,end:m,slotName:h,content:t.slice(s,m-11).trim(),propsBinding:l[4]||void 0}),e=m;continue}}}if(!/\/\s*>$/.test(a)&&!w.has(g)){if(i.push(g),g==="script"||g==="style"){let l=t.toLowerCase().indexOf(`</${g}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function ha(t){let o={default:"",named:new Map},i=t,r=O(t);for(let n of r)o.named.set(n.slotName,{name:n.slotName,content:n.content,propsBinding:n.propsBinding});r.sort((n,s)=>s.start-n.start);for(let n of r)i=i.slice(0,n.start)+i.slice(n.end);let e=A(i);for(let n of e){let s=o.named.get(n.slotName);if(s)s.content+=n.element;else o.named.set(n.slotName,{name:n.slotName,content:n.element})}for(let n=e.length-1;n>=0;n--){let s=e[n];i=i.slice(0,s.start)+i.slice(s.end)}return o.default=i.trim(),o}function Rl(t){let o=t.match(/name\s*=\s*["']([^"']+)["']/),i=o?o[1]:"",r={},e=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,n;while((n=e.exec(t))!==null)r[n[1]]=n[2];let s=t.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),a=s?s[1].trim():"";return{name:i,props:r,defaultContent:a}}async function ya(t,o,i,r){if(!t)return i;let e=t.content;if(t.propsBinding&&Object.keys(o).length>0){let n=t.propsBinding.trim(),s={...r};if(n.startsWith("{")&&n.endsWith("}")){let a=n.slice(1,-1).split(",").map((f)=>f.trim()).filter(Boolean);for(let f of a){let[u,g]=f.split(":").map((l)=>l.trim()),d=g||u;if(o[u]!==void 0)s[d]=o[u]}}else s[n]=o;e=C(e,s)}return e}function C(t,o){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(i,r)=>{try{let e=r.trim(),n=k(e,o);return b(String(n??""))}catch{return`{{ ${r} }}`}})}function k(t,o){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(t)){let r=t.split("."),e=o;for(let n of r)if(e&&typeof e==="object"&&n in e)e=e[n];else return;return e}let i=t.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(i){let[,r,e,n]=i,s=o[r],a=parseInt(n,10);if(typeof s==="number")switch(e){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":return s/a}}try{if(!p(t))return;return c(t,Object.keys(o))(...Object.values(o))}catch{return}}async function ba(t,o,i){let r=t;r=await M(r,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(s,a,f,u)=>{let g=o.named.get(a),d=u?.trim()||"",l=f||"",m={},h=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,S;while((S=h.exec(l))!==null){let E=S[1],R=S[2];m[E]=k(R,i)}return await ya(g,m,d,i)});let n=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return r=r.replace(n,(s,a,f)=>{if(/\bname\s*=/.test(a||""))return s;let u=f?.trim()||"";return o.default||u}),r}async function M(t,o,i){let r=[],e=[];t.replace(o,(a,...f)=>{let u=f[f.length-2];return e.push({match:a,index:u}),r.push(i(a,...f.slice(0,-2))),a});let n=await Promise.all(r),s=t;for(let a=e.length-1;a>=0;a--){let{match:f,index:u}=e[a];s=s.slice(0,u)+n[a]+s.slice(u+f.length)}return s}function Al(t){let o=ha(t);return{defaultSlot:o.default,namedSlots:o.named}}async function Pl(t,o,i,r){return await ba(t,{default:o,named:i},r)}
3
3
  export{ha,Rl,ya,ba,Al,Pl};