@stacksjs/stx 0.2.242 → 0.2.244

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 (56) hide show
  1. package/dist/browser-core-imports.js +1 -0
  2. package/dist/{chunk-ysq64g2a.js → chunk-02btxy6j.js} +1 -1
  3. package/dist/{chunk-kd3hbecq.js → chunk-0hatcb1t.js} +1 -1
  4. package/dist/{chunk-bhx39765.js → chunk-0zdy4dpp.js} +8 -8
  5. package/dist/{chunk-bjb61amk.js → chunk-15w5gfwe.js} +1 -1
  6. package/dist/{chunk-kvqkkwnd.js → chunk-1gaetkpx.js} +1 -1
  7. package/dist/{chunk-z5ecweqg.js → chunk-1md5q98r.js} +1 -1
  8. package/dist/{chunk-jvs7azc8.js → chunk-2d13x7hs.js} +1 -1
  9. package/dist/{chunk-4heeeaef.js → chunk-2nqtzhgw.js} +1 -1
  10. package/dist/{chunk-t2sbh2xx.js → chunk-47be2t3d.js} +1 -1
  11. package/dist/{chunk-rxvmgb8d.js → chunk-4j8crbk6.js} +1 -1
  12. package/dist/{chunk-vgmc978e.js → chunk-4mnmm48x.js} +1 -1
  13. package/dist/{chunk-5dh58a34.js → chunk-56rabpsq.js} +1 -1
  14. package/dist/chunk-595kj4n2.js +22 -0
  15. package/dist/{chunk-k8y3m0kn.js → chunk-5a6dzmj8.js} +1 -1
  16. package/dist/{chunk-15bk9bn4.js → chunk-6rfc8exk.js} +1 -1
  17. package/dist/{chunk-fnhvrp9g.js → chunk-6z1re4a4.js} +1 -1
  18. package/dist/{chunk-we0kk7cq.js → chunk-7qyz242h.js} +2 -2
  19. package/dist/{chunk-eb7875fm.js → chunk-8vgcye5c.js} +1 -1
  20. package/dist/{chunk-wzyfsdr7.js → chunk-8yn96bkr.js} +1 -1
  21. package/dist/{chunk-19erfat4.js → chunk-9k5symz8.js} +1 -1
  22. package/dist/{chunk-x1az3202.js → chunk-b6zt4aqb.js} +1 -1
  23. package/dist/{chunk-ytxz3xcs.js → chunk-d35mdkw8.js} +1 -1
  24. package/dist/{chunk-2s7s4pmw.js → chunk-djct09qx.js} +1 -1
  25. package/dist/{chunk-bc250je5.js → chunk-e03bh9ze.js} +1 -1
  26. package/dist/{chunk-y8p9jhb6.js → chunk-f13qa3kb.js} +1 -1
  27. package/dist/{chunk-58x4e8m5.js → chunk-fad3d1g7.js} +1 -1
  28. package/dist/{chunk-at4yzmym.js → chunk-fbhhzy5j.js} +1 -1
  29. package/dist/{chunk-4k15x8g6.js → chunk-gcf0z2j8.js} +1 -1
  30. package/dist/{chunk-9pkxerqa.js → chunk-hess6q86.js} +1 -1
  31. package/dist/{chunk-dq48z0r7.js → chunk-jqkg6w3p.js} +1 -1
  32. package/dist/{chunk-a0sagjwy.js → chunk-jwchwn52.js} +20 -17
  33. package/dist/{chunk-1aekxpev.js → chunk-kf8edvxc.js} +1 -1
  34. package/dist/{chunk-gept2ha2.js → chunk-m2w91jne.js} +1 -1
  35. package/dist/{chunk-qqt7b18y.js → chunk-przv5z6z.js} +1 -1
  36. package/dist/{chunk-azrhea8j.js → chunk-pxzj5tzb.js} +1 -1
  37. package/dist/{chunk-v5fmahvj.js → chunk-qaj72jrj.js} +1 -1
  38. package/dist/{chunk-ggghr7tk.js → chunk-qbc0adqw.js} +2 -2
  39. package/dist/{chunk-7q6abr68.js → chunk-qtmearwp.js} +1 -1
  40. package/dist/{chunk-mqgjwfvw.js → chunk-rg1g3xjx.js} +1 -1
  41. package/dist/{chunk-atbpj3dh.js → chunk-s0b1p8tc.js} +1 -1
  42. package/dist/{chunk-q9bbt522.js → chunk-vcreetnm.js} +1 -1
  43. package/dist/{chunk-dk45sjgn.js → chunk-wjahpknc.js} +1 -1
  44. package/dist/{chunk-0vfb2q94.js → chunk-z4f3gahw.js} +1 -1
  45. package/dist/cli.js +7 -7
  46. package/dist/composables.d.ts +11 -1
  47. package/dist/composables.js +10 -0
  48. package/dist/craft-entry.js +1 -1
  49. package/dist/craft.js +1 -1
  50. package/dist/pwa.js +1 -1
  51. package/dist/ssg.js +2 -2
  52. package/dist/stx-virtual-ts.js +11 -7
  53. package/dist/stx.d.ts +39 -7
  54. package/package.json +5 -5
  55. package/stx.d.ts +39 -7
  56. package/dist/chunk-87kz1190.js +0 -22
