/* ─── types ─── */
/* ─── helpers ─── */
let _sid = 0;
const sid = () => `s${++_sid}`;
const cloneShapes = (s) => JSON.parse(JSON.stringify(s));
const downloadBlob = (blob, name) => {
    const a = document.createElement("a");
    const url = URL.createObjectURL(blob);
    a.href = url;
    a.download = name;
    a.click();
    setTimeout(() => URL.revokeObjectURL(url), 3000);
};
const TOOLS = [
    { id: "pointer", icon: "↖", label: "Select", key: "V" },
    { id: "rect", icon: "▢", label: "Rectangle", key: "R" },
    { id: "roundrect", icon: "▣", label: "Rounded Rect", key: "U" },
    { id: "ellipse", icon: "◯", label: "Ellipse", key: "C" },
    { id: "line", icon: "╱", label: "Line", key: "L" },
    { id: "arrow", icon: "→", label: "Arrow", key: "A" },
    { id: "polygon", icon: "⬡", label: "Polygon", key: "G" },
    { id: "star", icon: "★", label: "Star", key: "S" },
    { id: "pen", icon: "✎", label: "Pen (polyline)", key: "P" },
    { id: "text", icon: "T", label: "Text", key: "T" },
];
const FONTS = [
    "sans-serif",
    "serif",
    "monospace",
    "cursive",
    "fantasy",
    "Arial",
    "Georgia",
    "Courier New",
    "Times New Roman",
    "Verdana",
];
/** Generate polygon points string for n-sided regular polygon */
function polygonPoints(cx, cy, r, sides, rotation) {
    const pts = [];
    for (let i = 0; i < sides; i++) {
        const angle = (Math.PI * 2 * i) / sides - Math.PI / 2 + (rotation * Math.PI) / 180;
        pts.push(`${cx + r * Math.cos(angle)},${cy + r * Math.sin(angle)}`);
    }
    return pts.join(" ");
}
/** Generate star points string */
function starPoints(cx, cy, outerR, innerR, points, rotation) {
    const pts = [];
    for (let i = 0; i < points * 2; i++) {
        const angle = (Math.PI * i) / points - Math.PI / 2 + (rotation * Math.PI) / 180;
        const r = i % 2 === 0 ? outerR : innerR;
        pts.push(`${cx + r * Math.cos(angle)},${cy + r * Math.sin(angle)}`);
    }
    return pts.join(" ");
}
/** Snap a value to grid */
function snapToGrid(val, gridSize) {
    return Math.round(val / gridSize) * gridSize;
}

export { FONTS, TOOLS, cloneShapes, downloadBlob, polygonPoints, sid, snapToGrid, starPoints };
//# sourceMappingURL=vectorEditorTypes.js.map
