import { Pipe, inject } from '@angular/core';
import { extend } from '@jscrpt/common';
import { LAYOUT_DEFAULTS_OVERRIDE } from '../../misc/tokens';
import * as i0 from "@angular/core";
/**
 * Transforms ComponentsPaletteItem item to LayoutComponentDragData
 */
export class ToLayoutDragDataSAPipe {
    constructor() {
        //######################### protected properties #########################
        /**
         * Default options override service
         */
        this._defaultsOverride = inject(LAYOUT_DEFAULTS_OVERRIDE, { optional: true });
    }
    //######################### public methods - implementation of PipeTransform #########################
    /**
     * Transforms ComponentsPaletteItem item to LayoutComponentDragData
     * @param value - Palette item to be transformed
     */
    transform(value) {
        return {
            metadata: {
                id: '',
                displayName: this._defaultsOverride?.getDisplayName(value.itemSource.package, value.itemSource.name) || '',
                package: value.itemSource.package,
                name: value.itemSource.name,
                options: extend(true, {}, this._defaultsOverride?.getOptions(value.itemSource.package, value.itemSource.name, value.metadata.metaInfo?.defaultOptions) ?? value.metadata.metaInfo?.defaultOptions),
            },
            parentId: null,
            index: null,
        };
    }
}
ToLayoutDragDataSAPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: ToLayoutDragDataSAPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
ToLayoutDragDataSAPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.0.4", ngImport: i0, type: ToLayoutDragDataSAPipe, isStandalone: true, name: "toLayoutDragData" });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: ToLayoutDragDataSAPipe, decorators: [{
            type: Pipe,
            args: [{ name: 'toLayoutDragData', standalone: true }]
        }] });
//# sourceMappingURL=toLayoutDragData.pipe.js.map