/*var disableHashChange = false;

$(document).ready(function ($) {
    $(window).on("hashchange", function () {
        var hash = location.hash;
        if (!disableHashChange && hash) {
            var formData = $.deparam(hash.substr(1));
            if (
                formData &&
                formData.formId &&
                $("#" + formData.formId).length
            ) {
                $("#" + formData.formId).values(formData);
                $("#" + formData.formId).submitForm();
            } else if ($(jQuerySelectorEscape(hash)).length) {
                $(jQuerySelectorEscape(hash)).click();
            }
        }
        if (disableHashChange) {
            disableHashChange = false;
        }
    });

    $(window).trigger("hashchange");
});


const hashchange = () => {
    var disableHashChange = false;

    window.addEventListener('hashchange', function () {
        var hash = location.hash;
        if (!disableHashChange && hash) {
            var formData = new URLSearchParams(hash.substr(1));
            var formId = formData.get('formId');

            if (formData && formId && document.getElementById(formId)) {
                var formElement = document.getElementById(formId);
                
                for (let [key, value] of formData.entries()) {
                    var inputElement = formElement.querySelector(`[name="${key}"]`);
                    if (inputElement) {
                        inputElement.value = value;
                    }
                }
                
                formElement.submit();
            } else if (document.querySelector(hash)) {
                document.querySelector(hash).click();
            }
        }
        if (disableHashChange) {
            disableHashChange = false;
        }
    });
}

export { hashchange };
*/