(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms')) : typeof define === 'function' && define.amd ? define('primeng/inputswitch', ['exports', '@angular/core', '@angular/common', '@angular/forms'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.primeng = global.primeng || {}, global.primeng.inputswitch = {}), global.ng.core, global.ng.common, global.ng.forms)); }(this, (function (exports, core, common, forms) { 'use strict'; var INPUTSWITCH_VALUE_ACCESSOR = { provide: forms.NG_VALUE_ACCESSOR, useExisting: core.forwardRef(function () { return InputSwitch; }), multi: true }; var InputSwitch = /** @class */ (function () { function InputSwitch(cd) { this.cd = cd; this.onChange = new core.EventEmitter(); this.checked = false; this.focused = false; this.onModelChange = function () { }; this.onModelTouched = function () { }; } InputSwitch.prototype.onClick = function (event, cb) { if (!this.disabled && !this.readonly) { event.preventDefault(); this.toggle(event); cb.focus(); } }; InputSwitch.prototype.onInputChange = function (event) { if (!this.readonly) { var inputChecked = event.target.checked; this.updateModel(event, inputChecked); } }; InputSwitch.prototype.toggle = function (event) { this.updateModel(event, !this.checked); }; InputSwitch.prototype.updateModel = function (event, value) { this.checked = value; this.onModelChange(this.checked); this.onChange.emit({ originalEvent: event, checked: this.checked }); }; InputSwitch.prototype.onFocus = function (event) { this.focused = true; }; InputSwitch.prototype.onBlur = function (event) { this.focused = false; this.onModelTouched(); }; InputSwitch.prototype.writeValue = function (checked) { this.checked = checked; this.cd.markForCheck(); }; InputSwitch.prototype.registerOnChange = function (fn) { this.onModelChange = fn; }; InputSwitch.prototype.registerOnTouched = function (fn) { this.onModelTouched = fn; }; InputSwitch.prototype.setDisabledState = function (val) { this.disabled = val; this.cd.markForCheck(); }; return InputSwitch; }()); InputSwitch.decorators = [ { type: core.Component, args: [{ selector: 'p-inputSwitch', template: "\n