import t from"./matchPath.js";function matchRoute(e,r,n,a,o){let u,h,s=0,c=e.path||"";return"/"===c.charAt(0)&&(n&&(c=c.substr(1)),n=!0),{next(l){if(e===l)return{done:!0};const i=e.__children=e.__children||e.children;if(!u&&(u=t(c,r,!i,a,o),u))return{done:!1,value:{route:e,keys:u.keys,params:u.params,path:u.path}};if(u&&i)for(;s<i.length;){if(!h){const t=i[s];t.parent=e;let a=u.path.length;a>0&&"/"===r.charAt(a)&&(a+=1),h=matchRoute(t,r.substr(a),n,u.keys,u.params)}const t=h.next(l);if(!t.done)return{done:!1,value:t.value};h=null,s++}return{done:!0}}}}export default matchRoute;