import type { StxOptions } from './types';
/**
 * Scan a template for `<script>` tags in browser order: each opening tag is
 * closed by the **first** subsequent `</script>` (case-insensitive), and the
 * scanner then continues from after that close tag. This matches how HTML
 * parsers tokenize `<script>` as a RAWTEXT element — they don't re-scan the
 * body for more `<script` openings.
 *
 * A plain regex like `/<script[^>]*>([\s\S]*?)<\/script>/g` doesn't give you
 * this property: if a script body contains the literal text `<script client>`
 * (e.g. inside a JS comment), the regex matches it as a fresh script tag,
 * which breaks downstream TypeScript transpilation and directive parsing.
 *
 * `skipAttrs` lets callers drop tags whose attribute string contains certain
 * patterns (e.g. `server`, `src=`, `data-stx-scoped`).
 */
export declare function scanScriptTags(html: string, opts?: { skipAttrs?: RegExp }): Array<{ fullMatch: string, attrs: string, body: string, start: number, end: number }>;
/**
 * Parse a loop argument — accepts every syntax stx supports at runtime.
 *
 * ```
 * parseLoopExpression('items as item')                → { style:'as', iterable:'items',     itemVar:'item', indexVar:null }
 * parseLoopExpression('items as idx => item')         → { style:'as', iterable:'items',     itemVar:'item', indexVar:'idx' }
 * parseLoopExpression('items as item, idx')           → { style:'as', iterable:'items',     itemVar:'item', indexVar:'idx' }
 * parseLoopExpression('items as (item, idx)')         → { style:'as', iterable:'items',     itemVar:'item', indexVar:'idx' }
 * parseLoopExpression('obj.list as item')             → { style:'as', iterable:'obj.list',  itemVar:'item', indexVar:null }
 * parseLoopExpression('item in items')                → { style:'in', iterable:'items',     itemVar:'item', indexVar:null }
 * parseLoopExpression('(item, idx) in items')         → { style:'in', iterable:'items',     itemVar:'item', indexVar:'idx' }
 * parseLoopExpression('item of items')                → { style:'in', iterable:'items',     itemVar:'item', indexVar:null }
 * ```
 */
export declare function parseLoopExpression(expr: string): ParsedLoopExpression;
/**
 * Check if template uses STX signals syntax.
 *
 * STX directives work seamlessly on both server and client:
 * - `@if`, `@else` - Conditional rendering
 * - `@for` - List iteration
 * - `@show` - Toggle visibility (keeps element in DOM)
 * - `@model` - Two-way binding
 * - `@bind:attr` - Dynamic attribute binding
 * - `@class`, `@style` - Dynamic class/style binding
 * - `@click`, `@submit` - Event handling
 * - Scripts containing `state(`, `derived(`, `effect(` - Signal APIs
 *
 * Server-side directives are processed at build time.
 * Remaining directives with reactive values are handled by the client runtime.
 */
export declare function hasSignalsSyntax(template: string): boolean;
/**
 * Convert @if(expr)...@endif directive blocks to attribute-style for signal templates.
 *
 * This allows the signals runtime to handle reactive conditionals instead of
 * evaluating them at build time with mock values.
 *
 * Converts:
 *   @if(loading())
 *     <div>Loading...</div>
 *   @endif
 *
 * To:
 *   <template @if="loading()">
 *     <div>Loading...</div>
 *   </template>
 *
 * Note: Uses <template> wrapper for blocks with multiple children or text nodes.
 */
export declare function convertSignalDirectivesToAttributes(template: string): string;
/**
 * Convert @for(item in items())...@endfor directive blocks to attribute-style.
 *
 * Converts:
 *   @for(item in items())
 *     <div>{{ item.name }}</div>
 *   @endfor
 *
 * To:
 *   <template @for="item in items()">
 *     <div>{{ item.name }}</div>
 *   </template>
 */
export declare function convertSignalLoopsToAttributes(template: string, context?: Record<string, any>): string;
export declare function processScriptSetup(template: string, filePath?: string): Promise<{ output: string, setupCode: string | null }>;
/**
 * Extract exported variable names from setup script.
 * Returns variables that should be exposed to the template.
 * Only extracts TOP-LEVEL declarations, not variables inside nested functions.
 */
export declare function extractExports(setupContent: string): string;
/**
 * Main orchestrator for signal processing.
 *
 * Detects signal syntax, wraps scripts in setup functions,
 * injects the signals runtime and browser runtime.
 */
export declare function processSignals(template: string, options: StxOptions, filePath?: string): Promise<string>;
/**
 * Parsed form of a loop expression (`@for` / `@foreach` argument).
 *
 * `style: 'as'` — "iterable as item" / "iterable as idx => item" / "iterable as (item, idx)"
 * `style: 'in'` — "item in iterable" / "(item, idx) in iterable" / "item of iterable"
 * `style: 'unknown'` — fell through all parsers; iterable is `null`
 */
export declare interface ParsedLoopExpression {
  style: 'as' | 'in' | 'unknown'
  iterable: string | null
  itemVar: string | null
  indexVar: string | null
}
