function array_key_exists(key, obj) {
    return obj.hasOwnProperty(key);
}

// Function to log an error when a translation key is missing
function getLogError(code) {
    console.error(`Translation key missing: ${ code }`);
}

jQuery(function run($) {
    /*
     *
     * NewStyle iFrame v2.2
     * Bootstrap 5.3
     *
     */
    var edoobox = {
        data: {
            bs_version: 5,
            payrun: false,
            frame_edid: '',
            payment: {
                stripe: {},
                elements: {},
                card: {}
            },
            modals: {
                loading: null
                
            }
        },
        l: function (a) {
            console.info(a);
        },
        sizeFrame: function () {
            //grösse nach wenigen sec anpassen
            if (edoobox.data.frame_edid != '') {
                try {
                    window.parent.postMessage(['setheight', $('body').outerHeight(), edoobox.data.frame_edid], '*');
                } catch (e) {
                }
                setTimeout(function () {
                    try {
                        window.parent.postMessage(['setheight', $('body').outerHeight(), edoobox.data.frame_edid], '*');
                    } catch (e) {
                    }
                }, 50);
                setTimeout(function () {
                    try {
                        window.parent.postMessage(['setheight', $('body').outerHeight(), edoobox.data.frame_edid], '*');
                    } catch (e) {
                    }
                }, 150);
            }
        },
        noCache: function () {
            return '/cAe-' + Math.round(new Date().getTime());
        },
        //DataLayerPush
        iFrameDataLayerPush: function (data) {
            // Überprüfen, ob data.ecommerce undefined oder null ist UND ob data.booking_id nicht vorhanden ist
            if ((typeof data.ecommerce === 'undefined' || data.ecommerce === null) && typeof data.booking_id === 'undefined') {
                return; // Beendet die Funktion frühzeitig, wenn keine relevanten Daten gefunden werden
            }
            
            // Wenn data.booking_id vorhanden ist, senden Sie diese Daten
            if (typeof data.booking_id !== 'undefined') {
                window.parent.postMessage(['gtmedoobox', { 'booking_id': data.booking_id }, edoobox.data.frame_edid], '*');
            }
            // Andernfalls, wenn data.ecommerce vorhanden ist (aber nicht data.booking_id), senden Sie diese Daten
            else if (typeof data.ecommerce !== 'undefined' && data.ecommerce !== null) {
                window.parent.postMessage(['gtmedoobox', data, edoobox.data.frame_edid], '*');
            }
        },
        //Input vom iFrame
        iFrameListener: function (e) {
            var eventName = e.data[0],
                data      = e.data[1],
                edid      = edoobox.getArg('edref');
            edoobox.data.frame_edid = edoobox.getArg('edref');
            switch (eventName) {
                case 'getheight':
                    try {
                        window.parent.postMessage(['setheight', $('body').outerHeight(), edid], '*');
                    } catch (e) {
                    }
                    break;
                case 'setwidth':
                    //Wenn das iFrame dem Content die Breite übergibt
                    $('body').width(data);
                    break;
                case 'google_ecommerce':
                    var cid = JSON.parse(data).cid;
                    
                    //IST cid nicht false
                    if (cid) {
                        if (typeof doGoogleTrack1 == "function") {
                            doGoogleTrack1(cid);
                        }
                        if (typeof doGoogleTrack2 == "function") {
                            doGoogleTrack2(cid);
                        }
                        if (typeof doGoogleTrack3 == "function") {
                            doGoogleTrack3(cid);
                        }
                    }
                    break;
            }
        },
        
        //Wenn JavaScript aktiv
        ActiveJavaScript: function () {
            $('.hidden').removeClass('hidden');
            
            var loading_element = document.getElementById('ed_loading_Modal');
            if (loading_element) {
                if ($('#ed_loading_Modal').attr('data-gtm') == '0') {
                    edoobox.data.modals.loading = new bootstrap.Modal(loading_element, {
                        keyboard: false,
                        backdrop: 'static',
                        show: false
                    });
                } else {
                    edoobox.data.modals.loading = new bootstrap.Modal(loading_element, {
                        keyboard: false,
                        backdrop: false,
                        show: true
                    });
                }
            }
            
            $(document).on("submit", "form", function (e) {
                $('button').prop('disabled', true);
                setTimeout(function () {
                    $('button').prop('disabled', false);
                }, 500);
                if (loading_element) {
                    edoobox.data.modals.loading.show();
                }
            });
            
            if (typeof moment == "function") {
                var locale = window.navigator.userLanguage || window.navigator.language;
                moment.locale(locale);
            }
            
        },
        
        //Input mit Anzahl einen Spinner Init
        InitSpinner: function () {
            $('.spinner').click(function (e) {
                var inp = $('#' + $(this).data('spinner'));
                if ($(this).hasClass('minus')) {
                    var val = (inp.val() * 1) - 1;
                    if (val >= 0) {
                        inp.val(val);
                    } else {
                        inp.val(0);
                    }
                } else {
                    inp.val((inp.val() * 1) + 1);
                }
            });
        },
        facebookv2_11: {
            onlogin: function () {
                edoobox.data.modals.loading.show();
                edoobox.facebookv2_11.checkLogin();
            },
            checkLogin: function () {
                FB.getLoginStatus(function (response) {
                    //Wenn verbunden, dann Anmeldung durchführen
                    if (response.status == 'connected') {
                        edoobox.facebookv2_11.updateBooking(response.authResponse);
                    } else {
                        edoobox.data.modals.loading.hide();
                    }
                });
            },
            updateBooking: function (fbObj) {
                $.ajax({
                    type: 'post',
                    async: true,
                    dataType: 'json',
                    url: $ajU.jsFB,
                    data: {
                        accessToken: fbObj.accessToken,
                        expiresIn: fbObj.expiresIn,
                        signedRequest: fbObj.signedRequest,
                        userID: fbObj.userID
                    },
                    success: function (json) {
                        if (json.ok == false) {
                            //Das Login ist fehlgeschlagen, Meldung ausbelden
                            edoobox.data.modals.loading.hide();
                        } else {
                            //Die Person wurde angemeldet, Seite muss neu geladen werden
                            location.reload(); //Wenn nicht läuft dann ein TRUE in die Klammern
                        }
                    }
                });
            }
        },
        widget_func: {
            taskTracking: [],
            tracking: false,
            RunCookie: function (Task) {
                if (Task.run == true) {
                    edoobox.widget_func[Task.func]();
                }
            },
            NoCookie: function () {
                edoobox.widget_func.tracking = false;
                edoobox.widget_func.taskTracking = [];
            },
            YesCookie: function () {
                edoobox.widget_func.tracking = true;
                edoobox.widget_func.taskTracking.map(edoobox.widget_func.RunCookie);
                if (typeof googleGTM1 !== "undefined") {
                    googleGTM1();
                }
                if (typeof googleGTM2 !== "undefined") {
                    googleGTM2();
                }
            },
            cookiebanner: function () {
                if (top.location != location) {
                    //Soll im iFrame der Banner angezeigt werden?
                    if ($('.cookiebanner').data('iframe') != 1) {
                        $('.cookiebanner').remove();
                        edoobox.widget_func.YesCookie();
                    } else {
                        $('.cookiebanner').show();
                    }
                } else {
                    $('.cookiebanner').show();
                }
                $('.denycookies').click(function () {
                    if ($(this).data('type') == '2') {
                        var d = new Date();
                        d.setTime(d.getTime() + (24 * 60 * 60 * 1000));
                        var expires = "; expires=" + d.toGMTString();
                        document.cookie = "cookiebanner=6" + expires + "; path=/; SameSite=None; Secure";
                    }
                    $('.cookiebanner').remove();
                    edoobox.widget_func.NoCookie();
                });
                $('.acceptcookies').click(function () {
                    var CookieDate = new Date;
                    CookieDate.setFullYear(CookieDate.getFullYear() + 10);
                    document.cookie = 'cookiebanner=5; expires=' + CookieDate.toUTCString() + '; path=/; SameSite=None; Secure';
                    $('.cookiebanner').remove();
                    edoobox.widget_func.YesCookie();
                });
            },
            fileupload_data: {
                init: false,
                xhr: {}
            },
            
            ufilterData: {
                filters: {
                    price: {
                        fields: {
                            i: 'price_min',
                            x: 'price_max'
                        }
                    },
                    date: {
                        fields: {
                            i: 'date_min',
                            x: 'date_max'
                        }
                    },
                    leader: {
                        select: 'leaders',
                        field: 'l'
                    },
                    place: {
                        select: 'places',
                        field: 'p'
                    },
                    status: {
                        select: 'status',
                        field: 's'
                    },
                    search: {
                        fields: {
                            q: 'search'
                        }
                    },
                    tag: {
                        select: 'tag',
                        field: 't'
                    },
                    category: {
                        select: 'category',
                        field: 'c'
                    }
                },
                popovers_open: null,
                popovers: [],
                popovers_objs: {},
                createFilterString: function (filterKey) {
                    var filterData = edoobox.widget_func.ufilterData.filters[filterKey];
                    var filterStr = filterKey + '=';
                    var fillterArr = [];
                    
                    if (filterData.fields) {
                        for (var fieldIndex in filterData.fields) {
                            var fieldValue = $('.popover.ed-filter-popover .f-' + filterData.fields[fieldIndex]).val();
                            filterStr += fieldIndex + ':' + encodeURIComponent(fieldValue) + ',';
                        }
                    } else if (filterData.select) {
                        if (filterKey == 'tag') {
                            var uniqueValues = new Set();
                        }
                        $('.popover.ed-filter-popover .f-' + filterData.select + '-v:checked').each(function () {
                            filterStr += $(this).val() + ',';
                            if (filterKey == 'tag') {
                                let parts = $(this).data('tags').split("..");
                                parts.forEach(part => {
                                    uniqueValues.add(part);
                                });
                            }
                        });
                        if (filterKey == 'tag') {
                            $('.f-form-tag').val([...uniqueValues].join('..'));
                        }
                        
                    }
                    return filterStr.slice(0, -1);  // Letztes Komma entfernen
                },
                removeFilterFromString: function (filterString, filterKey) {
                    var filterRegex = new RegExp(filterKey + '=[^|]*\\|?');
                    return filterString.replace(filterRegex, '');
                },
                addFilterToString: function (filterString, filterKey) {
                    var newFilterValue = edoobox.widget_func.ufilterData.createFilterString(filterKey);
                    filterString = edoobox.widget_func.ufilterData.removeFilterFromString(filterString, filterKey);  // Entfernen
                                                                                                                     // Sie
                                                                                                                     // zuerst
                                                                                                                     // den
                                                                                                                     // vorhandenen
                                                                                                                     // Filterwert
                                                                                                                     // (falls
                                                                                                                     // vorhanden)
                    
                    // Fügen Sie den neuen Filterwert hinzu
                    if (filterString) {
                        return filterString + '|' + newFilterValue;
                    } else {
                        return newFilterValue;
                    }
                },
                filterExists: function (filterString, filterKey) {
                    var filterRegex = new RegExp(filterKey + '=[^|]*');
                    return filterRegex.test(filterString);
                },
                
                getPopoverContent: function (templateClass) {
                    // Hauptgerüst kopieren
                    var template = $('.ed-filter-templates .f-default').clone();
                    
                    // Inhalt für den Slot extrahieren
                    var slotContent = $('.ed-filter-templates .f-' + templateClass).html();
                    
                    // Inhalt im Slot des Hauptgerüsts ersetzen
                    template.find('.filter-slot').html(slotContent);
                    return template.html();
                },
                initPopover: function (elm, filter, selectorPrefix) {
                    if ( ! edoobox.widget_func.ufilterData.popovers.includes(filter)) {
                        edoobox.widget_func.ufilterData.popovers_objs[filter] = new bootstrap.Popover(elm, {
                            placement: 'bottom',
                            sanitize: false,
                            container: selectorPrefix ? '.edoobox-plugin' + selectorPrefix : 'body',
                            template: '<div class="popover ed-filter-popover col-12 col-sm-10 col-md-10" role="tooltip">' +
                                '<div class="popover-arrow"></div>' +
                                '<h3 class="popover-header d-flex justify-content-between align-items-center"></h3>' +
                                '<div class="popover-body"></div>' +
                                '</div>',
                            content: function () {
                                return edoobox.widget_func.ufilterData.getPopoverContent(filter);
                            },
                            title: $(elm).find('.filter-name').text() + '<span class="close bs5">&times;</span>',
                            html: true
                        });
                        edoobox.widget_func.ufilterData.popovers.push(filter);
                    }
                },
                closeAllPopovers: function () {
                    Object.values(edoobox.widget_func.ufilterData.popovers_objs).forEach(popover => popover?.hide());
                    edoobox.widget_func.ufilterData.popovers_open = null;
                }
            },
            ufilter: function (element) {
                var count = $(element).closest('.edoobox-plugin').data('count');
                var selectorPrefix = '[data-count="' + count + '"]';
                
                $(selectorPrefix + ' .ed-filter').click(function () {
                    var elm = $(this);
                    var filter = elm.data('filter');
                    edoobox.widget_func.ufilterData.initPopover(elm, filter, selectorPrefix);
                    
                    if (edoobox.widget_func.ufilterData.popovers_open != null) {
                        edoobox.widget_func.ufilterData.popovers_objs[filter].hide();
                        if (edoobox.widget_func.ufilterData.popovers_open == elm) {
                            edoobox.widget_func.ufilterData.popovers_open = null;
                            return;
                        }
                    }
                    
                    edoobox.widget_func.ufilterData.closeAllPopovers();
                    
                    edoobox.widget_func.ufilterData.popovers_open = elm;
                    edoobox.widget_func.ufilterData.popovers_objs[filter].show();
                });
                
                // Schleife durch alle .ed-filter Elemente
                $(selectorPrefix + ' .ed-filter').each(function () {
                    var $this = $(this);
                    var filterName = $this.data('filter');
                    
                    // Standard: Sichtbarkeit auf 50%
                    var visibility = 50;
                    
                    // Überprüfung ob das Element die Klasse bg-success hat
                    if ($this.hasClass('border-success')) {
                        visibility = 100;
                    } else {
                        // Überprüfung des Inhalts in der entsprechenden f- Klasse
                        switch (filterName) {
                            case 'price':
                            case 'date':
                            case 'leader':
                            case 'place':
                            case 'status':
                            case 'search':
                            case 'tag':
                            case 'category':
                                if ($('.f-' + filterName).text().trim() !== '') {
                                    visibility = 100;
                                }
                                break;
                            default:
                                // Standardverhalten für nicht definierte Filter
                                if ($('.f-' + filterName).text().trim() !== '') {
                                    visibility = 100;
                                }
                                break;
                        }
                    }
                    
                    // Setze die Sichtbarkeit des .ed-filter Elements
                    $this.css('opacity', visibility + '%');
                });
                
                $(document).on('click', selectorPrefix + ' .popover-header .close',
                    edoobox.widget_func.ufilterData.closeAllPopovers
                );
                
                $(document).on('click', selectorPrefix + ' a.f-success', function () {
                    //Der Filter soll angewendet werden
                    var filter = edoobox.widget_func.ufilterData.popovers_open.data('filter');
                    
                    if (filter == 'search') {
                        $('.f-form-q').val($('.popover-content .f-search-v').val());
                    } else {
                        $('.f-form-field').val(edoobox.widget_func.ufilterData.addFilterToString(
                            $('.f-form-field').val(),
                            filter
                        ));
                        
                        if (filter == 'category') {
                            //Form URL anpassen
                            let url_action = $(".f-category-v-baseurl").data('baseurl') + '/' + $('input[type="radio"].f-category-v:checked').data('url');
                            $("#ed_filter_form").attr('action', url_action);
                        }
                    }
                    
                    //Formular absenden
                    $("#ed_filter_form").submit();
                });
                
                $(document).on('click', selectorPrefix + ' a.f-destroy', function () {
                    //Der Filter soll angewendet werden
                    var filter = edoobox.widget_func.ufilterData.popovers_open.data('filter');
                    if (filter == 'search') {
                        $('.f-form-q').val('');
                        //Formular absenden
                        $("#ed_filter_form").submit();
                    } else {
                        if (edoobox.widget_func.ufilterData.filterExists($('.f-form-field').val(), filter) === false) {
                            edoobox.widget_func.ufilterData.popovers_objs[edoobox.widget_func.ufilterData.popovers_open.data('filter')].hide();
                            edoobox.widget_func.ufilterData.popovers_open = null;
                        } else {
                            
                            $('.f-form-field').val(//encodeURIComponent(
                                edoobox.widget_func.ufilterData.removeFilterFromString(
                                    $('.f-form-field').val(),
                                    filter
                                )
                            );
                            
                            if (filter == 'tag') {
                                $('.f-form-tag').val('');
                            }
                            
                            if (filter == 'category') {
                                //Form URL anpassen
                                let url_action = $(".f-category-v-baseurl").data('baseurl');
                                $("#ed_filter_form").attr('action', url_action);
                            }
                            
                            //Formular absenden
                            $("#ed_filter_form").submit();
                        }
                    }
                });
                
            },
            
            
            ucalendarData: {
                popover_elm: null,
                offers: {},
                lesson: {},
                initView: false
            },
            //Calendar Init
            ucalendar: function () {
                
                $(window).on('popstate', function (event) {
                    if (edoobox.getArg('edview') != false) {
                        var calView = 'agendaWeek';
                        switch (edoobox.getArg('edview')) {
                            case 'v1':
                                calView = 'month';
                                break;
                            case 'v2':
                                calView = 'agendaWeek';
                                break;
                            case 'v3':
                                calView = 'agendaDay';
                                break;
                            case 'v4':
                                calView = 'listMonth';
                                break;
                        }
                        $('#calendar').fullCalendar('changeView', calView);
                    }
                });
                
                
                if (edoobox.getArg('edstart') != false) {
                    var edstart = moment(edoobox.getArg('edstart'));
                    if (edstart._isValid == false) {
                        var calStart = moment();
                    } else {
                        var calStart = edstart;
                    }
                } else {
                    var edstart = moment();
                    var calStart = edstart;
                }
                var edview = edoobox.getArg('edview');
                var calView = $('#calendar').data('defaultview');
                if (edview) {
                    switch (edview) {
                        case 'v1':
                            calView = 'month';
                            break;
                        case 'v2':
                            calView = 'agendaWeek';
                            break;
                        case 'v3':
                            calView = 'agendaDay';
                            break;
                        case 'v4':
                            calView = 'listMonth';
                            break;
                    }
                }
                
                var baseUrl = [location.protocol, '//', location.host, location.pathname].join('');
                var pluginContainer = document.querySelector(".edoobox-plugin");
                var language = pluginContainer ? pluginContainer.dataset['language'] : 'de';
                
                
                $(document).on('click', ':not(.popover,.edevents)', function () {
                    //$('.popover').popover('hide');
                });
                $(document).on('click', '.popover-content .close', function () {
                    $('.popover').popover('hide');
                });

                $('#calendar').fullCalendar({
                    themeSystem: 'bootstrap4',
                    
                    lang: language,
                    header: {
                        left: 'prev,next today',
                        center: 'title',
                        right: $('#calendar').data('views')
                    },
                    bootstrapGlyphicons: {
                        close: 'bi bi-x',
                        prev: 'bi bi-chevron-left',
                        next: 'bi bi-chevron-right',
                        prevYear: 'bi bi-chevron-double-left',
                        nextYear: 'bi bi-chevron-double-right'
                    },
                    defaultDate: calStart,
                    defaultView: calView,
                    
                    viewRender: function (view, element) {
                        if (edoobox.widget_func.ucalendarData.initView == true) {
                            var baseUrl = [location.protocol, '//', location.host, location.pathname].join('');
                            var urlQueryString = document.location.search;
                            var calView = '';
                            switch (view.name) {
                                case 'month':
                                    calView = 'v1';
                                    break;
                                case 'agendaWeek':
                                    calView = 'v2';
                                    break;
                                case 'agendaDay':
                                    calView = 'v3';
                                    break;
                                case 'listMonth':
                                    calView = 'v4';
                                    break;
                            }
                            
                            var tpm1 = edoobox.updateQueryStringParam('edview', calView, baseUrl, urlQueryString);
                            var tpm2 = edoobox.updateQueryStringParam('edstart', view.intervalStart.format("YYYY-MM-DD"), baseUrl, tpm1);
                            
                            window.history.pushState({
                                edview: view.name,
                                edstart: '1111'
                            }, "", baseUrl + tpm2);
                            
                            //Grösse iFrame anpassen
                            edoobox.sizeFrame();
                        } else {
                            edoobox.widget_func.ucalendarData.initView = true;
                        }
                    },
                    navLinks: true, // can click day/week names to navigate views
                    editable: false,
                    eventLimit: true, // allow "more" link when too many events
                    firstDay: 1,
                    timeFormat: 'HH:mm',
                    axisFormat: 'HH:mm',
                    slotLabelFormat: "HH:mm",
                    //axisFormat: 'LT',
                    allDaySlot: false,
                    weekends: ($('#calendar').data('weekend') == 1 ? true : false),
                    scrollTime: $('#calendar').data('scrolltime'),
                    slotDuration: $('#calendar').data('slottime'),
                    minTime: $('#calendar').data('mintime'),
                    maxTime: $('#calendar').data('maxtime'),
                    columnFormat: {
                        month: 'ddd',    // Mon
                        week: "ddd D.M",//'ddd d.M', // Mon 9/7
                        day: "D. dddd, MMMM",//'d. dddd, MMMM'  // Monday 9/7,
                        list: "ddd D.M"
                    },
                    titleFormat: {
                        month: 'MMMM yyyy',                             // September 2009
                        week: "d[ yyyy]{ '&#8212;' d MMM yyyy}", // Sep 7 - 13 2009
                        day: 'dddd, D. MMM YYYY'//'dddd, d. MMM yyyy'                  // Tuesday, Sep 8, 2009
                    },
                    monthNames: [tg('N49793')/*Januar*/, tg('N81898')/*Februar*/, tg('N46973')/*März*/,
                        tg('N58856')/*April*/, tg('N89060')/*Mai*/, tg('N40154')/*Juni*/,
                        tg('N37238')/*Juli*/, tg('N89357')/*August*/, tg('N65953')/*September*/,
                        tg('N26360')/*Oktober*/, tg('N76373')/*November*/, tg('N47833')/*Dezember*/],
                    monthNamesShort: [tg('N95809')/*Jan*/, tg('N62941')/*Feb*/, tg('N63756')/*Mär*/, tg('N42221')/*Apr*/, tg('N40939')/*Mai*/, tg('N7948')/*Jun*/,
                        tg('N14211')/*Jul*/, tg('N92885')/*Aug*/, tg('N2743')/*Sep*/, tg('N66484')/*Okt*/, tg('N39063')/*Nov*/, tg('N93036')/*Dez*/],
                    dayNames: [tg('N8188')/*Sonntag*/, tg('N1487')/*Montag*/, tg('N1888')/*Dienstag*/,
                        tg('N6403')/*Mittwoch*/, tg('N1049')/*Donnerstag*/, tg('N2334')/*Freitag*/,
                        tg('N7682')/*Samstag*/],
                    dayNamesShort: [tg('N2021')/*So*/, tg('N5049')/*Mo*/, tg('N1598')/*Di*/,
                        tg('N7855')/*Mi*/, tg('N1570')/*Do*/, tg('N2706')/*Fr*/, tg('N3862')/*Sa*/],
                    eventLimitText: tg('N39246')/*Weitere*/,
                    views: {
                        month: { // name of view
                            titleFormat: 'MMMM YYYY',
                            columnFormat: 'ddd'
                            // other view-specific options here
                        },
                        agenda: {
                            // options apply to agendaWeek and agendaDay views
                            titleFormat: 'll',
                            columnFormat: 'ddd D.M'
                        },
                        week: {
                            // options apply to basicWeek and agendaWeek views
                            titleFormat: "ll",
                            columnFormat: 'ddd D.M'
                        },
                        day: {
                            // options apply to basicDay and agendaDay views
                            titleFormat: 'DD MMMM YYYY',
                            columnFormat: 'D. dddd, MMMM'
                        }
                    },
                    
                    themeButtonIcons: {
                        prev: 'glyphicon-chevron-left',  // left triangle
                        next: 'glyphicon-chevron-right',  // right triangle
                        prevYear: 'glyphicon-backward', // <<
                        nextYear: 'glyphicon-forward' // >>
                    },
                    buttonText: {
                        
                        today: tg('N88771')/*Heute*/,
                        month: tg('N33644')/*Monat*/,
                        week: tg('N17274')/*Woche*/,
                        day: tg('N6351')/*Tag*/,
                        list: tg('N91117')/*Liste*/
                    },
                    events: function (start, end, timezone, callback) {
                        $.ajax({
                            async: true,
                            dataType: 'json',
                            type: 'post',
                            url: $('#calendar').data('events'),
                            data: {
                                'start': moment(start).toISOString(),
                                'end': moment(end).toISOString()
                            },
                            success: function (json) {
                                edoobox.widget_func.ucalendarData.offers = $.merge(json.offers || [], edoobox.widget_func.ucalendarData.offers || []);
                                
                                //Alte Module löschen
                                $('#calendar').fullCalendar('removeEvents');
                                
                                //Neue Module hinzufügen
                                var module = [];
                                $.each(json.rsl, function (key, value) {
                                    module.push({
                                        id: value.id,
                                        title: json.offers[value['offerid']].name,
                                        start: moment(value.start),
                                        end: moment(value.end),
                                        borderColor: value.color,
                                        allDay: false,
                                        offerid: value['offerid']
                                    });
                                    
                                });
                                //Module dem Kalender übergeben
                                callback(module);
                                
                            }
                        });
                    },
                    eventRender: function (event, element, view) {
                        // Angebots Status
                        var tpm1 = edoobox.widget_func.ucalendarData.offers[event['offerid']];
                        var tpm = '', tpm_bs53 = '';
                        var tpmtxt = '';
                        var btn2 = false;
                        var btn2cl = false;
                        
                        // Im Head vom Event den Angebot Status einfügen
                        switch (tpm1.booking_status) {
                            case 'normal':
                                tpm = 'ok-circle text-primary';
                                tpm_bs53 = 'check2-circle text-primary';
                                tpmtxt = tg('N7520')/*Für Anmeldungen geöffnet*/;
                                btn2 = tg('N4929')/*Jetzt anmelden*/;
                                btn2cl = 'success';
                                break;
                            case 'guaranteed':
                                tpm = 'ok-sign text-success';
                                tpm_bs53 = 'patch-check text-success';
                                tpmtxt = tg('N3832')/*Garantierte Durchführung*/;
                                btn2 = tg('N4929')/*Jetzt anmelden*/;
                                btn2cl = 'success';
                                break;
                            case 'alreadystarted':
                                tpm = 'exclamation-sign text-warning';
                                tpm_bs53 = 'exclamation-circle text-warning';
                                tpmtxt = tg('N850')/*Gestartet, Einstieg noch möglich*/;
                                btn2 = tg('N4929')/*Jetzt anmelden*/;
                                btn2cl = 'success';
                                break;
                            case 'waitinglist':
                                tpm = 'hourglass text-info';
                                tpm_bs53 = 'hourglass text-info';
                                tpmtxt = tg('N13104')/*Ausgebucht,  Eintrag in Warteliste möglich*/;
                                btn2 = tg('N63385')/*Auf Warteliste eintragen*/;
                                btn2cl = 'warning';
                                break;
                            case 'full':
                                tpm = 'ban-circle text-danger';
                                tpm_bs53 = 'slash-circle text-danger';
                                tpmtxt = tg('N72446')/*Ausgebucht / Anmeldefrist abgelaufen*/;
                                break;
                        }
                        
                        var Status = $('<span class="offer_status glyphicon glyphicon-' + tpm + '"></span>');
                        $(element).find('.fc-title').prepend(Status);
                        $(element).addClass('edevents_' + event['offerid']);
                        $(element).addClass('edevents');
                        
                        var usercount = tpm1.user_maximum - tpm1.usercount;
                        if (usercount < 0) {
                            usercount = 0;
                        }
                        
                        var tpm2 = '';
                        if (tpm1.image) {
                            tpm2 += '<div class="col-12 col-sm-4 col-md-4">';
                            tpm2 += '<div><img src="' + tpm1.image + '" class="rounded img-responsive"></div>';
                            tpm2 += '</div>';
                            tpm2 += '<div class="col-12 col-sm-8 col-md-8">';
                        } else {
                            tpm2 += '<div class="col-12 col-sm-12 col-md-12">';
                        }
                        
                        if (tpm1.shortdescription.length > 4) {
                            tpm2 += '<div class="d-flex align-items-center">' +
                                '<i class="bi bi-info-circle me-1"></i>' +
                                '<span class="glyphicon_text me-1">' +
                                tpm1.shortdescription +
                                '</span>' +
                                '</div>';
                        }
                        
                        var date_string = '';
                        if (moment(tpm1.start_date).isSame(moment(tpm1.end_date), 'day')) {
                            date_string = moment(tpm1.start_date).format('MMMM D, YYYY h:mm A') + ' – ' + moment(tpm1.end_date).format('h:mm A');
                        } else {
                            date_string = moment(tpm1.start_date).format('MMMM D, YYYY h:mm A') + ' – ' + moment(tpm1.end_date).format('MMMM D, YYYY h:mm A');
                        }
                        
                        tpm2 += '<div class="d-flex align-items-center">' +
                            '<i class="bi bi-calendar3 me-1"></i>' +
                            '<span class="glyphicon_text me-1">' +
                            date_string +
                            '</span>' +
                            '</div>';
                        
                        tpm2 += '<div class="d-flex align-items-center">' +
                            '<i class="offer_status bi bi-' + tpm_bs53 + ' me-1"></i>' +
                            '<span class="glyphicon_text me-1">' +
                            tpmtxt +
                            '</span>' +
                            '</div>';
                        
                        tpm2 += '<div class="ed-cal-btns-grp">';
                        if ($('#calendar').data('usercount') == 1) {
                            tpm2 += '<span class="badge bg-secondary"><i class="bi bi-info-circle"></i> ' + tg('N7240')/*Freie Plätze*/ + ': ' + usercount + '</span>';
                        }
                        
                        var pluginContainer = document.querySelector(".edoobox-plugin");
                        var language = pluginContainer ? pluginContainer.dataset['language'] : 'de';
                        var shortcutUrl = pluginContainer ? pluginContainer.dataset['url'] : '';
                        var accountShortcut = pluginContainer ? pluginContainer.dataset['shortcut'] : '';
                        var currentDomain = window.location.origin;
                        
                        // Ensure the currentPath ends with the accountShortcut
                        var currentPathParts = window.location.pathname
                            .replace(/^\/|\/$/g, '') // Trim leading and trailing slashes
                            .split('/'); // Split into parts
                        
                        if (currentPathParts[currentPathParts.length - 1] !== accountShortcut) {
                            currentPathParts.push(accountShortcut); // Add the accountShortcut if it doesn't already exist at the end
                        }
                        
                        // Clean the target URL path by removing language, accountShortcut, and extra slashes
                        var urlWithoutDomain = tpm1.offer_details_url.replace(/^https?:\/\/[^/]+/, '');
                        var cleanedPathParts = urlWithoutDomain
                            .replace(new RegExp(`^/${language}`), '') // Remove language prefix
                            .replace(new RegExp(`/${shortcutUrl.replace(/^\/|\/$/g, '')}`), '') // Remove shortcut URL
                            .replace(/^\/|\/$/g, '') // Trim leading and trailing slashes
                            .split('/') // Split into parts
                            .filter(part => part !== accountShortcut); // Remove occurrences of accountShortcut
                        
                        // Merge currentPath and cleanedPath parts
                        var finalPathParts = [...currentPathParts, ...cleanedPathParts];
                        
                        // Construct the updated URL
                        var finalPath = finalPathParts.join('/');
                        var updatedUrl = `${currentDomain}/${finalPath}`;
                        
                        // Add the current domain and cleaned path
                        tpm2 += '<a class="ed-cal-btn btn btn-info" href="' + updatedUrl + '">' + tg('N3238')/*Details*/ + '</a>';

                        if (btn2) {
                            tpm2 += '<a class="ed-cal-btn btn btn-' + btn2cl + '" href="' + tpm1.booking_start_url + '" id="book-btn' + event._id + '">' + btn2 + '</a>';
                        }
                        tpm2 += '</div>';
                        
                        new bootstrap.Popover(element, {
                            container: '#' + $('#calendar').data('wdgid'),
                            trigger: 'focus',
                            placement: 'auto',
                            html: true,
                            template: '<div class="popover ed-cal-popover ed-cal-popover_bs53 col-12 col-sm-9 col-md-7" role="popover"><div class="popover-arrow"></div><div class="popover-header"></div><div class="popover-body"></div></div>',
                            content: tpm2,
                            title: '<div class="d-flex justify-content-between"><span>' + tpm1.name + '</span><span class="btn-close popover-close"></span></div>'
                        });
                    },
                    eventClick: function (event, jsEvent, view) {
                        if (edoobox.widget_func.ucalendarData.popover_elm !== null) {
                            const bs_popover_old = bootstrap.Popover.getInstance(edoobox.widget_func.ucalendarData.popover_elm);
                            bs_popover_old.hide();
                        }
                        edoobox.widget_func.ucalendarData.popover_elm = jsEvent.currentTarget;
                        
                        const bs_popover = bootstrap.Popover.getInstance(jsEvent.currentTarget); // Returns a Bootstrap
                                                                                                 // popover instance
                        bs_popover.toggle();
                        
                        setTimeout(function () {
                            var eventPopup = document.querySelector('a#book-btn' + event._id); // id is set in eventRender
                            eventPopup && (eventPopup.addEventListener('click', function (e) {
                                e.preventDefault();
                                window.iframe.set(eventPopup.closest(".edoobox-plugin"), eventPopup.getAttribute('href'));
                            }));
                        }, 50); // needs to render first (next tick)
                        
                        $(document).on('click', '.popover-close', function () {
                            const bs_popover_old = bootstrap.Popover.getInstance(edoobox.widget_func.ucalendarData.popover_elm);
                            bs_popover_old.hide();
                            edoobox.widget_func.ucalendarData.popover_elm = null;
                            
                        });
                        
                        //Grösse iFrame anpassen
                        edoobox.sizeFrame();
                    },
                    eventMouseover: function (event, jsEvent, view) {
                        $('.edevents_' + event['offerid']).addClass('edeventhover');
                        //$('.popover').popover('hide');
                        //$(jsEvent.currentTarget).popover('show');
                    },
                    eventMouseout: function (event, jsEvent, view) {
                        $('.edevents_' + event['offerid']).removeClass('edeventhover');
                        //$('.popover').popover('hide');
                        //$(jsEvent.currentTarget).popover('show');
                    }
                });
                
            },
            
            //File upload initialisieren
            fileupload: function () {
                if ( ! edoobox.widget_func.fileupload_data.init) {
                    edoobox.widget_func.fileupload_data.init = true;
                    $('.ed_files_upload').on("change", function () {
                        var elm = $(this);
                        var field = elm.data('field');
                        var user_id = elm.data('uid');
                        
                        $('#ed_file_upload_' + field + '-' + user_id + '_er').hide();
                        
                        var file = elm.get()[0].files[0];
                        
                        if (file) {
                            var fileSize = 0;
                            if (file.size > 1024 * 1024) {
                                fileSize = (Math.round(file.size * 100 / (1024 * 1024)) / 100).toString() + ' MB';
                            } else {
                                fileSize = (Math.round(file.size * 100 / 1024) / 100).toString() + ' KB';
                            }
                            $('#ed_file_upload_' + field + '-' + user_id + '_1').hide();
                            $('#ed_file_upload_' + field + '-' + user_id + '_type').attr('data-type', file.name.substr(file.name.lastIndexOf('.') + 1));
                            $('#ed_file_upload_' + field + '-' + user_id + '_name').text(file.name);
                            $('#ed_file_upload_' + field + '-' + user_id + '_size').text(fileSize);
                            $('#ed_file_upload_' + field + '-' + user_id + '_2').show();
                        }
                        
                    });
                    
                    
                    //Upload Button
                    $('.ed_files_upload_gos').click(function () {
                        var elm = $(this);
                        edoobox.widget_func.fileupload_go(elm);
                        //Grösse iFrame anpassen
                        edoobox.sizeFrame();
                    });
                    
                    //Upload Entfernen
                    $('.ed_files_upload_removes').click(function () {
                        var elm = $(this);
                        var field = elm.data('field');
                        var user_id = elm.data('uid');
                        
                        $('#ed_file_upload_' + field + '-' + user_id).val('');
                        if ( ! /safari/i.test(navigator.userAgent)) {
                            $('#ed_file_upload_' + field + '-' + user_id).attr('type', '');
                            $('#ed_file_upload_' + field + '-' + user_id).attr('type', 'file');
                        }
                        
                        $('#ed_file_upload_' + field + '-' + user_id + '_1').show();
                        $('#ed_file_upload_' + field + '-' + user_id + '_2').hide();
                        $('#ed_file_upload_' + field + '-' + user_id + '_3').hide();
                    });
                    
                    //Upload Abbrechen
                    $('.ed_files_upload_stops').click(function () {
                        var elm = $(this);
                        var field = elm.data('field');
                        var user_id = elm.data('uid');
                        edoobox.widget_func.fileupload_data.xhr[user_id][field].abort();
                        
                        $('#ed_file_upload_' + field + '-' + user_id).val('');
                        if ( ! /safari/i.test(navigator.userAgent)) {
                            $('#ed_file_upload_' + field + '-' + user_id).attr('type', '');
                            $('#ed_file_upload_' + field + '-' + user_id).attr('type', 'file');
                        }
                        
                        $('#ed_file_upload_' + field + '-' + user_id + '_1').show();
                        $('#ed_file_upload_' + field + '-' + user_id + '_2').hide();
                        $('#ed_file_upload_' + field + '-' + user_id + '_3').hide();
                        
                    });
                }
            },
            fileupload_go: function (elm) {
                var field = elm.data('field');
                var user_id = elm.data('uid');
                var file = $('#ed_file_upload_' + field + '-' + user_id).get()[0].files[0];
                $('#ed_file_upload_' + field + '-' + user_id + '_er').hide();
                edoobox.data.modals.loading.show();
                $.ajax({
                    type: 'post',
                    async: true,
                    dataType: 'json',
                    url: $ajU.js8,
                    data: {
                        a: field,
                        b: file.name,
                        c: file.size,
                        d: file.type,
                        e: user_id
                    },
                    success: function (json) {
                        if (json.ok == true) {
                            edoobox.data.modals.loading.hide();
                            $('#ed_file_upload_' + field + '-' + user_id + '_2').hide();
                            $('#ed_file_upload_' + field + '-' + user_id + '_3').show();
                            
                            $.ajax({
                                type: 'PUT',
                                url: json.url,
                                // Content type must much with the parameter you signed your URL with
                                contentType: json.mime,
                                // this flag is important, if not set, it will try to send data as a form
                                processData: false,
                                // the actual file is sent raw
                                data: file,
                                xhr: function () {
                                    if (edoobox.widget_func.fileupload_data.xhr.hasOwnProperty(user_id) === false) {
                                        edoobox.widget_func.fileupload_data.xhr[user_id] = {};
                                    }
                                    edoobox.widget_func.fileupload_data.xhr[user_id][field] = $.ajaxSettings.xhr();
                                    edoobox.widget_func.fileupload_data.xhr[user_id][field].upload.onprogress = function (e) {
                                        // For uploads
                                        if (e.lengthComputable) {
                                            var prozent = Math.round(e.loaded / e.total * 100);
                                            $('#ed_file_upload_' + field + '-' + user_id + '_progress').text(prozent);
                                            $('#ed_file_upload_' + field + '-' + user_id + '_progress').css("width", prozent + '%');
                                        }
                                    };
                                    return edoobox.widget_func.fileupload_data.xhr[user_id][field];
                                },
                                success: function (e) {
                                    $.ajax({
                                        type: 'post',
                                        async: true,
                                        dataType: 'json',
                                        url: $ajU.js9,
                                        data: {
                                            a: field,
                                            b: user_id
                                        },
                                        success: function (json2) {
                                            if (json2.ok) {
                                                //Datei erfolgreich hochgeladen
                                                $('#ed_file_upload_' + field + '-' + user_id + '_3').hide();
                                                $('#ed_file_upload_' + field + '-' + user_id + '_4').show();
                                                
                                                $('#ed_file_upload_' + field + '-' + user_id + '_1').parent(".form-group").addClass('has-success');
                                                $('#ed_file_upload_' + field + '-' + user_id + '_1').parent(".form-group").removeClass('has-error');
                                                
                                                var fileSize = 0;
                                                if (file.size > 1024 * 1024) {
                                                    fileSize = (Math.round(file.size * 100 / (1024 * 1024)) / 100).toString() + ' MB';
                                                } else {
                                                    fileSize = (Math.round(file.size * 100 / 1024) / 100).toString() + ' KB';
                                                }
                                                
                                                $('#ed_file_upload_' + field + '-' + user_id + '_type_4').attr('data-type', file.name.substr(file.name.lastIndexOf('.') + 1));
                                                $('#ed_file_upload_' + field + '-' + user_id + '_name_4').text(file.name);
                                                $('#ed_file_upload_' + field + '-' + user_id + '_size_4').text(fileSize);
                                                
                                                $('#ed_file_upload_' + field + '-' + user_id).val('');
                                                if ( ! /safari/i.test(navigator.userAgent)) {
                                                    $('#ed_file_upload_' + field + '-' + user_id).attr('type', '');
                                                    $('#ed_file_upload_' + field + '-' + user_id).attr('type', 'file');
                                                }
                                                
                                                edoobox.data.modals.loading.hide();
                                            } else {
                                                edoobox.widget_func.fileupload_error(field, tg('N26682')/*Ein unerwarteter Fehler ist aufgetreten. Bitte versuchen Sie es noch einmal.*/, user_id);
                                            }
                                        }
                                    });
                                },
                                error: function (e) {
                                    edoobox.widget_func.fileupload_error(field, tg('N26682')/*Ein unerwarteter Fehler ist aufgetreten. Bitte versuchen Sie es noch einmal.*/, user_id);
                                }
                            });
                        } else {
                            
                            var in_er = '';
                            if (typeof json.er != "undefined") {
                                $.each(json.er, function (key, value) {
                                    in_er += value + '<br>';
                                });
                            } else {
                                in_er += json.error;
                            }
                            
                            edoobox.widget_func.fileupload_error(field, in_er, user_id);
                        }
                    }
                });
                
            },
            
            //Es gab ein Upload Fehler
            fileupload_error: function (field, in_er, user_id) {
                $('#ed_file_upload_' + field + '-' + user_id + '_er').show();
                $('#ed_file_upload_' + field + '-' + user_id + '_er').html(in_er);
                $('#ed_file_upload_' + field + '-' + user_id + '_1').parent(".form-group").removeClass('has-success');
                $('#ed_file_upload_' + field + '-' + user_id + '_1').parent(".form-group").addClass('has-error');
                
                edoobox.data.modals.loading.hide();
                
                //Datei neu auswählen
                $('#ed_file_upload_' + field + '-' + user_id + '_1').show();
                $('#ed_file_upload_' + field + '-' + user_id + '_2').hide();
                $('#ed_file_upload_' + field + '-' + user_id + '_3').hide();
                $('#ed_file_upload_' + field + '-' + user_id + '_4').hide();
                
                $('#ed_file_upload_' + field + '-' + user_id).val('');
                if ( ! /safari/i.test(navigator.userAgent)) {
                    $('#ed_file_upload_' + field + '-' + user_id).attr('type', '');
                    $('#ed_file_upload_' + field + '-' + user_id).attr('type', 'file');
                }
            },
            
            
            //Alle Elemente gleiche Höhe
            sameHeight: function () {
                var tallest = 0;
                $('.sameheight').each(function () {
                    var thisHeight = $(this).innerHeight();    //$(this).find('.thumbnail').height();
                    if (thisHeight > tallest) {
                        tallest = thisHeight;
                    }
                });
                
                $('.sameheight').find('.thumbnail').css('min-height', tallest + 'px');
                
                //Grösse iFrame anpassen
                edoobox.sizeFrame();
            },
            
            //Tabelle Übersicht
            utable: function () {
                if ($('.utable1').first().data('responsive') == '1') {
                    $('.utable1').stacktable({ headIndex: $('.utable1').data('nameindex') });
                    $('.utable1.small-only .wgd_tableview_beschr').hide();
                    
                    //Grösse iFrame anpassen
                    edoobox.sizeFrame();
                }
            },
            
            //Lektionen Übersicht
            alektionen: function () {
                if ($('.alektionen').first().data('responsive') == '1') {
                    $('.alektionen').stacktable();
                    
                    //Grösse iFrame anpassen
                    edoobox.sizeFrame();
                }
            },
            
            //AGB anzeigen
            booking_agb: function () {
                $('.lawtexts').hide();
                $('.showAGB').click(function () {
                    $(".lawtexts.agb").toggle();
                });
            },
            
            //Wiederrufsbelehrung anzeigen
            booking_belehrung: function () {
                $('.lawtexts').hide();
                $('.showBelehrung').click(function () {
                    $(".lawtexts.belehrung").toggle();
                });
            },
            
            //Datenschutzerklährung anzeigen
            booking_privacypolicy: function () {
                $('.lawtexts').hide();
                $('.showprivacypolicy').click(function () {
                    $(".lawtexts.privacypolicy").toggle();
                });
            },
            
            //Ausgebucht Meldung
            ed_modal01: function () {
                edoobox.data.modals.fullybooked = new bootstrap.Modal(document.getElementById('ed_modal02'), {
                    keyboard: false,
                    backdrop: 'static',
                    show: true
                });
            },
            
            utableclick: function () {
                $('.utable1 tbody tr.angebot_row:not(.btn)').click(function () {
                    $('.utable1 tbody tr.wgd_tableview_beschr').hide();
                    $('.utable1 tbody tr.angebot_row, .utable1 tbody tr.wgd_tableview_beschr').removeClass('selected');
                    $(this).addClass('selected');
                    $(this).next().addClass('selected').show('slide');
                    //Grösse iFrame anpassen
                    edoobox.sizeFrame();
                });
                if ($('.utable1').first().data('responsive') == '1') {
                    $('.utable1').stacktable({ headIndex: $('.utable1').data('nameindex') });
                    $('.utable1.small-only .wgd_tableview_beschr').hide();
                    
                    //Grösse iFrame anpassen
                    edoobox.sizeFrame();
                }
            },
            //Login mit Sozial Provider
            login_social: function () {
                edoobox.widget_func.oauth2();
                
                $('.fb-login-button').click(function () {
                    $('#ed_loading_Modal').modal('show');
                });
                window.fbAsyncInit = function () {
                    FB.init({
                        appId: '1945424902141041',
                        xfbml: true,
                        version: 'v2.11'
                    });
                    FB.AppEvents.logPageView();
                    
                    FB.getLoginStatus(function (response) {
                        //Wenn verbunden, dann Anmeldung durchführen
                        if (response.status == 'connected') {
                            $('#ed_loading_Modal').modal('show');
                            edoobox.facebookv2_11.updateBooking(response.authResponse);
                        }
                    });
                };
                
                (function (d, s, id) {
                    
                    var lang = 'de-DE';
                    switch (tg('N52960')/*de*/) {
                        case 'de':
                            lang = 'de_DE';
                            break;
                        case 'en':
                            lang = 'en_GB';
                            break;
                        case 'fr':
                            lang = 'fr_FR';
                            break;
                        case 'es':
                            lang = 'es_ES';
                            break;
                        case 'cs':
                            lang = 'cs_CZ';
                            break;
                        case 'cn':
                            lang = 'zh_CN';
                            break;
                    }
                    
                    var js, fjs = d.getElementsByTagName(s)[0];
                    if (d.getElementById(id)) {
                        return;
                    }
                    js = d.createElement(s);
                    js.id = id;
                    js.src = "https://connect.facebook.net/" + lang + "/sdk.js";
                    js.setAttribute("nonce", $('[nonce]').first().attr('nonce'));
                    fjs.parentNode.insertBefore(js, fjs);
                }(document, 'script', 'facebook-jssdk'));
                
                
            },
            
            
            facebook: function () {
                if (edoobox.widget_func.tracking) {
                    var lang = $('#fb-root').data('edlang');
                    
                    var po = document.createElement('script');
                    po.type = 'text/javascript';
                    po.nonce = $('[nonce]').first().attr('nonce');
                    po.async = true;
                    po.src = 'https://connect.facebook.net/' + lang + '/sdk.js';
                    var s = document.getElementsByTagName('script')[0];
                    s.parentNode.insertBefore(po, s);
                    
                    window.fbAsyncInit = function () {
                        FB.init({
                            appId: '1422645587958813',
                            status: true,
                            xfbml: true,
                            version: 'v18.0' // or v2.6, v2.5, v2.4, v2.3
                        });
                    };
                } else {
                    edoobox.widget_func.taskTracking.push({
                        'run': true,
                        'func': 'facebook'
                    });
                }
                
            },
            
            //SocialWidget
            social_xing: function () {
                if (edoobox.widget_func.tracking) {
                    (function (d, s) {
                        var x = d.createElement(s),
                            s = d.getElementsByTagName(s)[0];
                        x.src = "https://www.xing-share.com/plugins/share.js";
                        x.setAttribute("nonce", $('[nonce]').first().attr('nonce'));
                        s.parentNode.insertBefore(x, s);
                    })(document, "script");
                } else {
                    edoobox.widget_func.taskTracking.push({
                        'run': true,
                        'func': 'social_xing'
                    });
                }
            },
            social_googleplus: function () {
            },
            social_twitter: function () {
                if (edoobox.widget_func.tracking) {
                    var po = document.createElement('script');
                    po.type = 'text/javascript';
                    po.nonce = $('[nonce]').first().attr('nonce');
                    po.async = true;
                    po.src = 'https://platform.twitter.com/widgets.js';
                    var s = document.getElementsByTagName('script')[0];
                    s.parentNode.insertBefore(po, s);
                } else {
                    edoobox.widget_func.taskTracking.push({
                        'run': true,
                        'func': 'social_twitter'
                    });
                }
            },
            social_linkedin: function () {
                if (edoobox.widget_func.tracking) {
                    var po = document.createElement('script');
                    po.type = 'text/javascript';
                    po.nonce = $('[nonce]').first().attr('nonce');
                    po.async = true;
                    po.src = 'https://platform.linkedin.com/in.js';
                    var s = document.getElementsByTagName('script')[0];
                    s.parentNode.insertBefore(po, s);
                } else {
                    edoobox.widget_func.taskTracking.push({
                        'run': true,
                        'func': 'social_linkedin'
                    });
                }
            },
            
            //Suchfeld AutoComplete
            search_autocomplete: function () {
            
            },


            googlemap: function () {
                window.edoobox = edoobox; // Ensure edoobox object is available globally

                // Check if Google Maps API is already loaded
                if (typeof google === 'object' && typeof google.maps === 'object') {
                    console.log('Google Maps API is already loaded');
                    window.edoobox.widget_func.googlemapinit();
                } else {
                    const script = document.createElement('script');
                    const apiKey = window.googleMapsApiKey?.[0];

                    if (apiKey) {
                        script.type = 'text/javascript';
                        script.nonce = $('[nonce]').first().attr('nonce');
                        // Updated URL with loading=async and removed outdated v=3.exp
                        script.src = `https://maps.googleapis.com/maps/api/js?loading=async&libraries=places&callback=window.edoobox.widget_func.googlemapinit&key=${apiKey}`;
                        script.async = true;
                        script.defer = true;
                        document.body.appendChild(script);
                    } else {
                        console.error('Google Maps API key is missing');
                    }
                }
            },

            googlemapinit: function () {
                $('.wdg_google_init').each(function () {
                    const $elm = $(this);
                    const element = this;

                    // Remove init class
                    $elm.removeClass('wdg_google_init');

                    // Initialize coordinates with fallback
                    const lat = parseFloat($elm.data('lat')) || 0;
                    const lng = parseFloat($elm.data('lan')) || 0; // Note: 'lan' might be intended as 'lng'
                    const myLatlng = new google.maps.LatLng(lat, lng);

                    // Base map options
                    const mapOptions = {
                        zoom: parseInt($elm.data('zoom')) || 8,
                        center: myLatlng,
                        streetViewControl: true
                    };

                    let map;

                    // Custom style handling
                    if ($elm.data('gstyle') === 'json') {
                        Object.assign(mapOptions, {
                            mapTypeControlOptions: {
                                mapTypeIds: [google.maps.MapTypeId[$elm.data('gtype')], 'edooboxstyle']
                            },
                            mapTypeId: 'edooboxstyle'
                        });

                        map = new google.maps.Map(element, mapOptions);

                        const styledMapOptions = {
                            name: 'Event Style'
                        };
                        const customMapType = new google.maps.StyledMapType(googlemapstyle, styledMapOptions);
                        map.mapTypes.set('edooboxstyle', customMapType);
                    } else {
                        // Default style
                        mapOptions.mapTypeId = ($elm.data('gtype') || 'ROADMAP').toLowerCase();
                        map = new google.maps.Map(element, mapOptions);
                    }

                    // Add marker if specified
                    if ($elm.data('gmarker') === '1') {
                        const marker = new google.maps.Marker({
                            position: myLatlng,
                            map: map,
                            animation: google.maps.Animation.DROP,
                            title: tg('N1669') // Durchführungs-Ort
                        });
                    }
                });
            },

            /**
             *Counter anzeigen
             */
            bookingtimer: function () {
                
                function servertime() {
                    var e = new Date();
                    e.setTime($('#bookingtimer').data('rel3'));
                    return e;
                }
                
                var d = new Date();
                d.setTime($('#bookingtimer').data('rel'));
                var endURL = $('#bookingtimer').data('rel2');
                
                
                $('#bookingtimer .time').countdown({
                    until: d,
                    format: 'yowdhMS',
                    labels: [tg('N88254')/*Jahre*/, tg('N70110')/*Monate*/, tg('N14683')/*Wochen*/,
                        tg('N77806')/*Tage*/, tg('N6102')/*Stunden*/, tg('N9717')/*Minuten*/, tg('N6104')/*Sekunden*/],
                    
                    labels1: [tg('N4989')/*Jahr*/, tg('N33644')/*Monat*/, tg('N17274')/*Woche*/,
                        tg('N6351')/*Tag*/, tg('N44184')/*Stunde*/, tg('N19299')/*Minute*/, tg('N16067')/*Sekunde*/],
                    expiryUrl: endURL,
                    serverSync: servertime
                });
                
            },
            
            //Rechnungsadresse
            invoiceaddress: function () {
                $('#invoice_address').hide();
                
                $('#invoice_address_add').click(function () {
                    if ( ! $(this).is(':checked')) {
                        //bei deaktivieren, Formular leerne und ausblenden
                        $('#invoice_address').hide();
                        $('#invoice_address input').val('');
                        //$('#invoice_address input[data-required="required"]').prop('required', false);
                        
                        //Grösse iFrame anpassen
                        edoobox.sizeFrame();
                    } else {
                        //Wenn Checkobox aktivieren, dann anzeigen
                        $('#invoice_address').show();
                        //$('#invoice_address input[data-required="required"]').prop('required', true);
                        
                        //Grösse iFrame anpassen
                        edoobox.sizeFrame();
                    }
                });
                
                
            },
            
            //Teilnehmer identifizierung
            UserIdentiSearch: function (_a, _b, _c, _d) {
                //Ein
                $.ajax({
                    type: 'post',
                    async: false,
                    dataType: 'json',
                    url: $ajU.js5,
                    data: {
                        'a': _b,
                        'b': $('#' + _a + '-' + _b).val(),
                        'c': _c,
                        'd': _d
                    },
                    success: function (json) {
                        //Wenn Feld OK
                        if (json.o == true) {
                            //Wenn Resultate grösser als 1
                            if (json.c > 1) {
                                $('#Identifi_selectCho_' + _b).html('');
                                
                                //Alle Resultate in einer Schlaufe
                                $.each(json.t, function (index, value) {
                                    //Einzelenen Optionsschlater einfügen
                                    $('#Identifi_selectCho_' + _b).append($(
                                        '<input type="radio" name="identi" id="identi-selec_' + value.i + '" value="' + value.i + '" class="identi-selec form-check-input" />' +
                                        ' <label for="identi-selec_' + value.i + '" class="form-check-label">' + value.a + ' ' + value.c + ' ' + value.b + '</label><br>'
                                    ));
                                });
                                $('#Identifi_selectCho_' + _b).show('blind');
                                
                                //Wenn auf einen geklickt wird
                                $('#Identifi_selectCho_' + _b + ' input[type=radio]').change(function () {
                                    var _i = $(this).val();
                                    $('#Identifi_selectCho_' + _b).hide('blind');
                                    edoobox.widget_func.UserIdentiSearch(_a, _b, 'select', _i);
                                });
                                
                                //Grösse iFrame anpassen
                                edoobox.sizeFrame();
                            } else if (json.c == 1) {
                                //Erfolgreich hinzugefügt
                                window.location.reload();
                            } else {
                                //Keiner gefunden
                                $('#Identifi_selectCho_' + _b).html($('<span class="alert alert-warning">' + tg('N76656', 0)/*Kein Teilnehmer gefunden*/ + '</span>'));
                                $('#Identifi_selectCho_' + _b).show('blind');
                                
                                //Grösse iFrame anpassen
                                edoobox.sizeFrame();
                            }
                        }
                    }
                });
            },
            
            //OAuth2.0 aktivieren
            oauth2: function () {
                /*!
                 * jQuery Auth mit diversen Provider
                 */
                (function ($) {
                    // inspired by DISQUS
                    $.authpopup = function (options) {
                        if ( ! options || ! options.provider) {
                            throw new Error("URL darf nicht leer sein");
                        }
                        $.extend({
                            windowName: 'VerbindenMitProvider' // should not include space for IE
                            , windowOptions: 'location=0,status=0,width=800,height=400'
                            , callback: function () {
                                window.location.reload();
                            }
                        }, options);
                        
                        var authWindow = window.open(options.provider,
                            options.windowName,
                            options.windowOptions);
                        var authInterval = window.setInterval(function () {
                            if (authWindow.closed) {
                                window.clearInterval(authInterval);
                                options.callback();
                            }
                        }, 1000);
                    };
                })(jQuery);
                
                
                $('.ConnectProvider').attr('href', '#')
                    .click(function () {
                        var provider = $(this).data('sessurl');
                        $.authpopup({
                            provider: provider,
                            windowOptions: 'location=0,status=0,width=700,height=600',
                            callback: function () {
                                var getUrl = location.href.split('#');
                                window.location.href = getUrl[0] + edoobox.noCache() + '/';
                            }
                        });
                    });
            },
            
            //Holen der UserID für Google
            googleecommerce: function () {
            },
            
            //Timeline für Multiangebot und alle Teilnehmer erstellen
            multi_timeline: function (elm) {
                $.ajax({
                    url: "//www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1','packages':['timeline']}]}",
                    dataType: 'script',
                    cache: true,
                    success: function () {
                        google.setOnLoadCallback(edoobox.widget_func.multi_timelineCallback(elm));
                    }
                });
            },
            multi_timelineCallback: function (elm) {
            
            },
            paypalv2: function () {
                edoobox.widget_func.payment.paypalv2.load();
            },
            payment: {
                paypalv2: {
                    data: {
                        fundings: [],
                        fundingSources: [],
                        buttons: [],
                        autofund: false
                    },
                    order_id: false,
                    fundingSource: '',
                    load: function () {
                        //Gibt es ein weiteres aktives Paymentsystem?
                        //jQuery zähle wie viele .payment_option Elemente es gibt
                        if ($('.payment_option').length == 0) {
                            $('#payment-submit').hide();
                        }
                        
                        
                        var autofund = $('#paypal-button-container').data('ed-autofund') == '1' ? true : false;
                        edoobox.widget_func.payment.paypalv2.data.autofund = autofund;
                        var currency = $('#paypal-button-container').data('ed-currency');
                        var fundings = $('#paypal-button-container').data('ed-fundings').split(',');
                        
                        //Welche Fundings aktivieren?
                        var arrComponents     = [],
                            arrFunding        = [],
                            arrDisableFunding = [];
                        $.each(fundings, function (key, val) {
                            var FundingVal = $('#paypal-button-container').data('ed-paypalfunding' + val);
                            if (FundingVal == '1' && (autofund == false || val == 'paylater')) {
                                arrFunding.push(val);
                                edoobox.widget_func.payment.paypalv2.data.fundings.push(val.toUpperCase());
                            } else {
                                if (val !== 'paypal' && (autofund == false || val == 'paylater')) {
                                    arrDisableFunding.push(val);
                                }
                            }
                            if (val === 'paylater' && FundingVal == '1') {
                                arrComponents.push('messages');
                            }
                        });
                        
                        //Buttons hinzufügen
                        arrComponents.push('buttons');
                        arrComponents.push('funding-eligibility');
                        //arrComponents.push('marks');
                        
                        var ScriptURL = 'https://www.paypal.com/sdk/js?';
                        //ScriptURL += 'client-id=sb';
                        ScriptURL += 'client-id=' + $('#paypal-button-container').data('ed-partner-paypal_client_id');
                        ScriptURL += '&merchant-id=' + $('#paypal-button-container').data('ed-merchant-id');
                        ScriptURL += '&currency=' + currency;
                        
                        //Gibt es mindestens einen Eintrag in arrComponents?
                        if (arrComponents.length > 0) {
                            ScriptURL += '&components=' + arrComponents.join(',');
                        }
                        
                        //Gibt es mindestens einen Eintrag in arrFunding?
                        if (arrFunding.length > 0) {
                            ScriptURL += '&enable-funding=' + arrFunding.join(',');
                        }
                        
                        //Gibt es mindestens einen Eintrag in arrDisableFunding?
                        if (arrDisableFunding.length > 0) {
                            ScriptURL += '&disable-funding=' + arrDisableFunding.join(',');
                        }
                        
                        var scriptElement = document.createElement('script');
                        scriptElement.setAttribute('id', "paypal-sdk");
                        scriptElement.setAttribute('src', ScriptURL);
                        scriptElement.onload = edoobox.widget_func.payment.paypalv2.init;
                        document.head.appendChild(scriptElement);
                        
                    },
                    init: function () {
                        
                        if (edoobox.widget_func.payment.paypalv2.data.autofund == false) {
                            let i = 0;
                            while (i < edoobox.widget_func.payment.paypalv2.data.fundings.length) {
                                edoobox.widget_func.payment.paypalv2.data.fundingSources.push(paypal.FUNDING[edoobox.widget_func.payment.paypalv2.data.fundings[i]]);
                                i++;
                            }
                            
                            for (const fundingSource of edoobox.widget_func.payment.paypalv2.data.fundingSources) {
                                const paypalButtonsComponent = paypal.Buttons({
                                    fundingSource: fundingSource,
                                    
                                    // optional styling for buttons
                                    // https://developer.paypal.com/docs/checkout/standard/customize/buttons-style-guide/
                                    style: {
                                        shape: 'rect',
                                        height: 40
                                    },
                                    
                                    // set up the transaction
                                    createOrder: (data, actions) => {
                                        $('#payment-submit').attr("disabled", true);
                                        $.ajax({
                                            type: 'post',
                                            async: false,
                                            dataType: 'json',
                                            url: $('#paypal-button-container').data('urlintent'),
                                            data: {
                                                'payment_method': 'checkout',
                                                'fundingSource': data.fundingSource
                                            },
                                            success: function (response) {
                                                if (response.error) {
                                                    $('#payment-submit').attr("disabled", false);
                                                } else {
                                                    edoobox.widget_func.payment.paypalv2.order_id = response.order_id;
                                                }
                                            }
                                        });
                                        return edoobox.widget_func.payment.paypalv2.order_id;
                                    },
                                    
                                    // finalize the transaction
                                    onApprove: (data, actions) => {
                                        edoobox.data.modals.loading.show();
                                        var $form = $('#payment-form');
                                        // Insert the token ID into the form so it gets submitted to the server:
                                        $form.append($('<input type="hidden" name="payment_intent_id">').val(edoobox.widget_func.payment.paypalv2.order_id));
                                        $form.attr('action', $('#paypal-button-container').data('url'));
                                        
                                        // Submit the form:
                                        $form.get(0).submit();
                                        
                                    },
                                    
                                    // handle unrecoverable errors
                                    onError: (err) => {
                                        $('#payment-submit').attr("disabled", false);
                                    },
                                    onCancel: function (data) {
                                        $('#payment-submit').attr("disabled", false);
                                    }
                                });
                                
                                if (paypalButtonsComponent.isEligible()) {
                                    paypalButtonsComponent
                                        .render('#paypal-button-container')
                                        .catch((err) => {
                                        });
                                } else {
                                }
                            }
                        } else {
                            
                            paypal.Buttons({
                                style: {
                                    shape: 'rect',
                                    height: 40
                                },
                                
                                onClick: (data) => {
                                    // fundingSource = "venmo"
                                    edoobox.widget_func.payment.paypalv2.fundingSource = data.fundingSource;
                                },
                                
                                // Call your server to set up the transaction
                                createOrder: function (data, actions) {
                                    $('#payment-submit').attr("disabled", true);
                                    $.ajax({
                                        type: 'post',
                                        async: false,
                                        dataType: 'json',
                                        url: $('#paypal-button-container').data('urlintent'),
                                        data: {
                                            'payment_method': 'checkout',
                                            'fundingSource': edoobox.widget_func.payment.paypalv2.fundingSource
                                        },
                                        success: function (response) {
                                            if (response.error) {
                                                $('#payment-submit').attr("disabled", false);
                                            } else {
                                                edoobox.widget_func.payment.paypalv2.order_id = response.order_id;
                                            }
                                        }
                                    });
                                    return edoobox.widget_func.payment.paypalv2.order_id;
                                },
                                
                                // Call your server to finalize the transaction
                                onApprove: function (data, actions) {
                                    edoobox.data.modals.loading.show();
                                    var $form = $('#payment-form');
                                    // Insert the token ID into the form so it gets submitted to the server:
                                    $form.append($('<input type="hidden" name="payment_intent_id">').val(edoobox.widget_func.payment.paypalv2.order_id));
                                    $form.attr('action', $('#paypal-button-container').data('url'));
                                    
                                    // Submit the form:
                                    $form.get(0).submit();
                                },
                                // handle unrecoverable errors
                                onError: (err) => {
                                    $('#payment-submit').attr("disabled", false);
                                },
                                onCancel: function (data) {
                                    $('#payment-submit').attr("disabled", false);
                                }
                                
                            }).render('#paypal-button-container');
                        }
                    }
                },
                stripe: {
                    init: function () {
                        //Gibt es einen Public Key
                        if (typeof STRIPE_PublishableKey == 'string' && STRIPE_PublishableKey != '') {
                            var ConnectAccount = {};
                            if (STRIPE_Account != false) {
                                ConnectAccount = {
                                    stripeAccount: STRIPE_Account
                                };
                            }
                            edoobox.data.payment.stripe = Stripe(STRIPE_PublishableKey, ConnectAccount);
                            const options = {
                                locale: tg('N52960')/*de*/,
                                clientSecret: $('#stripe-card-paymentintents').data('clientsecret'),
                                appearance: {
                                    theme: 'stripe',
                                    variables: {
                                        //fontSizeBase: '13px'
                                    }
                                }
                            };
                            edoobox.data.payment.elements = edoobox.data.payment.stripe.elements(options);
                            
                            const paymentElementOptions = {
                                layout: "tabs"
                            };
                            
                            edoobox.data.payment.paymentElement = edoobox.data.payment.elements.create("payment", paymentElementOptions);
                            edoobox.data.payment.paymentElement.mount("#payment-element");
                            
                        }
                    },
                    stripeResponseHandlerSEPA: function (source) {
                        if (source) {
                            // Send the token to your server.
                            var $form = $('#payment-form');
                            // Insert the token ID into the form so it gets submitted to the server:
                            $form.append($('<input type="hidden" name="stripeToken">').val(source.id));
                            $form.attr('action', $('#payment_stripe_formSEPA').data('url'));
                            
                            // Submit the form:
                            $form.get(0).submit();
                        } else if (source.error) {
                            if (source.error.type == 'invalid_request_error' && typeof source.error.code == "undefined") {
                                $('#stripe_sepa_error .payment-errors').html(tg('N3563')/*Um SEPA Debit Direct verwenden zu können, benötigen wir den Kontoinhaber und die dazugehörige IBAN.*/);
                            } else {
                                switch (result.error.code) {
                                    case 'payment_method_not_available':
                                        $('#stripe_sepa_error .payment-errors').html(tg('N50865')/*Die Zahlungsmethode ist derzeit nicht verfügbar. Bitte verwenden Sie eine andere Zahlungsmethode.*/);
                                        break;
                                    case 'processing_error':
                                        $('#stripe_sepa_error .payment-errors').html(tg('N83478')/*Ein unerwarteter Fehler trat auf, bitte versuchen Sie es erneut.*/);
                                        break;
                                    case 'invalid_bank_account_iban':
                                        $('#stripe_sepa_error .payment-errors').html(tg('N3204')/*Die angegebene IBAN scheint ungültig zu sein. Bitte überprüfen Sie Ihre Eingabe*/);
                                        break;
                                    case 'invalid_owner_name':
                                        $('#stripe_sepa_error .payment-errors').html(tg('N14398')/*Der Konto Inhaber ist ungültig. Dieser muss mindestens 3 Zeichen enthalten*/);
                                        break;
                                    default:
                                        $('#stripe_sepa_error .payment-errors').html(source.error.message);
                                        break;
                                }
                            }
                            $('#stripe_sepa_error').show();
                            edoobox.data.payrun = false;
                            $('#payment-submit').attr("disabled", false);
                            edoobox.data.modals.loading.hide();
                        }
                    }
                }
            }
        },
        
        views: {
            //Welcher View soll geladen werden?
            manager: function () {
                //Welches Template laden
                var tpl = $('#edoobox-view').data('view');
                if (typeof edoobox.views[tpl] == 'function') {
                    edoobox.views[tpl]();
                }
            },
            
            //View Preiskategorien
            preiskat: function () {
                edoobox.InitSpinner();
                $('.list-group-item-action').click(function () {
                    // Alle anderen aktiven Klassen entfernen
                    $('.list-group-item-action').removeClass('list-group-item-success');
                    
                    // Die Klasse 'active' zum angeklickten Listenelement hinzufügen
                    $(this).addClass('list-group-item-success');
                    
                    // Das zugehörige Radio-Button-Input-Feld aktivieren
                    $(this).find('input[type="radio"]').prop('checked', true);
                });
            },
            
            promobuy: function () {
                $('.list-group-item-action').click(function () {
                    // Alle anderen aktiven Klassen entfernen
                    $('.list-group-item-action').removeClass('list-group-item-success');
                    
                    // Die Klasse 'active' zum angeklickten Listenelement hinzufügen
                    $(this).addClass('list-group-item-success');
                    
                    // Das zugehörige Radio-Button-Input-Feld aktivieren
                    $(this).find('input[type="radio"]').prop('checked', true);
                });
            },
            
            //View Leistungen
            leistung: function () {
                edoobox.InitSpinner();
            },
            
            //View Lektion
            lektion: function () {
                $('label.input-group').popover({
                    trigger: "hover",
                    html: true,
                    title: function () {
                        return '<h3 class="popover-title">' + $(this).data('popovertitle') + ' <a href="#" class="close" data-dismiss="alert">×</a></h3>';
                    },
                    content: function () {
                        return $(this).find('div.popoverhtml').html();
                    }
                });
                $(document).on("click", ".popover .close", function () {
                    $('label.input-group').popover('hide');
                });
            },
            
            //Formularfelder für Anmalrung
            formular: function () {
                //Identifizierungs Button Init
                $('.identi_user').click(function () {
                    var _i = $(this).data('input').split('-');
                    edoobox.widget_func.UserIdentiSearch(_i[0], _i[1], 'search', 0);
                });
                
                //Datum Feld überprüfen?
                if ($('input[type="date"]').prop('type') != 'date') {
                    var locale = window.navigator.userLanguage || window.navigator.language;
                    moment.locale(locale);
                    $('input[type="date"]').datetimepicker({
                        viewMode: 'years',
                        format: 'YYYY-MM-DD'
                    });
                }
                
                
                // ParsleyConfig definition if not already set
                window.ParsleyConfig = window.ParsleyConfig || {};
                window.ParsleyConfig.i18n = window.ParsleyConfig.i18n || {};
                
                // Define then the messages
                window.ParsleyConfig.i18n.edoobox = $.extend(window.ParsleyConfig.i18n.edoobox || {}, {
                    defaultMessage: tg('N31930')/*Die Eingabe scheint nicht korrekt zu sein.*/,
                    type: {
                        email: tg('N54686')/*Die Eingabe muss eine gültige E-Mail-Adresse sein.*/,
                        url: tg('N45377')/*Die Eingabe muss eine gültige URL sein.*/,
                        number: tg('N19913')/*Die Eingabe muss eine Zahl sein.*/,
                        integer: tg('N19913')/*Die Eingabe muss eine Zahl sein.*/,
                        digits: tg('N19913')/*Die Eingabe muss eine Zahl sein.*/,
                        alphanum: tg('N78272')/*Die Eingabe muss alphanumerisch sein.*/
                    },
                    notblank: tg('N89553')/*Die Eingabe darf nicht leer sein.*/,
                    required: tg('N85030')/*Dies ist ein Pflichtfeld.*/,
                    pattern: tg('N46113')/*Die Eingabe scheint ungültig zu sein.*/,
                    min: tg('N73056')/*Die Eingabe muss größer oder gleich %s sein.*/,
                    max: tg('N52058')/*Die Eingabe muss kleiner oder gleich %s sein.*/,
                    range: tg('N52058')/*Die Eingabe muss kleiner oder gleich %s sein.*/,
                    minlength: tg('N25764')/*Die Eingabe ist zu kurz. Es müssen mindestens %s Zeichen eingegeben werden.*/,
                    maxlength: tg('N37812')/*Die Eingabe ist zu lang. Es dürfen höchstens %s Zeichen eingegeben werden.*/,
                    length: tg('N28908')/*Die Länge der Eingabe ist ungültig. Es müssen zwischen %s und %s Zeichen eingegeben werden.*/,
                    equalto: tg('N31705')/*Dieses Feld muss dem anderen entsprechen.*/
                });
                
                
                // If file is loaded after Parsley main file, auto-load locale
                if ('undefined' !== typeof window.ParsleyValidator) {
                    window.Parsley.addCatalog('edoobox', window.ParsleyConfig.i18n.edoobox, true);
                    window.Parsley.setLocale('edoobox');
                    
                    
                    $('#addUser').parsley({
                        successClass: "is-valid",
                        errorClass: "is-invalid",
                        classHandler: function (el) {
                            return el.$element.closest(".form-control");
                        },
                        errorsContainer: function (el) {
                            return el.$element.closest(".ParsleyGroup_after");
                        },
                        errorsWrapper: "<div class='col-sm-12 text-danger'></div>",
                        errorTemplate: "<div></div>"
                    }).on('form:validated', function (formInstance) {
                        
                        if ($(formInstance['_$submitSource']).val() != 'P') {
                            if ($(formInstance['_$submitSource']).attr('formaction') === undefined) {
                                //Die URL ist nicht definiert, daher nichts unternehmen
                            } else {
                                $('#addUser').get(0).setAttribute('action', $(formInstance['_$submitSource']).attr('formaction'));
                            }
                            formInstance.validationResult = true;
                        } else {
                            formInstance.isValid({ force: true });
                        }
                    });
                }
                
                $(document).on("keypress", "form", function (event) {
                    return event.keyCode != 13;
                });
                
                //Email verfification
                if ($('.email_submit_okbox').data('sta') == 0) {
                    $('.email_submit_okbox').hide();
                }
                
                //Email überprüfen
                $('.email_submit').click(function () {
                    var elm = $(this);
                    $('#email-verf-alert').hide();
                    $('#email-verf-progress').show();
                    
                    $.ajax({
                        type: 'post',
                        async: true,
                        dataType: 'json',
                        url: elm.attr('formaction'),
                        data: {
                            'a': $('#email').val(),
                            'b': 2
                        },
                        success: function (json) {
                            $('#email-verf-progress').hide();
                            if (json.ok == true) {
                                //Darf die Überprüfung gemacht werden, oder soll abgebrochen werden?
                                if (json.check == true) {
                                    $('.email_submit_okbox').show();
                                    elm.hide();
                                    
                                    $('#email').prop('readonly', true);
                                    
                                    setTimeout(function () {
                                        $('#email_reset').show();
                                    }, 10000);
                                } else {
                                    elm.hide();
                                }
                            } else {
                                $('#email-verf-alert').show();
                            }
                        }
                    });
                    $.ajax({
                        url: 'https://js.pusher.com/8.4/pusher.min.js',
                        dataType: "script",
                        success: function () {
                            var pusher = new Pusher('d587a805bc5241f3b926',
                                {
                                    authEndpoint: $ajU.webSo,
                                    encrypted: true,
                                    cluster: "eu"
                                }
                            );
                            var channel = pusher.subscribe($channel);
                            channel.bind('emailvalid', function (data) {
                                //Die Mail wurde erfolgreich überprüft
                                $('.email_submit_okbox_mail').show();
                                $('.email_submit').hide();
                                $('.email_submit_okbox').hide();
                                $('#email_reset').hide();
                                $('#email').prop('readonly', true);
                            });
                        }
                    });
                    
                    return false;
                });
                
                $('.email_reset').click(function () {
                    var elm = $(this);
                    $('#email-verf-alert').hide();
                    $('#email-verf-alert2').hide();
                    elm.hide();
                    $('#email').prop('readonly', false);
                    $('.email_submit_okbox').hide();
                    $('.email_submit').show();
                });
                
                
                //Code für E_amil überprüfen
                
                $('.email_submit_ok').click(function () {
                    var elm = $(this);
                    $('#email-verf-alert2').hide();
                    $('#email-verf-progress').show();
                    $.ajax({
                        type: 'post',
                        async: false,
                        dataType: 'json',
                        url: elm.attr('formaction'),
                        data: {
                            'a': $('#email-verf').val(),
                            'b': 2
                        },
                        success: function (json) {
                            $('#email-verf-progress').hide();
                            if (json.ok == true) {
                                //Darf die Überprüfung gemacht werden, oder soll abgebrochen werden?
                                $('.email_submit_okbox_mail').show();
                                $('.email_submit').hide();
                                $('.email_submit_okbox').hide();
                                $('#email_reset').hide();
                            } else {
                                $('#email-verf-alert2').show();
                            }
                        }
                    });
                    return false;
                });
                
                
                //Phone verfification
                $('.phone_submit_okbox').hide();
                
                //Nummer überprüfen
                $('.phone_submit').click(function () {
                    var elm = $(this);
                    $('#' + elm.data('inp') + '-verf-alert').hide();
                    $('#' + elm.data('inp') + '-verf-progress').show();
                    
                    $.ajax({
                        type: 'post',
                        async: false,
                        dataType: 'json',
                        url: elm.attr('formaction'),
                        data: {
                            'a': $('#' + elm.data('inp')).val(),
                            'b': 2,
                            'c': $('#land').val()
                        },
                        success: function (json) {
                            $('#' + elm.data('inp') + '-verf-progress').hide();
                            if (json.ok == true) {
                                //Darf die Überprüfung gemacht werden, oder soll abgebrochen werden?
                                if (json.check == true) {
                                    $('.phone_submit_okbox').show();
                                    elm.hide();
                                    
                                    $('#' + elm.data('inp')).prop('disabled', true);
                                    
                                    setTimeout(function () {
                                        $('#' + elm.data('inp') + '_reset').show();
                                    }, 10000);
                                } else {
                                    elm.hide();
                                }
                            } else {
                                $('#' + elm.data('inp') + '-verf-alert').show();
                            }
                        }
                    });
                    return false;
                });
                
                $('.phone_reset').click(function () {
                    var elm = $(this);
                    $('#' + elm.data('inp') + '-verf-alert').hide();
                    $('#' + elm.data('inp') + '-verf-alert2').hide();
                    elm.hide();
                    $('#' + elm.data('inp')).prop('disabled', false);
                    $('.phone_submit_okbox').hide();
                    $('.phone_submit').show();
                });
                
                
                //Code für Nummer überprüfen
                
                $('.phone_submit_ok').click(function () {
                    var elm = $(this);
                    $('#' + elm.data('inp') + '-verf-alert2').hide();
                    $('#' + elm.data('inp') + '-verf-progress').show();
                    $.ajax({
                        type: 'post',
                        async: false,
                        dataType: 'json',
                        url: elm.attr('formaction'),
                        data: {
                            'a': $('#' + elm.data('inp') + '-verf').val(),
                            'b': 2
                        },
                        success: function (json) {
                            $('#' + elm.data('inp') + '-verf-progress').hide();
                            if (json.ok == true) {
                                //Darf die Überprüfung gemacht werden, oder soll abgebrochen werden?
                                $('#' + elm.data('inp') + '_valid').show();
                                $('.phone_submit').hide();
                                $('.phone_submit_okbox').hide();
                                $('#' + elm.data('inp') + '_reset').hide();
                            } else {
                                $('#' + elm.data('inp') + '-verf-alert2').show();
                            }
                        }
                    });
                    return false;
                });
                
                var previousPK;
                var resetPK = false;
                $(".pk_user_js").on('focus', function () {
                    // Store the current value on focus and on change
                    previousPK = this.value;
                }).change(function () {
                    if ( ! resetPK) {
                        var elm = $(this);
                        $.ajax({
                            type: 'post',
                            async: false,
                            dataType: 'json',
                            url: $ed_sync.url_pk,
                            data: {
                                'a': elm.data('user'),
                                'b': elm.val()
                            },
                            success: function (json) {
                                //Konnten die Änderungen vorgenommen werden
                                if (json.ok == true) {
                                    //Die Änderung konnte erstellt werden
                                    
                                } else {
                                    //Fehler, die Änderung konnte nicht erstellt werden
                                    //Wieso nicht und zurückstellen?
                                    resetPK = true;
                                    elm.val(previousPK);
                                    resetPK = false;
                                    
                                    $('#' + elm.attr('id') + '-error').show();
                                    setTimeout(function () {
                                        $('#' + elm.attr('id') + '-error').hide();
                                    }, 5000);
                                }
                            }
                        });
                    }
                });
                
                //Wenn bei der Rechnungsadresse etwas eingegeben wird, dann diese aktivieren
                $("#invoice0, #invoice1, #invoice2, #invoice3, #invoice4, #invoice5, #invoice6").change(function () {
                    $('#invoice_address_add').prop('checked', true);
                });
                
            },
            
            //View Payment Seite 2.0
            payment2: function () {
                
                //Tab etc. init
                var pay_amount = 0;
                var pay_currency = '';
                
                //Stripe nur laden, wenn es verwendet wird
                edoobox.widget_func.payment.stripe.init();
                
                //PayPalv2 nur laden, wenn es verwendet wird
                edoobox.widget_func.payment.paypalv2.init();
                
                document.querySelectorAll('.accordion-button').forEach(button => {
                    button.addEventListener('click', function () {
                        const radio = this.querySelector('input[type="radio"]');
                        radio.checked = true;
                    });
                });
                
                
                $(".edpayForm").removeAttr("disabled");
                $("#payment-form").submit(function (event) {
                    // Deactivate the submit button to avoid further clicks
                    $('.edpayForm').attr("disabled", "disabled");
                    edoobox.data.modals.loading.show();
                    
                    switch ($('input[name=paysystem_select]:checked').val()) {
                        case 'rechnung':
                            $("#payment-form").attr("target", "");
                            return true;
                            break;
                        case 'stripe.com':
                            // Request a token from Stripe:
                            $("#payment-form").attr("target", "");
                            if ( ! edoobox.data.payrun) {
                                edoobox.data.payrun = true;
                                
                                var elements = edoobox.data.payment.elements;
                                
                                var options = {
                                    elements,
                                    confirmParams: {
                                        return_url: $('#stripe-card-paymentintents').data('returnurl')
                                    }
                                };
                                
                                edoobox.data.payment.stripe.confirmPayment(options)
                                    .then(function (result) {
                                        if (result.error) {
                                            const messageContainer = document.querySelector("#stripe-payment-message");
                                            messageContainer.classList.remove("hidden");
                                            messageContainer.textContent = result.error.message;
                                            
                                            setTimeout(function () {
                                                messageContainer.classList.add("hidden");
                                                messageContainer.textContent = "";
                                            }, 4000);
                                            
                                            edoobox.data.modals.loading.hide();
                                            $('.edpayForm').attr("disabled", false);
                                            edoobox.data.payrun = false;
                                        }
                                    });
                            }
                            return false;
                            break;
                        
                        case 'paypal.com':
                            return true;
                            break;
                        case 'bitpay':
                            $.ajax({
                                type: 'post',
                                async: false,
                                dataType: 'json',
                                url: $('#payment-form').attr('action'),
                                data: 'pay_options=bitpay' +
                                    '&view=' + (top.location == location ? 'web' : 'iframe'),
                                success: function (json) {
                                    //Konnte die Transaktion erstellt werden?
                                    if (json.ok == true) {
                                        //GOTO: Paymentsystem in iFrame
                                        window.location.href = json.url;
                                    } else {
                                        $("#payment-submit").removeAttr("disabled");
                                    }
                                }
                            });
                            return false;
                            break;
                        default:
                            //Alle andernen Zahlungssysteme
                            return true;
                    }
                });
            }
        },
        getArg: function (theParameter) {
            var params = window.location.search.substr(1).split('&');
            
            for (var i = 0; i < params.length; i++) {
                var p = params[i].split('=');
                if (p[0] == theParameter) {
                    return decodeURIComponent(p[1]).replace('/', '').replace('/', '').replace('/', '');
                }
            }
            return false;
        },
        getArgOLD: function (name) {
            var args = new Object();
            var query = location.search.substring(1);
            var pairs = query.split("&amp;");
            
            var number_of_arguments = pairs.length;
            
            for (var i = 0; i < number_of_arguments; i++) {
                var pos = pairs[i].indexOf('=');
                
                if (pos == -1) {
                    continue;
                }
                
                var argname = pairs[i].substring(0, pos);
                var value = pairs[i].substring(pos + 1);
                
                args[argname] = unescape(value);
            }
            
            args["NB_OF_ARGS"] = number_of_arguments;
            
            switch (name) {
                case "ALL_ARGS":
                    return args;
                    break;
                default:
                    if (args[name]) {
                        return args[name];
                    } else {
                        return null;
                    }
                    break;
            }
        }, gtm: function () {
        
        },
        gtm_clientID: function () {
        },
        
        updateQueryStringParam: function (key, value, baseUrl, urlQueryString) {
            var returnURL = false;
            if (typeof baseUrl == "undefined") {
                baseUrl = [location.protocol, '//', location.host, location.pathname].join('');
                urlQueryString = document.location.search;
            } else {
                returnURL = true;
            }
            var newParam = key + '=' + value,
                params   = '?' + newParam;
            
            // If the "search" string exists, then build params from it
            if (urlQueryString) {
                keyRegex = new RegExp('([\?&])' + key + '[^&]*');
                // If param exists already, update it
                if (urlQueryString.match(keyRegex) !== null) {
                    params = urlQueryString.replace(keyRegex, "$1" + newParam);
                } else { // Otherwise, add it to end of query string
                    params = urlQueryString + '&' + newParam;
                }
            }
            //window.history.replaceState({}, "", baseUrl + params);
            if (returnURL) {
                return params;
            } else {
                window.history.pushState({}, "", baseUrl + params);
            }
        }
    };
    
    $(function () {
        //Bootstrap Version
        edoobox.data.bs_version = $('body').data('bs');
        
        /** ---------- Plugin specific code (start) ---------- **/
        var iframe = {
            data: {
                id: "",
                autoh3: 0,
                interval1: 0,
                t2: 0
            },
            set: function (selector, url) {
                //Ist es eine ID oder eine Class?
                // Creates a new ID for the new iframe.
                iframe.data.id = 'ediframe' + Math.round(new Date().getTime());
                
                // Prepare the new iframe with given URL.
                var i_html = '<iframe id="' + iframe.data.id + '" src="' + url + '" seamless="seamless" style="width:100%; height:300px; border:0 none;" frameborder="0" hspace="0" vspace="0" marginheight="0" marginwidth="0" allowtransparency="true"></iframe>';
                
                // Insert the new iframe before the current iframe.
                $(i_html).insertBefore(selector);
                
                // Hide the current iframe.
                $(selector).hide();
                
                // Add the '#edinframe' hash to the URL.
                window.location.hash = '#edinframe';
                
                // Check if the event onhashchange is available on the window object.
                if ('onhashchange' in window) {
                    // If yes, add callback to onhashchange event.
                    // Callback will fire every time the hash changes.
                    // Callback: If the hash is not #edinframe, then remove
                    // event listeners for the "message" event, that is defined
                    // below this callback.
                    window.onhashchange = function (a) {
                        // If the new hash is not '#edinframe', then..
                        if (window.location.hash != '#edinframe') {
                            // .. fetch the '#edinframe + timestamp' (new) iframe, that was defined above.
                            // See: iframe.data.id = 'ediframe' + Math.round(new Date().getTime());
                            $('#' + iframe.data.id).remove();
                            
                            // Show the default (previously referred to as: 'current') iframe.
                            $(selector).show();
                            
                            // Stop listening to the "message" event.
                            // Message event listener is defined below in this 'set' function.
                            try {
                                if (window.addEventListener) {
                                    window.removeEventListener("message", iframe.iFrameListener, false);
                                } else {
                                    window.detachEvent("onmessage", iframe.iFrameListener);
                                }
                            } catch (e) {
                            }
                        }
                    };
                }
                
                // Add event listender for the "message" event and fire callback iFrameListener.
                try {
                    if (window.addEventListener) {
                        window.addEventListener("message", iframe.iFrameListener, false);
                    } else {
                        window.attachEvent("onmessage", iframe.iFrameListener);
                    }
                } catch (e) {
                }
                
                // Select the "new" iframe (which is the registration form).
                var iframetmp = document.getElementById(iframe.data.id);
                // Wait for the iframe to load and then set the height withing 20 * 100ms intervals.
                iframetmp.onload = function () {
                    iframe.data.interval1 = setInterval(function () {
                        if (iframe.data.t2 < 20) {
                            if ($("#" + iframe.data.id).length == 1) {
                                if (typeof iframetmp.attributes['seamless'] != 'undefined' && typeof iframetmp.contentWindow != null) {
                                    iframetmp.contentWindow.postMessage(['getheight', 1, iframe.data.id], '*');
                                    iframe.data.t2++;
                                }
                            }
                        } else {
                            iframe.data.t2 = 0;
                            clearInterval(iframe.data.interval1);
                            iframetmp.style.overflow = "auto";
                        }
                    }, 100);
                };
            },
            iFrameListener: function (e) {
                var eventName = e.data[0], data = e.data[1];
                var iframetmp = document.getElementById(iframe.data.id);
                if (iframetmp != null) {
                    switch (eventName) {
                        //GTM E-Commerce Events
                        case 'gtmedoobox':
                            window.dataLayer = window.dataLayer || [];
                            dataLayer.push({ ecommerce: null });
                            dataLayer.push(data);
                            return;
                        case 'setheight':
                            if (iframe.data.autoh3 == 0 || data > iframe.data.autoh3 + 30 || data < iframe.data.autoh3 - 100) {
                                iframetmp.style.height = (data + 50) + 'px';
                                iframe.data.autoh3 = data;
                            }
                            break;
                    }
                }
                // execute once on each new page
                var currentInterval = e.currentTarget?.frames?.iframe?.data?.interval1;
                if (typeof edbsLastInterval === 'undefined') {
                    var edbsLastInterval = null;
                }
                if (edbsLastInterval !== currentInterval) {
                    // write a div with id $edbsAnchor above the iframe
                    function edbs_anchor() {
                        var edbsAnchor = e.currentTarget?.frames?.iframe?.data?.id;
                        
                        // jump to the iframe anchor
                        if (document.getElementById(edbsAnchor)) {
                            function jump(anchorId) {
                                let url = location.href;               //Save down the URL without hash.
                                location.href = "#" + anchorId;                 //Go to the target element.
                                history.replaceState(null, null, url);   //Don't like hashes. Changing it back.
                            }
                            
                            jump(edbsAnchor);
                        }
                    }
                    
                    edbs_anchor();
                    edbsLastInterval = e.currentTarget?.frames?.iframe?.data?.interval1;
                }
            }
        };
        
        if (typeof window.iframe === 'undefined') {
            window.iframe = iframe;
        }
        initialise(".edoobox-plugin", iframe.set);
        /** ---------- Plugin specific code (end) ---------- **/
        
        //Init edoobox iFrame v2.0
        edoobox.ActiveJavaScript();
        
        //View laden
        edoobox.views.manager();
        
        //Wenn kein CookieBanner Widget, alles normal laden
        if ($('.cookiebanner').length == 0) {
            edoobox.widget_func.YesCookie();
        }
        
        //Alle Widget Funktionen ausführen
        $('.edoobox-func').each(function () {
            var func = $(this).data('func');
            if (typeof edoobox.widget_func[func] == 'function') {
                edoobox.widget_func[func]($(this));
            }
        });
        
        //edoobox wird in einem iFrame angezeigt
        //edoobox wird in einem iFrame angezeigt
        if (top.location != location) {
            //iFrame Anischt
            $('.onlyiFrameView').removeClass('onlyiFrameView');
            
            //Der Parent Seite zuhören
            try {
                if (window.addEventListener) {
                    window.addEventListener("message", edoobox.iFrameListener, false);
                } else {
                    window.attachEvent("onmessage", edoobox.iFrameListener);
                }
                
                //Alle dataLayer Events an den Parent senden
                window.dataLayer = window.dataLayer || [];
                
                // Proxy zum Abfangen von Push-Operationen
                window.dataLayer = new Proxy(window.dataLayer, {
                    set: function (target, property, value) {
                        if (property === 'length' || ! Number.isInteger(+property)) {
                            return Reflect.set(target, property, value);
                        }
                        edoobox.iFrameDataLayerPush(value);
                        return Reflect.set(target, property, value);
                    }
                });
                
                // Bestehende Events senden
                if (window.dataLayer.length > 0) {
                    window.dataLayer.forEach(function (item) {
                        edoobox.iFrameDataLayerPush(item);
                    });
                }
            } catch (e) {
            }
        } else {
            //Standard Ansicht
            $('.onlyStandardView').removeClass('onlyStandardView');
        }
        
        /** ---------- Plugin specific code (start) ---------- **/
        sizeFrame(iframe.data.id);
        
        function initialise(selector, callback) {
            if ( ! openLinkInIFrameAllowed(".edoobox-plugin")) {
                return;
            }
            const allEdooboxLinks = document.querySelectorAll(selector + ' a[href*=".edoobox.com/"]');
            allEdooboxLinks.forEach(function (element) {
                // Prüfen, ob bereits ein Event-Listener registriert wurde
                if (element.dataset && element.dataset.edooboxListener === 'true') {
                    return;
                }
                // Markieren, dass ein Listener registriert wurde
                if (element.dataset) {
                    element.dataset.edooboxListener = 'true';
                }
                element.addEventListener("click", function (e) {
                    e.preventDefault();
                    callback(element.closest(".edoobox-plugin"), element.getAttribute('href'));
                });
            });
        }
        
        function openLinkInIFrameAllowed(selector) {
            const pluginElement = document.querySelector(".edoobox-plugin");
            return pluginElement && pluginElement.dataset && pluginElement.dataset.noframe === "0";
        }
        
        function sizeFrame(id) {
            if ( ! id) return;
            postMessage(id);
            setTimeout(function () {
                postMessage(id);
            }, 50);
            setTimeout(function () {
                postMessage(id);
            }, 150);
        }
        
        function postMessage(id) {
            try {
                window.parent.postMessage(['setheight', document.body.clientHeight, id], '*');
            } catch (e) {
                // Handle error if needed
            }
        }
        
        // Example of firing the functions when the DOM is ready
        document.addEventListener("DOMContentLoaded", function () {
            sizeFrame("your-frame-id"); // Replace with the actual frame ID
            initialise(".edoobox-plugin", function (pluginElement, href) {
                // Your callback logic here
            });
        });
        /** ---------- Plugin specific code (end) ---------- **/
    });
    
    
    function array_key_exists(key, search) {
        // http://jsphp.co/jsphp/fn/view/array_key_exists
        // + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
        // + improved by: Felix Geisendoerfer (http://www.debuggable.com/felix)
        // * example 1: array_key_exists('kevin', {'kevin': 'van Zonneveld'});
        // * returns 1: true
        // input sanitation
        if ( ! search || (search.constructor !== Array && search.constructor !== Object)) {
            return false;
        }
        
        return key in search;
    }
    
    function edump(obj) {
        if (window.console) {
            console.info(obj);
        }
    }
    
    function getLogError(val) {
        $.ajax({
            type: 'post',
            async: false,
            url: $urlbase + 'ajax/log',
            data: 'a=' + val,
            success: function (json) {
                //LOG OK
            }
        });
    }
    
    window.authorize_responseHandler = function (response) {
        edoobox.widget_func.payment.authorize.responseHandler(response);
    };
    
    
    /**
     * stacktable.js
     * Author & copyright (c) 2012: John Polacek
     * CardTable by: Justin McNally (2015)
     * MIT license
     *
     * Page: http://johnpolacek.github.com/stacktable.js
     * Repo: https://github.com/johnpolacek/stacktable.js/
     *
     * jQuery plugin for stacking tables on small screens
     * Requires jQuery version 1.7 or above
     *
     */
    ;(function ($) {
        $.fn.cardtable = function (options) {
            var $tables  = this,
                defaults = { headIndex: 0 },
                settings = $.extend({}, defaults, options),
                headIndex;
            
            // checking the "headIndex" option presence... or defaults it to 0
            if (options && options.headIndex)
                headIndex = options.headIndex;
            else
                headIndex = 0;
            
            return $tables.each(function () {
                var $table = $(this);
                if ($table.hasClass('stacktable')) {
                    return;
                }
                var table_css = $(this).prop('class');
                var $stacktable = $('<div></div>');
                if (typeof settings.myClass !== 'undefined') $stacktable.addClass(settings.myClass);
                var markup = '';
                var $caption, $topRow, headMarkup, bodyMarkup, tr_class;
                
                $table.addClass('stacktable large-only');
                
                $caption = $table.find(">caption").clone();
                $topRow = $table.find('>thead>tr,>tbody>tr,>tfoot>tr,>tr').eq(0);
                
                // avoid duplication when paginating
                $table.siblings().filter('.small-only').remove();
                
                // using rowIndex and cellIndex in order to reduce ambiguity
                $table.find('>tbody>tr').each(function () {
                    
                    // declaring headMarkup and bodyMarkup, to be used for separately head and body of single records
                    headMarkup = '';
                    bodyMarkup = '';
                    tr_class = $(this).prop('class');
                    // for the first row, "headIndex" cell is the head of the table
                    // for the other rows, put the "headIndex" cell as the head for that row
                    // then iterate through the key/values
                    
                    $(this).find('>td,>th').each(function (cellIndex) {
                        if ($(this).html() !== '') {
                            bodyMarkup += '<tr class="' + tr_class + '">';
                            // Überprüfen Sie, ob die aktuelle Zelle die Klasse 'month_title_h2' hat
                            if ($topRow.find('>td,>th').eq(cellIndex).hasClass('month_title_h2')) {
                                bodyMarkup += '<td class="st-key"></td>'; // Fügen Sie leeres td hinzu, wenn die Klasse
                                                                          // vorhanden ist
                            } else if ($topRow.find('>td,>th').eq(cellIndex).html()) {
                                bodyMarkup += '<td class="st-key">' + $topRow.find('>td,>th').eq(cellIndex).html() + '</td>';
                            } else {
                                bodyMarkup += '<td class="st-key"></td>';
                            }
                            bodyMarkup += '<td class="st-val ' + $(this).prop('class') + '">' + $(this).html() + '</td>';
                            bodyMarkup += '</tr>';
                        }
                    });
                    
                    markup += '<table class=" ' + table_css + ' stacktable small-only"><tbody>' + headMarkup + bodyMarkup + '</tbody></table>';
                });
                
                $table.find('>tfoot>tr>td').each(function (rowIndex, value) {
                    if ($.trim($(value).text()) !== '') {
                        markup += '<table class="' + table_css + ' stacktable small-only"><tbody><tr><td>' + $(value).html() + '</td></tr></tbody></table>';
                    }
                });
                
                $stacktable.prepend($caption);
                $stacktable.append($(markup));
                $table.before($stacktable);
            });
        };
        
        $.fn.stacktable = function (options) {
            var $tables  = this,
                defaults = { headIndex: 0, displayHeader: true },
                settings = $.extend({}, defaults, options),
                headIndex;
            
            // checking the "headIndex" option presence... or defaults it to 0
            if (options && options.headIndex)
                headIndex = options.headIndex;
            else
                headIndex = 0;
            
            return $tables.each(function () {
                var table_css = $(this).prop('class');
                var $stacktable = $('<table class="' + table_css + ' stacktable small-only"><tbody></tbody></table>');
                if (typeof settings.myClass !== 'undefined') $stacktable.addClass(settings.myClass);
                var markup = '';
                var $table, $caption, $topRow, headMarkup, bodyMarkup, tr_class, displayHeader;
                
                $table = $(this);
                $table.addClass('stacktable large-only');
                $caption = $table.find(">caption").clone();
                $topRow = $table.find('>thead>tr,>tbody>tr,>tfoot>tr').eq(0);
                
                displayHeader = $table.data('display-header') === undefined ? settings.displayHeader : $table.data('display-header');
                
                // using rowIndex and cellIndex in order to reduce ambiguity
                $table.find('>tbody>tr, >thead>tr').each(function (rowIndex) {
                    
                    // declaring headMarkup and bodyMarkup, to be used for separately head and body of single records
                    headMarkup = '';
                    bodyMarkup = '';
                    tr_class = $(this).prop('class');
                    
                    // for the first row, "headIndex" cell is the head of the table
                    if (rowIndex === 0) {
                        // the main heading goes into the markup variable
                        if (displayHeader) {
                            markup += '<tr class=" ' + tr_class + ' "><th class="st-head-row st-head-row-main" colspan="2">' + $(this).find('>th,>td').eq(headIndex).html() + '</th></tr>';
                        }
                    } else {
                        // for the other rows, put the "headIndex" cell as the head for that row
                        // then iterate through the key/values
                        $(this).find('>td,>th').each(function (cellIndex) {
                            if (cellIndex === headIndex) {
                                headMarkup = '<tr class="' + tr_class + '"><th class="st-head-row" colspan="2">' + $(this).html() + '</th></tr>';
                            } else {
                                if ($(this).html() !== '') {
                                    bodyMarkup += '<tr class="' + tr_class + '">';
                                    // Überprüfen Sie, ob die übergeordnete 'tr' die Klasse 'month_title_h2' hat
                                    if ($(this).closest('tr').hasClass('month_title_h2')) {
                                        bodyMarkup += '<td class="st-key"></td>'; // Fügen Sie leeres td hinzu, wenn
                                                                                  // die Klasse vorhanden ist
                                    } else if ($topRow.find('>td,>th').eq(cellIndex).html()) {
                                        bodyMarkup += '<td class="st-key">' + $topRow.find('>td,>th').eq(cellIndex).html() + '</td>';
                                    } else {
                                        bodyMarkup += '<td class="st-key"></td>';
                                    }
                                    bodyMarkup += '<td class="st-val ' + $(this).prop('class') + '">' + $(this).html() + '</td>';
                                    bodyMarkup += '</tr>';
                                }
                            }
                        });
                        
                        
                        markup += headMarkup + bodyMarkup;
                    }
                });
                
                $stacktable.prepend($caption);
                $stacktable.append($(markup));
                $table.before($stacktable);
            });
        };
        
        $.fn.stackcolumns = function (options) {
            var $tables  = this,
                defaults = {},
                settings = $.extend({}, defaults, options);
            
            return $tables.each(function () {
                var $table = $(this);
                var $caption = $table.find(">caption").clone();
                var num_cols = $table.find('>thead>tr,>tbody>tr,>tfoot>tr').eq(0).find('>td,>th').length; //first table
                                                                                                          // <tr> must
                                                                                                          // not
                                                                                                          // contain
                                                                                                          // colspans,
                                                                                                          // or add
                                                                                                          // sum(colspan-1)
                                                                                                          // here.
                if (num_cols < 3) //stackcolumns has no effect on tables with less than 3 columns
                    return;
                
                var $stackcolumns = $('<table class="stacktable small-only"></table>');
                if (typeof settings.myClass !== 'undefined') $stackcolumns.addClass(settings.myClass);
                $table.addClass('stacktable large-only');
                var tb = $('<tbody></tbody>');
                var col_i = 1; //col index starts at 0 -> start copy at second column.
                
                while (col_i < num_cols) {
                    $table.find('>thead>tr,>tbody>tr,>tfoot>tr').each(function (index) {
                        var tem = $('<tr></tr>'); // todo opt. copy styles of $this; todo check if parent is thead or
                                                  // tfoot to handle accordingly
                        if (index === 0) tem.addClass("st-head-row st-head-row-main");
                        var first = $(this).find('>td,>th').eq(0).clone().addClass("st-key");
                        var target = col_i;
                        // if colspan apply, recompute target for second cell.
                        if ($(this).find("*[colspan]").length) {
                            var i = 0;
                            $(this).find('>td,>th').each(function () {
                                var cs = $(this).attr("colspan");
                                if (cs) {
                                    cs = parseInt(cs, 10);
                                    target -= cs - 1;
                                    if ((i + cs) > (col_i)) //out of current bounds
                                        target += i + cs - col_i - 1;
                                    i += cs;
                                } else {
                                    i++;
                                }
                                
                                if (i > col_i)
                                    return false; //target is set; break.
                            });
                        }
                        var second = $(this).find('>td,>th').eq(target).clone().addClass("st-val").removeAttr("colspan");
                        tem.append(first, second);
                        tb.append(tem);
                    });
                    ++col_i;
                }
                
                $stackcolumns.append($(tb));
                $stackcolumns.prepend($caption);
                $table.before($stackcolumns);
            });
        };
        
        
    }(jQuery));
    
    ! function (a) {
        "use strict";
        if ("function" == typeof define && define.amd) define(["jquery", "moment"], a); else if ("object" == typeof exports) module.exports = a(require("jquery"), require("moment")); else {
            if ("undefined" == typeof jQuery) throw "bootstrap-datetimepicker requires jQuery to be loaded first";
            if ("undefined" == typeof moment) throw "bootstrap-datetimepicker requires Moment.js to be loaded first";
            a(jQuery, moment);
        }
    }(function (a, b) {
        "use strict";
        if ( ! b) throw new Error("bootstrap-datetimepicker requires Moment.js to be loaded first");
        var c = function (c, d) {
            var e, f, g, h, i, j, k, l = {}, m = ! 0, n = ! 1, o = ! 1, p = 0,
                q = [{ clsName: "days", navFnc: "M", navStep: 1 }, {
                    clsName: "months",
                    navFnc: "y",
                    navStep: 1
                }, { clsName: "years", navFnc: "y", navStep: 10 }, { clsName: "decades", navFnc: "y", navStep: 100 }],
                r = ["days", "months", "years", "decades"], s = ["top", "bottom", "auto"],
                t = ["left", "right", "auto"], u = ["default", "top", "bottom"], v = {
                    up: 38,
                    38: "up",
                    down: 40,
                    40: "down",
                    left: 37,
                    37: "left",
                    right: 39,
                    39: "right",
                    tab: 9,
                    9: "tab",
                    escape: 27,
                    27: "escape",
                    enter: 13,
                    13: "enter",
                    pageUp: 33,
                    33: "pageUp",
                    pageDown: 34,
                    34: "pageDown",
                    shift: 16,
                    16: "shift",
                    control: 17,
                    17: "control",
                    space: 32,
                    32: "space",
                    t: 84,
                    84: "t",
                    delete: 46,
                    46: "delete"
                }, w = {}, x = function () {
                    return void 0 !== b.tz && void 0 !== d.timeZone && null !== d.timeZone && "" !== d.timeZone;
                }, y = function (a) {
                    var c;
                    return c = void 0 === a || null === a ? b() : b.isDate(a) || b.isMoment(a) ? b(a) : x() ? b.tz(a, j, d.useStrict, d.timeZone) : b(a, j, d.useStrict), x() && c.tz(d.timeZone), c;
                }, z = function (a) {
                    if ("string" != typeof a || a.length > 1) throw new TypeError("isEnabled expects a single character string parameter");
                    switch (a) {
                        case"y":
                            return i.indexOf("Y") !== -1;
                        case"M":
                            return i.indexOf("M") !== -1;
                        case"d":
                            return i.toLowerCase().indexOf("d") !== -1;
                        case"h":
                        case"H":
                            return i.toLowerCase().indexOf("h") !== -1;
                        case"m":
                            return i.indexOf("m") !== -1;
                        case"s":
                            return i.indexOf("s") !== -1;
                        default:
                            return ! 1;
                    }
                }, A = function () {
                    return z("h") || z("m") || z("s");
                }, B = function () {
                    return z("y") || z("M") || z("d");
                }, C = function () {
                    var b = a("<thead>").append(a("<tr>").append(a("<th>").addClass("prev").attr("data-action", "previous").append(a("<span>").addClass(d.icons.previous))).append(a("<th>").addClass("picker-switch").attr("data-action", "pickerSwitch").attr("colspan", d.calendarWeeks ? "6" : "5")).append(a("<th>").addClass("next").attr("data-action", "next").append(a("<span>").addClass(d.icons.next)))),
                        c = a("<tbody>").append(a("<tr>").append(a("<td>").attr("colspan", d.calendarWeeks ? "8" : "7")));
                    return [a("<div>").addClass("datepicker-days").append(a("<table>").addClass("table-condensed").append(b).append(a("<tbody>"))), a("<div>").addClass("datepicker-months").append(a("<table>").addClass("table-condensed").append(b.clone()).append(c.clone())), a("<div>").addClass("datepicker-years").append(a("<table>").addClass("table-condensed").append(b.clone()).append(c.clone())), a("<div>").addClass("datepicker-decades").append(a("<table>").addClass("table-condensed").append(b.clone()).append(c.clone()))];
                }, D = function () {
                    var b = a("<tr>"), c = a("<tr>"), e = a("<tr>");
                    return z("h") && (b.append(a("<td>").append(a("<a>").attr({
                        href: "#",
                        tabindex: "-1",
                        title: d.tooltips.incrementHour
                    }).addClass("btn").attr("data-action", "incrementHours").append(a("<span>").addClass(d.icons.up)))), c.append(a("<td>").append(a("<span>").addClass("timepicker-hour").attr({
                        "data-time-component": "hours",
                        title: d.tooltips.pickHour
                    }).attr("data-action", "showHours"))), e.append(a("<td>").append(a("<a>").attr({
                        href: "#",
                        tabindex: "-1",
                        title: d.tooltips.decrementHour
                    }).addClass("btn").attr("data-action", "decrementHours").append(a("<span>").addClass(d.icons.down))))), z("m") && (z("h") && (b.append(a("<td>").addClass("separator")), c.append(a("<td>").addClass("separator").html(":")), e.append(a("<td>").addClass("separator"))), b.append(a("<td>").append(a("<a>").attr({
                        href: "#",
                        tabindex: "-1",
                        title: d.tooltips.incrementMinute
                    }).addClass("btn").attr("data-action", "incrementMinutes").append(a("<span>").addClass(d.icons.up)))), c.append(a("<td>").append(a("<span>").addClass("timepicker-minute").attr({
                        "data-time-component": "minutes",
                        title: d.tooltips.pickMinute
                    }).attr("data-action", "showMinutes"))), e.append(a("<td>").append(a("<a>").attr({
                        href: "#",
                        tabindex: "-1",
                        title: d.tooltips.decrementMinute
                    }).addClass("btn").attr("data-action", "decrementMinutes").append(a("<span>").addClass(d.icons.down))))), z("s") && (z("m") && (b.append(a("<td>").addClass("separator")), c.append(a("<td>").addClass("separator").html(":")), e.append(a("<td>").addClass("separator"))), b.append(a("<td>").append(a("<a>").attr({
                        href: "#",
                        tabindex: "-1",
                        title: d.tooltips.incrementSecond
                    }).addClass("btn").attr("data-action", "incrementSeconds").append(a("<span>").addClass(d.icons.up)))), c.append(a("<td>").append(a("<span>").addClass("timepicker-second").attr({
                        "data-time-component": "seconds",
                        title: d.tooltips.pickSecond
                    }).attr("data-action", "showSeconds"))), e.append(a("<td>").append(a("<a>").attr({
                        href: "#",
                        tabindex: "-1",
                        title: d.tooltips.decrementSecond
                    }).addClass("btn").attr("data-action", "decrementSeconds").append(a("<span>").addClass(d.icons.down))))), h || (b.append(a("<td>").addClass("separator")), c.append(a("<td>").append(a("<button>").addClass("btn btn-primary").attr({
                        "data-action": "togglePeriod",
                        tabindex: "-1",
                        title: d.tooltips.togglePeriod
                    }))), e.append(a("<td>").addClass("separator"))), a("<div>").addClass("timepicker-picker").append(a("<table>").addClass("table-condensed").append([b, c, e]));
                }, E = function () {
                    var b = a("<div>").addClass("timepicker-hours").append(a("<table>").addClass("table-condensed")),
                        c = a("<div>").addClass("timepicker-minutes").append(a("<table>").addClass("table-condensed")),
                        d = a("<div>").addClass("timepicker-seconds").append(a("<table>").addClass("table-condensed")),
                        e = [D()];
                    return z("h") && e.push(b), z("m") && e.push(c), z("s") && e.push(d), e;
                }, F = function () {
                    var b = [];
                    return d.showTodayButton && b.push(a("<td>").append(a("<a>").attr({
                        "data-action": "today",
                        title: d.tooltips.today
                    }).append(a("<span>").addClass(d.icons.today)))), ! d.sideBySide && B() && A() && b.push(a("<td>").append(a("<a>").attr({
                        "data-action": "togglePicker",
                        title: d.tooltips.selectTime
                    }).append(a("<span>").addClass(d.icons.time)))), d.showClear && b.push(a("<td>").append(a("<a>").attr({
                        "data-action": "clear",
                        title: d.tooltips.clear
                    }).append(a("<span>").addClass(d.icons.clear)))), d.showClose && b.push(a("<td>").append(a("<a>").attr({
                        "data-action": "close",
                        title: d.tooltips.close
                    }).append(a("<span>").addClass(d.icons.close)))), a("<table>").addClass("table-condensed").append(a("<tbody>").append(a("<tr>").append(b)));
                }, G = function () {
                    var b = a("<div>").addClass("bootstrap-datetimepicker-widget dropdown-menu"),
                        c = a("<div>").addClass("datepicker").append(C()),
                        e = a("<div>").addClass("timepicker").append(E()), f = a("<ul>").addClass("list-unstyled"),
                        g = a("<li>").addClass("picker-switch" + (d.collapse ? " accordion-toggle" : "")).append(F());
                    return d.inline && b.removeClass("dropdown-menu"), h && b.addClass("usetwentyfour"), z("s") && ! h && b.addClass("wider"), d.sideBySide && B() && A() ? (b.addClass("timepicker-sbs"), "top" === d.toolbarPlacement && b.append(g), b.append(a("<div>").addClass("row").append(c.addClass("col-md-6")).append(e.addClass("col-md-6"))), "bottom" === d.toolbarPlacement && b.append(g), b) : ("top" === d.toolbarPlacement && f.append(g), B() && f.append(a("<li>").addClass(d.collapse && A() ? "collapse in" : "").append(c)), "default" === d.toolbarPlacement && f.append(g), A() && f.append(a("<li>").addClass(d.collapse && B() ? "collapse" : "").append(e)), "bottom" === d.toolbarPlacement && f.append(g), b.append(f));
                }, H = function () {
                    var b, e = {};
                    return b = c.is("input") || d.inline ? c.data() : c.find("input").data(), b.dateOptions && b.dateOptions instanceof Object && (e = a.extend( ! 0, e, b.dateOptions)), a.each(d, function (a) {
                        var c = "date" + a.charAt(0).toUpperCase() + a.slice(1);
                        void 0 !== b[c] && (e[a] = b[c]);
                    }), e;
                }, I = function () {
                    var b, e = (n || c).position(), f = (n || c).offset(), g = d.widgetPositioning.vertical,
                        h = d.widgetPositioning.horizontal;
                    if (d.widgetParent) b = d.widgetParent.append(o); else if (c.is("input")) b = c.after(o).parent(); else {
                        if (d.inline) return void (b = c.append(o));
                        b = c, c.children().first().after(o);
                    }
                    if ("auto" === g && (g = f.top + 1.5 * o.height() >= a(window).height() + a(window).scrollTop() && o.height() + c.outerHeight() < f.top ? "top" : "bottom"), "auto" === h && (h = b.width() < f.left + o.outerWidth() / 2 && f.left + o.outerWidth() > a(window).width() ? "right" : "left"), "top" === g ? o.addClass("top").removeClass("bottom") : o.addClass("bottom").removeClass("top"), "right" === h ? o.addClass("pull-right") : o.removeClass("pull-right"), "static" === b.css("position") && (b = b.parents().filter(function () {
                        return "static" !== a(this).css("position");
                    }).first()), 0 === b.length) throw new Error("datetimepicker component should be placed within a non-static positioned container");
                    o.css({
                        top: "top" === g ? "auto" : e.top + c.outerHeight(),
                        bottom: "top" === g ? b.outerHeight() - (b === c ? 0 : e.top) : "auto",
                        left: "left" === h ? b === c ? 0 : e.left : "auto",
                        right: "left" === h ? "auto" : b.outerWidth() - c.outerWidth() - (b === c ? 0 : e.left)
                    });
                }, J = function (a) {
                    "dp.change" === a.type && (a.date && a.date.isSame(a.oldDate) || ! a.date && ! a.oldDate) || c.trigger(a);
                }, K = function (a) {
                    "y" === a && (a = "YYYY"), J({ type: "dp.update", change: a, viewDate: f.clone() });
                }, L = function (a) {
                    o && (a && (k = Math.max(p, Math.min(3, k + a))), o.find(".datepicker > div").hide().filter(".datepicker-" + q[k].clsName).show());
                }, M = function () {
                    var b = a("<tr>"), c = f.clone().startOf("w").startOf("d");
                    for (d.calendarWeeks === ! 0 && b.append(a("<th>").addClass("cw").text("#")); c.isBefore(f.clone().endOf("w"));) b.append(a("<th>").addClass("dow").text(c.format("dd"))), c.add(1, "d");
                    o.find(".datepicker-days thead").append(b);
                }, N = function (a) {
                    return d.disabledDates[a.format("YYYY-MM-DD")] === ! 0;
                }, O = function (a) {
                    return d.enabledDates[a.format("YYYY-MM-DD")] === ! 0;
                }, P = function (a) {
                    return d.disabledHours[a.format("H")] === ! 0;
                }, Q = function (a) {
                    return d.enabledHours[a.format("H")] === ! 0;
                }, R = function (b, c) {
                    if ( ! b.isValid()) return ! 1;
                    if (d.disabledDates && "d" === c && N(b)) return ! 1;
                    if (d.enabledDates && "d" === c && ! O(b)) return ! 1;
                    if (d.minDate && b.isBefore(d.minDate, c)) return ! 1;
                    if (d.maxDate && b.isAfter(d.maxDate, c)) return ! 1;
                    if (d.daysOfWeekDisabled && "d" === c && d.daysOfWeekDisabled.indexOf(b.day()) !== -1) return ! 1;
                    if (d.disabledHours && ("h" === c || "m" === c || "s" === c) && P(b)) return ! 1;
                    if (d.enabledHours && ("h" === c || "m" === c || "s" === c) && ! Q(b)) return ! 1;
                    if (d.disabledTimeIntervals && ("h" === c || "m" === c || "s" === c)) {
                        var e = ! 1;
                        if (a.each(d.disabledTimeIntervals, function () {
                            if (b.isBetween(this[0], this[1])) return e = ! 0, ! 1;
                        }), e) return ! 1;
                    }
                    return ! 0;
                }, S = function () {
                    for (var b = [], c = f.clone().startOf("y").startOf("d"); c.isSame(f, "y");) b.push(a("<span>").attr("data-action", "selectMonth").addClass("month").text(c.format("MMM"))), c.add(1, "M");
                    o.find(".datepicker-months td").empty().append(b);
                }, T = function () {
                    var b = o.find(".datepicker-months"), c = b.find("th"), g = b.find("tbody").find("span");
                    c.eq(0).find("span").attr("title", d.tooltips.prevYear), c.eq(1).attr("title", d.tooltips.selectYear), c.eq(2).find("span").attr("title", d.tooltips.nextYear), b.find(".disabled").removeClass("disabled"), R(f.clone().subtract(1, "y"), "y") || c.eq(0).addClass("disabled"), c.eq(1).text(f.year()), R(f.clone().add(1, "y"), "y") || c.eq(2).addClass("disabled"), g.removeClass("active"), e.isSame(f, "y") && ! m && g.eq(e.month()).addClass("active"), g.each(function (b) {
                        R(f.clone().month(b), "M") || a(this).addClass("disabled");
                    });
                }, U = function () {
                    var a = o.find(".datepicker-years"), b = a.find("th"), c = f.clone().subtract(5, "y"),
                        g = f.clone().add(6, "y"), h = "";
                    for (b.eq(0).find("span").attr("title", d.tooltips.prevDecade), b.eq(1).attr("title", d.tooltips.selectDecade), b.eq(2).find("span").attr("title", d.tooltips.nextDecade), a.find(".disabled").removeClass("disabled"), d.minDate && d.minDate.isAfter(c, "y") && b.eq(0).addClass("disabled"), b.eq(1).text(c.year() + "-" + g.year()), d.maxDate && d.maxDate.isBefore(g, "y") && b.eq(2).addClass("disabled"); ! c.isAfter(g, "y");) h += '<span data-action="selectYear" class="year' + (c.isSame(e, "y") && ! m ? " active" : "") + (R(c, "y") ? "" : " disabled") + '">' + c.year() + "</span>", c.add(1, "y");
                    a.find("td").html(h);
                }, V = function () {
                    var a, c = o.find(".datepicker-decades"), g = c.find("th"), h = b({ y: f.year() - f.year() % 100 - 1 }),
                        i = h.clone().add(100, "y"), j = h.clone(), k = ! 1, l = ! 1, m = "";
                    for (g.eq(0).find("span").attr("title", d.tooltips.prevCentury), g.eq(2).find("span").attr("title", d.tooltips.nextCentury), c.find(".disabled").removeClass("disabled"), (h.isSame(b({ y: 1900 })) || d.minDate && d.minDate.isAfter(h, "y")) && g.eq(0).addClass("disabled"), g.eq(1).text(h.year() + "-" + i.year()), (h.isSame(b({ y: 2e3 })) || d.maxDate && d.maxDate.isBefore(i, "y")) && g.eq(2).addClass("disabled"); ! h.isAfter(i, "y");) a = h.year() + 12, k = d.minDate && d.minDate.isAfter(h, "y") && d.minDate.year() <= a, l = d.maxDate && d.maxDate.isAfter(h, "y") && d.maxDate.year() <= a, m += '<span data-action="selectDecade" class="decade' + (e.isAfter(h) && e.year() <= a ? " active" : "") + (R(h, "y") || k || l ? "" : " disabled") + '" data-selection="' + (h.year() + 6) + '">' + (h.year() + 1) + " - " + (h.year() + 12) + "</span>", h.add(12, "y");
                    m += "<span></span><span></span><span></span>", c.find("td").html(m), g.eq(1).text(j.year() + 1 + "-" + h.year());
                }, W = function () {
                    var b, c, g, h = o.find(".datepicker-days"), i = h.find("th"), j = [], k = [];
                    if (B()) {
                        for (i.eq(0).find("span").attr("title", d.tooltips.prevMonth), i.eq(1).attr("title", d.tooltips.selectMonth), i.eq(2).find("span").attr("title", d.tooltips.nextMonth), h.find(".disabled").removeClass("disabled"), i.eq(1).text(f.format(d.dayViewHeaderFormat)), R(f.clone().subtract(1, "M"), "M") || i.eq(0).addClass("disabled"), R(f.clone().add(1, "M"), "M") || i.eq(2).addClass("disabled"), b = f.clone().startOf("M").startOf("w").startOf("d"), g = 0; g < 42; g++) 0 === b.weekday() && (c = a("<tr>"), d.calendarWeeks && c.append('<td class="cw">' + b.week() + "</td>"), j.push(c)), k = ["day"], b.isBefore(f, "M") && k.push("old"), b.isAfter(f, "M") && k.push("new"), b.isSame(e, "d") && ! m && k.push("active"), R(b, "d") || k.push("disabled"), b.isSame(y(), "d") && k.push("today"), 0 !== b.day() && 6 !== b.day() || k.push("weekend"), J({
                            type: "dp.classify",
                            date: b,
                            classNames: k
                        }), c.append('<td data-action="selectDay" data-day="' + b.format("L") + '" class="' + k.join(" ") + '">' + b.date() + "</td>"), b.add(1, "d");
                        h.find("tbody").empty().append(j), T(), U(), V();
                    }
                }, X = function () {
                    var b = o.find(".timepicker-hours table"), c = f.clone().startOf("d"), d = [], e = a("<tr>");
                    for (f.hour() > 11 && ! h && c.hour(12); c.isSame(f, "d") && (h || f.hour() < 12 && c.hour() < 12 || f.hour() > 11);) c.hour() % 4 === 0 && (e = a("<tr>"), d.push(e)), e.append('<td data-action="selectHour" class="hour' + (R(c, "h") ? "" : " disabled") + '">' + c.format(h ? "HH" : "hh") + "</td>"), c.add(1, "h");
                    b.empty().append(d);
                }, Y = function () {
                    for (var b = o.find(".timepicker-minutes table"), c = f.clone().startOf("h"), e = [], g = a("<tr>"), h = 1 === d.stepping ? 5 : d.stepping; f.isSame(c, "h");) c.minute() % (4 * h) === 0 && (g = a("<tr>"), e.push(g)), g.append('<td data-action="selectMinute" class="minute' + (R(c, "m") ? "" : " disabled") + '">' + c.format("mm") + "</td>"), c.add(h, "m");
                    b.empty().append(e);
                }, Z = function () {
                    for (var b = o.find(".timepicker-seconds table"), c = f.clone().startOf("m"), d = [], e = a("<tr>"); f.isSame(c, "m");) c.second() % 20 === 0 && (e = a("<tr>"), d.push(e)), e.append('<td data-action="selectSecond" class="second' + (R(c, "s") ? "" : " disabled") + '">' + c.format("ss") + "</td>"), c.add(5, "s");
                    b.empty().append(d);
                }, $ = function () {
                    var a, b, c = o.find(".timepicker span[data-time-component]");
                    h || (a = o.find(".timepicker [data-action=togglePeriod]"), b = e.clone().add(e.hours() >= 12 ? -12 : 12, "h"), a.text(e.format("A")), R(b, "h") ? a.removeClass("disabled") : a.addClass("disabled")), c.filter("[data-time-component=hours]").text(e.format(h ? "HH" : "hh")), c.filter("[data-time-component=minutes]").text(e.format("mm")), c.filter("[data-time-component=seconds]").text(e.format("ss")), X(), Y(), Z();
                }, _ = function () {
                    o && (W(), $());
                }, aa = function (a) {
                    var b = m ? null : e;
                    if ( ! a) return m = ! 0, g.val(""), c.data("date", ""), J({
                        type: "dp.change",
                        date: ! 1,
                        oldDate: b
                    }), void _();
                    if (a = a.clone().locale(d.locale), x() && a.tz(d.timeZone), 1 !== d.stepping) for (a.minutes(Math.round(a.minutes() / d.stepping) * d.stepping).seconds(0); d.minDate && a.isBefore(d.minDate);) a.add(d.stepping, "minutes");
                    R(a) ? (e = a, f = e.clone(), g.val(e.format(i)), c.data("date", e.format(i)), m = ! 1, _(), J({
                        type: "dp.change",
                        date: e.clone(),
                        oldDate: b
                    })) : (d.keepInvalid ? J({
                        type: "dp.change",
                        date: a,
                        oldDate: b
                    }) : g.val(m ? "" : e.format(i)), J({ type: "dp.error", date: a, oldDate: b }));
                }, ba = function () {
                    var b = ! 1;
                    return o ? (o.find(".collapse").each(function () {
                        var c = a(this).data("collapse");
                        return ! c || ! c.transitioning || (b = ! 0, ! 1);
                    }), b ? l : (n && n.hasClass("btn") && n.toggleClass("active"), o.hide(), a(window).off("resize", I), o.off("click", "[data-action]"), o.off("mousedown", ! 1), o.remove(), o = ! 1, J({
                        type: "dp.hide",
                        date: e.clone()
                    }), g.blur(), f = e.clone(), l)) : l;
                }, ca = function () {
                    aa(null);
                }, da = function (a) {
                    return void 0 === d.parseInputDate ? ( ! b.isMoment(a) || a instanceof Date) && (a = y(a)) : a = d.parseInputDate(a), a;
                }, ea = {
                    next: function () {
                        var a = q[k].navFnc;
                        f.add(q[k].navStep, a), W(), K(a);
                    }, previous: function () {
                        var a = q[k].navFnc;
                        f.subtract(q[k].navStep, a), W(), K(a);
                    }, pickerSwitch: function () {
                        L(1);
                    }, selectMonth: function (b) {
                        var c = a(b.target).closest("tbody").find("span").index(a(b.target));
                        f.month(c), k === p ? (aa(e.clone().year(f.year()).month(f.month())), d.inline || ba()) : (L(-1), W()), K("M");
                    }, selectYear: function (b) {
                        var c = parseInt(a(b.target).text(), 10) || 0;
                        f.year(c), k === p ? (aa(e.clone().year(f.year())), d.inline || ba()) : (L(-1), W()), K("YYYY");
                    }, selectDecade: function (b) {
                        var c = parseInt(a(b.target).data("selection"), 10) || 0;
                        f.year(c), k === p ? (aa(e.clone().year(f.year())), d.inline || ba()) : (L(-1), W()), K("YYYY");
                    }, selectDay: function (b) {
                        var c = f.clone();
                        a(b.target).is(".old") && c.subtract(1, "M"), a(b.target).is(".new") && c.add(1, "M"), aa(c.date(parseInt(a(b.target).text(), 10))), A() || d.keepOpen || d.inline || ba();
                    }, incrementHours: function () {
                        var a = e.clone().add(1, "h");
                        R(a, "h") && aa(a);
                    }, incrementMinutes: function () {
                        var a = e.clone().add(d.stepping, "m");
                        R(a, "m") && aa(a);
                    }, incrementSeconds: function () {
                        var a = e.clone().add(1, "s");
                        R(a, "s") && aa(a);
                    }, decrementHours: function () {
                        var a = e.clone().subtract(1, "h");
                        R(a, "h") && aa(a);
                    }, decrementMinutes: function () {
                        var a = e.clone().subtract(d.stepping, "m");
                        R(a, "m") && aa(a);
                    }, decrementSeconds: function () {
                        var a = e.clone().subtract(1, "s");
                        R(a, "s") && aa(a);
                    }, togglePeriod: function () {
                        aa(e.clone().add(e.hours() >= 12 ? -12 : 12, "h"));
                    }, togglePicker: function (b) {
                        var c, e = a(b.target), f = e.closest("ul"), g = f.find(".in"), h = f.find(".collapse:not(.in)");
                        if (g && g.length) {
                            if (c = g.data("collapse"), c && c.transitioning) return;
                            g.collapse ? (g.collapse("hide"), h.collapse("show")) : (g.removeClass("in"), h.addClass("in")), e.is("span") ? e.toggleClass(d.icons.time + " " + d.icons.date) : e.find("span").toggleClass(d.icons.time + " " + d.icons.date);
                        }
                    }, showPicker: function () {
                        o.find(".timepicker > div:not(.timepicker-picker)").hide(), o.find(".timepicker .timepicker-picker").show();
                    }, showHours: function () {
                        o.find(".timepicker .timepicker-picker").hide(), o.find(".timepicker .timepicker-hours").show();
                    }, showMinutes: function () {
                        o.find(".timepicker .timepicker-picker").hide(), o.find(".timepicker .timepicker-minutes").show();
                    }, showSeconds: function () {
                        o.find(".timepicker .timepicker-picker").hide(), o.find(".timepicker .timepicker-seconds").show();
                    }, selectHour: function (b) {
                        var c = parseInt(a(b.target).text(), 10);
                        h || (e.hours() >= 12 ? 12 !== c && (c += 12) : 12 === c && (c = 0)), aa(e.clone().hours(c)), ea.showPicker.call(l);
                    }, selectMinute: function (b) {
                        aa(e.clone().minutes(parseInt(a(b.target).text(), 10))), ea.showPicker.call(l);
                    }, selectSecond: function (b) {
                        aa(e.clone().seconds(parseInt(a(b.target).text(), 10))), ea.showPicker.call(l);
                    }, clear: ca, today: function () {
                        var a = y();
                        R(a, "d") && aa(a);
                    }, close: ba
                }, fa = function (b) {
                    return ! a(b.currentTarget).is(".disabled") && (ea[a(b.currentTarget).data("action")].apply(l, arguments), ! 1);
                }, ga = function () {
                    var b, c = {
                        year: function (a) {
                            return a.month(0).date(1).hours(0).seconds(0).minutes(0);
                        }, month: function (a) {
                            return a.date(1).hours(0).seconds(0).minutes(0);
                        }, day: function (a) {
                            return a.hours(0).seconds(0).minutes(0);
                        }, hour: function (a) {
                            return a.seconds(0).minutes(0);
                        }, minute: function (a) {
                            return a.seconds(0);
                        }
                    };
                    return g.prop("disabled") || ! d.ignoreReadonly && g.prop("readonly") || o ? l : (void 0 !== g.val() && 0 !== g.val().trim().length ? aa(da(g.val().trim())) : m && d.useCurrent && (d.inline || g.is("input") && 0 === g.val().trim().length) && (b = y(), "string" == typeof d.useCurrent && (b = c[d.useCurrent](b)), aa(b)), o = G(), M(), S(), o.find(".timepicker-hours").hide(), o.find(".timepicker-minutes").hide(), o.find(".timepicker-seconds").hide(), _(), L(), a(window).on("resize", I), o.on("click", "[data-action]", fa), o.on("mousedown", ! 1), n && n.hasClass("btn") && n.toggleClass("active"), I(), o.show(), d.focusOnShow && ! g.is(":focus") && g.focus(), J({ type: "dp.show" }), l);
                }, ha = function () {
                    return o ? ba() : ga();
                }, ia = function (a) {
                    var b, c, e, f, g = null, h = [], i = {}, j = a.which, k = "p";
                    w[j] = k;
                    for (b in w) w.hasOwnProperty(b) && w[b] === k && (h.push(b), parseInt(b, 10) !== j && (i[b] = ! 0));
                    for (b in d.keyBinds) if (d.keyBinds.hasOwnProperty(b) && "function" == typeof d.keyBinds[b] && (e = b.split(" "), e.length === h.length && v[j] === e[e.length - 1])) {
                        for (f = ! 0, c = e.length - 2; c >= 0; c--) if ( ! (v[e[c]] in i)) {
                            f = ! 1;
                            break;
                        }
                        if (f) {
                            g = d.keyBinds[b];
                            break;
                        }
                    }
                    g && (g.call(l, o), a.stopPropagation(), a.preventDefault());
                }, ja = function (a) {
                    w[a.which] = "r", a.stopPropagation(), a.preventDefault();
                }, ka = function (b) {
                    var c = a(b.target).val().trim(), d = c ? da(c) : null;
                    return aa(d), b.stopImmediatePropagation(), ! 1;
                }, la = function () {
                    g.on({
                        change: ka,
                        blur: d.debug ? "" : ba,
                        keydown: ia,
                        keyup: ja,
                        focus: d.allowInputToggle ? ga : ""
                    }), c.is("input") ? g.on({ focus: ga }) : n && (n.on("click", ha), n.on("mousedown", ! 1));
                }, ma = function () {
                    g.off({
                        change: ka,
                        blur: blur,
                        keydown: ia,
                        keyup: ja,
                        focus: d.allowInputToggle ? ba : ""
                    }), c.is("input") ? g.off({ focus: ga }) : n && (n.off("click", ha), n.off("mousedown", ! 1));
                }, na = function (b) {
                    var c = {};
                    return a.each(b, function () {
                        var a = da(this);
                        a.isValid() && (c[a.format("YYYY-MM-DD")] = ! 0);
                    }), !! Object.keys(c).length && c;
                }, oa = function (b) {
                    var c = {};
                    return a.each(b, function () {
                        c[this] = ! 0;
                    }), !! Object.keys(c).length && c;
                }, pa = function () {
                    var a = d.format || "L LT";
                    i = a.replace(/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, function (a) {
                        var b = e.localeData().longDateFormat(a) || a;
                        return b.replace(/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, function (a) {
                            return e.localeData().longDateFormat(a) || a;
                        });
                    }), j = d.extraFormats ? d.extraFormats.slice() : [], j.indexOf(a) < 0 && j.indexOf(i) < 0 && j.push(i), h = i.toLowerCase().indexOf("a") < 1 && i.replace(/\[.*?\]/g, "").indexOf("h") < 1, z("y") && (p = 2), z("M") && (p = 1), z("d") && (p = 0), k = Math.max(p, k), m || aa(e);
                };
            if (l.destroy = function () {
                ba(), ma(), c.removeData("DateTimePicker"), c.removeData("date");
            }, l.toggle = ha, l.show = ga, l.hide = ba, l.disable = function () {
                return ba(), n && n.hasClass("btn") && n.addClass("disabled"), g.prop("disabled", ! 0), l;
            }, l.enable = function () {
                return n && n.hasClass("btn") && n.removeClass("disabled"), g.prop("disabled", ! 1), l;
            }, l.ignoreReadonly = function (a) {
                if (0 === arguments.length) return d.ignoreReadonly;
                if ("boolean" != typeof a) throw new TypeError("ignoreReadonly () expects a boolean parameter");
                return d.ignoreReadonly = a, l;
            }, l.options = function (b) {
                if (0 === arguments.length) return a.extend( ! 0, {}, d);
                if ( ! (b instanceof Object)) throw new TypeError("options() options parameter should be an object");
                return a.extend( ! 0, d, b), a.each(d, function (a, b) {
                    if (void 0 === l[a]) throw new TypeError("option " + a + " is not recognized!");
                    l[a](b);
                }), l;
            }, l.date = function (a) {
                if (0 === arguments.length) return m ? null : e.clone();
                if ( ! (null === a || "string" == typeof a || b.isMoment(a) || a instanceof Date)) throw new TypeError("date() parameter must be one of [null, string, moment or Date]");
                return aa(null === a ? null : da(a)), l;
            }, l.format = function (a) {
                if (0 === arguments.length) return d.format;
                if ("string" != typeof a && ("boolean" != typeof a || a !== ! 1)) throw new TypeError("format() expects a string or boolean:false parameter " + a);
                return d.format = a, i && pa(), l;
            }, l.timeZone = function (a) {
                if (0 === arguments.length) return d.timeZone;
                if ("string" != typeof a) throw new TypeError("newZone() expects a string parameter");
                return d.timeZone = a, l;
            }, l.dayViewHeaderFormat = function (a) {
                if (0 === arguments.length) return d.dayViewHeaderFormat;
                if ("string" != typeof a) throw new TypeError("dayViewHeaderFormat() expects a string parameter");
                return d.dayViewHeaderFormat = a, l;
            }, l.extraFormats = function (a) {
                if (0 === arguments.length) return d.extraFormats;
                if (a !== ! 1 && ! (a instanceof Array)) throw new TypeError("extraFormats() expects an array or false parameter");
                return d.extraFormats = a, j && pa(), l;
            }, l.disabledDates = function (b) {
                if (0 === arguments.length) return d.disabledDates ? a.extend({}, d.disabledDates) : d.disabledDates;
                if ( ! b) return d.disabledDates = ! 1, _(), l;
                if ( ! (b instanceof Array)) throw new TypeError("disabledDates() expects an array parameter");
                return d.disabledDates = na(b), d.enabledDates = ! 1, _(), l;
            }, l.enabledDates = function (b) {
                if (0 === arguments.length) return d.enabledDates ? a.extend({}, d.enabledDates) : d.enabledDates;
                if ( ! b) return d.enabledDates = ! 1, _(), l;
                if ( ! (b instanceof Array)) throw new TypeError("enabledDates() expects an array parameter");
                return d.enabledDates = na(b), d.disabledDates = ! 1, _(), l;
            }, l.daysOfWeekDisabled = function (a) {
                if (0 === arguments.length) return d.daysOfWeekDisabled.splice(0);
                if ("boolean" == typeof a && ! a) return d.daysOfWeekDisabled = ! 1, _(), l;
                if ( ! (a instanceof Array)) throw new TypeError("daysOfWeekDisabled() expects an array parameter");
                if (d.daysOfWeekDisabled = a.reduce(function (a, b) {
                    return b = parseInt(b, 10), b > 6 || b < 0 || isNaN(b) ? a : (a.indexOf(b) === -1 && a.push(b), a);
                }, []).sort(), d.useCurrent && ! d.keepInvalid) {
                    for (var b = 0; ! R(e, "d");) {
                        if (e.add(1, "d"), 31 === b) throw "Tried 31 times to find a valid date";
                        b++;
                    }
                    aa(e);
                }
                return _(), l;
            }, l.maxDate = function (a) {
                if (0 === arguments.length) return d.maxDate ? d.maxDate.clone() : d.maxDate;
                if ("boolean" == typeof a && a === ! 1) return d.maxDate = ! 1, _(), l;
                "string" == typeof a && ("now" !== a && "moment" !== a || (a = y()));
                var b = da(a);
                if ( ! b.isValid()) throw new TypeError("maxDate() Could not parse date parameter: " + a);
                if (d.minDate && b.isBefore(d.minDate)) throw new TypeError("maxDate() date parameter is before options.minDate: " + b.format(i));
                return d.maxDate = b, d.useCurrent && ! d.keepInvalid && e.isAfter(a) && aa(d.maxDate), f.isAfter(b) && (f = b.clone().subtract(d.stepping, "m")), _(), l;
            }, l.minDate = function (a) {
                if (0 === arguments.length) return d.minDate ? d.minDate.clone() : d.minDate;
                if ("boolean" == typeof a && a === ! 1) return d.minDate = ! 1, _(), l;
                "string" == typeof a && ("now" !== a && "moment" !== a || (a = y()));
                var b = da(a);
                if ( ! b.isValid()) throw new TypeError("minDate() Could not parse date parameter: " + a);
                if (d.maxDate && b.isAfter(d.maxDate)) throw new TypeError("minDate() date parameter is after options.maxDate: " + b.format(i));
                return d.minDate = b, d.useCurrent && ! d.keepInvalid && e.isBefore(a) && aa(d.minDate), f.isBefore(b) && (f = b.clone().add(d.stepping, "m")), _(), l;
            }, l.defaultDate = function (a) {
                if (0 === arguments.length) return d.defaultDate ? d.defaultDate.clone() : d.defaultDate;
                if ( ! a) return d.defaultDate = ! 1, l;
                "string" == typeof a && (a = "now" === a || "moment" === a ? y() : y(a));
                var b = da(a);
                if ( ! b.isValid()) throw new TypeError("defaultDate() Could not parse date parameter: " + a);
                if ( ! R(b)) throw new TypeError("defaultDate() date passed is invalid according to component setup validations");
                return d.defaultDate = b, (d.defaultDate && d.inline || "" === g.val().trim()) && aa(d.defaultDate), l;
            }, l.locale = function (a) {
                if (0 === arguments.length) return d.locale;
                if ( ! b.localeData(a)) throw new TypeError("locale() locale " + a + " is not loaded from moment locales!");
                return d.locale = a, e.locale(d.locale), f.locale(d.locale), i && pa(), o && (ba(), ga()), l;
            }, l.stepping = function (a) {
                return 0 === arguments.length ? d.stepping : (a = parseInt(a, 10), (isNaN(a) || a < 1) && (a = 1), d.stepping = a, l);
            }, l.useCurrent = function (a) {
                var b = ["year", "month", "day", "hour", "minute"];
                if (0 === arguments.length) return d.useCurrent;
                if ("boolean" != typeof a && "string" != typeof a) throw new TypeError("useCurrent() expects a boolean or string parameter");
                if ("string" == typeof a && b.indexOf(a.toLowerCase()) === -1) throw new TypeError("useCurrent() expects a string parameter of " + b.join(", "));
                return d.useCurrent = a, l;
            }, l.collapse = function (a) {
                if (0 === arguments.length) return d.collapse;
                if ("boolean" != typeof a) throw new TypeError("collapse() expects a boolean parameter");
                return d.collapse === a ? l : (d.collapse = a, o && (ba(), ga()), l);
            }, l.icons = function (b) {
                if (0 === arguments.length) return a.extend({}, d.icons);
                if ( ! (b instanceof Object)) throw new TypeError("icons() expects parameter to be an Object");
                return a.extend(d.icons, b), o && (ba(), ga()), l;
            }, l.tooltips = function (b) {
                if (0 === arguments.length) return a.extend({}, d.tooltips);
                if ( ! (b instanceof Object)) throw new TypeError("tooltips() expects parameter to be an Object");
                return a.extend(d.tooltips, b), o && (ba(), ga()), l;
            }, l.useStrict = function (a) {
                if (0 === arguments.length) return d.useStrict;
                if ("boolean" != typeof a) throw new TypeError("useStrict() expects a boolean parameter");
                return d.useStrict = a, l;
            }, l.sideBySide = function (a) {
                if (0 === arguments.length) return d.sideBySide;
                if ("boolean" != typeof a) throw new TypeError("sideBySide() expects a boolean parameter");
                return d.sideBySide = a, o && (ba(), ga()), l;
            }, l.viewMode = function (a) {
                if (0 === arguments.length) return d.viewMode;
                if ("string" != typeof a) throw new TypeError("viewMode() expects a string parameter");
                if (r.indexOf(a) === -1) throw new TypeError("viewMode() parameter must be one of (" + r.join(", ") + ") value");
                return d.viewMode = a, k = Math.max(r.indexOf(a), p), L(), l;
            }, l.toolbarPlacement = function (a) {
                if (0 === arguments.length) return d.toolbarPlacement;
                if ("string" != typeof a) throw new TypeError("toolbarPlacement() expects a string parameter");
                if (u.indexOf(a) === -1) throw new TypeError("toolbarPlacement() parameter must be one of (" + u.join(", ") + ") value");
                return d.toolbarPlacement = a, o && (ba(), ga()), l;
            }, l.widgetPositioning = function (b) {
                if (0 === arguments.length) return a.extend({}, d.widgetPositioning);
                if ("[object Object]" !== {}.toString.call(b)) throw new TypeError("widgetPositioning() expects an object variable");
                if (b.horizontal) {
                    if ("string" != typeof b.horizontal) throw new TypeError("widgetPositioning() horizontal variable must be a string");
                    if (b.horizontal = b.horizontal.toLowerCase(), t.indexOf(b.horizontal) === -1) throw new TypeError("widgetPositioning() expects horizontal parameter to be one of (" + t.join(", ") + ")");
                    d.widgetPositioning.horizontal = b.horizontal;
                }
                if (b.vertical) {
                    if ("string" != typeof b.vertical) throw new TypeError("widgetPositioning() vertical variable must be a string");
                    if (b.vertical = b.vertical.toLowerCase(), s.indexOf(b.vertical) === -1) throw new TypeError("widgetPositioning() expects vertical parameter to be one of (" + s.join(", ") + ")");
                    d.widgetPositioning.vertical = b.vertical;
                }
                return _(), l;
            }, l.calendarWeeks = function (a) {
                if (0 === arguments.length) return d.calendarWeeks;
                if ("boolean" != typeof a) throw new TypeError("calendarWeeks() expects parameter to be a boolean value");
                return d.calendarWeeks = a, _(), l;
            }, l.showTodayButton = function (a) {
                if (0 === arguments.length) return d.showTodayButton;
                if ("boolean" != typeof a) throw new TypeError("showTodayButton() expects a boolean parameter");
                return d.showTodayButton = a, o && (ba(), ga()), l;
            }, l.showClear = function (a) {
                if (0 === arguments.length) return d.showClear;
                if ("boolean" != typeof a) throw new TypeError("showClear() expects a boolean parameter");
                return d.showClear = a, o && (ba(), ga()), l;
            }, l.widgetParent = function (b) {
                if (0 === arguments.length) return d.widgetParent;
                if ("string" == typeof b && (b = a(b)), null !== b && "string" != typeof b && ! (b instanceof a)) throw new TypeError("widgetParent() expects a string or a jQuery object parameter");
                return d.widgetParent = b, o && (ba(), ga()), l;
            }, l.keepOpen = function (a) {
                if (0 === arguments.length) return d.keepOpen;
                if ("boolean" != typeof a) throw new TypeError("keepOpen() expects a boolean parameter");
                return d.keepOpen = a, l;
            }, l.focusOnShow = function (a) {
                if (0 === arguments.length) return d.focusOnShow;
                if ("boolean" != typeof a) throw new TypeError("focusOnShow() expects a boolean parameter");
                return d.focusOnShow = a, l;
            }, l.inline = function (a) {
                if (0 === arguments.length) return d.inline;
                if ("boolean" != typeof a) throw new TypeError("inline() expects a boolean parameter");
                return d.inline = a, l;
            }, l.clear = function () {
                return ca(), l;
            }, l.keyBinds = function (a) {
                return 0 === arguments.length ? d.keyBinds : (d.keyBinds = a, l);
            }, l.getMoment = function (a) {
                return y(a);
            }, l.debug = function (a) {
                if ("boolean" != typeof a) throw new TypeError("debug() expects a boolean parameter");
                return d.debug = a, l;
            }, l.allowInputToggle = function (a) {
                if (0 === arguments.length) return d.allowInputToggle;
                if ("boolean" != typeof a) throw new TypeError("allowInputToggle() expects a boolean parameter");
                return d.allowInputToggle = a, l;
            }, l.showClose = function (a) {
                if (0 === arguments.length) return d.showClose;
                if ("boolean" != typeof a) throw new TypeError("showClose() expects a boolean parameter");
                return d.showClose = a, l;
            }, l.keepInvalid = function (a) {
                if (0 === arguments.length) return d.keepInvalid;
                if ("boolean" != typeof a) throw new TypeError("keepInvalid() expects a boolean parameter");
                return d.keepInvalid = a, l;
            }, l.datepickerInput = function (a) {
                if (0 === arguments.length) return d.datepickerInput;
                if ("string" != typeof a) throw new TypeError("datepickerInput() expects a string parameter");
                return d.datepickerInput = a, l;
            }, l.parseInputDate = function (a) {
                if (0 === arguments.length) return d.parseInputDate;
                if ("function" != typeof a) throw new TypeError("parseInputDate() sholud be as function");
                return d.parseInputDate = a, l;
            }, l.disabledTimeIntervals = function (b) {
                if (0 === arguments.length) return d.disabledTimeIntervals ? a.extend({}, d.disabledTimeIntervals) : d.disabledTimeIntervals;
                if ( ! b) return d.disabledTimeIntervals = ! 1, _(), l;
                if ( ! (b instanceof Array)) throw new TypeError("disabledTimeIntervals() expects an array parameter");
                return d.disabledTimeIntervals = b, _(), l;
            }, l.disabledHours = function (b) {
                if (0 === arguments.length) return d.disabledHours ? a.extend({}, d.disabledHours) : d.disabledHours;
                if ( ! b) return d.disabledHours = ! 1, _(), l;
                if ( ! (b instanceof Array)) throw new TypeError("disabledHours() expects an array parameter");
                if (d.disabledHours = oa(b), d.enabledHours = ! 1, d.useCurrent && ! d.keepInvalid) {
                    for (var c = 0; ! R(e, "h");) {
                        if (e.add(1, "h"), 24 === c) throw "Tried 24 times to find a valid date";
                        c++;
                    }
                    aa(e);
                }
                return _(), l;
            }, l.enabledHours = function (b) {
                if (0 === arguments.length) return d.enabledHours ? a.extend({}, d.enabledHours) : d.enabledHours;
                if ( ! b) return d.enabledHours = ! 1, _(), l;
                if ( ! (b instanceof Array)) throw new TypeError("enabledHours() expects an array parameter");
                if (d.enabledHours = oa(b), d.disabledHours = ! 1, d.useCurrent && ! d.keepInvalid) {
                    for (var c = 0; ! R(e, "h");) {
                        if (e.add(1, "h"), 24 === c) throw "Tried 24 times to find a valid date";
                        c++;
                    }
                    aa(e);
                }
                return _(), l;
            }, l.viewDate = function (a) {
                if (0 === arguments.length) return f.clone();
                if ( ! a) return f = e.clone(), l;
                if ( ! ("string" == typeof a || b.isMoment(a) || a instanceof Date)) throw new TypeError("viewDate() parameter must be one of [string, moment or Date]");
                return f = da(a), K(), l;
            }, c.is("input")) g = c; else if (g = c.find(d.datepickerInput), 0 === g.length) g = c.find("input"); else if ( ! g.is("input")) throw new Error('CSS class "' + d.datepickerInput + '" cannot be applied to non input element');
            if (c.hasClass("input-group") && (n = 0 === c.find(".datepickerbutton").length ? c.find(".input-group-addon") : c.find(".datepickerbutton")), ! d.inline && ! g.is("input")) throw new Error("Could not initialize DateTimePicker without an input element");
            return e = y(), f = e.clone(), a.extend( ! 0, d, H()), l.options(d), pa(), la(), g.prop("disabled") && l.disable(), g.is("input") && 0 !== g.val().trim().length ? aa(da(g.val().trim())) : d.defaultDate && void 0 === g.attr("placeholder") && aa(d.defaultDate), d.inline && ga(), l;
        };
        return a.fn.datetimepicker = function (b) {
            b = b || {};
            var d, e = Array.prototype.slice.call(arguments, 1), f = ! 0, g = ["destroy", "hide", "show", "toggle"];
            if ("object" == typeof b) return this.each(function () {
                var d, e = a(this);
                e.data("DateTimePicker") || (d = a.extend( ! 0, {}, a.fn.datetimepicker.defaults, b), e.data("DateTimePicker", c(e, d)));
            });
            if ("string" == typeof b) return this.each(function () {
                var c = a(this), g = c.data("DateTimePicker");
                if ( ! g) throw new Error('bootstrap-datetimepicker("' + b + '") method was called on an element that is not using DateTimePicker');
                d = g[b].apply(g, e), f = d === g;
            }), f || a.inArray(b, g) > -1 ? this : d;
            throw new TypeError("Invalid arguments for DateTimePicker: " + b);
        }, a.fn.datetimepicker.defaults = {
            timeZone: "",
            format: ! 1,
            dayViewHeaderFormat: "MMMM YYYY",
            extraFormats: ! 1,
            stepping: 1,
            minDate: ! 1,
            maxDate: ! 1,
            useCurrent: ! 0,
            collapse: ! 0,
            locale: b.locale(),
            defaultDate: ! 1,
            disabledDates: ! 1,
            enabledDates: ! 1,
            icons: {
                time: "glyphicon glyphicon-time",
                date: "glyphicon glyphicon-calendar",
                up: "glyphicon glyphicon-chevron-up",
                down: "glyphicon glyphicon-chevron-down",
                previous: "glyphicon glyphicon-chevron-left",
                next: "glyphicon glyphicon-chevron-right",
                today: "glyphicon glyphicon-screenshot",
                clear: "glyphicon glyphicon-trash",
                close: "glyphicon glyphicon-remove"
            },
            tooltips: {
                today: "Go to today",
                clear: "Clear selection",
                close: "Close the picker",
                selectMonth: "Select Month",
                prevMonth: "Previous Month",
                nextMonth: "Next Month",
                selectYear: "Select Year",
                prevYear: "Previous Year",
                nextYear: "Next Year",
                selectDecade: "Select Decade",
                prevDecade: "Previous Decade",
                nextDecade: "Next Decade",
                prevCentury: "Previous Century",
                nextCentury: "Next Century",
                pickHour: "Pick Hour",
                incrementHour: "Increment Hour",
                decrementHour: "Decrement Hour",
                pickMinute: "Pick Minute",
                incrementMinute: "Increment Minute",
                decrementMinute: "Decrement Minute",
                pickSecond: "Pick Second",
                incrementSecond: "Increment Second",
                decrementSecond: "Decrement Second",
                togglePeriod: "Toggle Period",
                selectTime: "Select Time"
            },
            useStrict: ! 1,
            sideBySide: ! 1,
            daysOfWeekDisabled: ! 1,
            calendarWeeks: ! 1,
            viewMode: "days",
            toolbarPlacement: "default",
            showTodayButton: ! 1,
            showClear: ! 1,
            showClose: ! 1,
            widgetPositioning: { horizontal: "auto", vertical: "auto" },
            widgetParent: null,
            ignoreReadonly: ! 1,
            keepOpen: ! 1,
            focusOnShow: ! 0,
            inline: ! 1,
            keepInvalid: ! 1,
            datepickerInput: ".datepickerinput",
            keyBinds: {
                up: function (a) {
                    if (a) {
                        var b = this.date() || this.getMoment();
                        a.find(".datepicker").is(":visible") ? this.date(b.clone().subtract(7, "d")) : this.date(b.clone().add(this.stepping(), "m"));
                    }
                }, down: function (a) {
                    if ( ! a) return void this.show();
                    var b = this.date() || this.getMoment();
                    a.find(".datepicker").is(":visible") ? this.date(b.clone().add(7, "d")) : this.date(b.clone().subtract(this.stepping(), "m"));
                }, "control up": function (a) {
                    if (a) {
                        var b = this.date() || this.getMoment();
                        a.find(".datepicker").is(":visible") ? this.date(b.clone().subtract(1, "y")) : this.date(b.clone().add(1, "h"));
                    }
                }, "control down": function (a) {
                    if (a) {
                        var b = this.date() || this.getMoment();
                        a.find(".datepicker").is(":visible") ? this.date(b.clone().add(1, "y")) : this.date(b.clone().subtract(1, "h"));
                    }
                }, left: function (a) {
                    if (a) {
                        var b = this.date() || this.getMoment();
                        a.find(".datepicker").is(":visible") && this.date(b.clone().subtract(1, "d"));
                    }
                }, right: function (a) {
                    if (a) {
                        var b = this.date() || this.getMoment();
                        a.find(".datepicker").is(":visible") && this.date(b.clone().add(1, "d"));
                    }
                }, pageUp: function (a) {
                    if (a) {
                        var b = this.date() || this.getMoment();
                        a.find(".datepicker").is(":visible") && this.date(b.clone().subtract(1, "M"));
                    }
                }, pageDown: function (a) {
                    if (a) {
                        var b = this.date() || this.getMoment();
                        a.find(".datepicker").is(":visible") && this.date(b.clone().add(1, "M"));
                    }
                }, enter: function () {
                    this.hide();
                }, escape: function () {
                    this.hide();
                }, "control space": function (a) {
                    a && a.find(".timepicker").is(":visible") && a.find('.btn[data-action="togglePeriod"]').click();
                }, t: function () {
                    this.date(this.getMoment());
                }, delete: function () {
                    this.clear();
                }
            },
            debug: ! 1,
            allowInputToggle: ! 1,
            disabledTimeIntervals: ! 1,
            disabledHours: ! 1,
            enabledHours: ! 1,
            viewDate: ! 1
        }, a.fn.datetimepicker;
    });
});

if (typeof window.tg === 'undefined') {
    window.tg = function(textcode) {
        return document.getElementById(`ed_wp_${textcode}`)?.innerText?.trim();
    };
}