{
    "namespace": "chest_ui",
    "chest_label": {
        "type": "label",
        "text": "#title_text",
        "color": "$title_text_color",
        "layer": 2,
        "anchor_from": "bottom_left",
        "anchor_to": "bottom_left"
    },
    "grid_items": {
        "type": "grid",
        "size": [
            "100%",
            "default"
        ],
        "offset": [
            0,
            0
        ],
        "grid_dimensions": "$grid_size",
        "grid_item_template": "chest_ui.inventory_item_panel",
        "collection_name": "form_buttons",
        "layer": 1
    },
    
    "chest_ui_template": {
        "type": "panel",
        "size": [
            "100%c",
            "100%c"
        ],
        "bindings": [
            {
                "binding_name": "#title_text",
                "binding_type": "global"
            },
            {
                "binding_type": "view",
                "source_property_name": "(not ((#title_text - $condition) = #title_text))",
                "target_property_name": "#visible"
            }
        ],
        "controls": [
            {
                "background": {
                    "type": "image",
                    "texture": "$border_and_background_texture",
                    "layer": 0,
                    "size": [
                        "100%c + 14px",
                        "100%c + 11px"
                    ],
                    "controls": [
                        {
                            "container": {
                                "type": "panel",
                                "size": [
                                    "100%c",
                                    "100%c"
                                ],
                                "controls": [
                                    {
                                        "stack": {
                                            "type": "stack_panel",
                                            "orientation": "vertical",
                                            "size": [
                                                "162px",
                                                "100%c"
                                            ],
                                            "controls": [
                                                {
                                                    "gap@common.empty_panel": {
                                                        "size": [
                                                            "100%",
                                                            6
                                                        ],
                                                        "controls": [
                                                            {
                                                                "close_button@common.close_button": {
                                                                    "$close_button_offset": [
                                                                        5,
                                                                        -3
                                                                    ]
                                                                }
                                                            }
                                                        ]
                                                    }
                                                },
                                                {
                                                    "text@chest_ui.chest_label": {}
                                                },
                                                {
                                                    "grid@chest_ui.grid_items": {}
                                                },
                                                {
                                                    "gap2@common.empty_panel": {
                                                        "size": [
                                                            0,
                                                            1
                                                        ]
                                                    }
                                                },
                                                {
                                                    "inventory_label@chest_ui_inventory_system.inventory_label": {}
                                                },
                                                {
                                                    "inventory_items@chest_ui_inventory_system.inventory_items": {}
                                                },
                                                {
                                                    "gap3@common.empty_panel": {
                                                        "size": [
                                                            0,
                                                            3
                                                        ],
                                                        "ignored": "(not $show_inventory)"
                                                    }
                                                },
                                                {
                                                    "hotbar_items@chest_ui_inventory_system.hotbar_items": {}
                                                }
                                            ]
                                        }
                                    }
                                ]
                            }
                        }
                    ]
                }
            }
        ]
    },
    "chest_panel": {
        "type": "panel",
        "size": [
            "100%",
            "100%"
        ],
        "controls": [
            {
                "09@chest_ui.chest_ui_template": {
                    "$grid_size": [
                        9,
                        1
                    ],
                    "$condition": "§c§h§e§s§t§0§9",
                    "ignored": "$disable_9_slots_layout"
                }
            },
            {
                "01@chest_ui.chest_ui_template": {
                    "$grid_size": [
                        1,
                        1
                    ],
                    "$condition": "§c§h§e§s§t§0§1",
                    "ignored": "$disable_1_slots_layout"
                }
            },
            {
                "05@chest_ui.chest_ui_template": {
                    "$grid_size": [
                        5,
                        1
                    ],
                    "$condition": "§c§h§e§s§t§0§5",
                    "ignored": "$disable_5_slots_layout"
                }
            },
            {
                "18@chest_ui.chest_ui_template": {
                    "$grid_size": [
                        9,
                        2
                    ],
                    "$condition": "§c§h§e§s§t§1§8",
                    "ignored": "$disable_18_slots_layout"
                }
            },
            {
                "27@chest_ui.chest_ui_template": {
                    "$grid_size": [
                        9,
                        3
                    ],
                    "$condition": "§c§h§e§s§t§2§7",
                    "ignored": "$disable_27_slots_layout"
                }
            },
            {
                "36@chest_ui.chest_ui_template": {
                    "$grid_size": [
                        9,
                        4
                    ],
                    "$condition": "§c§h§e§s§t§3§6",
                    "ignored": "$disable_36_slots_layout"
                }
            },
            {
                "45@chest_ui.chest_ui_template": {
                    "$grid_size": [
                        9,
                        5
                    ],
                    "$condition": "§c§h§e§s§t§4§5",
                    "ignored": "$disable_45_slots_layout"
                }
            },
            {
                "54@chest_ui.chest_ui_template": {
                    "$grid_size": [
                        9,
                        6
                    ],
                    "$condition": "§c§h§e§s§t§5§4",
                    "ignored": "$disable_54_slots_layout"
                }
            }
        ]
    },
    "inventory_item_panel": {
        "type": "panel",
        "size": [
            18,
            18
        ],
        "layer": 1,
        "controls": [
            {
                "bg@chest_ui.cell": {}
            },
            {
                "inventory_button_amount@chest_ui.inventory_button_amount": {}
            },
            {
                "inventory_item@chest_ui.inventory_item": {}
            }
        ]
    },
    "inventory_item@common.button": {
        "$pressed_button_name": "button.form_button_click",
        "bindings": [
            {
                "binding_name": "#null",
                "binding_type": "collection",
                "binding_condition": "none",
                "binding_collection_name": "form_buttons"
            },
            {
                "binding_name": "#null",
                "binding_type": "collection_details",
                "binding_collection_name": "form_buttons"
            },
            {
                "binding_name": "#form_button_text",
                "binding_type": "collection",
                "binding_collection_name": "form_buttons"
            },
            {
                "binding_name": "#null",
                "binding_type": "view",
                "source_property_name": "(not (#form_button_text = ''))",
                "target_property_name": "#visible"
            }
        ],
        "$aux_id": [
            {
                "binding_name": "#form_button_texture",
                "binding_type": "collection",
                "binding_collection_name": "form_buttons"
            },
            {
                "binding_type": "view",
                "source_property_name": "(not (('%.8s' * #form_button_texture) = 'textures'))",
                "target_property_name": "#visible"
            },
            {
                "binding_type": "view",
                "source_property_name": "(not ((#texture = '') or (#texture = 'loading')))",
                "target_property_name": "#visible"
            },
            {
                "binding_type": "view",
                "source_property_name": "(#form_button_texture * 1)",
                "target_property_name": "#item_id_aux"
            }
        ],
        "default_control": "default",
        "hover_control": "hover",
        "pressed_control": "pressed",
        "controls": [
            {
                "default@chest_ui.default_control": {}
            },
            {
                "hover@chest_ui.hover_control": {}
            },
            {
                "pressed@chest_ui.pressed_control": {}
            }
        ]
    },
    "default_control": {
        "type": "panel",
        "size": [
            16,
            16
        ],
        "controls": [
            {
                "item@beacon.item_renderer": {
                    "size": [
                        16,
                        16
                    ],
                    "layer": 4,
                    "bindings": "$aux_id"
                }
            },
            {
                "durability_bar@chest_ui.durability_bar": {}
            },
            {
                "non_renderer_item@chest_ui.non_renderer_item": {}
            }
        ]
    },
    "hover_control": {
        "type": "panel",
        "size": [
            18,
            18
        ],
        "controls": [
            {
                "item@beacon.item_renderer": {
                    "size": [
                        16,
                        16
                    ],
                    "layer": 4,
                    "bindings": "$aux_id",
                    "offset": [
                        1,
                        1
                    ]
                }
            },
            {
                "durability_bar@chest_ui.durability_bar": {
                    "offset": [
                        0,
                        -2.5
                    ]
                }
            },
            {
                "non_renderer_item@chest_ui.non_renderer_item": {}
            },
            {
                "item_details@chest_ui.item_details": {}
            },
            {
                "highlight_slot@chest_ui.highlight_slot": {}
            },
            {
                "focus_border@chest_ui.focus_border": {}
            }
        ]
    },
    "pressed_control": {
        "type": "panel",
        "size": [
            16,
            16
        ],
        "controls": [
            {
                "item@beacon.item_renderer": {
                    "size": [
                        16,
                        16
                    ],
                    "layer": 4,
                    "bindings": "$aux_id"
                }
            },
            {
                "durability_bar@chest_ui.durability_bar": {}
            },
            {
                "non_renderer_item@chest_ui.non_renderer_item": {}
            },
            {
                "focus_border@chest_ui.focus_border": {}
            }
        ]
    },
    "highlight_slot": {
        "type": "image",
        "size": [
            18,
            18
        ],
        "texture": "textures/ui/highlight_slot",
        "layer": 3
    },
    "focus_border": {
        "type": "image",
        "size": [
            18,
            18
        ],
        "texture": "textures/ui/focus_border_white",
        "layer": 4
    },
    "item_details": {
        "type": "custom",
        "renderer": "hover_text_renderer",
        "allow_clipping": false,
        "layer": 30,
        "bindings": [
            {
                "binding_name": "#form_button_text",
                "binding_type": "collection",
                "binding_collection_name": "form_buttons"
            },
            {
                "binding_type": "view",
                "source_property_name": "(#form_button_text - ('%.14s' * #form_button_text))",
                "target_property_name": "#hover_text"
            },
            {
                "binding_type": "collection_details",
                "binding_collection_name": "form_buttons"
            }
        ]
    },
    "durability_bar": {
        "type": "image",
        "texture": "textures/enchanting_plus/ui/d_b",
        "size": [
            14,
            2
        ],
        "layer": 8,
        "anchor_from": "bottom_middle",
        "anchor_to": "bottom_middle",
        "offset": [
            0,
            -1.5
        ],
        "bindings": [
            {
                "binding_type": "collection_details",
                "binding_collection_name": "form_buttons"
            },
            {
                "binding_name": "#form_button_text",
                "binding_type": "collection",
                "binding_collection_name": "form_buttons"
            },
            {
                "binding_type": "view",
                "source_property_name": "((#form_button_text - 'dur#00') = #form_button_text)",
                "target_property_name": "#visible"
            }
        ],
        "controls": [
            {
                "val": {
                    "type": "image",
                    "layer": 7,
                    "texture": "textures/enchanting_plus/ui/d_g",
                    "size": [
                        "100%",
                        "50%"
                    ],
                    "offset": [
                        0,
                        -0.5
                    ],
                    "clip_pixelperfect": false,
                    "clip_direction": "left",
                    "$clip_max": 99,
                    "$one": 1.0,
                    "bindings": [
                        {
                            "binding_type": "collection_details",
                            "binding_collection_name": "form_buttons"
                        },
                        {
                            "binding_name": "#form_button_text",
                            "binding_type": "collection",
                            "binding_collection_name": "form_buttons"
                        },
                        {
                            "binding_type": "view",
                            "source_property_name": "((%.14s * #form_button_text) - (%.12s * #form_button_text))",
                            "target_property_name": "#ratio"
                        },
                        {
                            "binding_type": "view",
                            "source_property_name": "(#ratio * $one)",
                            "target_property_name": "#ratio_1"
                        },
                        {
                            "binding_type": "view",
                            "source_property_name": "(($clip_max - #ratio_1) / $clip_max)",
                            "target_property_name": "#clip_ratio"
                        }
                    ]
                }
            }
        ]
    },
    "inventory_button_amount": {
        "type": "panel",
        "controls": [
            {
                "item_amount": {
                    "type": "label",
                    "offset": [
                        0,
                        1
                    ],
                    "shadow": true,
                    "text_alignment": "left",
                    "anchor_from": "bottom_right",
                    "anchor_to": "bottom_right",
                    "color": "$tool_tip_text",
                    "layer": 6,
                    "text": "#stack_size",
                    "bindings": [
                        {
                            "binding_name": "#null",
                            "binding_type": "collection",
                            "binding_condition": "none",
                            "binding_collection_name": "form_buttons"
                        },
                        {
                            "binding_name": "#null",
                            "binding_type": "collection_details",
                            "binding_collection_name": "form_buttons"
                        },
                        {
                            "binding_name": "#form_button_text",
                            "binding_type": "collection",
                            "binding_collection_name": "form_buttons"
                        },
                        {
                            "binding_name": "#null",
                            "binding_type": "view",
                            "source_property_name": "((#form_button_text - 'stack#01') = #form_button_text)",
                            "target_property_name": "#visible"
                        },
                        {
                            "binding_name": "#null",
                            "binding_type": "view",
                            "source_property_name": "(('§z') + (('%.8s' * #form_button_text) - ('%.6s' * #form_button_text)))",
                            "target_property_name": "#stack_size"
                        }
                    ]
                }
            }
        ]
    },
    "non_renderer_item": {
        "type": "image",
        "size": [
            16,
            16
        ],
        "layer": 4,
        "bindings": [
            {
                "binding_name": "#form_button_texture",
                "binding_name_override": "#texture",
                "binding_type": "collection",
                "binding_collection_name": "form_buttons"
            },
            {
                "binding_type": "view",
                "source_property_name": "(not ((#texture = '') or (#texture = 'loading')))",
                "target_property_name": "#visible"
            },
            {
                "binding_type": "view",
                "source_property_name": "(('%.8s' * #texture) = 'textures')",
                "target_property_name": "#visible"
            }
        ]
    },
    "cell": {
        "type": "image",
        "texture": "textures/enchanting_plus/ui/item_background",
        "size": [
            18,
            18
        ],
        "layer": 2
    }
}