import{isLocalLink as f}from"../../../utils/path/is-local-link.js";import{getPathnameForLocale as u,getLocaleFromPathname as d}from"@redocly/theme/core/utils";function g(t,n){if(!n||!n.locales||n.locales.length===0)return t;const{defaultLocale:e,locales:a}=n,m=a.filter(o=>o.code!==e),l={...t};for(const o in t){const c=t[o];if(d(o,e,a)!==e||!c.to||!f(o))continue;const i=f(c.to);if(!(o.endsWith("*")&&!i))for(const r of m){const s=u(o,e,r.code,a);if(t[s])continue;const L=i?u(c.to,e,r.code,a):c.to;l[s]={...c,to:L}}}return l}export{g as applyL10nToRedirects};
