/**
 *
 * @ai-apps/angular v2.147.1-next.0 | radio-setting.component.js
 *
 * Copyright 2014, 2022 IBM
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0

 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


import { Component, EventEmitter, Input, Output } from '@angular/core';
import { isObservable, of } from 'rxjs';
import * as i0 from "@angular/core";
import * as i1 from "carbon-components-angular";
import * as i2 from "@angular/common";
function RadioSettingComponent_ibm_radio_1_Template(rf, ctx) { if (rf & 1) {
    const _r3 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "ibm-radio", 1);
    i0.ɵɵlistener("change", function RadioSettingComponent_ibm_radio_1_Template_ibm_radio_change_0_listener($event) { i0.ɵɵrestoreView(_r3); const ctx_r2 = i0.ɵɵnextContext(); return ctx_r2.onChange($event); });
    i0.ɵɵtext(1);
    i0.ɵɵpipe(2, "async");
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const option_r1 = ctx.$implicit;
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵproperty("checked", option_r1.value === ctx_r0.active)("value", option_r1.value);
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(2, 3, ctx_r0.getContent(option_r1)), " ");
} }
export class RadioSettingComponent {
    constructor() {
        this.activeChange = new EventEmitter();
    }
    getContent(option) {
        if (isObservable(option.content)) {
            return option.content;
        }
        return of(option.content);
    }
    onChange(event) {
        this.activeChange.emit({ active: event.value });
    }
}
RadioSettingComponent.ɵfac = function RadioSettingComponent_Factory(t) { return new (t || RadioSettingComponent)(); };
RadioSettingComponent.ɵcmp = i0.ɵɵdefineComponent({ type: RadioSettingComponent, selectors: [["sc-radio-setting"], ["ai-radio-setting"]], inputs: { options: "options", active: "active" }, outputs: { activeChange: "activeChange" }, decls: 2, vars: 1, consts: [[3, "checked", "value", "change", 4, "ngFor", "ngForOf"], [3, "checked", "value", "change"]], template: function RadioSettingComponent_Template(rf, ctx) { if (rf & 1) {
        i0.ɵɵelementStart(0, "ibm-radio-group");
        i0.ɵɵtemplate(1, RadioSettingComponent_ibm_radio_1_Template, 3, 5, "ibm-radio", 0);
        i0.ɵɵelementEnd();
    } if (rf & 2) {
        i0.ɵɵadvance(1);
        i0.ɵɵproperty("ngForOf", ctx.options);
    } }, directives: [i1.RadioGroup, i2.NgForOf, i1.Radio], pipes: [i2.AsyncPipe], encapsulation: 2 });
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(RadioSettingComponent, [{
        type: Component,
        args: [{
                selector: 'sc-radio-setting, ai-radio-setting',
                template: `
    <ibm-radio-group>
      <ibm-radio
        *ngFor="let option of options"
        [checked]="option.value === active"
        [value]="option.value"
        (change)="onChange($event)"
      >
        {{ getContent(option) | async }}
      </ibm-radio>
    </ibm-radio-group>
  `,
            }]
    }], null, { options: [{
            type: Input
        }], active: [{
            type: Input
        }], activeChange: [{
            type: Output
        }] }); })();
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmFkaW8tc2V0dGluZy5jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvdG9vbGtpdC90YWJsZS1zZXR0aW5ncy9zZXR0aW5ncy9yYWRpby1zZXR0aW5nLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsU0FBUyxFQUFFLFlBQVksRUFBRSxLQUFLLEVBQUUsTUFBTSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBRXZFLE9BQU8sRUFBRSxZQUFZLEVBQWMsRUFBRSxFQUFFL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