package utils

import (
	"fmt"
	"strings"
)

func ParseDataURL(dataURL string) (string, string, error) {
	if !strings.HasPrefix(dataURL, "data:") {
		return "", "", fmt.Errorf("not a data URL")
	}

	parts := strings.Split(dataURL[5:], ";base64,")
	if len(parts) != 2 {
		return "", "", fmt.Errorf("invalid data URL format")
	}

	return parts[0], parts[1], nil
}
