import * as i0 from '@angular/core';
import { Directive, Optional, Inject, Input, HostBinding, Component, ChangeDetectionStrategy } from '@angular/core';
import { CommonModule } from '@angular/common';
import { SVG_OPTIONS_TOKEN } from '@ironsource/fusion-ui/components/svg';

class FlagBaseComponent {
    /**
     * Set country code ISO 3166-1-alpha-2 code of a country. https://www.iso.org/obp/ui/#search/code/
     * @param value
     */
    set countryCode(value) {
        this._countryCode = value;
    }
    /**
     * Set flag size
     * @default 16
     */
    set size(value) {
        this._size = value;
    }
    /**
     * Set border radius
     * @default 50%
     */
    set borderRadius(value) {
        this._borderRadius = value;
    }
    set rounded(value) {
        this._rounded = value;
    }
    /** @internal */
    set version(value) {
        this._version = value;
    }
    get size() {
        return this._size;
    }
    get borderRadius() {
        return this._rounded ? '50%' : this._borderRadius;
    }
    /** @internal */
    get flagUrl() {
        return `${this.svgOptions?.assetsPath}/flags/${this._version}/${this._countryCode}.svg`;
    }
    get width() {
        return this._size;
    }
    get height() {
        return this._size;
    }
    constructor(svgOptions) {
        this.svgOptions = svgOptions;
        this._size = 16;
        this._borderRadius = '50%';
        this._rounded = true;
        this._version = 'v4';
    }
    static { this.ɵfac = function FlagBaseComponent_Factory(t) { return new (t || FlagBaseComponent)(i0.ɵɵdirectiveInject(SVG_OPTIONS_TOKEN, 8)); }; }
    static { this.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: FlagBaseComponent, hostVars: 4, hostBindings: function FlagBaseComponent_HostBindings(rf, ctx) { if (rf & 2) {
            i0.ɵɵstyleProp("width", ctx.width, "px")("height", ctx.height, "px");
        } }, inputs: { countryCode: "countryCode", size: "size", borderRadius: "borderRadius", rounded: "rounded", version: "version" } }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(FlagBaseComponent, [{
        type: Directive
    }], () => [{ type: undefined, decorators: [{
                type: Optional
            }, {
                type: Inject,
                args: [SVG_OPTIONS_TOKEN]
            }] }], { countryCode: [{
            type: Input
        }], size: [{
            type: Input
        }], borderRadius: [{
            type: Input
        }], rounded: [{
            type: Input
        }], version: [{
            type: Input
        }], width: [{
            type: HostBinding,
            args: ['style.width.px']
        }], height: [{
            type: HostBinding,
            args: ['style.height.px']
        }] }); })();

class FlagComponent extends FlagBaseComponent {
    static { this.ɵfac = /*@__PURE__*/ (() => { let ɵFlagComponent_BaseFactory; return function FlagComponent_Factory(t) { return (ɵFlagComponent_BaseFactory || (ɵFlagComponent_BaseFactory = i0.ɵɵgetInheritedFactory(FlagComponent)))(t || FlagComponent); }; })(); }
    static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: FlagComponent, selectors: [["fusion-flag"]], standalone: true, features: [i0.ɵɵInheritDefinitionFeature, i0.ɵɵStandaloneFeature], decls: 2, vars: 3, consts: [["focusable", "false", "aria-hidden", "true", "viewBox", "0 0 24 24", 1, "fu-flag"]], template: function FlagComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵnamespaceSVG();
            i0.ɵɵelementStart(0, "svg", 0);
            i0.ɵɵelement(1, "image");
            i0.ɵɵelementEnd();
        } if (rf & 2) {
            i0.ɵɵstyleProp("border-radius", ctx.borderRadius);
            i0.ɵɵadvance();
            i0.ɵɵattribute("href", ctx.flagUrl);
        } }, dependencies: [CommonModule], styles: ["[_nghost-%COMP%]{margin:0;padding:0;-webkit-user-select:none;user-select:none;display:inline-block}[_nghost-%COMP%]   svg.fu-flag[_ngcontent-%COMP%]{fill:currentcolor;flex-shrink:0;transition:fill .2s cubic-bezier(.4,0,.2,1) 0ms}[_nghost-%COMP%]   svg.fu-flag[_ngcontent-%COMP%]   image[_ngcontent-%COMP%]{width:100%;height:auto}"], changeDetection: 0 }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(FlagComponent, [{
        type: Component,
        args: [{ selector: 'fusion-flag', standalone: true, imports: [CommonModule], template: `
        <svg class="fu-flag" focusable="false" aria-hidden="true" viewBox="0 0 24 24" [style.border-radius]="borderRadius">
            <image [attr.href]="flagUrl"></image>
        </svg>
    `, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{margin:0;padding:0;-webkit-user-select:none;user-select:none;display:inline-block}:host svg.fu-flag{fill:currentcolor;flex-shrink:0;transition:fill .2s cubic-bezier(.4,0,.2,1) 0ms}:host svg.fu-flag image{width:100%;height:auto}\n"] }]
    }], null, null); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(FlagComponent, { className: "FlagComponent", filePath: "flag.component.ts", lineNumber: 17 }); })();

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

export { FlagComponent };
//# sourceMappingURL=ironsource-fusion-ui-components-flag-v4.mjs.map
