# 🚀 Online WASM Compilation Guide

Since Rust is not available in the current environment, here's how to compile the WASM module:

## Option 1: Local Compilation (Recommended)

```bash
# Install Rust (one-time)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Add WASM target
rustup target add wasm32-unknown-unknown

# Install wasm-pack
cargo install wasm-pack

# Build WASM
cd fikoyt-wasm
wasm-pack build --target web --out-dir pkg --release

# Copy to assets
cp -r pkg/* ../public/assets/fikoyt-wasm/
```

## Option 2: GitHub Actions (CI/CD)

Create `.github/workflows/build-wasm.yml`:

```yaml
name: Build WASM

on:
  push:
    paths:
      - 'fikoyt-wasm/**'

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: Install Rust
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          target: wasm32-unknown-unknown

      - name: Install wasm-pack
        run: cargo install wasm-pack

      - name: Build WASM
        run: |
          cd fikoyt-wasm
          wasm-pack build --target web --out-dir pkg --release

      - name: Copy artifacts
        run: cp -r fikoyt-wasm/pkg/* public/assets/fikoyt-wasm/

      - name: Commit
        run: |
          git config user.name github-actions
          git config user.email github-actions@github.com
          git add public/assets/fikoyt-wasm/
          git commit -m "Update WASM build" || echo "No changes"
          git push
```

## Option 3: Docker Build

```bash
docker run --rm -v $(pwd)/fikoyt-wasm:/src -w /src rust:latest bash -c "
  rustup target add wasm32-unknown-unknown &&
  cargo install wasm-pack &&
  wasm-pack build --target web --out-dir pkg --release
"

cp -r fikoyt-wasm/pkg/* public/assets/fikoyt-wasm/
```

## Option 4: Cloud Build Service

Use one of these services:
- **Vercel:** Add build step to `vercel.json`
- **Netlify:** Add to `netlify.toml`
- **CloudFlare Pages:** Add to build config

## What Gets Generated

After successful build:
- `fikoyt_wasm_bg.wasm` (~120-150 KB)
- `fikoyt_wasm_bg.js` (glue code)
- `fikoyt_wasm.js` (exports)
- `fikoyt_wasm.d.ts` (TypeScript)

## Quick Test

After compilation, test with:
```bash
npm run serve
# Check console for: "✅ WASM module loaded"
```
