President Trump has transformed the world’s view of the United States from an anchor of the international order into something more inward-looking and unpredictable.