export function createId() {
    if (typeof crypto !== "undefined" && "randomUUID" in crypto) {
        return crypto.randomUUID();
    }
    return Math.random().toString(16).slice(2) + Date.now().toString(16);
}
export function createRule(name = "New rule") {
    return {
        uid: createId(),
        name,
        conditions: null,
        actions: [],
    };
}
export function createLeafCondition(definitionItemId) {
    return {
        kind: "leaf",
        definitionItemId,
        uniqueId: createId(),
        parameters: {},
    };
}
export function createCompositeCondition(op, children = []) {
    return {
        kind: "composite",
        op,
        children,
    };
}
export function createAction(definitionItemId) {
    return {
        uid: createId(),
        definitionItemId,
        parameters: {},
    };
}
//# sourceMappingURL=utils.js.map