( function () {
	if ( ! window.location.search ) {
		return;
	}

	var url = new URL( window.location.href );
	var keysToRemove = [ 'action', 'action2', 'shipment_ids', '_wpnonce', '_wp_http_referer' ];
	var changed = false;

	keysToRemove.forEach(
		function ( key ) {
			if ( url.searchParams.has( key ) ) {
				url.searchParams.delete( key );
				changed = true;
			}
		}
	);

	if ( changed ) {
		window.history.replaceState( {}, document.title, url.toString() );
	}
} )();
