function setupElementLists() {
    $('#menu').empty();

    window.circuitElementList = metadata.circuitElementList;
    window.annotationList = metadata.annotationList;
    window.inputList = metadata.inputList;
    window.subCircuitInputList = metadata.subCircuitInputList;
    window.moduleList = [...circuitElementList, ...annotationList];
    window.updateOrder = ['wires', ...circuitElementList, 'nodes', ...annotationList]; // Order of update
    window.renderOrder = [...(moduleList.slice().reverse()), 'wires', 'allNodes']; // Order of render

    function createIcon(element) {
        return `<div class="icon logixModules" id="${element.name}" title="${element.label}">
            <img src= "/img/${element.name}.svg" alt="element's image" >
        </div>`;
    }

    window.elementHierarchy = metadata.elementHierarchy;
    window.elementPanelList = [];
    for (const category in elementHierarchy) {
        let htmlIcons = '';
        const categoryData = elementHierarchy[category];
        for (let i = 0; i < categoryData.length; i++) {
            const element = categoryData[i];
            if (!(element.name).startsWith('verilog')) {
                htmlIcons += createIcon(element);
                window.elementPanelList.push(element.label);
            }
        }

        const accordionData = `<div class="panelHeader">${category}</div>
        <div class="panel customScroll">
        ${htmlIcons}
        </div>`;
        const touchaccordionData = `<div class="mobilepanelHeader">${category}</div>
        <div class="panel customScroll">
        ${htmlIcons}
        </div>`;

        $('#menu').append(accordionData);
        $('#menu2').append(touchaccordionData);
    }
}
It initializes some useful array which are helpful
while simulating, saving and loading project.
It also draws icons in the sidebar
@category setup