import { Component, EventEmitter, Input, Output } from '@angular/core';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "../more-options/more-options.component";
function JournalPreviewComponent_figure_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "figure", 15);
    i0.ɵɵelementStart(1, "a");
    i0.ɵɵelement(2, "img", 16);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance(2);
    i0.ɵɵpropertyInterpolate2("src", "", ctx_r0.envUrl, "", ctx_r0.authorAvatar, "", i0.ɵɵsanitizeUrl);
} }
function JournalPreviewComponent_a_7_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "a", 17);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext();
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate1(" ", ctx_r1.authorName, " ");
} }
function JournalPreviewComponent_div_8_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 18);
    i0.ɵɵtext(1);
    i0.ɵɵpipe(2, "date");
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r2 = i0.ɵɵnextContext();
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind2(2, 1, ctx_r2.postDate, "medium"));
} }
function JournalPreviewComponent_figure_11_div_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 22);
    i0.ɵɵtext(1, "Sensitive Content ");
    i0.ɵɵelementStart(2, "small");
    i0.ɵɵtext(3, "Click to view");
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} }
function JournalPreviewComponent_figure_11_Template(rf, ctx) { if (rf & 1) {
    const _r7 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "figure", 19);
    i0.ɵɵlistener("click", function JournalPreviewComponent_figure_11_Template_figure_click_0_listener() { i0.ɵɵrestoreView(_r7); const ctx_r6 = i0.ɵɵnextContext(); return ctx_r6.onClickToggleSensitive(); });
    i0.ɵɵelement(1, "img", 20);
    i0.ɵɵtemplate(2, JournalPreviewComponent_figure_11_div_2_Template, 4, 0, "div", 21);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r3 = i0.ɵɵnextContext();
    i0.ɵɵclassProp("pb-sensitive", ctx_r3.photos[0] == null ? null : ctx_r3.photos[0].sensitive);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("src", ctx_r3.photos[0] == null ? null : ctx_r3.photos[0].variant_lg_URL, i0.ɵɵsanitizeUrl);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r3.photos[0] == null ? null : ctx_r3.photos[0].sensitive);
} }
function JournalPreviewComponent_div_13_ins_more_options_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "ins-more-options", 28);
} if (rf & 2) {
    const ctx_r8 = i0.ɵɵnextContext(2);
    i0.ɵɵproperty("options", ctx_r8.selectedCommunities);
} }
function JournalPreviewComponent_div_13_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 23);
    i0.ɵɵelementStart(1, "a", 24);
    i0.ɵɵelement(2, "img", 25);
    i0.ɵɵelementStart(3, "span", 26);
    i0.ɵɵtext(4);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
    i0.ɵɵtemplate(5, JournalPreviewComponent_div_13_ins_more_options_5_Template, 1, 1, "ins-more-options", 27);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r4 = i0.ɵɵnextContext();
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("src", ctx_r4.selectedCommunities[0] == null ? null : ctx_r4.selectedCommunities[0].assets == null ? null : ctx_r4.selectedCommunities[0].assets.logo_image, i0.ɵɵsanitizeUrl);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(ctx_r4.selectedCommunities[0] == null ? null : ctx_r4.selectedCommunities[0].name);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r4.selectedCommunities.length > 1);
} }
export class JournalPreviewComponent {
    constructor() {
        this.editPost = new EventEmitter();
        this.publishPost = new EventEmitter();
        this.postBody = '';
        this.authorName = '';
        this.authorAvatar = '';
        this.postTitle = '';
        this.selectedCommunities = [];
        this.disablePublish = false;
        this.photos = [];
        this.toggleMoreCommunityList = false;
        this.isSensitiveOnLoad = false;
    }
    ngOnInit() {
        var _a, _b;
        this.isSensitiveOnLoad = ((_a = this.photos) === null || _a === void 0 ? void 0 : _a.length) ? (_b = this.photos[0]) === null || _b === void 0 ? void 0 : _b.sensitive : false;
    }
    onEditPost() {
        this.editPost.emit();
    }
    onPublishPost() {
        this.publishPost.emit();
    }
    onToggleMoreCommunityList() {
        this.toggleMoreCommunityList = !this.toggleMoreCommunityList;
    }
    onCloseMoreCommunityList() {
        this.toggleMoreCommunityList = false;
    }
    onClickToggleSensitive() {
        var _a;
        if (this.isSensitiveOnLoad && this.photos.length) {
            this.photos[0].sensitive = !((_a = this.photos[0]) === null || _a === void 0 ? void 0 : _a.sensitive);
        }
    }
}
JournalPreviewComponent.ɵfac = function JournalPreviewComponent_Factory(t) { return new (t || JournalPreviewComponent)(); };
JournalPreviewComponent.ɵcmp = i0.ɵɵdefineComponent({ type: JournalPreviewComponent, selectors: [["ins-journal-preview"]], inputs: { postBody: "postBody", authorName: "authorName", authorAvatar: "authorAvatar", postDate: "postDate", envUrl: "envUrl", postTitle: "postTitle", selectedCommunities: "selectedCommunities", joinedDate: "joinedDate", disablePublish: "disablePublish", photos: "photos" }, outputs: { editPost: "editPost", publishPost: "publishPost" }, decls: 19, vars: 8, consts: [[1, "preview-title"], [1, "post-block"], [1, "pb-head"], [1, "pb-profile"], ["class", "pb-avatar", 4, "ngIf"], [1, "pb-meta"], ["class", "pb-username", 4, "ngIf"], ["class", "pb-stamp", 4, "ngIf"], [1, "pb-title"], ["class", "pb-image", "id", "preview-photo", 3, "pb-sensitive", "click", 4, "ngIf"], ["id", "post_body", 1, "pb-desc", 3, "innerHTML"], ["class", "pb-condition", 4, "ngIf"], [1, "preview-foot"], ["type", "button", "id", "edit_btn", 1, "btn-preview", 3, "click"], ["type", "button", "id", "publish_btn", 1, "btn-publish", 3, "disabled", "click"], [1, "pb-avatar"], ["alt", "avatar", 3, "src"], [1, "pb-username"], [1, "pb-stamp"], ["id", "preview-photo", 1, "pb-image", 3, "click"], ["alt", "post photo", 3, "src"], ["class", "pb-i-overlay", 4, "ngIf"], [1, "pb-i-overlay"], [1, "pb-condition"], [1, "pb-community"], ["alt", "image", 3, "src"], ["id", "community_name"], ["label", "name", "singularHeading", "community", "pluralHeading", "communities", 3, "options", 4, "ngIf"], ["label", "name", "singularHeading", "community", "pluralHeading", "communities", 3, "options"]], template: function JournalPreviewComponent_Template(rf, ctx) { if (rf & 1) {
        i0.ɵɵelementStart(0, "h1", 0);
        i0.ɵɵtext(1, "Preview Journal");
        i0.ɵɵelementEnd();
        i0.ɵɵelementStart(2, "section", 1);
        i0.ɵɵelementStart(3, "div", 2);
        i0.ɵɵelementStart(4, "div", 3);
        i0.ɵɵtemplate(5, JournalPreviewComponent_figure_5_Template, 3, 2, "figure", 4);
        i0.ɵɵelementStart(6, "div", 5);
        i0.ɵɵtemplate(7, JournalPreviewComponent_a_7_Template, 2, 1, "a", 6);
        i0.ɵɵtemplate(8, JournalPreviewComponent_div_8_Template, 3, 4, "div", 7);
        i0.ɵɵelementEnd();
        i0.ɵɵelementEnd();
        i0.ɵɵelementEnd();
        i0.ɵɵelementStart(9, "h1", 8);
        i0.ɵɵtext(10);
        i0.ɵɵelementEnd();
        i0.ɵɵtemplate(11, JournalPreviewComponent_figure_11_Template, 3, 4, "figure", 9);
        i0.ɵɵelement(12, "article", 10);
        i0.ɵɵtemplate(13, JournalPreviewComponent_div_13_Template, 6, 3, "div", 11);
        i0.ɵɵelementEnd();
        i0.ɵɵelementStart(14, "div", 12);
        i0.ɵɵelementStart(15, "button", 13);
        i0.ɵɵlistener("click", function JournalPreviewComponent_Template_button_click_15_listener() { return ctx.onEditPost(); });
        i0.ɵɵtext(16, "Edit");
        i0.ɵɵelementEnd();
        i0.ɵɵelementStart(17, "button", 14);
        i0.ɵɵlistener("click", function JournalPreviewComponent_Template_button_click_17_listener() { return ctx.onPublishPost(); });
        i0.ɵɵtext(18, "Publish");
        i0.ɵɵelementEnd();
        i0.ɵɵelementEnd();
    } if (rf & 2) {
        i0.ɵɵadvance(5);
        i0.ɵɵproperty("ngIf", ctx.authorAvatar);
        i0.ɵɵadvance(2);
        i0.ɵɵproperty("ngIf", ctx.authorName);
        i0.ɵɵadvance(1);
        i0.ɵɵproperty("ngIf", ctx.postDate);
        i0.ɵɵadvance(2);
        i0.ɵɵtextInterpolate(ctx.postTitle);
        i0.ɵɵadvance(1);
        i0.ɵɵproperty("ngIf", ctx.photos == null ? null : ctx.photos.length);
        i0.ɵɵadvance(1);
        i0.ɵɵproperty("innerHTML", ctx.postBody, i0.ɵɵsanitizeHtml);
        i0.ɵɵadvance(1);
        i0.ɵɵproperty("ngIf", ctx.selectedCommunities == null ? null : ctx.selectedCommunities.length);
        i0.ɵɵadvance(4);
        i0.ɵɵproperty("disabled", ctx.disablePublish);
    } }, directives: [i1.NgIf, i2.MoreOptionsComponent], pipes: [i1.DatePipe], styles: ["a[_ngcontent-%COMP%]{text-decoration:none}*[_ngcontent-%COMP%]{font-family:Lato,sans-serif;outline:0}.btn-preview[_ngcontent-%COMP%], .btn-publish[_ngcontent-%COMP%]{border:none;border-radius:.5rem;font-size:1rem;line-height:1;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;padding:0 1rem;height:2.25rem;transition:.3s ease-in-out}.btn-preview[_ngcontent-%COMP%]:hover, .btn-publish[_ngcontent-%COMP%]:hover{background:#f8f9fb}.btn-preview[disabled][_ngcontent-%COMP%], .btn-publish[disabled][_ngcontent-%COMP%]{background:#c6cbc9;color:#6e6f70;cursor:default}.btn-publish[_ngcontent-%COMP%]{background:#009dfc;color:#fff}.btn-publish[_ngcontent-%COMP%]:not([disabled]):hover{background:#008de3}.btn-preview[_ngcontent-%COMP%]{background:#005cc9;color:#fff}.btn-preview[_ngcontent-%COMP%]:not([disabled]):hover{background:#0050b0}@font-face{font-family:ins-icons;src:url(/assets/fonts/icons/ins-icons.ttf?nf14g1) format(\"truetype\"),url(/assets/fonts/icons/ins-icons.woff?nf14g1) format(\"woff\"),url(/assets/fonts/icons/ins-icons.svg?nf14g1#ins-icons) format(\"svg\");font-weight:400;font-style:normal;font-display:block}.ins-icon[_ngcontent-%COMP%], [class*=\" icn-\"][_ngcontent-%COMP%], [class^=icn-][_ngcontent-%COMP%]{font-family:ins-icons!important;speak:never;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icn-minus-o[_ngcontent-%COMP%]:before{content:\"\\e93a\"}.icn-disclaimer[_ngcontent-%COMP%]:before{content:\"\\e934\"}.icn-leave-community[_ngcontent-%COMP%]:before{content:\"\\e935\"}.icn-stethoscope[_ngcontent-%COMP%]:before{content:\"\\e936\"}.icn-join-community[_ngcontent-%COMP%]:before{content:\"\\e937\"}.icn-resources[_ngcontent-%COMP%]:before{content:\"\\e938\"}.icn-help[_ngcontent-%COMP%]:before{content:\"\\e939\"}.icn-checked[_ngcontent-%COMP%]:before{content:\"\\e933\"}.icn-plus[_ngcontent-%COMP%]:before{content:\"\\e932\"}.icn-expand[_ngcontent-%COMP%]:before{content:\"\\e931\"}.icn-Invite[_ngcontent-%COMP%]:before{content:\"\\e930\"}.icn-report[_ngcontent-%COMP%]:before{content:\"\\e92f\"}.icn-unfollow[_ngcontent-%COMP%]:before{content:\"\\e92e\"}.icn-block[_ngcontent-%COMP%]:before{content:\"\\e92d\"}.icn-trash[_ngcontent-%COMP%]:before{content:\"\\e92b\"}.icn-follow[_ngcontent-%COMP%]:before{content:\"\\e92c\"}.icn-lock[_ngcontent-%COMP%]:before{content:\"\\e92a\"}.icn-bolt-left[_ngcontent-%COMP%]:before{content:\"\\e925\"}.icn-bolt-right[_ngcontent-%COMP%]:before{content:\"\\e926\"}.icn-bolt-down[_ngcontent-%COMP%]:before{content:\"\\e927\"}.icn-bolt-up[_ngcontent-%COMP%]:before{content:\"\\e928\"}.icn-img-o[_ngcontent-%COMP%]:before{content:\"\\e929\"}.icn-tick[_ngcontent-%COMP%]:before{content:\"\\e924\"}.icn-tick-o[_ngcontent-%COMP%]:before{content:\"\\e923\"}.icn-cross-o[_ngcontent-%COMP%]:before{content:\"\\e922\"}.icn-plus-o[_ngcontent-%COMP%]:before{content:\"\\e921\"}.icn-hide[_ngcontent-%COMP%]:before{content:\"\\e920\"}.icn-menu[_ngcontent-%COMP%]:before{content:\"\\e900\"}.icn-more[_ngcontent-%COMP%]:before{content:\"\\e901\"}.icn-msgs[_ngcontent-%COMP%]:before{content:\"\\e902\"}.icn-pin[_ngcontent-%COMP%]:before{content:\"\\e903\"}.icn-reply[_ngcontent-%COMP%]:before{content:\"\\e904\"}.icn-search[_ngcontent-%COMP%]:before{content:\"\\e905\"}.icn-settings[_ngcontent-%COMP%]:before{content:\"\\e906\"}.icn-treatment[_ngcontent-%COMP%]:before{content:\"\\e907\"}.icn-aid[_ngcontent-%COMP%]:before{content:\"\\e908\"}.icn-apple[_ngcontent-%COMP%]:before{content:\"\\e909\"}.icn-arrow-down[_ngcontent-%COMP%]:before{content:\"\\e90a\"}.icn-arrow-up[_ngcontent-%COMP%]:before{content:\"\\e91d\"}.icn-arrow-left[_ngcontent-%COMP%]:before{content:\"\\e91e\"}.icn-arrow-right[_ngcontent-%COMP%]:before{content:\"\\e91f\"}.icn-bell[_ngcontent-%COMP%]:before{content:\"\\e90b\"}.icn-bookmark-o[_ngcontent-%COMP%]:before{content:\"\\e90c\"}.icn-calendar[_ngcontent-%COMP%]:before{content:\"\\e90d\"}.icn-check[_ngcontent-%COMP%]:before{content:\"\\e90e\"}.icn-community[_ngcontent-%COMP%]:before{content:\"\\e90f\"}.icn-d-arrow-up[_ngcontent-%COMP%]:before{content:\"\\e910\"}.icn-discussion[_ngcontent-%COMP%]:before{content:\"\\e911\"}.icn-edit[_ngcontent-%COMP%]:before{content:\"\\e912\"}.icn-facebook[_ngcontent-%COMP%]:before{content:\"\\e913\"}.icn-filters[_ngcontent-%COMP%]:before{content:\"\\e914\"}.icn-friends[_ngcontent-%COMP%]:before{content:\"\\e915\"}.icn-google[_ngcontent-%COMP%]:before{content:\"\\e916\"}.icn-heart[_ngcontent-%COMP%]:before{content:\"\\e917\"}.icn-home[_ngcontent-%COMP%]:before{content:\"\\e918\"}.icn-img[_ngcontent-%COMP%]:before{content:\"\\e919\"}.icn-inspire[_ngcontent-%COMP%]:before{content:\"\\e91a\"}.icn-journal[_ngcontent-%COMP%]:before{content:\"\\e91b\"}.icn-like[_ngcontent-%COMP%]:before{content:\"\\e91c\"}.pill-block[_ngcontent-%COMP%]{font-size:.875rem;padding:.5rem 1.25rem;border-radius:3.125rem;background:#f8f9fb;display:inline-block}.preview-title[_ngcontent-%COMP%]{font-family:Palanquin,sans-serif;color:#000;font-size:1.6875rem;font-weight:500;margin:0}.post-block[_ngcontent-%COMP%]{padding:1.875rem .625rem;border-bottom:1px solid #e2e5e4}.pb-head[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;margin-bottom:1.875rem}.pb-profile[_ngcontent-%COMP%]{display:flex;align-items:center}.pb-avatar[_ngcontent-%COMP%]{margin:0 .9375rem 0 0;width:2.125rem;height:2.125rem;border-radius:50%;border:1px solid #e2e5e4}.pb-avatar[_ngcontent-%COMP%]   img[_ngcontent-%COMP%]{width:100%;height:100%;-o-object-fit:cover;object-fit:cover;border-radius:100%;display:block}.pb-meta[_ngcontent-%COMP%]{flex:1 1 auto}.pb-username[_ngcontent-%COMP%]{color:#000;font-size:.875rem}.pb-stamp[_ngcontent-%COMP%]{font-size:.875rem;color:#6e6f70}@media (max-width:767px){.pb-stamp[_ngcontent-%COMP%]{font-size:.75rem}}.pb-ortho[_ngcontent-%COMP%]{display:flex;align-items:center}.pb-title[_ngcontent-%COMP%]{margin:0;font-weight:500;font-family:Palanquin,sans-serif;color:#000;font-size:1.4375rem}.pb-condition[_ngcontent-%COMP%]{display:flex;align-items:center;margin-top:1.25rem;position:relative}.pb-community[_ngcontent-%COMP%]{color:#6e6f70;display:flex;align-items:center}.pb-community[_ngcontent-%COMP%]   img[_ngcontent-%COMP%]{width:1.625rem;height:1.625rem;border-radius:50%;margin-right:.5rem;display:block;image-rendering:auto}.pill-block[_ngcontent-%COMP%]{margin-left:.9375rem;color:#000}.pill-block[_ngcontent-%COMP%]:hover{background:#eff1f1}.preview-foot[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-end;margin-top:3.125rem}.btn-publish[_ngcontent-%COMP%]{margin-left:1rem}.btn-preview[_ngcontent-%COMP%], .btn-publish[_ngcontent-%COMP%]{width:6.25rem}.pb-more[_ngcontent-%COMP%]{margin-left:.625rem;position:relative}.pb-more-btn[_ngcontent-%COMP%]{font-size:.875rem;color:#c6cbc9;cursor:pointer}.pb-more-btn[_ngcontent-%COMP%]:hover{text-decoration:underline}.pb-more-menu[_ngcontent-%COMP%]{position:absolute;bottom:100%;margin-top:.625rem;background:#fff;border:1px solid #e2e5e4;padding:1.25rem;border-radius:.3125rem;width:18.75rem;box-shadow:0 .125rem .3125rem 0 rgba(208,208,208,.5);flex-direction:column;align-items:flex-start;display:flex;z-index:11}@media (max-width:575px){.pb-more-menu[_ngcontent-%COMP%]{margin-left:-6.25rem}}.pb-more-menu[_ngcontent-%COMP%]   .pill-block[_ngcontent-%COMP%]{font-size:.75rem;margin:0}.pb-more-menu[_ngcontent-%COMP%]   .pill-block[_ngcontent-%COMP%]:not(:last-child){margin-bottom:.625rem}.pb-more-title[_ngcontent-%COMP%]{color:#005cc9;font-size:.875rem;font-weight:700;margin-bottom:.9375rem}.pb-more-close[_ngcontent-%COMP%]{font-size:1.25rem;color:#c6cbc9;position:absolute;right:0;top:0;line-height:.6;padding:.4375rem;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.pb-more-close[_ngcontent-%COMP%]:hover{color:#6e6f70}.pb-image[_ngcontent-%COMP%]{margin:1.25rem 0 0;position:relative;border-radius:.625rem;overflow:hidden;height:12.5rem}@media (max-width:767px){.pb-image[_ngcontent-%COMP%]{height:9.375rem}}.pb-image[_ngcontent-%COMP%]   img[_ngcontent-%COMP%]{width:100%;height:100%;-o-object-fit:cover;object-fit:cover;position:relative;z-index:0}.pb-image.pb-sensitive[_ngcontent-%COMP%]{cursor:pointer}.pb-image.pb-sensitive[_ngcontent-%COMP%]   img[_ngcontent-%COMP%]{-webkit-filter:blur(1.125rem);filter:blur(1.125rem)}.pb-i-overlay[_ngcontent-%COMP%]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);z-index:1;background:rgba(0,0,0,.5);padding:.3125rem .625rem;border-radius:.3125rem;font-weight:700;font-size:1.125rem;text-align:center;color:#fff}.pb-i-overlay[_ngcontent-%COMP%]   small[_ngcontent-%COMP%]{font-size:.875rem;display:block}"] });
/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(JournalPreviewComponent, [{
        type: Component,
        args: [{
                selector: 'ins-journal-preview',
                templateUrl: './journal-preview.component.html',
                styleUrls: ['./journal-preview.component.scss']
            }]
    }], function () { return []; }, { editPost: [{
            type: Output
        }], publishPost: [{
            type: Output
        }], postBody: [{
            type: Input
        }], authorName: [{
            type: Input
        }], authorAvatar: [{
            type: Input
        }], postDate: [{
            type: Input
        }], envUrl: [{
            type: Input
        }], postTitle: [{
            type: Input
        }], selectedCommunities: [{
            type: Input
        }], joinedDate: [{
            type: Input
        }], disablePublish: [{
            type: Input
        }], photos: [{
            type: Input
        }] }); })();
//# sourceMappingURL=data:application/json;base64, 