var intercept,onPopState,getNavResult;"undefined"==typeof navigation&&(intercept=function(obj){obj&&(obj.precommitHandler&&obj.precommitHandler(),obj.handler)&&obj.handler()},onPopState=function(e){var newUrl=window.location.href,ev=new CustomEvent("navigation_navigate",{bubbles:!1});ev.canIntercept=!0,ev.info=navigation.navigationInfo,ev.destination={url:newUrl},ev.navigationType=navigation.navigationType,console.log("navigation polyfill: popstate: "+newUrl+", navigationType: "+ev.navigationType+", dispatching navigation_navigate"),ev.abortController=new AbortController,ev.signal=ev.abortController.signal,ev.intercept=intercept.bind(ev),document.dispatchEvent(ev),navigation.navigationType="traverse",navigation.navigationInfo=null},getNavResult=function(){return{committed:Promise.resolve(),finished:Promise.resolve()}},globalThis.navigation={back:function(){return navigation.navigationType="traverse",navigation.navigationInfo=null,history.back(),getNavResult()},forward:function(){return navigation.navigationType="traverse",navigation.navigationInfo=null,history.forward(),getNavResult()},get canGoBack(){return 1<history.length},addEventListener:function(eventName,fn){document.addEventListener("navigation_"+eventName,fn)},removeEventListener:function(eventName,fn){document.removeEventListener("navigation_"+eventName,fn)},navigate:function(url,options){return"replace"===(null==options?void 0:options.history)?(console.log("navigation polyfill: replaceState: "+url),navigation.navigationType="replace",navigation.navigationInfo=null==options?void 0:options.info,history.replaceState(options,"",url)):(console.log("navigation polyfill: pushState: "+url),navigation.navigationType="push",navigation.navigationInfo=null==options?void 0:options.info,history.pushState(options,"",url)),onPopState.call(window,{state:options}),getNavResult()}},window.addEventListener("popstate",onPopState,!1));