function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _defineProperty(e,t,n){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:e+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0===n)return("string"===t?String:Number)(e);n=n.call(e,t||"default");if("object"!=_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(()=>{function e(e,t,n,i,r,o){var u,a,s,m,l,c=this,d="elementForm",f={IS_REQUIRED:"required",IS_VALID_NAME:"valid-name",IS_VALID_NUMBER:"valid-number"};_.assign(c,{$onInit:function(){var e=c.resolve;a=e.element,s=e.existingElements,m=e.existingCategories,u=c.resolve.features[a.input?"discreteInputs":"discreteOutputs"],c.features=u,c.element=i.addDiscreteIOMeta(a),c.categories=m,l=_defineProperty(_defineProperty(_defineProperty({},f.IS_REQUIRED,o("This field is required.")),f.IS_VALID_NAME,o("Name must be unique among coils and discrete inputs.")),f.IS_VALID_NUMBER,a.input?o("Number must be unique among discrete inputs."):o("Number must be unique among coils."))},onUpdateStatusCheckboxClicked:function(){a.meta.updateStatus&&(a.meta.showStatus=!0)},alarmSeverities:r.severityList,invalid:function(e){return(()=>{var t=c[d].name,n=_.get(a,"meta"),e=_.isUndefined(t.$modelValue)||_.every(s,function(e){return e.name===_.get(n,"original.name")||e.name!==t.$modelValue});t.$setValidity(f.IS_VALID_NAME,e)})(),(()=>{var t=c[d].number,n=_.get(a,"meta"),e=_.isUndefined(t.$modelValue)||_.every(s,function(e){return e.input!==a.input||e.number===_.get(n,"original.number")||e.number!==t.$modelValue});t.$setValidity(f.IS_VALID_NUMBER,e)})(),n.invalid(c,d,e)},validationHints:function(e){return n.validationHints(e,l)},save:function(){c.close({$value:i.removeDiscreteIOMeta(a)})}}),e.$watch("vm.element.meta.showStatus",function(){{var e,t,n;a&&(e=_.get(a,"meta",{}),t=(a.meta=e).showStatus,n=e.enumValues,t?n||_.assign(e,{enumType:!0,enumValues:_.cloneDeep(i.metaDefaults.discreteIO.enumValues)}):_.assign(e,{enumType:!1,enumValues:void 0}))}})}e.$inject=["$scope","$q","c8yBase","c8yDeviceDatabase","c8yAlarms","gettext"],angular.module("c8y.deviceDatabase4").component("c8yConfigureDiscreteIOModal",{templateUrl:":::PLUGIN_PATH:::/modals/configure-discrete-io.html",bindings:{resolve:"<",close:"&",dismiss:"&"},controllerAs:"vm",controller:e})})();