(()=>{function e(t,e,r,a){return{doesSupportFile:function(e){return/\.json$/.test(e.name)},parseFile:function(n){return t(function(r,e){var t=new FileReader;t.onload=function(e){e=e.target;return r(e.result)},t.onerror=function(){return e({feedback:{type:"error",summary:a("Could not read file.")}})},t.readAsText(n)}).then(c)},parseString:c,parseObject:n};function c(e){var r;try{r=t.resolve(JSON.parse(e))}catch(e){r=t.reject({feedback:{type:"error",summary:a("Could not parse JSON content.")}})}return r.then(n)}function n(e){var e=_.cloneDeep(e),r="c8y_ModbusDeviceTypeInfo",t=_.get(e,r,{}),t=(e.name=e.name||t.name,e.fieldbusType=e.fieldbusType||t.fieldbusType,_.unset(e,r),{type:"success",summary:a("JSON parsed successfully.")});return{deviceType:e,feedback:t}}}e.$inject=["$q","$rootScope","c8yDeviceDatabase","gettext"],angular.module("c8y.deviceDatabase4").factory("c8yDeviceTypeParserJSON",e)})();