{
  "namespace": "smithing_table_2",

  //------------------------------------------------------------------------------------
  // #region Icon and text area (top quarter of screen)
  //------------------------------------------------------------------------------------

  "smithing_icon": {
    "type": "image",
    "anchor_from": "top_left",
    "anchor_to": "top_left",
    "texture": "textures/ui/smithing_icon",
    "size": [ 30, 30 ],
    "layer": 1
  },

  "upgrade_label": {
    "type": "label",
    "color": "$title_text_color",
    "anchor_from": "center",
    "anchor_to": "center",
    "size": [ "80%", "30%" ],
    "offset": [ "30%", 0 ],
    "layer": 1,
    "text": "container.smithing_table.upgrade"
  },

  // Panel to position the top quarter of screen
  "icon_and_text_panel": {
    "type": "panel",
    "anchor_from": "top_left",
    "anchor_to": "top_left",
    "size": [ "65%", "40%" ],
    "offset": [ 0, 0 ],
    "controls": [
      { "smithing_icon_panel@smithing_table_2.smithing_icon_panel": {} },
      { "upgrade_label@smithing_table_2.upgrade_label": {} }
    ]
  },

  // Panel to position the icon
  "smithing_icon_panel": {
    "type": "panel",
    "anchor_from": "top_left",
    "anchor_to": "top_left",
    "controls": [
      { "smithing_icon@smithing_table_2.smithing_icon": {} }
    ]
  },

  // #endregion

  //------------------------------------------------------------------------------------
  // #region Recipe (template, input, material and results) area (2nd quarter of screen)
  //------------------------------------------------------------------------------------

  "smithing_image": {
    "type": "image",
    "anchor_to": "top_left",
    "anchor_from": "top_left",
    "layer": 1,
    "offset": [ 1, 1 ],
    "size": [ 16, 16 ]
  },

  "smithing_material_image_ingot@smithing_table_2.smithing_image": {
    "texture": "textures/ui/ingot_image"
  },

  "arrow_icon": {
    "type": "image",
    "texture": "textures/ui/arrow_large",
    "size": [ 18, 12 ]
  },

  "cross_out_icon_image": {
    "type": "image",
    "texture": "textures/ui/crossout",
    "size": [ 18, 12 ]
  },

  "cross_out_icon_button": {
    "type": "button",
    "hover_control": "hover",
    "controls": [
      { "default@smithing_table_2.cross_out_icon_image": {} },
      {
        "hover@common.hover_text": {
          "layer": 29,
          "$hover_text_max_width": 500,
          "bindings": [
            {
              "binding_name": "#no_result_arrow_tooltip",
              "binding_name_override": "#hover_text"
            }
          ]
        }
      }
    ],
    "bindings": [
      {
        "binding_name": "#cross_out_icon",
        "binding_name_override": "#visible"
      }
    ]
  },

  "templates_animation": {
    "anim_type": "flip_book",
    "initial_uv": [ 0, 0 ],
    "frame_count": 2,
    "frame_step": 0, // Unused
    "fps": 1.0,
    "easing": "linear" // Unused
  },

  "armors_animation": {
    "anim_type": "flip_book",
    "initial_uv": [ 0, 0 ],
    "frame_count": 4,
    "frame_step": 0, // Unused
    "fps": 1.0,
    "easing": "linear" // Unused
  },

  "armors_and_tools_animation": {
    "anim_type": "flip_book",
    "initial_uv": [ 0, 0 ],
    "frame_count": 9,
    "frame_step": 0, // Unused
    "fps": 1.0,
    "easing": "linear" // Unused
  },

  "all_materials_animation": {
    "anim_type": "flip_book",
    "initial_uv": [ 0, 0 ],
    "frame_count": 7,
    "frame_step": 0, // Unused
    "fps": 1.0,
    "easing": "linear" // Unused
  },

  "smithing_input_image_templates@smithing_table_2.smithing_image": {
    "texture": "textures/ui/templates_slot_overlay",
    "uv": "@smithing_table_2.templates_animation",
    "uv_size": [ 16, 16 ]
  },

  "smithing_input_image_armors@smithing_table_2.smithing_image": {
    "texture": "textures/ui/armors_slot_overlay",
    "uv": "@smithing_table_2.armors_animation",
    "uv_size": [ 16, 16 ]
  },

  "smithing_input_image_armors_and_tools@smithing_table_2.smithing_image": {
    "texture": "textures/ui/armors_and_tools_slot_overlay",
    "uv": "@smithing_table_2.armors_and_tools_animation",
    "uv_size": [ 16, 16 ]
  },

  "smithing_material_image_all@smithing_table_2.smithing_image": {
    "texture": "textures/ui/smithing_material_slot_overlay",
    "uv": "@smithing_table_2.all_materials_animation",
    "uv_size": [ 16, 16 ]
  },

  "template_overlay_image": {
    "type": "panel",
    "controls": [
      {
        "templates@smithing_table_2.smithing_input_image_templates": {
          "bindings": [
            {
              "binding_name": "#show_input_overlay_templates",
              "binding_name_override": "#visible"
            }
          ]
        }
      }
    ]
  },

  "input_overlay_image": {
    "type": "panel",
    "controls": [
      {
        "armors_and_tools@smithing_table_2.smithing_input_image_armors_and_tools": {
          "bindings": [
            {
              "binding_name": "#show_input_overlay_armors_and_tools",
              "binding_name_override": "#visible"
            }
          ]
        }
      },
      {
        "armors@smithing_table_2.smithing_input_image_armors": {
          "bindings": [
            {
              "binding_name": "#show_input_overlay_armors",
              "binding_name_override": "#visible"
            }
          ]
        }
      }
    ]
  },

  "material_overlay_image": {
    "type": "panel",
    "controls": [
      {
        "all_materials@smithing_table_2.smithing_material_image_all": {
          "bindings": [
            {
              "binding_name": "#show_material_overlay_all",
              "binding_name_override": "#visible"
            }
          ]
        }
      },
      {
        "ingot@smithing_table_2.smithing_material_image_ingot": {
          "bindings": [
            {
              "binding_name": "#show_material_overlay_ingot",
              "binding_name_override": "#visible"
            }
          ]
        }
      }
    ]
  },

  // #endregion

  "smithing_table_output_slot_button@common.container_slot_button_prototype": {
    "button_mappings": [
      {
        "from_button_id": "button.menu_select",
        "to_button_id": "button.smithing_table_take_all_place_all",
        "mapping_type": "pressed"
      },
      {
        "from_button_id": "button.menu_ok",
        "to_button_id": "button.smithing_table_take_all_place_all",
        "mapping_type": "pressed"
      },
      {
        "from_button_id": "button.controller_back",
        "to_button_id": "button.smithing_table_take_all_place_all",
        "mapping_type": "pressed",
        "ignored": "(not $is_ps4)"
      },
      {
        "from_button_id": "button.menu_secondary_select",
        "to_button_id": "button.smithing_table_take_half_place_one",
        "mapping_type": "pressed"
      },
      {
        "from_button_id": "button.controller_select",
        "to_button_id": "button.smithing_table_take_half_place_one",
        "mapping_type": "pressed"
      },
      {
        "from_button_id": "button.menu_auto_place",
        "to_button_id": "button.container_auto_place",
        "mapping_type": "pressed"
      },
      {
        "from_button_id": "button.controller_secondary_select",
        "to_button_id": "button.container_auto_place",
        "mapping_type": "pressed"
      },
      {
        "from_button_id": "button.menu_inventory_drop",
        "to_button_id": "button.drop_one",
        "mapping_type": "pressed"
      },
      {
        "from_button_id": "button.menu_inventory_drop_all",
        "to_button_id": "button.drop_all",
        "mapping_type": "pressed"
      },
      {
        "from_button_id": "button.menu_select",
        "to_button_id": "button.smithing_table_coalesce_stack",
        "mapping_type": "double_pressed"
      },
      {
        "from_button_id": "button.menu_ok",
        "to_button_id": "button.smithing_table_coalesce_stack",
        "mapping_type": "double_pressed"
      },
      {
        "to_button_id": "button.container_slot_hovered",
        "mapping_type": "pressed"
      }
    ]
  },

  "smithing_table_item_slot": {
    "type": "panel",
    "controls": [
      {
        "container_item@common.container_item": {
          "anchor_to": "center",
          "anchor_from": "center",
          "$hover_text_max_width": 500
        }
      }
    ]
  },

  "recipe_grid": {
    "type": "grid",
    "size": [ "100%", "90%" ],
    "anchor_from": "left_middle",
    "anchor_to": "left_middle",
    "grid_dimensions": [ 9, 1 ],
    "controls": [
      {
        "template_item_slot@smithing_table_2.smithing_table_item_slot": {
          "grid_position": [ 0, 0 ],
          "$item_collection_name": "smithing_table_template_items",
          "$cell_overlay_ref": "smithing_table_2.template_overlay_image",

          "$focus_id_binding_type": "none",
          "$focus_id": "smithing_table_template",

          "$focus_override_right_binding_type": "none",
          "$focus_override_right": "smithing_table_input"
        }
      },
      {
        "input_item_slot@smithing_table_2.smithing_table_item_slot": {
          "grid_position": [ 1, 0 ],
          "$item_collection_name": "smithing_table_input_items",
          "$cell_overlay_ref": "smithing_table_2.input_overlay_image",

          "$focus_id_binding_type": "none",
          "$focus_id": "smithing_table_input",

          "$focus_override_right_binding_type": "none",
          "$focus_override_right": "smithing_table_material",

          "$focus_override_left_binding_type": "none",
          "$focus_override_left": "smithing_table_template"
        }
      },
      {
        "material_item_slot@smithing_table_2.smithing_table_item_slot": {
          "grid_position": [ 2, 0 ],
          "$item_collection_name": "smithing_table_material_items",
          "$cell_overlay_ref": "smithing_table_2.material_overlay_image",

          "$focus_id_binding_type": "none",
          "$focus_id": "smithing_table_material",

          "$focus_override_left_binding_type": "none",
          "$focus_override_left": "smithing_table_input",

          "$focus_override_right_binding_type": "none",
          "$focus_override_right": "smithing_table_result"
        }
      },
      {
        "yields": {
          "type": "panel",
          "grid_position": [ 3, 0 ],
          "size": [ "22.2%", "100%" ], // Center across two grid columns
          "controls": [
            { "arrow_icon@smithing_table_2.arrow_icon": {} },
            {
              "cross_out_icon@smithing_table_2.cross_out_icon_button": {
                "layer": 1
              }
            }
          ]
        }
      },
      {
        "result_item_slot@smithing_table_2.smithing_table_item_slot": {
          "grid_position": [ 5, 0 ],
          "$item_collection_name": "smithing_table_result_items",
          "$button_ref": "smithing_table_2.smithing_table_output_slot_button",

          "$focus_id_binding_type": "none",
          "$focus_id": "smithing_table_result",

          "$focus_override_left_binding_type": "none",
          "$focus_override_left": "smithing_table_material"
        }
      },
      {
        "result_item_preview@smithing_table_2.result_item_preview": {
          "grid_position": [ 7, 0 ]
        }
      }
    ]
  },

  "recipe_panel": {
    "type": "panel",
    "anchor_from": "top_left",
    "anchor_to": "top_left",
    "size": [ "100%", "60%" ],
    "offset": [ 0, "40%" ],
    "controls": [
      { "recipe_grid@smithing_table_2.recipe_grid": {} }
    ]
  },

  //------------------------------------------------------------------------------------
  // #region Result item preview
  //------------------------------------------------------------------------------------

  "result_item_preview": {
    "type": "panel",
    "controls": [
      {
        "inner@smithing_table_2.result_item_preview_inner": {}
      }
    ]
  },

  "result_item_preview_inner": {
    "type": "panel",
    "size": [ "25px", "25px" ],
    "offset": [ "2px", 0 ],
    "controls": [
      {
        "smithing_preview_renderer": {
          "type": "custom",
          "renderer": "equipment_preview_renderer",
          "animation_reset_name": "screen_animation_reset",
          "anims": [
            "@common.screen_exit_size_animation_push",
            "@common.screen_exit_size_animation_pop",
            "@common.screen_entrance_size_animation_push",
            "@common.screen_entrance_size_animation_pop"
          ],
          "layer": 8,
          "rotation_x": 30,
          "rotation_y": -30,
          "bindings": [
            {
              "binding_name": "#item_id_aux",
              "binding_type": "collection",
              "binding_collection_name": "smithing_table_result_items"
            },
            {
              "binding_name": "#item_custom_color",
              "binding_type": "collection",
              "binding_collection_name": "smithing_table_result_items"
            },
            {
              "binding_name": "#armor_trim_pattern",
              "binding_type": "collection",
              "binding_collection_name": "smithing_table_result_items"
            },
            {
              "binding_name": "#armor_trim_material",
              "binding_type": "collection",
              "binding_collection_name": "smithing_table_result_items"
            }
          ]
        }
      }
    ]
  },

  // #endregion

  //------------------------------------------------------------------------------------
  // #region Toolbar
  //------------------------------------------------------------------------------------

  "toolbar_background": {
    "type": "image",
    "texture": "textures/ui/toolbar_background"
  },

  "help_button@common.help_button": {
    "layer": 5,
    "$focus_id": "help_button",
    "$focus_override_up": "FOCUS_OVERRIDE_STOP"
  },

  "toolbar_panel@common.root_panel": {
    "size": [ "100%c", 20 ],
    "controls": [
      {
        "toolbar_background@loom.toolbar_background": {
          "size": [ "100%cm", "100% + 8px" ],
          "offset": [ 0, -5 ],
          "anchor_from": "top_right",
          "anchor_to": "top_right",

          "controls": [
            {
              "toolbar_stack_panel": {
                "type": "stack_panel",
                "orientation": "horizontal",

                "size": [ "default", "100% - 8px" ],
                "offset": [ 0, 3 ],
                "anchor_from": "top_middle",
                "anchor_to": "top_middle",

                "controls": [
                  {
                    "padding_1": {
                      "type": "panel",
                      "size": [ 6, 0 ]
                    }
                  },
                  {
                    "help_button_panel": {
                      "type": "panel",
                      "size": [ "100%c", "100%" ],
                      "controls": [
                        { "help_button@loom.help_button": {} }
                      ]
                    }
                  },
                  {
                    "close_button_panel": {
                      "type": "panel",
                      "size": [ "100%c", "100%" ],
                      "bindings": [
                        {
                          "binding_name": "#close_button_visible",
                          "binding_name_override": "#visible"
                        }
                      ],
                      "controls": [
                        {
                          "close_button@common.light_close_button": {
                            "size": [ "100%cm", "100%cm" ],
                            "offset": [ 0, 0 ],
                            "anchor_from": "center",
                            "anchor_to": "center"
                          }
                        }
                      ]
                    }
                  },
                  {
                    "padding_2": {
                      "type": "panel",
                      "size": [ 6, 0 ]
                    }
                  }
                ]
              }
            }
          ]
        }
      }
    ]
  },

  "toolbar_anchor": {
    "type": "panel",
    "size": [ 176, 166 ],
    "inherit_max_sibling_height": true,
    "controls": [
      {
        "toolbar_panel@smithing_table_2.toolbar_panel": {
          "anchor_from": "top_right",
          "anchor_to": "bottom_right"
        }
      }
    ]
  },

  // #endregion

  //------------------------------------------------------------------------------------
  // #region Screen
  //------------------------------------------------------------------------------------

  "top_half_panel": {
    "type": "panel",
    "anchor_from": "top_left",
    "anchor_to": "top_left",
    "size": [ "100% - 14px", "50% - 14px" ],
    "offset": [ 7, 7 ],
    "controls": [
      { "icon_and_text_panel@smithing_table_2.icon_and_text_panel": {} },
      { "recipe_panel@smithing_table_2.recipe_panel": {} }
    ]
  },

  "smithing_table_panel": {
    "type": "panel",
    "controls": [
      { "container_gamepad_helpers@common.container_gamepad_helpers": {} },
      { "selected_item_details_factory@common.selected_item_details_factory": {} },
      { "item_lock_notification_factory@common.item_lock_notification_factory": {} },
      {
        "root_panel@common.root_panel": {
          "layer": 1,
          "controls": [
            {
              "common_panel@common.common_panel": {
                "$show_close_button": false
              }
            },
            {
              "smithing_table_screen_inventory": {
                "type": "panel",
                "layer": 2,
                "controls": [
                  { "top_half_panel@smithing_table_2.top_half_panel": {} },
                  { "inventory_panel_bottom_half_with_label@common.inventory_panel_bottom_half_with_label": {} },
                  { "hotbar_grid@common.hotbar_grid_template": {} },
                  { "inventory_take_progress_icon_button@common.inventory_take_progress_icon_button": {} }
                ]
              }
            },
            { "inventory_selected_icon_button@common.inventory_selected_icon_button": {} },
            { "toolbar_anchor@smithing_table_2.toolbar_anchor": {} },
            { "gamepad_cursor@common.gamepad_cursor_button": {} }
          ]
        }
      },
      { "flying_item_renderer@common.flying_item_renderer": { "layer": 21 } }
    ]
  }

  // #endregion

}
