/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{isFeatureLayer as r}from"../../../layers/support/layerUtils.js";function e(r){return"feature"===r.type}function t(r,e){return r.url.includes(e)}function a(r,e){return(r.dataElement?.domainNetworks||[]).some(r=>r.subnetworkLayerId===e.layerId)}class i{getValidUtilityNetworkLayers(i,l){const s=[];return i?.allLayers.forEach(i=>{"group"===i.type?s.push(...i.layers.filter(r).filter(r=>e(r)&&l.isUtilityLayer(r)&&!a(l,r)).filter(r=>t(r,l.featureServiceUrl)).toArray()):"subtype-group"===i.type?s.push(...i.sublayers.filter(r=>t(r,l.featureServiceUrl)).toArray()):r(i)&&e(i)&&l.isUtilityLayer(i)&&!a(l,i)&&t(i,l.featureServiceUrl)&&s.push(i)}),s}}export{i as UtilityHelper};
