declare function acquireVsCodeApi ( ) ; const vscode = acquireVsCodeApi ( ) ; window . onmousedown = ( ev ) => { vscode . postMessage ( { message : 'mouseClick' , button : Number ( ev . button ) , scrollY : window . scrollY } ) ; } ; window . addEventListener ( 'message' , ( ev ) => { const message = ev . data ; if ( message . command === 'goBack' ) { vscode . postMessage ( { message : 'mouseClick' , button : 3 , scrollY : window . scrollY } ) ; } else if ( message . command === 'goForward' ) { vscode . postMessage ( { message : 'mouseClick' , button : 4 , scrollY : window . scrollY } ) ; } } ) ; window . document . body . onload = ( ) => { const relPath = ( document . body . getAttribute ( 'relPath' ) || '' ) ; vscode . setState ( relPath ) ; const loc = document . location ; const url0 = new URL ( loc . protocol + '//' + loc . host ) ; const url1 = new URL ( relPath , url0 ) ; const scrollYTo = Number ( document . body . getAttribute ( 'scrollYTo' ) ?? - 1 ) ; if ( scrollYTo >= 0 ) { window . scrollTo ( 0 , scrollYTo ) ; } else if ( url1 . hash ) { document . location . hash = url1 . hash ; } const hyperLinks = document . getElementsByTagName ( 'a' ) ; for ( let i = 0 ; i < hyperLinks . length ; i ++ ) { const hrefAbs = hyperLinks [ i ] . href ; const hrefRel = hyperLinks [ i ] . getAttribute ( 'href' ) || '' ; if ( hrefRel . startsWith ( '#' ) ) { hyperLinks [ i ] . onclick = ( ) => { document . location . hash = hrefRel ; } ; } else if ( hrefAbs && hrefAbs . startsWith ( 'vscode-webview://' ) ) { hyperLinks [ i ] . onclick = ( ) => { const url2 = new URL ( hrefRel , url1 ) ; const finalHref = url2 . toString ( ) ; vscode . postMessage ( { message : 'linkClicked' , href : finalHref , scrollY : window . scrollY } ) ; } ; } } } ;