import { Pipe } from '@angular/core';
import * as i0 from "@angular/core";
export class GroupByPipe {
    transform(items, property) {
        if (!items || !property) {
            return [];
        }
        const grouped = new Map();
        for (const item of items) {
            const key = String(item[property] || '');
            if (!grouped.has(key)) {
                grouped.set(key, []);
            }
            grouped.get(key).push(item);
        }
        return Array.from(grouped.entries())
            .map(([key, values]) => ({ key, values }))
            .sort((a, b) => a.key.localeCompare(b.key));
    }
    static ɵfac = function GroupByPipe_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || GroupByPipe)(); };
    static ɵpipe = /*@__PURE__*/ i0.ɵɵdefinePipe({ name: "groupBy", type: GroupByPipe, pure: true, standalone: false });
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(GroupByPipe, [{
        type: Pipe,
        args: [{
                standalone: false,
                name: 'groupBy'
            }]
    }], null, null); })();
//# sourceMappingURL=group-by.pipe.js.map