package/stx.d.ts CHANGED
@@ -78,12 +78,25 @@ declare function isDerived(_value: unknown): value is StxDerivedSignal<unknown>
78
78
  // Lifecycle
79
79
  // ============================================================================
80
80
 
81
- declare function onMount(_fn: () => void | StxCleanup): void
82
- declare function onDestroy(_fn: () => void): void
83
- declare function onBeforeMount(_fn: () => void): void
84
- declare function onMounted(_fn: () => void | StxCleanup): void
85
- declare function onBeforeUnmount(_fn: () => void): void
86
- declare function onUnmounted(_fn: () => void): void
81
+ /**
82
+ * A lifecycle hook may be `async`.
83
+ *
84
+ * `onMount(async () => { rows.set(await load()) })` is the documented way to
85
+ * fetch a component's initial data - it is the second JSDoc example on both
86
+ * `onMount` implementations - and the runtime has always awaited nothing and
87
+ * simply let the promise run. These declarations left the promise out of the
88
+ * return union, so every async `onMount` in a real app was a type error
89
+ * against a call that works.
90
+ *
91
+ * Only a synchronous return can be a cleanup function: the runtime registers
92
+ * it before the next hook runs. So a promise resolves to `void`.
93
+ */
94
+ declare function onMount(_fn: () => void | StxCleanup | Promise<void>): void
95
+ declare function onDestroy(_fn: () => void | Promise<void>): void
96
+ declare function onBeforeMount(_fn: () => void | Promise<void>): void
97
+ declare function onMounted(_fn: () => void | StxCleanup | Promise<void>): void
98
+ declare function onBeforeUnmount(_fn: () => void | Promise<void>): void
99
+ declare function onUnmounted(_fn: () => void | Promise<void>): void
87
100
  // onBeforeUpdate / onUpdated / onErrorCaptured are NOT declared: they exist in
88
101
  // reactivity.ts and composition-api.ts but have no client-runtime counterpart,
89
102
  // so declaring them promised a global that resolved to undefined (#1804).
