{"version":3,"sources":["./node_modules/ng2-currency-mask/fesm2015/ng2-currency-mask.js"],"names":[],"mappings":";;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAoJ;AACxG;AACmC;AAChC;;AAE/C,+BAA+B,4DAAc;;AAE7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,+DAA+D;AAC5E;AACA;AACA;AACA;AACA;AACA,qHAAqH,EAAE;AACvH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,qBAAqB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA,aAAa,gEAAiB;AAC9B,iBAAiB,gEAAU;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D;AAC5D;AACA;AACA;AACA,4FAA4F;AAC5F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,gCAAgC,OAAO,sDAAQ,EAAE,GAAG,OAAO,oDAAM,iCAAiC,GAAG;AAC1G,KAAK,OAAO,wDAAU,EAAE;AACxB,KAAK,OAAO,6DAAe;AAC3B;AACA,wDAAU;AACV,IAAI,2DAAK;AACT;AACA,wDAAU;AACV,IAAI,2DAAK;AACT;AACA,wDAAU;AACV,IAAI,2DAAK;AACT;AACA,wDAAU;AACV,IAAI,kEAAY;AAChB;AACA,wDAAU;AACV,IAAI,kEAAY;AAChB;AACA,wDAAU;AACV,IAAI,kEAAY;AAChB;AACA,wDAAU;AACV,IAAI,kEAAY;AAChB;AACA,wDAAU;AACV,IAAI,kEAAY;AAChB;AACA,wDAAU;AACV,IAAI,kEAAY;AAChB;AACA,wDAAU;AACV,IAAI,kEAAY;AAChB;AACA,wDAAU;AACV,IAAI,kEAAY;AAChB;AACA,kDAAkD,wDAAU;AAC5D,IAAI,+DAAS;AACb;AACA;AACA;AACA,aAAa,UAAU,4DAAa;AACpC;AACA,KAAK;AACL,IAAI,qDAAO,IAAI,8DAAQ,KAAK,qDAAO,IAAI,4DAAM;AAC7C;;AAEA;AACA;AACA,qBAAqB,wDAAU;AAC/B,IAAI,8DAAQ;AACZ;AACA,YAAY,4DAAY;AACxB,YAAY,0DAAW;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEiH;AACjH","file":"default~flujo-mensual-flujo-mensual-module-ngfactory~presupuesto-anual-presupuesto-anual-module-ngfa~52d4c69b-es2015.113ede962d0536a4db44.js","sourcesContent":["import { InjectionToken, forwardRef, Optional, Inject, ElementRef, KeyValueDiffers, Input, HostListener, Directive, NgModule } from '@angular/core';\nimport { __decorate, __param } from 'tslib';\nimport { NG_VALUE_ACCESSOR, NG_VALIDATORS, FormsModule } from '@angular/forms';\nimport { CommonModule } from '@angular/common';\n\nlet CURRENCY_MASK_CONFIG = new InjectionToken(\"currency.mask.config\");\n\nclass InputManager {\n    constructor(htmlInputElement) {\n        this.htmlInputElement = htmlInputElement;\n    }\n    setCursorAt(position) {\n        if (this.htmlInputElement.setSelectionRange) {\n            this.htmlInputElement.focus();\n            this.htmlInputElement.setSelectionRange(position, position);\n        }\n        else if (this.htmlInputElement.createTextRange) {\n            let textRange = this.htmlInputElement.createTextRange();\n            textRange.collapse(true);\n            textRange.moveEnd(\"character\", position);\n            textRange.moveStart(\"character\", position);\n            textRange.select();\n        }\n    }\n    updateValueAndCursor(newRawValue, oldLength, selectionStart) {\n        this.rawValue = newRawValue;\n        let newLength = newRawValue.length;\n        selectionStart = selectionStart - (oldLength - newLength);\n        this.setCursorAt(selectionStart);\n    }\n    get canInputMoreNumbers() {\n        let haventReachedMaxLength = !(this.rawValue.length >= this.htmlInputElement.maxLength && this.htmlInputElement.maxLength >= 0);\n        let selectionStart = this.inputSelection.selectionStart;\n        let selectionEnd = this.inputSelection.selectionEnd;\n        let haveNumberSelected = (selectionStart != selectionEnd && this.htmlInputElement.value.substring(selectionStart, selectionEnd).match(/\\d/)) ? true : false;\n        let startWithZero = (this.htmlInputElement.value.substring(0, 1) == \"0\");\n        return haventReachedMaxLength || haveNumberSelected || startWithZero;\n    }\n    get inputSelection() {\n        let selectionStart = 0;\n        let selectionEnd = 0;\n        if (typeof this.htmlInputElement.selectionStart == \"number\" && typeof this.htmlInputElement.selectionEnd == \"number\") {\n            selectionStart = this.htmlInputElement.selectionStart;\n            selectionEnd = this.htmlInputElement.selectionEnd;\n        }\n        else {\n            let range = document.getSelection().anchorNode;\n            if (range && range.firstChild == this.htmlInputElement) {\n                let lenght = this.htmlInputElement.value.length;\n                let normalizedValue = this.htmlInputElement.value.replace(/\\r\\n/g, \"\\n\");\n                let startRange = this.htmlInputElement.createTextRange();\n                let endRange = this.htmlInputElement.createTextRange();\n                endRange.collapse(false);\n                if (startRange.compareEndPoints(\"StartToEnd\", endRange) > -1) {\n                    selectionStart = selectionEnd = lenght;\n                }\n                else {\n                    selectionStart = -startRange.moveStart(\"character\", -lenght);\n                    selectionStart += normalizedValue.slice(0, selectionStart).split(\"\\n\").length - 1;\n                    if (startRange.compareEndPoints(\"EndToEnd\", endRange) > -1) {\n                        selectionEnd = lenght;\n                    }\n                    else {\n                        selectionEnd = -startRange.moveEnd(\"character\", -lenght);\n                        selectionEnd += normalizedValue.slice(0, selectionEnd).split(\"\\n\").length - 1;\n                    }\n                }\n            }\n        }\n        return {\n            selectionStart: selectionStart,\n            selectionEnd: selectionEnd\n        };\n    }\n    get rawValue() {\n        return this.htmlInputElement && this.htmlInputElement.value;\n    }\n    set rawValue(value) {\n        this._storedRawValue = value;\n        if (this.htmlInputElement) {\n            this.htmlInputElement.value = value;\n        }\n    }\n    get storedRawValue() {\n        return this._storedRawValue;\n    }\n}\n\nclass InputService {\n    constructor(htmlInputElement, options) {\n        this.htmlInputElement = htmlInputElement;\n        this.options = options;\n        this.inputManager = new InputManager(htmlInputElement);\n    }\n    addNumber(keyCode) {\n        if (!this.rawValue) {\n            this.rawValue = this.applyMask(false, \"0\");\n        }\n        let keyChar = String.fromCharCode(keyCode);\n        let selectionStart = this.inputSelection.selectionStart;\n        let selectionEnd = this.inputSelection.selectionEnd;\n        this.rawValue = this.rawValue.substring(0, selectionStart) + keyChar + this.rawValue.substring(selectionEnd, this.rawValue.length);\n        this.updateFieldValue(selectionStart + 1);\n    }\n    applyMask(isNumber, rawValue) {\n        let { allowNegative, decimal, precision, prefix, suffix, thousands } = this.options;\n        rawValue = isNumber ? new Number(rawValue).toFixed(precision) : rawValue;\n        let onlyNumbers = rawValue.replace(/[^0-9]/g, \"\");\n        if (!onlyNumbers) {\n            return \"\";\n        }\n        let integerPart = onlyNumbers.slice(0, onlyNumbers.length - precision).replace(/^0*/g, \"\").replace(/\\B(?=(\\d{3})+(?!\\d))/g, thousands);\n        if (integerPart == \"\") {\n            integerPart = \"0\";\n        }\n        let newRawValue = integerPart;\n        let decimalPart = onlyNumbers.slice(onlyNumbers.length - precision);\n        if (precision > 0) {\n            decimalPart = \"0\".repeat(precision - decimalPart.length) + decimalPart;\n            newRawValue += decimal + decimalPart;\n        }\n        let isZero = parseInt(integerPart) == 0 && (parseInt(decimalPart) == 0 || decimalPart == \"\");\n        let operator = (rawValue.indexOf(\"-\") > -1 && allowNegative && !isZero) ? \"-\" : \"\";\n        return operator + prefix + newRawValue + suffix;\n    }\n    clearMask(rawValue) {\n        if (rawValue == null || rawValue == \"\") {\n            return null;\n        }\n        let value = rawValue.replace(this.options.prefix, \"\").replace(this.options.suffix, \"\");\n        if (this.options.thousands) {\n            value = value.replace(new RegExp(\"\\\\\" + this.options.thousands, \"g\"), \"\");\n        }\n        if (this.options.decimal) {\n            value = value.replace(this.options.decimal, \".\");\n        }\n        return parseFloat(value);\n    }\n    changeToNegative() {\n        if (this.options.allowNegative && this.rawValue != \"\" && this.rawValue.charAt(0) != \"-\" && this.value != 0) {\n            let selectionStart = this.inputSelection.selectionStart;\n            this.rawValue = \"-\" + this.rawValue;\n            this.updateFieldValue(selectionStart + 1);\n        }\n    }\n    changeToPositive() {\n        let selectionStart = this.inputSelection.selectionStart;\n        this.rawValue = this.rawValue.replace(\"-\", \"\");\n        this.updateFieldValue(selectionStart - 1);\n    }\n    fixCursorPosition(forceToEndPosition) {\n        let currentCursorPosition = this.inputSelection.selectionStart;\n        //if the current cursor position is after the number end position, it is moved to the end of the number, ignoring the prefix or suffix. this behavior can be forced with forceToEndPosition flag\n        if (currentCursorPosition > this.getRawValueWithoutSuffixEndPosition() || forceToEndPosition) {\n            this.inputManager.setCursorAt(this.getRawValueWithoutSuffixEndPosition());\n            //if the current cursor position is before the number start position, it is moved to the start of the number, ignoring the prefix or suffix\n        }\n        else if (currentCursorPosition < this.getRawValueWithoutPrefixStartPosition()) {\n            this.inputManager.setCursorAt(this.getRawValueWithoutPrefixStartPosition());\n        }\n    }\n    getRawValueWithoutSuffixEndPosition() {\n        return this.rawValue.length - this.options.suffix.length;\n    }\n    getRawValueWithoutPrefixStartPosition() {\n        return this.value != null && this.value < 0 ? this.options.prefix.length + 1 : this.options.prefix.length;\n    }\n    removeNumber(keyCode) {\n        let { decimal, thousands } = this.options;\n        let selectionEnd = this.inputSelection.selectionEnd;\n        let selectionStart = this.inputSelection.selectionStart;\n        if (selectionStart > this.rawValue.length - this.options.suffix.length) {\n            selectionEnd = this.rawValue.length - this.options.suffix.length;\n            selectionStart = this.rawValue.length - this.options.suffix.length;\n        }\n        //there is no selection\n        if (selectionEnd == selectionStart) {\n            //delete key and the target digit is a number\n            if ((keyCode == 46 || keyCode == 63272) && /^\\d+$/.test(this.rawValue.substring(selectionStart, selectionEnd + 1))) {\n                selectionEnd = selectionEnd + 1;\n            }\n            //delete key and the target digit is the decimal or thousands divider\n            if ((keyCode == 46 || keyCode == 63272) && (this.rawValue.substring(selectionStart, selectionEnd + 1) == decimal || this.rawValue.substring(selectionStart, selectionEnd + 1) == thousands)) {\n                selectionEnd = selectionEnd + 2;\n                selectionStart = selectionStart + 1;\n            }\n            //backspace key and the target digit is a number\n            if (keyCode == 8 && /^\\d+$/.test(this.rawValue.substring(selectionStart - 1, selectionEnd))) {\n                selectionStart = selectionStart - 1;\n            }\n            //backspace key and the target digit is the decimal or thousands divider\n            if (keyCode == 8 && (this.rawValue.substring(selectionStart - 1, selectionEnd) == decimal || this.rawValue.substring(selectionStart - 1, selectionEnd) == thousands)) {\n                selectionStart = selectionStart - 2;\n                selectionEnd = selectionEnd - 1;\n            }\n        }\n        this.rawValue = this.rawValue.substring(0, selectionStart) + this.rawValue.substring(selectionEnd, this.rawValue.length);\n        this.updateFieldValue(selectionStart);\n    }\n    updateFieldValue(selectionStart) {\n        let newRawValue = this.applyMask(false, this.rawValue || \"\");\n        selectionStart = selectionStart == undefined ? this.rawValue.length : selectionStart;\n        this.inputManager.updateValueAndCursor(newRawValue, this.rawValue.length, selectionStart);\n    }\n    updateOptions(options) {\n        let value = this.value;\n        this.options = options;\n        this.value = value;\n    }\n    get canInputMoreNumbers() {\n        return this.inputManager.canInputMoreNumbers;\n    }\n    get inputSelection() {\n        return this.inputManager.inputSelection;\n    }\n    get rawValue() {\n        return this.inputManager.rawValue;\n    }\n    set rawValue(value) {\n        this.inputManager.rawValue = value;\n    }\n    get storedRawValue() {\n        return this.inputManager.storedRawValue;\n    }\n    get value() {\n        return this.clearMask(this.rawValue);\n    }\n    set value(value) {\n        this.rawValue = this.applyMask(true, \"\" + value);\n    }\n}\n\nclass InputHandler {\n    constructor(htmlInputElement, options) {\n        this.inputService = new InputService(htmlInputElement, options);\n        this.htmlInputElement = htmlInputElement;\n    }\n    handleClick(event, chromeAndroid) {\n        let selectionRangeLength = Math.abs(this.inputService.inputSelection.selectionEnd - this.inputService.inputSelection.selectionStart);\n        //if there is no selection and the value is not null, the cursor position will be fixed. if the browser is chrome on android, the cursor will go to the end of the number.\n        if (selectionRangeLength == 0 && !isNaN(this.inputService.value)) {\n            this.inputService.fixCursorPosition(chromeAndroid);\n        }\n    }\n    handleCut(event) {\n        if (this.isReadOnly()) {\n            return;\n        }\n        setTimeout(() => {\n            this.inputService.updateFieldValue();\n            this.setValue(this.inputService.value);\n            this.onModelChange(this.inputService.value);\n        }, 0);\n    }\n    handleInput(event) {\n        if (this.isReadOnly()) {\n            return;\n        }\n        let keyCode = this.getNewKeyCode(this.inputService.storedRawValue, this.inputService.rawValue);\n        let rawValueLength = this.inputService.rawValue.length;\n        let rawValueSelectionEnd = this.inputService.inputSelection.selectionEnd;\n        let rawValueWithoutSuffixEndPosition = this.inputService.getRawValueWithoutSuffixEndPosition();\n        let storedRawValueLength = this.inputService.storedRawValue.length;\n        this.inputService.rawValue = this.inputService.storedRawValue;\n        if ((rawValueSelectionEnd != rawValueWithoutSuffixEndPosition || Math.abs(rawValueLength - storedRawValueLength) != 1) && storedRawValueLength != 0) {\n            this.setCursorPosition(event);\n            return;\n        }\n        if (rawValueLength < storedRawValueLength) {\n            if (this.inputService.value != 0) {\n                this.inputService.removeNumber(8);\n            }\n            else {\n                this.setValue(null);\n            }\n        }\n        if (rawValueLength > storedRawValueLength) {\n            switch (keyCode) {\n                case 43:\n                    this.inputService.changeToPositive();\n                    break;\n                case 45:\n                    this.inputService.changeToNegative();\n                    break;\n                default:\n                    if (!this.inputService.canInputMoreNumbers || (isNaN(this.inputService.value) && String.fromCharCode(keyCode).match(/\\d/) == null)) {\n                        return;\n                    }\n                    this.inputService.addNumber(keyCode);\n            }\n        }\n        this.setCursorPosition(event);\n        this.onModelChange(this.inputService.value);\n    }\n    handleKeydown(event) {\n        if (this.isReadOnly()) {\n            return;\n        }\n        let keyCode = event.which || event.charCode || event.keyCode;\n        if (keyCode == 8 || keyCode == 46 || keyCode == 63272) {\n            event.preventDefault();\n            let selectionRangeLength = Math.abs(this.inputService.inputSelection.selectionEnd - this.inputService.inputSelection.selectionStart);\n            if (selectionRangeLength == this.inputService.rawValue.length || this.inputService.value == 0) {\n                this.setValue(null);\n                this.onModelChange(this.inputService.value);\n            }\n            if (selectionRangeLength == 0 && !isNaN(this.inputService.value)) {\n                this.inputService.removeNumber(keyCode);\n                this.onModelChange(this.inputService.value);\n            }\n            if ((keyCode === 8 || keyCode === 46) && selectionRangeLength != 0 && !isNaN(this.inputService.value)) {\n                this.inputService.removeNumber(keyCode);\n                this.onModelChange(this.inputService.value);\n            }\n        }\n    }\n    handleKeypress(event) {\n        if (this.isReadOnly()) {\n            return;\n        }\n        let keyCode = event.which || event.charCode || event.keyCode;\n        if (keyCode == undefined || [9, 13].indexOf(keyCode) != -1 || this.isArrowEndHomeKeyInFirefox(event)) {\n            return;\n        }\n        switch (keyCode) {\n            case 43:\n                this.inputService.changeToPositive();\n                break;\n            case 45:\n                this.inputService.changeToNegative();\n                break;\n            default:\n                if (this.inputService.canInputMoreNumbers && (!isNaN(this.inputService.value) || String.fromCharCode(keyCode).match(/\\d/) != null)) {\n                    this.inputService.addNumber(keyCode);\n                }\n        }\n        event.preventDefault();\n        this.onModelChange(this.inputService.value);\n    }\n    handleKeyup(event) {\n        this.inputService.fixCursorPosition();\n    }\n    handlePaste(event) {\n        if (this.isReadOnly()) {\n            return;\n        }\n        setTimeout(() => {\n            this.inputService.updateFieldValue();\n            this.setValue(this.inputService.value);\n            this.onModelChange(this.inputService.value);\n        }, 1);\n    }\n    updateOptions(options) {\n        this.inputService.updateOptions(options);\n    }\n    getOnModelChange() {\n        return this.onModelChange;\n    }\n    setOnModelChange(callbackFunction) {\n        this.onModelChange = callbackFunction;\n    }\n    getOnModelTouched() {\n        return this.onModelTouched;\n    }\n    setOnModelTouched(callbackFunction) {\n        this.onModelTouched = callbackFunction;\n    }\n    setValue(value) {\n        this.inputService.value = value;\n    }\n    getNewKeyCode(oldString, newString) {\n        if (oldString.length > newString.length) {\n            return null;\n        }\n        for (let x = 0; x < newString.length; x++) {\n            if (oldString.length == x || oldString[x] != newString[x]) {\n                return newString.charCodeAt(x);\n            }\n        }\n    }\n    isArrowEndHomeKeyInFirefox(event) {\n        if ([35, 36, 37, 38, 39, 40].indexOf(event.keyCode) != -1 && (event.charCode == undefined || event.charCode == 0)) {\n            return true;\n        }\n        return false;\n    }\n    isReadOnly() {\n        return this.htmlInputElement && this.htmlInputElement.readOnly;\n    }\n    setCursorPosition(event) {\n        let rawValueWithoutSuffixEndPosition = this.inputService.getRawValueWithoutSuffixEndPosition();\n        setTimeout(function () {\n            event.target.setSelectionRange(rawValueWithoutSuffixEndPosition, rawValueWithoutSuffixEndPosition);\n        }, 0);\n    }\n}\n\nvar CurrencyMaskDirective_1;\nconst CURRENCYMASKDIRECTIVE_VALUE_ACCESSOR = {\n    provide: NG_VALUE_ACCESSOR,\n    useExisting: forwardRef(() => CurrencyMaskDirective),\n    multi: true\n};\nlet CurrencyMaskDirective = CurrencyMaskDirective_1 = class CurrencyMaskDirective {\n    constructor(currencyMaskConfig, elementRef, keyValueDiffers) {\n        this.currencyMaskConfig = currencyMaskConfig;\n        this.elementRef = elementRef;\n        this.keyValueDiffers = keyValueDiffers;\n        this.options = {};\n        this.optionsTemplate = {\n            align: \"right\",\n            allowNegative: true,\n            decimal: \".\",\n            precision: 2,\n            prefix: \"$ \",\n            suffix: \"\",\n            thousands: \",\"\n        };\n        if (currencyMaskConfig) {\n            this.optionsTemplate = currencyMaskConfig;\n        }\n        this.keyValueDiffer = keyValueDiffers.find({}).create();\n    }\n    ngAfterViewInit() {\n        this.elementRef.nativeElement.style.textAlign = this.options.align ? this.options.align : this.optionsTemplate.align;\n    }\n    ngDoCheck() {\n        if (this.keyValueDiffer.diff(this.options)) {\n            this.elementRef.nativeElement.style.textAlign = this.options.align ? this.options.align : this.optionsTemplate.align;\n            this.inputHandler.updateOptions(Object.assign({}, this.optionsTemplate, this.options));\n        }\n    }\n    ngOnInit() {\n        this.inputHandler = new InputHandler(this.elementRef.nativeElement, Object.assign({}, this.optionsTemplate, this.options));\n    }\n    handleBlur(event) {\n        this.inputHandler.getOnModelTouched().apply(event);\n    }\n    handleClick(event) {\n        this.inputHandler.handleClick(event, this.isChromeAndroid());\n    }\n    handleCut(event) {\n        if (!this.isChromeAndroid()) {\n            this.inputHandler.handleCut(event);\n        }\n    }\n    handleInput(event) {\n        if (this.isChromeAndroid()) {\n            this.inputHandler.handleInput(event);\n        }\n    }\n    handleKeydown(event) {\n        if (!this.isChromeAndroid()) {\n            this.inputHandler.handleKeydown(event);\n        }\n    }\n    handleKeypress(event) {\n        if (!this.isChromeAndroid()) {\n            this.inputHandler.handleKeypress(event);\n        }\n    }\n    handleKeyup(event) {\n        if (!this.isChromeAndroid()) {\n            this.inputHandler.handleKeyup(event);\n        }\n    }\n    handlePaste(event) {\n        if (!this.isChromeAndroid()) {\n            this.inputHandler.handlePaste(event);\n        }\n    }\n    isChromeAndroid() {\n        return /chrome/i.test(navigator.userAgent) && /android/i.test(navigator.userAgent);\n    }\n    registerOnChange(callbackFunction) {\n        this.inputHandler.setOnModelChange(callbackFunction);\n    }\n    registerOnTouched(callbackFunction) {\n        this.inputHandler.setOnModelTouched(callbackFunction);\n    }\n    setDisabledState(value) {\n        this.elementRef.nativeElement.disabled = value;\n    }\n    validate(abstractControl) {\n        let result = {};\n        if (abstractControl.value > this.max) {\n            result.max = true;\n        }\n        if (abstractControl.value < this.min) {\n            result.min = true;\n        }\n        return result != {} ? result : null;\n    }\n    writeValue(value) {\n        this.inputHandler.setValue(value);\n    }\n};\nCurrencyMaskDirective.ctorParameters = () => [\n    { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [CURRENCY_MASK_CONFIG,] }] },\n    { type: ElementRef },\n    { type: KeyValueDiffers }\n];\n__decorate([\n    Input()\n], CurrencyMaskDirective.prototype, \"max\", void 0);\n__decorate([\n    Input()\n], CurrencyMaskDirective.prototype, \"min\", void 0);\n__decorate([\n    Input()\n], CurrencyMaskDirective.prototype, \"options\", void 0);\n__decorate([\n    HostListener(\"blur\", [\"$event\"])\n], CurrencyMaskDirective.prototype, \"handleBlur\", null);\n__decorate([\n    HostListener(\"click\", [\"$event\"])\n], CurrencyMaskDirective.prototype, \"handleClick\", null);\n__decorate([\n    HostListener(\"cut\", [\"$event\"])\n], CurrencyMaskDirective.prototype, \"handleCut\", null);\n__decorate([\n    HostListener(\"input\", [\"$event\"])\n], CurrencyMaskDirective.prototype, \"handleInput\", null);\n__decorate([\n    HostListener(\"keydown\", [\"$event\"])\n], CurrencyMaskDirective.prototype, \"handleKeydown\", null);\n__decorate([\n    HostListener(\"keypress\", [\"$event\"])\n], CurrencyMaskDirective.prototype, \"handleKeypress\", null);\n__decorate([\n    HostListener(\"keyup\", [\"$event\"])\n], CurrencyMaskDirective.prototype, \"handleKeyup\", null);\n__decorate([\n    HostListener(\"paste\", [\"$event\"])\n], CurrencyMaskDirective.prototype, \"handlePaste\", null);\nCurrencyMaskDirective = CurrencyMaskDirective_1 = __decorate([\n    Directive({\n        selector: \"[currencyMask]\",\n        providers: [\n            CURRENCYMASKDIRECTIVE_VALUE_ACCESSOR,\n            { provide: NG_VALIDATORS, useExisting: CurrencyMaskDirective_1, multi: true }\n        ]\n    }),\n    __param(0, Optional()), __param(0, Inject(CURRENCY_MASK_CONFIG))\n], CurrencyMaskDirective);\n\nlet CurrencyMaskModule = class CurrencyMaskModule {\n};\nCurrencyMaskModule = __decorate([\n    NgModule({\n        imports: [\n            CommonModule,\n            FormsModule\n        ],\n        declarations: [\n            CurrencyMaskDirective\n        ],\n        exports: [\n            CurrencyMaskDirective\n        ]\n    })\n], CurrencyMaskModule);\n\n/*\n * Public API Surface of currency-mask\n */\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { CURRENCYMASKDIRECTIVE_VALUE_ACCESSOR, CURRENCY_MASK_CONFIG, CurrencyMaskDirective, CurrencyMaskModule };\n//# sourceMappingURL=ng2-currency-mask.js.map\n"],"sourceRoot":""}