import{trimText as s}from"@redocly/theme/core/openapi";const e=10,m=40;function T(n,l,c,o){if(!n.length||l<=0)return e;const x=Math.max(0,l-(c?m:0));o.textContent="/";const r=o.scrollWidth,W=(n.length-1)*r,d=Math.max(...n.map(t=>t.name.length),e);let h=e,i=d,a=e;for(;h<=i;){const t=Math.floor((h+i)/2);n.reduce((f,g)=>(o.textContent=s(g.name,t),f+o.scrollWidth),0)+W<=x?(a=t,h=t+1):i=t-1}return a}export{T as calculateMaxLength};