@@ -608,7 +621,26 @@ declare function watchMultiple(
608
621
 
609
622
  declare function defineProps<T extends Record<string, any> = Record<string, any>>(_definitions?: any): T
610
623
  declare function withDefaults<T extends Record<string, any>>(_props: T, _defaults: Partial<T>): T
611
- declare function defineEmits<T extends string = string>(): (_event: T, _payload?: unknown) => void
624
+ /**
625
+ * Two forms, matching the runtime.
626
+ *
627
+ * The union form names the events and leaves the payload open. The map form
628
+ * gives each event a payload tuple, so `emit('view')` with a missing record
629
+ * and `emit('view', record, extra)` with a spare one are both errors.
630
+ *
631
+ * This used to be the union form alone, with a single optional `_payload`.
632
+ * That made the documented map form - the one `props.ts` and the composition
633
+ * API both implement, and the one the dashboard tables are written in - a
634
+ * constraint violation, and made a third argument an arity error even though
635
+ * the runtime forwards every argument it is given.
636
+ *
637
+ * @example
638
+ * const emit = defineEmits<'change' | 'close'>()
639
+ * @example
640
+ * const emit = defineEmits<{ view: [record: Row], remove: [id: number] }>()
641
+ */
642
+ declare function defineEmits<T extends string = string>(): (_event: T, ..._args: unknown[]) => void
643
+ declare function defineEmits<T extends Record<string, unknown[]>>(): <K extends keyof T & string>(_event: K, ..._args: T[K]) => void
612
644
  declare function defineExpose<T extends Record<string, any>>(_exposed: T): void
613
645
  declare function defineSlots<T extends Record<string, (..._args: any[]) => any> = Record<string, (..._args: any[]) => any>>(): T
614
646
  declare function provide<T>(_key: string | symbol, _value: T): void
@@ -1,22 +0,0 @@
1
- // @bun
2
- import{Pl as C}from"./chunk-a0sagjwy.js";import{Js as Y}from"./chunk-mv2v3g62.js";import{Dt as D}from"./chunk-ax56kn66.js";import u from"path";var g=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function h(K){let J=(Z)=>Z.replace(/[^\n]/g," ");return K.replace(/<!--[\s\S]*?-->/g,J).replace(/\{\{--[\s\S]*?--\}\}/g,J)}function p(K){let J=[],Z=h(K);g.lastIndex=0;let $;while(($=g.exec(Z))!==null){let j=($[1]||"").trim(),F=($[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,z=($[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,W=$.index+F,Q=$.index+$[0].length-z,U=K.slice(W,Q);if(/\bsrc\s*=/.test(j))continue;let q=j.match(/\btype\s*=\s*["']([^"']+)["']/i);if(q&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(q[1]))continue;let X=/\bserver\b/.test(j)?"server":/\bclient\b/.test(j)?"client":"plain",G=B(K,W);J.push({kind:X,code:U,startLine:G,attrs:j})}return J}function B(K,J){let Z=1;for(let $=0;$<J&&$<K.length;$++)if(K.charCodeAt($)===10)Z++;return Z}function N(K,J){let Z=K.lastIndexOf(`
3
- `,J-1)+1;return J-Z+1}function P(K){let J=K.split(""),Z=(j,F)=>{for(let z=j;z<F&&z<J.length;z++)if(J[z]!==`
4
- `)J[z]=" "},$=[/<script(?:\s[^>]*)?>[\s\S]*?<\/script>/gi,/<style(?:\s[^>]*)?>[\s\S]*?<\/style>/gi,/<!--[\s\S]*?-->/g,/\{\{--[\s\S]*?--\}\}/g,/@verbatim\b[\s\S]*?@endverbatim\b/g];for(let j of $){j.lastIndex=0;let F;while((F=j.exec(K))!==null)Z(F.index,F.index+F[0].length)}return J.join("")}function m(K){let J=0,Z="";for(let $=0;$<K.length;$++){let j=K[$];if(Z){if(j==="\\"){$++;continue}if(j===Z)Z="";continue}if(j==='"'||j==="'"||j==="`"){Z=j;continue}if(j==="("||j==="["||j==="{"){J++;continue}if(j===")"||j==="]"||j==="}"){J--;continue}if(j==="|"&&J===0){if(K[$+1]==="|"){$++;continue}if(K[$-1]==="|")continue;return K.slice(0,$)}}return K}var R=new Set([":for","x-for","v-for"]),w=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,O="__stx_interpolated",S="__StxElement",f="__StxTemplateValue",l=`type ${f}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function L(K){return K.replace(/\{\{[\s\S]*?\}\}/g,O).replace(/\{!![\s\S]*?!!\}/g,O)}function Vj(K){return K.replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/g,(J)=>{let Z=J.split(`
5
- `).length-1,$=J.length-Z;return`0${" ".repeat(Math.max(0,$-1))}${`
6
- `.repeat(Z)}`})}var d=["foreach","endforeach","forelse","endforelse","for","endfor","while","endwhile","empty","if","elseif","else","endif","unless","endunless","isset","endisset","switch","case","default","endswitch","auth","endauth","guest","endguest","env","endenv","once","endonce","break","continue"],i=new RegExp(String.raw`^[ \t]*@(?:${d.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function Yj(K){return K.replace(i,(J)=>J.replace(/[^\n]/g," "))}var I=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function c(K){let J=P(K),Z=[],$=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,j;while((j=$.exec(J))!==null){if(j[1]||j[3])continue;let z=j[2]??j[4]??"",W=j[2]!==void 0?2:3,Q=m(z);if(!Q.trim())continue;let U=j.index+W+(Q.length-Q.trimStart().length);Z.push({code:Q.trim(),line:B(J,U),column:N(J,U),offset:U,kind:"interpolation"})}w.lastIndex=0;while((j=w.exec(J))!==null){let F=j[1],z=j[3]??"",W=F.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(I.has(W)||I.has(F))continue;if(!z.trim())continue;let Q=j.index+j[0].indexOf(j[2],j[0].indexOf(F)+F.length)+1;if(R.has(W)){let q=z.match(/\s+(?:in|of)\s+/);if(!q||q.index===void 0)continue;let X=z.slice(q.index+q[0].length),G=q.index+q[0].length+(X.length-X.trimStart().length);Z.push({code:L(X.trim()),line:B(J,Q+G),column:N(J,Q+G),offset:Q+G,kind:"directive",attribute:W});continue}let U=z.length-z.trimStart().length;Z.push({code:L(z.trim()),line:B(J,Q+U),column:N(J,Q+U),offset:Q+U,kind:"directive",attribute:W})}return Z.sort((F,z)=>F.line-z.line||F.column-z.column),Z}var o=2000;function r(K,J){let Z=0,$=Math.min(K.length,J+o);for(let j=J;j<$;j++){let F=K[j];if(F==="(")Z++;else if(F===")"){if(Z--,Z===0)return K.slice(J+1,j)}}return null}function n(K){let J=new Map,Z=(W,Q)=>{let U=W.split(/[,[\]{}()\s]+/).filter(Boolean);for(let q of U){let X=q.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(X))continue;let G=U.length===1?Q:void 0,H=J.get(X);if(!H)J.set(X,{name:X,iterable:G});else if(H.iterable!==G)H.iterable=void 0}},$=/^\$?[A-Z_$][\w$]*$/i,j=(W)=>{let Q=W.trim();return $.test(Q)?Q:void 0};for(let W of K.matchAll(/@for(?:each|else)\s*\(/g)){let Q=r(K,W.index+W[0].length-1);if(Q===null)continue;let U=Q.match(/^([\s\S]*?)\bas\b([\s\S]*)$/);if(!U)continue;Z(U[2].replace(/=>/g," "),j(U[1]))}for(let W of K.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)/g))Z(W[1]);let F=P(K);w.lastIndex=0;let z;while((z=w.exec(F))!==null){let W=z[1].replace(/\..*$/,"");if(!R.has(W))continue;let Q=z[3].match(/\s+(?:in|of)\s+/);if(!Q||Q.index===void 0)continue;Z(z[3].slice(0,Q.index),j(z[3].slice(Q.index+Q[0].length)))}for(let W of K.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let Q of W[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))Z(Q[1]);return[...J.values()].sort((W,Q)=>W.name.localeCompare(Q.name))}function V(K){let J=new Set;for(let Z of K.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))J.add(Z[1]);for(let Z of K.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))J.add(Z[1]);for(let Z of K.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))J.add(Z[1]);for(let Z of K.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let $ of Z[1].split(",")){let j=$.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(j))J.add(j)}return[...J].sort()}function a(){return["declare var window: any",...D.map((K)=>`declare var ${K}: any`)].join(`
7
- `)}var s=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"];function t(){return s.map((K)=>`declare var ${K}: any`).join(`
8
- `)}function T(K){let J=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,Z,$=!1,j=new Set,F=Y(K);while((Z=J.exec(F))!==null){$=!0;for(let z of e(Z[1])){let W=z.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(W))j.add(W)}}return $?[...j]:null}function e(K){let J=[],Z=0,$="";for(let j of K){if(j===","&&Z===0){J.push($),$="";continue}if(j==="("||j==="["||j==="{")Z++;else if(j===")"||j==="]"||j==="}")Z--;$+=j}return J.push($),J.filter((j)=>j.trim().length>0)}function jj(K){let J=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,Z=[],$=K.replace(J,(j)=>{return Z.push(j.trim()),j.split(`
9
- `).map(()=>"").join(`
10
- `)});return{imports:Z.join(`
11
- `),body:$}}function x(K){let J=Y(K),Z=Array(J.length),$=0;for(let W=0;W<J.length;W++){let Q=J[W];if(Q==="}"||Q===")"||Q==="]")$=Math.max(0,$-1);if(Z[W]=$,Q==="{"||Q==="("||Q==="[")$++}let j=[],F=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,z;while((z=F.exec(J))!==null){if(Z[z.index]!==0)continue;let W=z[1],Q=z[2],U;if(W==="interface"){let q=J.indexOf("{",z.index);if(q===-1)continue;let X=0;U=-1;for(let G=q;G<J.length;G++)if(J[G]==="{")X++;else if(J[G]==="}"&&--X===0){U=G+1;break}if(U===-1)continue}else{let q=0;U=J.length;for(let X=J.indexOf("=",z.index)+1;X<J.length;X++){let G=J[X];if(G==="{"||G==="["||G==="("||G==="<")q++;else if(G==="}"||G==="]"||G===")"||G===">")q--;else if(q<=0&&(G===";"||G===`
12
- `&&!/[=|&,<([{]\s*$/.test(J.slice(Math.max(0,X-40),X)))){U=G===";"?X+1:X;break}}}j.push({name:Q,text:K.slice(z.index,U).replace(/^[ \t]*export[ \t]+/,"")}),F.lastIndex=U}return j}function Jj(K){return new Set(x(K).map((J)=>J.name))}function Bj(K,J=""){let Z=T(K),$=Jj(J),j=x(K).filter((U)=>!$.has(U.name)).map((U)=>U.text);if(!Z){let U=V(K);if(U.length===0&&j.length===0)return"";return["",`// ${Qj}`,...j,...U.map((q)=>`declare var ${q}: any`)].join(`
13
- `)}if(Z.length===0)return j.length>0?["",`// ${k}`,...j].join(`
14
- `):"";let{imports:F,body:z}=jj(K),W=z.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),Q=["",`// ${k}`];if(F)Q.push(F);return Q.push(...j),Q.push(`async function ${A}() {`,W,` return { ${Z.join(", ")} }`,"}",`type ${_} = Awaited<ReturnType<typeof ${A}>>`,...Z.map((U)=>`declare var ${U}: ${_}[${JSON.stringify(U)}]`)),Q.join(`
15
- `)}function Kj(K){let Z=Y(K).split(""),$=0;for(let j=0;j<Z.length;j++){let F=Z[j];if(F==="{"||F==="("||F==="["){$++;continue}if(F==="}"||F===")"||F==="]"){$=Math.max(0,$-1);continue}if($>0&&F!==`
16
- `)Z[j]=" "}return V(Z.join(""))}function wj(K,J){if(T(K)!==null)return[];let Z=Y(J),$=new Set(D);return Kj(K).filter((j)=>{if($.has(j))return!1;if(V(J).includes(j))return!1;return new RegExp(`(?<![.#\\w$])${j}(?![\\w$])`).test(Z)})}var k="stx: types for the declared client payload (#1868)",Qj="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",A="__stxServerScope",_="__StxClientPayload";var Zj=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","props","slot"];var $j=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function zj(K,J){let Z=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,$=[],j;while((j=Z.exec(K))!==null){if(j.index>=J)break;let F=j[1];if(F==="endif"||F==="endunless"){$.pop();continue}let z="";if(j[2]==="("){let W=0,Q=j.index+j[0].length-1,U=Q+1;for(;Q<K.length;Q++){let q=K[Q];if(q==="(")W++;else if(q===")"){if(W--,W===0)break}}z=K.slice(U,Q).trim(),Z.lastIndex=Q+1}if(F==="if")$.push({conditions:[z]});else if(F==="unless")$.push({conditions:[`!(${z})`]});else if(F==="elseif"||F==="else"){let W=$[$.length-1];if(!W)continue;let Q=W.conditions.map((U)=>`!(${U})`);W.conditions=F==="elseif"?[...Q,z]:Q}}return $.flatMap((F)=>F.conditions).filter(Boolean)}function Wj(K){let J=K.code.trim();if(!J)return null;if(K.attribute?.startsWith("@")){if($j.test(J))return null;let $=";(($event: any): void => { ";return{text:`${$}${J} });`,prefixLength:$.length}}let Z=";void ((";return{text:`${Z}${J}));`,prefixLength:Z.length}}var Fj=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function Uj(K,J){if(!J)return K;return K.replace(Fj,(Z,$,j,F)=>{let z=u.resolve(J,F).replace(/\\/g,"/");return`${$}${j}${z}${j}`})}function Mj(K,J={}){let Z=p(K),$=K.split(`
17
- `),j=Array.from({length:$.length},()=>""),F=new Map;for(let W of Z)Uj(W.code,J.originDir??"").split(`
18
- `).forEach((U,q)=>{let X=W.startLine-1+q;if(X<j.length)j[X]=U});let z=(W,Q)=>{if(j.push(W),Q)F.set(j.length,Q)};if(J.globals!==!1){if(z(""),J.runtimeGlobals!==!1)for(let Q of a().split(`
19
- `))z(Q);for(let Q of t().split(`
20
- `))z(Q);for(let Q of C)z(`declare var ${Q}: any`);for(let Q of Zj)z(`declare var ${Q}: any`);z(`declare var ${O}: any`);let W=new Set(Z.flatMap((Q)=>V(Q.code)));z(`type ${S}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let Q of n(K)){if(W.has(Q.name))continue;let U=Q.iterable&&W.has(Q.iterable)?`${S}<typeof ${Q.iterable}>`:"any";z(`declare var ${Q.name}: ${U}`)}}if(J.templateExpressions!==!1){let W=c(K).map((Q)=>({expression:Q,statement:Wj(Q)})).filter((Q)=>Q.statement!==null);if(W.length>0){let Q=P(K),q=[...new Set(Z.flatMap((G)=>V(G.code)))].filter((G)=>/^[A-Z_$][\w$]*$/i.test(G)),X=0;if(q.length>0){z(l);for(let G of q)z(`type __StxT_${G} = ${f}<typeof ${G}>`);z(`;((${q.map((G)=>`${G}: __StxT_${G}`).join(", ")}) => {`),X=1}for(let{expression:G,statement:H}of W){let v=" ".repeat(X),M=G.offset===void 0?[]:zj(Q,G.offset),y=M.length>0?`${M.map((b)=>`if (${b}) `).join("")}{ `:"",E=M.length>0?" }":"";z(v+y+H.text+E,{line:G.line,column:G.column,expression:G,prefixLength:H.prefixLength+v.length+y.length})}if(X>0)z("});")}}return z("export {}"),{text:j.join(`
21
- `),lineMap:F,sourceLineCount:$.length}}function Nj(K,J,Z){let $=K.lineMap.get(J);if(!$)return J<=K.sourceLineCount?{line:J,column:Z}:null;let j=Math.max(0,Z-1-($.prefixLength??0));return{line:$.line,column:$.column+j,expression:$.expression}}
22
- export{p as Mf,Vj as Nf,Yj as Of,c as Pf,V as Qf,t as Rf,Bj as Sf,wj as Tf,Uj as Uf,Mj as Vf,Nj as Wf};