import { Component, Input, TemplateRef, ViewChild } from '@angular/core';
import { BsSnackbarService } from '@mintplayer/ng-bootstrap/snackbar';
import * as i0 from "@angular/core";
import * as i1 from "@mintplayer/ng-bootstrap/snackbar";
import * as i2 from "@mintplayer/ng-bootstrap/copy";
import * as i3 from "ngx-highlightjs";
export class BsCodeSnippetComponent {
    constructor(snackbarService) {
        this.snackbarService = snackbarService;
        this.codeToCopy = '';
        this.languages = null;
        this.lineNumbers = false;
    }
    copiedHtml() {
        const snackbar = this.snackbarService.show(this.copiedTemplate);
        setTimeout(() => this.snackbarService.hide(snackbar), 3000);
    }
}
BsCodeSnippetComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BsCodeSnippetComponent, deps: [{ token: i1.BsSnackbarService }], target: i0.ɵɵFactoryTarget.Component });
BsCodeSnippetComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: BsCodeSnippetComponent, selector: "bs-code-snippet", inputs: { codeToCopy: "codeToCopy", languages: "languages", lineNumbers: "lineNumbers" }, viewQueries: [{ propertyName: "copiedTemplate", first: true, predicate: ["copiedTemplate"], descendants: true }], ngImport: i0, template: "<div class=\"position-relative\">\n    <button #copyBtn [bsCopy]=\"codeToCopy\" (bsCopied)=\"copiedHtml()\" class=\"btn btn-link rounded-0 text-light position-absolute copy-btn\">\n        Copy html\n    </button>\n    <pre class=\"white-space-normal\">\n        <code class=\"d-block white-space-pre\" [highlight]=\"codeToCopy\" [lineNumbers]=\"lineNumbers\" [languages]=\"languages ?? undefined!\"></code>\n    </pre>\n    <ng-template #copiedTemplate>\n        <div class=\"p-3\">Copied!</div>\n    </ng-template>\n</div>", styles: [".copy-btn{right:0}\n"], dependencies: [{ kind: "directive", type: i2.BsCopyDirective, selector: "[bsCopy]", inputs: ["bsCopy"], outputs: ["bsCopied"] }, { kind: "directive", type: i3.Highlight, selector: "[highlight]", inputs: ["highlight", "languages", "lineNumbers"], outputs: ["highlighted"] }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BsCodeSnippetComponent, decorators: [{
            type: Component,
            args: [{ selector: 'bs-code-snippet', template: "<div class=\"position-relative\">\n    <button #copyBtn [bsCopy]=\"codeToCopy\" (bsCopied)=\"copiedHtml()\" class=\"btn btn-link rounded-0 text-light position-absolute copy-btn\">\n        Copy html\n    </button>\n    <pre class=\"white-space-normal\">\n        <code class=\"d-block white-space-pre\" [highlight]=\"codeToCopy\" [lineNumbers]=\"lineNumbers\" [languages]=\"languages ?? undefined!\"></code>\n    </pre>\n    <ng-template #copiedTemplate>\n        <div class=\"p-3\">Copied!</div>\n    </ng-template>\n</div>", styles: [".copy-btn{right:0}\n"] }]
        }], ctorParameters: function () { return [{ type: i1.BsSnackbarService }]; }, propDecorators: { codeToCopy: [{
                type: Input
            }], languages: [{
                type: Input
            }], lineNumbers: [{
                type: Input
            }], copiedTemplate: [{
                type: ViewChild,
                args: ['copiedTemplate']
            }] } });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29kZS1zbmlwcGV0LmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvbWludHBsYXllci1uZy1ib290c3RyYXAvY29kZS1zbmlwcGV0L3NyYy9jb2RlLXNuaXBwZXQuY29tcG9uZW50LnRzIiwiLi4vLi4vLi4vLi4vLi4vLi4vbGlicy9taW50cGxheWVyLW5nLWJvb3RzdHJhcC9jb2RlLXNuaXBwZXQvc3JjL2NvZGUtc25pcHBldC5jb21wb25lbnQuaHRtbCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsU0FBUyxFQUFFLEtBQUssRUFBRSxXQUFXLEVBQUUsU0FBUyxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQ3pFLE9BQU8sR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