@aihu/compiler 1.3.5 → 1.3.8

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.
package/README.md CHANGED
@@ -18,6 +18,36 @@ import { migrateTemplateGrammar } from '@aihu/compiler/codemods/template-grammar
18
18
 
19
19
  <!-- END_HANDWRITTEN: prose -->
20
20
 
21
+ ### CSS providers
22
+
23
+ CSS integration is opt-in. The default plugin behavior continues to discover
24
+ `@aihu/css-engine` when it is installed. A project that uses another CSS
25
+ engine can provide its own complete stylesheet producer without importing the
26
+ legacy engine:
27
+
28
+ ```ts
29
+ import { aihuCompilerPlugin, type AihuCssProvider } from '@aihu/compiler'
30
+
31
+ const cssProvider: AihuCssProvider = ({ source, id, shadowMode, target, lightScopeId }) => {
32
+ return myCssEngine.compileAihu({ source, id, shadowMode, target, lightScopeId })
33
+ }
34
+
35
+ export default {
36
+ plugins: [aihuCompilerPlugin({ cssProvider })],
37
+ }
38
+ ```
39
+
40
+ The provider receives the source and file id plus the compiler's resolved
41
+ `shadowMode` (`'light'` or `'shadow'`), build `target`, and optional light-DOM
42
+ scope id. A non-empty result is authoritative: it must be the complete
43
+ stylesheet for that SFC, including utility rules, tokens, and authored
44
+ `@style` rules that should ship. The compiler replaces the component's shadow
45
+ stylesheet with it, or sends it through the Vite CSS pipeline for light DOM.
46
+ Return an empty string, `null`, or `undefined` to emit no provider stylesheet.
47
+
48
+ The explicit provider replaces automatic css-engine resolution for that plugin
49
+ instance, so alternate CSS engines remain independent and opt-in.
50
+
21
51
  ## Install
22
52
 
23
53
  <!-- BEGIN_AUTOGEN: install -->
@@ -29,7 +59,7 @@ npm install @aihu/compiler
29
59
  bun add @aihu/compiler
30
60
  ```
31
61
 
32
- <sub><i>Auto-generated against `@aihu/compiler@1.3.5`.</i></sub>
62
+ <sub><i>Auto-generated against `@aihu/compiler@1.3.6`.</i></sub>
33
63
 
34
64
  <!-- END_AUTOGEN: install -->
35
65
 
@@ -40,12 +70,12 @@ bun add @aihu/compiler
40
70
 
41
71
  | | |
42
72
  |---|---|
43
- | **Version** | `1.3.5` |
73
+ | **Version** | `1.3.6` |
44
74
  | **Tier** | D — Compiler — Single-File Component (.aihu) → Web Component |
45
75
  | **Published files** | 4 entries |
46
76
  | **License** | MIT |
47
77
 
48
- <sub><i>Auto-generated against `@aihu/compiler@1.3.5`.</i></sub>
78
+ <sub><i>Auto-generated against `@aihu/compiler@1.3.6`.</i></sub>
49
79
 
50
80
  <!-- END_AUTOGEN: stats -->
51
81
 
@@ -61,7 +91,7 @@ bun add @aihu/compiler
61
91
  | `./codemods/state-wrapper` | `./dist/codemods/state-wrapper.js` | `—` |
62
92
  | `./codemods/template-grammar-v2` | `./dist/codemods/template-grammar-v2.js` | `—` |
63
93
 
64
- <sub><i>Auto-generated against `@aihu/compiler@1.3.5`.</i></sub>
94
+ <sub><i>Auto-generated against `@aihu/compiler@1.3.6`.</i></sub>
65
95
 
66
96
  <!-- END_AUTOGEN: exports -->
67
97
 
@@ -88,7 +118,7 @@ bun add @aihu/compiler
88
118
  - `@aihu/compiler-native-linux-arm64-gnu` — `1.3.4`
89
119
  - `@aihu/compiler-native-win32-x64-msvc` — `1.3.4`
90
120
 
91
- <sub><i>Auto-generated against `@aihu/compiler@1.3.5`.</i></sub>
121
+ <sub><i>Auto-generated against `@aihu/compiler@1.3.6`.</i></sub>
92
122
 
93
123
  <!-- END_AUTOGEN: deps -->
94
124
 
@@ -102,7 +132,7 @@ bun add @aihu/compiler
102
132
  - [Macro Vocabulary spec](../../docs/superpowers/specs/2026-05-02-spec-macro-vocabulary.md)
103
133
  - [Aihu framework root](../../README.md)
104
134
 
105
- <sub><i>Auto-generated against `@aihu/compiler@1.3.5`.</i></sub>
135
+ <sub><i>Auto-generated against `@aihu/compiler@1.3.6`.</i></sub>
106
136
 
107
137
  <!-- END_AUTOGEN: see-also -->
108
138
 
@@ -113,6 +143,6 @@ bun add @aihu/compiler
113
143
 
114
144
  MIT — see [LICENSE](../../LICENSE).
115
145
 
116
- <sub><i>Auto-generated against `@aihu/compiler@1.3.5`.</i></sub>
146
+ <sub><i>Auto-generated against `@aihu/compiler@1.3.6`.</i></sub>
117
147
 
118
148
  <!-- END_AUTOGEN: license -->
package/dist/index.d.ts CHANGED
@@ -178,6 +178,21 @@ interface VitePlugin {
178
178
  * Options for `aihuCompilerPlugin()` (Plan 3.3 — Islands).
179
179
  */
180
180
  interface AihuCompilerPluginOptions {
181
+ /**
182
+ * Optional CSS provider for the compiled SFC.
183
+ *
184
+ * When supplied, the provider is the sole source of generated component
185
+ * CSS. Its non-empty result must be the COMPLETE stylesheet for the SFC:
186
+ * include utility rules, design tokens, and any authored `@style` rules
187
+ * that should ship with the component. The compiler replaces its existing
188
+ * stylesheet body with this result (or routes it through the document CSS
189
+ * pipeline for `shadowMode: 'light'`). Returning an empty string, `null`,
190
+ * or `undefined` means that this SFC has no provider stylesheet.
191
+ *
192
+ * Without this option, the compiler preserves the legacy automatic,
193
+ * optional `@aihu/css-engine` integration.
194
+ */
195
+ cssProvider?: AihuCssProvider;
181
196
  /**
182
197
  * When `true` (default), components the compiler classified as `'static'`
183
198
  * (read from the `// @aihu:island` marker via `_parseIslandMarker()`) are
@@ -209,6 +224,13 @@ interface AihuCompilerPluginOptions {
209
224
  * `'shadow'`.
210
225
  */
211
226
  shadowMode?: 'light' | 'shadow';
227
+ /**
228
+ * Project-level inputs forwarded to the automatic `@aihu/css-engine`
229
+ * integration for every SFC (requires a css-engine release that accepts
230
+ * `compileSfc`'s fourth argument; older releases ignore it). Ignored when
231
+ * `cssProvider` is set, since the provider owns the whole stylesheet.
232
+ */
233
+ css?: AihuCssEngineOptions;
212
234
  /**
213
235
  * Build target threaded to the compiler binary (`--target`). Defaults to the
214
236
  * compiler's `universal` target (current behaviour). Set to `'client'` for a
@@ -232,6 +254,30 @@ interface AihuCompilerPluginOptions {
232
254
  */
233
255
  layoutsDir?: string;
234
256
  }
257
+ /**
258
+ * Context passed to an explicit CSS provider for each compiled SFC.
259
+ *
260
+ * `shadowMode` and `target` are resolved compiler values, including their
261
+ * runtime defaults. A provider can therefore choose a light-DOM stylesheet
262
+ * strategy or emit target-specific CSS without parsing compiler markers.
263
+ */
264
+ interface AihuCssProviderContext {
265
+ source: string;
266
+ id: string;
267
+ shadowMode: 'light' | 'shadow';
268
+ target: 'client' | 'server' | 'universal';
269
+ lightScopeId?: string;
270
+ }
271
+ /**
272
+ * Explicit CSS provider contract for `aihuCompilerPlugin`.
273
+ *
274
+ * A non-empty return value is authoritative and must be a complete stylesheet
275
+ * for the SFC, including any authored styles the provider wants to preserve.
276
+ * It may be synchronous or asynchronous. Empty/absent results skip CSS
277
+ * folding for that SFC. The provider is an opt-in replacement for the
278
+ * automatic `@aihu/css-engine` fallback, not an additional stylesheet layer.
279
+ */
280
+ type AihuCssProvider = (context: AihuCssProviderContext) => string | null | undefined | Promise<string | null | undefined>;
235
281
  /**
236
282
  * Inject `shadowMode: '...'` (and, for light mode, `lightScopeId: '...'` in
237
283
  * the SAME options object) into the third argument of the emitted
@@ -615,7 +661,7 @@ declare function transform(source: string, id: string, options?: {
615
661
  /**
616
662
  * Fold css-engine utility CSS into the SERVER target's `__aihu_css__` export.
617
663
  *
618
- * The shadow-DOM sibling of `_foldCssEngineStyles`. That one rewrites the
664
+ * The shadow-DOM sibling of `_foldCssStyles`. That one rewrites the
619
665
  * client's `__style__.replaceSync(...)`; the server target has no `__style__`
620
666
  * (`CSSStyleSheet` is a DOM dependency and the Rust codegen elides it), it has
621
667
  * `export const __aihu_css__` — the string `__aihu_schild` inlines as `<style>`
@@ -631,15 +677,15 @@ declare function transform(source: string, id: string, options?: {
631
677
  * never wired to it.)
632
678
  *
633
679
  * REPLACES rather than appends, for the same reason shape 1 above does: the
634
- * css-engine output already contains the authored `@style` rules, so appending
680
+ * Provider output already contains the authored `@style` rules, so appending
635
681
  * would duplicate them.
636
682
  *
637
683
  * Light-DOM components never reach this — their utilities go through the global
638
- * cascade via `_foldCssEngineStylesGlobal`, and their prerendered markup is
684
+ * cascade via `_foldCssStylesGlobal`, and their prerendered markup is
639
685
  * covered by the app stylesheet's `@scope([data-a=…])` blocks.
640
686
  */
