function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,o){var t;if(e)return"string"==typeof e?_arrayLikeToArray(e,o):"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,o):void 0}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,o){(null==o||o>e.length)&&(o=e.length);for(var t=0,r=Array(o);t<o;t++)r[t]=e[t];return r}(()=>{function e(o,t,r,n){var i=this,a="",c=[];function e(){i.protocols=void 0,l()}function l(){s(!0),r.listProtocols().then(u).finally(_.partial(s,!1))}function u(e){i.protocols||(i.protocols=[],c=e),o.paging=e.paging||{refresh:!0};e=_.uniqBy([].concat(_toConsumableArray(i.protocols),_toConsumableArray(e)),"data.id");i.protocols=a&&0<a.length?t("filter")(e,function(e){return _.includes(r.getProtocolName(e).toLowerCase(),a.toLowerCase())}):e,d(i.protocols)}function s(e){i.mainView&&(i.mainView.isLoading=e)}function d(e){i.mainView&&(i.mainView.isEmpty=0===_.get(e,"length")&&""===a)}function p(e){return void 0!==e.data.c8y_LpwanCodecDetails}_.assign(i,{$onInit:function(){e(),i.mainView&&(i.mainView.refresh=e)},$onChanges:function(e){e=_.get(e,"filter.currentValue");e?(a=e,l()):""===e&&(i.protocols=[],a="",u(c))},edit:r.edit,remove:function(e){return r.remove(e).then(function(){return _.pull(i.protocols,e)}).then(function(){return _.pull(c,e)}).then(function(){return d(i.protocols)})},CONFIG:r.VIEW_CONFIG,getTitle:r.getProtocolName,getProtocolActionsMemoized:_.memoize(r.getActionsForProtocol,_.property("id")),getRowInfoComponent:r.getProtocolRowInfoComponent,isReadOnly:p,getDescription:function(e){var o,t;return p(e)?(t=e.data.c8y_LpwanCodecDetails.supportedDevice,o=t.deviceModel,t=t.deviceManufacturer,n.getString("Device protocol that supports device model {{deviceModel}} manufactured by {{deviceManufacturer}}",{deviceModel:o,deviceManufacturer:t})):e.data.description},getSearchTerm:function(){return a},hasMore:function(){return _.get(o,"paging.more",!1)}}),o.paging={},o.loadNext=function(){o.paging.loading=!0,o.paging.next().then(u).finally(function(){o.paging.loading=!1})}}e.$inject=["$scope","$filter","c8yDeviceProtocolUi","gettextCatalog"],angular.module("c8y.deviceProtocols").component("c8yDeviceProtocolList",{templateUrl:":::PLUGIN_PATH:::/deviceProtocolList.html",controllerAs:"vm",require:{mainView:"?^c8yDeviceProtocolView"},controller:e,bindings:{filter:"<",onList:"&"}})})();