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,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,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 r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!=_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(()=>{function e(e,t,p){var a=this;_.assign(a,{$doCheck:function(){var e=_.get(a.context,a.property.path);a.model!==e&&(a.model=(o=>_.forEach(o,function(e,t){try{var r=JSON.parse(e);0<_.keys(r).length&&(o[t]=_.reduce(r,function(e,t,r){return e[parseInt(r,10)]=t,e},[]))}catch(e){}}))(e))},$onChanges:function(){(()=>{var e=a.property.key;a.schema={type:"object",properties:_defineProperty({},e,a.property)},a.form=[{key:[e],description:!1,notitle:!0,properties:_defineProperty({},e,a.property),labelHtmlClass:"no-label"}]})(),(()=>{var e=a.property.items;e&&_.get(e,"title")&&delete e.title,a.inputValueSchema={type:"object",properties:{inputValue:a.property},required:["inputValue"]},a.inputValueForm=[{key:["inputValue"],notitle:!0,description:!1,readonly:!1,uiSortable:{disabled:!0}}],a.placeholders={inputValue:_.cloneDeep(_.get(a.context,"".concat(a.property.path,".").concat(a.property.key)))}})()},execute:function(e,t){var r=(void 0!==t?t:"").inputValue,o=a.property,n=o.type,o=o.items,o=_.get(o,"type"),i=!1;n&&"array"===n&&o&&"string"===o&&(n=JSON.stringify(r),o=JSON.stringify(n),t.inputValue=o.match(/^"(.*)"$/)[1],i=!0);n=JSON.parse(p.replaceOperationTemplatePlaceholders(e.template,a.context,a.property,t));i&&(t.inputValue=r);a.createOperation({operation:n,name:e.name})},operationPopoverTemplate:":::PLUGIN_PATH:::/generic-ui-inventory-property-operation-popover.html",needsUserInput:function(e){return _.includes(e.template,"${inputValue}")},noOperationsSupported:function(){return 0<_.get(a.property,"operations.length",0)},needsForm:function(){return"operations"!==a.property.type&&!(0<_.intersection(["execute","execute with parameters"],_.map(a.property.operations,function(e){return e.name.toLowerCase()})).length)},isInProgress:function(t){return _.some(a.operations,function(e){return t.name===_.get(e,"c8y_JsonSchemaContext.operation")&&_.includes(["PENDING","EXECUTING"],e.status)})},options:{supressPropertyTitles:!0}})}e.$inject=["$location","$uibModal","c8yGenericUi"],angular.module("c8y.genericUi").component("c8yGenericUiInventoryProperty",{bindings:{property:"<",context:"<",operations:"<",createOperation:"&"},templateUrl:":::PLUGIN_PATH:::/generic-ui-inventory-property.html",controller:e,controllerAs:"vm"})})();