(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/forms'), require('@angular/common')) :
    typeof define === 'function' && define.amd ? define('@grwit/blocks/core', ['exports', '@angular/core', '@angular/forms', '@angular/common'], factory) :
    (factory((global.grwit = global.grwit || {}, global.grwit.blocks = global.grwit.blocks || {}, global.grwit.blocks.core = {}),global.ng.core,global.ng.forms,global.ng.common));
}(this, (function (exports,core,forms,common) { 'use strict';

    /**
     * @fileoverview added by tsickle
     * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
     */
    /**
     * @abstract
     */
    var AbstractValueAccessor = /** @class */ (function () {
        function AbstractValueAccessor() {
            this._value = '';
            this.onChange = function (_) { };
            this.onTouched = function () { };
        }
        Object.defineProperty(AbstractValueAccessor.prototype, "value", {
            get: /**
             * @return {?}
             */ function () { return this._value; },
            set: /**
             * @param {?} v
             * @return {?}
             */ function (v) {
                if (v !== this._value) {
                    this._value = v;
                    this.onChange(v);
                }
            },
            enumerable: true,
            configurable: true
        });
        /**
         * @param {?} value
         * @return {?}
         */
        AbstractValueAccessor.prototype.writeValue = /**
         * @param {?} value
         * @return {?}
         */
            function (value) {
                this._value = value;
                // warning: comment below if only want to emit on user intervention
                this.onChange(value);
            };
        /**
         * @param {?} fn
         * @return {?}
         */
        AbstractValueAccessor.prototype.registerOnChange = /**
         * @param {?} fn
         * @return {?}
         */
            function (fn) { this.onChange = fn; };
        /**
         * @param {?} fn
         * @return {?}
         */
        AbstractValueAccessor.prototype.registerOnTouched = /**
         * @param {?} fn
         * @return {?}
         */
            function (fn) { this.onTouched = fn; };
        AbstractValueAccessor.propDecorators = {
            value: [{ type: core.Input }]
        };
        return AbstractValueAccessor;
    }());

    /**
     * @fileoverview added by tsickle
     * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
     */
    /**
     * @param {?} type
     * @return {?}
     */
    function MakeProvider(type) {
        return {
            provide: forms.NG_VALUE_ACCESSOR,
            useExisting: core.forwardRef(function () { return type; }),
            multi: true
        };
    }

    /**
     * @fileoverview added by tsickle
     * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
     */
    /**
     * @param {?} type
     * @return {?}
     */
    function MakeValidator(type) {
        return {
            provide: forms.NG_VALIDATORS,
            useExisting: core.forwardRef(function () { return type; }),
            multi: true
        };
    }

    /**
     * @fileoverview added by tsickle
     * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
     */
    /**
     * @param {?} obj
     * @param {?} propertyPath
     * @return {?}
     */
    function getNestedProperty(obj, propertyPath) {
        /** @type {?} */
        var pathParts = propertyPath.split('.');
        /** @type {?} */
        var currObj = obj;
        pathParts.forEach(function (part) {
            currObj = currObj[part];
            if (!currObj) {
                return null;
            }
        });
        return currObj;
    }

    /**
     * @fileoverview added by tsickle
     * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
     */
    var GrwitCoreModule = /** @class */ (function () {
        function GrwitCoreModule() {
        }
        GrwitCoreModule.decorators = [
            { type: core.NgModule, args: [{
                        imports: [
                            common.CommonModule,
                            forms.FormsModule
                        ],
                        providers: [],
                    },] },
        ];
        return GrwitCoreModule;
    }());

    /**
     * @fileoverview added by tsickle
     * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
     */

    /**
     * @fileoverview added by tsickle
     * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
     */

    /**
     * @fileoverview added by tsickle
     * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
     */

    exports.AbstractValueAccessor = AbstractValueAccessor;
    exports.MakeProvider = MakeProvider;
    exports.MakeValidator = MakeValidator;
    exports.getNestedProperty = getNestedProperty;
    exports.GrwitCoreModule = GrwitCoreModule;

    Object.defineProperty(exports, '__esModule', { value: true });

})));

//# sourceMappingURL=data:application/json;charset=utf-8;base64, 