function _slicedToArray(e,r){return _arrayWithHoles(e)||_iterableToArrayLimit(e,r)||_unsupportedIterableToArray(e,r)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,r){var t;if(e)return"string"==typeof e?_arrayLikeToArray(e,r):"Map"===(t="Object"===(t={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:t)||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,r):void 0}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t<r;t++)n[t]=e[t];return n}function _iterableToArrayLimit(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,a,o,i,l=[],u=!0,c=!1;try{if(o=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;u=!1}else for(;!(u=(n=o.call(t)).done)&&(l.push(n.value),l.length!==r);u=!0);}catch(e){c=!0,a=e}finally{try{if(!u&&null!=t.return&&(i=t.return(),Object(i)!==i))return}finally{if(c)throw a}}return l}}function _arrayWithHoles(e){if(Array.isArray(e))return e}(()=>{function e(r,t,n,a,o){var i="configuration.licence";return{updateLicenseKey:function(r){return e(r).then(function(e){return e?(e={category:i,key:_slicedToArray(r.match(/(.*)?\.licence=.*/),2)[1],value:r},a.updateOption(e)):t.reject({data:{error:o("Invalid license key.")}})})},validateLicenseKey:e,removeLicenseKey:function(e){return a.deleteOption({category:i,key:e})},getLicenses:function(){return a.detail({category:i}).then(n.getResData)}};function e(e){e={method:"POST",url:n.url("tenant/domain/validate"),data:{value:e}};return r(e).then(n.getResData).then(function(e){return e.valid})}}e.$inject=["$http","$q","c8yBase","c8ySettings","gettext"],angular.module("c8y.core").factory("c8yLicense",e)})();