641
687
  declare function _foldSsrCssExport(compiledCode: string, css: string): string;
642
- declare function _foldCssEngineStyles(compiledCode: string, css: string): string;
688
+ declare function _foldCssStyles(compiledCode: string, css: string): string;
643
689
  /**
644
690
  * Virtual-module prefix used by the `shadowMode === 'light'` branch to route
645
691
  * per-SFC utility CSS through Vite's built-in CSS pipeline. The plugin
@@ -698,10 +744,14 @@ declare function _lightScopeId(id: string): string;
698
744
  *
699
745
  * @internal
700
746
  */
701
- declare function _foldCssEngineStylesGlobal(compiledCode: string, css: string, id: string): {
747
+ declare function _foldCssStylesGlobal(compiledCode: string, css: string, id: string): {
702
748
  code: string;
703
749
  virtualId: string;
704
750
  } | null;
751
+ /** @deprecated Use `_foldCssStyles`; retained for internal consumers during the seam rollout. */
752
+ declare const _foldCssEngineStyles: typeof _foldCssStyles;
753
+ /** @deprecated Use `_foldCssStylesGlobal`; retained for internal consumers during the seam rollout. */
754
+ declare const _foldCssEngineStylesGlobal: typeof _foldCssStylesGlobal;
705
755
  /** Top-level AST export — one per .aihu SFC. */
706
756
  interface SfcAst {
707
757
  /** Resolved custom-element tag name (meta.name → route.name → file stem). */
@@ -896,7 +946,26 @@ declare function compileRouteMeta(source: string, id?: string): RouteMeta | null
896
946
  * @internal
897
947
  */
898
948
  declare function _injectAutoWiring(code: string): string;
949
+ /**
950
+ * Project-level `@aihu/css-engine` inputs (`aihuCompilerPlugin({ css })`).
951
+ * Mirrors css-engine's `CompileSfcOptions`, declared locally for the same
952
+ * no-type-import reason as {@link CssEngineModule}.
953
+ */
954
+ interface AihuCssEngineOptions {
955
+ /**
956
+ * Project theme as CSS text: `@theme { … }` blocks or a bare
957
+ * `--name: value;` list. Replaces the engine's built-in default token
958
+ * values, which still compile to `var()` fallbacks, so a theme inherited
959
+ * from the document wins.
960
+ */
961
+ theme?: string;
962
+ /**
963
+ * `false` compiles token references to bare `var(--name)` with no default
964
+ * fallback, for apps that always supply tokens at `:root`. Default `true`.
965
+ */
966
+ hostTokens?: boolean;
967
+ }
899
968
  declare function aihuCompilerPlugin(options?: AihuCompilerPluginOptions): VitePlugin;
900
969
  //#endregion
901
- export { AihuCompilerPluginOptions, type CompileEnvelope, type CompileEnvelopeOptions, RouteMeta, SfcAst, SfcAttr, SfcMacroValue, SfcMeta, SfcNode, SfcStyleBlock, StripTypesResult, VIRTUAL_UTILITY_PREFIX, ViteStripApi, _MEMO_MAX_ENTRIES, _buildDeferredHydration, _buildStaticIsland, _clearTransformMemo, _compileViaBackend, _deriveChildTags, _errMessage, _foldCssEngineStyles, _foldCssEngineStylesGlobal, _foldSsrCssExport, _formatExtractCensus, _getCompilerNativeStateKind, _globalizeAuthoredStyle, _hashIdForUtilityCss, _injectAutoWiring, _injectLightScopeId, _injectShadowMode, _isLayoutFile, _isViteMissing, _layoutTag, _lightScopeId, _parseComponentTagsMarker, _parseExtractMarker, _parseIslandMarker, _passivizeOutlet, _resetCompileBackend, _resetCompilerNative, _resolveCompileBackend, _stripFailure, _stripTypes, _transformMemoStats, aihuCompilerPlugin, compileRouteMeta, compileSidecar, compileToAst, kebabComponentTag, loadCompilerNative, resolveCompilerBinary, transform };
970
+ export { AihuCompilerPluginOptions, AihuCssEngineOptions, AihuCssProvider, AihuCssProviderContext, type CompileEnvelope, type CompileEnvelopeOptions, RouteMeta, SfcAst, SfcAttr, SfcMacroValue, SfcMeta, SfcNode, SfcStyleBlock, StripTypesResult, VIRTUAL_UTILITY_PREFIX, ViteStripApi, _MEMO_MAX_ENTRIES, _buildDeferredHydration, _buildStaticIsland, _clearTransformMemo, _compileViaBackend, _deriveChildTags, _errMessage, _foldCssEngineStyles, _foldCssEngineStylesGlobal, _foldCssStyles, _foldCssStylesGlobal, _foldSsrCssExport, _formatExtractCensus, _getCompilerNativeStateKind, _globalizeAuthoredStyle, _hashIdForUtilityCss, _injectAutoWiring, _injectLightScopeId, _injectShadowMode, _isLayoutFile, _isViteMissing, _layoutTag, _lightScopeId, _parseComponentTagsMarker, _parseExtractMarker, _parseIslandMarker, _passivizeOutlet, _resetCompileBackend, _resetCompilerNative, _resolveCompileBackend, _stripFailure, _stripTypes, _transformMemoStats, aihuCompilerPlugin, compileRouteMeta, compileSidecar, compileToAst, kebabComponentTag, loadCompilerNative, resolveCompilerBinary, transform };
902
971
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../js/native.ts","../js/envelope.ts","../js/transform-memo.ts","../js/index.ts"],"mappings":";;;;;;AAiCA;AAAoC;AAAA;AAAA;AAClC;AAAgB;AAAgB;AAOhC;AAAe;AAAA;AAiEjB;AAAgC;AAAA;AAAA;AAAA;AAEhC;AAA+B;AAAA;AAGlB;AAEC;AAaqB;AAAK;UA7FvB,mBAAA;EACf,eAAA,CAAgB,MAAA,UAAgB,WAAA;EA6E5B;AAAO;AACP;AACA;AAAQ;AAUR;EAlFJ,eAAA;AAAA;AA0IgC;AAAA;AAAuB;AAAA;AA0GzD;AAA2C;AAAA;AAAuB;AAAA;AAKlE;AAAoC;AAAA;AAAA;AAAA;;AA/GF,KAzEtB,oBAAA;AAAA,KAEA,mBAAA;EAEN,IAAA;EACA,KAAA,EAAO,mBAAA;EACP,SAAA;EACA,MAAA,EAAQ,oBAAA;EC5DZ;AACA;AAAS;AAAiB;AAAa;AACvC;AACA;AACA;AAAW;EDkEP,cAAA;AAAA;EAEA,IAAA;AAAA;EACA,IAAA;EAAqB,KAAA,GAAQ,KAAA;AAAA;AC3DvB;AAGZ;AAA0B;AAAA;AAHd,iBDgHI,kBAAA,CAAA,GAAsB,mBAAmB;AC3GnD;AAAA,iBDqNU,2BAAA,CAAA,GAA+B,mBAAmB;ACpN1C;AAAA,iBDyNR,oBAAA,CAAA;;;AA/GkB;AAAA,UC/HjB,eAAA;EACf,QAAA;EACA,OAAA,EAAS,MAAM;IAAW,E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B,IAAY;;;;;;UA0J7B,oBAAA;;;;;;;EAOf,KAAA;;;;;EAKA,UAAU;AAAA;AAAA,iBA2II,kBAAA,CAAmB,OAAA,GAAU,yBAAA,GAA4B,UAAU"}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import{resolveCompilerBinary as e}from"./resolve-binary.js";import{execFileSync as t}from"node:child_process";import{createRequire as n}from"node:module";import{basename as r,dirname as i,join as a,resolve as o}from"node:path";import{fileURLToPath as s,pathToFileURL as c}from"node:url";import{existsSync as l,readFileSync as u,statSync as d}from"node:fs";import{createHash as f}from"node:crypto";const p=i(s(import.meta.url));function m(){if(typeof process>`u`||!process.platform||!process.arch)return null;switch(`${process.platform}-${process.arch}`){case`darwin-arm64`:return{platformId:`darwin-arm64`,packageName:`@aihu/compiler-native-darwin-arm64`,nodeFile:`aihu-compiler-native.darwin-arm64.node`};case`darwin-x64`:return{platformId:`darwin-x64`,packageName:`@aihu/compiler-native-darwin-x64`,nodeFile:`aihu-compiler-native.darwin-x64.node`};case`linux-x64`:return{platformId:`linux-x64-gnu`,packageName:`@aihu/compiler-native-linux-x64-gnu`,nodeFile:`aihu-compiler-native.linux-x64-gnu.node`};case`linux-arm64`:return{platformId:`linux-arm64-gnu`,packageName:`@aihu/compiler-native-linux-arm64-gnu`,nodeFile:`aihu-compiler-native.linux-arm64-gnu.node`};case`win32-x64`:return{platformId:`win32-x64-msvc`,packageName:`@aihu/compiler-native-win32-x64-msvc`,nodeFile:`aihu-compiler-native.win32-x64-msvc.node`};default:return null}}let h=null,g=!1;function _(e){try{let t=a(i(e),`package.json`);if(!l(t))return null;let n=JSON.parse(u(t,`utf8`));return typeof n.name!=`string`||!n.name.startsWith(`@aihu/compiler-native-`)?null:typeof n.version==`string`?n.version:null}catch{return null}}function v(){return m()}function y(e){return typeof e==`object`&&!!e&&typeof e.compileEnvelope==`function`}function b(){if(h!==null)return h;if(typeof process<`u`&&process.env?.AIHU_COMPILER_NATIVE===`0`)return h={kind:`disabled`},h;let e=n(import.meta.url),t=process.env?.AIHU_COMPILER_NATIVE_ADDON;if(t){let n;try{n=e(t)}catch(e){throw Error(`[@aihu/compiler] AIHU_COMPILER_NATIVE_ADDON is set to '${t}', which failed to load: ${e.message}`)}if(!y(n))throw Error(`[@aihu/compiler] AIHU_COMPILER_NATIVE_ADDON module at '${t}' does not export compileEnvelope()`);return h={kind:`loaded`,addon:n,addonPath:t,origin:`override`,packageVersion:_(t)},h}let r=m();if(r===null)return h={kind:`unavailable`},h;let i=null;try{i=e.resolve(r.packageName)}catch{}let a=[o(p,`../src-native/aihu-compiler-native.node`),o(p,`../src-native/target/release/aihu-compiler-native.node`)],s=i?[i]:a.filter(e=>l(e)),c=i?`package`:`dev-build`;for(let t of s)try{let n=e(t);if(y(n))return h={kind:`loaded`,addon:n,addonPath:t,origin:c,packageVersion:_(t)},h;throw Error(`module at ${t} does not export compileEnvelope()`)}catch(e){return g||(g=!0,console.warn(`[@aihu/compiler] native addon found but failed to load; falling back to the aihu-compile spawn path (identical output, slower).
2
- Candidate: ${t}\n Error: ${e.message}\n Reinstall @aihu/compiler (or rebuild: cargo build --release --manifest-path packages/compiler/src-native/Cargo.toml), or set AIHU_COMPILER_NATIVE=0 to silence this warning.`)),h={kind:`unavailable`,error:e},h}return h={kind:`unavailable`},h}function x(){return b().kind}function S(){h=null,g=!1}const C=67108864;function w(e=0){let t=Math.ceil(e/1024)*2,n=process.env.AIHU_COMPILE_TIMEOUT_MS;if(n!==void 0&&n!==``){let e=Number(n);if(Number.isFinite(e)&&e>0)return Math.max(e,t)}return Math.max(12e4,t)}function T(e=0){return{timeout:w(e),maxBuffer:C,killSignal:`SIGKILL`}}function E(e,t,n,r,i){let a=e,o=` binary: ${t}\n args: ${n.length>0?n.join(` `):`(none)`}\n stdin: ${r} bytes\n elapsed: ${i} ms`;if(a.code===`ETIMEDOUT`){let e=w(r);return Error(`[@aihu/compiler] aihu-compile TIMED OUT after ${e} ms and the child was killed.\n\n${o}\n\n This is the known spawn stall, not a slow compile: the compiler normally\n finishes in single-digit milliseconds. The child parks in read() waiting for\n an EOF on stdin that the parent's spawnSync loop never delivers, so without\n this timeout the build would hang at 0% CPU indefinitely (two such children\n were once found still running after 2.5 days).\n\n What to do next:\n - Re-run the build. The stall is intermittent and load-dependent; a retry\n normally succeeds.\n - If it reproduces every time, check the binary directly: ${t} --help\n and rebuild it: cargo build --release -p aihu-compiler\n - If a payload genuinely needs longer than ${e} ms, raise the bound with\n AIHU_COMPILE_TIMEOUT_MS=<milliseconds>. Do not remove it.`)}return a.code===`ENOBUFS`?Error(`[@aihu/compiler] aihu-compile produced more than the ${C} byte\n stdout/stderr limit and the child was killed.\n\n${o}\n\n An emit this large almost certainly means the input is wrong rather than a\n real component. Check what is being passed in before raising the cap.`):null}const ee=i(s(import.meta.url));let D=null;function te(){let e=v();if(e===null)return null;try{let t=JSON.parse(u(o(ee,`../package.json`),`utf8`)).optionalDependencies?.[e.packageName];return typeof t==`string`?t:null}catch{return null}}function ne(e){let t=te();if(t===null)return{ok:!0};if(typeof e.addon.compilerVersion!=`function`)return{ok:!1,reason:`missing-method`,actual:`<no compilerVersion()>`,expected:t};let n;try{n=String(e.addon.compilerVersion())}catch(e){return{ok:!1,reason:`missing-method`,actual:`<compilerVersion() threw: ${e.message}>`,expected:t}}return e.packageVersion===null||e.packageVersion===t?{ok:!0}:{ok:!1,reason:`version-mismatch`,actual:`${e.packageVersion} (reports: ${n})`,expected:t}}function re(e,t){return`[@aihu/compiler] native addon version mismatch — ${t.reason===`missing-method`?`the addon does not implement compilerVersion(), so it predates this handshake`:`the installed addon is not the build this source requires`}.\n Required (packages/compiler/package.json pin): ${t.expected}\n Loaded addon: ${t.actual}\n Addon path: ${e.addonPath}\n Cause: the addon is a PUBLISHED artifact, so a branch that changes Rust\n is stale by construction — the pinned version is not on npm yet and\n \`bun install\` cannot fix it. Using it would silently compile with\n pre-change codegen.`}function O(){if(D!==null)return D;let e=typeof process<`u`?process.env:void 0;if(e?.AIHU_COMPILER_NATIVE===`0`||e?.AIHU_COMPILE_BIN)return D={kind:`spawn`},D;let t=b();if(t.kind!==`loaded`)return D={kind:`spawn`},D;let n=ne(t);if(!n.ok){if(t.origin===`override`)throw Error(`${re(t,n)}\n AIHU_COMPILER_NATIVE_ADDON pinned this addon explicitly, so this fails\n rather than falling back. Unset it (the CLI spawn path is byte-identical),\n set AIHU_COMPILER_NATIVE=0, or rebuild:\n bun packages/compiler/scripts/build-native.ts`);return console.warn(`${re(t,n)}\n Falling back to the aihu-compile spawn path (built from source,\n byte-identical output, slower). Set AIHU_COMPILER_NATIVE=0 to silence\n this, or build the addon from source:\n bun packages/compiler/scripts/build-native.ts`),D={kind:`spawn`},D}return D={kind:`native`,compileEnvelope:t.addon.compileEnvelope.bind(t.addon),stampPath:t.addonPath},D}function ie(){D=null}function k(){let e=O();return e.kind===`native`?e.stampPath:A()}function A(){return process.env.AIHU_COMPILE_BIN??e()}function ae(e){let t=e.trim();if(t.startsWith(`{`))try{let e=JSON.parse(t);if(typeof e==`object`&&e&&e.envelope===1)return{kind:`envelope`,envelope:e}}catch{}return{kind:`legacy`,output:e}}function j(e,n,r){let i=O(),a=JSON.stringify(r);if(i.kind===`native`)return{kind:`envelope`,envelope:JSON.parse(i.compileEnvelope(e,a))};let o=A(),s=[...n,`--envelope`,a],c=Date.now(),l;try{l=t(o,s,{input:e,encoding:`utf8`,...T(e.length)})}catch(t){throw E(t,o,s,e.length,Date.now()-c)??t}return ae(l)}const oe=1024,M=new Map;let N=0,P=0,F=0;function se(e){try{let t=d(e);return`${e}:${t.mtimeMs}:${t.size}`}catch{return e}}function I(e,t,n,r,i){return f(`sha256`).update(e).update(`\0`).update(n).update(`\0`).update(r).update(`\0`).update(se(i)).update(`\0`).update(t).digest(`hex`)}function L(e,t,n,r,i,a){let o=I(e,t,n,r,i),s=M.get(o);if(s!==void 0)return N++,s;let c=a();if(P++,M.size>=1024){let e=M.keys().next().value;e!==void 0&&M.delete(e)}return M.set(o,c),c}function R(e,t,n,r,i,a){let o=I(e,t,n,r,i);if(!M.has(o)){if(M.size>=1024){let e=M.keys().next().value;e!==void 0&&M.delete(e)}M.set(o,a),F++}}function ce(){M.clear(),N=0,P=0,F=0}function le(){return{size:M.size,hits:N,misses:P,seeds:F}}function z(){return process.env.AIHU_COMPILE_BIN??e()}function ue(e,t){let n=[{kind:`code`,brace:0}],r=0;for(let i=t;i<e.length;i++){let t=n[n.length-1];if(t===void 0)return-1;let a=e[i];if(t.kind===`tpl`){a===`\\`?i++:a==="`"?n.pop():a===`$`&&e[i+1]===`{`&&(n.push({kind:`code`,brace:0}),i++);continue}if(a===`'`||a===`"`)for(i++;i<e.length&&e[i]!==a;)e[i]===`\\`&&i++,i++;else if(a==="`")n.push({kind:`tpl`});else if(a===`/`&&e[i+1]===`/`)for(;i<e.length&&e[i]!==`
3
- `;)i++;else if(a===`/`&&e[i+1]===`*`){for(i+=2;i<e.length&&(e[i]!==`*`||e[i+1]!==`/`);)i++;i++}else if(a===`(`)r++;else if(a===`)`){if(r--,r===0)return i}else a===`{`?t.brace++:a===`}`&&(t.brace===0&&n.length>1?n.pop():t.brace--)}return-1}function B(e,t,n){let r=/defineElement\(\s*['"][^'"]+['"]\s*,\s*defineComponent\(/.exec(e);if(r==null)return e;let i=ue(e,r.index+r[0].length-1);if(i===-1)return e;let a=`shadowMode: '${t}'${n?`, lightScopeId: '${n}'`:``}`,o=e.slice(i+1);if(/^\s*\)/.test(o))return`${e.slice(0,i+1)}, { ${a} }${o}`;let s=/^\s*,\s*\{/.exec(o);if(s&&!/^\s*,\s*\{[^}]*\bshadowMode\b/.test(o)){let t=i+1+s[0].length;return`${e.slice(0,t)} ${a},${e.slice(t)}`}return e}function V(e,t){return e.replace(`const __AIHU_LIGHT_SCOPE_ID__: string | undefined = undefined`,`const __AIHU_LIGHT_SCOPE_ID__: string | undefined = '${t}'`)}function H(e){return e.replace(/\(ctx\.host as ShadowRoot\)\.adoptedStyleSheets\s*=\s*\[__style__\];?/,`if (!document.adoptedStyleSheets.includes(__style__)) document.adoptedStyleSheets = [...document.adoptedStyleSheets, __style__];`)}function U(e){return/^\/\/ @aihu:island (static|interactive)$/m.exec(e)?.[1]===`static`?`static`:`interactive`}function W(e){if(e instanceof Error)return e.message;if(typeof e==`string`)return e;let t=e?.message;return typeof t==`string`?t:String(e)}function G(e){let t=W(e),n=e?.code;return n===`ERR_MODULE_NOT_FOUND`||n===`MODULE_NOT_FOUND`||/cannot find (module|package)/i.test(t)?/['"`]vite['"`]/.test(t):!1}function K(e,t,n,r,i){return`[@aihu/compiler] TypeScript strip failed for ${t} — vite ${n} \`${e}\` (${r?`server`:`client`} environment) threw. Returning the un-stripped TypeScript would corrupt the build silently and resurface as an unrelated bundler PARSE_ERROR on this file, so it fails here instead. Underlying error: ${W(i)}`}async function q(e,t,n,r){let i=e.version??`unknown`;if(typeof e.transformWithOxc==`function`)try{return{code:(await e.transformWithOxc(t,`component.ts`,{lang:`ts`,sourcemap:!1})).code,map:null}}catch(e){throw Error(K(`transformWithOxc`,n,i,r,e),{cause:e})}if(typeof e.transformWithEsbuild==`function`)try{return{code:(await e.transformWithEsbuild(t,`component.ts`,{target:`esnext`,sourcemap:!1})).code,map:null}}catch(e){throw Error(K(`transformWithEsbuild`,n,i,r,e),{cause:e})}return{code:t,moduleType:`ts`,map:null}}function J(e){let t=/^\/\/ @aihu:component-tags (.+)$/m.exec(e);return t===null?[]:t[1].split(`,`)}function Y(e){return[...new Set(Array.from(e.matchAll(/__aihu_schild\('([^']+)'/g),e=>e[1]))].sort()}function de(e){let t=/^\/\/ @aihu:extract read=(\S+) call=(\S+)$/m.exec(e);return t?{read:t[1],call:t[2]}:null}function fe(e){if(e.size===0)return[];let t=new Map,n=new Map;for(let{read:r,call:i}of e.values())t.set(r,(t.get(r)??0)+1),n.set(i,(n.get(i)??0)+1);let r=[`[aihu] extract census — ${e.size} surface(s)`];for(let[e,n]of[...t.entries()].sort())r.push(` read=${e}: ${n}`);for(let[e,t]of[...n.entries()].sort())r.push(` call=${e}: ${t}`);return r}function pe(e){let t=/defineElement\(\s*['"]([^'"]+)['"]/m.exec(e);return t?t[1]??null:null}function me(e){let t=/defineComponent\(\s*\{/.exec(e);if(t===null)return!1;let n=/\bbase\s*:/g;return n.lastIndex=t.index+t[0].length,n.test(e)}function he(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===47;)t--;return e.slice(0,t)}function ge(e,t){let n=he(t.replace(/\\/g,`/`).replace(/^\.?\//,``));return n?e.replace(/\\/g,`/`).includes(`/${n}/`):!1}function _e(e){return`aihu-layout-${e.toLowerCase()}`}function ve(e){let t=``;for(let n=0;n<e.length;n++){let r=e.charAt(n);if(n>0&&r>=`A`&&r<=`Z`){let r=e.charAt(n-1),i=e.charAt(n+1);(r>=`a`&&r<=`z`||r>=`0`&&r<=`9`||r>=`A`&&r<=`Z`&&i>=`a`&&i<=`z`)&&(t+=`-`)}t+=r.toLowerCase()}return t}function ye(e){let t=e.indexOf(`const createOutletBoundary = () => {`);if(t===-1)return e;let n=/return host;[^\S\n]*\n\};/g;n.lastIndex=t+36;let r=n.exec(e);return r===null?e:e.slice(0,t)+`const createOutletBoundary = () => branch('div', { 'data-aihu-outlet': '' }, []);`+e.slice(r.index+r[0].length)}function be(e,t){let n=e.replace(/import\s*\{([^{}]*)\}\s*from\s*'@aihu\/runtime'/,(e,t)=>{let n=t.split(`,`).map(e=>e.trim()).filter(Boolean);return n.includes(`_hmrReplace`)||n.push(`_hmrReplace`),`import { ${n.join(`, `)} } from '@aihu/runtime'`}).replace(/\bdefineComponent\(/,`defineComponent(__aihu_setup__ = `),r=`
1
+ import{resolveCompilerBinary as e}from"./resolve-binary.js";import{execFileSync as t}from"node:child_process";import{createRequire as n}from"node:module";import{basename as r,dirname as i,join as a,resolve as o}from"node:path";import{fileURLToPath as s,pathToFileURL as c}from"node:url";import{existsSync as l,readFileSync as u,statSync as d}from"node:fs";import{createHash as f}from"node:crypto";const p=i(s(import.meta.url));function m(){if(typeof process>`u`||!process.platform||!process.arch)return null;switch(`${process.platform}-${process.arch}`){case`darwin-arm64`:return{platformId:`darwin-arm64`,packageName:`@aihu/compiler-native-darwin-arm64`,nodeFile:`aihu-compiler-native.darwin-arm64.node`};case`darwin-x64`:return{platformId:`darwin-x64`,packageName:`@aihu/compiler-native-darwin-x64`,nodeFile:`aihu-compiler-native.darwin-x64.node`};case`linux-x64`:return{platformId:`linux-x64-gnu`,packageName:`@aihu/compiler-native-linux-x64-gnu`,nodeFile:`aihu-compiler-native.linux-x64-gnu.node`};case`linux-arm64`:return{platformId:`linux-arm64-gnu`,packageName:`@aihu/compiler-native-linux-arm64-gnu`,nodeFile:`aihu-compiler-native.linux-arm64-gnu.node`};case`win32-x64`:return{platformId:`win32-x64-msvc`,packageName:`@aihu/compiler-native-win32-x64-msvc`,nodeFile:`aihu-compiler-native.win32-x64-msvc.node`};default:return null}}let h=null,g=!1;function _(e){try{let t=a(i(e),`package.json`);if(!l(t))return null;let n=JSON.parse(u(t,`utf8`));return typeof n.name!=`string`||!n.name.startsWith(`@aihu/compiler-native-`)?null:typeof n.version==`string`?n.version:null}catch{return null}}function ee(){return m()}function v(e){return typeof e==`object`&&!!e&&typeof e.compileEnvelope==`function`}function y(){if(h!==null)return h;if(typeof process<`u`&&process.env?.AIHU_COMPILER_NATIVE===`0`)return h={kind:`disabled`},h;let e=n(import.meta.url),t=process.env?.AIHU_COMPILER_NATIVE_ADDON;if(t){let n;try{n=e(t)}catch(e){throw Error(`[@aihu/compiler] AIHU_COMPILER_NATIVE_ADDON is set to '${t}', which failed to load: ${e.message}`)}if(!v(n))throw Error(`[@aihu/compiler] AIHU_COMPILER_NATIVE_ADDON module at '${t}' does not export compileEnvelope()`);return h={kind:`loaded`,addon:n,addonPath:t,origin:`override`,packageVersion:_(t)},h}let r=m();if(r===null)return h={kind:`unavailable`},h;let i=null;try{i=e.resolve(r.packageName)}catch{}let a=[o(p,`../src-native/aihu-compiler-native.node`),o(p,`../src-native/target/release/aihu-compiler-native.node`)],s=i?[i]:a.filter(e=>l(e)),c=i?`package`:`dev-build`;for(let t of s)try{let n=e(t);if(v(n))return h={kind:`loaded`,addon:n,addonPath:t,origin:c,packageVersion:_(t)},h;throw Error(`module at ${t} does not export compileEnvelope()`)}catch(e){return g||(g=!0,console.warn(`[@aihu/compiler] native addon found but failed to load; falling back to the aihu-compile spawn path (identical output, slower).
2
+ Candidate: ${t}\n Error: ${e.message}\n Reinstall @aihu/compiler (or rebuild: cargo build --release --manifest-path packages/compiler/src-native/Cargo.toml), or set AIHU_COMPILER_NATIVE=0 to silence this warning.`)),h={kind:`unavailable`,error:e},h}return h={kind:`unavailable`},h}function b(){return y().kind}function x(){h=null,g=!1}const S=67108864;function C(e=0){let t=Math.ceil(e/1024)*2,n=process.env.AIHU_COMPILE_TIMEOUT_MS;if(n!==void 0&&n!==``){let e=Number(n);if(Number.isFinite(e)&&e>0)return Math.max(e,t)}return Math.max(12e4,t)}function w(e=0){return{timeout:C(e),maxBuffer:S,killSignal:`SIGKILL`}}function T(e,t,n,r,i){let a=e,o=` binary: ${t}\n args: ${n.length>0?n.join(` `):`(none)`}\n stdin: ${r} bytes\n elapsed: ${i} ms`;if(a.code===`ETIMEDOUT`){let e=C(r);return Error(`[@aihu/compiler] aihu-compile TIMED OUT after ${e} ms and the child was killed.\n\n${o}\n\n This is the known spawn stall, not a slow compile: the compiler normally\n finishes in single-digit milliseconds. The child parks in read() waiting for\n an EOF on stdin that the parent's spawnSync loop never delivers, so without\n this timeout the build would hang at 0% CPU indefinitely (two such children\n were once found still running after 2.5 days).\n\n What to do next:\n - Re-run the build. The stall is intermittent and load-dependent; a retry\n normally succeeds.\n - If it reproduces every time, check the binary directly: ${t} --help\n and rebuild it: cargo build --release -p aihu-compiler\n - If a payload genuinely needs longer than ${e} ms, raise the bound with\n AIHU_COMPILE_TIMEOUT_MS=<milliseconds>. Do not remove it.`)}return a.code===`ENOBUFS`?Error(`[@aihu/compiler] aihu-compile produced more than the ${S} byte\n stdout/stderr limit and the child was killed.\n\n${o}\n\n An emit this large almost certainly means the input is wrong rather than a\n real component. Check what is being passed in before raising the cap.`):null}const E=i(s(import.meta.url));let D=null;function te(){let e=ee();if(e===null)return null;try{let t=JSON.parse(u(o(E,`../package.json`),`utf8`)).optionalDependencies?.[e.packageName];return typeof t==`string`?t:null}catch{return null}}function ne(e){let t=te();if(t===null)return{ok:!0};if(typeof e.addon.compilerVersion!=`function`)return{ok:!1,reason:`missing-method`,actual:`<no compilerVersion()>`,expected:t};let n;try{n=String(e.addon.compilerVersion())}catch(e){return{ok:!1,reason:`missing-method`,actual:`<compilerVersion() threw: ${e.message}>`,expected:t}}return e.packageVersion===null||e.packageVersion===t?{ok:!0}:{ok:!1,reason:`version-mismatch`,actual:`${e.packageVersion} (reports: ${n})`,expected:t}}function re(e,t){return`[@aihu/compiler] native addon version mismatch — ${t.reason===`missing-method`?`the addon does not implement compilerVersion(), so it predates this handshake`:`the installed addon is not the build this source requires`}.\n Required (packages/compiler/package.json pin): ${t.expected}\n Loaded addon: ${t.actual}\n Addon path: ${e.addonPath}\n Cause: the addon is a PUBLISHED artifact, so a branch that changes Rust\n is stale by construction — the pinned version is not on npm yet and\n \`bun install\` cannot fix it. Using it would silently compile with\n pre-change codegen.`}function O(){if(D!==null)return D;let e=typeof process<`u`?process.env:void 0;if(e?.AIHU_COMPILER_NATIVE===`0`||e?.AIHU_COMPILE_BIN)return D={kind:`spawn`},D;let t=y();if(t.kind!==`loaded`)return D={kind:`spawn`},D;let n=ne(t);if(!n.ok){if(t.origin===`override`)throw Error(`${re(t,n)}\n AIHU_COMPILER_NATIVE_ADDON pinned this addon explicitly, so this fails\n rather than falling back. Unset it (the CLI spawn path is byte-identical),\n set AIHU_COMPILER_NATIVE=0, or rebuild:\n bun packages/compiler/scripts/build-native.ts`);return console.warn(`${re(t,n)}\n Falling back to the aihu-compile spawn path (built from source,\n byte-identical output, slower). Set AIHU_COMPILER_NATIVE=0 to silence\n this, or build the addon from source:\n bun packages/compiler/scripts/build-native.ts`),D={kind:`spawn`},D}return D={kind:`native`,compileEnvelope:t.addon.compileEnvelope.bind(t.addon),stampPath:t.addonPath},D}function ie(){D=null}function k(){let e=O();return e.kind===`native`?e.stampPath:A()}function A(){return process.env.AIHU_COMPILE_BIN??e()}function ae(e){let t=e.trim();if(t.startsWith(`{`))try{let e=JSON.parse(t);if(typeof e==`object`&&e&&e.envelope===1)return{kind:`envelope`,envelope:e}}catch{}return{kind:`legacy`,output:e}}function j(e,n,r){let i=O(),a=JSON.stringify(r);if(i.kind===`native`)return{kind:`envelope`,envelope:JSON.parse(i.compileEnvelope(e,a))};let o=A(),s=[...n,`--envelope`,a],c=Date.now(),l;try{l=t(o,s,{input:e,encoding:`utf8`,...w(e.length)})}catch(t){throw T(t,o,s,e.length,Date.now()-c)??t}return ae(l)}const oe=1024,M=new Map;let N=0,P=0,F=0;function se(e){try{let t=d(e);return`${e}:${t.mtimeMs}:${t.size}`}catch{return e}}function ce(e,t,n,r,i){return f(`sha256`).update(e).update(`\0`).update(n).update(`\0`).update(r).update(`\0`).update(se(i)).update(`\0`).update(t).digest(`hex`)}function I(e,t,n,r,i,a){let o=ce(e,t,n,r,i),s=M.get(o);if(s!==void 0)return N++,s;let c=a();if(P++,M.size>=1024){let e=M.keys().next().value;e!==void 0&&M.delete(e)}return M.set(o,c),c}function L(e,t,n,r,i,a){let o=ce(e,t,n,r,i);if(!M.has(o)){if(M.size>=1024){let e=M.keys().next().value;e!==void 0&&M.delete(e)}M.set(o,a),F++}}function le(){M.clear(),N=0,P=0,F=0}function ue(){return{size:M.size,hits:N,misses:P,seeds:F}}function R(){return process.env.AIHU_COMPILE_BIN??e()}function de(e,t){let n=[{kind:`code`,brace:0}],r=0;for(let i=t;i<e.length;i++){let t=n[n.length-1];if(t===void 0)return-1;let a=e[i];if(t.kind===`tpl`){a===`\\`?i++:a==="`"?n.pop():a===`$`&&e[i+1]===`{`&&(n.push({kind:`code`,brace:0}),i++);continue}if(a===`'`||a===`"`)for(i++;i<e.length&&e[i]!==a;)e[i]===`\\`&&i++,i++;else if(a==="`")n.push({kind:`tpl`});else if(a===`/`&&e[i+1]===`/`)for(;i<e.length&&e[i]!==`
3
+ `;)i++;else if(a===`/`&&e[i+1]===`*`){for(i+=2;i<e.length&&(e[i]!==`*`||e[i+1]!==`/`);)i++;i++}else if(a===`(`)r++;else if(a===`)`){if(r--,r===0)return i}else a===`{`?t.brace++:a===`}`&&(t.brace===0&&n.length>1?n.pop():t.brace--)}return-1}function z(e,t,n){let r=/defineElement\(\s*['"][^'"]+['"]\s*,\s*defineComponent\(/.exec(e);if(r==null)return e;let i=de(e,r.index+r[0].length-1);if(i===-1)return e;let a=`shadowMode: '${t}'${n?`, lightScopeId: '${n}'`:``}`,o=e.slice(i+1);if(/^\s*\)/.test(o))return`${e.slice(0,i+1)}, { ${a} }${o}`;let s=/^\s*,\s*\{/.exec(o);if(s&&!/^\s*,\s*\{[^}]*\bshadowMode\b/.test(o)){let t=i+1+s[0].length;return`${e.slice(0,t)} ${a},${e.slice(t)}`}return e}function B(e,t){return e.replace(`const __AIHU_LIGHT_SCOPE_ID__: string | undefined = undefined`,`const __AIHU_LIGHT_SCOPE_ID__: string | undefined = '${t}'`)}function V(e){return e.replace(/\(ctx\.host as ShadowRoot\)\.adoptedStyleSheets\s*=\s*\[__style__\];?/,`if (!document.adoptedStyleSheets.includes(__style__)) document.adoptedStyleSheets = [...document.adoptedStyleSheets, __style__];`)}function H(e){return/^\/\/ @aihu:island (static|interactive)$/m.exec(e)?.[1]===`static`?`static`:`interactive`}function U(e){if(e instanceof Error)return e.message;if(typeof e==`string`)return e;let t=e?.message;return typeof t==`string`?t:String(e)}function W(e){let t=U(e),n=e?.code;return n===`ERR_MODULE_NOT_FOUND`||n===`MODULE_NOT_FOUND`||/cannot find (module|package)/i.test(t)?/['"`]vite['"`]/.test(t):!1}function G(e,t,n,r,i){return`[@aihu/compiler] TypeScript strip failed for ${t} — vite ${n} \`${e}\` (${r?`server`:`client`} environment) threw. Returning the un-stripped TypeScript would corrupt the build silently and resurface as an unrelated bundler PARSE_ERROR on this file, so it fails here instead. Underlying error: ${U(i)}`}async function K(e,t,n,r){let i=e.version??`unknown`;if(typeof e.transformWithOxc==`function`)try{return{code:(await e.transformWithOxc(t,`component.ts`,{lang:`ts`,sourcemap:!1})).code,map:null}}catch(e){throw Error(G(`transformWithOxc`,n,i,r,e),{cause:e})}if(typeof e.transformWithEsbuild==`function`)try{return{code:(await e.transformWithEsbuild(t,`component.ts`,{target:`esnext`,sourcemap:!1})).code,map:null}}catch(e){throw Error(G(`transformWithEsbuild`,n,i,r,e),{cause:e})}return{code:t,moduleType:`ts`,map:null}}function q(e){let t=/^\/\/ @aihu:component-tags (.+)$/m.exec(e);return t===null?[]:t[1].split(`,`)}function J(e){return[...new Set(Array.from(e.matchAll(/__aihu_schild\('([^']+)'/g),e=>e[1]))].sort()}function fe(e){let t=/^\/\/ @aihu:extract read=(\S+) call=(\S+)$/m.exec(e);return t?{read:t[1],call:t[2]}:null}function pe(e){if(e.size===0)return[];let t=new Map,n=new Map;for(let{read:r,call:i}of e.values())t.set(r,(t.get(r)??0)+1),n.set(i,(n.get(i)??0)+1);let r=[`[aihu] extract census — ${e.size} surface(s)`];for(let[e,n]of[...t.entries()].sort())r.push(` read=${e}: ${n}`);for(let[e,t]of[...n.entries()].sort())r.push(` call=${e}: ${t}`);return r}function me(e){let t=/defineElement\(\s*['"]([^'"]+)['"]/m.exec(e);return t?t[1]??null:null}function he(e){let t=/defineComponent\(\s*\{/.exec(e);if(t===null)return!1;let n=/\bbase\s*:/g;return n.lastIndex=t.index+t[0].length,n.test(e)}function ge(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===47;)t--;return e.slice(0,t)}function _e(e,t){let n=ge(t.replace(/\\/g,`/`).replace(/^\.?\//,``));return n?e.replace(/\\/g,`/`).includes(`/${n}/`):!1}function ve(e){return`aihu-layout-${e.toLowerCase()}`}function ye(e){let t=``;for(let n=0;n<e.length;n++){let r=e.charAt(n);if(n>0&&r>=`A`&&r<=`Z`){let r=e.charAt(n-1),i=e.charAt(n+1);(r>=`a`&&r<=`z`||r>=`0`&&r<=`9`||r>=`A`&&r<=`Z`&&i>=`a`&&i<=`z`)&&(t+=`-`)}t+=r.toLowerCase()}return t}function be(e){let t=e.indexOf(`const createOutletBoundary = () => {`);if(t===-1)return e;let n=/return host;[^\S\n]*\n\};/g;n.lastIndex=t+36;let r=n.exec(e);return r===null?e:e.slice(0,t)+`const createOutletBoundary = () => branch('div', { 'data-aihu-outlet': '' }, []);`+e.slice(r.index+r[0].length)}function xe(e,t){let n=e.replace(/import\s*\{([^{}]*)\}\s*from\s*'@aihu\/runtime'/,(e,t)=>{let n=t.split(`,`).map(e=>e.trim()).filter(Boolean);return n.includes(`_hmrReplace`)||n.push(`_hmrReplace`),`import { ${n.join(`, `)} } from '@aihu/runtime'`}).replace(/\bdefineComponent\(/,`defineComponent(__aihu_setup__ = `),r=`
4
4
  export { __aihu_setup__ as default }
5
5
 
6
6
  if (typeof __DEV__ !== 'undefined' && __DEV__ && import.meta.hot) {
@@ -15,7 +15,7 @@ if (typeof __DEV__ !== 'undefined' && __DEV__ && import.meta.hot) {
15
15
  })
16
16
  }
17
17
  `;return`let __aihu_setup__: ((ctx: any) => any) | undefined
18
- `+n+r}function xe(e,t){let n=e.replace(/import\s*\{([^{}]*)\}\s*from\s*'@aihu\/runtime'/,(e,t)=>{let n=t.split(`,`).map(e=>e.trim()).filter(Boolean);return n.includes(`_hydrateOnVisible`)||n.push(`_hydrateOnVisible`),`import { ${n.join(`, `)} } from '@aihu/runtime'`}),r=n.replace(/defineElement\(\s*('[^']+'|"[^"]+")\s*,\s*defineComponent\(/,(e,t)=>`defineElement(${t}, __aihu_wrap_defer__(defineComponent(`);if(r===n)return e;let i=r.replace(/\)\s*\)\s*\nexport\s/,`)))
18
+ `+n+r}function Se(e,t){let n=e.replace(/import\s*\{([^{}]*)\}\s*from\s*'@aihu\/runtime'/,(e,t)=>{let n=t.split(`,`).map(e=>e.trim()).filter(Boolean);return n.includes(`_hydrateOnVisible`)||n.push(`_hydrateOnVisible`),`import { ${n.join(`, `)} } from '@aihu/runtime'`}),r=n.replace(/defineElement\(\s*('[^']+'|"[^"]+")\s*,\s*defineComponent\(/,(e,t)=>`defineElement(${t}, __aihu_wrap_defer__(defineComponent(`);if(r===n)return e;let i=r.replace(/\)\s*\)\s*\nexport\s/,`)))
19
19
  export `);return i===r&&(i=r.replace(/\)\s*\)\s*$/,`)))
20
20
  `)),i===r?e:`
21
21
  // Plan 3.3 (Islands) — defer attribute support. Wraps the constructor
@@ -34,13 +34,13 @@ function __aihu_wrap_defer__<T extends typeof HTMLElement>(Ctor: T): T {
34
34
  }
35
35
  return Ctor
36
36
  }
37
- `+i}function Se(e,t){if(!/defineElement\(\s*['"][^'"]+['"]\s*,\s*defineComponent\(/.test(e))return e;let n=e.replace(/^[^\S\r\n]*import\s*\{[^{}]*\}\s*from\s*'@aihu\/runtime'(?:\s*;)?\s*$/m,``).replace(/import\s*\{([^{}]*)\}\s*from\s*'@aihu\/arbor'/,(e,t)=>{let n=t.split(`,`).map(e=>e.trim()).filter(Boolean);return n.includes(`mount`)||n.push(`mount`),`import { ${n.join(`, `)} } from '@aihu/arbor'`}),r=/\)\s*\)\s*$/,i=/\),\s*\{\s*shadowMode:\s*'shadow'\s*\}\)\s*$/,a=r.test(n)?r:i.test(n)?i:null;if(a===null)return e;let o=JSON.stringify(t);return`// AIHU_STATIC_ISLAND — zero @aihu/runtime references\n${n.replace(/defineElement\(\s*['"][^'"]+['"]\s*,\s*defineComponent\(/,`customElements.define(${o}, class extends HTMLElement {\n connectedCallback() {\n const root = this.attachShadow({ mode: 'open' })\n const __aihu_setup__ = (`).replace(a,`)
37
+ `+i}function Ce(e,t){if(!/defineElement\(\s*['"][^'"]+['"]\s*,\s*defineComponent\(/.test(e))return e;let n=e.replace(/^[^\S\r\n]*import\s*\{[^{}]*\}\s*from\s*'@aihu\/runtime'(?:\s*;)?\s*$/m,``).replace(/import\s*\{([^{}]*)\}\s*from\s*'@aihu\/arbor'/,(e,t)=>{let n=t.split(`,`).map(e=>e.trim()).filter(Boolean);return n.includes(`mount`)||n.push(`mount`),`import { ${n.join(`, `)} } from '@aihu/arbor'`}),r=/\)\s*\)\s*$/,i=/\),\s*\{\s*shadowMode:\s*'shadow'\s*\}\)\s*$/,a=r.test(n)?r:i.test(n)?i:null;if(a===null)return e;let o=JSON.stringify(t);return`// AIHU_STATIC_ISLAND — zero @aihu/runtime references\n${n.replace(/defineElement\(\s*['"][^'"]+['"]\s*,\s*defineComponent\(/,`customElements.define(${o}, class extends HTMLElement {\n connectedCallback() {\n const root = this.attachShadow({ mode: 'open' })\n const __aihu_setup__ = (`).replace(a,`)
38
38
  mount(__aihu_setup__({ host: root, element: this }), root)
39
39
  }
40
40
  })
41
- `)}`}function Ce(e,n,i){let a=r(n,`.aihu`),o=ve(a),s=/^[A-Z]/.test(a)&&!o.includes(`-`)?a:o,c=[`--stdin`,`--tag`,i?.tag??s,`--path`,n];if(i?.sidecarOut&&c.push(`--sidecar-out`,i.sidecarOut),i?.target&&c.push(`--target`,i.target),i?.strictTemplates&&c.push(`--strict-templates`),i?.sidecarOut){let n=z(),r=Date.now();try{return{code:t(n,c,{input:e,encoding:`utf8`,...T(e.length)}),map:null}}catch(t){throw E(t,n,c,e.length,Date.now()-r)??t}}let l=k(),u=i?.target??`universal`,d=i?.tag===void 0;return{code:L(`transform`,e,n,`target=${i?.target??``}|tag=${i?.tag??``}|strict=${i?.strictTemplates===!0}`,l,()=>{let t=j(e,c,{tag:i?.tag??s,path:n,targets:[u],emits:d?[`js`,`ast`,`route`]:[`js`],...i?.strictTemplates?{strictTemplates:!0}:{}});if(t.kind===`legacy`)return t.output;let r=t.envelope;d&&(r.astJson!==void 0&&R(`ast`,e,n,``,l,r.astJson),R(`route`,e,n,``,l,r.routeJson??`null`));let a=r.targets[u]?.js;if(a===void 0)throw Error(`[@aihu/compiler] envelope reply missing js for target '${u}'`);return a}),map:null}}function we(e){return e.replace(/\\/g,`\\\\`).replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}function Te(e,t,n,r){let i=e.indexOf(t);if(i===-1)return null;let a=i+t.length,o=e.indexOf(n,a);return o===-1?null:e.slice(0,a)+r+e.slice(o)}function Ee(e,t){if(!t.trim())return e;let n=we(t),r=Te(e,"export const __aihu_css__ = `","`",n);return r===null?`${e}\nexport const __aihu_css__ = \`${n}\`\n`:r}function X(e,t){if(!t.trim())return e;let n=we(t),r=Te(e,"__style__.replaceSync(`","`);",n);if(r!==null)return r;let i=/defineComponent\(\s*\((__?[A-Za-z0-9_]+)\)\s*=>\s*\{/,a=i.exec(e);if(a==null)return e;let o=a[1]===`_ctx`?`ctx`:a[1],s=e.split(`
41
+ `)}`}function we(e,n,i){let a=r(n,`.aihu`),o=ye(a),s=/^[A-Z]/.test(a)&&!o.includes(`-`)?a:o,c=[`--stdin`,`--tag`,i?.tag??s,`--path`,n];if(i?.sidecarOut&&c.push(`--sidecar-out`,i.sidecarOut),i?.target&&c.push(`--target`,i.target),i?.strictTemplates&&c.push(`--strict-templates`),i?.sidecarOut){let n=R(),r=Date.now();try{return{code:t(n,c,{input:e,encoding:`utf8`,...w(e.length)}),map:null}}catch(t){throw T(t,n,c,e.length,Date.now()-r)??t}}let l=k(),u=i?.target??`universal`,d=i?.tag===void 0;return{code:I(`transform`,e,n,`target=${i?.target??``}|tag=${i?.tag??``}|strict=${i?.strictTemplates===!0}`,l,()=>{let t=j(e,c,{tag:i?.tag??s,path:n,targets:[u],emits:d?[`js`,`ast`,`route`]:[`js`],...i?.strictTemplates?{strictTemplates:!0}:{}});if(t.kind===`legacy`)return t.output;let r=t.envelope;d&&(r.astJson!==void 0&&L(`ast`,e,n,``,l,r.astJson),L(`route`,e,n,``,l,r.routeJson??`null`));let a=r.targets[u]?.js;if(a===void 0)throw Error(`[@aihu/compiler] envelope reply missing js for target '${u}'`);return a}),map:null}}function Te(e){return e.replace(/\\/g,`\\\\`).replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}function Ee(e,t,n,r){let i=e.indexOf(t);if(i===-1)return null;let a=i+t.length,o=e.indexOf(n,a);return o===-1?null:e.slice(0,a)+r+e.slice(o)}function De(e,t){if(!t.trim())return e;let n=Te(t),r=Ee(e,"export const __aihu_css__ = `","`",n);return r===null?`${e}\nexport const __aihu_css__ = \`${n}\`\n`:r}function Y(e,t){if(!t.trim())return e;let n=Te(t),r=Ee(e,"__style__.replaceSync(`","`);",n);if(r!==null)return r;let i=/defineComponent\(\s*\((__?[A-Za-z0-9_]+)\)\s*=>\s*\{/,a=i.exec(e);if(a==null)return e;let o=a[1]===`_ctx`?`ctx`:a[1],s=e.split(`
42
42
  `),c=-1;for(let e=s.length-1;e>=0;e--){let t=(s[e]??``).trim();if(t.startsWith(`import `)||t.startsWith(`import{`)){c=e;break}}let l=`const __style__ = new CSSStyleSheet();\n__style__.replaceSync(\`${n}\`);`;c===-1?s.unshift(l):s.splice(c+1,0,l);let u=s.join(`
43
- `);return u=u.replace(i,`defineComponent((${o}) => {\n (${o}.host as ShadowRoot).adoptedStyleSheets = [__style__];`),u}const De=`\0virtual:aihu-utility/`;function Oe(e){let t=5381;for(let n=0;n<e.length;n++)t=(t*33^e.charCodeAt(n))>>>0;return t}function ke(e){return Oe(e).toString(36)}function Ae(e){return Oe(e).toString(16).padStart(8,`0`)}function je(e,t,n){if(!t.trim())return null;let r=ke(n),i=`${De}${r}.css`;return{code:`import ${JSON.stringify(i)};\n`+e,virtualId:i}}function Me(e,n,i){let a=[`--stdin`,`--tag`,n?r(n,`.aihu`):`Component`,`--sidecar-stdout`];n&&a.push(`--path`,n),i?.strictTemplates&&a.push(`--strict-templates`),i?.target&&a.push(`--target`,i.target);let o=z(),s=Date.now();try{return t(o,a,{input:e,encoding:`utf8`,stdio:[`pipe`,`pipe`,`pipe`],...T(e.length)})}catch(t){throw E(t,o,a,e.length,Date.now()-s)??t}}function Ne(e,t){let n=t?r(t,`.aihu`):`Component`,i=[`--stdin`,`--tag`,n,`--ast-json`];t&&i.push(`--path`,t);let a=k(),o=L(`ast`,e,t??``,``,a,()=>{let r=j(e,i,{tag:n,...t?{path:t}:{},emits:[`ast`]});if(r.kind===`legacy`)return r.output;let a=r.envelope.astJson;if(a===void 0)throw Error(`[@aihu/compiler] envelope reply missing astJson`);return a});return JSON.parse(o)}function Pe(e,t){let n=t?r(t,`.aihu`):`Component`,i=[`--stdin`,`--tag`,n,`--route-json`];t&&i.push(`--path`,t);let a=k(),o=L(`route`,e,t??``,``,a,()=>{let r=j(e,i,{tag:n,...t?{path:t}:{},emits:[`route`]});return r.kind===`legacy`?r.output:r.envelope.routeJson??`null`}).trim();return o===``||o===`null`?null:JSON.parse(o)}function Z(e){let t;t=e.includes(`from '@aihu/arbor'`)?e.replace(/import\s*\{([^{}]*)\}\s*from\s*'@aihu\/arbor'/,(e,t)=>{let n=t.split(`,`).map(e=>e.trim()).filter(Boolean);return n.includes(`mount`)||n.push(`mount`),`import { ${n.join(`, `)} } from '@aihu/arbor'`}):`import { mount } from '@aihu/arbor'\n${e}`,/import\s+\{[^{}]*\}\s+from\s+'@aihu\/signals'/.test(t)?t=t.replace(/import\s*\{([^{}]*)\}\s*from\s*'@aihu\/signals'/,(e,t)=>{if(e.startsWith(`import type`))return e;let n=t.split(`,`).map(e=>e.trim()).filter(Boolean);return n.includes(`signal`)||n.push(`signal`),`import { ${n.join(`, `)} } from '@aihu/signals'`}):/^[^\S\n]*import\b[^\n]*from[^\S\n]*'@aihu\/signals'/m.test(t)?/import\s+type\s+\{[^{}]*\}\s+from\s+'@aihu\/signals'/.test(t)&&!t.match(/import\s+\{[^{}]*\}\s+from\s+'@aihu\/signals'/)&&(t=t.replace(/(import\s+type\s+\{[^{}]*\}\s+from\s+'@aihu\/signals')/,(e,t)=>`${t}\nimport { signal } from '@aihu/signals'`)):t=t.replace(/import\s*\{[^{}]*\}\s*from\s*'@aihu\/arbor'/,e=>`${e}\nimport { signal } from '@aihu/signals'`),t=t.replace(/import\s*\{([^{}]*)\}\s*from\s*'@aihu\/runtime'/,(e,t)=>{let n=t.split(`,`).map(e=>e.trim()).filter(Boolean);return n.includes(`_setMount`)||n.push(`_setMount`),n.includes(`_setSignal`)||n.push(`_setSignal`),`import { ${n.join(`, `)} } from '@aihu/runtime'`});let n=t.split(`
43
+ `);return u=u.replace(i,`defineComponent((${o}) => {\n (${o}.host as ShadowRoot).adoptedStyleSheets = [__style__];`),u}const Oe=`\0virtual:aihu-utility/`;function ke(e){let t=5381;for(let n=0;n<e.length;n++)t=(t*33^e.charCodeAt(n))>>>0;return t}function Ae(e){return ke(e).toString(36)}function je(e){return ke(e).toString(16).padStart(8,`0`)}function X(e,t,n){if(!t.trim())return null;let r=Ae(n),i=`${Oe}${r}.css`;return{code:`import ${JSON.stringify(i)};\n`+e,virtualId:i}}const Me=Y,Ne=X;function Pe(e,n,i){let a=[`--stdin`,`--tag`,n?r(n,`.aihu`):`Component`,`--sidecar-stdout`];n&&a.push(`--path`,n),i?.strictTemplates&&a.push(`--strict-templates`),i?.target&&a.push(`--target`,i.target);let o=R(),s=Date.now();try{return t(o,a,{input:e,encoding:`utf8`,stdio:[`pipe`,`pipe`,`pipe`],...w(e.length)})}catch(t){throw T(t,o,a,e.length,Date.now()-s)??t}}function Fe(e,t){let n=t?r(t,`.aihu`):`Component`,i=[`--stdin`,`--tag`,n,`--ast-json`];t&&i.push(`--path`,t);let a=k(),o=I(`ast`,e,t??``,``,a,()=>{let r=j(e,i,{tag:n,...t?{path:t}:{},emits:[`ast`]});if(r.kind===`legacy`)return r.output;let a=r.envelope.astJson;if(a===void 0)throw Error(`[@aihu/compiler] envelope reply missing astJson`);return a});return JSON.parse(o)}function Ie(e,t){let n=t?r(t,`.aihu`):`Component`,i=[`--stdin`,`--tag`,n,`--route-json`];t&&i.push(`--path`,t);let a=k(),o=I(`route`,e,t??``,``,a,()=>{let r=j(e,i,{tag:n,...t?{path:t}:{},emits:[`route`]});return r.kind===`legacy`?r.output:r.envelope.routeJson??`null`}).trim();return o===``||o===`null`?null:JSON.parse(o)}function Z(e){let t;t=e.includes(`from '@aihu/arbor'`)?e.replace(/import\s*\{([^{}]*)\}\s*from\s*'@aihu\/arbor'/,(e,t)=>{let n=t.split(`,`).map(e=>e.trim()).filter(Boolean);return n.includes(`mount`)||n.push(`mount`),`import { ${n.join(`, `)} } from '@aihu/arbor'`}):`import { mount } from '@aihu/arbor'\n${e}`,/import\s+\{[^{}]*\}\s+from\s+'@aihu\/signals'/.test(t)?t=t.replace(/import\s*\{([^{}]*)\}\s*from\s*'@aihu\/signals'/,(e,t)=>{if(e.startsWith(`import type`))return e;let n=t.split(`,`).map(e=>e.trim()).filter(Boolean);return n.includes(`signal`)||n.push(`signal`),`import { ${n.join(`, `)} } from '@aihu/signals'`}):/^[^\S\n]*import\b[^\n]*from[^\S\n]*'@aihu\/signals'/m.test(t)?/import\s+type\s+\{[^{}]*\}\s+from\s+'@aihu\/signals'/.test(t)&&!t.match(/import\s+\{[^{}]*\}\s+from\s+'@aihu\/signals'/)&&(t=t.replace(/(import\s+type\s+\{[^{}]*\}\s+from\s+'@aihu\/signals')/,(e,t)=>`${t}\nimport { signal } from '@aihu/signals'`)):t=t.replace(/import\s*\{[^{}]*\}\s*from\s*'@aihu\/arbor'/,e=>`${e}\nimport { signal } from '@aihu/signals'`),t=t.replace(/import\s*\{([^{}]*)\}\s*from\s*'@aihu\/runtime'/,(e,t)=>{let n=t.split(`,`).map(e=>e.trim()).filter(Boolean);return n.includes(`_setMount`)||n.push(`_setMount`),n.includes(`_setSignal`)||n.push(`_setSignal`),`import { ${n.join(`, `)} } from '@aihu/runtime'`});let n=t.split(`
44
44
  `),r=-1;for(let e=n.length-1;e>=0;e--){let t=(n[e]??``).trim();if(t.startsWith(`import `)||t.startsWith(`import{`)){r=e;break}}return r!==-1&&(n.splice(r+1,0,`_setMount(mount)`,`_setSignal(signal)`,``),t=n.join(`
45
- `)),t}let Q,Fe=!1;const $=`@aihu/css-engine`;async function Ie(){try{return await import($)}catch{try{let e=n(a(process.cwd(),`package.json`)).resolve($);return await import(c(e).href)}catch{return null}}}async function Le(e,t,n){if(Q===null)return``;if(process.env.AIHU_COMPILE_BIN==null)try{process.env.AIHU_COMPILE_BIN=z()}catch{}if(Q===void 0&&(Q=await Ie(),Q===null))return``;try{return Q.compileSfc(e,t,n)}catch(e){if(!Fe){Fe=!0;let t=e instanceof Error?e.message:String(e);console.warn(`[@aihu/compiler] @aihu/css-engine is installed but compileSfc() failed; utility classes will not emit. Original error: ${t}\nHint: ensure the native css-core binary is installed (install/upgrade @aihu/css-engine + its per-platform optional dep, or run \`cargo build --release -p aihu-css-core\` in a dev clone).`)}return``}}function Re(e){let t=e?.islands!==!1,n=e?.shadowMode,i=e?.target,a=e?.layoutsDir??`src/layouts`,o=new Map,s=new Map;return{name:`aihu-compiler`,enforce:`pre`,buildEnd(){for(let e of fe(s))console.info(e)},resolveId(e){return e.startsWith(`\0virtual:aihu-utility/`)?e:null},load(e){return e.startsWith(`\0virtual:aihu-utility/`)?o.get(e)??null:null},transform(e,c){let l=c.split(`?`)[0];if(!l.endsWith(`.aihu`))return;let u=this?.environment?.config?.consumer===`server`,d=i??(u?`server`:void 0);return(async()=>{let i=ge(l,a),c=i?_e(r(l,`.aihu`)):void 0,f={...d?{target:d}:{},...c?{tag:c}:{}},p=Ce(e,l,f),m=de(p.code);m&&s.set(l,m);let h=/^\/\/ @aihu:shadow (light|shadow)\b/m.exec(p.code)?.[1],g=/^\/\/ @aihu:shadow-default (light|shadow)\b/m.exec(p.code)?.[1]??(i?`light`:void 0),_=h??n??g,v=_===`light`?Ae(l):void 0,y=_==null?p.code:B(p.code,_,v);v&&(y=V(y,v)),_===`light`&&(y=H(y)),i&&(y=ye(y));let b=await Le(e,l,v);if(b){if(_===`light`){let e=je(y,b,l);e&&(o.set(e.virtualId,b),y=e.code)}else y=X(y,b),u&&(y=Ee(y,b))}let x=pe(y),S,C=me(y);if(u){S=y,v&&(S+=`\nexport const __aihu_light_scope__ = '${v}'\n`),x!==null&&(S+=`\nexport const __aihu_tag__ = '${x}'\n`),_!=null&&(S+=`\nexport const __aihu_shadow__ = '${_}'\n`);let e=Y(S);e.length>0&&(S+=`\nexport const __aihu_child_tags__ = ${JSON.stringify(e)}\n`);let t=J(y);t.length>0&&(S+=`\nexport const __aihu_referenced_tags__ = ${JSON.stringify(t)}\n`)}else t&&x!==null&&!C&&_!==`light`&&U(y)===`static`?S=Se(y,x):x===null?(S=y,S=Z(S)):(S=be(y,x),S=xe(S,x),S=Z(S));let w;try{w=await import(`vite`)}catch(e){if(G(e))return{code:S,map:null};throw Error(`[@aihu/compiler] Could not load \`vite\` to strip TypeScript from ${l}. Vite appears to be installed but failed to load, so this is NOT the "running outside Vite" case and the TypeScript must not be handed back un-stripped. Underlying error: ${W(e)}`,{cause:e})}return await q(w,S,l,u)})()}}}export{De as VIRTUAL_UTILITY_PREFIX,oe as _MEMO_MAX_ENTRIES,xe as _buildDeferredHydration,Se as _buildStaticIsland,ce as _clearTransformMemo,j as _compileViaBackend,Y as _deriveChildTags,W as _errMessage,X as _foldCssEngineStyles,je as _foldCssEngineStylesGlobal,Ee as _foldSsrCssExport,fe as _formatExtractCensus,x as _getCompilerNativeStateKind,H as _globalizeAuthoredStyle,ke as _hashIdForUtilityCss,Z as _injectAutoWiring,V as _injectLightScopeId,B as _injectShadowMode,ge as _isLayoutFile,G as _isViteMissing,_e as _layoutTag,Ae as _lightScopeId,J as _parseComponentTagsMarker,de as _parseExtractMarker,U as _parseIslandMarker,ye as _passivizeOutlet,ie as _resetCompileBackend,S as _resetCompilerNative,O as _resolveCompileBackend,K as _stripFailure,q as _stripTypes,le as _transformMemoStats,Re as aihuCompilerPlugin,Pe as compileRouteMeta,Me as compileSidecar,Ne as compileToAst,ve as kebabComponentTag,b as loadCompilerNative,e as resolveCompilerBinary,Ce as transform};
45
+ `)),t}let Q,Le=!1;const $=`@aihu/css-engine`;async function Re(){try{return await import($)}catch{try{let e=n(a(process.cwd(),`package.json`)).resolve($);return await import(c(e).href)}catch{return null}}}async function ze(e,t,n,r){if(Q===null)return``;if(process.env.AIHU_COMPILE_BIN==null)try{process.env.AIHU_COMPILE_BIN=R()}catch{}if(Q===void 0&&(Q=await Re(),Q===null))return``;try{return r===void 0?Q.compileSfc(e,t,n):Q.compileSfc(e,t,n,r)}catch(e){if(!Le){Le=!0;let t=e instanceof Error?e.message:String(e);console.warn(`[@aihu/compiler] @aihu/css-engine is installed but compileSfc() failed; utility classes will not emit. Original error: ${t}\nHint: ensure the native css-core binary is installed (install/upgrade @aihu/css-engine + its per-platform optional dep, or run \`cargo build --release -p aihu-css-core\` in a dev clone).`)}return``}}async function Be(e,t,n){return e===void 0?ze(t.source,t.id,t.lightScopeId,n):await e(t)??``}function Ve(e){let t=e?.islands!==!1,n=e?.shadowMode,i=e?.cssProvider,a=e?.css,o=e?.target,s=e?.layoutsDir??`src/layouts`,c=new Map,l=new Map;return{name:`aihu-compiler`,enforce:`pre`,buildEnd(){for(let e of pe(l))console.info(e)},resolveId(e){return e.startsWith(`\0virtual:aihu-utility/`)?e:null},load(e){return e.startsWith(`\0virtual:aihu-utility/`)?c.get(e)??null:null},transform(e,u){let d=u.split(`?`)[0];if(!d.endsWith(`.aihu`))return;let f=this?.environment?.config?.consumer===`server`,p=o??(f?`server`:void 0);return(async()=>{let o=_e(d,s),u=o?ve(r(d,`.aihu`)):void 0,m={...p?{target:p}:{},...u?{tag:u}:{}},h=we(e,d,m),g=fe(h.code);g&&l.set(d,g);let _=/^\/\/ @aihu:shadow (light|shadow)\b/m.exec(h.code)?.[1],ee=/^\/\/ @aihu:shadow-default (light|shadow)\b/m.exec(h.code)?.[1]??(o?`light`:void 0),v=_??n??ee,y=v??`shadow`,b=v===`light`?je(d):void 0,x=v==null?h.code:z(h.code,v,b);b&&(x=B(x,b)),v===`light`&&(x=V(x)),o&&(x=be(x));let S=await Be(i,{source:e,id:d,shadowMode:y,target:p??`universal`,...b?{lightScopeId:b}:{}},a);if(S){if(v===`light`){let e=X(x,S,d);e&&(c.set(e.virtualId,S),x=e.code)}else x=Y(x,S),f&&(x=De(x,S))}let C=me(x),w,T=he(x);if(f){w=x,b&&(w+=`\nexport const __aihu_light_scope__ = '${b}'\n`),C!==null&&(w+=`\nexport const __aihu_tag__ = '${C}'\n`),v!=null&&(w+=`\nexport const __aihu_shadow__ = '${v}'\n`);let e=J(w);e.length>0&&(w+=`\nexport const __aihu_child_tags__ = ${JSON.stringify(e)}\n`);let t=q(x);t.length>0&&(w+=`\nexport const __aihu_referenced_tags__ = ${JSON.stringify(t)}\n`)}else t&&C!==null&&!T&&v!==`light`&&H(x)===`static`?w=Ce(x,C):C===null?(w=x,w=Z(w)):(w=xe(x,C),w=Se(w,C),w=Z(w));let E;try{E=await import(`vite`)}catch(e){if(W(e))return{code:w,map:null};throw Error(`[@aihu/compiler] Could not load \`vite\` to strip TypeScript from ${d}. Vite appears to be installed but failed to load, so this is NOT the "running outside Vite" case and the TypeScript must not be handed back un-stripped. Underlying error: ${U(e)}`,{cause:e})}return await K(E,w,d,f)})()}}}export{Oe as VIRTUAL_UTILITY_PREFIX,oe as _MEMO_MAX_ENTRIES,Se as _buildDeferredHydration,Ce as _buildStaticIsland,le as _clearTransformMemo,j as _compileViaBackend,J as _deriveChildTags,U as _errMessage,Me as _foldCssEngineStyles,Ne as _foldCssEngineStylesGlobal,Y as _foldCssStyles,X as _foldCssStylesGlobal,De as _foldSsrCssExport,pe as _formatExtractCensus,b as _getCompilerNativeStateKind,V as _globalizeAuthoredStyle,Ae as _hashIdForUtilityCss,Z as _injectAutoWiring,B as _injectLightScopeId,z as _injectShadowMode,_e as _isLayoutFile,W as _isViteMissing,ve as _layoutTag,je as _lightScopeId,q as _parseComponentTagsMarker,fe as _parseExtractMarker,H as _parseIslandMarker,be as _passivizeOutlet,ie as _resetCompileBackend,x as _resetCompilerNative,O as _resolveCompileBackend,G as _stripFailure,K as _stripTypes,ue as _transformMemoStats,Ve as aihuCompilerPlugin,Ie as compileRouteMeta,Pe as compileSidecar,Fe as compileToAst,ye as kebabComponentTag,y as loadCompilerNative,e as resolveCompilerBinary,we as transform};
46
46
  //# sourceMappingURL=index.js.map