import { DOCUMENT, CommonModule } from '@angular/common';
import * as i0 from '@angular/core';
import { EventEmitter, Directive, Inject, Input, Output, HostListener, NgModule } from '@angular/core';

class BsCopyDirective {
    constructor(doc) {
        this.bsCopy = null;
        this.bsCopied = new EventEmitter();
        this.doc = doc;
    }
    click(event) {
        event.preventDefault();
        const listener = (e) => {
            var _a;
            if (!!this.bsCopy && !!window) {
                const clipboard = e.clipboardData || window['clipboardData'] || null;
                if (clipboard) {
                    clipboard.setData('text', (_a = this.bsCopy) === null || _a === void 0 ? void 0 : _a.toString());
                    e.preventDefault();
                    this.bsCopied.emit(this.bsCopy);
                }
            }
        };
        this.doc.addEventListener('copy', listener, false);
        this.doc.execCommand('copy');
        this.doc.removeEventListener('copy', listener, false);
    }
}
BsCopyDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BsCopyDirective, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Directive });
BsCopyDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.7", type: BsCopyDirective, selector: "[bsCopy]", inputs: { bsCopy: "bsCopy" }, outputs: { bsCopied: "bsCopied" }, host: { listeners: { "click": "click($event)" } }, ngImport: i0 });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BsCopyDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[bsCopy]',
                }]
        }], ctorParameters: function () {
        return [{ type: undefined, decorators: [{
                        type: Inject,
                        args: [DOCUMENT]
                    }] }];
    }, propDecorators: { bsCopy: [{
                type: Input
            }], bsCopied: [{
                type: Output
            }], click: [{
                type: HostListener,
                args: ['click', ['$event']]
            }] } });

class BsCopyModule {
}
BsCopyModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BsCopyModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
BsCopyModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.7", ngImport: i0, type: BsCopyModule, declarations: [BsCopyDirective], imports: [CommonModule], exports: [BsCopyDirective] });
BsCopyModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BsCopyModule, imports: [CommonModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BsCopyModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        BsCopyDirective
                    ],
                    imports: [
                        CommonModule
                    ],
                    exports: [
                        BsCopyDirective
                    ]
                }]
        }] });

/**
 * Generated bundle index. Do not edit.
 */

export { BsCopyDirective, BsCopyModule };
//# sourceMappingURL=mintplayer-ng-bootstrap-copy.mjs.map
