import { Component, ChangeDetectionStrategy, ViewChild, Input, ViewEncapsulation } from '@angular/core';
import { SmzDocumentsService } from '../../services/smz-documents.service';
import moment from 'moment';
import * as i0 from "@angular/core";
import * as i1 from "../../services/smz-documents.service";
import * as i2 from "@angular/common";
import * as i3 from "@ngxs/store";
import * as i4 from "primeng/button";
export class SmzDocumentViewerComponent {
    constructor(el, documentService, location, cdr, store, renderer) {
        this.el = el;
        this.documentService = documentService;
        this.location = location;
        this.cdr = cdr;
        this.store = store;
        this.renderer = renderer;
        this.now = moment().format('MMMM Do YYYY, h:mm:ss a');
    }
    ngOnInit() {
    }
    ngOnChanges(changes) {
        if (changes.state.currentValue != null) {
            this.documentService.setZoom(this.state.viewer.zoom.initial);
            this.documentService.setFilename(this.state.export.filename);
            this.documentService.setState(this.state);
        }
    }
    ngAfterViewInit() {
        this.documentService.setPaperElement(this.paperElement);
        if (this.state?.isDebug) {
            console.log('Document State', this.state);
        }
    }
    goBack() {
        this.location.back();
    }
    ngOnDestroy() {
        this.documentService.setState(null);
        this.documentService.setPaperElement(null);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: SmzDocumentViewerComponent, deps: [{ token: i0.ElementRef }, { token: i1.SmzDocumentsService }, { token: i2.Location }, { token: i0.ChangeDetectorRef }, { token: i3.Store }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.5", type: SmzDocumentViewerComponent, selector: "document-viewer", inputs: { state: "state" }, providers: [SmzDocumentsService], viewQueries: [{ propertyName: "paperElement", first: true, predicate: ["paper"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"grid grid-nogutter items-center justify-start flex-col gap-2\" [ngClass]=\"state.viewer.container.styleClass\">\r\n\r\n    <div class=\"grid grid-nogutter items-start justify-start gap-2\">\r\n\r\n        <ng-container *ngIf=\"state.viewer.zoom.isEnabled\">\r\n            <button pButton type=\"button\" class=\"p-button p-button-outlined\" label=\"ZOOM -\" (click)=\"documentService.lessZoom()\"></button>\r\n            <button pButton type=\"button\" class=\"p-button p-button-outlined\" label=\"100%\" (click)=\"documentService.restoreZoom()\"></button>\r\n            <button pButton type=\"button\" class=\"p-button p-button-outlined\" label=\"ZOOM +\" (click)=\"documentService.moreZoom()\"></button>\r\n        </ng-container>\r\n        <button *ngIf=\"state.viewer.open.isEnabled\" pButton type=\"button\" class=\"p-button p-button-success\" [label]=\"state.viewer.open.label\" (click)=\"documentService.generate('open')\" [disabled]=\"state.isDebug\"></button>\r\n        <button *ngIf=\"state.viewer.print.isEnabled\" pButton type=\"button\" class=\"p-button p-button-success\" [label]=\"state.viewer.print.label\" (click)=\"documentService.generate('print')\" [disabled]=\"state.isDebug\"></button>\r\n        <button *ngIf=\"state.viewer.download.isEnabled\" pButton type=\"button\" class=\"p-button p-button-success\" [label]=\"state.viewer.download.label\" (click)=\"documentService.generate('download')\" [disabled]=\"state.isDebug\"></button>\r\n    </div>\r\n\r\n    <div class=\"pager\" [ngClass]=\"state.viewer.paper.styleClass\"\r\n        [style.transform]=\"'scale(' + documentService.zoom + ')'\"\r\n        [style.width.pt]=\"state.viewer.paper.ptWidth\"\r\n        [style.padding-left]=\"state.export.margin.left + 'pt !important'\"\r\n        [style.padding-right]=\"state.export.margin.right + 'pt !important'\"\r\n        [style.padding-top]=\"state.export.margin.top + 'pt !important'\"\r\n        [style.padding-bottom]=\"state.export.margin.bottom + 'pt !important'\"\r\n        >\r\n        <div #paper [style.font-family]=\"state.globals.font.family\" [style.padding]=\"state.export.paddingCompensation\">\r\n            <ng-content select=\"header\"></ng-content>\r\n            <ng-content select=\"content\"></ng-content>\r\n        </div>\r\n    </div>\r\n\r\n</div>", styles: [".pager{transform-origin:top center;transition:transform .1s ease-in-out;margin-top:0;margin-left:auto;margin-right:auto}.footer-container{position:absolute;bottom:14.173px;right:22.6768px;font-size:\"0.8px\"}.sticky-header{position:absolute}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain"] }], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: SmzDocumentViewerComponent, decorators: [{
            type: Component,
            args: [{ selector: 'document-viewer', changeDetection: ChangeDetectionStrategy.Default, encapsulation: ViewEncapsulation.None, providers: [SmzDocumentsService], template: "<div class=\"grid grid-nogutter items-center justify-start flex-col gap-2\" [ngClass]=\"state.viewer.container.styleClass\">\r\n\r\n    <div class=\"grid grid-nogutter items-start justify-start gap-2\">\r\n\r\n        <ng-container *ngIf=\"state.viewer.zoom.isEnabled\">\r\n            <button pButton type=\"button\" class=\"p-button p-button-outlined\" label=\"ZOOM -\" (click)=\"documentService.lessZoom()\"></button>\r\n            <button pButton type=\"button\" class=\"p-button p-button-outlined\" label=\"100%\" (click)=\"documentService.restoreZoom()\"></button>\r\n            <button pButton type=\"button\" class=\"p-button p-button-outlined\" label=\"ZOOM +\" (click)=\"documentService.moreZoom()\"></button>\r\n        </ng-container>\r\n        <button *ngIf=\"state.viewer.open.isEnabled\" pButton type=\"button\" class=\"p-button p-button-success\" [label]=\"state.viewer.open.label\" (click)=\"documentService.generate('open')\" [disabled]=\"state.isDebug\"></button>\r\n        <button *ngIf=\"state.viewer.print.isEnabled\" pButton type=\"button\" class=\"p-button p-button-success\" [label]=\"state.viewer.print.label\" (click)=\"documentService.generate('print')\" [disabled]=\"state.isDebug\"></button>\r\n        <button *ngIf=\"state.viewer.download.isEnabled\" pButton type=\"button\" class=\"p-button p-button-success\" [label]=\"state.viewer.download.label\" (click)=\"documentService.generate('download')\" [disabled]=\"state.isDebug\"></button>\r\n    </div>\r\n\r\n    <div class=\"pager\" [ngClass]=\"state.viewer.paper.styleClass\"\r\n        [style.transform]=\"'scale(' + documentService.zoom + ')'\"\r\n        [style.width.pt]=\"state.viewer.paper.ptWidth\"\r\n        [style.padding-left]=\"state.export.margin.left + 'pt !important'\"\r\n        [style.padding-right]=\"state.export.margin.right + 'pt !important'\"\r\n        [style.padding-top]=\"state.export.margin.top + 'pt !important'\"\r\n        [style.padding-bottom]=\"state.export.margin.bottom + 'pt !important'\"\r\n        >\r\n        <div #paper [style.font-family]=\"state.globals.font.family\" [style.padding]=\"state.export.paddingCompensation\">\r\n            <ng-content select=\"header\"></ng-content>\r\n            <ng-content select=\"content\"></ng-content>\r\n        </div>\r\n    </div>\r\n\r\n</div>", styles: [".pager{transform-origin:top center;transition:transform .1s ease-in-out;margin-top:0;margin-left:auto;margin-right:auto}.footer-container{position:absolute;bottom:14.173px;right:22.6768px;font-size:\"0.8px\"}.sticky-header{position:absolute}\n"] }]
        }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.SmzDocumentsService }, { type: i2.Location }, { type: i0.ChangeDetectorRef }, { type: i3.Store }, { type: i0.Renderer2 }], propDecorators: { paperElement: [{
                type: ViewChild,
                args: ['paper', { static: true }]
            }], state: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64, 