const p={Service:"Service",ServiceInstance:"Instance",Endpoint:"Endpoint",Process:"Process",ServiceRelation:"Relation Service→Service",ServiceInstanceRelation:"Relation Instance→Instance",EndpointRelation:"Relation Endpoint→Endpoint",ProcessRelation:"Relation Process→Process",All:"All"},c=/([A-Za-z0-9_\-]+)::([^\s]+)/g;function g(s){const n=[];let i=0;c.lastIndex=0;let e;for(;(e=c.exec(s))!==null;)e.index>i&&n.push({kind:"text",text:s.slice(i,e.index)}),n.push({kind:"group",group:e[1],base:e[2]}),i=e.index+e[0].length;return i<s.length&&n.push({kind:"text",text:s.slice(i)}),n.length===0&&n.push({kind:"text",text:s}),n}function d(s,n){return{prefix:p[typeof s=="string"?s:""]??"",segments:g(n)}}function h(s){if(s.length===0)return[];const n=new Map;for(const e of s){let t=n.get(e.id);t||(t=[],n.set(e.id,t)),t.push(e)}const i=[];for(const[e,t]of n){t.sort((o,f)=>o.startTime-f.startTime);const r=t[t.length-1],a=t[0],l=t.filter(o=>o.recoveryTime!==null).length,u=r.recoveryTime!==null?"recovered":l>0?"unstable":"firing";i.push({id:e,events:t,oldest:a,latest:r,state:u,triggerCount:t.length,recoveredCount:l,layerKey:r.layerKey})}return i.sort((e,t)=>t.latest.startTime-e.latest.startTime),i}export{d as f,h as m};
