import { Component, Input } from '@angular/core';
import { coerceBooleanProperty } from '@angular/cdk/coercion';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "./currency-symbol.pipe";
import * as i3 from "./amount.pipe";
import * as i4 from "./amount-split.pipe";
export class AmountComponent {
    constructor() {
        this.currencyPosition = 'start';
        this.positiveSigh = false;
    }
    set setPositiveSigh(value) {
        this.positiveSigh = coerceBooleanProperty(value);
    }
    get precision() {
        if (this.currency) {
            switch (this.currency.toUpperCase()) {
                case 'BTC':
                case 'LTC':
                case 'XRP':
                case 'ETH':
                    return 4;
            }
        }
        return 2;
    }
    get isPositive() {
        return Number(this.amount) > 0;
    }
}
AmountComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: AmountComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
AmountComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.4", type: AmountComponent, selector: "ui-amount", inputs: { amount: "amount", currency: "currency", currencyPosition: "currencyPosition", setPositiveSigh: ["positiveSigh", "setPositiveSigh"] }, ngImport: i0, template: "<ng-container *ngIf=\"amount | amount:precision | amountSplit as amounts\">\n  <span *ngIf=\"amounts.sign else plus\">{{amounts.sign}}</span>\n  <span *ngIf=\"currencyPosition === 'start'\">{{currency | currencySymbol}}</span>\n  <span>{{amounts.int}}</span>\n  <span *ngIf=\"amounts.frac\">.{{amounts.frac}}</span>\n  <span *ngIf=\"currencyPosition === 'end'\">{{currency | currencySymbol}}</span>\n</ng-container>\n\n<ng-template #plus>\n  <span *ngIf=\"positiveSigh && isPositive\">+</span>\n</ng-template>\n", styles: [":host{white-space:nowrap}span{display:inline-block}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i2.CurrencySymbolPipe, name: "currencySymbol" }, { kind: "pipe", type: i3.AmountPipe, name: "amount" }, { kind: "pipe", type: i4.AmountSplitPipe, name: "amountSplit" }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: AmountComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ui-amount', template: "<ng-container *ngIf=\"amount | amount:precision | amountSplit as amounts\">\n  <span *ngIf=\"amounts.sign else plus\">{{amounts.sign}}</span>\n  <span *ngIf=\"currencyPosition === 'start'\">{{currency | currencySymbol}}</span>\n  <span>{{amounts.int}}</span>\n  <span *ngIf=\"amounts.frac\">.{{amounts.frac}}</span>\n  <span *ngIf=\"currencyPosition === 'end'\">{{currency | currencySymbol}}</span>\n</ng-container>\n\n<ng-template #plus>\n  <span *ngIf=\"positiveSigh && isPositive\">+</span>\n</ng-template>\n", styles: [":host{white-space:nowrap}span{display:inline-block}\n"] }]
        }], propDecorators: { amount: [{
                type: Input
            }], currency: [{
                type: Input
            }], currencyPosition: [{
                type: Input
            }], setPositiveSigh: [{
                type: Input,
                args: ['positiveSigh']
            }] } });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW1vdW50LmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3VpLWtpdC9zcmMvbGliL2Ftb3VudC9hbW91bnQuY29tcG9uZW50LnRzIiwiLi4vLi4vLi4vLi4vLi4vdWkta2l0L3NyYy9saWIvYW1vdW50L2Ftb3VudC5jb21wb25lbnQuaHRtbCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUMsU0FBUyxFQUFFLEtBQUssRUFBQyxNQUFNLGVBQWUsQ0FBQztBQUMvQyxPQUFPLEVBQUMscUJBQXFCLEVBQUMsTUFBTSx1QkFBdUIsQ0FBQzs7Ozs7O0FBTzVELE1BQU0sT0FBTyxlQUFlO0lBTDVCO1FBUVcscUJBQWdCLEdBQW9CLE9BQU8sQ0FBQztRQU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