/* Minification failed. Returning unminified contents.
(5352,11-12): run-time error JS1010: Expected identifier: .
(5352,11-12): run-time error JS1195: Expected expression: .
(5916,15-16): run-time error JS1010: Expected identifier: .
(5916,15-16): run-time error JS1195: Expected expression: .
(8533,3-4): run-time error JS1009: Expected '}': [
(8533,30): run-time error JS1004: Expected ';'
(8533,30-31): run-time error JS1195: Expected expression: :
(8534,1-2): run-time error JS1002: Syntax error: }
(8707,7-10): run-time error JS1009: Expected '}': ...
(8707,7-10): run-time error JS1009: Expected '}': ...
(8707,7-10): run-time error JS1006: Expected ')': ...
(8693,11): run-time error JS1004: Expected ';'
(8708,6-7): run-time error JS1195: Expected expression: ,
(8709,23-24): run-time error JS1010: Expected identifier: (
(8722,3-4): run-time error JS1002: Syntax error: }
(8722,4-5): run-time error JS1195: Expected expression: )
(8723,1-2): run-time error JS1002: Syntax error: }
(8747,9-12): run-time error JS1009: Expected '}': ...
(8747,9-12): run-time error JS1009: Expected '}': ...
(8747,9-12): run-time error JS1006: Expected ')': ...
(8732,13): run-time error JS1004: Expected ';'
(8748,8-9): run-time error JS1195: Expected expression: ,
(8749,25-26): run-time error JS1010: Expected identifier: (
(8758,6-7): run-time error JS1195: Expected expression: )
(8759,3-4): run-time error JS1002: Syntax error: }
(8761,1-2): run-time error JS1002: Syntax error: }
(8785,9-12): run-time error JS1009: Expected '}': ...
(8785,9-12): run-time error JS1009: Expected '}': ...
(8785,9-12): run-time error JS1006: Expected ')': ...
(8770,13): run-time error JS1004: Expected ';'
(8786,8-9): run-time error JS1195: Expected expression: ,
(8787,25-26): run-time error JS1010: Expected identifier: (
(8803,6-7): run-time error JS1195: Expected expression: )
(8804,3-4): run-time error JS1002: Syntax error: }
(8806,1-2): run-time error JS1002: Syntax error: }
(8821,7-10): run-time error JS1009: Expected '}': ...
(8821,7-10): run-time error JS1009: Expected '}': ...
(8821,7-10): run-time error JS1006: Expected ')': ...
(8808,11): run-time error JS1004: Expected ';'
(8822,6-7): run-time error JS1195: Expected expression: ,
(8823,23-24): run-time error JS1010: Expected identifier: (
(8833,3-4): run-time error JS1002: Syntax error: }
(8833,4-5): run-time error JS1195: Expected expression: )
(8834,1-2): run-time error JS1002: Syntax error: }
(9004,7-10): run-time error JS1009: Expected '}': ...
(9004,7-10): run-time error JS1009: Expected '}': ...
(9004,7-10): run-time error JS1006: Expected ')': ...
(8990,11): run-time error JS1004: Expected ';'
(9005,6-7): run-time error JS1195: Expected expression: ,
(9006,23-24): run-time error JS1010: Expected identifier: (
(9019,3-4): run-time error JS1002: Syntax error: }
(9019,4-5): run-time error JS1195: Expected expression: )
(9021,1-2): run-time error JS1002: Syntax error: }
(9060,7-10): run-time error JS1009: Expected '}': ...
(9060,7-10): run-time error JS1009: Expected '}': ...
(9060,7-10): run-time error JS1006: Expected ')': ...
(9046,11): run-time error JS1004: Expected ';'
(9061,6-7): run-time error JS1195: Expected expression: ,
(9062,23-24): run-time error JS1010: Expected identifier: (
(9071,3-4): run-time error JS1002: Syntax error: }
(9071,4-5): run-time error JS1195: Expected expression: )
(9073,1-2): run-time error JS1002: Syntax error: }
(9072,3-15): run-time error JS1018: 'return' statement outside of function: return false
(9020,3-15): run-time error JS1018: 'return' statement outside of function: return false
(8805,3-15): run-time error JS1018: 'return' statement outside of function: return false
(8760,3-15): run-time error JS1018: 'return' statement outside of function: return false
 */
//___________________________________________Variablendeklarationsbereich______________________________________

// ############# Initialisierung Autocomplete mit Suggest #############
const bosuggest = new function () {/* empty */}();
window.cachedLengths = [];
// Lokaler Cache für gelöschte Einträge, um Darstellungsprobleme zu umgehen, wenn der Eintrag Solr-seitig mit einigen Sekunden Verz�gerung gel�scht wird
// NB. Der Cache wird nie geleert, die Annahme ist, dass pro Fenster immer nur einige Eintr�ge gel�scht werden
window.deletedItems = {};
let isSuggestHistoryDeleted = false;
//_____________________________________________Allgemeine Funktionen____________________________________________
//____________________________________________Benutzerspezifische Funktionen_____________________________________
bosuggest.init = function (options) {
  let isOpen = false;
  const settings = $.extend({
    control: null,
    query: null,
    minlen: autocompleteHandler.getSuggestionInputMinLen(),
    multivalues: false,
    allowfocus: false,
    highlighting: true,
    width: null,
    onselect: function (selectedValue) {
      this.control.val(selectedValue).change();
    },
    onkeyup: function () {
      return true;
    },
    onkeydown: function () {
      return true;
    },
    onenter: function () {
      if (isOpen) this.control.autocomplete("close");else this.control.closest("form").submit();
    }
  }, options);
  const formatSuggestion = function (item) {
    const spellingInfo = autocompleteHandler.getSpellingInfo();
    if (jQuery.isEmptyObject(spellingInfo)) {
      return item.label;
    }
    const id = item.id;
    const lengths = spellingInfo.values[id].lengths;
    //console.log("lengths for " + id + ":" + lengths);
    const prefix = "<span class='suggesthighlight'>";
    const suffix = "</span>";
    const indexesToHighlight = 1;
    let ret = "";
    let start = 0;
    for (let j = 0; j < lengths.length; j++) {
      const len = lengths[j];
      const label = item.label.substring(start, start + len);
      // console.log("substring: " + label);
      if (j % 2 == indexesToHighlight) {
        ret += prefix + label + suffix;
      } else {
        ret += label;
      }
      start += len;
    }
    return ret;
  };
  settings.control.autocomplete({
    source: function (request, response) {
      const startTime = new Date().getTime();
      autocompleteHandler.setSpellingInfo(new Object());
      // Sonderfall: Suggest in Detailsuche erst ab Länge 1 aktivieren
      if (request.term.length < 1 && settings.query !== "std") {
        response([]);
        return;
      }
      $.getJSON("/Suggest/", {
        typ: settings.query,
        term: settings.multivalues ? extractLast(request.term) : request.term
      }, function (data) {
        autocompleteHandler.setSuggestionCount(autocompleteHandler.getSuggestionCount() + 1);
        const endTime = new Date().getTime();
        const timediff = endTime - startTime;
        if (timediff > autocompleteHandler.getSuggestionMaxLatency()) {
          autocompleteHandler.setSuggestionMaxLatency(timediff);
        }
        if (timediff < autocompleteHandler.getSuggestionMinLatency()) {
          autocompleteHandler.setSuggestionMinLatency(timediff);
        }
        autocompleteHandler.setSuggestionTotalLatency(autocompleteHandler.getSuggestionTotalLatency() + timediff);
        autocompleteHandler.setSpellingInfo(data.SpellingInfo);
        updateSpellingIndicator(null);
        const array = [];
        $.each(data.values, function (index, d) {
          if (!window.deletedItems[d.label]) array.push(d);
        });
        autocompleteHandler.setSuggestionId(data.id);
        response(array);
      });
    },
    minLength: settings.minlen,
    focus: function (event, ui) {
      const e = event || window.event;
      if (e && (e.keyCode == 38 || e.keyCode == 40 || e.keyCode == 13)) {
        // up/down/enter
        clearSpellingIndicator();
      }
      if (!settings.allowfocus) return null;
      let replaceValue = true;
      if (settings.multivalues) {
        replaceValue = false;
        const origTerm = this.value;
        let val = ui.item.value;

        // For these widgets we want to append the selected value to the existing ones
        // remove the last typed word
        const terms = removeLast(origTerm);
        // add the selected item
        terms.push(val);
        val = terms.join(", ");
        settings.control.val(val);
      } else {
        settings.control.val(ui.item.value);
      }
      return replaceValue;
    },
    select: function (event, ui) {
      if (isSuggestHistoryDeleted || ui.item.id === -1) {
        return false;
      }
      clearSpellingIndicator();
      const origTerm = this.value;
      let action = "Vorschlagsliste";
      const suggestsHistory = document.getElementsByClassName("suggesthistory");
      const suggestsGeneral = document.getElementsByClassName("suggestgeneral");
      let name = '"' + origTerm + '"' + ',' + suggestsToString(suggestsHistory) + ',' + suggestsToString(suggestsGeneral);
      trackSuggest(action, name);
      const searchid = ui.item.searchid;
      if (searchid === "") action = "Allgemeiner Vorschlag";else action = "Persönlicher Vorschlag";
      name = ui.item.label;
      trackSuggest(action, name);
      if (event && event.keyCode === 13) {
        // BOE-2331: Bei Enter-Taste nicht den Mouseover-Suggest verwenden
        document.forms["form1"].submit();
        return false;
      }
      const trackingString = "" + autocompleteHandler.getSuggestionCount() + "-" + autocompleteHandler.getSuggestionMaxLatency() + "-" + autocompleteHandler.getSuggestionMinLatency() + "-" + Math.round(autocompleteHandler.getSuggestionTotalLatency() / autocompleteHandler.getSuggestionCount()) + "-" + autocompleteHandler.getSuggestionId() + "-" + ui.item.id + "-" + settings.query + "-" + origTerm;
      document.forms["form1"].searchid.value = ui.item.searchid;
      document.forms["form1"].st.value = trackingString;
      autocompleteHandler.setSuggestionCount(0);
      autocompleteHandler.setSuggestionTotalLatency(0);
      autocompleteHandler.setSuggestionMaxLatency(0);
      autocompleteHandler.setSuggestionMinLatency(Number.MAX_VALUE);
      let val = ui.item.value;

      // redirect to search for searchid
      if (searchid !== "") {
        settings.onselect(val);
        window.location.href = "/LetzteSuchen/ExecuteSuche?searchId=" + ui.item.searchid;
        return false;
      }
      if (settings.multivalues) {
        // For these widgets we want to append the selected value to the existing ones,
        // adding commas between and at the end
        // remove the last typed word
        const terms = removeLast(this.value);
        // add the selected item
        terms.push(ui.item.value);
        // add empty element to get the comma-and-space at the end
        terms.push("");
        val = terms.join(", ");
      }
      settings.onselect(val);
      return false;
    },
    open: function () {
      isOpen = true;
      if (resizeSearchSuggest) {
        resizeSearchSuggest();
      }
    },
    close: function () {
      document.forms["form1"].searchid.value = "";
      window.cachedLengths = [];
      isOpen = false;
    }
  }).keydown(function (event) {
    settings.onkeydown(event);
  }).keyup(function (event) {
    settings.onkeyup(event);
    if (event.keyCode === 13) {
      settings.onenter();
    }
  }).focus(function () {
    $(this).autocomplete("search", $(this).val());
  });
  const uiAutocomplete = settings.control.data("uiAutocomplete");
  if (uiAutocomplete) {
    if (settings.highlighting) {
      uiAutocomplete._renderItem = function (ul, item) {
        if (item.id < 0) {
          return addPersonalSearchHistoryHint(item).appendTo(ul);
        }
        const formattedLabel = formatSuggestion(item);
        const li = $("<li>");
        const div = $("<div>");
        if (item.searchid != "") {
          buildSuggestHistoryDiv(div, formattedLabel, item);
        } else {
          div.addClass("suggestgeneral");
          div.append(formattedLabel);
        }
        li.append(div);
        return li.appendTo(ul);
      };
    }
    if (settings.width) {
      uiAutocomplete._resizeMenu = function () {
        this.menu.element.outerWidth(settings.width);
      };
    }
    uiAutocomplete.close = function (e) {
      if (isSuggestHistoryDeleted) {
        isSuggestHistoryDeleted = false;
        return false;
      }
      isOpen = false;
      clearTimeout(this.closing), this.menu.element.is(":visible") && (this.menu.blur(), this.menu.element.hide(), this._trigger("close", e));
      return true;
    };
  }
};
function addPersonalSearchHistoryHint(item) {
  const li = $("<li>");
  const div = $("<div>");
  div.addClass("suggesthistory");
  div.attr("id", "suggest_pers_searchhist_hint");
  const checkIcon = $("<i class='icon icon-check-empty'>");
  const deleteIcon = $("<i class='icon icon-cancel'>");
  const infoIcon = $("<i class='icon icon-info-circled'>");
  checkIcon.attr("onClick", "activatePersonalSearchhistory(); return false;");
  infoIcon.attr("title", item.label);
  deleteIcon.attr("id", "suggest_pers_searchhist_hint_icon");
  deleteIcon.attr("title", "Hinweis dauerhaft entfernen");
  deleteIcon.attr("onClick", "hidePersonalSearchHistoryHint(); return false;");
  const divLabel = $("<div>");
  divLabel.addClass("suggesthistorylabel");
  divLabel.append(item.value);
  divLabel.attr("onClick", "activatePersonalSearchhistory(); return false;");
  divLabel.append(infoIcon);
  div.append(checkIcon);
  div.append(divLabel);
  div.append(deleteIcon);
  return li.append(div);
}
function buildSuggestHistoryDiv(div, label, item) {
  div.addClass("suggesthistory");
  div.attr("id", "suggest_" + item.searchid);
  const clockIcon = $("<i class='icon icon-clock-regular'>");
  const deleteIcon = $("<i class='icon icon-cancel'>");
  deleteIcon.attr("id", "suggest_icon_" + item.searchid);
  deleteIcon.attr("onClick", "deleteSuggestHistory('" + item.searchid + "', '" + item.label + "')");
  const divLabel = $("<div>");
  divLabel.addClass("suggesthistorylabel");
  divLabel.append(label);
  div.append(clockIcon);
  div.append(divLabel);
  div.append(deleteIcon);
}
function split(val) {
  return val.split(/,\s*/);
}
function extractLast(term) {
  const elements = split(term);
  for (let i = elements.length - 1; i >= 0; --i) if (elements[i].length) return elements[i];
  return "";
}
function removeLast(term) {
  const terms = split(term);
  const nonEmpty = [];
  for (let i = 0; i < terms.length; ++i) if (terms[i].length) nonEmpty.push(terms[i]);
  nonEmpty.pop();
  return nonEmpty;
}
function addChildren(parentId, string, lengths) {
  const parent = document.getElementById(parentId);
  if (jQuery.isEmptyObject(parent)) {
    return;
  }
  // remove current children
  $("#" + parentId).empty();
  let offset = 0;
  for (let i = 0; i < lengths.length; i++) {
    if (lengths[i] == 0) {
      continue;
    }
    const stringChunk = string.substring(offset, offset + lengths[i]);
    // console.log("String at offset " + i + ": |" + stringChunk + "|");
    let node;
    if (i % 2 == 1) {
      node = document.createElement("span");
      node.id = "autocorrect_wrong";
      node.innerHTML = stringChunk;
    } else {
      node = document.createTextNode(stringChunk);
    }
    parent.appendChild(node);
    offset += lengths[i];
  }
}
function clearSpellingIndicator() {
  $("#autocorrect_tmpl").empty();
}
function updateSpellingIndicator(event) {
  const e = event || window.event;
  if (e && (e.keyCode == 38 || e.keyCode == 40 || e.keyCode == 13)) {
    // up/down
    return;
  }
  const $input = $("#words");
  const info = autocompleteHandler.getSpellingInfo();
  const clearSpell = jQuery.isEmptyObject(info) || jQuery.isEmptyObject(info.lengths) || info.lengths.length < 2 || $input.val().length <= autocompleteHandler.getSuggestionInputMinLen() || $input.get(0).clientWidth < $input.textWidth(); // BON-10285: Wenn Text länger als Input, dann wie bei Google keine Spellcheck-Markierung

  if (clearSpell) {
    clearSpellingIndicator();
    window.cachedLengths = [];
    return;
  }
  const lengths = info.lengths;
  // check if lengths changed so the spelling indicator needs updating
  if (window.cachedLengths.toString() != lengths.toString()) {
    addChildren("autocorrect_tmpl", $input.val(), lengths);
    window.cachedLengths = lengths;
  }
  const ac = document.getElementById('autocorrect_wrong');
  if (ac !== null) {
    let textElement = document.getElementById('search_input_text');
    if (textElement === null) {
      textElement = document.createElement('span');
      textElement.id = 'search_input_text';
      textElement.style.position = 'absolute';
      textElement.style.top = '-100px';
      document.body.appendChild(textElement);
    }
    textElement.textContent = ac.textContent;
    ac.style.width = textElement.clientWidth + 'px';
  }
}
const deleteSuggestHistory = function (searchId, searchQuery) {
  isSuggestHistoryDeleted = true;
  window.deletedItems[searchQuery] = true;
  $.ajax({
    type: "POST",
    url: "/LetzteSuchen/DeleteSuggestHistorySuche",
    dataType: "html",
    data: {
      searchQuery: searchQuery
    },
    success: function () {
      $("#suggest_" + searchId).remove();
    },
    error: function () {
      console.error("Error deleting search term '" + searchQuery + "': " + xhr.status + ": " + thrownError);
    }
  });
};
const hidePersonalSearchHistoryHint = function () {
  $.ajax({
    type: "POST",
    url: "/HitlistSettings/DisablePersonalSearchHistoryHint",
    dataType: "html",
    success: function (result) {
      $("#suggest_pers_searchhist_hint").remove();
      trackMatomoEvent(result.Category, result.Action);
    },
    error: function () {
      // console.log("Error on diasbling personal search history");
    }
  });
};
const activatePersonalSearchhistory = function () {
  $.ajax({
    type: "POST",
    url: "/HitlistSettings/ActivatePersonalSearchHistory",
    dataType: "html",
    success: function (result) {
      $("#suggest_pers_searchhist_hint").remove();
      trackMatomoEvent(result.Category, result.Action);
    },
    error: function () {
      // console.log("Error on activating personal search history");
    }
  });
};
function suggestsToString(suggestArray) {
  let suggest = '[';
  for (let i = 0; i < suggestArray.length; i++) {
    if (suggest.length > 1) suggest = suggest + ',';
    suggest = suggest + '"' + suggestArray[i].innerText + '"';
  }
  suggest = suggest + ']';
  return suggest;
}
//# sourceMappingURL=Bo.suggest.js.map
;
//______________________________________Variablen Deklarationsbereich________________________________________

const SMALL_MOBILE_RESOLUTION = 628;
let enableKeyboardShortcuts = true;
let preventClicks = false;
let preventClickTimer;
const previousWidth = $(window).width();
const isSearchCheckboxList = false;
const previousDetailsWidth = 0;
let _spinnerBo = null;
const isNotNull = function (obj) {
  return obj !== null && typeof obj !== 'undefined';
};
const isNull = function (obj) {
  return obj === null || typeof obj === 'undefined';
};
const isNullOrEmpty = function (obj) {
  return isNull(obj) || obj === '';
};
const isNotNullOrEmpty = function (obj) {
  return !isNullOrEmpty(obj);
};

//_________________________________________Allgemeine Funktionen__________________________________________
$(".portalweicheDialogContainer").ready(function () {
  // Click-Event "Schließen"-Button
  $(".headerPortalweicheDialogCLose").on("click", function () {
    _paq.push(['trackEvent', 'Anzeige Portalweiche-Dialog', 'Dialog schießen']);
  });

  // Click-Event "ChangeSite"-Button
  $("#ChangeSite").on("click", function () {
    _paq.push(['trackEvent', 'Anzeige Portalweiche-Dialog', 'jetzt einmal wechseln']);
  });

  // Click-Event "ChangeAllwaysSite"-Button
  $("#ChangeAllwaysSite").on("click", function () {
    _paq.push(['trackEvent', 'Anzeige Portalweiche-Dialog', 'zukuenftigt immer wechseln']);
  });

  // Click-Event "StayAtCurrentSite"-Button
  $("#StayAtCurrentSite").on("click", function () {
    _paq.push(['trackEvent', 'Anzeige Portalweiche-Dialog', 'im Portal bleiben']);
  });

  // Click-Event "diesen Hinweis nicht mehr anzeigen"-Link
  $(".hidePortalweicheDialog").on("click", function () {
    _paq.push(['trackEvent', 'Anzeige Portalweiche-Dialog', 'diesen Hinweis nicht mehr anzeigen']);
  });
});
$(document).on("click", "#FacettenControl a, #keywordcloud a, #topParagraphs a, #hitlist-header a, #hitlist-header input:not(.markall), #btsearch1, #hitlistfilter a", function (e) {
  if (preventClicks) {
    // BON-10068: Doppelklick auf Elemente temporär blocken, um die "nur 1 Suche pro Sekunde"-Fehlermeldung zu vermeiden
    e.preventDefault();

    // Nach kurzer Zeit klicks wieder erlauben, da hauptsächlich versehentliche Doppelklicks verhindert werden sollen
    if (preventClickTimer) clearTimeout(preventClickTimer);
    preventClickTimer = setTimeout(function () {
      preventClicks = false;
    }, 500);
  } else {
    preventClicks = true;
  }
});
$(document).on("click", "a[href^='#']", function (e) {
  // Handle jump when same hash
  if (this.hash === location.hash) {
    handleAbsolutePositionedAnchorLinks();
    e.preventDefault();
  }
});
window.addEventListener("hashchange", handleAbsolutePositionedAnchorLinks, false);
// Jump on page load
window.addEventListener("load", handleAbsolutePositionedAnchorLinks, false);
String.prototype.padLeft = function (paddingValue) {
  return String(paddingValue + this).slice(-paddingValue.length);
};
$(document).ready(function () {
  _spinnerBo = new SpinnerHandler();
  document.addEventListener("keydown", documentKeyDown);
  $("div#detailsuchereiter .checkboxFilter, div.hitlistSearchArea .checkboxFilter").each(function () {
    $(this).toggleClass("nosee");
  });
  document.getElementById("form1").addEventListener("submit", function () {
    const words = document.getElementById("words");
    words.value = words.value.replace(/<|&#/g, '');
  });

  // UTC-Zeit in Zeitzone des Client darstellen
  let lang = $('body').attr('lang');
  if (isNull(lang)) lang = 'de';
  $('[data-utcdate]').each(function () {
    const self = $(this);
    const val = $(this).data('utcdate');
    if (val == '') return;
    const dateonly = $(this).data('dateonly'),
      date = new Date(val);
    let local;
    if (lang == 'de') {
      local = date.getDate().toString().padLeft('00') + '.' + (date.getMonth() + 1).toString().padLeft('00') + '.';
    } else {
      local = (date.getMonth() + 1).toString().padLeft('00') + '/' + date.getDate().toString().padLeft('00') + '/';
    }
    local += date.getFullYear().toString();
    if (!dateonly) {
      local += ' ' + date.getHours().toString().padLeft('00') + ':' + date.getMinutes().toString().padLeft('00');
      if (val.length > 18) local += date.getSeconds().toString().padLeft('00');
    }
    if (self[0].nodeName == 'INPUT') {
      self.val(local);
    } else {
      self.text(local);
    }
  });
  setTimeout(function () {
    initDropdownToggle();
  }, 100);
  $('[data-timezone]').each(function () {
    $(this).val(Intl.DateTimeFormat().resolvedOptions().timeZone);
  });
  $("#zusatzinfo_datum_icon").on({
    click: function () {
      toggleElementDisplay($("#zusatzinfo_datum").toggle());
    },
    keypress: function (event) {
      const e = event || window.event;
      const key = e.keyCode ? e.keyCode : e.which;
      if (key !== 9 && key !== 13) {
        toggleElementDisplay($("#zusatzinfo_datum").toggle());
      } else if (key === 13) {
        event.preventDefault();
      }
    }
  });
  addJSEnabledClass();
  registerHotkeys();
  syncCheckboxesOnBrowserNavigation();
  if (document.addEventListener) {
    document.addEventListener("DOMContentLoaded", init, false);
    const iconsinh6 = $(document).find("h6");
    iconsinh6.removeClass("clickflag");
  }
  const obj = jQuery(".jsShow");
  obj.removeClass('jsShow');
  $(".jsHide").remove();
  $(":input[placeholder]").placeholder();
  $(".mvcWidget ul li a.widget-geschlossen.haschild, div#myFavouriteBox div.clear h1.modUebersicht, div#meineModule div.clear h1.modUebersicht, div.bo_zwischenueberschrift > h6:first-child, #bo_center div.bo_opus p span.moreInfo, #bo_center div.bo_opus p span.lessInfo, .mvcWidget ul li a.widget-offen.haschild, div#verweiszettel-content.content .foldable, div.search-verweiszettel, .svgui a, div.bo_werksgruppierung h6").mouseenter(function () {
    const icon = $("i:first", this);
    if (icon.hasClass("icon-right-open") || icon.hasClass("icon-down-open")) {
      icon.toggleClass("icon-right-open icon-down-open");
    }
  });
  $(".mvcWidget ul li a.widget-geschlossen.haschild, div#myFavouriteBox div.clear h1.modUebersicht, div#meineModule div.clear h1.modUebersicht, div.bo_zwischenueberschrift > h6:first-child, #bo_center div.bo_opus p span.moreInfo, #bo_center div.bo_opus p span.lessInfo, .mvcWidget ul li a.widget-offen.haschild, div#verweiszettel-content.content .foldable, div.search-verweiszettel, .svgui a, div.bo_werksgruppierung h6").mouseleave(function () {
    const icon = $("i:first", this);
    if (icon.hasClass("clickflag")) {
      icon.removeClass("clickflag");
      return;
    }
    if (icon.hasClass("icon-right-open") || icon.hasClass("icon-down-open")) {
      icon.toggleClass("icon-right-open icon-down-open");
    }
  });

  //Färbt die Icons in der Modulübersicht in der Portalfarbe ein, wenn man über den Link fährt (BON-10230)
  $(".mvcWidget ul li a.widget-geschlossen, div.bo_kasten div.bo_kastenrahmen a, .mvcWidget div.bo_boxContent ul li a, .mvcWidget ul li div.standardueberschrift, div.bo_kastenrahmen div div.bo_opus p.opuslink, div.bo_opus span.gotoWerk, div.standardueberschrift, div#bo_center ul li.bo_columnleft div.bo_opus a, a[data-title|='PersLex'], .mvcWidget ul li ul li div.bo_opus a, div.bo_indent div.bo_opus div a, .mvcWidget .widget-offen, .ArrowMiddleColumnTop a, .ArrowMiddleColumn a").not(".mvcWidget ul li a.widget-geschlossen.haschild, .mvcWidget .widget-offen.haschild").mouseenter(function () {
    const icon = $("i:first", this);
    if (icon.hasClass("icon-right-open")) {
      icon.removeClass("icon-right-open");
      icon.addClass("icon-site-color icon-right-open");
    }
  });
  $(".mvcWidget ul li a.widget-geschlossen, div.bo_kasten div.bo_kastenrahmen a, .mvcWidget div.bo_boxContent ul li a, .mvcWidget ul li div.standardueberschrift, div.bo_kastenrahmen div div.bo_opus p.opuslink, div.bo_opus span.gotoWerk, div.standardueberschrift, div#bo_center ul li.bo_columnleft div.bo_opus a, a[data-title|='PersLex'], .mvcWidget ul li ul li div.bo_opus a, div.bo_indent div.bo_opus div a, .mvcWidget .widget-offen, .ArrowMiddleColumnTop a, .ArrowMiddleColumn a").not(".mvcWidget ul li a.widget-geschlossen.haschild, .mvcWidget .widget-offen.haschild").mouseleave(function () {
    const icon = $("i:first", this);
    if (icon.hasClass("icon-right-open")) {
      icon.removeClass("icon-site-color icon-right-open");
      icon.addClass("icon-right-open");
    }
  });

  //Färbt die Icons im Verweiszettel in der Portalfarbe ein, wenn man über den Link fährt (BON-10230)
  $("div#verweiszettel-content ul li ul li.meldungen, div#verweiszettel-content ul li.simple").mouseenter(function () {
    const icon = $("i:first", this);
    if (icon.hasClass("icon-right-open")) {
      icon.removeClass("icon-right-open");
      icon.addClass("trigger icon-right-open");
    }
  });
  $("div#verweiszettel-content ul li ul li.meldungen, div#verweiszettel-content ul li.simple").mouseleave(function () {
    const icon = $("i:first", this);
    if (icon.hasClass("icon-right-open")) {
      icon.removeClass("trigger icon-right-open");
      icon.addClass("icon-right-open");
    }
  });

  //Färbt u.A. die aktuelle Vorschrift im Verweiszettel portalfarben. Dort wurde eine andere Icon-Klasse verwendet, die ich im HTML nicht ändern konnte; daher die zusätzliche Funktion (BON-10230)
  $("div#verweiszettel-content li.aktuellevorschrift:not(.unlinked), div#verweiszettel-content ul li ul li.verweisstichworte, div#verweiszettel-content ul li.beckshoplink").mouseenter(function () {
    const icon = $("i:first", this);
    if (icon.hasClass("icon-right-open")) {
      icon.removeClass("icon-right-open");
      icon.addClass("icon-site-color trigger icon-right-open");
    }
  });
  $("div#verweiszettel-content li.aktuellevorschrift:not(.unlinked), div#verweiszettel-content ul li ul li.verweisstichworte, div#verweiszettel-content ul li.beckshoplink").mouseleave(function () {
    const icon = $("i:first", this);
    if (icon.hasClass("icon-right-open")) {
      icon.removeClass("icon-site-color trigger icon-right-open");
      icon.addClass("icon-right-open");
    }
  });
  $('div.PwVergessenBenutzername input#Benutzername').change(function () {
    const text = this.value.trim();
    if (text.length != 0) {
      $('div.PwVergessenEmail input#Email').attr('disabled', 'disabled');
    } else {
      $('div.PwVergessenEmail input#Email').removeAttr('disabled');
    }
  });
  $('div.PwVergessenEmail input#Email').change(function () {
    const text = this.value.trim();
    if (text.length != 0) {
      $('div.PwVergessenBenutzername input#Benutzername').attr('disabled', 'disabled');
    } else {
      $('div.PwVergessenBenutzername input#Benutzername').removeAttr('disabled');
    }
  });
  registerEinzeldokument();
  $('.fnback a').click(function () {
    window.location.hash = '';
    return true;
  });

  // BON-15263
  $('#dokument sup').each(function () {
    $(this).find('a').addClass('footnoteAnchor');
    $(this).replaceWith($(this).html());
  });
  setTimeout(jumpToAnchor, 200);

  // BON-16242: https://stackoverflow.com/questions/25168861/how-to-take-user-back-to-where-they-scrolled-to-on-the-previous-page-when-clicki/65632874#65632874
  if ('scrollRestoration' in window.history) window.history.scrollRestoration = 'manual';
  window.addEventListener('beforeunload', function () {
    const newState = Object.assign({}, window.history.state, {
      lastScrollPosition: window.scrollY
    });
    window.history.replaceState(newState, '', window.location.href);
  });
});
const restoreLastScrollPositionIfAny = function () {
  if (window.history.state !== null && window.history.state.lastScrollPosition !== null && typeof window.history.state.lastScrollPosition === 'number') {
    window.scrollTo(window.scrollX, window.history.state.lastScrollPosition);
    const cleanState = Object.assign({}, window.history.state);
    delete cleanState.lastScrollPosition;
    window.history.replaceState(cleanState, '', window.location.href);
    return true;
  }
  return false;
};
const jumpToAnchor = function () {
  if (restoreLastScrollPositionIfAny()) return;
  window.scrollTo(0, 0);
  let hash = location.hash;
  if (hash === '') {
    hash = new URLSearchParams(location.href).get('anchor');
  } else {
    hash = hash.substring(1);
  }
  if (hash === null || hash === '') {
    return;
  }
  hash = hash.toLowerCase();
  [...document.getElementById('dokcontent').querySelectorAll('a[name]')].every((element, index) => {
    if (element.name.toLowerCase() === hash) {
      if (index > 0) {
        const header = document.getElementById('HeaderControl');
        const anchor = document.querySelector('a[name=' + element.name + ']');
        let elem = anchor.closest('.pagebreak');
        if (elem === null) elem = anchor;
        const y = elem.getBoundingClientRect().y - (header.getBoundingClientRect().height + 20);
        window.scrollTo(0, y);
      }
      return false;
    }
    return true;
  });
};
const postFormAndTrack = function (url, formData) {
  fetch(url, {
    headers: {
      'Accept': 'application/json',
      'Content-Type': 'application/json'
    },
    method: "POST",
    body: JSON.stringify(formData)
  }).then(response => response.json()).then(data => {
    if (data.Category !== null) {
      trackMatomoEvent(data.Category, data.Action, data.Name);
    }
    if (data.Url !== null) {
      location.href = data.Url;
    }
  });
};
const collectFormData = function (selector) {
  const fd = new FormData(document.querySelector(selector));
  const object = {};
  fd.forEach((value, key) => {
    const elem = document.querySelector(selector + ' [name=' + key + ']');
    if (elem !== null && elem.type === 'checkbox') {
      value = elem.checked.toString();
    }
    object[key] = value;
  });
  return object;
};
const registerEinzeldokument = function () {
  const matomoLinks = document.querySelectorAll('#einzelDokKaufFormId button');
  Array.from(matomoLinks).forEach(link => {
    link.addEventListener('click', function (event) {
      event.preventDefault();
      const url = document.querySelector('#einzelDokKaufFormId input[type=hidden]').value;
      postFormAndTrack('/Einzeldokumentkauf?vpath=' + url + '&' + event.target.name + '=true', {});
      return false;
    });
  });
};
$(window).on('resize DOMContentLoaded', function () {
  handleHitlistResponsive();
});

/*Modul*/
(function ($) {
  function toggleOpusInfos() {
    const $this = $(this);
    $this.toggleClass('mehrinfos');
    $this.toggleClass('wenigerinfos');
    const lessInfo = $this.attr('data-lessinfo-text');
    const moreInfo = $this.attr('data-moreinfo-text');
    const target = $this.attr('data-target');
    $('#' + target).toggle();
    if ($this.hasClass('mehrinfos')) {
      $this.text(moreInfo);
    } else {
      $this.text(lessInfo);
    }
    return false;
  }
  $(function () {
    $(".mehrinfos, .wenigerinfos").on("click", toggleOpusInfos);
  });
})(jQuery);
//________________________________________Benutzerspezifische Funktionen____________________________________

document.documentElement.className += "ontouchstart" in document.documentElement ? ' touch' : ' no-touch';

// Ladescreen für einen Ajax Suchaufruf der länger dauern kann
function showLoader(coveringElementId) {
  const coveringElement = $get(coveringElementId);
  if (isNull(coveringElement)) return;
  const loader = document.createElement("div");
  loader.id = "bo-loader";
  loader.style.display = "block";
  loader.style.height = coveringElement.offsetHeight + "px";
  loader.style.width = coveringElement.offsetWidth + "px";
  loader.style.left = "0px";
  loader.style.top = "0px";
  coveringElement.appendChild(loader);
}

// Ladescreen wider entfernen
function hideLoader() {
  removeElement("bo-loader");
}

//Ersetzt alle divs mit den angegebenen ID's
function replaceDivs(html, divsToReplace) {
  if (isNull(html)) return;
  const bodyinnerhtml = getBodyInnerHTML(html);
  if (bodyinnerhtml != '') {
    const help = document.createElement("body");
    help.innerHTML = bodyinnerhtml;

    //alle angegebenen Divs zurücksetzen
    for (let i = 0; i < divsToReplace.length; i++) {
      const innerDiv = $get(divsToReplace[i]);
      if (isNotNull(innerDiv)) innerDiv.innerHTML = '';
    }
    let divs = help.getElementsByTagName("div");
    const fieldSets = help.getElementsByTagName("fieldset");
    divs = concatArrays(divs, fieldSets);

    //über das Array, der zu ersetzenden Divs laufen
    for (let ii = 0; ii < divsToReplace.length; ii++) {
      const idtoreplace = divsToReplace[ii];
      let idInNewHtml = false;
      //über alle divs aus dem Response laufen
      for (let i = 0; i < divs.length; i++) {
        const div = divs[i];
        const id = div.getAttribute('id');
        if (isNull(id) || id === '') continue;
        try {
          if (idtoreplace == id) {
            idInNewHtml = true;
            let divstring = div.innerHTML;
            divstring = replaceLineBreak(divstring, '');
            //Zeilenumbrüche raus, sonst gibt es ggf. Problem mit Bildern

            const target = $get(idtoreplace);
            if (divstring) {
              target.innerHTML = divstring;
              target.style.cssText = div.style.cssText; //css aus dem Style-Attribut wird auch mit übernommen
            } else {
              target.style.cssText = "display: none;";
            }
          }
        } catch (e) {
          // ignore
        }
      }
      if ($get(idtoreplace) && !idInNewHtml) {
        $get(idtoreplace).style.cssText = "display: none;";
      }
    }
  }
}

//Fügt der Form ein verstecktes Feld hinzu; falls Inhalte vorhanden sind, so werden diese überschrieben
function addHiddenField(name, value) {
  if (isNotNull($get(name))) {
    $get(name).value = value;
  } else {
    const el = document.createElement("input");
    el.type = "hidden";
    el.id = name;
    el.name = name;
    el.value = value;
    document.forms["form1"].appendChild(el);
  }
}
function entferneAktuelleSuchOption() {
  const elements = $get('detailsuchereiterul').getElementsByTagName('h6');
  if (isNotNull(elements) && elements.length > 0) {
    const element = elements[0];
    element.parentNode.removeChild(element);
  }
}
function markiereAktuelleSuchOption(index) {
  entferneAktuelleSuchOption();
  const markierung = document.createElement('h6');
  markierung.className = 'out-of-viewport';
  markierung.appendChild(document.createTextNode('Aktuelle Suchoption:'));
  const detailsuchereiterul = $get('detailsuchereiterul');
  detailsuchereiterul.childNodes[index].insertBefore(markierung, detailsuchereiterul.childNodes[index].firstChild);
}

// ############# Initialisierung DateTimePicker #############
const BODateControl = new function () {/* empty */}();
BODateControl.initDatePicker = function (controlId, config, onClose) {
  const hoverClass = "date-range-hover";
  const $target = $("#" + controlId);
  // default datepicker settings
  const settings = {
    buttonText: "",
    changeMonth: true,
    changeYear: true,
    showOn: "button",
    constrainInput: false
  };
  const getStartDate = function (sender) {
    return $(sender).data("datepicker").startDate || -1;
  };
  const setStartDate = function (sender, value) {
    $(sender).data("datepicker").startDate = value;
  };
  const getEndDate = function (sender) {
    return $(sender).data("datepicker").endDate || -1;
  };
  const setEndDate = function (sender, value) {
    $(sender).data("datepicker").endDate = value;
  };
  const clearSelection = function (sender) {
    setStartDate(sender, -1);
    setEndDate(sender, -1);
  };
  const clearCalendarHoverSelection = function () {
    $(".ui-datepicker-calendar ." + hoverClass).removeClass(hoverClass);
  };

  // Parsing
  const makeValidDateString = function (input, beginAtMonth) {
    const monthPattern = new RegExp("^([0-9]{1,2})\.([0-9]{2,4})$", "gm");
    const yearPattern = new RegExp("^[0-9]{2,4}$", "gm");

    // input equals "2017"
    if (yearPattern.exec(input)) {
      // into new Format 01.01.2017 or 31.12.2017
      return (beginAtMonth ? "01.01." : "31.12.") + input;
    }
    // input equals "02.2017" or "3.2017"
    const matches = monthPattern.exec(input);
    if (matches) {
      const month = parseInt(matches[1]);
      const year = parseInt(matches[2]);
      let day = 1;
      if (!beginAtMonth) {
        // get last day in month
        const lastDate = new Date(year, month, 0);
        day = lastDate.getDate();
      }

      // into new Format 01.02.2017
      return ("0" + day).slice(-2) + "." + ("0" + month).slice(-2) + "." + year;
    }
    return input;
  };
  const parseDate = function (control) {
    const text = control.value;
    if (text && text.length > 0) {
      const format = $(control).datepicker("option", "dateFormat");
      try {
        const range = text.split(/\s?(\-|bis)\s?/);
        if (range.length > 1) {
          const start = makeValidDateString(range[0], true);
          const end = makeValidDateString(range[2], false);
          const startDate = $.datepicker.parseDate(format, start).getTime();
          const endDate = $.datepicker.parseDate(format, end).getTime();
          setStartDate(control, startDate);
          setEndDate(control, endDate);
        } else {
          const date = makeValidDateString(text, true);
          const parsedDate = $.datepicker.parseDate(format, date).getTime();
          setStartDate(control, parsedDate);
        }
        $(control).datepicker("refresh").show();
      } catch (e) {
        // ignore
      }
    } else {
      clearSelection(control);
    }
  };

  // Events
  const beforeShowDay = function (date) {
    const startDate = getStartDate(this);
    let endDate = getEndDate(this);
    if (endDate <= 0) {
      endDate = startDate;
    }
    const selected = date.getTime() >= Math.min(startDate, endDate) && date.getTime() <= Math.max(startDate, endDate);
    return [true, selected ? "date-range-selected" : ""];
  };
  const onSelect = function (dateText, instance) {
    clearCalendarHoverSelection();
    const $field = $(this);
    const endDate = getEndDate(this);
    const reset = instance.resetRange;
    if (isNull(reset) || endDate > 0) {
      instance.resetRange = false;
      setStartDate(this, -1);
      setEndDate(this, -1);
      instance.dpDiv.data("startDate", -1);
    }
    const startDate = getStartDate(this);
    const selectedDate = new Date(instance.selectedYear, instance.selectedMonth, instance.selectedDay).getTime();
    if (startDate === -1 || startDate === selectedDate) {
      // First time
      setStartDate(this, selectedDate);
      instance.dpDiv.data("startDate", selectedDate);
    } else {
      // Second time
      setEndDate(this, selectedDate);
      const format = $field.datepicker("option", "dateFormat");
      const formattedStartDate = $.datepicker.formatDate(format, new Date(Math.min(startDate, selectedDate)), {});
      const formattedEndDate = $.datepicker.formatDate(format, new Date(Math.max(startDate, selectedDate)), {});
      dateText = formattedStartDate + " - " + formattedEndDate;
      instance.dpDiv.data("startDate", -1);
    }
    $field.val(dateText);
  };
  const beforeShow = function (sender, instance) {
    instance.dpDiv.data("startDate", -1);
    instance.resetRange = true;
    parseDate(sender);
  };
  const setHoverSelection = function () {
    // Already made selection, return
    if ($(".date-range-selected").length > 1) {
      return;
    }
    const $dpDiv = $("#ui-datepicker-div");
    const selectedStartDate = $dpDiv.data("startDate") || -1;

    // If start Date is not set yet, return
    if (selectedStartDate <= 0) {
      return;
    }
    const $allCells = $dpDiv.find("td[data-handler='selectDay']");
    const $currentCell = $allCells.find(".ui-state-hover").closest("td");
    const currentMonth = parseInt($currentCell.data("month"));
    const currentYear = parseInt($currentCell.data("year"));
    const currentCellIndex = $allCells.index($currentCell);
    const startMonth = new Date(selectedStartDate).getMonth();
    const startYear = new Date(selectedStartDate).getFullYear();
    let selectionStartIndex;
    let selectionEndIndex;
    if (startYear !== currentYear) {
      // different Year
      if (startYear >= currentYear) {
        selectionStartIndex = currentCellIndex;
        selectionEndIndex = $allCells.length;
      } else {
        selectionStartIndex = 0;
        selectionEndIndex = currentCellIndex;
      }
    } else if (startMonth !== currentMonth) {
      // different Month
      if (startMonth >= currentMonth) {
        selectionStartIndex = currentCellIndex;
        selectionEndIndex = $allCells.length;
      } else {
        selectionStartIndex = 0;
        selectionEndIndex = currentCellIndex;
      }
    } else {
      // in current Month
      const $startDate = $(".ui-datepicker-current-day");
      const startDateIndex = $allCells.index($startDate);
      selectionStartIndex = Math.min(startDateIndex, currentCellIndex);
      selectionEndIndex = Math.max(startDateIndex, currentCellIndex);
    }

    // reset
    clearCalendarHoverSelection();

    // Set hover class
    for (let i = selectionStartIndex; i <= selectionEndIndex; i++) {
      $($allCells[i]).find("a").addClass(hoverClass);
    }
  };

  // Setup functions
  const setupCulture = function () {
    $.datepicker.regional[config.cultureKey] = {
      clearText: 'löschen',
      clearStatus: 'aktuelles Datum löschen',
      closeText: 'Schließen',
      closeStatus: 'ohne Änderungen schließen',
      prevText: config.prevText,
      //zurück
      prevStatus: 'letzten Monat zeigen',
      nextText: config.nextText,
      //vor
      nextStatus: 'nächsten Monat zeigen',
      currentText: 'Heute',
      currentStatus: '',
      monthNames: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
      monthNamesShort: config.monthNamesShort,
      // ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun','Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez']
      monthStatus: 'anderen Monat anzeigen',
      yearStatus: 'anderes Jahr anzeigen',
      weekHeader: 'Wo',
      weekStatus: 'Woche des Monats',
      dayNames: config.dayNames,
      //['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
      dayNamesShort: config.dayNamesShort,
      // ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
      dayNamesMin: config.dayNamesShort,
      // ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
      dayStatus: 'Setze DD als ersten Wochentag',
      dateStatus: 'Wähle D, M d',
      dateFormat: 'dd.mm.yy',
      firstDay: 1,
      initStatus: 'Wähle ein Datum',
      isRTL: false,
      onClose: onClose
    };
    $.datepicker.setDefaults($.datepicker.regional[config.cultureKey]);
  };
  const setupRangeSelection = function () {
    if (!config.rangeSelection) {
      return;
    }

    // override _selectDate function
    const selectDateBase = $.datepicker._selectDate;
    $.datepicker._selectDate = function (id, date) {
      // Set inline true to avoid closing the datepicker
      const target = $(id);
      const inst = this._getInst(target[0]);

      // inst.resetRange is set on beforeShow
      inst.inline = inst.resetRange;
      selectDateBase.call(this, id, date);
      inst.inline = false;
      this._updateDatepicker(inst);
    };

    // Register events
    $(document).on("mouseenter", ".ui-datepicker-calendar .ui-state-hover", setHoverSelection);
    $(document).on("mouseleave", ".ui-datepicker-calendar", clearCalendarHoverSelection);
    $target.on("change", function () {
      parseDate(this);
    });
    $target.on("keyup", function () {
      parseDate(this);
      setHoverSelection();
    });
    settings.beforeShowDay = beforeShowDay;
    settings.onSelect = onSelect;
    settings.beforeShow = beforeShow;
    settings.showButtonPanel = true;
  };
  const setupPreSelection = function () {
    if (!config.rangeSelection || !config.preSelection) {
      return;
    }
    const createSeparatorControl = function () {
      const separator = document.createElement("span");
      separator.innerHTML = " | ";
      separator.className = "preSelection-separator";
      return separator;
    };
    const elements = document.createDocumentFragment();
    config.preSelectionList.forEach(function (item) {
      const title = item.key;
      const months = item.value;
      const element = document.createElement("a");
      element.innerHTML = title;
      element.className = "preSelection-item";
      if (element.dataset) {
        element.dataset.months = months;
        element.dataset.target = controlId;
      } else {
        element.setAttribute("data-months", months);
        element.setAttribute("data-target", controlId);
      }
      element.onclick = onPreSelectionClicked;
      element.href = "javascript:void(0)";
      elements.appendChild(element);
      elements.appendChild(createSeparatorControl());
    });

    // remove last separator
    elements.removeChild(elements.lastChild);
    const wrapper = document.createElement("div");
    wrapper.className = "preSelections";
    wrapper.appendChild(elements);
    const targetElement = $target.closest(".inputimagewrapper").parent();
    if (targetElement.length > 0) {
      // wrapped inside inputimagewrapper
      targetElement.append(wrapper);
    } else {
      // append after input
      $target.after(wrapper);
    }
  };
  const init = function () {
    setupCulture();
    setupRangeSelection();
    setupPreSelection();
    const iconTitle = config["selectDate"];
    const calenderIcon = document.createElement("i");
    calenderIcon.className = "fa-regular fa-calendar-days";
    calenderIcon.title = iconTitle;
    calenderIcon.setAttribute("aria-hidden", "true");
    const calenderIconSpan = document.createElement("span");
    calenderIconSpan.className = "sr-only";
    calenderIconSpan.textContent = iconTitle;
    $target.datepicker(settings).next('button').append(calenderIcon).append(calenderIconSpan).on("keyup", function (event) {
      if (event.which === 13) $(this).closest("form").submit();
    });

    // Try parse range selection
    if (config.rangeSelection) {
      const field = document.getElementById(controlId);
      parseDate(field);
    }
  };
  init();
};
function onPreSelectionClicked() {
  const months = $(this).data("months");
  const target = $(this).data("target");
  const $target = $("#" + target);
  let endDate = new Date();
  const startDate = new Date();
  if (months > 1) {
    startDate.setMonth(startDate.getMonth() - months);
  } else {
    // letzten Tag im Monat
    endDate = new Date(endDate.getFullYear(), endDate.getMonth() + 1, 0);
  }
  startDate.setDate(1);
  const format = $target.datepicker("option", "dateFormat");
  const formattedStartDate = $.datepicker.formatDate(format, new Date(startDate), {});
  const formattedEndDate = $.datepicker.formatDate(format, new Date(endDate), {});
  const dateText = formattedStartDate + " - " + formattedEndDate;
  $target.val(dateText);
  const onCloseEvent = $target.datepicker("option", "onClose");
  if (onCloseEvent) {
    onCloseEvent(dateText, this);
  }
}

// ############# Initialisierung Autocomplete mit Suggest #############
// Hilfsfunktionen, um den Cursor ans Ende der Suggest-Texts zu setzen und diesen im Eingabefeld sichtbar zu machen
// (von http://stackoverflow.com/questions/499126/jquery-set-cursor-position-in-text-area)
$.fn.setCursorPosition = function (position) {
  if (this.length == 0) return this;
  return $(this).setSelection(position, position);
};
$.fn.setSelection = function (selectionStart, selectionEnd) {
  if (this.length == 0) return this;
  const input = this[0];
  if (input.createTextRange) {
    const range = input.createTextRange();
    range.collapse(true);
    range.moveEnd('character', selectionEnd);
    range.moveStart('character', selectionStart);
    range.select();
  } else if (input.setSelectionRange) {
    input.focus();
    input.setSelectionRange(selectionStart, selectionEnd);
  }
  return this;
};
$.fn.focusEnd = function () {
  this.setCursorPosition(this.val().length);
  return this;
};

/**
 * Singleton Object for query completions; contains members mostly used for logging.
 */
const autocompleteHandler = new function () {
  this.suggestionId = 0;
  this.suggestionCount = 0;
  this.suggestionTotalLatency = 0;
  this.suggestionMaxLatency = 0;
  this.suggestionMinLatency = Number.MAX_VALUE;
  this.suggestionInputMinLen = 0;
  this.spellingInfo = new Object();
}();

/**
 * getters/setters for the members
 */
autocompleteHandler.getSuggestionId = function () {
  return this.suggestionId;
};
autocompleteHandler.setSuggestionId = function (value) {
  this.suggestionId = value;
};
autocompleteHandler.getSuggestionCount = function () {
  return this.suggestionCount;
};
autocompleteHandler.setSuggestionCount = function (value) {
  this.suggestionCount = value;
};
autocompleteHandler.getSuggestionTotalLatency = function () {
  return this.suggestionTotalLatency;
};
autocompleteHandler.setSuggestionTotalLatency = function (value) {
  this.suggestionTotalLatency = value;
};
autocompleteHandler.getSuggestionMaxLatency = function () {
  return this.suggestionMaxLatency;
};
autocompleteHandler.setSuggestionMaxLatency = function (value) {
  this.suggestionMaxLatency = value;
};
autocompleteHandler.getSuggestionMinLatency = function () {
  return this.suggestionMinLatency;
};
autocompleteHandler.setSuggestionMinLatency = function (value) {
  this.suggestionMinLatency = value;
};
autocompleteHandler.getSuggestionInputMinLen = function () {
  return this.suggestionInputMinLen;
};
autocompleteHandler.getSpellingInfo = function () {
  return this.spellingInfo;
};
autocompleteHandler.setSpellingInfo = function (value) {
  this.spellingInfo = value;
};

// === Funktionen werden momentan nur für Gesetzesübersichten (im Inhalt) benutzt
// === zum Ein-/Ausblenden der Detail-Bereiche
function ulClose() {
  const uls = document.getElementsByTagName('ul');
  for (let i = 0; i < uls.length; ++i) {
    if (uls[i].id.substring(0, 5) == "coll_") {
      if (toggleOnlyLevel2 === false || getAncestorByTagName(getAncestorByTagName(uls[i], 'UL'), 'UL') !== null) {
        collapseElement(uls[i]);
      }
    }
  }
}
function ulOpen() {
  const uls = document.getElementsByTagName('ul');
  for (let i = 0; i < uls.length; ++i) {
    if (uls[i].id.substring(0, 5) == "coll_") {
      if (toggleOnlyLevel2 === false || getAncestorByTagName(getAncestorByTagName(uls[i], 'UL'), 'UL') !== null) {
        expandElement(uls[i]);
      }
    }
  }
}
function getAncestorByTagName(element, tagName) {
  if (isNull(element)) return null;
  let current = element.parentNode;
  while (isNotNull(current)) {
    if (current.tagName == tagName) {
      return current;
    }
    current = current.parentNode;
  }
  return null;
}
function expandElement(element) {
  if (element.style.display) {
    element.style.display = "";
    const ico = $get("ico" + element.id);
    if (ico) ico.src = "/bib/bilder/toc2-path-h1-o.gif";
  }
}
function collapseElement(element) {
  if (!element.style.display) {
    element.style.display = "none";
    const ico = $get("ico" + element.id);
    if (ico) ico.src = "/bib/bilder/toc2-path-h1-c.gif";
  }
}
function ToggleMagazineNotification(elementid, opusID, stand) {
  $("#" + elementid + " > div").attr("class", "notification_loader");
  $.ajax({
    type: "POST",
    dataType: "html",
    url: "/ToggleMagazineNotification",
    data: {
      elementid: elementid,
      opusID: opusID,
      stand: stand
    },
    success: function (data) {
      $get(elementid).innerHTML = data;
    }
  });
  return false;
}
function RemoveMagazineNotification(opusID) {
  $.ajax({
    type: "POST",
    url: "/RemoveMagazineNotification",
    data: {
      opusID: opusID
    },
    success: function (data) {
      $get("magazinenotifications").innerHTML = data;
    }
  });
  return false;
}
function ScrollLeftPaging(sender) {
  const element = $(".TopTabHeader");
  const posScrollbalken = element.scrollLeft();
  if (posScrollbalken <= 0) {
    sender.style.display = "none";
    return true;
  }
  element.animate({
    scrollLeft: posScrollbalken - element.width() / 4
  }, 100);
  return false;
}
function ScrollRightPaging(sender) {
  const element = $(".TopTabHeader");
  const posScrollbalken = element.scrollLeft();
  const maxScrollPos = element.prop("scrollWidth") - element.width();
  if (posScrollbalken >= maxScrollPos) {
    sender.style.display = "none";
    return true;
  }
  element.animate({
    scrollLeft: posScrollbalken + element.width() / 4
  }, 100);
  return false;
}
function RegisterOnClickOpusTracking(matomoOpusTrackingSetting) {
  if (isNull(matomoOpusTrackingSetting) || matomoOpusTrackingSetting.length < 1) return;
  const processedBcids = [];
  matomoOpusTrackingSetting.forEach(function (setting) {
    $("a:regex(href, " + setting.VpathPattern + ")").on("click", function () {
      const anchorLocation = detectAnchorLocation($(this));
      if (isNotNull(anchorLocation)) {
        trackMatomoEvent(setting.MatomoLogCategory, anchorLocation);
      }
    });
    $("a:regex(href, " + setting.BcidPattern + ")").on("click", function () {
      if (isNotNull(processedBcids) && processedBcids.length > 0 && $.inArray(setting.BcidPattern, processedBcids) >= 0) return;
      processedBcids.push(setting.BcidPattern);
      const bcidAncor = detectAnchorLocation($(this));
      const token = $("input[name=\"__RequestVerificationToken\"]").val();
      if (isNotNull(bcidAncor) && token) {
        $.ajax({
          type: "POST",
          url: "BeckConnectivity/SetBcidLinkAnchorLocation",
          data: {
            __RequestVerificationToken: token,
            anchorLocation: bcidAncor
          },
          async: false
        });
      }
    });
  });
}
function detectAnchorLocation($object) {
  if ($object.parents("#trefferliste").length) {
    return "Trefferliste";
  } else if ($object.parents("#dokcontent").length) {
    return "Inhalt";
  } else if ($object.parents("#doktoc").length) {
    return "TOC";
  } else if ($object.parents("#verweisContainer").length) {
    return "VZ";
  }
  return null;
}
function openPrintExportBox(exportManager, contentBox) {
  contentBox.classList.remove('hidden');
  const iconParent = exportManager.querySelector('.column.icons');
  Array.from(iconParent.children).forEach(el => {
    if (el.className.includes('hidden')) {
      el.classList.remove('hidden');
    } else {
      el.classList.add('hidden');
    }
  });
}
function registerPrintExportHotkey() {
  const exportManager = document.getElementById('viewExport') !== null ? document.getElementById('viewExport') : document.getElementById('viewExporthitlist');
  if (exportManager) {
    window.hotkeyManager.registerHotkey("0", 48, () => {
      const boxIsHidden = exportManager.querySelector('.content.rechtespalte.hidden');
      if (boxIsHidden) {
        openPrintExportBox(exportManager, boxIsHidden);
        document.getElementById('Print').focus();
      } else {
        document.getElementById('Print').focus();
      }
    }, {
      altKey: true
    }, true);
  }
}
function registerHotkeys() {
  registerPrintExportHotkey();
  // Fokus auf Bücher bei der Homepage bei ALT + 9
  window.hotkeyManager.registerHotkey("9", 57, () => {
    const leftRowOpen = document.querySelector('.bo_show_left_content');
    if (leftRowOpen) {
      const allWidgets = leftRowOpen.querySelectorAll('.widget-geschlossen');
      const publicationBooks = Array.from(allWidgets).find(el => el.textContent === 'Bücher');
      if (publicationBooks) {
        publicationBooks.focus({
          focusVisible: true
        });
        publicationBooks.scrollIntoView();
      }
    }
  }, {
    altKey: true
  }, true);
  // BON-10333: Drucken über STRG + ALT + P
  window.hotkeyManager.registerHotkey("p", 80, printHotkey, {
    ctrlKey: true,
    altKey: true
  }, false);
  window.hotkeyManager.registerHotkey("1", 49, function () {
    location.href = document.querySelector("#beckonline-tab a").href;
  }, {
    altKey: true
  }, true);
  window.hotkeyManager.registerHotkey("2", 50, function () {
    location.href = document.querySelector("#mybo-tab a").href;
  }, {
    altKey: true
  }, true);

  // BON-15283: Alt + 8 für Focus auf 1. Ergebnis in Mittelspalte
  window.hotkeyManager.registerHotkey("8", 56, () => {
    const divDocument = document.getElementById('dokument');
    if (divDocument !== null) {
      /*divDocument.querySelector('a[href]');*/
      document.querySelector('#dokument a.dk2button').focus();
    } else {
      const currentRoute = window.location.pathname.toLowerCase();
      let parentElement = '';
      if (currentRoute.endsWith('/home') || currentRoute.endsWith('/home/')) {
        parentElement = document.querySelector('#bo_meldungenListe li');
      } else if (currentRoute.endsWith('/search') || currentRoute.endsWith('/treffer')) {
        parentElement = document.querySelector('p.treffer-firstline-text');
      } else {
        return;
      }
      const link = parentElement.querySelector('a');
      link.focus();
    }
  }, {
    ctrlKey: false,
    altKey: true,
    shiftKey: false
  }, true);
  window.hotkeyManager.registerHotkey("ArrowUp", 38, () => {
    window.scrollTo({
      top: 0
    });
  }, {
    altKey: true
  }, true);
  window.hotkeyManager.registerHotkey("h", 72, () => {
    window.location.href = '/Home';
  }, {
    altKey: true
  }, true);
  if (location.pathname.toLowerCase() === '/home' || location.pathname.toLowerCase() === '/home/') {
    const usernameInput = document.getElementById('username');
    if (usernameInput) {
      window.hotkeyManager.registerHotkey("l", 76, () => {
        usernameInput.focus();
      }, {
        altKey: true,
        ctrlKey: true
      }, true);
    }
  }
}

//Simuliert einen Click
function simulateClick(elId) {
  //Notwendig für die Facetten auf der dokumentliste
  if (self.location.href.indexOf('typ=dokumentliste') != -1) addHiddenField("typ", "dokumentliste");
  let evt;
  const el = $get(elId);
  if (document.createEvent) {
    evt = document.createEvent("MouseEvents");
    evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
  }
  evt ? el.dispatchEvent(evt) : el.click && el.trigger("click");
}

//---Aktenverwaltung---BEGIN
function findParentForm(ctl) {
  let parentCtl = ctl.parentNode;
  while (isNotNull(parentCtl)) {
    if (parentCtl.tagName == "FORM") return parentCtl;
    parentCtl = parentCtl.parentNode;
  }
  return null;
}
function exclusiveRechtsgebietCheck(ctl) {
  if (ctl.checked == true) {
    const master = ctl.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
    const masterDivs = master.getElementsByTagName('div');
    for (let i = 0; i < masterDivs.length; i++) {
      const aCheckboxes = masterDivs[i].getElementsByTagName('input');
      for (let j = 0; j < aCheckboxes.length; j++) {
        if (aCheckboxes[j].type == "checkbox" && aCheckboxes[j].id != ctl.id) {
          aCheckboxes[j].checked = false;
        }
      }
    }
  }
}

//Löscht alle Kind-Knoten aus dem DOM
function removeAllChilds(nodeID) {
  const obj = $get(nodeID);
  if (isNotNull(obj)) {
    while (obj.hasChildNodes() == true) obj.removeChild(obj.firstChild);
  }
  return false;
}
function SerializeArrayWithSeparator(array, separator) {
  let _value = '';
  for (let i = 0; i < array.length; i++) {
    _value += array[i];
    if (i != array.length - 1) {
      _value += " " + separator + " ";
    }
  }
  return _value;
}
//---Aktenverwaltung---END

// ############## Searchforms #############
function documentKeyDown(event) {
  // Hat ein Input bereits ein Fokus?
  const inputFocused = ["input", "textarea", "select", "beck-chat-component"].indexOf(document.activeElement.tagName.toLowerCase()) >= 0;
  if (inputFocused) {
    return;
  }
  if (event.altKey || event.ctrlKey || event.metaKey) return;

  //Erlaubt sind alle Buchstaben, Zahlen und Satzzeichen
  const isValidKey = event.keyCode > 47 && event.keyCode < 91 //Alle Buchstaben und Zahlen
  || event.keyCode > 95 && event.keyCode < 112 //Die Zahlen des NumPad und die Operatoren '/', '*', '-', '+', ',' 
  || event.keyCode > 185 && event.keyCode < 193 //Die Satzzeichen ',', ';', '=', '-', '/', '.', '´'
  || event.keyCode > 219 && event.keyCode < 223 //Die Satzzeichen '(', '\', ')', '''
  || event.keyCode === 173;
  if (isValidKey && !window.hotkeyManager.isHotkeyRegistered(event.key, event.keyCode, event.shiftKey, event.ctrlKey, event.altKey)) {
    setInputFocus("words");
  }
}
setInputFocus = function (controlId) {
  const input = $get(controlId);
  if (isNotNull(input)) {
    input.focus();
  }
};
function split(val) {
  return val.split(/,\s*/);
}
function extractLast(term) {
  return split(term).pop();
}
hideControl = function (controlId) {
  const contr = $get(controlId);
  if (isNotNull(contr)) $("#" + controlId).css('display', 'none');
};
initAutosearch = function (controlId, params, divs2Replace, timeout, autosearch) {
  if (!autosearch) autosearch = function () {
    doAjax(params, divs2Replace, timeout);
  };
  $("#summary-filter #" + controlId).keyup(function (event) {
    if (event.keyCode === 13 || event.keyCode === 9) {
      return;
    }
    autosearch();
  });
};
doAjax = function (params, divs2Replace, timeout) {
  if (timeout > 0) {
    try {
      clearTimeout(this.timer);
    } catch (e) {
      // ignore
    }
    this.timer = setTimeout(function () {
      doAjax(params, divs2Replace, 0);
    }, timeout);
  } else {
    if (document.getElementById('bo-loader') === null) showLoader('SummaryControl');
    const form = $get('summary-form');
    if (isNotNull(form)) {
      const postString = getPostString(form);
      $("#rs-filter").val(postString);
      const body = postString + "&" + params;
      $.ajax({
        url: form.action,
        data: body,
        type: "POST",
        success: function (data) {
          replaceDivs(data, divs2Replace);
          hideLoader();
        },
        complete: function () {
          if ($("input.markall").length > 0 && $(".treffer-funktion-checkbox").length > 0) showMarkDocumentCheckboxes();
          if ($(".btn_markall").length > 0) $(".btn_markall").hide();
        }
      });
    }
  }
};
function toggleMyModules(element, colText, expText) {
  $('.hide').toggle();
  $('.hide')[0].focus();
  const item = $('#' + element);
  const icon = $(item).find("i");
  if (icon.hasClass("icon-down-open")) {
    icon.toggleClass("icon-right-open icon-down-open");
    icon.next().text(expText);
  } else {
    icon.toggleClass("icon-down-open icon-right-open");
    icon.next().text(colText);
  }
}
function toggleElementDisplay(elementname) {
  const obj = document.getElementById(elementname);
  if (isNotNull(obj)) obj.style.display = obj.style.display != "" ? "" : "none";
}
function handleAbsolutePositionedAnchorLinks() {
  // Fallback für BON-7515
  const hash = location.hash;
  if (!hash || hash.length <= 0) return;
  let $target = $(hash);
  if ($target.length <= 0) $target = $("a[name='" + hash.substring(1) + "']");
  if ($target.length <= 0) return;

  // Nur für Seitennavigation (alle Browser) und Fussnoten (für Chrome)
  const selector = ".pagebreak, sup";
  let $sectionElement = $target.siblings(selector);

  // Möglicher Fallback für alte Fussnoten Referenz
  if ($sectionElement.length <= 0) {
    $sectionElement = $target.children(selector);
  }

  // Möglicher Fallback für alte Fussnoten Darstellung
  if ($sectionElement.length <= 0) {
    $sectionElement = $target.closest(selector);
  }
  if ($sectionElement.length <= 0) return;
  if (!$sectionElement.is(":visible")) {
    const collapsedSectionId = $sectionElement.parents("[id^='" + prefixIds.containerId + "']").attr("id");
    if (collapsedSectionId) {
      const linkId = collapsedSectionId.replace(prefixIds.containerId, prefixIds.linkId);
      dtlToggle(linkId);
    }
  }
  const offset = $sectionElement.offset().top;
  if (offset <= 0) return;
  window.scrollTo(0, offset - 20);
}

/**
 * BON-10368: Beim zurück/vorwärts navigieren im Browser nach dem setzen einer Checkbox (Favorit, Mein Beck-Online...)
 * kann es passieren, dass der Checkbox-Status aus dem Cache kommt und nicht mehr zum Severstatus passt
 */
function syncCheckboxesOnBrowserNavigation() {
  // navigation type 2 = back/forward navigation
  if (window.performance && window.performance.navigation.type === 2) {
    checkParam("meinefavoriten", $("a.myFavouriteFilter").siblings("input[type=checkbox]"), "/Favourite/UpdateMyFavouriteFilter?meinefavoriten=");
    checkParam("meinbeckonline", $("a.myBeckOnlineFilter").siblings("input[type=checkbox]"), "/Benutzereinstellungen/UpdateMyBeckOnlineFilter?meinbeckonline=");
    checkParam("nurlexikon", $("a.onlyLexiconFilter").siblings("input[type=checkbox]"), "/Benutzereinstellungen/UpdateNurLexikonFilter?nurlexikon=");
    checkParam("nurnormenbayernsunddesbundes", $("a.nurNormenBayernsUndDesBundes").siblings("input[type=checkbox]"), "/Benutzereinstellungen/UpdateBayernRechtFilter?nurnormenbayernsunddesbundes=");
  }

  // da document.referrer nicht immer die erwartete URL lieferte, wird die aktuelle URL im localStorage gespeichert
  localStorage["lastUrl"] = window.location.search;
}

/**
 * Prüft den übergebenen Parameter und aktualisiert ihn am Server (falls notwendig)
 * @param {string} param: Name des Parameters innerhalb der URL
 * @param {object} $checkboxes: Checkboxen die anhand des Parameters aktualisiert werden sollen
 * @param {string} ajaxUrl: Die Action um den Parameter am Server zu aktualisieren
 */
function checkParam(param, $checkboxes, ajaxUrl) {
  let parameter;
  const $checkInput = $("#" + param + "Check");
  if ($checkInput.length > 0) {
    // In einer Trefferliste liefert der Server in hidden-Feldern den aktuellen Filter Status der Suche zurück
    parameter = $checkInput.val() === "True";
  } else {
    parameter = getParameterByName(param, window.location.search);
    if (isNotNull(parameter)) {
      // Beim vorwärts navigieren im Browser wird der Serverstatus anhand des Parameters in der aktuellen URL aktualisiert
      parameter = parameter.toLowerCase() === "true";
    } else {
      parameter = getParameterByName(param, localStorage["lastUrl"]);
      if (isNull(parameter)) return;

      // Beim zurück navigieren im Browser wird der Serverstatus anhand des Parameters aus der letzten URL aktualisiert
      parameter = !(parameter.toLowerCase() === "true");
    }
  }
  $.ajax({
    type: "POST",
    url: ajaxUrl + parameter,
    success: function () {
      $checkboxes.prop("checked", parameter);
    }
  });
}
function showProgress($icon) {
  $icon.parent().attr("disabled", "disabled");
  $icon.hide();
  _spinnerBo.show();
}
function hideProgress($icon) {
  _spinnerBo.hide();
  $icon.show();
  setTimeout(function () {
    $icon.parent().removeAttr("disabled");
  }, 100);
}
function togglePasswordViewModus(iTag) {
  const passwordInput = $(iTag).prev('input')[0];
  const type = passwordInput.getAttribute('type') === 'password' ? 'text' : 'password';
  passwordInput.setAttribute('type', type);
  iTag.classList.toggle('icon-eye-solid');
  iTag.classList.toggle('icon-eye-slash-solid');
}
//_________________________________________________Handler___________________________________________________

function addJSEnabledClass() {
  $('#bottomleiste').addClass('jsEnabled');
  $('#bo_center').addClass('jsEnabled');
  $('#bo_left').addClass('jsEnabled');
  $('#bo_right').addClass('jsEnabled');
}
function isSmallMobile() {
  return window.matchMedia("(max-width:" + SMALL_MOBILE_RESOLUTION + "px)").matches;
}
function setEnableKeyboardShortcuts(value) {
  enableKeyboardShortcuts = value;
  if (!value) window.hotkeyManager.disable();
  if (value) window.hotkeyManager.enable();
}
function handleHitlistResponsive() {
  // Prüft die Trefferliste Breite und blendet Elemente entsprechend ein/aus
  const width = $('#trefferliste').width();
  if (!width) return;
  if (width > 633) {
    // Paging Element über der Trefferliste 
    $('#hitlist-header ul.paging').show();
  } else {
    $('#hitlist-header ul.paging').hide();
  }
}
function replaceLineBreak(input, replacestring) {
  return input.replace(/\r\n/g, replacestring);
}

/*Meine neuen Werke*/
function toggleWerke(element, target) {
  const $target = jQuery('#' + target);
  const $icon = element.find("i");
  $target.toggle();
  if ($icon.hasClass("clickflag")) {
    $icon.toggleClass("icon-down-open icon-right-open");
  } else {
    $icon.addClass("clickflag");
  }
}

/*Modul*/
function toggleModul(element, target) {
  element.toggleClass('offen');
  element.toggleClass('geschlossen');
  jQuery('#' + target).toggle();
}
function toggleFavorite() {
  if (document.getElementById('favoriten').style.display === '' || document.getElementById('favoriten').style.display === 'block') {
    document.getElementById('favoriten').style.display = 'none';
  } else {
    document.getElementById('favoriten').style.display = 'block';
  }
}

/*Zwischenüberschrift*/
function toggleZwischenueberschrift(element) {
  element.closest('div').find('>div').slideToggle('fast');
  const $icon = element.find("i");
  if ($icon.hasClass("clickflag")) {
    $icon.toggleClass("icon-down-open icon-right-open");
  } else {
    $icon.toggleClass("clickflag");
  }
}
function concatArrays(arr1, arr2) {
  const result = new Array();
  for (let i = 0; i < arr1.length; i++) {
    result.push(arr1[i]);
  }
  for (let i = 0; i < arr2.length; i++) {
    result.push(arr2[i]);
  }
  return result;
}
function getPostString(form) {
  const body = $(form).find(":input").filter(function (i, e) {
    return $(e).val() != "";
  }).serialize();
  return body;
}
function UrlEncode(input) {
  return input.replace("/", "%2F").replace("?", "%3F").replace("=", "%3D").replace("&", "%26");
}
function getBodyInnerHTML(html) {
  const regexbody = new RegExp("<body[^>]*>");
  const match = html.match(regexbody);

  //06.05.2011 Matthias Szczygiol
  //lastIndex liefert einen undefinierten Wert zurück
  const start = match.index;
  const end = html.indexOf('</body>');
  return html.substring(start, end);
}

//löscht das angegebene Element
function removeElement(id) {
  const elem = $get(id);
  if (isNotNull(elem)) {
    const parent = elem.parentNode;
    parent.removeChild(elem);
  }
}

// Liefert das InnerXML eines Nodes als String zurück
function GetInnerXml(node) {
  let s = "";
  for (let i = 0; i < node.childNodes.length; i++) {
    const xmlSerializer = new XMLSerializer();
    s += xmlSerializer.serializeToString(node.childNodes[i]);
  }
  return s;
}
function GetActiveElementID() {
  let targetid = "";
  if (isNotNull(document.activeElement))
    //untestützt nur der IE
    targetid = document.activeElement.id;
  return targetid;
}
function SetFocus(id) {
  window.setTimeout(function () {
    try {
      $get('words').focus(); //wg. IE

      const object = $get(id);
      const val = object.value;
      if (isNotNull(object) && (isNotNull(object.type) && object.type == 'text' || object.tagName == 'TEXTAREA')) {
        object.value = '';
        object.focus(); //Damit der Curser am Ende des Textes steht
        object.value = val;
        return;
      }
      object.focus();
    } catch (e) {
      // ignore
    }
  }, 0);
}
function SerializeArray(array) {
  let value = '';
  for (let i = 0; i < array.length; i++) {
    value += array[i];
    if (i != array.length - 1) {
      value += ", ";
    }
  }
  return value;
}
function KeyDownHandler(e, btn) {
  if (!e) e = window.event;
  if (e.keyCode == 13) {
    e.returnValue = false;
    e.cancel = true;
    if (isNotNull(btn)) {
      btn.trigger("click");
    }
    return false;
  } else return true;
}
function getUrlParameter(sParam) {
  let parameter = '';
  const pageUrl = window.location.search.substring(1);
  const sUrlVariables = pageUrl.split('&');
  for (let i = 0; i < sUrlVariables.length; i++) {
    const sParameterName = sUrlVariables[i].split('=');
    if (sParameterName[0].toLowerCase() == sParam.toLowerCase()) {
      parameter = sParameterName[1];
    }
  }
  return parameter;
}
function ToggleElement(elementname) {
  const obj = $get(elementname);
  if (isNotNull(obj)) obj.style.visibility = obj.style.visibility != "visible" ? "visible" : "hidden";
}
function printHotkey() {
  const printDialog = $("a.printDialogLink");
  if (printDialog.length > 0) {
    printDialog[0].click();
  }
}
function getParameterByName(name, url) {
  const match = RegExp("[?&]" + name + "=([^&]*)", "i").exec(url);
  return match && decodeURIComponent(match[1].replace(/\+/g, " "));
}
function isDisabled($icon) {
  return $icon.parent().attr("disabled");
}
function deleteInputs(event) {
  document.querySelectorAll('#summary-form input[type="text"]').forEach(input => {
    input.setAttribute("value", "");
    input.value = "";
    if (input.hasAttribute("inputvalue")) {
      input.setAttribute("inputvalue", '');
    }
  });
  document.querySelectorAll('#summary-form input[type="checkbox"]').forEach(input => input.checked = false);
  event.preventDefault();
}

// sobald Bootstrap integriert ist, kann die ganze Funktion wieder raus (Aufruf weiter oben nicht vergessen :-))
const initDropdownToggle = function () {
  let toggleIsOpen = false;
  const closeToggle = function () {
    if (!toggleIsOpen || $(this).data('bs-toggle') === 'dropdown') return true;
    $('[data-bs-toggle=dropdown]').removeClass('dd-show').next().hide().removeClass('dd-show');
    toggleIsOpen = false;
    return true;
  };
  $('[data-bs-toggle=dropdown]').on('click', function (event) {
    event.stopPropagation();
    const sender = $(this);
    sender.toggleClass('dd-show').next().toggle().toggleClass('dd-show');
    toggleIsOpen = sender.hasClass('dd-show');
  });
  $(window).on('click', closeToggle);
  $('a,button').on('click', closeToggle);
};
function fadeOutEffect(selector, totalTimeInMilliseconds) {
  const fadeTarget = document.querySelector(selector);
  const fadeEffect = setInterval(function () {
    if (!fadeTarget.style.opacity) {
      fadeTarget.style.opacity = 1;
    }
    if (fadeTarget.style.opacity > 0) {
      fadeTarget.style.opacity -= 0.1;
    } else {
      clearInterval(fadeEffect);
    }
  }, totalTimeInMilliseconds / 10);
}
function clickOnDataProtect() {
  let counter = 20;
  const int = window.setInterval(function () {
    counter--;
    if (typeof UC_UI !== "undefined") {
      counter = 0;
      document.getElementById("dataProtect").click();
    }
    if (counter <= 0) {
      clearInterval(int);
    }
  }, 100);
}
function validateInput(elem) {
  if (isNull(elem)) {
    return false;
  }
  let valid = true;
  const minLength = elem.getAttribute('minlength');
  if (minLength !== null && elem.value.length < minLength) {
    valid = false;
  }
  if (elem.getAttribute('type') === 'email') {
    const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
    if (!re.test(String(elem.value).toLowerCase())) {
      valid = false;
    }
  }
  if (!valid) {
    elem.closest('.beck-input-container').classList.add('beck-input-invalid');
    elem.closest('.beck-input-container').classList.remove('beck-input-valid');
  } else {
    elem.closest('.beck-input-container').classList.remove('beck-input-invalid');
    elem.closest('.beck-input-container').classList.add('beck-input-valid');
  }
  return valid;
}
function validateTextarea(elem) {
  if (isNull(elem)) {
    return false;
  }
  if (isNullOrEmpty(elem.value)) {
    elem.parentElement.classList.add('validation-error');
    elem.parentElement.nextElementSibling.style.display = 'block';
    return false;
  } else {
    elem.parentElement.classList.remove('validation-error');
    elem.parentElement.nextElementSibling.style.display = 'none';
    return true;
  }
}
function initBucDropdown(id) {
  const dropdownField = document.querySelector('#' + id);
  const dropdownBtnText = document.querySelector('#' + id + 'Btn span');
  const dropdownItems = document.querySelectorAll('#' + id + 'Items li');
  dropdownItems.forEach(item => {
    if (item.dataset.value === dropdownField.value) {
      dropdownBtnText.textContent = item.outerText;
      item.classList.add('active');
    }
    item.addEventListener('click', event => {
      const curElem = document.querySelector('#' + id + 'Items li.active');
      if (isNotNull(curElem)) curElem.classList.remove('active');
      const elem = event.currentTarget;
      elem.classList.add('active');
      dropdownField.value = elem.dataset.value;
      dropdownBtnText.textContent = elem.outerText;
    });
  });
}
//# sourceMappingURL=bo.js.map
;
//___________________________________________Variablendeklarationsbereich______________________________________
let _spinnerBoBox = null;

//_____________________________________________Allgemeine Funktionen____________________________________________

function ensureSpinner() {
  if (_spinnerBoBox === null) {
    _spinnerBoBox = new SpinnerHandler();
  }
  return _spinnerBoBox;
}
function toggleBox(e, element) {
  const $this = $(element);
  const $container = $this.closest(".bo-box").children(".content");
  const $icon = $this.closest(".bo-box").find(".toggleIcon");
  const $anchor = $icon.parent("a");
  if (!$anchor.length) {
    $.ajax({
      type: "GET",
      url: $anchor.attr("href"),
      success: function (data) {
        if (!data) {
          $container.hide();
        } else {
          $container.show();
        }
        setIcon($icon, $container);
      },
      cache: false
    });
    e.preventDefault();
  } else {
    $container.toggle();
    setIcon($icon, $container);
  }
}
function toggleBoxRechteSpalte(e, element) {
  const $this = $(element);
  const $container = $this.closest(".bo-box").children(".content");
  const $icon = $this.closest(".bo-box").find(".toggleIcon");
  $container.toggleClass("hidden");
  $icon.toggleClass("hidden");
}
function setIcon($icon, $container) {
  const isContainerVisible = $container.is(":visible");
  $icon.toggleClass("icon-up-dir", isContainerVisible);
  $icon.toggleClass("icon-down-dir", !isContainerVisible);
}
$(document).on("click", ".bo-box.bo-box-rechtespalte > .header.row", function (event) {
  toggleBoxRechteSpalte(event, this);
});
$(document).on("click", ".bo-box:not(.bo-box-rechtespalte) > .header.row", function (event) {
  toggleBox(event, this);
});
$(document).on("keypress", ".bo-box.bo-box-rechtespalte > .header.row > .icons > i", function (event) {
  if (event.keyCode === 13 || event.keyCode === 32) {
    toggleBoxRechteSpalte(event, this);
  }
});
$(document).on("keypress", ".bo-box:not(.bo-box-rechtespalte) > .header.row > .icons > i", function (event) {
  if (event.keyCode === 13 || event.keyCode === 32) {
    toggleBox(event, this);
  }
});
$(document).on("click", "div.rechtespalte a.trigger", function () {
  toggleMoreOptions();
});
$(document).on("keypress", "div.rechtespalte a.trigger", function (event) {
  if (event.keyCode === 13 || event.keyCode === 32) {
    toggleMoreOptions();
  }
});
//____________________________________________Benutzerspezifische Funktionen_____________________________________

function toggleMoreOptions() {
  const icon = $("div.rechtespalte i.trigger");
  const $target = $(document).find(".target");
  $target.toggleClass("nosee");
  icon.toggleClass("icon-down-open icon-right-open");
}
function toggleLink(target, icon) {
  const $icon = $(icon);
  const $target = $(target);
  $target.toggleClass("nosee");
  $icon.toggleClass("icon-down-open icon-right-open");
}
function toggleVolltextDruckenIconFuerHitlist(sender) {
  if (sender === null) return false;
  const $icon = $(".action i", $(sender).closest("div#volltextOption"));
  const $checkbox = $("input.hidden_printoption_checkbox", $(sender).closest("div#volltextOption"))[0];
  if (isDisabled($icon)) return false;
  const url = BO.config.druckSettings.toggleVolltextDruckenUrl;
  showProgress($icon);
  $.post(url, function (result) {
    const setToActive = result.setToActive;

    // flip icon state
    $icon.toggleClass(BO.config.druckSettings.iconToggleOn, setToActive);
    $icon.toggleClass(BO.config.druckSettings.iconToggleOff, !setToActive);
    toggleHiddenOptionCheckbox($checkbox, setToActive);
    toggleFussnoteUndNeueSeiteFuerHitlist(setToActive);
    toggleExportButtonForHitlist(setToActive);
    hideProgress($icon);
  });
  return false;
}
function toggleExportOption(sender, optionselector, url) {
  if (sender === null) return;
  const $icon = $(".action i", $(sender).closest(optionselector));
  const $checkbox = $("input.hidden_printoption_checkbox", $(sender).closest(optionselector))[0];
  if (isDisabled($icon)) return;
  showProgress($icon);
  $.post(url, function (result) {
    const setToActive = result.setToActive;

    // flip icon state
    $icon.toggleClass(BO.config.druckSettings.iconToggleOn, setToActive);
    $icon.toggleClass(BO.config.druckSettings.iconToggleOff, !setToActive);
    toggleHiddenOptionCheckbox($checkbox, setToActive);
    hideProgress($icon);
  });
}
function toggleDokumentAufNeuerSeiteDruckenIconFuerHitlist(element) {
  toggleExportOption(element, "#neueSeiteOption", BO.config.druckSettings.toggleDokumentAufNeuerSeiteUrl);
}
function toggleDokumentAllgemeineAktendatenIcon(element) {
  toggleExportOption(element, "#allgemeineAktendatenOption", BO.config.druckSettings.toggleAllgemeineAktendatenDruckenUrl);
}
function toggleDokumentDokumentenlisteAkteIcon(element) {
  toggleExportOption(element, "#dokumentenlisteAkteOption", BO.config.druckSettings.toggleDokumentenlisteDruckenUrl);
}
function toggleDokumentHistorieAkteIcon(element) {
  toggleExportOption(element, "#historieAkteOption", BO.config.druckSettings.toggleHistorieDruckenUrl);
}
function toggleFussnotenImDokumentIcon(element) {
  toggleExportOption(element, "#fussnoteOption", BO.config.druckSettings.toggleFussnotenImDokumentUrl);
}
function toggleMitSieheAuchDruckenIcon(element) {
  toggleExportOption(element, "#sieheAuchOption", BO.config.druckSettings.toggleMitSieheAuchUrl);
}
function toggleMitAnmerkungenDruckenIcon(element) {
  toggleExportOption(element, "#anmerkungenOption", BO.config.druckSettings.toggleMitAnmerkungenUrl);
}
function toggleMitHighlightingDruckenIcon(element) {
  toggleExportOption(element, "#highlightingOption", BO.config.druckSettings.toggleMitHighlightingUrl);
}
function toggleMitVerlinkungDruckenIcon(element) {
  toggleExportOption(element, "#verlinkungOption", BO.config.druckSettings.toggleMitVerlinkungUrl);
}
function toggleDokumentAufNeuerSeiteDruckenIcon(element) {
  toggleExportOption(element, "#neueSeiteOption", BO.config.druckSettings.toggleDokumentAufNeuerSeiteUrl);
}
function toggleHiddenOptionCheckbox(checkbox, setToActive) {
  if (isNull(checkbox)) return;
  if (setToActive) {
    $(checkbox).attr("checked", "checked");
  } else {
    $(checkbox).removeAttr("checked");
  }
  checkbox.checked = setToActive;
}
function toggleFussnoteUndNeueSeiteFuerHitlist(istAktiv) {
  const fussnoteoption = $("div.moreOptionsContainer").find("#fussnoteOption");
  const neueseiteoption = $("div.moreOptionsContainer").find("#neueSeiteOption");
  if (fussnoteoption.length == 0 || neueseiteoption.length == 0) return;
  toggleExportOptionState($(fussnoteoption[0]), istAktiv);
  toggleExportOptionState($(neueseiteoption[0]), istAktiv);
}
function toggleExportOptionState($option, setToActive) {
  const $label = $($option.find("div.exportoption-label"));
  $label.toggleClass("disabled", !setToActive);
  const $icon = $($option.find("a.action"));
  $icon.toggleClass("disabled", !setToActive);
}
function toggleExportButtonForHitlist(setToActive) {
  const exportButton = document.getElementById("PrintExport");
  if (!exportButton) {
    return;
  }
  if (setToActive) {
    exportButton.setAttribute('disabled', '');
    exportButton.parentElement.title = BO.config.druckSettings.exportButtonDisabledTooltip;
  } else {
    exportButton.removeAttribute('disabled');
    exportButton.parentElement.title = BO.config.druckSettings.exportButtonEnabledTooltip;
  }
}
function showProgress($icon) {
  $icon.parent().attr("disabled", "disabled");
  $icon.hide();
  ensureSpinner().show();
}
function hideProgress($icon) {
  ensureSpinner().hide();
  setTimeout(function () {
    $icon.parent().removeAttr("disabled");
  }, 100);
  $icon.show();
}
//# sourceMappingURL=bo-box.js.map
;
const ids = ["btlogout"];
document.addEventListener("DOMContentLoaded", function () {
  ids.forEach(id => {
    const el = document.getElementById(id);
    if (el) {
      el.disabled = false;
      document.getElementById("login-button-div").parentNode.addEventListener("submit", function () {
        el.disabled = true;
        el.classList.add("beck-btn-disabled");
      });
    }
  });
  if (document.getElementById("loginFormId")) {
    const usernameField = document.getElementById("username");
    if (usernameField) {
      usernameField.focus();
      usernameField.addEventListener("keydown", event => {
        if (event.key === "Enter") {
          event.preventDefault();
          onJumpToPassword(usernameField);
        }
      });
    }
  }
});
function onJumpToPassword(usernameField) {
  if (usernameField.value === "") {
    showInputfieldError(usernameField, document.getElementById("user-no-input-msg"));
    return;
  }
  const antiForgeryToken = document.getElementById("loginFormId").querySelector("[name='__RequestVerificationToken']").value;
  const referrer = document.getElementById("next-step-button").getAttribute("data-referrer");
  toggleNextButtonLoader(document.getElementById("next-step-button"));
  $.ajax({
    type: "POST",
    url: "/Konto/CheckRedirectToIDP",
    data: {
      loginName: usernameField.value,
      __RequestVerificationToken: antiForgeryToken
    },
    success: function () {
      toggleNextButtonLoader(document.getElementById("next-step-button"));
      document.getElementById("step-password").addEventListener("transitionend", function () {
        document.getElementById("passwd").focus();
        document.getElementById("step-password").removeEventListener("transitionend", arguments.callee);
      }, false);
      document.getElementById("username-step-2").textContent = usernameField.value;
      document.getElementById("step-password").classList.remove("hidden");
      usernameField.classList.add("hidden");
      // timeout damit die animation funktioniert (!hidden muss erst effekt haben)
      setTimeout(function () {
        document.getElementById("step-username").style.transform = "translateX(-100%)";
        document.getElementById("step-password").style.transform = "translateX(-100%)";
      }, 20);
    },
    statusCode: {
      302: function () {
        const encodedUsername = encodeURIComponent(usernameField.value);
        document.location = "/Konto/IdentityProviderLogin?ursprungsReferrer=" + referrer + "&loginHint=" + encodedUsername;
      }
    },
    error: function (e) {
      if (!e.statusCode === 302) {
        console.error(e.value);
      }
    }
  });
}
function onJumpToUsername() {
  document.getElementById("step-username").addEventListener("transitionend", function () {
    document.getElementById("username").focus();
    document.getElementById("step-username").removeEventListener("transitionend", arguments.callee);
  }, false);
  document.getElementById("passwd").value = "";
  document.getElementById("passwd").dispatchEvent(new Event("input"));
  document.getElementById("step-password").classList.add("hidden");
  document.getElementById("username").classList.remove("hidden");
  document.getElementById("step-username").style.transform = "translateX(0)";
  document.getElementById("step-password").style.transform = "translateX(100%)";
}
function toggleNextButtonLoader(element) {
  if (!element.classList.contains("beck-btn-disabled")) {
    element.classList.add("beck-btn-disabled");
    const span = document.createElement("span");
    span.classList.add("beck-spinner", "beck-spinner-btn", "loading");
    span.role = "status";
    span.ariaHidden = "true";
    element.insertBefore(span, element.firstChild);
  } else {
    element.classList.remove("beck-btn-disabled");
    element.removeChild(element.firstChild);
  }
}
function showInputfieldError(fieldId, errorMsgId) {
  errorMsgId.classList.remove("hidden");
  fieldId.classList.add("validation-error");

  // Remove error class on input
  fieldId.addEventListener("input", function () {
    errorMsgId.classList.add("hidden");
    fieldId.classList.remove("validation-error");
    fieldId.removeEventListener("input", arguments.callee);
  });
}
//# sourceMappingURL=LoginForm.js.map
;
var Ajax = (function () {
    function InsertFirstChildIntoZweispaltenContent(divId) {
        var div = document.createElement("div");
        div.id = divId;
        div.innerHTML = "";
        var zweispaltenContent = document.getElementById("zweispaltencontent");
        if (zweispaltenContent != null)
            zweispaltenContent.insertBefore(div, zweispaltenContent.firstChild);
        else {
            var dreispaltenContent = document.getElementById("dreispaltencontent");
            if (dreispaltenContent != null)
                dreispaltenContent.insertBefore(div, dreispaltenContent.firstChild);
        }
    }

    function InsertFirstChildIntoVerweisContainer(divId) {
        var div = document.createElement("div");
        div.id = divId;
        div.innerHTML = "";

        var verweisContainer = document.getElementById("verweisContainer");
        if (verweisContainer != null)
            verweisContainer.insertBefore(div, verweisContainer.firstChild);
    }

    var result = new function () { };

    result.DoHref = function (href, replacedivarray, completedhandler) {
        wRequest = new Sys.Net.WebRequest();
        wRequest.set_url(href);
        wRequest.set_userContext(replacedivarray);
        wRequest.add_completed(result.OnSucceededAjax);

        if (completedhandler != null)
            wRequest.add_completed(completedhandler);

        wRequest.invoke();
    }

    result.DoFormPost = function (formid, replacedivarray, bodyaddon, callbackFunction, element) {

        var __form = element.getElementById(formid);
        if (__form != null) {
            wRequest = new Sys.Net.WebRequest();
            wRequest.set_httpVerb("POST");
            wRequest.set_url(__form.action);
            var __body = getPostString(__form);

            if (bodyaddon != null)
                __body += "&" + bodyaddon;

            wRequest.set_body(__body);
            wRequest.set_userContext(replacedivarray);
            if (callbackFunction == null)
                wRequest.add_completed(result.OnSucceededAjax);
            else
                wRequest.add_completed(callbackFunction);
            wRequest.invoke();
        }
    }

    result.ReplaceDivs = function (html, divsToReplace) {
        var body = document.createElement('body');

        var bodytext = getBodyInnerHTML(html);

        body.innerHTML = bodytext;

        var sourceDivs = body.getElementsByTagName('div');

        for (var replaceDivsIndex = 0; replaceDivsIndex < divsToReplace.length; replaceDivsIndex++) {
            var id = divsToReplace[replaceDivsIndex];

            var oldElement = document.getElementById(id);
            var newElement = null;

            // Element in Ajax Response suchen
            for (var divIndex = 0; divIndex < sourceDivs.length; divIndex++) {
                var sourceDiv = sourceDivs[divIndex];
                if (sourceDiv.getAttribute('id') != null && sourceDiv.getAttribute('id') == id) {
                    newElement = sourceDiv;
                    break;
                }
            }

            // Element ersetzen oder löschen wenn nicht mehr vorhanden
            if (newElement != null && oldElement != null) {
                oldElement.parentNode.replaceChild(newElement, oldElement);
            }
            else if (newElement == null && oldElement != null) {
                oldElement.parentNode.removeChild(oldElement);
            }

        }
    }

    result.OnSucceededAjax = function (executor, eventArgs) {
        if (executor.get_responseAvailable()) {
            var __html = executor.get_responseData();
            var __usercontext = executor.get_webRequest().get_userContext();

            // ggf. noch die Divs zum ZweispaltenContent hinzufügen
            if (__usercontext != null) {
                for (i = 0; i < __usercontext.length; i++) {
                    var __currentDivId = __usercontext[i];
                    var __currentDiv = document.getElementById(__currentDivId);
                    if (__currentDiv == null) {
                        if (__currentDivId == "verweiszettel-bottom" || __currentDivId == "anmerkzettel-bottom")
                            InsertFirstChildIntoVerweisContainer(__currentDivId);
                        else
                            InsertFirstChildIntoZweispaltenContent(__currentDivId);
                    }
                }
            }

            result.ReplaceDivs(__html, __usercontext);
        }
    }
    return result;
})();
;
/*
Diese Klasse regelt die "neuen" Tooltips von BeckOnline
*/

//___________Benutzerspezifische Funktionen______________

function ToolTipHandler(openDelay, closeDelay) {
  "use strict";

  const tooltipStack = [];
  const clearEventHandlers = function (link) {
    link.off('mouseup mouseleave', handleMouseLeave);
  };
  const clearDestroyDelay = function (link) {
    const timeoutHandle = link.data("closeTimeout");
    if (timeoutHandle) {
      window.clearTimeout(timeoutHandle);
    }
  };
  const clearOpenDelay = function (link) {
    const timeoutHandle = link.data("openTimeout");
    if (timeoutHandle) {
      window.clearTimeout(timeoutHandle);
    }
  };
  const destroyTooltip = function (link) {
    clearOpenDelay(link);
    clearDestroyDelay(link);
    clearEventHandlers(link);
    link.removeClass("hastooltip");
    if (link.tooltip("instance")) {
      link.tooltip('destroy');
    }
    tooltipStack.pop();
  };
  const openTooltip = function (link, contentCallback) {
    link.tooltip({
      items: "a, p, span, i",
      content: function (callback) {
        const sourceLink = $(this);
        return contentCallback(sourceLink, callback);
      },
      open: function (e, ui) {
        const sourceLink = $(this);
        ui.tooltip.hover(function () {
          clearDestroyDelay(sourceLink);
          $(this).stop(true).fadeTo(400, 1);
        }, function () {
          delayDestroyTooltip(sourceLink);
        });
      },
      tooltipClass: "ui-tooltip-content"
    });
    link.tooltip('open');
  };
  const delayOpenTooltip = function (link, contentCallback) {
    // Tooltip Daten erst nach Ablauf des Timeouts laden.
    // Timeout Handle für Target erstellen

    const timeoutHandle = window.setTimeout(openTooltip.bind(null, link, contentCallback), openDelay);
    link.data("openTimeout", timeoutHandle);
  };
  const delayDestroyTooltip = function (link) {
    // Tooltip Daten erst nach Ablauf des Timeouts schließen.
    // Timeout Handle für Target erstellen

    const timeoutHandle = window.setTimeout(destroyTooltip, closeDelay, link);
    link.data("closeTimeout", timeoutHandle);
  };
  const handleMouseLeave = function (e) {
    const link = $(this);
    // Wenn Tooltip bereits angezeigt wird, kurz warten
    if (link.tooltip("instance")) {
      delayDestroyTooltip(link);
    } else {
      destroyTooltip(link);
    }
    link.trigger("toggleIcon");

    // prevent tooltip widget to close the tooltip now
    e.stopImmediatePropagation();
  };

  /**
   * Zeigt einen Tooltip für ein Element.
   * @param {JQuery<HtmlElement>} target Ziel Link Element
   * @param {(link: string, callback: () => string) => string|void} contentCallback Funktion die den Inhalt zurück gibt oder den callback (2. Parameter) aufruft.
   */
  this.showTooltip = function (target, contentCallback, e) {
    const toolTipEventHandler = new OnTooltipInsert();
    toolTipEventHandler.trigger(e);
    clearDestroyDelay(target);

    // Hat bereits einen Tooltip?
    if (target.hasClass("noToolTip") || target.hasClass("hastooltip")) {
      toolTipEventHandler.trigger(e);
      return;
    }

    // Entferne alle Tooltip Instanzen
    destroyTooltip(target);
    this.destroyAllTooltips();

    // EventListener für Tooltips zum neu positionieren von verbuggten/zu langen Tooltips
    toolTipEventHandler.trigger(e);
    target.addClass("hastooltip");
    target.removeAttr("title").children().removeAttr("title");
    target.on('mouseup mouseleave', handleMouseLeave);
    tooltipStack.push(target);
    delayOpenTooltip(target, contentCallback);
  };
  this.destroyAllTooltips = function () {
    tooltipStack.forEach(destroyTooltip);
    $(".ui-tooltip").remove();
  };
}
const OnTooltipInsert = function () {
  const delay = 100;
  const seconds = delay * 10;
  const timeout = 20 * seconds;
  let currentTime = 0;
  let finished = false;
  this.trigger = function (e) {
    finished = false;
    setTimeout(function check() {
      if (document.querySelector('[role="tooltip"]') && !finished) {
        rePositionTooltip(e);
        finished = true;
        return;
      }
      currentTime += delay;
      if (currentTime <= timeout && !finished) {
        setTimeout(check, delay);
      }
    }, delay);
  };
};
function rePositionTooltip(e) {
  const elem = document.querySelector('[role="tooltip"]');
  const currentTop = parseInt(elem.style["top"].replace("px", ""));
  if (currentTop < 0 || e.currentTarget.nodeName === 'svg' && currentTop < 16) {
    const windowBorderX = parseInt(window.innerWidth / 2);
    const offSet = {
      x: 11,
      y: 27
    };
    let tooltipOriginPositionX = e !== null && typeof e !== 'undefined' ? e.clientX : 25;
    if (typeof tooltipOriginPositionX != 'number') {
      tooltipOriginPositionX = tooltipOriginPositionX.replace('px', "");
      tooltipOriginPositionX = parseInt(tooltipOriginPositionX);
    }
    let tooltipOriginPositionY = e !== null && typeof e !== 'undefined' ? e.clientY + offSet.y : 10;
    tooltipOriginPositionY += window.scrollY;
    if (tooltipOriginPositionX >= windowBorderX) {
      const tooltipPropertys = window.getComputedStyle(elem).getPropertyValue('width');
      const tooltipWidth = tooltipPropertys.replace("px", "");
      tooltipOriginPositionX = tooltipOriginPositionX - parseInt(tooltipWidth) - offSet.x;
    } else {
      tooltipOriginPositionX += offSet.x;
    }
    elem.style["top"] = tooltipOriginPositionY.toString() + "px";
    elem.style["left"] = tooltipOriginPositionX.toString() + "px";
    return true;
  }
  return false;
}
//# sourceMappingURL=ToolTip.js.map
;
// Fix for IE 8
if (!Object.create) {
    Object.create = function (o, properties) {
        if (typeof o !== 'object' && typeof o !== 'function') throw new TypeError('Object prototype may only be an Object: ' + o);
        else if (o === null) throw new Error("This browser's implementation of Object.create is a shim and doesn't support 'null' as the first argument.");

        if (typeof properties != 'undefined') throw new Error("This browser's implementation of Object.create is a shim and doesn't support a second argument.");

        function F() { }

        F.prototype = o;

        return new F();
    };
}
// ENDE Fix for IE 8

/*! Hammer.JS - v2.0.8 - 2016-04-23
 * http://hammerjs.github.io/
 *
 * Copyright (c) 2016 Jorik Tangelder;
 * Licensed under the MIT license */
(function(window, document, exportName, undefined) {
  'use strict';

var VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];
var TEST_ELEMENT = document.createElement('div');

var TYPE_FUNCTION = 'function';

var round = Math.round;
var abs = Math.abs;
var now = Date.now;

/**
 * set a timeout with a given scope
 * @param {Function} fn
 * @param {Number} timeout
 * @param {Object} context
 * @returns {number}
 */
function setTimeoutContext(fn, timeout, context) {
    return setTimeout(bindFn(fn, context), timeout);
}

/**
 * if the argument is an array, we want to execute the fn on each entry
 * if it aint an array we don't want to do a thing.
 * this is used by all the methods that accept a single and array argument.
 * @param {*|Array} arg
 * @param {String} fn
 * @param {Object} [context]
 * @returns {Boolean}
 */
function invokeArrayArg(arg, fn, context) {
    if (Array.isArray(arg)) {
        each(arg, context[fn], context);
        return true;
    }
    return false;
}

/**
 * walk objects and arrays
 * @param {Object} obj
 * @param {Function} iterator
 * @param {Object} context
 */
function each(obj, iterator, context) {
    var i;

    if (!obj) {
        return;
    }

    if (obj.forEach) {
        obj.forEach(iterator, context);
    } else if (obj.length !== undefined) {
        i = 0;
        while (i < obj.length) {
            iterator.call(context, obj[i], i, obj);
            i++;
        }
    } else {
        for (i in obj) {
            obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);
        }
    }
}

/**
 * wrap a method with a deprecation warning and stack trace
 * @param {Function} method
 * @param {String} name
 * @param {String} message
 * @returns {Function} A new function wrapping the supplied method.
 */
function deprecate(method, name, message) {
    var deprecationMessage = 'DEPRECATED METHOD: ' + name + '\n' + message + ' AT \n';
    return function() {
        var e = new Error('get-stack-trace');
        var stack = e && e.stack ? e.stack.replace(/^[^\(]+?[\n$]/gm, '')
            .replace(/^\s+at\s+/gm, '')
            .replace(/^Object.<anonymous>\s*\(/gm, '{anonymous}()@') : 'Unknown Stack Trace';

        var log = window.console && (window.console.warn || window.console.log);
        if (log) {
            log.call(window.console, deprecationMessage, stack);
        }
        return method.apply(this, arguments);
    };
}

/**
 * extend object.
 * means that properties in dest will be overwritten by the ones in src.
 * @param {Object} target
 * @param {...Object} objects_to_assign
 * @returns {Object} target
 */
var assign;
if (typeof Object.assign !== 'function') {
    assign = function assign(target) {
        if (target === undefined || target === null) {
            throw new TypeError('Cannot convert undefined or null to object');
        }

        var output = Object(target);
        for (var index = 1; index < arguments.length; index++) {
            var source = arguments[index];
            if (source !== undefined && source !== null) {
                for (var nextKey in source) {
                    if (source.hasOwnProperty(nextKey)) {
                        output[nextKey] = source[nextKey];
                    }
                }
            }
        }
        return output;
    };
} else {
    assign = Object.assign;
}

/**
 * extend object.
 * means that properties in dest will be overwritten by the ones in src.
 * @param {Object} dest
 * @param {Object} src
 * @param {Boolean} [merge=false]
 * @returns {Object} dest
 */
var extend = deprecate(function extend(dest, src, merge) {
    var keys = Object.keys(src);
    var i = 0;
    while (i < keys.length) {
        if (!merge || (merge && dest[keys[i]] === undefined)) {
            dest[keys[i]] = src[keys[i]];
        }
        i++;
    }
    return dest;
}, 'extend', 'Use `assign`.');

/**
 * merge the values from src in the dest.
 * means that properties that exist in dest will not be overwritten by src
 * @param {Object} dest
 * @param {Object} src
 * @returns {Object} dest
 */
var merge = deprecate(function merge(dest, src) {
    return extend(dest, src, true);
}, 'merge', 'Use `assign`.');

/**
 * simple class inheritance
 * @param {Function} child
 * @param {Function} base
 * @param {Object} [properties]
 */
function inherit(child, base, properties) {
    var baseP = base.prototype,
        childP;

    childP = child.prototype = Object.create(baseP);
    childP.constructor = child;
    childP._super = baseP;

    if (properties) {
        assign(childP, properties);
    }
}

/**
 * simple function bind
 * @param {Function} fn
 * @param {Object} context
 * @returns {Function}
 */
function bindFn(fn, context) {
    return function boundFn() {
        return fn.apply(context, arguments);
    };
}

/**
 * let a boolean value also be a function that must return a boolean
 * this first item in args will be used as the context
 * @param {Boolean|Function} val
 * @param {Array} [args]
 * @returns {Boolean}
 */
function boolOrFn(val, args) {
    if (typeof val == TYPE_FUNCTION) {
        return val.apply(args ? args[0] || undefined : undefined, args);
    }
    return val;
}

/**
 * use the val2 when val1 is undefined
 * @param {*} val1
 * @param {*} val2
 * @returns {*}
 */
function ifUndefined(val1, val2) {
    return (val1 === undefined) ? val2 : val1;
}

/**
 * addEventListener with multiple events at once
 * @param {EventTarget} target
 * @param {String} types
 * @param {Function} handler
 */
function addEventListeners(target, types, handler) {
    each(splitStr(types), function(type) {
        target.addEventListener(type, handler, false);
    });
}

/**
 * removeEventListener with multiple events at once
 * @param {EventTarget} target
 * @param {String} types
 * @param {Function} handler
 */
function removeEventListeners(target, types, handler) {
    each(splitStr(types), function(type) {
        target.removeEventListener(type, handler, false);
    });
}

/**
 * find if a node is in the given parent
 * @method hasParent
 * @param {HTMLElement} node
 * @param {HTMLElement} parent
 * @return {Boolean} found
 */
function hasParent(node, parent) {
    while (node) {
        if (node == parent) {
            return true;
        }
        node = node.parentNode;
    }
    return false;
}

/**
 * small indexOf wrapper
 * @param {String} str
 * @param {String} find
 * @returns {Boolean} found
 */
function inStr(str, find) {
    return str.indexOf(find) > -1;
}

/**
 * split string on whitespace
 * @param {String} str
 * @returns {Array} words
 */
function splitStr(str) {
    return str.trim().split(/\s+/g);
}

/**
 * find if a array contains the object using indexOf or a simple polyFill
 * @param {Array} src
 * @param {String} find
 * @param {String} [findByKey]
 * @return {Boolean|Number} false when not found, or the index
 */
function inArray(src, find, findByKey) {
    if (src.indexOf && !findByKey) {
        return src.indexOf(find);
    } else {
        var i = 0;
        while (i < src.length) {
            if ((findByKey && src[i][findByKey] == find) || (!findByKey && src[i] === find)) {
                return i;
            }
            i++;
        }
        return -1;
    }
}

/**
 * convert array-like objects to real arrays
 * @param {Object} obj
 * @returns {Array}
 */
function toArray(obj) {
    return Array.prototype.slice.call(obj, 0);
}

/**
 * unique array with objects based on a key (like 'id') or just by the array's value
 * @param {Array} src [{id:1},{id:2},{id:1}]
 * @param {String} [key]
 * @param {Boolean} [sort=False]
 * @returns {Array} [{id:1},{id:2}]
 */
function uniqueArray(src, key, sort) {
    var results = [];
    var values = [];
    var i = 0;

    while (i < src.length) {
        var val = key ? src[i][key] : src[i];
        if (inArray(values, val) < 0) {
            results.push(src[i]);
        }
        values[i] = val;
        i++;
    }

    if (sort) {
        if (!key) {
            results = results.sort();
        } else {
            results = results.sort(function sortUniqueArray(a, b) {
                return a[key] > b[key];
            });
        }
    }

    return results;
}

/**
 * get the prefixed property
 * @param {Object} obj
 * @param {String} property
 * @returns {String|Undefined} prefixed
 */
function prefixed(obj, property) {
    var prefix, prop;
    var camelProp = property[0].toUpperCase() + property.slice(1);

    var i = 0;
    while (i < VENDOR_PREFIXES.length) {
        prefix = VENDOR_PREFIXES[i];
        prop = (prefix) ? prefix + camelProp : property;

        if (prop in obj) {
            return prop;
        }
        i++;
    }
    return undefined;
}

/**
 * get a unique id
 * @returns {number} uniqueId
 */
var _uniqueId = 1;
function uniqueId() {
    return _uniqueId++;
}

/**
 * get the window object of an element
 * @param {HTMLElement} element
 * @returns {DocumentView|Window}
 */
function getWindowForElement(element) {
    var doc = element.ownerDocument || element;
    return (doc.defaultView || doc.parentWindow || window);
}

var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;

var SUPPORT_TOUCH = ('ontouchstart' in window);
var SUPPORT_POINTER_EVENTS = prefixed(window, 'PointerEvent') !== undefined;
var SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);

var INPUT_TYPE_TOUCH = 'touch';
var INPUT_TYPE_PEN = 'pen';
var INPUT_TYPE_MOUSE = 'mouse';
var INPUT_TYPE_KINECT = 'kinect';

var COMPUTE_INTERVAL = 25;

var INPUT_START = 1;
var INPUT_MOVE = 2;
var INPUT_END = 4;
var INPUT_CANCEL = 8;

var DIRECTION_NONE = 1;
var DIRECTION_LEFT = 2;
var DIRECTION_RIGHT = 4;
var DIRECTION_UP = 8;
var DIRECTION_DOWN = 16;

var DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;
var DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;
var DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;

var PROPS_XY = ['x', 'y'];
var PROPS_CLIENT_XY = ['clientX', 'clientY'];

/**
 * create new input type manager
 * @param {Manager} manager
 * @param {Function} callback
 * @returns {Input}
 * @constructor
 */
function Input(manager, callback) {
    var self = this;
    this.manager = manager;
    this.callback = callback;
    this.element = manager.element;
    this.target = manager.options.inputTarget;

    // smaller wrapper around the handler, for the scope and the enabled state of the manager,
    // so when disabled the input events are completely bypassed.
    this.domHandler = function(ev) {
        if (boolOrFn(manager.options.enable, [manager])) {
            self.handler(ev);
        }
    };

    this.init();

}

Input.prototype = {
    /**
     * should handle the inputEvent data and trigger the callback
     * @virtual
     */
    handler: function() { },

    /**
     * bind the events
     */
    init: function() {
        this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);
        this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);
        this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
    },

    /**
     * unbind the events
     */
    destroy: function() {
        this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);
        this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);
        this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
    }
};

/**
 * create new input type manager
 * called by the Manager constructor
 * @param {Hammer} manager
 * @returns {Input}
 */
function createInputInstance(manager) {
    var Type;
    var inputClass = manager.options.inputClass;

    if (inputClass) {
        Type = inputClass;
    } else if (SUPPORT_POINTER_EVENTS) {
        Type = PointerEventInput;
    } else if (SUPPORT_ONLY_TOUCH) {
        Type = TouchInput;
    } else if (!SUPPORT_TOUCH) {
        Type = MouseInput;
    } else {
        Type = TouchMouseInput;
    }
    return new (Type)(manager, inputHandler);
}

/**
 * handle input events
 * @param {Manager} manager
 * @param {String} eventType
 * @param {Object} input
 */
function inputHandler(manager, eventType, input) {
    var pointersLen = input.pointers.length;
    var changedPointersLen = input.changedPointers.length;
    var isFirst = (eventType & INPUT_START && (pointersLen - changedPointersLen === 0));
    var isFinal = (eventType & (INPUT_END | INPUT_CANCEL) && (pointersLen - changedPointersLen === 0));

    input.isFirst = !!isFirst;
    input.isFinal = !!isFinal;

    if (isFirst) {
        manager.session = {};
    }

    // source event is the normalized value of the domEvents
    // like 'touchstart, mouseup, pointerdown'
    input.eventType = eventType;

    // compute scale, rotation etc
    computeInputData(manager, input);

    // emit secret event
    manager.emit('hammer.input', input);

    manager.recognize(input);
    manager.session.prevInput = input;
}

/**
 * extend the data with some usable properties like scale, rotate, velocity etc
 * @param {Object} manager
 * @param {Object} input
 */
function computeInputData(manager, input) {
    var session = manager.session;
    var pointers = input.pointers;
    var pointersLength = pointers.length;

    // store the first input to calculate the distance and direction
    if (!session.firstInput) {
        session.firstInput = simpleCloneInputData(input);
    }

    // to compute scale and rotation we need to store the multiple touches
    if (pointersLength > 1 && !session.firstMultiple) {
        session.firstMultiple = simpleCloneInputData(input);
    } else if (pointersLength === 1) {
        session.firstMultiple = false;
    }

    var firstInput = session.firstInput;
    var firstMultiple = session.firstMultiple;
    var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;

    var center = input.center = getCenter(pointers);
    input.timeStamp = now();
    input.deltaTime = input.timeStamp - firstInput.timeStamp;

    input.angle = getAngle(offsetCenter, center);
    input.distance = getDistance(offsetCenter, center);

    computeDeltaXY(session, input);
    input.offsetDirection = getDirection(input.deltaX, input.deltaY);

    var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);
    input.overallVelocityX = overallVelocity.x;
    input.overallVelocityY = overallVelocity.y;
    input.overallVelocity = (abs(overallVelocity.x) > abs(overallVelocity.y)) ? overallVelocity.x : overallVelocity.y;

    input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;
    input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;

    input.maxPointers = !session.prevInput ? input.pointers.length : ((input.pointers.length >
        session.prevInput.maxPointers) ? input.pointers.length : session.prevInput.maxPointers);

    computeIntervalInputData(session, input);

    // find the correct target
    var target = manager.element;
    if (hasParent(input.srcEvent.target, target)) {
        target = input.srcEvent.target;
    }
    input.target = target;
}

function computeDeltaXY(session, input) {
    var center = input.center;
    var offset = session.offsetDelta || {};
    var prevDelta = session.prevDelta || {};
    var prevInput = session.prevInput || {};

    if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {
        prevDelta = session.prevDelta = {
            x: prevInput.deltaX || 0,
            y: prevInput.deltaY || 0
        };

        offset = session.offsetDelta = {
            x: center.x,
            y: center.y
        };
    }

    input.deltaX = prevDelta.x + (center.x - offset.x);
    input.deltaY = prevDelta.y + (center.y - offset.y);
}

/**
 * velocity is calculated every x ms
 * @param {Object} session
 * @param {Object} input
 */
function computeIntervalInputData(session, input) {
    var last = session.lastInterval || input,
        deltaTime = input.timeStamp - last.timeStamp,
        velocity, velocityX, velocityY, direction;

    if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {
        var deltaX = input.deltaX - last.deltaX;
        var deltaY = input.deltaY - last.deltaY;

        var v = getVelocity(deltaTime, deltaX, deltaY);
        velocityX = v.x;
        velocityY = v.y;
        velocity = (abs(v.x) > abs(v.y)) ? v.x : v.y;
        direction = getDirection(deltaX, deltaY);

        session.lastInterval = input;
    } else {
        // use latest velocity info if it doesn't overtake a minimum period
        velocity = last.velocity;
        velocityX = last.velocityX;
        velocityY = last.velocityY;
        direction = last.direction;
    }

    input.velocity = velocity;
    input.velocityX = velocityX;
    input.velocityY = velocityY;
    input.direction = direction;
}

/**
 * create a simple clone from the input used for storage of firstInput and firstMultiple
 * @param {Object} input
 * @returns {Object} clonedInputData
 */
function simpleCloneInputData(input) {
    // make a simple copy of the pointers because we will get a reference if we don't
    // we only need clientXY for the calculations
    var pointers = [];
    var i = 0;
    while (i < input.pointers.length) {
        pointers[i] = {
            clientX: round(input.pointers[i].clientX),
            clientY: round(input.pointers[i].clientY)
        };
        i++;
    }

    return {
        timeStamp: now(),
        pointers: pointers,
        center: getCenter(pointers),
        deltaX: input.deltaX,
        deltaY: input.deltaY
    };
}

/**
 * get the center of all the pointers
 * @param {Array} pointers
 * @return {Object} center contains `x` and `y` properties
 */
function getCenter(pointers) {
    var pointersLength = pointers.length;

    // no need to loop when only one touch
    if (pointersLength === 1) {
        return {
            x: round(pointers[0].clientX),
            y: round(pointers[0].clientY)
        };
    }

    var x = 0, y = 0, i = 0;
    while (i < pointersLength) {
        x += pointers[i].clientX;
        y += pointers[i].clientY;
        i++;
    }

    return {
        x: round(x / pointersLength),
        y: round(y / pointersLength)
    };
}

/**
 * calculate the velocity between two points. unit is in px per ms.
 * @param {Number} deltaTime
 * @param {Number} x
 * @param {Number} y
 * @return {Object} velocity `x` and `y`
 */
function getVelocity(deltaTime, x, y) {
    return {
        x: x / deltaTime || 0,
        y: y / deltaTime || 0
    };
}

/**
 * get the direction between two points
 * @param {Number} x
 * @param {Number} y
 * @return {Number} direction
 */
function getDirection(x, y) {
    if (x === y) {
        return DIRECTION_NONE;
    }

    if (abs(x) >= abs(y)) {
        return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;
    }
    return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;
}

/**
 * calculate the absolute distance between two points
 * @param {Object} p1 {x, y}
 * @param {Object} p2 {x, y}
 * @param {Array} [props] containing x and y keys
 * @return {Number} distance
 */
function getDistance(p1, p2, props) {
    if (!props) {
        props = PROPS_XY;
    }
    var x = p2[props[0]] - p1[props[0]],
        y = p2[props[1]] - p1[props[1]];

    return Math.sqrt((x * x) + (y * y));
}

/**
 * calculate the angle between two coordinates
 * @param {Object} p1
 * @param {Object} p2
 * @param {Array} [props] containing x and y keys
 * @return {Number} angle
 */
function getAngle(p1, p2, props) {
    if (!props) {
        props = PROPS_XY;
    }
    var x = p2[props[0]] - p1[props[0]],
        y = p2[props[1]] - p1[props[1]];
    return Math.atan2(y, x) * 180 / Math.PI;
}

/**
 * calculate the rotation degrees between two pointersets
 * @param {Array} start array of pointers
 * @param {Array} end array of pointers
 * @return {Number} rotation
 */
function getRotation(start, end) {
    return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);
}

/**
 * calculate the scale factor between two pointersets
 * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out
 * @param {Array} start array of pointers
 * @param {Array} end array of pointers
 * @return {Number} scale
 */
function getScale(start, end) {
    return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);
}

var MOUSE_INPUT_MAP = {
    mousedown: INPUT_START,
    mousemove: INPUT_MOVE,
    mouseup: INPUT_END
};

var MOUSE_ELEMENT_EVENTS = 'mousedown';
var MOUSE_WINDOW_EVENTS = 'mousemove mouseup';

/**
 * Mouse events input
 * @constructor
 * @extends Input
 */
function MouseInput() {
    this.evEl = MOUSE_ELEMENT_EVENTS;
    this.evWin = MOUSE_WINDOW_EVENTS;

    this.pressed = false; // mousedown state

    Input.apply(this, arguments);
}

inherit(MouseInput, Input, {
    /**
     * handle mouse events
     * @param {Object} ev
     */
    handler: function MEhandler(ev) {
        var eventType = MOUSE_INPUT_MAP[ev.type];

        // on start we want to have the left mouse button down
        if (eventType & INPUT_START && ev.button === 0) {
            this.pressed = true;
        }

        if (eventType & INPUT_MOVE && ev.which !== 1) {
            eventType = INPUT_END;
        }

        // mouse must be down
        if (!this.pressed) {
            return;
        }

        if (eventType & INPUT_END) {
            this.pressed = false;
        }

        this.callback(this.manager, eventType, {
            pointers: [ev],
            changedPointers: [ev],
            pointerType: INPUT_TYPE_MOUSE,
            srcEvent: ev
        });
    }
});

var POINTER_INPUT_MAP = {
    pointerdown: INPUT_START,
    pointermove: INPUT_MOVE,
    pointerup: INPUT_END,
    pointercancel: INPUT_CANCEL,
    pointerout: INPUT_CANCEL
};

// in IE10 the pointer types is defined as an enum
var IE10_POINTER_TYPE_ENUM = {
    2: INPUT_TYPE_TOUCH,
    3: INPUT_TYPE_PEN,
    4: INPUT_TYPE_MOUSE,
    5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816
};

var POINTER_ELEMENT_EVENTS = 'pointerdown';
var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel';

// IE10 has prefixed support, and case-sensitive
if (window.MSPointerEvent && !window.PointerEvent) {
    POINTER_ELEMENT_EVENTS = 'MSPointerDown';
    POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';
}

/**
 * Pointer events input
 * @constructor
 * @extends Input
 */
function PointerEventInput() {
    this.evEl = POINTER_ELEMENT_EVENTS;
    this.evWin = POINTER_WINDOW_EVENTS;

    Input.apply(this, arguments);

    this.store = (this.manager.session.pointerEvents = []);
}

inherit(PointerEventInput, Input, {
    /**
     * handle mouse events
     * @param {Object} ev
     */
    handler: function PEhandler(ev) {
        var store = this.store;
        var removePointer = false;

        var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');
        var eventType = POINTER_INPUT_MAP[eventTypeNormalized];
        var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;

        var isTouch = (pointerType == INPUT_TYPE_TOUCH);

        // get index of the event in the store
        var storeIndex = inArray(store, ev.pointerId, 'pointerId');

        // start and mouse must be down
        if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {
            if (storeIndex < 0) {
                store.push(ev);
                storeIndex = store.length - 1;
            }
        } else if (eventType & (INPUT_END | INPUT_CANCEL)) {
            removePointer = true;
        }

        // it not found, so the pointer hasn't been down (so it's probably a hover)
        if (storeIndex < 0) {
            return;
        }

        // update the event in the store
        store[storeIndex] = ev;

        this.callback(this.manager, eventType, {
            pointers: store,
            changedPointers: [ev],
            pointerType: pointerType,
            srcEvent: ev
        });

        if (removePointer) {
            // remove from the store
            store.splice(storeIndex, 1);
        }
    }
});

var SINGLE_TOUCH_INPUT_MAP = {
    touchstart: INPUT_START,
    touchmove: INPUT_MOVE,
    touchend: INPUT_END,
    touchcancel: INPUT_CANCEL
};

var SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';
var SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';

/**
 * Touch events input
 * @constructor
 * @extends Input
 */
function SingleTouchInput() {
    this.evTarget = SINGLE_TOUCH_TARGET_EVENTS;
    this.evWin = SINGLE_TOUCH_WINDOW_EVENTS;
    this.started = false;

    Input.apply(this, arguments);
}

inherit(SingleTouchInput, Input, {
    handler: function TEhandler(ev) {
        var type = SINGLE_TOUCH_INPUT_MAP[ev.type];

        // should we handle the touch events?
        if (type === INPUT_START) {
            this.started = true;
        }

        if (!this.started) {
            return;
        }

        var touches = normalizeSingleTouches.call(this, ev, type);

        // when done, reset the started state
        if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {
            this.started = false;
        }

        this.callback(this.manager, type, {
            pointers: touches[0],
            changedPointers: touches[1],
            pointerType: INPUT_TYPE_TOUCH,
            srcEvent: ev
        });
    }
});

/**
 * @this {TouchInput}
 * @param {Object} ev
 * @param {Number} type flag
 * @returns {undefined|Array} [all, changed]
 */
function normalizeSingleTouches(ev, type) {
    var all = toArray(ev.touches);
    var changed = toArray(ev.changedTouches);

    if (type & (INPUT_END | INPUT_CANCEL)) {
        all = uniqueArray(all.concat(changed), 'identifier', true);
    }

    return [all, changed];
}

var TOUCH_INPUT_MAP = {
    touchstart: INPUT_START,
    touchmove: INPUT_MOVE,
    touchend: INPUT_END,
    touchcancel: INPUT_CANCEL
};

var TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';

/**
 * Multi-user touch events input
 * @constructor
 * @extends Input
 */
function TouchInput() {
    this.evTarget = TOUCH_TARGET_EVENTS;
    this.targetIds = {};

    Input.apply(this, arguments);
}

inherit(TouchInput, Input, {
    handler: function MTEhandler(ev) {
        var type = TOUCH_INPUT_MAP[ev.type];
        var touches = getTouches.call(this, ev, type);
        if (!touches) {
            return;
        }

        this.callback(this.manager, type, {
            pointers: touches[0],
            changedPointers: touches[1],
            pointerType: INPUT_TYPE_TOUCH,
            srcEvent: ev
        });
    }
});

/**
 * @this {TouchInput}
 * @param {Object} ev
 * @param {Number} type flag
 * @returns {undefined|Array} [all, changed]
 */
function getTouches(ev, type) {
    var allTouches = toArray(ev.touches);
    var targetIds = this.targetIds;

    // when there is only one touch, the process can be simplified
    if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {
        targetIds[allTouches[0].identifier] = true;
        return [allTouches, allTouches];
    }

    var i,
        targetTouches,
        changedTouches = toArray(ev.changedTouches),
        changedTargetTouches = [],
        target = this.target;

    // get target touches from touches
    targetTouches = allTouches.filter(function(touch) {
        return hasParent(touch.target, target);
    });

    // collect touches
    if (type === INPUT_START) {
        i = 0;
        while (i < targetTouches.length) {
            targetIds[targetTouches[i].identifier] = true;
            i++;
        }
    }

    // filter changed touches to only contain touches that exist in the collected target ids
    i = 0;
    while (i < changedTouches.length) {
        if (targetIds[changedTouches[i].identifier]) {
            changedTargetTouches.push(changedTouches[i]);
        }

        // cleanup removed touches
        if (type & (INPUT_END | INPUT_CANCEL)) {
            delete targetIds[changedTouches[i].identifier];
        }
        i++;
    }

    if (!changedTargetTouches.length) {
        return;
    }

    return [
        // merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'
        uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true),
        changedTargetTouches
    ];
}

/**
 * Combined touch and mouse input
 *
 * Touch has a higher priority then mouse, and while touching no mouse events are allowed.
 * This because touch devices also emit mouse events while doing a touch.
 *
 * @constructor
 * @extends Input
 */

var DEDUP_TIMEOUT = 2500;
var DEDUP_DISTANCE = 25;

function TouchMouseInput() {
    Input.apply(this, arguments);

    var handler = bindFn(this.handler, this);
    this.touch = new TouchInput(this.manager, handler);
    this.mouse = new MouseInput(this.manager, handler);

    this.primaryTouch = null;
    this.lastTouches = [];
}

inherit(TouchMouseInput, Input, {
    /**
     * handle mouse and touch events
     * @param {Hammer} manager
     * @param {String} inputEvent
     * @param {Object} inputData
     */
    handler: function TMEhandler(manager, inputEvent, inputData) {
        var isTouch = (inputData.pointerType == INPUT_TYPE_TOUCH),
            isMouse = (inputData.pointerType == INPUT_TYPE_MOUSE);

        if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) {
            return;
        }

        // when we're in a touch event, record touches to  de-dupe synthetic mouse event
        if (isTouch) {
            recordTouches.call(this, inputEvent, inputData);
        } else if (isMouse && isSyntheticEvent.call(this, inputData)) {
            return;
        }

        this.callback(manager, inputEvent, inputData);
    },

    /**
     * remove the event listeners
     */
    destroy: function destroy() {
        this.touch.destroy();
        this.mouse.destroy();
    }
});

function recordTouches(eventType, eventData) {
    if (eventType & INPUT_START) {
        this.primaryTouch = eventData.changedPointers[0].identifier;
        setLastTouch.call(this, eventData);
    } else if (eventType & (INPUT_END | INPUT_CANCEL)) {
        setLastTouch.call(this, eventData);
    }
}

function setLastTouch(eventData) {
    var touch = eventData.changedPointers[0];

    if (touch.identifier === this.primaryTouch) {
        var lastTouch = {x: touch.clientX, y: touch.clientY};
        this.lastTouches.push(lastTouch);
        var lts = this.lastTouches;
        var removeLastTouch = function() {
            var i = lts.indexOf(lastTouch);
            if (i > -1) {
                lts.splice(i, 1);
            }
        };
        setTimeout(removeLastTouch, DEDUP_TIMEOUT);
    }
}

function isSyntheticEvent(eventData) {
    var x = eventData.srcEvent.clientX, y = eventData.srcEvent.clientY;
    for (var i = 0; i < this.lastTouches.length; i++) {
        var t = this.lastTouches[i];
        var dx = Math.abs(x - t.x), dy = Math.abs(y - t.y);
        if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) {
            return true;
        }
    }
    return false;
}

var PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');
var NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;

// magical touchAction value
var TOUCH_ACTION_COMPUTE = 'compute';
var TOUCH_ACTION_AUTO = 'auto';
var TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented
var TOUCH_ACTION_NONE = 'none';
var TOUCH_ACTION_PAN_X = 'pan-x';
var TOUCH_ACTION_PAN_Y = 'pan-y';
var TOUCH_ACTION_MAP = getTouchActionProps();

/**
 * Touch Action
 * sets the touchAction property or uses the js alternative
 * @param {Manager} manager
 * @param {String} value
 * @constructor
 */
function TouchAction(manager, value) {
    this.manager = manager;
    this.set(value);
}

TouchAction.prototype = {
    /**
     * set the touchAction value on the element or enable the polyfill
     * @param {String} value
     */
    set: function(value) {
        // find out the touch-action by the event handlers
        if (value == TOUCH_ACTION_COMPUTE) {
            value = this.compute();
        }

        if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) {
            this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;
        }
        this.actions = value.toLowerCase().trim();
    },

    /**
     * just re-set the touchAction value
     */
    update: function() {
        this.set(this.manager.options.touchAction);
    },

    /**
     * compute the value for the touchAction property based on the recognizer's settings
     * @returns {String} value
     */
    compute: function() {
        var actions = [];
        each(this.manager.recognizers, function(recognizer) {
            if (boolOrFn(recognizer.options.enable, [recognizer])) {
                actions = actions.concat(recognizer.getTouchAction());
            }
        });
        return cleanTouchActions(actions.join(' '));
    },

    /**
     * this method is called on each input cycle and provides the preventing of the browser behavior
     * @param {Object} input
     */
    preventDefaults: function(input) {
        var srcEvent = input.srcEvent;
        var direction = input.offsetDirection;

        // if the touch action did prevented once this session
        if (this.manager.session.prevented) {
            srcEvent.preventDefault();
            return;
        }

        var actions = this.actions;
        var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE];
        var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y];
        var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X];

        if (hasNone) {
            //do not prevent defaults if this is a tap gesture

            var isTapPointer = input.pointers.length === 1;
            var isTapMovement = input.distance < 2;
            var isTapTouchTime = input.deltaTime < 250;

            if (isTapPointer && isTapMovement && isTapTouchTime) {
                return;
            }
        }

        if (hasPanX && hasPanY) {
            // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent
            return;
        }

        if (hasNone ||
            (hasPanY && direction & DIRECTION_HORIZONTAL) ||
            (hasPanX && direction & DIRECTION_VERTICAL)) {
            return this.preventSrc(srcEvent);
        }
    },

    /**
     * call preventDefault to prevent the browser's default behavior (scrolling in most cases)
     * @param {Object} srcEvent
     */
    preventSrc: function(srcEvent) {
        this.manager.session.prevented = true;
        srcEvent.preventDefault();
    }
};

/**
 * when the touchActions are collected they are not a valid value, so we need to clean things up. *
 * @param {String} actions
 * @returns {*}
 */
function cleanTouchActions(actions) {
    // none
    if (inStr(actions, TOUCH_ACTION_NONE)) {
        return TOUCH_ACTION_NONE;
    }

    var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);
    var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);

    // if both pan-x and pan-y are set (different recognizers
    // for different directions, e.g. horizontal pan but vertical swipe?)
    // we need none (as otherwise with pan-x pan-y combined none of these
    // recognizers will work, since the browser would handle all panning
    if (hasPanX && hasPanY) {
        return TOUCH_ACTION_NONE;
    }

    // pan-x OR pan-y
    if (hasPanX || hasPanY) {
        return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;
    }

    // manipulation
    if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {
        return TOUCH_ACTION_MANIPULATION;
    }

    return TOUCH_ACTION_AUTO;
}

function getTouchActionProps() {
    if (!NATIVE_TOUCH_ACTION) {
        return false;
    }
    var touchMap = {};
    var cssSupports = window.CSS && window.CSS.supports;
    ['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(function(val) {

        // If css.supports is not supported but there is native touch-action assume it supports
        // all values. This is the case for IE 10 and 11.
        touchMap[val] = cssSupports ? window.CSS.supports('touch-action', val) : true;
    });
    return touchMap;
}

/**
 * Recognizer flow explained; *
 * All recognizers have the initial state of POSSIBLE when a input session starts.
 * The definition of a input session is from the first input until the last input, with all it's movement in it. *
 * Example session for mouse-input: mousedown -> mousemove -> mouseup
 *
 * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed
 * which determines with state it should be.
 *
 * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to
 * POSSIBLE to give it another change on the next cycle.
 *
 *               Possible
 *                  |
 *            +-----+---------------+
 *            |                     |
 *      +-----+-----+               |
 *      |           |               |
 *   Failed      Cancelled          |
 *                          +-------+------+
 *                          |              |
 *                      Recognized       Began
 *                                         |
 *                                      Changed
 *                                         |
 *                                  Ended/Recognized
 */
var STATE_POSSIBLE = 1;
var STATE_BEGAN = 2;
var STATE_CHANGED = 4;
var STATE_ENDED = 8;
var STATE_RECOGNIZED = STATE_ENDED;
var STATE_CANCELLED = 16;
var STATE_FAILED = 32;

/**
 * Recognizer
 * Every recognizer needs to extend from this class.
 * @constructor
 * @param {Object} options
 */
function Recognizer(options) {
    this.options = assign({}, this.defaults, options || {});

    this.id = uniqueId();

    this.manager = null;

    // default is enable true
    this.options.enable = ifUndefined(this.options.enable, true);

    this.state = STATE_POSSIBLE;

    this.simultaneous = {};
    this.requireFail = [];
}

Recognizer.prototype = {
    /**
     * @virtual
     * @type {Object}
     */
    defaults: {},

    /**
     * set options
     * @param {Object} options
     * @return {Recognizer}
     */
    set: function(options) {
        assign(this.options, options);

        // also update the touchAction, in case something changed about the directions/enabled state
        this.manager && this.manager.touchAction.update();
        return this;
    },

    /**
     * recognize simultaneous with an other recognizer.
     * @param {Recognizer} otherRecognizer
     * @returns {Recognizer} this
     */
    recognizeWith: function(otherRecognizer) {
        if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {
            return this;
        }

        var simultaneous = this.simultaneous;
        otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
        if (!simultaneous[otherRecognizer.id]) {
            simultaneous[otherRecognizer.id] = otherRecognizer;
            otherRecognizer.recognizeWith(this);
        }
        return this;
    },

    /**
     * drop the simultaneous link. it doesnt remove the link on the other recognizer.
     * @param {Recognizer} otherRecognizer
     * @returns {Recognizer} this
     */
    dropRecognizeWith: function(otherRecognizer) {
        if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {
            return this;
        }

        otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
        delete this.simultaneous[otherRecognizer.id];
        return this;
    },

    /**
     * recognizer can only run when an other is failing
     * @param {Recognizer} otherRecognizer
     * @returns {Recognizer} this
     */
    requireFailure: function(otherRecognizer) {
        if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {
            return this;
        }

        var requireFail = this.requireFail;
        otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
        if (inArray(requireFail, otherRecognizer) === -1) {
            requireFail.push(otherRecognizer);
            otherRecognizer.requireFailure(this);
        }
        return this;
    },

    /**
     * drop the requireFailure link. it does not remove the link on the other recognizer.
     * @param {Recognizer} otherRecognizer
     * @returns {Recognizer} this
     */
    dropRequireFailure: function(otherRecognizer) {
        if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {
            return this;
        }

        otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
        var index = inArray(this.requireFail, otherRecognizer);
        if (index > -1) {
            this.requireFail.splice(index, 1);
        }
        return this;
    },

    /**
     * has require failures boolean
     * @returns {boolean}
     */
    hasRequireFailures: function() {
        return this.requireFail.length > 0;
    },

    /**
     * if the recognizer can recognize simultaneous with an other recognizer
     * @param {Recognizer} otherRecognizer
     * @returns {Boolean}
     */
    canRecognizeWith: function(otherRecognizer) {
        return !!this.simultaneous[otherRecognizer.id];
    },

    /**
     * You should use `tryEmit` instead of `emit` directly to check
     * that all the needed recognizers has failed before emitting.
     * @param {Object} input
     */
    emit: function(input) {
        var self = this;
        var state = this.state;

        function emit(event) {
            self.manager.emit(event, input);
        }

        // 'panstart' and 'panmove'
        if (state < STATE_ENDED) {
            emit(self.options.event + stateStr(state));
        }

        emit(self.options.event); // simple 'eventName' events

        if (input.additionalEvent) { // additional event(panleft, panright, pinchin, pinchout...)
            emit(input.additionalEvent);
        }

        // panend and pancancel
        if (state >= STATE_ENDED) {
            emit(self.options.event + stateStr(state));
        }
    },

    /**
     * Check that all the require failure recognizers has failed,
     * if true, it emits a gesture event,
     * otherwise, setup the state to FAILED.
     * @param {Object} input
     */
    tryEmit: function(input) {
        if (this.canEmit()) {
            return this.emit(input);
        }
        // it's failing anyway
        this.state = STATE_FAILED;
    },

    /**
     * can we emit?
     * @returns {boolean}
     */
    canEmit: function() {
        var i = 0;
        while (i < this.requireFail.length) {
            if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {
                return false;
            }
            i++;
        }
        return true;
    },

    /**
     * update the recognizer
     * @param {Object} inputData
     */
    recognize: function(inputData) {
        // make a new copy of the inputData
        // so we can change the inputData without messing up the other recognizers
        var inputDataClone = assign({}, inputData);

        // is is enabled and allow recognizing?
        if (!boolOrFn(this.options.enable, [this, inputDataClone])) {
            this.reset();
            this.state = STATE_FAILED;
            return;
        }

        // reset when we've reached the end
        if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {
            this.state = STATE_POSSIBLE;
        }

        this.state = this.process(inputDataClone);

        // the recognizer has recognized a gesture
        // so trigger an event
        if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {
            this.tryEmit(inputDataClone);
        }
    },

    /**
     * return the state of the recognizer
     * the actual recognizing happens in this method
     * @virtual
     * @param {Object} inputData
     * @returns {Const} STATE
     */
    process: function(inputData) { }, // jshint ignore:line

    /**
     * return the preferred touch-action
     * @virtual
     * @returns {Array}
     */
    getTouchAction: function() { },

    /**
     * called when the gesture isn't allowed to recognize
     * like when another is being recognized or it is disabled
     * @virtual
     */
    reset: function() { }
};

/**
 * get a usable string, used as event postfix
 * @param {Const} state
 * @returns {String} state
 */
function stateStr(state) {
    if (state & STATE_CANCELLED) {
        return 'cancel';
    } else if (state & STATE_ENDED) {
        return 'end';
    } else if (state & STATE_CHANGED) {
        return 'move';
    } else if (state & STATE_BEGAN) {
        return 'start';
    }
    return '';
}

/**
 * direction cons to string
 * @param {Const} direction
 * @returns {String}
 */
function directionStr(direction) {
    if (direction == DIRECTION_DOWN) {
        return 'down';
    } else if (direction == DIRECTION_UP) {
        return 'up';
    } else if (direction == DIRECTION_LEFT) {
        return 'left';
    } else if (direction == DIRECTION_RIGHT) {
        return 'right';
    }
    return '';
}

/**
 * get a recognizer by name if it is bound to a manager
 * @param {Recognizer|String} otherRecognizer
 * @param {Recognizer} recognizer
 * @returns {Recognizer}
 */
function getRecognizerByNameIfManager(otherRecognizer, recognizer) {
    var manager = recognizer.manager;
    if (manager) {
        return manager.get(otherRecognizer);
    }
    return otherRecognizer;
}

/**
 * This recognizer is just used as a base for the simple attribute recognizers.
 * @constructor
 * @extends Recognizer
 */
function AttrRecognizer() {
    Recognizer.apply(this, arguments);
}

inherit(AttrRecognizer, Recognizer, {
    /**
     * @namespace
     * @memberof AttrRecognizer
     */
    defaults: {
        /**
         * @type {Number}
         * @default 1
         */
        pointers: 1
    },

    /**
     * Used to check if it the recognizer receives valid input, like input.distance > 10.
     * @memberof AttrRecognizer
     * @param {Object} input
     * @returns {Boolean} recognized
     */
    attrTest: function(input) {
        var optionPointers = this.options.pointers;
        return optionPointers === 0 || input.pointers.length === optionPointers;
    },

    /**
     * Process the input and return the state for the recognizer
     * @memberof AttrRecognizer
     * @param {Object} input
     * @returns {*} State
     */
    process: function(input) {
        var state = this.state;
        var eventType = input.eventType;

        var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);
        var isValid = this.attrTest(input);

        // on cancel input and we've recognized before, return STATE_CANCELLED
        if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {
            return state | STATE_CANCELLED;
        } else if (isRecognized || isValid) {
            if (eventType & INPUT_END) {
                return state | STATE_ENDED;
            } else if (!(state & STATE_BEGAN)) {
                return STATE_BEGAN;
            }
            return state | STATE_CHANGED;
        }
        return STATE_FAILED;
    }
});

/**
 * Pan
 * Recognized when the pointer is down and moved in the allowed direction.
 * @constructor
 * @extends AttrRecognizer
 */
function PanRecognizer() {
    AttrRecognizer.apply(this, arguments);

    this.pX = null;
    this.pY = null;
}

inherit(PanRecognizer, AttrRecognizer, {
    /**
     * @namespace
     * @memberof PanRecognizer
     */
    defaults: {
        event: 'pan',
        threshold: 10,
        pointers: 1,
        direction: DIRECTION_ALL
    },

    getTouchAction: function() {
        var direction = this.options.direction;
        var actions = [];
        if (direction & DIRECTION_HORIZONTAL) {
            actions.push(TOUCH_ACTION_PAN_Y);
        }
        if (direction & DIRECTION_VERTICAL) {
            actions.push(TOUCH_ACTION_PAN_X);
        }
        return actions;
    },

    directionTest: function(input) {
        var options = this.options;
        var hasMoved = true;
        var distance = input.distance;
        var direction = input.direction;
        var x = input.deltaX;
        var y = input.deltaY;

        // lock to axis?
        if (!(direction & options.direction)) {
            if (options.direction & DIRECTION_HORIZONTAL) {
                direction = (x === 0) ? DIRECTION_NONE : (x < 0) ? DIRECTION_LEFT : DIRECTION_RIGHT;
                hasMoved = x != this.pX;
                distance = Math.abs(input.deltaX);
            } else {
                direction = (y === 0) ? DIRECTION_NONE : (y < 0) ? DIRECTION_UP : DIRECTION_DOWN;
                hasMoved = y != this.pY;
                distance = Math.abs(input.deltaY);
            }
        }
        input.direction = direction;
        return hasMoved && distance > options.threshold && direction & options.direction;
    },

    attrTest: function(input) {
        return AttrRecognizer.prototype.attrTest.call(this, input) &&
            (this.state & STATE_BEGAN || (!(this.state & STATE_BEGAN) && this.directionTest(input)));
    },

    emit: function(input) {

        this.pX = input.deltaX;
        this.pY = input.deltaY;

        var direction = directionStr(input.direction);

        if (direction) {
            input.additionalEvent = this.options.event + direction;
        }
        this._super.emit.call(this, input);
    }
});

/**
 * Pinch
 * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out).
 * @constructor
 * @extends AttrRecognizer
 */
function PinchRecognizer() {
    AttrRecognizer.apply(this, arguments);
}

inherit(PinchRecognizer, AttrRecognizer, {
    /**
     * @namespace
     * @memberof PinchRecognizer
     */
    defaults: {
        event: 'pinch',
        threshold: 0,
        pointers: 2
    },

    getTouchAction: function() {
        return [TOUCH_ACTION_NONE];
    },

    attrTest: function(input) {
        return this._super.attrTest.call(this, input) &&
            (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);
    },

    emit: function(input) {
        if (input.scale !== 1) {
            var inOut = input.scale < 1 ? 'in' : 'out';
            input.additionalEvent = this.options.event + inOut;
        }
        this._super.emit.call(this, input);
    }
});

/**
 * Press
 * Recognized when the pointer is down for x ms without any movement.
 * @constructor
 * @extends Recognizer
 */
function PressRecognizer() {
    Recognizer.apply(this, arguments);

    this._timer = null;
    this._input = null;
}

inherit(PressRecognizer, Recognizer, {
    /**
     * @namespace
     * @memberof PressRecognizer
     */
    defaults: {
        event: 'press',
        pointers: 1,
        time: 251, // minimal time of the pointer to be pressed
        threshold: 9 // a minimal movement is ok, but keep it low
    },

    getTouchAction: function() {
        return [TOUCH_ACTION_AUTO];
    },

    process: function(input) {
        var options = this.options;
        var validPointers = input.pointers.length === options.pointers;
        var validMovement = input.distance < options.threshold;
        var validTime = input.deltaTime > options.time;

        this._input = input;

        // we only allow little movement
        // and we've reached an end event, so a tap is possible
        if (!validMovement || !validPointers || (input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime)) {
            this.reset();
        } else if (input.eventType & INPUT_START) {
            this.reset();
            this._timer = setTimeoutContext(function() {
                this.state = STATE_RECOGNIZED;
                this.tryEmit();
            }, options.time, this);
        } else if (input.eventType & INPUT_END) {
            return STATE_RECOGNIZED;
        }
        return STATE_FAILED;
    },

    reset: function() {
        clearTimeout(this._timer);
    },

    emit: function(input) {
        if (this.state !== STATE_RECOGNIZED) {
            return;
        }

        if (input && (input.eventType & INPUT_END)) {
            this.manager.emit(this.options.event + 'up', input);
        } else {
            this._input.timeStamp = now();
            this.manager.emit(this.options.event, this._input);
        }
    }
});

/**
 * Rotate
 * Recognized when two or more pointer are moving in a circular motion.
 * @constructor
 * @extends AttrRecognizer
 */
function RotateRecognizer() {
    AttrRecognizer.apply(this, arguments);
}

inherit(RotateRecognizer, AttrRecognizer, {
    /**
     * @namespace
     * @memberof RotateRecognizer
     */
    defaults: {
        event: 'rotate',
        threshold: 0,
        pointers: 2
    },

    getTouchAction: function() {
        return [TOUCH_ACTION_NONE];
    },

    attrTest: function(input) {
        return this._super.attrTest.call(this, input) &&
            (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);
    }
});

/**
 * Swipe
 * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.
 * @constructor
 * @extends AttrRecognizer
 */
function SwipeRecognizer() {
    AttrRecognizer.apply(this, arguments);
}

inherit(SwipeRecognizer, AttrRecognizer, {
    /**
     * @namespace
     * @memberof SwipeRecognizer
     */
    defaults: {
        event: 'swipe',
        threshold: 10,
        velocity: 0.3,
        direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,
        pointers: 1
    },

    getTouchAction: function() {
        return PanRecognizer.prototype.getTouchAction.call(this);
    },

    attrTest: function(input) {
        var direction = this.options.direction;
        var velocity;

        if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {
            velocity = input.overallVelocity;
        } else if (direction & DIRECTION_HORIZONTAL) {
            velocity = input.overallVelocityX;
        } else if (direction & DIRECTION_VERTICAL) {
            velocity = input.overallVelocityY;
        }

        return this._super.attrTest.call(this, input) &&
            direction & input.offsetDirection &&
            input.distance > this.options.threshold &&
            input.maxPointers == this.options.pointers &&
            abs(velocity) > this.options.velocity && input.eventType & INPUT_END;
    },

    emit: function(input) {
        var direction = directionStr(input.offsetDirection);
        if (direction) {
            this.manager.emit(this.options.event + direction, input);
        }

        this.manager.emit(this.options.event, input);
    }
});

/**
 * A tap is ecognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur
 * between the given interval and position. The delay option can be used to recognize multi-taps without firing
 * a single tap.
 *
 * The eventData from the emitted event contains the property `tapCount`, which contains the amount of
 * multi-taps being recognized.
 * @constructor
 * @extends Recognizer
 */
function TapRecognizer() {
    Recognizer.apply(this, arguments);

    // previous time and center,
    // used for tap counting
    this.pTime = false;
    this.pCenter = false;

    this._timer = null;
    this._input = null;
    this.count = 0;
}

inherit(TapRecognizer, Recognizer, {
    /**
     * @namespace
     * @memberof PinchRecognizer
     */
    defaults: {
        event: 'tap',
        pointers: 1,
        taps: 1,
        interval: 300, // max time between the multi-tap taps
        time: 250, // max time of the pointer to be down (like finger on the screen)
        threshold: 9, // a minimal movement is ok, but keep it low
        posThreshold: 10 // a multi-tap can be a bit off the initial position
    },

    getTouchAction: function() {
        return [TOUCH_ACTION_MANIPULATION];
    },

    process: function(input) {
        var options = this.options;

        var validPointers = input.pointers.length === options.pointers;
        var validMovement = input.distance < options.threshold;
        var validTouchTime = input.deltaTime < options.time;

        this.reset();

        if ((input.eventType & INPUT_START) && (this.count === 0)) {
            return this.failTimeout();
        }

        // we only allow little movement
        // and we've reached an end event, so a tap is possible
        if (validMovement && validTouchTime && validPointers) {
            if (input.eventType != INPUT_END) {
                return this.failTimeout();
            }

            var validInterval = this.pTime ? (input.timeStamp - this.pTime < options.interval) : true;
            var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;

            this.pTime = input.timeStamp;
            this.pCenter = input.center;

            if (!validMultiTap || !validInterval) {
                this.count = 1;
            } else {
                this.count += 1;
            }

            this._input = input;

            // if tap count matches we have recognized it,
            // else it has began recognizing...
            var tapCount = this.count % options.taps;
            if (tapCount === 0) {
                // no failing requirements, immediately trigger the tap event
                // or wait as long as the multitap interval to trigger
                if (!this.hasRequireFailures()) {
                    return STATE_RECOGNIZED;
                } else {
                    this._timer = setTimeoutContext(function() {
                        this.state = STATE_RECOGNIZED;
                        this.tryEmit();
                    }, options.interval, this);
                    return STATE_BEGAN;
                }
            }
        }
        return STATE_FAILED;
    },

    failTimeout: function() {
        this._timer = setTimeoutContext(function() {
            this.state = STATE_FAILED;
        }, this.options.interval, this);
        return STATE_FAILED;
    },

    reset: function() {
        clearTimeout(this._timer);
    },

    emit: function() {
        if (this.state == STATE_RECOGNIZED) {
            this._input.tapCount = this.count;
            this.manager.emit(this.options.event, this._input);
        }
    }
});

/**
 * Simple way to create a manager with a default set of recognizers.
 * @param {HTMLElement} element
 * @param {Object} [options]
 * @constructor
 */
function Hammer(element, options) {
    options = options || {};
    options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset);
    return new Manager(element, options);
}

/**
 * @const {string}
 */
Hammer.VERSION = '2.0.8';

/**
 * default settings
 * @namespace
 */
Hammer.defaults = {
    /**
     * set if DOM events are being triggered.
     * But this is slower and unused by simple implementations, so disabled by default.
     * @type {Boolean}
     * @default false
     */
    domEvents: false,

    /**
     * The value for the touchAction property/fallback.
     * When set to `compute` it will magically set the correct value based on the added recognizers.
     * @type {String}
     * @default compute
     */
    touchAction: TOUCH_ACTION_COMPUTE,

    /**
     * @type {Boolean}
     * @default true
     */
    enable: true,

    /**
     * EXPERIMENTAL FEATURE -- can be removed/changed
     * Change the parent input target element.
     * If Null, then it is being set the to main element.
     * @type {Null|EventTarget}
     * @default null
     */
    inputTarget: null,

    /**
     * force an input class
     * @type {Null|Function}
     * @default null
     */
    inputClass: null,

    /**
     * Default recognizer setup when calling `Hammer()`
     * When creating a new Manager these will be skipped.
     * @type {Array}
     */
    preset: [
        // RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...]
        [RotateRecognizer, {enable: false}],
        [PinchRecognizer, {enable: false}, ['rotate']],
        [SwipeRecognizer, {direction: DIRECTION_HORIZONTAL}],
        [PanRecognizer, {direction: DIRECTION_HORIZONTAL}, ['swipe']],
        [TapRecognizer],
        [TapRecognizer, {event: 'doubletap', taps: 2}, ['tap']],
        [PressRecognizer]
    ],

    /**
     * Some CSS properties can be used to improve the working of Hammer.
     * Add them to this method and they will be set when creating a new Manager.
     * @namespace
     */
    cssProps: {
        /**
         * Disables text selection to improve the dragging gesture. Mainly for desktop browsers.
         * @type {String}
         * @default 'none'
         */
        userSelect: 'none',

        /**
         * Disable the Windows Phone grippers when pressing an element.
         * @type {String}
         * @default 'none'
         */
        touchSelect: 'none',

        /**
         * Disables the default callout shown when you touch and hold a touch target.
         * On iOS, when you touch and hold a touch target such as a link, Safari displays
         * a callout containing information about the link. This property allows you to disable that callout.
         * @type {String}
         * @default 'none'
         */
        touchCallout: 'none',

        /**
         * Specifies whether zooming is enabled. Used by IE10>
         * @type {String}
         * @default 'none'
         */
        contentZooming: 'none',

        /**
         * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.
         * @type {String}
         * @default 'none'
         */
        userDrag: 'none',

        /**
         * Overrides the highlight color shown when the user taps a link or a JavaScript
         * clickable element in iOS. This property obeys the alpha value, if specified.
         * @type {String}
         * @default 'rgba(0,0,0,0)'
         */
        tapHighlightColor: 'rgba(0,0,0,0)'
    }
};

var STOP = 1;
var FORCED_STOP = 2;

/**
 * Manager
 * @param {HTMLElement} element
 * @param {Object} [options]
 * @constructor
 */
function Manager(element, options) {
    this.options = assign({}, Hammer.defaults, options || {});

    this.options.inputTarget = this.options.inputTarget || element;

    this.handlers = {};
    this.session = {};
    this.recognizers = [];
    this.oldCssProps = {};

    this.element = element;
    this.input = createInputInstance(this);
    this.touchAction = new TouchAction(this, this.options.touchAction);

    toggleCssProps(this, true);

    each(this.options.recognizers, function(item) {
        var recognizer = this.add(new (item[0])(item[1]));
        item[2] && recognizer.recognizeWith(item[2]);
        item[3] && recognizer.requireFailure(item[3]);
    }, this);
}

Manager.prototype = {
    /**
     * set options
     * @param {Object} options
     * @returns {Manager}
     */
    set: function(options) {
        assign(this.options, options);

        // Options that need a little more setup
        if (options.touchAction) {
            this.touchAction.update();
        }
        if (options.inputTarget) {
            // Clean up existing event listeners and reinitialize
            this.input.destroy();
            this.input.target = options.inputTarget;
            this.input.init();
        }
        return this;
    },

    /**
     * stop recognizing for this session.
     * This session will be discarded, when a new [input]start event is fired.
     * When forced, the recognizer cycle is stopped immediately.
     * @param {Boolean} [force]
     */
    stop: function(force) {
        this.session.stopped = force ? FORCED_STOP : STOP;
    },

    /**
     * run the recognizers!
     * called by the inputHandler function on every movement of the pointers (touches)
     * it walks through all the recognizers and tries to detect the gesture that is being made
     * @param {Object} inputData
     */
    recognize: function(inputData) {
        var session = this.session;
        if (session.stopped) {
            return;
        }

        // run the touch-action polyfill
        this.touchAction.preventDefaults(inputData);

        var recognizer;
        var recognizers = this.recognizers;

        // this holds the recognizer that is being recognized.
        // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED
        // if no recognizer is detecting a thing, it is set to `null`
        var curRecognizer = session.curRecognizer;

        // reset when the last recognizer is recognized
        // or when we're in a new session
        if (!curRecognizer || (curRecognizer && curRecognizer.state & STATE_RECOGNIZED)) {
            curRecognizer = session.curRecognizer = null;
        }

        var i = 0;
        while (i < recognizers.length) {
            recognizer = recognizers[i];

            // find out if we are allowed try to recognize the input for this one.
            // 1.   allow if the session is NOT forced stopped (see the .stop() method)
            // 2.   allow if we still haven't recognized a gesture in this session, or the this recognizer is the one
            //      that is being recognized.
            // 3.   allow if the recognizer is allowed to run simultaneous with the current recognized recognizer.
            //      this can be setup with the `recognizeWith()` method on the recognizer.
            if (session.stopped !== FORCED_STOP && ( // 1
                    !curRecognizer || recognizer == curRecognizer || // 2
                    recognizer.canRecognizeWith(curRecognizer))) { // 3
                recognizer.recognize(inputData);
            } else {
                recognizer.reset();
            }

            // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the
            // current active recognizer. but only if we don't already have an active recognizer
            if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {
                curRecognizer = session.curRecognizer = recognizer;
            }
            i++;
        }
    },

    /**
     * get a recognizer by its event name.
     * @param {Recognizer|String} recognizer
     * @returns {Recognizer|Null}
     */
    get: function(recognizer) {
        if (recognizer instanceof Recognizer) {
            return recognizer;
        }

        var recognizers = this.recognizers;
        for (var i = 0; i < recognizers.length; i++) {
            if (recognizers[i].options.event == recognizer) {
                return recognizers[i];
            }
        }
        return null;
    },

    /**
     * add a recognizer to the manager
     * existing recognizers with the same event name will be removed
     * @param {Recognizer} recognizer
     * @returns {Recognizer|Manager}
     */
    add: function(recognizer) {
        if (invokeArrayArg(recognizer, 'add', this)) {
            return this;
        }

        // remove existing
        var existing = this.get(recognizer.options.event);
        if (existing) {
            this.remove(existing);
        }

        this.recognizers.push(recognizer);
        recognizer.manager = this;

        this.touchAction.update();
        return recognizer;
    },

    /**
     * remove a recognizer by name or instance
     * @param {Recognizer|String} recognizer
     * @returns {Manager}
     */
    remove: function(recognizer) {
        if (invokeArrayArg(recognizer, 'remove', this)) {
            return this;
        }

        recognizer = this.get(recognizer);

        // let's make sure this recognizer exists
        if (recognizer) {
            var recognizers = this.recognizers;
            var index = inArray(recognizers, recognizer);

            if (index !== -1) {
                recognizers.splice(index, 1);
                this.touchAction.update();
            }
        }

        return this;
    },

    /**
     * bind event
     * @param {String} events
     * @param {Function} handler
     * @returns {EventEmitter} this
     */
    on: function(events, handler) {
        if (events === undefined) {
            return;
        }
        if (handler === undefined) {
            return;
        }

        var handlers = this.handlers;
        each(splitStr(events), function(event) {
            handlers[event] = handlers[event] || [];
            handlers[event].push(handler);
        });
        return this;
    },

    /**
     * unbind event, leave emit blank to remove all handlers
     * @param {String} events
     * @param {Function} [handler]
     * @returns {EventEmitter} this
     */
    off: function(events, handler) {
        if (events === undefined) {
            return;
        }

        var handlers = this.handlers;
        each(splitStr(events), function(event) {
            if (!handler) {
                delete handlers[event];
            } else {
                handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);
            }
        });
        return this;
    },

    /**
     * emit event to the listeners
     * @param {String} event
     * @param {Object} data
     */
    emit: function(event, data) {
        // we also want to trigger dom events
        if (this.options.domEvents) {
            triggerDomEvent(event, data);
        }

        // no handlers, so skip it all
        var handlers = this.handlers[event] && this.handlers[event].slice();
        if (!handlers || !handlers.length) {
            return;
        }

        data.type = event;
        data.preventDefault = function() {
            data.srcEvent.preventDefault();
        };

        var i = 0;
        while (i < handlers.length) {
            handlers[i](data);
            i++;
        }
    },

    /**
     * destroy the manager and unbinds all events
     * it doesn't unbind dom events, that is the user own responsibility
     */
    destroy: function() {
        this.element && toggleCssProps(this, false);

        this.handlers = {};
        this.session = {};
        this.input.destroy();
        this.element = null;
    }
};

/**
 * add/remove the css properties as defined in manager.options.cssProps
 * @param {Manager} manager
 * @param {Boolean} add
 */
function toggleCssProps(manager, add) {
    var element = manager.element;
    if (!element.style) {
        return;
    }
    var prop;
    each(manager.options.cssProps, function(value, name) {
        prop = prefixed(element.style, name);
        if (add) {
            manager.oldCssProps[prop] = element.style[prop];
            element.style[prop] = value;
        } else {
            element.style[prop] = manager.oldCssProps[prop] || '';
        }
    });
    if (!add) {
        manager.oldCssProps = {};
    }
}

/**
 * trigger dom event
 * @param {String} event
 * @param {Object} data
 */
function triggerDomEvent(event, data) {
    var gestureEvent = document.createEvent('Event');
    gestureEvent.initEvent(event, true, true);
    gestureEvent.gesture = data;
    data.target.dispatchEvent(gestureEvent);
}

assign(Hammer, {
    INPUT_START: INPUT_START,
    INPUT_MOVE: INPUT_MOVE,
    INPUT_END: INPUT_END,
    INPUT_CANCEL: INPUT_CANCEL,

    STATE_POSSIBLE: STATE_POSSIBLE,
    STATE_BEGAN: STATE_BEGAN,
    STATE_CHANGED: STATE_CHANGED,
    STATE_ENDED: STATE_ENDED,
    STATE_RECOGNIZED: STATE_RECOGNIZED,
    STATE_CANCELLED: STATE_CANCELLED,
    STATE_FAILED: STATE_FAILED,

    DIRECTION_NONE: DIRECTION_NONE,
    DIRECTION_LEFT: DIRECTION_LEFT,
    DIRECTION_RIGHT: DIRECTION_RIGHT,
    DIRECTION_UP: DIRECTION_UP,
    DIRECTION_DOWN: DIRECTION_DOWN,
    DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL,
    DIRECTION_VERTICAL: DIRECTION_VERTICAL,
    DIRECTION_ALL: DIRECTION_ALL,

    Manager: Manager,
    Input: Input,
    TouchAction: TouchAction,

    TouchInput: TouchInput,
    MouseInput: MouseInput,
    PointerEventInput: PointerEventInput,
    TouchMouseInput: TouchMouseInput,
    SingleTouchInput: SingleTouchInput,

    Recognizer: Recognizer,
    AttrRecognizer: AttrRecognizer,
    Tap: TapRecognizer,
    Pan: PanRecognizer,
    Swipe: SwipeRecognizer,
    Pinch: PinchRecognizer,
    Rotate: RotateRecognizer,
    Press: PressRecognizer,

    on: addEventListeners,
    off: removeEventListeners,
    each: each,
    merge: merge,
    extend: extend,
    assign: assign,
    inherit: inherit,
    bindFn: bindFn,
    prefixed: prefixed
});

// this prevents errors when Hammer is loaded in the presence of an AMD
//  style loader but by script tag, not by the loader.
var freeGlobal = (typeof window !== 'undefined' ? window : (typeof self !== 'undefined' ? self : {})); // jshint ignore:line
freeGlobal.Hammer = Hammer;

if (typeof define === 'function' && define.amd) {
    define(function() {
        return Hammer;
    });
} else if (typeof module != 'undefined' && module.exports) {
    module.exports = Hammer;
} else {
    window[exportName] = Hammer;
}

})(window, document, 'Hammer');
;
window.matchMedia || (window.matchMedia = function () {
  "use strict";

  // For browsers that support matchMedium api such as IE 9 and webkit
  let styleMedia = window.styleMedia || window.media;

  // For those that don't support matchMedium
  if (!styleMedia) {
    const style = document.createElement('style');
    const script = document.getElementsByTagName('script')[0];
    style.type = 'text/css';
    style.id = 'matchmediajs-test';
    if (!script) {
      document.head.appendChild(style);
    } else {
      script.parentNode.insertBefore(style, script);
    }

    // 'style.currentStyle' is used by IE <= 8 and 'window.getComputedStyle' for all other browsers
    const info = 'getComputedStyle' in window && window.getComputedStyle(style, null) || style.currentStyle;
    styleMedia = {
      matchMedium: function (media) {
        const text = '@media ' + media + '{ #matchmediajs-test { width: 1px; } }';

        // 'style.styleSheet' is used by IE <= 8 and 'style.textContent' for all other browsers
        if (style.styleSheet) {
          style.styleSheet.cssText = text;
        } else {
          style.textContent = text;
        }

        // Test if media query is true or false
        return info.width === '1px';
      }
    };
  }
  return function (media) {
    return {
      matches: styleMedia.matchMedium(media || 'all'),
      media: media || 'all'
    };
  };
}());
//# sourceMappingURL=MatchMediaFallbackForIE.js.map
;
$(document).ready(function () {
  'use strict';

  $(document).on("click", function (e) {
    if (!$(e.target).closest("div#headercontent").length) {
      if ($("#checkbox_medium_menu:checked").length > 0) {
        $("#checkbox_medium_menu").prop("checked", false);
      }
    }
    if (!$(e.target).closest("div#subheadercontent").length) {
      if ($("#checkbox_user_menu:checked").length > 0) {
        $("#checkbox_user_menu").prop("checked", false);
      }
    }
  });
  $("#DetailSearchLink").on("click", function () {
    $("a#DetailSearchLink i").toggleClass("pfeilrotate");
    return false;
  });
  $("#searchcheckboxes").on("click", function () {
    $("label#searchcheckboxes i").toggleClass("pfeilrotate");
    if ($("#checkbox_searchfilter:checked").length > 0) {
      $("#checkbox_searchfilter").prop("checked", false);
    } else {
      $("#checkbox_searchfilter").prop("checked", true);
    }
    $("#searchcheckboxescontainer").toggleClass("showsearchcheckboxeslist");
    return false;
  });
});
//# sourceMappingURL=header.js.map
;
//_____________Variablen Deklarationsbereich_____________
//_________________Allgemeine Funktionen_________________
//___________Benutzerspezifische Funktionen______________
const verweiszettelFolding = function ($) {
  "use strict";

  const foldedCssClass = "folded";
  const dataIconFoldedAttribute = "icon-folded";
  const dataIconUnFoldedAttribute = "icon-unfolded";
  function toggleIcon(icon, folded) {
    const $icon = $(icon);
    const foldedIcon = $icon.data(dataIconFoldedAttribute);
    const unfoldedIcon = $icon.data(dataIconUnFoldedAttribute);
    if (isNull(folded)) {
      folded = $icon.hasClass(foldedIcon);
      folded = !folded;
    }
    $icon.toggleClass(foldedIcon, folded);
    $icon.toggleClass(unfoldedIcon, !folded);
  }
  function foldFoldable($foldable) {
    const $target = $foldable.next("li.foldable-target");
    if ($target) {
      $target.toggleClass(foldedCssClass);
      $foldable.toggleClass(foldedCssClass);
      const $icon = $foldable.find("i.trigger:first");
      if ($icon.hasClass("clickflag")) {
        toggleIcon($icon);
      } else {
        $icon.addClass("clickflag");
      }
    }
  }
  function initializeFoldingState($container, foldedIconClass, unfoldedIconClass) {
    if ($container.length > 0) {
      $(".foldable, .foldable-target", $container).each(function () {
        const $menuItem = $(this);
        const unfolded = $menuItem.data("unfolded");
        $menuItem.toggleClass(foldedCssClass, !unfolded);
        if ($menuItem.hasClass("foldable")) {
          const $icon = $menuItem.find("i.trigger:first");
          const foldedAttr = $icon.data(dataIconFoldedAttribute);
          const unfoldedAttr = $icon.data(dataIconUnFoldedAttribute);
          if (!foldedAttr) $icon.data(dataIconFoldedAttribute, foldedIconClass || "icon-right-open");
          if (!unfoldedAttr) $icon.data(dataIconUnFoldedAttribute, unfoldedIconClass || "icon-down-open");
          toggleIcon($icon, !unfolded);
        }
      });
    }
  }
  return {
    toggleIcon: toggleIcon,
    foldFoldable: foldFoldable,
    initializeFoldingState: initializeFoldingState
  };
}(jQuery);
//# sourceMappingURL=Verweiszettel_folding.js.map
;
//_____________Variablen Deklarationsbereich_____________
//_________________Allgemeine Funktionen_________________
//___________Benutzerspezifische Funktionen______________
function CollapseLinknoteTree(foldedIconClass, unfoldedIconClass) {
  "use strict";

  const handleMoreLinkClick = function (event) {
    const $target = $(event.currentTarget);
    $target.closest("li").hide().nextAll(":not(.foldable-target)").show();
    return false;
  };
  const handleCloseLinkClick = function (event) {
    const $target = $(event.currentTarget);
    $target.closest("li").prevAll(".moreLinkVerweiszettelLi").show().nextAll(":not(.foldable-target)").hide();
    return false;
  };
  const handleFoldable = function (event) {
    const $element = $(event.currentTarget);
    const $parentMenu = $element.closest("li.foldable");
    verweiszettelFolding.foldFoldable($parentMenu);
    return false;
  };
  const tooggleLinkNoteAndAnnotationContainer = function (event) {
    const container = $(event.currentTarget).attr("data-rda").split(",");
    container.forEach(function (element, index, array) {
      const container = $("#" + element);
      array[index] = container;
    });
    container[0].toggleClass("out-of-viewport");
    if (!container[0].hasClass("out-of-viewport") && !container[1].hasClass("out-of-viewport")) {
      container[1].toggleClass("out-of-viewport");
    }
    return container;
  };
  const toggleLinkNoteButton = function (container) {
    if (!container[0].hasClass("out-of-viewport")) {
      if ($("#linknoteoff").length) {
        $("#linknoteoff").attr("id", "linknoteon");
      }
    } else if ($("#linknoteon").length) {
      $("#linknoteon").attr("id", "linknoteoff");
    }
  };
  const toggleAnnotationButton = function (container) {
    if (!container[0].hasClass("out-of-viewport")) {
      if ($("#annotationwithcontentoff").length) {
        $("#annotationwithcontentoff").attr("id", "annotationwithcontenton");
      }
    } else if ($("#annotationwithcontenton").length) {
      $("#annotationwithcontenton").attr("id", "annotationwithcontentoff");
    }
    if (!container[0].hasClass("out-of-viewport")) {
      if ($("#annotationoff").length) {
        $("#annotationoff").attr("id", "annotationon");
      }
    } else if ($("#annotationon").length) {
      $("#annotationon").attr("id", "annotationoff");
    }
  };
  const handleLinkNoteButtonClick = function (event) {
    const container = tooggleLinkNoteAndAnnotationContainer(event);
    toggleLinkNoteButton(container);
    toggleAnnotationButton(container.reverse());
    return false;
  };
  const handleAnnotationButtonClick = function (event) {
    const container = tooggleLinkNoteAndAnnotationContainer(event);
    toggleAnnotationButton(container);
    toggleLinkNoteButton(container.reverse());
    return false;
  };
  const handleCloseLinkNote = function () {
    $('#verweiszettel-bottom').addClass("out-of-viewport");
    if ($("#linknoteon").length) {
      $("#linknoteon").attr("id", "linknoteoff");
    }
    return false;
  };
  const handleAnnotationClose = function () {
    $('#anmerkzettel-bottom').addClass("out-of-viewport");
    if ($("#annotationwithcontenton").length) {
      $("#annotationwithcontenton").attr("id", "annotationwithcontentoff");
    }
    if ($("#annotationon").length) {
      $("#annotationon").attr("id", "annotationoff");
    }
    return false;
  };
  const handleMatomoTracking = function (event) {
    const element = $(event.currentTarget);
    const link = element.attr("href");
    if (link.length) {
      const linkCategory = element.attr("linkCategory-data");
      trackMatomoEvent('trackEvent', 'Verweiszettel-klick', linkCategory);
    }
  };
  function restoreState() {
    verweiszettelFolding.initializeFoldingState($('#verweiszettel-content'), foldedIconClass, unfoldedIconClass);
  }
  this.restoreState = restoreState;
  $(function () {
    restoreState();
    const $bottomleiste = $("#bottomleiste");
    const $container = $("#verweisContainer");
    $container.find(".moreLinkVerweiszettelLi").show().nextAll(":not(.foldable-target)").hide();
    $bottomleiste.on("click", "#anmerkzettelbutton>a", handleAnnotationButtonClick);
    $bottomleiste.on("click", "#verweiszettelbutton>a", handleLinkNoteButtonClick);
    $container.on("click", "li.foldable .trigger", handleFoldable);
    $container.on('click', 'a.moreLinkVerweiszettelAnchor', handleMoreLinkClick);
    $container.on('click', 'a.closeLinkVerweiszettelAnchor', handleCloseLinkClick);
    $container.on('click', 'a#verweiszettelClose', handleCloseLinkNote);
    $container.on('click', '#annotation-close', handleAnnotationClose);

    //Matomo
    $container.on('click', 'div#verweiszettel-content a:not(.closeLinkVerweiszettelLi a, .moreLinkVerweiszettelLi a)', handleMatomoTracking);
  });
}
$(document).ready(function () {
  window.collapseLinknoteTree = new CollapseLinknoteTree('icon-right-open', 'icon-down-open');
});
//# sourceMappingURL=Verweiszettel.js.map
;
"use strict";

//_____________Variablen Deklarationsbereich_____________

//_________________Allgemeine Funktionen_________________
$(function () {
  const $container = $("#verweisContainer");
  $container.on("click", ".foldable .verweiszettel-section-count", handleUnlinkedCounter);
});

//___________Benutzerspezifische Funktionen______________
function handleUnlinkedCounter(e) {
  const target = $(e.target);
  verweiszettelFolding.foldFoldable(target.closest("li.foldable"));
  return false;
}
//# sourceMappingURL=Verweiszettel_WithCounters.js.map
;
//----------------------------------------------------------
// Copyright (C) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------
// MicrosoftAjax.js
Function.__typeName = "Function"; Function.__class = true; Function.createCallback = function (b, a) { return function () { var e = arguments.length; if (e > 0) { var d = []; for (var c = 0; c < e; c++) d[c] = arguments[c]; d[e] = a; return b.apply(this, d) } return b.call(this, a) } }; Function.createDelegate = function (a, b) { return function () { return b.apply(a, arguments) } }; Function.emptyFunction = Function.emptyMethod = function () { }; Function.validateParameters = function (c, b, a) { return Function._validateParams(c, b, a) }; Function._validateParams = function (g, e, c) { var a, d = e.length; c = c || typeof c === "undefined"; a = Function._validateParameterCount(g, e, c); if (a) { a.popStackFrame(); return a } for (var b = 0, i = g.length; b < i; b++) { var f = e[Math.min(b, d - 1)], h = f.name; if (f.parameterArray) h += "[" + (b - d + 1) + "]"; else if (!c && b >= d) break; a = Function._validateParameter(g[b], f, h); if (a) { a.popStackFrame(); return a } } return null }; Function._validateParameterCount = function (j, d, i) { var a, c, b = d.length, e = j.length; if (e < b) { var f = b; for (a = 0; a < b; a++) { var g = d[a]; if (g.optional || g.parameterArray) f-- } if (e < f) c = true } else if (i && e > b) { c = true; for (a = 0; a < b; a++) if (d[a].parameterArray) { c = false; break } } if (c) { var h = Error.parameterCount(); h.popStackFrame(); return h } return null }; Function._validateParameter = function (c, a, h) { var b, g = a.type, l = !!a.integer, k = !!a.domElement, m = !!a.mayBeNull; b = Function._validateParameterType(c, g, l, k, m, h); if (b) { b.popStackFrame(); return b } var e = a.elementType, f = !!a.elementMayBeNull; if (g === Array && typeof c !== "undefined" && c !== null && (e || !f)) { var j = !!a.elementInteger, i = !!a.elementDomElement; for (var d = 0; d < c.length; d++) { var n = c[d]; b = Function._validateParameterType(n, e, j, i, f, h + "[" + d + "]"); if (b) { b.popStackFrame(); return b } } } return null }; Function._validateParameterType = function (b, c, k, j, h, d) { var a, g; if (typeof b === "undefined") if (h) return null; else { a = Error.argumentUndefined(d); a.popStackFrame(); return a } if (b === null) if (h) return null; else { a = Error.argumentNull(d); a.popStackFrame(); return a } if (c && c.__enum) { if (typeof b !== "number") { a = Error.argumentType(d, Object.getType(b), c); a.popStackFrame(); return a } if (b % 1 === 0) { var e = c.prototype; if (!c.__flags || b === 0) { for (g in e) if (e[g] === b) return null } else { var i = b; for (g in e) { var f = e[g]; if (f === 0) continue; if ((f & b) === f) i -= f; if (i === 0) return null } } } a = Error.argumentOutOfRange(d, b, String.format(Sys.Res.enumInvalidValue, b, c.getName())); a.popStackFrame(); return a } if (j && (!Sys._isDomElement(b) || b.nodeType === 3)) { a = Error.argument(d, Sys.Res.argumentDomElement); a.popStackFrame(); return a } if (c && !Sys._isInstanceOfType(c, b)) { a = Error.argumentType(d, Object.getType(b), c); a.popStackFrame(); return a } if (c === Number && k) if (b % 1 !== 0) { a = Error.argumentOutOfRange(d, b, Sys.Res.argumentInteger); a.popStackFrame(); return a } return null }; Error.__typeName = "Error"; Error.__class = true; Error.create = function (d, b) { var a = new Error(d); a.message = d; if (b) for (var c in b) a[c] = b[c]; a.popStackFrame(); return a }; Error.argument = function (a, c) { var b = "Sys.ArgumentException: " + (c ? c : Sys.Res.argument); if (a) b += "\n" + String.format(Sys.Res.paramName, a); var d = Error.create(b, { name: "Sys.ArgumentException", paramName: a }); d.popStackFrame(); return d }; Error.argumentNull = function (a, c) { var b = "Sys.ArgumentNullException: " + (c ? c : Sys.Res.argumentNull); if (a) b += "\n" + String.format(Sys.Res.paramName, a); var d = Error.create(b, { name: "Sys.ArgumentNullException", paramName: a }); d.popStackFrame(); return d }; Error.argumentOutOfRange = function (c, a, d) { var b = "Sys.ArgumentOutOfRangeException: " + (d ? d : Sys.Res.argumentOutOfRange); if (c) b += "\n" + String.format(Sys.Res.paramName, c); if (typeof a !== "undefined" && a !== null) b += "\n" + String.format(Sys.Res.actualValue, a); var e = Error.create(b, { name: "Sys.ArgumentOutOfRangeException", paramName: c, actualValue: a }); e.popStackFrame(); return e }; Error.argumentType = function (d, c, b, e) { var a = "Sys.ArgumentTypeException: "; if (e) a += e; else if (c && b) a += String.format(Sys.Res.argumentTypeWithTypes, c.getName(), b.getName()); else a += Sys.Res.argumentType; if (d) a += "\n" + String.format(Sys.Res.paramName, d); var f = Error.create(a, { name: "Sys.ArgumentTypeException", paramName: d, actualType: c, expectedType: b }); f.popStackFrame(); return f }; Error.argumentUndefined = function (a, c) { var b = "Sys.ArgumentUndefinedException: " + (c ? c : Sys.Res.argumentUndefined); if (a) b += "\n" + String.format(Sys.Res.paramName, a); var d = Error.create(b, { name: "Sys.ArgumentUndefinedException", paramName: a }); d.popStackFrame(); return d }; Error.format = function (a) { var c = "Sys.FormatException: " + (a ? a : Sys.Res.format), b = Error.create(c, { name: "Sys.FormatException" }); b.popStackFrame(); return b }; Error.invalidOperation = function (a) { var c = "Sys.InvalidOperationException: " + (a ? a : Sys.Res.invalidOperation), b = Error.create(c, { name: "Sys.InvalidOperationException" }); b.popStackFrame(); return b }; Error.notImplemented = function (a) { var c = "Sys.NotImplementedException: " + (a ? a : Sys.Res.notImplemented), b = Error.create(c, { name: "Sys.NotImplementedException" }); b.popStackFrame(); return b }; Error.parameterCount = function (a) { var c = "Sys.ParameterCountException: " + (a ? a : Sys.Res.parameterCount), b = Error.create(c, { name: "Sys.ParameterCountException" }); b.popStackFrame(); return b }; Error.prototype.popStackFrame = function () { if (typeof this.stack === "undefined" || this.stack === null || typeof this.fileName === "undefined" || this.fileName === null || typeof this.lineNumber === "undefined" || this.lineNumber === null) return; var a = this.stack.split("\n"), c = a[0], e = this.fileName + ":" + this.lineNumber; while (typeof c !== "undefined" && c !== null && c.indexOf(e) === -1) { a.shift(); c = a[0] } var d = a[1]; if (typeof d === "undefined" || d === null) return; var b = d.match(/@(.*):(\d+)$/); if (typeof b === "undefined" || b === null) return; this.fileName = b[1]; this.lineNumber = parseInt(b[2]); a.shift(); this.stack = a.join("\n") }; Object.__typeName = "Object"; Object.__class = true; Object.getType = function (b) { var a = b.constructor; if (!a || typeof a !== "function" || !a.__typeName || a.__typeName === "Object") return Object; return a }; Object.getTypeName = function (a) { return Object.getType(a).getName() }; String.__typeName = "String"; String.__class = true; String.prototype.endsWith = function (a) { return this.substr(this.length - a.length) === a }; String.prototype.startsWith = function (a) { return this.substr(0, a.length) === a }; String.prototype.trim = function () { return this.replace(/^\s+|\s+$/g, "") }; String.prototype.trimEnd = function () { return this.replace(/\s+$/, "") }; String.prototype.trimStart = function () { return this.replace(/^\s+/, "") }; String.format = function () { return String._toFormattedString(false, arguments) }; String._toFormattedString = function (l, j) { var c = "", e = j[0]; for (var a = 0; true;) { var f = e.indexOf("{", a), d = e.indexOf("}", a); if (f < 0 && d < 0) { c += e.slice(a); break } if (d > 0 && (d < f || f < 0)) { c += e.slice(a, d + 1); a = d + 2; continue } c += e.slice(a, f); a = f + 1; if (e.charAt(a) === "{") { c += "{"; a++; continue } if (d < 0) break; var h = e.substring(a, d), g = h.indexOf(":"), k = parseInt(g < 0 ? h : h.substring(0, g), 10) + 1, i = g < 0 ? "" : h.substring(g + 1), b = j[k]; if (typeof b === "undefined" || b === null) b = ""; if (b.toFormattedString) c += b.toFormattedString(i); else if (l && b.localeFormat) c += b.localeFormat(i); else if (b.format) c += b.format(i); else c += b.toString(); a = d + 1 } return c }; Boolean.__typeName = "Boolean"; Boolean.__class = true; Boolean.parse = function (b) { var a = b.trim().toLowerCase(); if (a === "false") return false; if (a === "true") return true }; Date.__typeName = "Date"; Date.__class = true; Number.__typeName = "Number"; Number.__class = true; RegExp.__typeName = "RegExp"; RegExp.__class = true; if (!window) this.window = this; window.Type = Function; Type.prototype.callBaseMethod = function (a, d, b) { var c = Sys._getBaseMethod(this, a, d); if (!b) return c.apply(a); else return c.apply(a, b) }; Type.prototype.getBaseMethod = function (a, b) { return Sys._getBaseMethod(this, a, b) }; Type.prototype.getBaseType = function () { return typeof this.__baseType === "undefined" ? null : this.__baseType }; Type.prototype.getInterfaces = function () { var a = [], b = this; while (b) { var c = b.__interfaces; if (c) for (var d = 0, f = c.length; d < f; d++) { var e = c[d]; if (!Array.contains(a, e)) a[a.length] = e } b = b.__baseType } return a }; Type.prototype.getName = function () { return typeof this.__typeName === "undefined" ? "" : this.__typeName }; Type.prototype.implementsInterface = function (d) { this.resolveInheritance(); var c = d.getName(), a = this.__interfaceCache; if (a) { var e = a[c]; if (typeof e !== "undefined") return e } else a = this.__interfaceCache = {}; var b = this; while (b) { var f = b.__interfaces; if (f) if (Array.indexOf(f, d) !== -1) return a[c] = true; b = b.__baseType } return a[c] = false }; Type.prototype.inheritsFrom = function (b) { this.resolveInheritance(); var a = this.__baseType; while (a) { if (a === b) return true; a = a.__baseType } return false }; Type.prototype.initializeBase = function (a, b) { this.resolveInheritance(); if (this.__baseType) if (!b) this.__baseType.apply(a); else this.__baseType.apply(a, b); return a }; Type.prototype.isImplementedBy = function (a) { if (typeof a === "undefined" || a === null) return false; var b = Object.getType(a); return !!(b.implementsInterface && b.implementsInterface(this)) }; Type.prototype.isInstanceOfType = function (a) { return Sys._isInstanceOfType(this, a) }; Type.prototype.registerClass = function (c, b, d) { this.prototype.constructor = this; this.__typeName = c; this.__class = true; if (b) { this.__baseType = b; this.__basePrototypePending = true } Sys.__upperCaseTypes[c.toUpperCase()] = this; if (d) { this.__interfaces = []; for (var a = 2, f = arguments.length; a < f; a++) { var e = arguments[a]; this.__interfaces.push(e) } } return this }; Type.prototype.registerInterface = function (a) { Sys.__upperCaseTypes[a.toUpperCase()] = this; this.prototype.constructor = this; this.__typeName = a; this.__interface = true; return this }; Type.prototype.resolveInheritance = function () { if (this.__basePrototypePending) { var b = this.__baseType; b.resolveInheritance(); for (var a in b.prototype) { var c = b.prototype[a]; if (!this.prototype[a]) this.prototype[a] = c } delete this.__basePrototypePending } }; Type.getRootNamespaces = function () { return Array.clone(Sys.__rootNamespaces) }; Type.isClass = function (a) { if (typeof a === "undefined" || a === null) return false; return !!a.__class }; Type.isInterface = function (a) { if (typeof a === "undefined" || a === null) return false; return !!a.__interface }; Type.isNamespace = function (a) { if (typeof a === "undefined" || a === null) return false; return !!a.__namespace }; Type.parse = function (typeName, ns) { var fn; if (ns) { fn = Sys.__upperCaseTypes[ns.getName().toUpperCase() + "." + typeName.toUpperCase()]; return fn || null } if (!typeName) return null; if (!Type.__htClasses) Type.__htClasses = {}; fn = Type.__htClasses[typeName]; if (!fn) { fn = eval(typeName); Type.__htClasses[typeName] = fn } return fn }; Type.registerNamespace = function (e) { var d = window, c = e.split("."); for (var b = 0; b < c.length; b++) { var f = c[b], a = d[f]; if (!a) a = d[f] = {}; if (!a.__namespace) { if (b === 0 && e !== "Sys") Sys.__rootNamespaces[Sys.__rootNamespaces.length] = a; a.__namespace = true; a.__typeName = c.slice(0, b + 1).join("."); a.getName = function () { return this.__typeName } } d = a } }; Type._checkDependency = function (c, a) { var d = Type._registerScript._scripts, b = d ? !!d[c] : false; if (typeof a !== "undefined" && !b) throw Error.invalidOperation(String.format(Sys.Res.requiredScriptReferenceNotIncluded, a, c)); return b }; Type._registerScript = function (a, c) { var b = Type._registerScript._scripts; if (!b) Type._registerScript._scripts = b = {}; if (b[a]) throw Error.invalidOperation(String.format(Sys.Res.scriptAlreadyLoaded, a)); b[a] = true; if (c) for (var d = 0, f = c.length; d < f; d++) { var e = c[d]; if (!Type._checkDependency(e)) throw Error.invalidOperation(String.format(Sys.Res.scriptDependencyNotFound, a, e)) } }; Type.registerNamespace("Sys"); Sys.__upperCaseTypes = {}; Sys.__rootNamespaces = [Sys]; Sys._isInstanceOfType = function (c, b) { if (typeof b === "undefined" || b === null) return false; if (b instanceof c) return true; var a = Object.getType(b); return !!(a === c) || a.inheritsFrom && a.inheritsFrom(c) || a.implementsInterface && a.implementsInterface(c) }; Sys._getBaseMethod = function (d, e, c) { var b = d.getBaseType(); if (b) { var a = b.prototype[c]; return a instanceof Function ? a : null } return null }; Sys._isDomElement = function (a) { var c = false; if (typeof a.nodeType !== "number") { var b = a.ownerDocument || a.document || a; if (b != a) { var d = b.defaultView || b.parentWindow; c = d != a } else c = typeof b.body === "undefined" } return !c }; Array.__typeName = "Array"; Array.__class = true; Array.add = Array.enqueue = function (a, b) { a[a.length] = b }; Array.addRange = function (a, b) { a.push.apply(a, b) }; Array.clear = function (a) { a.length = 0 }; Array.clone = function (a) { if (a.length === 1) return [a[0]]; else return Array.apply(null, a) }; Array.contains = function (a, b) { return Sys._indexOf(a, b) >= 0 }; Array.dequeue = function (a) { return a.shift() }; Array.forEach = function (b, e, d) { for (var a = 0, f = b.length; a < f; a++) { var c = b[a]; if (typeof c !== "undefined") e.call(d, c, a, b) } }; Array.indexOf = function (a, c, b) { return Sys._indexOf(a, c, b) }; Array.insert = function (a, b, c) { a.splice(b, 0, c) }; Array.parse = function (value) { if (!value) return []; return eval(value) }; Array.remove = function (b, c) { var a = Sys._indexOf(b, c); if (a >= 0) b.splice(a, 1); return a >= 0 }; Array.removeAt = function (a, b) { a.splice(b, 1) }; Sys._indexOf = function (d, e, a) { if (typeof e === "undefined") return -1; var c = d.length; if (c !== 0) { a = a - 0; if (isNaN(a)) a = 0; else { if (isFinite(a)) a = a - a % 1; if (a < 0) a = Math.max(0, c + a) } for (var b = a; b < c; b++) if (typeof d[b] !== "undefined" && d[b] === e) return b } return -1 }; Type._registerScript._scripts = { "MicrosoftAjaxCore.js": true, "MicrosoftAjaxGlobalization.js": true, "MicrosoftAjaxSerialization.js": true, "MicrosoftAjaxComponentModel.js": true, "MicrosoftAjaxHistory.js": true, "MicrosoftAjaxNetwork.js": true, "MicrosoftAjaxWebServices.js": true }; Sys.IDisposable = function () { }; Sys.IDisposable.prototype = {}; Sys.IDisposable.registerInterface("Sys.IDisposable"); Sys.StringBuilder = function (a) { this._parts = typeof a !== "undefined" && a !== null && a !== "" ? [a.toString()] : []; this._value = {}; this._len = 0 }; Sys.StringBuilder.prototype = { append: function (a) { this._parts[this._parts.length] = a }, appendLine: function (a) { this._parts[this._parts.length] = typeof a === "undefined" || a === null || a === "" ? "\r\n" : a + "\r\n" }, clear: function () { this._parts = []; this._value = {}; this._len = 0 }, isEmpty: function () { if (this._parts.length === 0) return true; return this.toString() === "" }, toString: function (a) { a = a || ""; var b = this._parts; if (this._len !== b.length) { this._value = {}; this._len = b.length } var d = this._value; if (typeof d[a] === "undefined") { if (a !== "") for (var c = 0; c < b.length;) if (typeof b[c] === "undefined" || b[c] === "" || b[c] === null) b.splice(c, 1); else c++; d[a] = this._parts.join(a) } return d[a] } }; Sys.StringBuilder.registerClass("Sys.StringBuilder"); Sys.Browser = {}; Sys.Browser.InternetExplorer = {}; Sys.Browser.Firefox = {}; Sys.Browser.Safari = {}; Sys.Browser.Opera = {}; Sys.Browser.agent = null; Sys.Browser.hasDebuggerStatement = false; Sys.Browser.name = navigator.appName; Sys.Browser.version = parseFloat(navigator.appVersion); Sys.Browser.documentMode = 0; if (navigator.userAgent.indexOf(" MSIE ") > -1) { Sys.Browser.agent = Sys.Browser.InternetExplorer; Sys.Browser.version = parseFloat(navigator.userAgent.match(/MSIE (\d+\.\d+)/)[1]); if (Sys.Browser.version >= 8) if (document.documentMode >= 7) Sys.Browser.documentMode = document.documentMode; Sys.Browser.hasDebuggerStatement = true } else if (navigator.userAgent.indexOf(" Firefox/") > -1) { Sys.Browser.agent = Sys.Browser.Firefox; Sys.Browser.version = parseFloat(navigator.userAgent.match(/Firefox\/(\d+\.\d+)/)[1]); Sys.Browser.name = "Firefox"; Sys.Browser.hasDebuggerStatement = true } else if (navigator.userAgent.indexOf(" AppleWebKit/") > -1) { Sys.Browser.agent = Sys.Browser.Safari; Sys.Browser.version = parseFloat(navigator.userAgent.match(/AppleWebKit\/(\d+(\.\d+)?)/)[1]); Sys.Browser.name = "Safari" } else if (navigator.userAgent.indexOf("Opera/") > -1) Sys.Browser.agent = Sys.Browser.Opera; Sys.EventArgs = function () { }; Sys.EventArgs.registerClass("Sys.EventArgs"); Sys.EventArgs.Empty = new Sys.EventArgs; Sys.CancelEventArgs = function () { Sys.CancelEventArgs.initializeBase(this); this._cancel = false }; Sys.CancelEventArgs.prototype = { get_cancel: function () { return this._cancel }, set_cancel: function (a) { this._cancel = a } }; Sys.CancelEventArgs.registerClass("Sys.CancelEventArgs", Sys.EventArgs); Type.registerNamespace("Sys.UI"); Sys._Debug = function () { }; Sys._Debug.prototype = { _appendConsole: function (a) { if (typeof Debug !== "undefined" && Debug.writeln) Debug.writeln(a); if (window.console && window.console.log) window.console.log(a); if (window.opera) window.opera.postError(a); if (window.debugService) window.debugService.trace(a) }, _appendTrace: function (b) { var a = document.getElementById("TraceConsole"); if (a && a.tagName.toUpperCase() === "TEXTAREA") a.value += b + "\n" }, assert: function (c, a, b) { if (!c) { a = b && this.assert.caller ? String.format(Sys.Res.assertFailedCaller, a, this.assert.caller) : String.format(Sys.Res.assertFailed, a); if (confirm(String.format(Sys.Res.breakIntoDebugger, a))) this.fail(a) } }, clearTrace: function () { var a = document.getElementById("TraceConsole"); if (a && a.tagName.toUpperCase() === "TEXTAREA") a.value = "" }, fail: function (message) { this._appendConsole(message); if (Sys.Browser.hasDebuggerStatement) eval("debugger") }, trace: function (a) { this._appendConsole(a); this._appendTrace(a) }, traceDump: function (a, b) { var c = this._traceDump(a, b, true) }, _traceDump: function (a, c, f, b, d) { c = c ? c : "traceDump"; b = b ? b : ""; if (a === null) { this.trace(b + c + ": null"); return } switch (typeof a) { case "undefined": this.trace(b + c + ": Undefined"); break; case "number": case "string": case "boolean": this.trace(b + c + ": " + a); break; default: if (Date.isInstanceOfType(a) || RegExp.isInstanceOfType(a)) { this.trace(b + c + ": " + a.toString()); break } if (!d) d = []; else if (Array.contains(d, a)) { this.trace(b + c + ": ..."); return } Array.add(d, a); if (a == window || a === document || window.HTMLElement && a instanceof HTMLElement || typeof a.nodeName === "string") { var k = a.tagName ? a.tagName : "DomElement"; if (a.id) k += " - " + a.id; this.trace(b + c + " {" + k + "}") } else { var i = Object.getTypeName(a); this.trace(b + c + (typeof i === "string" ? " {" + i + "}" : "")); if (b === "" || f) { b += "    "; var e, j, l, g, h; if (Array.isInstanceOfType(a)) { j = a.length; for (e = 0; e < j; e++) this._traceDump(a[e], "[" + e + "]", f, b, d) } else for (g in a) { h = a[g]; if (!Function.isInstanceOfType(h)) this._traceDump(h, g, f, b, d) } } } Array.remove(d, a) } } }; Sys._Debug.registerClass("Sys._Debug"); Sys.Debug = new Sys._Debug; Sys.Debug.isDebug = false; function Sys$Enum$parse(c, e) { var a, b, i; if (e) { a = this.__lowerCaseValues; if (!a) { this.__lowerCaseValues = a = {}; var g = this.prototype; for (var f in g) a[f.toLowerCase()] = g[f] } } else a = this.prototype; if (!this.__flags) { i = e ? c.toLowerCase() : c; b = a[i.trim()]; if (typeof b !== "number") throw Error.argument("value", String.format(Sys.Res.enumInvalidValue, c, this.__typeName)); return b } else { var h = (e ? c.toLowerCase() : c).split(","), j = 0; for (var d = h.length - 1; d >= 0; d--) { var k = h[d].trim(); b = a[k]; if (typeof b !== "number") throw Error.argument("value", String.format(Sys.Res.enumInvalidValue, c.split(",")[d].trim(), this.__typeName)); j |= b } return j } } function Sys$Enum$toString(c) { if (typeof c === "undefined" || c === null) return this.__string; var d = this.prototype, a; if (!this.__flags || c === 0) { for (a in d) if (d[a] === c) return a } else { var b = this.__sortedValues; if (!b) { b = []; for (a in d) b[b.length] = { key: a, value: d[a] }; b.sort(function (a, b) { return a.value - b.value }); this.__sortedValues = b } var e = [], g = c; for (a = b.length - 1; a >= 0; a--) { var h = b[a], f = h.value; if (f === 0) continue; if ((f & c) === f) { e[e.length] = h.key; g -= f; if (g === 0) break } } if (e.length && g === 0) return e.reverse().join(", ") } return "" } Type.prototype.registerEnum = function (b, c) { Sys.__upperCaseTypes[b.toUpperCase()] = this; for (var a in this.prototype) this[a] = this.prototype[a]; this.__typeName = b; this.parse = Sys$Enum$parse; this.__string = this.toString(); this.toString = Sys$Enum$toString; this.__flags = c; this.__enum = true }; Type.isEnum = function (a) { if (typeof a === "undefined" || a === null) return false; return !!a.__enum }; Type.isFlags = function (a) { if (typeof a === "undefined" || a === null) return false; return !!a.__flags }; Sys.CollectionChange = function (e, a, c, b, d) { this.action = e; if (a) if (!(a instanceof Array)) a = [a]; this.newItems = a || null; if (typeof c !== "number") c = -1; this.newStartingIndex = c; if (b) if (!(b instanceof Array)) b = [b]; this.oldItems = b || null; if (typeof d !== "number") d = -1; this.oldStartingIndex = d }; Sys.CollectionChange.registerClass("Sys.CollectionChange"); Sys.NotifyCollectionChangedAction = function () { throw Error.notImplemented() }; Sys.NotifyCollectionChangedAction.prototype = { add: 0, remove: 1, reset: 2 }; Sys.NotifyCollectionChangedAction.registerEnum("Sys.NotifyCollectionChangedAction"); Sys.NotifyCollectionChangedEventArgs = function (a) { this._changes = a; Sys.NotifyCollectionChangedEventArgs.initializeBase(this) }; Sys.NotifyCollectionChangedEventArgs.prototype = { get_changes: function () { return this._changes || [] } }; Sys.NotifyCollectionChangedEventArgs.registerClass("Sys.NotifyCollectionChangedEventArgs", Sys.EventArgs); Sys.Observer = function () { }; Sys.Observer.registerClass("Sys.Observer"); Sys.Observer.makeObservable = function (a) { var c = a instanceof Array, b = Sys.Observer; if (a.setValue === b._observeMethods.setValue) return a; b._addMethods(a, b._observeMethods); if (c) b._addMethods(a, b._arrayMethods); return a }; Sys.Observer._addMethods = function (c, b) { for (var a in b) c[a] = b[a] }; Sys.Observer._addEventHandler = function (c, a, b) { Sys.Observer._getContext(c, true).events._addHandler(a, b) }; Sys.Observer.addEventHandler = function (c, a, b) { Sys.Observer._addEventHandler(c, a, b) }; Sys.Observer._removeEventHandler = function (c, a, b) { Sys.Observer._getContext(c, true).events._removeHandler(a, b) }; Sys.Observer.removeEventHandler = function (c, a, b) { Sys.Observer._removeEventHandler(c, a, b) }; Sys.Observer.raiseEvent = function (b, e, d) { var c = Sys.Observer._getContext(b); if (!c) return; var a = c.events.getHandler(e); if (a) a(b, d) }; Sys.Observer.addPropertyChanged = function (b, a) { Sys.Observer._addEventHandler(b, "propertyChanged", a) }; Sys.Observer.removePropertyChanged = function (b, a) { Sys.Observer._removeEventHandler(b, "propertyChanged", a) }; Sys.Observer.beginUpdate = function (a) { Sys.Observer._getContext(a, true).updating = true }; Sys.Observer.endUpdate = function (b) { var a = Sys.Observer._getContext(b); if (!a || !a.updating) return; a.updating = false; var d = a.dirty; a.dirty = false; if (d) { if (b instanceof Array) { var c = a.changes; a.changes = null; Sys.Observer.raiseCollectionChanged(b, c) } Sys.Observer.raisePropertyChanged(b, "") } }; Sys.Observer.isUpdating = function (b) { var a = Sys.Observer._getContext(b); return a ? a.updating : false }; Sys.Observer._setValue = function (a, j, g) { var b, f, k = a, d = j.split("."); for (var i = 0, m = d.length - 1; i < m; i++) { var l = d[i]; b = a["get_" + l]; if (typeof b === "function") a = b.call(a); else a = a[l]; var n = typeof a; if (a === null || n === "undefined") throw Error.invalidOperation(String.format(Sys.Res.nullReferenceInPath, j)) } var e, c = d[m]; b = a["get_" + c]; f = a["set_" + c]; if (typeof b === "function") e = b.call(a); else e = a[c]; if (typeof f === "function") f.call(a, g); else a[c] = g; if (e !== g) { var h = Sys.Observer._getContext(k); if (h && h.updating) { h.dirty = true; return } Sys.Observer.raisePropertyChanged(k, d[0]) } }; Sys.Observer.setValue = function (b, a, c) { Sys.Observer._setValue(b, a, c) }; Sys.Observer.raisePropertyChanged = function (b, a) { Sys.Observer.raiseEvent(b, "propertyChanged", new Sys.PropertyChangedEventArgs(a)) }; Sys.Observer.addCollectionChanged = function (b, a) { Sys.Observer._addEventHandler(b, "collectionChanged", a) }; Sys.Observer.removeCollectionChanged = function (b, a) { Sys.Observer._removeEventHandler(b, "collectionChanged", a) }; Sys.Observer._collectionChange = function (d, c) { var a = Sys.Observer._getContext(d); if (a && a.updating) { a.dirty = true; var b = a.changes; if (!b) a.changes = b = [c]; else b.push(c) } else { Sys.Observer.raiseCollectionChanged(d, [c]); Sys.Observer.raisePropertyChanged(d, "length") } }; Sys.Observer.add = function (a, b) { var c = new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.add, [b], a.length); Array.add(a, b); Sys.Observer._collectionChange(a, c) }; Sys.Observer.addRange = function (a, b) { var c = new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.add, b, a.length); Array.addRange(a, b); Sys.Observer._collectionChange(a, c) }; Sys.Observer.clear = function (a) { var b = Array.clone(a); Array.clear(a); Sys.Observer._collectionChange(a, new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.reset, null, -1, b, 0)) }; Sys.Observer.insert = function (a, b, c) { Array.insert(a, b, c); Sys.Observer._collectionChange(a, new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.add, [c], b)) }; Sys.Observer.remove = function (a, b) { var c = Array.indexOf(a, b); if (c !== -1) { Array.remove(a, b); Sys.Observer._collectionChange(a, new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.remove, null, -1, [b], c)); return true } return false }; Sys.Observer.removeAt = function (b, a) { if (a > -1 && a < b.length) { var c = b[a]; Array.removeAt(b, a); Sys.Observer._collectionChange(b, new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.remove, null, -1, [c], a)) } }; Sys.Observer.raiseCollectionChanged = function (b, a) { Sys.Observer.raiseEvent(b, "collectionChanged", new Sys.NotifyCollectionChangedEventArgs(a)) }; Sys.Observer._observeMethods = { add_propertyChanged: function (a) { Sys.Observer._addEventHandler(this, "propertyChanged", a) }, remove_propertyChanged: function (a) { Sys.Observer._removeEventHandler(this, "propertyChanged", a) }, addEventHandler: function (a, b) { Sys.Observer._addEventHandler(this, a, b) }, removeEventHandler: function (a, b) { Sys.Observer._removeEventHandler(this, a, b) }, get_isUpdating: function () { return Sys.Observer.isUpdating(this) }, beginUpdate: function () { Sys.Observer.beginUpdate(this) }, endUpdate: function () { Sys.Observer.endUpdate(this) }, setValue: function (b, a) { Sys.Observer._setValue(this, b, a) }, raiseEvent: function (b, a) { Sys.Observer.raiseEvent(this, b, a) }, raisePropertyChanged: function (a) { Sys.Observer.raiseEvent(this, "propertyChanged", new Sys.PropertyChangedEventArgs(a)) } }; Sys.Observer._arrayMethods = { add_collectionChanged: function (a) { Sys.Observer._addEventHandler(this, "collectionChanged", a) }, remove_collectionChanged: function (a) { Sys.Observer._removeEventHandler(this, "collectionChanged", a) }, add: function (a) { Sys.Observer.add(this, a) }, addRange: function (a) { Sys.Observer.addRange(this, a) }, clear: function () { Sys.Observer.clear(this) }, insert: function (a, b) { Sys.Observer.insert(this, a, b) }, remove: function (a) { return Sys.Observer.remove(this, a) }, removeAt: function (a) { Sys.Observer.removeAt(this, a) }, raiseCollectionChanged: function (a) { Sys.Observer.raiseEvent(this, "collectionChanged", new Sys.NotifyCollectionChangedEventArgs(a)) } }; Sys.Observer._getContext = function (b, c) { var a = b._observerContext; if (a) return a(); if (c) return (b._observerContext = Sys.Observer._createContext())(); return null }; Sys.Observer._createContext = function () { var a = { events: new Sys.EventHandlerList }; return function () { return a } }; Date._appendPreOrPostMatch = function (e, b) { var d = 0, a = false; for (var c = 0, g = e.length; c < g; c++) { var f = e.charAt(c); switch (f) { case "'": if (a) b.append("'"); else d++; a = false; break; case "\\": if (a) b.append("\\"); a = !a; break; default: b.append(f); a = false } } return d }; Date._expandFormat = function (a, b) { if (!b) b = "F"; var c = b.length; if (c === 1) switch (b) { case "d": return a.ShortDatePattern; case "D": return a.LongDatePattern; case "t": return a.ShortTimePattern; case "T": return a.LongTimePattern; case "f": return a.LongDatePattern + " " + a.ShortTimePattern; case "F": return a.FullDateTimePattern; case "M": case "m": return a.MonthDayPattern; case "s": return a.SortableDateTimePattern; case "Y": case "y": return a.YearMonthPattern; default: throw Error.format(Sys.Res.formatInvalidString) } else if (c === 2 && b.charAt(0) === "%") b = b.charAt(1); return b }; Date._expandYear = function (c, a) { var d = new Date, e = Date._getEra(d); if (a < 100) { var b = Date._getEraYear(d, c, e); a += b - b % 100; if (a > c.Calendar.TwoDigitYearMax) a -= 100 } return a }; Date._getEra = function (e, c) { if (!c) return 0; var b, d = e.getTime(); for (var a = 0, f = c.length; a < f; a += 4) { b = c[a + 2]; if (b === null || d >= b) return a } return 0 }; Date._getEraYear = function (d, b, e, c) { var a = d.getFullYear(); if (!c && b.eras) a -= b.eras[e + 3]; return a }; Date._getParseRegExp = function (b, e) { if (!b._parseRegExp) b._parseRegExp = {}; else if (b._parseRegExp[e]) return b._parseRegExp[e]; var c = Date._expandFormat(b, e); c = c.replace(/([\^\$\.\*\+\?\|\[\]\(\)\{\}])/g, "\\\\$1"); var a = new Sys.StringBuilder("^"), j = [], f = 0, i = 0, h = Date._getTokenRegExp(), d; while ((d = h.exec(c)) !== null) { var l = c.slice(f, d.index); f = h.lastIndex; i += Date._appendPreOrPostMatch(l, a); if (i % 2 === 1) { a.append(d[0]); continue } switch (d[0]) { case "dddd": case "ddd": case "MMMM": case "MMM": case "gg": case "g": a.append("(\\D+)"); break; case "tt": case "t": a.append("(\\D*)"); break; case "yyyy": a.append("(\\d{4})"); break; case "fff": a.append("(\\d{3})"); break; case "ff": a.append("(\\d{2})"); break; case "f": a.append("(\\d)"); break; case "dd": case "d": case "MM": case "M": case "yy": case "y": case "HH": case "H": case "hh": case "h": case "mm": case "m": case "ss": case "s": a.append("(\\d\\d?)"); break; case "zzz": a.append("([+-]?\\d\\d?:\\d{2})"); break; case "zz": case "z": a.append("([+-]?\\d\\d?)"); break; case "/": a.append("(\\" + b.DateSeparator + ")") } Array.add(j, d[0]) } Date._appendPreOrPostMatch(c.slice(f), a); a.append("$"); var k = a.toString().replace(/\s+/g, "\\s+"), g = { "regExp": k, "groups": j }; b._parseRegExp[e] = g; return g }; Date._getTokenRegExp = function () { return /\/|dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yy|y|hh|h|HH|H|mm|m|ss|s|tt|t|fff|ff|f|zzz|zz|z|gg|g/g }; Date.parseLocale = function (a) { return Date._parse(a, Sys.CultureInfo.CurrentCulture, arguments) }; Date.parseInvariant = function (a) { return Date._parse(a, Sys.CultureInfo.InvariantCulture, arguments) }; Date._parse = function (h, d, i) { var a, c, b, f, e, g = false; for (a = 1, c = i.length; a < c; a++) { f = i[a]; if (f) { g = true; b = Date._parseExact(h, f, d); if (b) return b } } if (!g) { e = d._getDateTimeFormats(); for (a = 0, c = e.length; a < c; a++) { b = Date._parseExact(h, e[a], d); if (b) return b } } return null }; Date._parseExact = function (w, D, k) { w = w.trim(); var g = k.dateTimeFormat, A = Date._getParseRegExp(g, D), C = (new RegExp(A.regExp)).exec(w); if (C === null) return null; var B = A.groups, x = null, e = null, c = null, j = null, i = null, d = 0, h, p = 0, q = 0, f = 0, l = null, v = false; for (var s = 0, E = B.length; s < E; s++) { var a = C[s + 1]; if (a) switch (B[s]) { case "dd": case "d": j = parseInt(a, 10); if (j < 1 || j > 31) return null; break; case "MMMM": c = k._getMonthIndex(a); if (c < 0 || c > 11) return null; break; case "MMM": c = k._getAbbrMonthIndex(a); if (c < 0 || c > 11) return null; break; case "M": case "MM": c = parseInt(a, 10) - 1; if (c < 0 || c > 11) return null; break; case "y": case "yy": e = Date._expandYear(g, parseInt(a, 10)); if (e < 0 || e > 9999) return null; break; case "yyyy": e = parseInt(a, 10); if (e < 0 || e > 9999) return null; break; case "h": case "hh": d = parseInt(a, 10); if (d === 12) d = 0; if (d < 0 || d > 11) return null; break; case "H": case "HH": d = parseInt(a, 10); if (d < 0 || d > 23) return null; break; case "m": case "mm": p = parseInt(a, 10); if (p < 0 || p > 59) return null; break; case "s": case "ss": q = parseInt(a, 10); if (q < 0 || q > 59) return null; break; case "tt": case "t": var z = a.toUpperCase(); v = z === g.PMDesignator.toUpperCase(); if (!v && z !== g.AMDesignator.toUpperCase()) return null; break; case "f": f = parseInt(a, 10) * 100; if (f < 0 || f > 999) return null; break; case "ff": f = parseInt(a, 10) * 10; if (f < 0 || f > 999) return null; break; case "fff": f = parseInt(a, 10); if (f < 0 || f > 999) return null; break; case "dddd": i = k._getDayIndex(a); if (i < 0 || i > 6) return null; break; case "ddd": i = k._getAbbrDayIndex(a); if (i < 0 || i > 6) return null; break; case "zzz": var u = a.split(/:/); if (u.length !== 2) return null; h = parseInt(u[0], 10); if (h < -12 || h > 13) return null; var m = parseInt(u[1], 10); if (m < 0 || m > 59) return null; l = h * 60 + (a.startsWith("-") ? -m : m); break; case "z": case "zz": h = parseInt(a, 10); if (h < -12 || h > 13) return null; l = h * 60; break; case "g": case "gg": var o = a; if (!o || !g.eras) return null; o = o.toLowerCase().trim(); for (var r = 0, F = g.eras.length; r < F; r += 4) if (o === g.eras[r + 1].toLowerCase()) { x = r; break } if (x === null) return null } } var b = new Date, t, n = g.Calendar.convert; if (n) t = n.fromGregorian(b)[0]; else t = b.getFullYear(); if (e === null) e = t; else if (g.eras) e += g.eras[(x || 0) + 3]; if (c === null) c = 0; if (j === null) j = 1; if (n) { b = n.toGregorian(e, c, j); if (b === null) return null } else { b.setFullYear(e, c, j); if (b.getDate() !== j) return null; if (i !== null && b.getDay() !== i) return null } if (v && d < 12) d += 12; b.setHours(d, p, q, f); if (l !== null) { var y = b.getMinutes() - (l + b.getTimezoneOffset()); b.setHours(b.getHours() + parseInt(y / 60, 10), y % 60) } return b }; Date.prototype.format = function (a) { return this._toFormattedString(a, Sys.CultureInfo.InvariantCulture) }; Date.prototype.localeFormat = function (a) { return this._toFormattedString(a, Sys.CultureInfo.CurrentCulture) }; Date.prototype._toFormattedString = function (e, j) { var b = j.dateTimeFormat, n = b.Calendar.convert; if (!e || !e.length || e === "i") if (j && j.name.length) if (n) return this._toFormattedString(b.FullDateTimePattern, j); else { var r = new Date(this.getTime()), x = Date._getEra(this, b.eras); r.setFullYear(Date._getEraYear(this, b, x)); return r.toLocaleString() } else return this.toString(); var l = b.eras, k = e === "s"; e = Date._expandFormat(b, e); var a = new Sys.StringBuilder, c; function d(a) { if (a < 10) return "0" + a; return a.toString() } function m(a) { if (a < 10) return "00" + a; if (a < 100) return "0" + a; return a.toString() } function v(a) { if (a < 10) return "000" + a; else if (a < 100) return "00" + a; else if (a < 1000) return "0" + a; return a.toString() } var h, p, t = /([^d]|^)(d|dd)([^d]|$)/g; function s() { if (h || p) return h; h = t.test(e); p = true; return h } var q = 0, o = Date._getTokenRegExp(), f; if (!k && n) f = n.fromGregorian(this); for (; true;) { var w = o.lastIndex, i = o.exec(e), u = e.slice(w, i ? i.index : e.length); q += Date._appendPreOrPostMatch(u, a); if (!i) break; if (q % 2 === 1) { a.append(i[0]); continue } function g(a, b) { if (f) return f[b]; switch (b) { case 0: return a.getFullYear(); case 1: return a.getMonth(); case 2: return a.getDate() } } switch (i[0]) { case "dddd": a.append(b.DayNames[this.getDay()]); break; case "ddd": a.append(b.AbbreviatedDayNames[this.getDay()]); break; case "dd": h = true; a.append(d(g(this, 2))); break; case "d": h = true; a.append(g(this, 2)); break; case "MMMM": a.append(b.MonthGenitiveNames && s() ? b.MonthGenitiveNames[g(this, 1)] : b.MonthNames[g(this, 1)]); break; case "MMM": a.append(b.AbbreviatedMonthGenitiveNames && s() ? b.AbbreviatedMonthGenitiveNames[g(this, 1)] : b.AbbreviatedMonthNames[g(this, 1)]); break; case "MM": a.append(d(g(this, 1) + 1)); break; case "M": a.append(g(this, 1) + 1); break; case "yyyy": a.append(v(f ? f[0] : Date._getEraYear(this, b, Date._getEra(this, l), k))); break; case "yy": a.append(d((f ? f[0] : Date._getEraYear(this, b, Date._getEra(this, l), k)) % 100)); break; case "y": a.append((f ? f[0] : Date._getEraYear(this, b, Date._getEra(this, l), k)) % 100); break; case "hh": c = this.getHours() % 12; if (c === 0) c = 12; a.append(d(c)); break; case "h": c = this.getHours() % 12; if (c === 0) c = 12; a.append(c); break; case "HH": a.append(d(this.getHours())); break; case "H": a.append(this.getHours()); break; case "mm": a.append(d(this.getMinutes())); break; case "m": a.append(this.getMinutes()); break; case "ss": a.append(d(this.getSeconds())); break; case "s": a.append(this.getSeconds()); break; case "tt": a.append(this.getHours() < 12 ? b.AMDesignator : b.PMDesignator); break; case "t": a.append((this.getHours() < 12 ? b.AMDesignator : b.PMDesignator).charAt(0)); break; case "f": a.append(m(this.getMilliseconds()).charAt(0)); break; case "ff": a.append(m(this.getMilliseconds()).substr(0, 2)); break; case "fff": a.append(m(this.getMilliseconds())); break; case "z": c = this.getTimezoneOffset() / 60; a.append((c <= 0 ? "+" : "-") + Math.floor(Math.abs(c))); break; case "zz": c = this.getTimezoneOffset() / 60; a.append((c <= 0 ? "+" : "-") + d(Math.floor(Math.abs(c)))); break; case "zzz": c = this.getTimezoneOffset() / 60; a.append((c <= 0 ? "+" : "-") + d(Math.floor(Math.abs(c))) + ":" + d(Math.abs(this.getTimezoneOffset() % 60))); break; case "g": case "gg": if (b.eras) a.append(b.eras[Date._getEra(this, l) + 1]); break; case "/": a.append(b.DateSeparator) } } return a.toString() }; String.localeFormat = function () { return String._toFormattedString(true, arguments) }; Number.parseLocale = function (a) { return Number._parse(a, Sys.CultureInfo.CurrentCulture) }; Number.parseInvariant = function (a) { return Number._parse(a, Sys.CultureInfo.InvariantCulture) }; Number._parse = function (b, o) { b = b.trim(); if (b.match(/^[+-]?infinity$/i)) return parseFloat(b); if (b.match(/^0x[a-f0-9]+$/i)) return parseInt(b); var a = o.numberFormat, g = Number._parseNumberNegativePattern(b, a, a.NumberNegativePattern), h = g[0], e = g[1]; if (h === "" && a.NumberNegativePattern !== 1) { g = Number._parseNumberNegativePattern(b, a, 1); h = g[0]; e = g[1] } if (h === "") h = "+"; var j, d, f = e.indexOf("e"); if (f < 0) f = e.indexOf("E"); if (f < 0) { d = e; j = null } else { d = e.substr(0, f); j = e.substr(f + 1) } var c, k, m = d.indexOf(a.NumberDecimalSeparator); if (m < 0) { c = d; k = null } else { c = d.substr(0, m); k = d.substr(m + a.NumberDecimalSeparator.length) } c = c.split(a.NumberGroupSeparator).join(""); var n = a.NumberGroupSeparator.replace(/\u00A0/g, " "); if (a.NumberGroupSeparator !== n) c = c.split(n).join(""); var l = h + c; if (k !== null) l += "." + k; if (j !== null) { var i = Number._parseNumberNegativePattern(j, a, 1); if (i[0] === "") i[0] = "+"; l += "e" + i[0] + i[1] } if (l.match(/^[+-]?\d*\.?\d*(e[+-]?\d+)?$/)) return parseFloat(l); return Number.NaN }; Number._parseNumberNegativePattern = function (a, d, e) { var b = d.NegativeSign, c = d.PositiveSign; switch (e) { case 4: b = " " + b; c = " " + c; case 3: if (a.endsWith(b)) return ["-", a.substr(0, a.length - b.length)]; else if (a.endsWith(c)) return ["+", a.substr(0, a.length - c.length)]; break; case 2: b += " "; c += " "; case 1: if (a.startsWith(b)) return ["-", a.substr(b.length)]; else if (a.startsWith(c)) return ["+", a.substr(c.length)]; break; case 0: if (a.startsWith("(") && a.endsWith(")")) return ["-", a.substr(1, a.length - 2)] } return ["", a] }; Number.prototype.format = function (a) { return this._toFormattedString(a, Sys.CultureInfo.InvariantCulture) }; Number.prototype.localeFormat = function (a) { return this._toFormattedString(a, Sys.CultureInfo.CurrentCulture) }; Number.prototype._toFormattedString = function (e, j) { if (!e || e.length === 0 || e === "i") if (j && j.name.length > 0) return this.toLocaleString(); else return this.toString(); var o = ["n %", "n%", "%n"], n = ["-n %", "-n%", "-%n"], p = ["(n)", "-n", "- n", "n-", "n -"], m = ["$n", "n$", "$ n", "n $"], l = ["($n)", "-$n", "$-n", "$n-", "(n$)", "-n$", "n-$", "n$-", "-n $", "-$ n", "n $-", "$ n-", "$ -n", "n- $", "($ n)", "(n $)"]; function g(a, c, d) { for (var b = a.length; b < c; b++) a = d ? "0" + a : a + "0"; return a } function i(j, i, l, n, p) { var h = l[0], k = 1, o = Math.pow(10, i), m = Math.round(j * o) / o; if (!isFinite(m)) m = j; j = m; var b = j.toString(), a = "", c, e = b.split(/e/i); b = e[0]; c = e.length > 1 ? parseInt(e[1]) : 0; e = b.split("."); b = e[0]; a = e.length > 1 ? e[1] : ""; var q; if (c > 0) { a = g(a, c, false); b += a.slice(0, c); a = a.substr(c) } else if (c < 0) { c = -c; b = g(b, c + 1, true); a = b.slice(-c, b.length) + a; b = b.slice(0, -c) } if (i > 0) { if (a.length > i) a = a.slice(0, i); else a = g(a, i, false); a = p + a } else a = ""; var d = b.length - 1, f = ""; while (d >= 0) { if (h === 0 || h > d) if (f.length > 0) return b.slice(0, d + 1) + n + f + a; else return b.slice(0, d + 1) + a; if (f.length > 0) f = b.slice(d - h + 1, d + 1) + n + f; else f = b.slice(d - h + 1, d + 1); d -= h; if (k < l.length) { h = l[k]; k++ } } return b.slice(0, d + 1) + n + f + a } var a = j.numberFormat, d = Math.abs(this); if (!e) e = "D"; var b = -1; if (e.length > 1) b = parseInt(e.slice(1), 10); var c; switch (e.charAt(0)) { case "d": case "D": c = "n"; if (b !== -1) d = g("" + d, b, true); if (this < 0) d = -d; break; case "c": case "C": if (this < 0) c = l[a.CurrencyNegativePattern]; else c = m[a.CurrencyPositivePattern]; if (b === -1) b = a.CurrencyDecimalDigits; d = i(Math.abs(this), b, a.CurrencyGroupSizes, a.CurrencyGroupSeparator, a.CurrencyDecimalSeparator); break; case "n": case "N": if (this < 0) c = p[a.NumberNegativePattern]; else c = "n"; if (b === -1) b = a.NumberDecimalDigits; d = i(Math.abs(this), b, a.NumberGroupSizes, a.NumberGroupSeparator, a.NumberDecimalSeparator); break; case "p": case "P": if (this < 0) c = n[a.PercentNegativePattern]; else c = o[a.PercentPositivePattern]; if (b === -1) b = a.PercentDecimalDigits; d = i(Math.abs(this) * 100, b, a.PercentGroupSizes, a.PercentGroupSeparator, a.PercentDecimalSeparator); break; default: throw Error.format(Sys.Res.formatBadFormatSpecifier) } var k = /n|\$|-|%/g, f = ""; for (; true;) { var q = k.lastIndex, h = k.exec(c); f += c.slice(q, h ? h.index : c.length); if (!h) break; switch (h[0]) { case "n": f += d; break; case "$": f += a.CurrencySymbol; break; case "-": if (/[1-9]/.test(d)) f += a.NegativeSign; break; case "%": f += a.PercentSymbol } } return f }; Sys.CultureInfo = function (c, b, a) { this.name = c; this.numberFormat = b; this.dateTimeFormat = a }; Sys.CultureInfo.prototype = { _getDateTimeFormats: function () { if (!this._dateTimeFormats) { var a = this.dateTimeFormat; this._dateTimeFormats = [a.MonthDayPattern, a.YearMonthPattern, a.ShortDatePattern, a.ShortTimePattern, a.LongDatePattern, a.LongTimePattern, a.FullDateTimePattern, a.RFC1123Pattern, a.SortableDateTimePattern, a.UniversalSortableDateTimePattern] } return this._dateTimeFormats }, _getIndex: function (c, d, e) { var b = this._toUpper(c), a = Array.indexOf(d, b); if (a === -1) a = Array.indexOf(e, b); return a }, _getMonthIndex: function (a) { if (!this._upperMonths) { this._upperMonths = this._toUpperArray(this.dateTimeFormat.MonthNames); this._upperMonthsGenitive = this._toUpperArray(this.dateTimeFormat.MonthGenitiveNames) } return this._getIndex(a, this._upperMonths, this._upperMonthsGenitive) }, _getAbbrMonthIndex: function (a) { if (!this._upperAbbrMonths) { this._upperAbbrMonths = this._toUpperArray(this.dateTimeFormat.AbbreviatedMonthNames); this._upperAbbrMonthsGenitive = this._toUpperArray(this.dateTimeFormat.AbbreviatedMonthGenitiveNames) } return this._getIndex(a, this._upperAbbrMonths, this._upperAbbrMonthsGenitive) }, _getDayIndex: function (a) { if (!this._upperDays) this._upperDays = this._toUpperArray(this.dateTimeFormat.DayNames); return Array.indexOf(this._upperDays, this._toUpper(a)) }, _getAbbrDayIndex: function (a) { if (!this._upperAbbrDays) this._upperAbbrDays = this._toUpperArray(this.dateTimeFormat.AbbreviatedDayNames); return Array.indexOf(this._upperAbbrDays, this._toUpper(a)) }, _toUpperArray: function (c) { var b = []; for (var a = 0, d = c.length; a < d; a++) b[a] = this._toUpper(c[a]); return b }, _toUpper: function (a) { return a.split("\u00a0").join(" ").toUpperCase() } }; Sys.CultureInfo.registerClass("Sys.CultureInfo"); Sys.CultureInfo._parse = function (a) { var b = a.dateTimeFormat; if (b && !b.eras) b.eras = a.eras; return new Sys.CultureInfo(a.name, a.numberFormat, b) }; Sys.CultureInfo.InvariantCulture = Sys.CultureInfo._parse({ "name": "", "numberFormat": { "CurrencyDecimalDigits": 2, "CurrencyDecimalSeparator": ".", "IsReadOnly": true, "CurrencyGroupSizes": [3], "NumberGroupSizes": [3], "PercentGroupSizes": [3], "CurrencyGroupSeparator": ",", "CurrencySymbol": "\u00a4", "NaNSymbol": "NaN", "CurrencyNegativePattern": 0, "NumberNegativePattern": 1, "PercentPositivePattern": 0, "PercentNegativePattern": 0, "NegativeInfinitySymbol": "-Infinity", "NegativeSign": "-", "NumberDecimalDigits": 2, "NumberDecimalSeparator": ".", "NumberGroupSeparator": ",", "CurrencyPositivePattern": 0, "PositiveInfinitySymbol": "Infinity", "PositiveSign": "+", "PercentDecimalDigits": 2, "PercentDecimalSeparator": ".", "PercentGroupSeparator": ",", "PercentSymbol": "%", "PerMilleSymbol": "\u2030", "NativeDigits": ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], "DigitSubstitution": 1 }, "dateTimeFormat": { "AMDesignator": "AM", "Calendar": { "MinSupportedDateTime": "@-62135568000000@", "MaxSupportedDateTime": "@253402300799999@", "AlgorithmType": 1, "CalendarType": 1, "Eras": [1], "TwoDigitYearMax": 2029, "IsReadOnly": true }, "DateSeparator": "/", "FirstDayOfWeek": 0, "CalendarWeekRule": 0, "FullDateTimePattern": "dddd, dd MMMM yyyy HH:mm:ss", "LongDatePattern": "dddd, dd MMMM yyyy", "LongTimePattern": "HH:mm:ss", "MonthDayPattern": "MMMM dd", "PMDesignator": "PM", "RFC1123Pattern": "ddd, dd MMM yyyy HH':'mm':'ss 'GMT'", "ShortDatePattern": "MM/dd/yyyy", "ShortTimePattern": "HH:mm", "SortableDateTimePattern": "yyyy'-'MM'-'dd'T'HH':'mm':'ss", "TimeSeparator": ":", "UniversalSortableDateTimePattern": "yyyy'-'MM'-'dd HH':'mm':'ss'Z'", "YearMonthPattern": "yyyy MMMM", "AbbreviatedDayNames": ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], "ShortestDayNames": ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], "DayNames": ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], "AbbreviatedMonthNames": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""], "MonthNames": ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", ""], "IsReadOnly": true, "NativeCalendarName": "Gregorian Calendar", "AbbreviatedMonthGenitiveNames": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""], "MonthGenitiveNames": ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", ""] }, "eras": [1, "A.D.", null, 0] }); if (typeof __cultureInfo === "object") { Sys.CultureInfo.CurrentCulture = Sys.CultureInfo._parse(__cultureInfo); delete __cultureInfo } else Sys.CultureInfo.CurrentCulture = Sys.CultureInfo._parse({ "name": "en-US", "numberFormat": { "CurrencyDecimalDigits": 2, "CurrencyDecimalSeparator": ".", "IsReadOnly": false, "CurrencyGroupSizes": [3], "NumberGroupSizes": [3], "PercentGroupSizes": [3], "CurrencyGroupSeparator": ",", "CurrencySymbol": "$", "NaNSymbol": "NaN", "CurrencyNegativePattern": 0, "NumberNegativePattern": 1, "PercentPositivePattern": 0, "PercentNegativePattern": 0, "NegativeInfinitySymbol": "-Infinity", "NegativeSign": "-", "NumberDecimalDigits": 2, "NumberDecimalSeparator": ".", "NumberGroupSeparator": ",", "CurrencyPositivePattern": 0, "PositiveInfinitySymbol": "Infinity", "PositiveSign": "+", "PercentDecimalDigits": 2, "PercentDecimalSeparator": ".", "PercentGroupSeparator": ",", "PercentSymbol": "%", "PerMilleSymbol": "\u2030", "NativeDigits": ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], "DigitSubstitution": 1 }, "dateTimeFormat": { "AMDesignator": "AM", "Calendar": { "MinSupportedDateTime": "@-62135568000000@", "MaxSupportedDateTime": "@253402300799999@", "AlgorithmType": 1, "CalendarType": 1, "Eras": [1], "TwoDigitYearMax": 2029, "IsReadOnly": false }, "DateSeparator": "/", "FirstDayOfWeek": 0, "CalendarWeekRule": 0, "FullDateTimePattern": "dddd, MMMM dd, yyyy h:mm:ss tt", "LongDatePattern": "dddd, MMMM dd, yyyy", "LongTimePattern": "h:mm:ss tt", "MonthDayPattern": "MMMM dd", "PMDesignator": "PM", "RFC1123Pattern": "ddd, dd MMM yyyy HH':'mm':'ss 'GMT'", "ShortDatePattern": "M/d/yyyy", "ShortTimePattern": "h:mm tt", "SortableDateTimePattern": "yyyy'-'MM'-'dd'T'HH':'mm':'ss", "TimeSeparator": ":", "UniversalSortableDateTimePattern": "yyyy'-'MM'-'dd HH':'mm':'ss'Z'", "YearMonthPattern": "MMMM, yyyy", "AbbreviatedDayNames": ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], "ShortestDayNames": ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], "DayNames": ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], "AbbreviatedMonthNames": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""], "MonthNames": ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", ""], "IsReadOnly": false, "NativeCalendarName": "Gregorian Calendar", "AbbreviatedMonthGenitiveNames": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""], "MonthGenitiveNames": ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", ""] }, "eras": [1, "A.D.", null, 0] }); Type.registerNamespace("Sys.Serialization"); Sys.Serialization.JavaScriptSerializer = function () { }; Sys.Serialization.JavaScriptSerializer.registerClass("Sys.Serialization.JavaScriptSerializer"); Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs = []; Sys.Serialization.JavaScriptSerializer._charsToEscape = []; Sys.Serialization.JavaScriptSerializer._dateRegEx = new RegExp('(^|[^\\\\])\\"\\\\/Date\\((-?[0-9]+)(?:[a-zA-Z]|(?:\\+|-)[0-9]{4})?\\)\\\\/\\"', "g"); Sys.Serialization.JavaScriptSerializer._escapeChars = {}; Sys.Serialization.JavaScriptSerializer._escapeRegEx = new RegExp('["\\\\\\x00-\\x1F]', "i"); Sys.Serialization.JavaScriptSerializer._escapeRegExGlobal = new RegExp('["\\\\\\x00-\\x1F]', "g"); Sys.Serialization.JavaScriptSerializer._jsonRegEx = new RegExp("[^,:{}\\[\\]0-9.\\-+Eaeflnr-u \\n\\r\\t]", "g"); Sys.Serialization.JavaScriptSerializer._jsonStringRegEx = new RegExp('"(\\\\.|[^"\\\\])*"', "g"); Sys.Serialization.JavaScriptSerializer._serverTypeFieldName = "__type"; Sys.Serialization.JavaScriptSerializer._init = function () { var c = ["\\u0000", "\\u0001", "\\u0002", "\\u0003", "\\u0004", "\\u0005", "\\u0006", "\\u0007", "\\b", "\\t", "\\n", "\\u000b", "\\f", "\\r", "\\u000e", "\\u000f", "\\u0010", "\\u0011", "\\u0012", "\\u0013", "\\u0014", "\\u0015", "\\u0016", "\\u0017", "\\u0018", "\\u0019", "\\u001a", "\\u001b", "\\u001c", "\\u001d", "\\u001e", "\\u001f"]; Sys.Serialization.JavaScriptSerializer._charsToEscape[0] = "\\"; Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs["\\"] = new RegExp("\\\\", "g"); Sys.Serialization.JavaScriptSerializer._escapeChars["\\"] = "\\\\"; Sys.Serialization.JavaScriptSerializer._charsToEscape[1] = '"'; Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs['"'] = new RegExp('"', "g"); Sys.Serialization.JavaScriptSerializer._escapeChars['"'] = '\\"'; for (var a = 0; a < 32; a++) { var b = String.fromCharCode(a); Sys.Serialization.JavaScriptSerializer._charsToEscape[a + 2] = b; Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs[b] = new RegExp(b, "g"); Sys.Serialization.JavaScriptSerializer._escapeChars[b] = c[a] } }; Sys.Serialization.JavaScriptSerializer._serializeBooleanWithBuilder = function (b, a) { a.append(b.toString()) }; Sys.Serialization.JavaScriptSerializer._serializeNumberWithBuilder = function (a, b) { if (isFinite(a)) b.append(String(a)); else throw Error.invalidOperation(Sys.Res.cannotSerializeNonFiniteNumbers) }; Sys.Serialization.JavaScriptSerializer._serializeStringWithBuilder = function (a, c) { c.append('"'); if (Sys.Serialization.JavaScriptSerializer._escapeRegEx.test(a)) { if (Sys.Serialization.JavaScriptSerializer._charsToEscape.length === 0) Sys.Serialization.JavaScriptSerializer._init(); if (a.length < 128) a = a.replace(Sys.Serialization.JavaScriptSerializer._escapeRegExGlobal, function (a) { return Sys.Serialization.JavaScriptSerializer._escapeChars[a] }); else for (var d = 0; d < 34; d++) { var b = Sys.Serialization.JavaScriptSerializer._charsToEscape[d]; if (a.indexOf(b) !== -1) if (Sys.Browser.agent === Sys.Browser.Opera || Sys.Browser.agent === Sys.Browser.FireFox) a = a.split(b).join(Sys.Serialization.JavaScriptSerializer._escapeChars[b]); else a = a.replace(Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs[b], Sys.Serialization.JavaScriptSerializer._escapeChars[b]) } } c.append(a); c.append('"') }; Sys.Serialization.JavaScriptSerializer._serializeWithBuilder = function (b, a, i, g) { var c; switch (typeof b) { case "object": if (b) if (Number.isInstanceOfType(b)) Sys.Serialization.JavaScriptSerializer._serializeNumberWithBuilder(b, a); else if (Boolean.isInstanceOfType(b)) Sys.Serialization.JavaScriptSerializer._serializeBooleanWithBuilder(b, a); else if (String.isInstanceOfType(b)) Sys.Serialization.JavaScriptSerializer._serializeStringWithBuilder(b, a); else if (Array.isInstanceOfType(b)) { a.append("["); for (c = 0; c < b.length; ++c) { if (c > 0) a.append(","); Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(b[c], a, false, g) } a.append("]") } else { if (Date.isInstanceOfType(b)) { a.append('"\\/Date('); a.append(b.getTime()); a.append(')\\/"'); break } var d = [], f = 0; for (var e in b) { if (e.startsWith("$")) continue; if (e === Sys.Serialization.JavaScriptSerializer._serverTypeFieldName && f !== 0) { d[f++] = d[0]; d[0] = e } else d[f++] = e } if (i) d.sort(); a.append("{"); var j = false; for (c = 0; c < f; c++) { var h = b[d[c]]; if (typeof h !== "undefined" && typeof h !== "function") { if (j) a.append(","); else j = true; Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(d[c], a, i, g); a.append(":"); Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(h, a, i, g) } } a.append("}") } else a.append("null"); break; case "number": Sys.Serialization.JavaScriptSerializer._serializeNumberWithBuilder(b, a); break; case "string": Sys.Serialization.JavaScriptSerializer._serializeStringWithBuilder(b, a); break; case "boolean": Sys.Serialization.JavaScriptSerializer._serializeBooleanWithBuilder(b, a); break; default: a.append("null") } }; Sys.Serialization.JavaScriptSerializer.serialize = function (b) { var a = new Sys.StringBuilder; Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(b, a, false); return a.toString() }; Sys.Serialization.JavaScriptSerializer.deserialize = function (data, secure) { if (data.length === 0) throw Error.argument("data", Sys.Res.cannotDeserializeEmptyString); try { var exp = data.replace(Sys.Serialization.JavaScriptSerializer._dateRegEx, "$1new Date($2)"); if (secure && Sys.Serialization.JavaScriptSerializer._jsonRegEx.test(exp.replace(Sys.Serialization.JavaScriptSerializer._jsonStringRegEx, ""))) throw null; return eval("(" + exp + ")") } catch (a) { throw Error.argument("data", Sys.Res.cannotDeserializeInvalidJson) } }; Type.registerNamespace("Sys.UI"); Sys.EventHandlerList = function () { this._list = {} }; Sys.EventHandlerList.prototype = { _addHandler: function (b, a) { Array.add(this._getEvent(b, true), a) }, addHandler: function (b, a) { this._addHandler(b, a) }, _removeHandler: function (c, b) { var a = this._getEvent(c); if (!a) return; Array.remove(a, b) }, removeHandler: function (b, a) { this._removeHandler(b, a) }, getHandler: function (b) { var a = this._getEvent(b); if (!a || a.length === 0) return null; a = Array.clone(a); return function (c, d) { for (var b = 0, e = a.length; b < e; b++) a[b](c, d) } }, _getEvent: function (a, b) { if (!this._list[a]) { if (!b) return null; this._list[a] = [] } return this._list[a] } }; Sys.EventHandlerList.registerClass("Sys.EventHandlerList"); Sys.CommandEventArgs = function (c, a, b) { Sys.CommandEventArgs.initializeBase(this); this._commandName = c; this._commandArgument = a; this._commandSource = b }; Sys.CommandEventArgs.prototype = { _commandName: null, _commandArgument: null, _commandSource: null, get_commandName: function () { return this._commandName }, get_commandArgument: function () { return this._commandArgument }, get_commandSource: function () { return this._commandSource } }; Sys.CommandEventArgs.registerClass("Sys.CommandEventArgs", Sys.CancelEventArgs); Sys.INotifyPropertyChange = function () { }; Sys.INotifyPropertyChange.prototype = {}; Sys.INotifyPropertyChange.registerInterface("Sys.INotifyPropertyChange"); Sys.PropertyChangedEventArgs = function (a) { Sys.PropertyChangedEventArgs.initializeBase(this); this._propertyName = a }; Sys.PropertyChangedEventArgs.prototype = { get_propertyName: function () { return this._propertyName } }; Sys.PropertyChangedEventArgs.registerClass("Sys.PropertyChangedEventArgs", Sys.EventArgs); Sys.INotifyDisposing = function () { }; Sys.INotifyDisposing.prototype = {}; Sys.INotifyDisposing.registerInterface("Sys.INotifyDisposing"); Sys.Component = function () { if (Sys.Application) Sys.Application.registerDisposableObject(this) }; Sys.Component.prototype = { _id: null, _initialized: false, _updating: false, get_events: function () { if (!this._events) this._events = new Sys.EventHandlerList; return this._events }, get_id: function () { return this._id }, set_id: function (a) { this._id = a }, get_isInitialized: function () { return this._initialized }, get_isUpdating: function () { return this._updating }, add_disposing: function (a) { this.get_events().addHandler("disposing", a) }, remove_disposing: function (a) { this.get_events().removeHandler("disposing", a) }, add_propertyChanged: function (a) { this.get_events().addHandler("propertyChanged", a) }, remove_propertyChanged: function (a) { this.get_events().removeHandler("propertyChanged", a) }, beginUpdate: function () { this._updating = true }, dispose: function () { if (this._events) { var a = this._events.getHandler("disposing"); if (a) a(this, Sys.EventArgs.Empty) } delete this._events; Sys.Application.unregisterDisposableObject(this); Sys.Application.removeComponent(this) }, endUpdate: function () { this._updating = false; if (!this._initialized) this.initialize(); this.updated() }, initialize: function () { this._initialized = true }, raisePropertyChanged: function (b) { if (!this._events) return; var a = this._events.getHandler("propertyChanged"); if (a) a(this, new Sys.PropertyChangedEventArgs(b)) }, updated: function () { } }; Sys.Component.registerClass("Sys.Component", null, Sys.IDisposable, Sys.INotifyPropertyChange, Sys.INotifyDisposing); function Sys$Component$_setProperties(a, i) { var d, j = Object.getType(a), e = j === Object || j === Sys.UI.DomElement, h = Sys.Component.isInstanceOfType(a) && !a.get_isUpdating(); if (h) a.beginUpdate(); for (var c in i) { var b = i[c], f = e ? null : a["get_" + c]; if (e || typeof f !== "function") { var k = a[c]; if (!b || typeof b !== "object" || e && !k) a[c] = b; else Sys$Component$_setProperties(k, b) } else { var l = a["set_" + c]; if (typeof l === "function") l.apply(a, [b]); else if (b instanceof Array) { d = f.apply(a); for (var g = 0, m = d.length, n = b.length; g < n; g++, m++) d[m] = b[g] } else if (typeof b === "object" && Object.getType(b) === Object) { d = f.apply(a); Sys$Component$_setProperties(d, b) } } } if (h) a.endUpdate() } function Sys$Component$_setReferences(c, b) { for (var a in b) { var e = c["set_" + a], d = $find(b[a]); e.apply(c, [d]) } } var $create = Sys.Component.create = function (h, f, d, c, g) { var a = g ? new h(g) : new h, b = Sys.Application, i = b.get_isCreatingComponents(); a.beginUpdate(); if (f) Sys$Component$_setProperties(a, f); if (d) for (var e in d) a["add_" + e](d[e]); if (a.get_id()) b.addComponent(a); if (i) { b._createdComponents[b._createdComponents.length] = a; if (c) b._addComponentToSecondPass(a, c); else a.endUpdate() } else { if (c) Sys$Component$_setReferences(a, c); a.endUpdate() } return a }; Sys.UI.MouseButton = function () { throw Error.notImplemented() }; Sys.UI.MouseButton.prototype = { leftButton: 0, middleButton: 1, rightButton: 2 }; Sys.UI.MouseButton.registerEnum("Sys.UI.MouseButton"); Sys.UI.Key = function () { throw Error.notImplemented() }; Sys.UI.Key.prototype = { backspace: 8, tab: 9, enter: 13, esc: 27, space: 32, pageUp: 33, pageDown: 34, end: 35, home: 36, left: 37, up: 38, right: 39, down: 40, del: 127 }; Sys.UI.Key.registerEnum("Sys.UI.Key"); Sys.UI.Point = function (a, b) { this.x = a; this.y = b }; Sys.UI.Point.registerClass("Sys.UI.Point"); Sys.UI.Bounds = function (c, d, b, a) { this.x = c; this.y = d; this.height = a; this.width = b }; Sys.UI.Bounds.registerClass("Sys.UI.Bounds"); Sys.UI.DomEvent = function (e) { var a = e, b = this.type = a.type.toLowerCase(); this.rawEvent = a; this.altKey = a.altKey; if (typeof a.button !== "undefined") this.button = typeof a.which !== "undefined" ? a.button : a.button === 4 ? Sys.UI.MouseButton.middleButton : a.button === 2 ? Sys.UI.MouseButton.rightButton : Sys.UI.MouseButton.leftButton; if (b === "keypress") this.charCode = a.charCode || a.keyCode; else if (a.keyCode && a.keyCode === 46) this.keyCode = 127; else this.keyCode = a.keyCode; this.clientX = a.clientX; this.clientY = a.clientY; this.ctrlKey = a.ctrlKey; this.target = a.target ? a.target : a.srcElement; if (!b.startsWith("key")) if (typeof a.offsetX !== "undefined" && typeof a.offsetY !== "undefined") { this.offsetX = a.offsetX; this.offsetY = a.offsetY } else if (this.target && this.target.nodeType !== 3 && typeof a.clientX === "number") { var c = Sys.UI.DomElement.getLocation(this.target), d = Sys.UI.DomElement._getWindow(this.target); this.offsetX = (d.pageXOffset || 0) + a.clientX - c.x; this.offsetY = (d.pageYOffset || 0) + a.clientY - c.y } this.screenX = a.screenX; this.screenY = a.screenY; this.shiftKey = a.shiftKey }; Sys.UI.DomEvent.prototype = { preventDefault: function () { if (this.rawEvent.preventDefault) this.rawEvent.preventDefault(); else if (window.event) this.rawEvent.returnValue = false }, stopPropagation: function () { if (this.rawEvent.stopPropagation) this.rawEvent.stopPropagation(); else if (window.event) this.rawEvent.cancelBubble = true } }; Sys.UI.DomEvent.registerClass("Sys.UI.DomEvent"); var $addHandler = Sys.UI.DomEvent.addHandler = function (a, d, e, g) { if (!a._events) a._events = {}; var c = a._events[d]; if (!c) a._events[d] = c = []; var b; if (a.addEventListener) { b = function (b) { return e.call(a, new Sys.UI.DomEvent(b)) }; a.addEventListener(d, b, false) } else if (a.attachEvent) { b = function () { var b = {}; try { b = Sys.UI.DomElement._getWindow(a).event } catch (c) { } return e.call(a, new Sys.UI.DomEvent(b)) }; a.attachEvent("on" + d, b) } c[c.length] = { handler: e, browserHandler: b, autoRemove: g }; if (g) { var f = a.dispose; if (f !== Sys.UI.DomEvent._disposeHandlers) { a.dispose = Sys.UI.DomEvent._disposeHandlers; if (typeof f !== "undefined") a._chainDispose = f } } }, $addHandlers = Sys.UI.DomEvent.addHandlers = function (f, d, c, e) { for (var b in d) { var a = d[b]; if (c) a = Function.createDelegate(c, a); $addHandler(f, b, a, e || false) } }, $clearHandlers = Sys.UI.DomEvent.clearHandlers = function (a) { Sys.UI.DomEvent._clearHandlers(a, false) }; Sys.UI.DomEvent._clearHandlers = function (a, g) { if (a._events) { var e = a._events; for (var b in e) { var d = e[b]; for (var c = d.length - 1; c >= 0; c--) { var f = d[c]; if (!g || f.autoRemove) $removeHandler(a, b, f.handler) } } a._events = null } }; Sys.UI.DomEvent._disposeHandlers = function () { Sys.UI.DomEvent._clearHandlers(this, true); var b = this._chainDispose, a = typeof b; if (a !== "undefined") { this.dispose = b; this._chainDispose = null; if (a === "function") this.dispose() } }; var $removeHandler = Sys.UI.DomEvent.removeHandler = function (b, a, c) { Sys.UI.DomEvent._removeHandler(b, a, c) }; Sys.UI.DomEvent._removeHandler = function (a, e, f) { var d = null, c = a._events[e]; for (var b = 0, g = c.length; b < g; b++) if (c[b].handler === f) { d = c[b].browserHandler; break } if (a.removeEventListener) a.removeEventListener(e, d, false); else if (a.detachEvent) a.detachEvent("on" + e, d); c.splice(b, 1) }; Sys.UI.DomElement = function () { }; Sys.UI.DomElement.registerClass("Sys.UI.DomElement"); Sys.UI.DomElement.addCssClass = function (a, b) { if (!Sys.UI.DomElement.containsCssClass(a, b)) if (a.className === "") a.className = b; else a.className += " " + b }; Sys.UI.DomElement.containsCssClass = function (b, a) { return Array.contains(b.className.split(" "), a) }; Sys.UI.DomElement.getBounds = function (a) { var b = Sys.UI.DomElement.getLocation(a); return new Sys.UI.Bounds(b.x, b.y, a.offsetWidth || 0, a.offsetHeight || 0) }; var $get = Sys.UI.DomElement.getElementById = function (f, e) { if (!e) return document.getElementById(f); if (e.getElementById) return e.getElementById(f); var c = [], d = e.childNodes; for (var b = 0; b < d.length; b++) { var a = d[b]; if (a.nodeType == 1) c[c.length] = a } while (c.length) { a = c.shift(); if (a.id == f) return a; d = a.childNodes; for (b = 0; b < d.length; b++) { a = d[b]; if (a.nodeType == 1) c[c.length] = a } } return null }; if (document.documentElement.getBoundingClientRect) Sys.UI.DomElement.getLocation = function (b) { if (b.self || b.nodeType === 9 || b === document.documentElement || b.parentNode === b.ownerDocument.documentElement) return new Sys.UI.Point(0, 0); var f = b.getBoundingClientRect(); if (!f) return new Sys.UI.Point(0, 0); var k, e = b.ownerDocument.documentElement, c = Math.round(f.left) + e.scrollLeft, d = Math.round(f.top) + e.scrollTop; if (Sys.Browser.agent === Sys.Browser.InternetExplorer) { try { var g = b.ownerDocument.parentWindow.frameElement || null; if (g) { var h = g.frameBorder === "0" || g.frameBorder === "no" ? 2 : 0; c += h; d += h } } catch (l) { } if (Sys.Browser.version === 7 && !document.documentMode) { var i = document.body, j = i.getBoundingClientRect(), a = (j.right - j.left) / i.clientWidth; a = Math.round(a * 100); a = (a - a % 5) / 100; if (!isNaN(a) && a !== 1) { c = Math.round(c / a); d = Math.round(d / a) } } if ((document.documentMode || 0) < 8) { c -= e.clientLeft; d -= e.clientTop } } return new Sys.UI.Point(c, d) }; else if (Sys.Browser.agent === Sys.Browser.Safari) Sys.UI.DomElement.getLocation = function (c) { if (c.window && c.window === c || c.nodeType === 9) return new Sys.UI.Point(0, 0); var d = 0, e = 0, a, j = null, g = null, b; for (a = c; a; j = a, (g = b, a = a.offsetParent)) { b = Sys.UI.DomElement._getCurrentStyle(a); var f = a.tagName ? a.tagName.toUpperCase() : null; if ((a.offsetLeft || a.offsetTop) && (f !== "BODY" || (!g || g.position !== "absolute"))) { d += a.offsetLeft; e += a.offsetTop } if (j && Sys.Browser.version >= 3) { d += parseInt(b.borderLeftWidth); e += parseInt(b.borderTopWidth) } } b = Sys.UI.DomElement._getCurrentStyle(c); var h = b ? b.position : null; if (!h || h !== "absolute") for (a = c.parentNode; a; a = a.parentNode) { f = a.tagName ? a.tagName.toUpperCase() : null; if (f !== "BODY" && f !== "HTML" && (a.scrollLeft || a.scrollTop)) { d -= a.scrollLeft || 0; e -= a.scrollTop || 0 } b = Sys.UI.DomElement._getCurrentStyle(a); var i = b ? b.position : null; if (i && i === "absolute") break } return new Sys.UI.Point(d, e) }; else Sys.UI.DomElement.getLocation = function (d) { if (d.window && d.window === d || d.nodeType === 9) return new Sys.UI.Point(0, 0); var e = 0, f = 0, a, i = null, g = null, b = null; for (a = d; a; i = a, (g = b, a = a.offsetParent)) { var c = a.tagName ? a.tagName.toUpperCase() : null; b = Sys.UI.DomElement._getCurrentStyle(a); if ((a.offsetLeft || a.offsetTop) && !(c === "BODY" && (!g || g.position !== "absolute"))) { e += a.offsetLeft; f += a.offsetTop } if (i !== null && b) { if (c !== "TABLE" && c !== "TD" && c !== "HTML") { e += parseInt(b.borderLeftWidth) || 0; f += parseInt(b.borderTopWidth) || 0 } if (c === "TABLE" && (b.position === "relative" || b.position === "absolute")) { e += parseInt(b.marginLeft) || 0; f += parseInt(b.marginTop) || 0 } } } b = Sys.UI.DomElement._getCurrentStyle(d); var h = b ? b.position : null; if (!h || h !== "absolute") for (a = d.parentNode; a; a = a.parentNode) { c = a.tagName ? a.tagName.toUpperCase() : null; if (c !== "BODY" && c !== "HTML" && (a.scrollLeft || a.scrollTop)) { e -= a.scrollLeft || 0; f -= a.scrollTop || 0; b = Sys.UI.DomElement._getCurrentStyle(a); if (b) { e += parseInt(b.borderLeftWidth) || 0; f += parseInt(b.borderTopWidth) || 0 } } } return new Sys.UI.Point(e, f) }; Sys.UI.DomElement.isDomElement = function (a) { return Sys._isDomElement(a) }; Sys.UI.DomElement.removeCssClass = function (d, c) { var a = " " + d.className + " ", b = a.indexOf(" " + c + " "); if (b >= 0) d.className = (a.substr(0, b) + " " + a.substring(b + c.length + 1, a.length)).trim() }; Sys.UI.DomElement.resolveElement = function (b, c) { var a = b; if (!a) return null; if (typeof a === "string") a = Sys.UI.DomElement.getElementById(a, c); return a }; Sys.UI.DomElement.raiseBubbleEvent = function (c, d) { var b = c; while (b) { var a = b.control; if (a && a.onBubbleEvent && a.raiseBubbleEvent) { Sys.UI.DomElement._raiseBubbleEventFromControl(a, c, d); return } b = b.parentNode } }; Sys.UI.DomElement._raiseBubbleEventFromControl = function (a, b, c) { if (!a.onBubbleEvent(b, c)) a._raiseBubbleEvent(b, c) }; Sys.UI.DomElement.setLocation = function (b, c, d) { var a = b.style; a.position = "absolute"; a.left = c + "px"; a.top = d + "px" }; Sys.UI.DomElement.toggleCssClass = function (b, a) { if (Sys.UI.DomElement.containsCssClass(b, a)) Sys.UI.DomElement.removeCssClass(b, a); else Sys.UI.DomElement.addCssClass(b, a) }; Sys.UI.DomElement.getVisibilityMode = function (a) { return a._visibilityMode === Sys.UI.VisibilityMode.hide ? Sys.UI.VisibilityMode.hide : Sys.UI.VisibilityMode.collapse }; Sys.UI.DomElement.setVisibilityMode = function (a, b) { Sys.UI.DomElement._ensureOldDisplayMode(a); if (a._visibilityMode !== b) { a._visibilityMode = b; if (Sys.UI.DomElement.getVisible(a) === false) if (a._visibilityMode === Sys.UI.VisibilityMode.hide) a.style.display = a._oldDisplayMode; else a.style.display = "none"; a._visibilityMode = b } }; Sys.UI.DomElement.getVisible = function (b) { var a = b.currentStyle || Sys.UI.DomElement._getCurrentStyle(b); if (!a) return true; return a.visibility !== "hidden" && a.display !== "none" }; Sys.UI.DomElement.setVisible = function (a, b) { if (b !== Sys.UI.DomElement.getVisible(a)) { Sys.UI.DomElement._ensureOldDisplayMode(a); a.style.visibility = b ? "visible" : "hidden"; if (b || a._visibilityMode === Sys.UI.VisibilityMode.hide) a.style.display = a._oldDisplayMode; else a.style.display = "none" } }; Sys.UI.DomElement._ensureOldDisplayMode = function (a) { if (!a._oldDisplayMode) { var b = a.currentStyle || Sys.UI.DomElement._getCurrentStyle(a); a._oldDisplayMode = b ? b.display : null; if (!a._oldDisplayMode || a._oldDisplayMode === "none") switch (a.tagName.toUpperCase()) { case "DIV": case "P": case "ADDRESS": case "BLOCKQUOTE": case "BODY": case "COL": case "COLGROUP": case "DD": case "DL": case "DT": case "FIELDSET": case "FORM": case "H1": case "H2": case "H3": case "H4": case "H5": case "H6": case "HR": case "IFRAME": case "LEGEND": case "OL": case "PRE": case "TABLE": case "TD": case "TH": case "TR": case "UL": a._oldDisplayMode = "block"; break; case "LI": a._oldDisplayMode = "list-item"; break; default: a._oldDisplayMode = "inline" } } }; Sys.UI.DomElement._getWindow = function (a) { var b = a.ownerDocument || a.document || a; return b.defaultView || b.parentWindow }; Sys.UI.DomElement._getCurrentStyle = function (a) { if (a.nodeType === 3) return null; var c = Sys.UI.DomElement._getWindow(a); if (a.documentElement) a = a.documentElement; var b = c && a !== c && c.getComputedStyle ? c.getComputedStyle(a, null) : a.currentStyle || a.style; if (!b && Sys.Browser.agent === Sys.Browser.Safari && a.style) { var g = a.style.display, f = a.style.position; a.style.position = "absolute"; a.style.display = "block"; var e = c.getComputedStyle(a, null); a.style.display = g; a.style.position = f; b = {}; for (var d in e) b[d] = e[d]; b.display = "none" } return b }; Sys.IContainer = function () { }; Sys.IContainer.prototype = {}; Sys.IContainer.registerInterface("Sys.IContainer"); Sys.ApplicationLoadEventArgs = function (b, a) { Sys.ApplicationLoadEventArgs.initializeBase(this); this._components = b; this._isPartialLoad = a }; Sys.ApplicationLoadEventArgs.prototype = { get_components: function () { return this._components }, get_isPartialLoad: function () { return this._isPartialLoad } }; Sys.ApplicationLoadEventArgs.registerClass("Sys.ApplicationLoadEventArgs", Sys.EventArgs); Sys._Application = function () { Sys._Application.initializeBase(this); this._disposableObjects = []; this._components = {}; this._createdComponents = []; this._secondPassComponents = []; this._unloadHandlerDelegate = Function.createDelegate(this, this._unloadHandler); Sys.UI.DomEvent.addHandler(window, "unload", this._unloadHandlerDelegate); this._domReady() }; Sys._Application.prototype = { _creatingComponents: false, _disposing: false, _deleteCount: 0, get_isCreatingComponents: function () { return this._creatingComponents }, get_isDisposing: function () { return this._disposing }, add_init: function (a) { if (this._initialized) a(this, Sys.EventArgs.Empty); else this.get_events().addHandler("init", a) }, remove_init: function (a) { this.get_events().removeHandler("init", a) }, add_load: function (a) { this.get_events().addHandler("load", a) }, remove_load: function (a) { this.get_events().removeHandler("load", a) }, add_unload: function (a) { this.get_events().addHandler("unload", a) }, remove_unload: function (a) { this.get_events().removeHandler("unload", a) }, addComponent: function (a) { this._components[a.get_id()] = a }, beginCreateComponents: function () { this._creatingComponents = true }, dispose: function () { if (!this._disposing) { this._disposing = true; if (this._timerCookie) { window.clearTimeout(this._timerCookie); delete this._timerCookie } if (this._endRequestHandler) { Sys.WebForms.PageRequestManager.getInstance().remove_endRequest(this._endRequestHandler); delete this._endRequestHandler } if (this._beginRequestHandler) { Sys.WebForms.PageRequestManager.getInstance().remove_beginRequest(this._beginRequestHandler); delete this._beginRequestHandler } if (window.pageUnload) window.pageUnload(this, Sys.EventArgs.Empty); var c = this.get_events().getHandler("unload"); if (c) c(this, Sys.EventArgs.Empty); var b = Array.clone(this._disposableObjects); for (var a = 0, f = b.length; a < f; a++) { var d = b[a]; if (typeof d !== "undefined") d.dispose() } Array.clear(this._disposableObjects); Sys.UI.DomEvent.removeHandler(window, "unload", this._unloadHandlerDelegate); if (Sys._ScriptLoader) { var e = Sys._ScriptLoader.getInstance(); if (e) e.dispose() } Sys._Application.callBaseMethod(this, "dispose") } }, disposeElement: function (c, j) { if (c.nodeType === 1) { var b, h = c.getElementsByTagName("*"), g = h.length, i = new Array(g); for (b = 0; b < g; b++) i[b] = h[b]; for (b = g - 1; b >= 0; b--) { var d = i[b], f = d.dispose; if (f && typeof f === "function") d.dispose(); else { var e = d.control; if (e && typeof e.dispose === "function") e.dispose() } var a = d._behaviors; if (a) this._disposeComponents(a); a = d._components; if (a) { this._disposeComponents(a); d._components = null } } if (!j) { var f = c.dispose; if (f && typeof f === "function") c.dispose(); else { var e = c.control; if (e && typeof e.dispose === "function") e.dispose() } var a = c._behaviors; if (a) this._disposeComponents(a); a = c._components; if (a) { this._disposeComponents(a); c._components = null } } } }, endCreateComponents: function () { var b = this._secondPassComponents; for (var a = 0, d = b.length; a < d; a++) { var c = b[a].component; Sys$Component$_setReferences(c, b[a].references); c.endUpdate() } this._secondPassComponents = []; this._creatingComponents = false }, findComponent: function (b, a) { return a ? Sys.IContainer.isInstanceOfType(a) ? a.findComponent(b) : a[b] || null : Sys.Application._components[b] || null }, getComponents: function () { var a = [], b = this._components; for (var c in b) a[a.length] = b[c]; return a }, initialize: function () { if (!this.get_isInitialized() && !this._disposing) { Sys._Application.callBaseMethod(this, "initialize"); this._raiseInit(); if (this.get_stateString) { if (Sys.WebForms && Sys.WebForms.PageRequestManager) { this._beginRequestHandler = Function.createDelegate(this, this._onPageRequestManagerBeginRequest); Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(this._beginRequestHandler); this._endRequestHandler = Function.createDelegate(this, this._onPageRequestManagerEndRequest); Sys.WebForms.PageRequestManager.getInstance().add_endRequest(this._endRequestHandler) } var a = this.get_stateString(); if (a !== this._currentEntry) this._navigate(a); else this._ensureHistory() } this.raiseLoad() } }, notifyScriptLoaded: function () { }, registerDisposableObject: function (b) { if (!this._disposing) { var a = this._disposableObjects, c = a.length; a[c] = b; b.__msdisposeindex = c } }, raiseLoad: function () { var b = this.get_events().getHandler("load"), a = new Sys.ApplicationLoadEventArgs(Array.clone(this._createdComponents), !!this._loaded); this._loaded = true; if (b) b(this, a); if (window.pageLoad) window.pageLoad(this, a); this._createdComponents = [] }, removeComponent: function (b) { var a = b.get_id(); if (a) delete this._components[a] }, unregisterDisposableObject: function (a) { if (!this._disposing) { var e = a.__msdisposeindex; if (typeof e === "number") { var b = this._disposableObjects; delete b[e]; delete a.__msdisposeindex; if (++this._deleteCount > 1000) { var c = []; for (var d = 0, f = b.length; d < f; d++) { a = b[d]; if (typeof a !== "undefined") { a.__msdisposeindex = c.length; c.push(a) } } this._disposableObjects = c; this._deleteCount = 0 } } } }, _addComponentToSecondPass: function (b, a) { this._secondPassComponents[this._secondPassComponents.length] = { component: b, references: a } }, _disposeComponents: function (a) { if (a) for (var b = a.length - 1; b >= 0; b--) { var c = a[b]; if (typeof c.dispose === "function") c.dispose() } }, _domReady: function () { var a, g, f = this; function b() { f.initialize() } var c = function () { Sys.UI.DomEvent.removeHandler(window, "load", c); b() }; Sys.UI.DomEvent.addHandler(window, "load", c); if (document.addEventListener) try { document.addEventListener("DOMContentLoaded", a = function () { document.removeEventListener("DOMContentLoaded", a, false); b() }, false) } catch (h) { } else if (document.attachEvent) if (window == window.top && document.documentElement.doScroll) { var e, d = document.createElement("div"); a = function () { try { d.doScroll("left") } catch (c) { e = window.setTimeout(a, 0); return } d = null; b() }; a() } else document.attachEvent("onreadystatechange", a = function () { if (document.readyState === "complete") { document.detachEvent("onreadystatechange", a); b() } }) }, _raiseInit: function () { var a = this.get_events().getHandler("init"); if (a) { this.beginCreateComponents(); a(this, Sys.EventArgs.Empty); this.endCreateComponents() } }, _unloadHandler: function () { this.dispose() } }; Sys._Application.registerClass("Sys._Application", Sys.Component, Sys.IContainer); Sys.Application = new Sys._Application; var $find = Sys.Application.findComponent; Sys.UI.Behavior = function (b) { Sys.UI.Behavior.initializeBase(this); this._element = b; var a = b._behaviors; if (!a) b._behaviors = [this]; else a[a.length] = this }; Sys.UI.Behavior.prototype = { _name: null, get_element: function () { return this._element }, get_id: function () { var a = Sys.UI.Behavior.callBaseMethod(this, "get_id"); if (a) return a; if (!this._element || !this._element.id) return ""; return this._element.id + "$" + this.get_name() }, get_name: function () { if (this._name) return this._name; var a = Object.getTypeName(this), b = a.lastIndexOf("."); if (b !== -1) a = a.substr(b + 1); if (!this.get_isInitialized()) this._name = a; return a }, set_name: function (a) { this._name = a }, initialize: function () { Sys.UI.Behavior.callBaseMethod(this, "initialize"); var a = this.get_name(); if (a) this._element[a] = this }, dispose: function () { Sys.UI.Behavior.callBaseMethod(this, "dispose"); var a = this._element; if (a) { var c = this.get_name(); if (c) a[c] = null; var b = a._behaviors; Array.remove(b, this); if (b.length === 0) a._behaviors = null; delete this._element } } }; Sys.UI.Behavior.registerClass("Sys.UI.Behavior", Sys.Component); Sys.UI.Behavior.getBehaviorByName = function (b, c) { var a = b[c]; return a && Sys.UI.Behavior.isInstanceOfType(a) ? a : null }; Sys.UI.Behavior.getBehaviors = function (a) { if (!a._behaviors) return []; return Array.clone(a._behaviors) }; Sys.UI.Behavior.getBehaviorsByType = function (d, e) { var a = d._behaviors, c = []; if (a) for (var b = 0, f = a.length; b < f; b++) if (e.isInstanceOfType(a[b])) c[c.length] = a[b]; return c }; Sys.UI.VisibilityMode = function () { throw Error.notImplemented() }; Sys.UI.VisibilityMode.prototype = { hide: 0, collapse: 1 }; Sys.UI.VisibilityMode.registerEnum("Sys.UI.VisibilityMode"); Sys.UI.Control = function (a) { Sys.UI.Control.initializeBase(this); this._element = a; a.control = this; var b = this.get_role(); if (b) a.setAttribute("role", b) }; Sys.UI.Control.prototype = { _parent: null, _visibilityMode: Sys.UI.VisibilityMode.hide, get_element: function () { return this._element }, get_id: function () { if (!this._element) return ""; return this._element.id }, set_id: function () { throw Error.invalidOperation(Sys.Res.cantSetId) }, get_parent: function () { if (this._parent) return this._parent; if (!this._element) return null; var a = this._element.parentNode; while (a) { if (a.control) return a.control; a = a.parentNode } return null }, set_parent: function (a) { this._parent = a }, get_role: function () { return null }, get_visibilityMode: function () { return Sys.UI.DomElement.getVisibilityMode(this._element) }, set_visibilityMode: function (a) { Sys.UI.DomElement.setVisibilityMode(this._element, a) }, get_visible: function () { return Sys.UI.DomElement.getVisible(this._element) }, set_visible: function (a) { Sys.UI.DomElement.setVisible(this._element, a) }, addCssClass: function (a) { Sys.UI.DomElement.addCssClass(this._element, a) }, dispose: function () { Sys.UI.Control.callBaseMethod(this, "dispose"); if (this._element) { this._element.control = null; delete this._element } if (this._parent) delete this._parent }, onBubbleEvent: function () { return false }, raiseBubbleEvent: function (a, b) { this._raiseBubbleEvent(a, b) }, _raiseBubbleEvent: function (b, c) { var a = this.get_parent(); while (a) { if (a.onBubbleEvent(b, c)) return; a = a.get_parent() } }, removeCssClass: function (a) { Sys.UI.DomElement.removeCssClass(this._element, a) }, toggleCssClass: function (a) { Sys.UI.DomElement.toggleCssClass(this._element, a) } }; Sys.UI.Control.registerClass("Sys.UI.Control", Sys.Component); Sys.HistoryEventArgs = function (a) { Sys.HistoryEventArgs.initializeBase(this); this._state = a }; Sys.HistoryEventArgs.prototype = { get_state: function () { return this._state } }; Sys.HistoryEventArgs.registerClass("Sys.HistoryEventArgs", Sys.EventArgs); Sys.Application._appLoadHandler = null; Sys.Application._beginRequestHandler = null; Sys.Application._clientId = null; Sys.Application._currentEntry = ""; Sys.Application._endRequestHandler = null; Sys.Application._history = null; Sys.Application._enableHistory = false; Sys.Application._historyFrame = null; Sys.Application._historyInitialized = false; Sys.Application._historyPointIsNew = false; Sys.Application._ignoreTimer = false; Sys.Application._initialState = null; Sys.Application._state = {}; Sys.Application._timerCookie = 0; Sys.Application._timerHandler = null; Sys.Application._uniqueId = null; Sys._Application.prototype.get_stateString = function () { var a = null; if (Sys.Browser.agent === Sys.Browser.Firefox) { var c = window.location.href, b = c.indexOf("#"); if (b !== -1) a = c.substring(b + 1); else a = ""; return a } else a = window.location.hash; if (a.length > 0 && a.charAt(0) === "#") a = a.substring(1); return a }; Sys._Application.prototype.get_enableHistory = function () { return this._enableHistory }; Sys._Application.prototype.set_enableHistory = function (a) { this._enableHistory = a }; Sys._Application.prototype.add_navigate = function (a) { this.get_events().addHandler("navigate", a) }; Sys._Application.prototype.remove_navigate = function (a) { this.get_events().removeHandler("navigate", a) }; Sys._Application.prototype.addHistoryPoint = function (c, f) { this._ensureHistory(); var b = this._state; for (var a in c) { var d = c[a]; if (d === null) { if (typeof b[a] !== "undefined") delete b[a] } else b[a] = d } var e = this._serializeState(b); this._historyPointIsNew = true; this._setState(e, f); this._raiseNavigate() }; Sys._Application.prototype.setServerId = function (a, b) { this._clientId = a; this._uniqueId = b }; Sys._Application.prototype.setServerState = function (a) { this._ensureHistory(); this._state.__s = a; this._updateHiddenField(a) }; Sys._Application.prototype._deserializeState = function (a) { var e = {}; a = a || ""; var b = a.indexOf("&&"); if (b !== -1 && b + 2 < a.length) { e.__s = a.substr(b + 2); a = a.substr(0, b) } var g = a.split("&"); for (var f = 0, j = g.length; f < j; f++) { var d = g[f], c = d.indexOf("="); if (c !== -1 && c + 1 < d.length) { var i = d.substr(0, c), h = d.substr(c + 1); e[i] = decodeURIComponent(h) } } return e }; Sys._Application.prototype._enableHistoryInScriptManager = function () { this._enableHistory = true }; Sys._Application.prototype._ensureHistory = function () { if (!this._historyInitialized && this._enableHistory) { if (Sys.Browser.agent === Sys.Browser.InternetExplorer && Sys.Browser.documentMode < 8) { this._historyFrame = document.getElementById("__historyFrame"); this._ignoreIFrame = true } this._timerHandler = Function.createDelegate(this, this._onIdle); this._timerCookie = window.setTimeout(this._timerHandler, 100); try { this._initialState = this._deserializeState(this.get_stateString()) } catch (a) { } this._historyInitialized = true } }; Sys._Application.prototype._navigate = function (c) { this._ensureHistory(); var b = this._deserializeState(c); if (this._uniqueId) { var d = this._state.__s || "", a = b.__s || ""; if (a !== d) { this._updateHiddenField(a); __doPostBack(this._uniqueId, a); this._state = b; return } } this._setState(c); this._state = b; this._raiseNavigate() }; Sys._Application.prototype._onIdle = function () { delete this._timerCookie; var a = this.get_stateString(); if (a !== this._currentEntry) { if (!this._ignoreTimer) { this._historyPointIsNew = false; this._navigate(a) } } else this._ignoreTimer = false; this._timerCookie = window.setTimeout(this._timerHandler, 100) }; Sys._Application.prototype._onIFrameLoad = function (a) { this._ensureHistory(); if (!this._ignoreIFrame) { this._historyPointIsNew = false; this._navigate(a) } this._ignoreIFrame = false }; Sys._Application.prototype._onPageRequestManagerBeginRequest = function () { this._ignoreTimer = true; this._originalTitle = document.title }; Sys._Application.prototype._onPageRequestManagerEndRequest = function (g, f) { var d = f.get_dataItems()[this._clientId], c = this._originalTitle; this._originalTitle = null; var b = document.getElementById("__EVENTTARGET"); if (b && b.value === this._uniqueId) b.value = ""; if (typeof d !== "undefined") { this.setServerState(d); this._historyPointIsNew = true } else this._ignoreTimer = false; var a = this._serializeState(this._state); if (a !== this._currentEntry) { this._ignoreTimer = true; if (typeof c === "string") { if (Sys.Browser.agent !== Sys.Browser.InternetExplorer || Sys.Browser.version > 7) { var e = document.title; document.title = c; this._setState(a); document.title = e } else this._setState(a); this._raiseNavigate() } else { this._setState(a); this._raiseNavigate() } } }; Sys._Application.prototype._raiseNavigate = function () { var d = this._historyPointIsNew, c = this.get_events().getHandler("navigate"), b = {}; for (var a in this._state) if (a !== "__s") b[a] = this._state[a]; var e = new Sys.HistoryEventArgs(b); if (c) c(this, e); if (!d) { var f; try { if (Sys.Browser.agent === Sys.Browser.Firefox && window.location.hash && (!window.frameElement || window.top.location.hash)) Sys.Browser.version < 3.5 ? window.history.go(0) : (location.hash = this.get_stateString()) } catch (g) { } } }; Sys._Application.prototype._serializeState = function (d) { var b = []; for (var a in d) { var e = d[a]; if (a === "__s") var c = e; else b[b.length] = a + "=" + encodeURIComponent(e) } return b.join("&") + (c ? "&&" + c : "") }; Sys._Application.prototype._setState = function (a, b) { if (this._enableHistory) { a = a || ""; if (a !== this._currentEntry) { if (window.theForm) { var d = window.theForm.action, e = d.indexOf("#"); window.theForm.action = (e !== -1 ? d.substring(0, e) : d) + "#" + a } if (this._historyFrame && this._historyPointIsNew) { this._ignoreIFrame = true; var c = this._historyFrame.contentWindow.document; c.open("javascript:'<html></html>'"); c.write("<html><head><title>" + (b || document.title) + "</title><scri" + 'pt type="text/javascript">parent.Sys.Application._onIFrameLoad(' + Sys.Serialization.JavaScriptSerializer.serialize(a) + ");</scri" + "pt></head><body></body></html>"); c.close() } this._ignoreTimer = false; this._currentEntry = a; if (this._historyFrame || this._historyPointIsNew) { var f = this.get_stateString(); if (a !== f) { window.location.hash = a; this._currentEntry = this.get_stateString(); if (typeof b !== "undefined" && b !== null) document.title = b } } this._historyPointIsNew = false } } }; Sys._Application.prototype._updateHiddenField = function (b) { if (this._clientId) { var a = document.getElementById(this._clientId); if (a) a.value = b } }; if (!window.XMLHttpRequest) window.XMLHttpRequest = function () { var b = ["Msxml2.XMLHTTP.3.0", "Msxml2.XMLHTTP"]; for (var a = 0, c = b.length; a < c; a++) try { return new ActiveXObject(b[a]) } catch (d) { } return null }; Type.registerNamespace("Sys.Net"); Sys.Net.WebRequestExecutor = function () { this._webRequest = null; this._resultObject = null }; Sys.Net.WebRequestExecutor.prototype = { get_webRequest: function () { return this._webRequest }, _set_webRequest: function (a) { this._webRequest = a }, get_started: function () { throw Error.notImplemented() }, get_responseAvailable: function () { throw Error.notImplemented() }, get_timedOut: function () { throw Error.notImplemented() }, get_aborted: function () { throw Error.notImplemented() }, get_responseData: function () { throw Error.notImplemented() }, get_statusCode: function () { throw Error.notImplemented() }, get_statusText: function () { throw Error.notImplemented() }, get_xml: function () { throw Error.notImplemented() }, get_object: function () { if (!this._resultObject) this._resultObject = Sys.Serialization.JavaScriptSerializer.deserialize(this.get_responseData()); return this._resultObject }, executeRequest: function () { throw Error.notImplemented() }, abort: function () { throw Error.notImplemented() }, getResponseHeader: function () { throw Error.notImplemented() }, getAllResponseHeaders: function () { throw Error.notImplemented() } }; Sys.Net.WebRequestExecutor.registerClass("Sys.Net.WebRequestExecutor"); Sys.Net.XMLDOM = function (d) { if (!window.DOMParser) { var c = ["Msxml2.DOMDocument.3.0", "Msxml2.DOMDocument"]; for (var b = 0, f = c.length; b < f; b++) try { var a = new ActiveXObject(c[b]); a.async = false; a.loadXML(d); a.setProperty("SelectionLanguage", "XPath"); return a } catch (g) { } } else try { var e = new window.DOMParser; return e.parseFromString(d, "text/xml") } catch (g) { } return null }; Sys.Net.XMLHttpExecutor = function () { Sys.Net.XMLHttpExecutor.initializeBase(this); var a = this; this._xmlHttpRequest = null; this._webRequest = null; this._responseAvailable = false; this._timedOut = false; this._timer = null; this._aborted = false; this._started = false; this._onReadyStateChange = function () { if (a._xmlHttpRequest.readyState === 4) { try { if (typeof a._xmlHttpRequest.status === "undefined") return } catch (b) { return } a._clearTimer(); a._responseAvailable = true; try { a._webRequest.completed(Sys.EventArgs.Empty) } finally { if (a._xmlHttpRequest != null) { a._xmlHttpRequest.onreadystatechange = Function.emptyMethod; a._xmlHttpRequest = null } } } }; this._clearTimer = function () { if (a._timer != null) { window.clearTimeout(a._timer); a._timer = null } }; this._onTimeout = function () { if (!a._responseAvailable) { a._clearTimer(); a._timedOut = true; a._xmlHttpRequest.onreadystatechange = Function.emptyMethod; a._xmlHttpRequest.abort(); a._webRequest.completed(Sys.EventArgs.Empty); a._xmlHttpRequest = null } } }; Sys.Net.XMLHttpExecutor.prototype = { get_timedOut: function () { return this._timedOut }, get_started: function () { return this._started }, get_responseAvailable: function () { return this._responseAvailable }, get_aborted: function () { return this._aborted }, executeRequest: function () { this._webRequest = this.get_webRequest(); var c = this._webRequest.get_body(), a = this._webRequest.get_headers(); this._xmlHttpRequest = new XMLHttpRequest; this._xmlHttpRequest.onreadystatechange = this._onReadyStateChange; var e = this._webRequest.get_httpVerb(); this._xmlHttpRequest.open(e, this._webRequest.getResolvedUrl(), true); this._xmlHttpRequest.setRequestHeader("X-Requested-With", "XMLHttpRequest"); if (a) for (var b in a) { var f = a[b]; if (typeof f !== "function") this._xmlHttpRequest.setRequestHeader(b, f) } if (e.toLowerCase() === "post") { if (a === null || !a["Content-Type"]) this._xmlHttpRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8"); if (!c) c = "" } var d = this._webRequest.get_timeout(); if (d > 0) this._timer = window.setTimeout(Function.createDelegate(this, this._onTimeout), d); this._xmlHttpRequest.send(c); this._started = true }, getResponseHeader: function (b) { var a; try { a = this._xmlHttpRequest.getResponseHeader(b) } catch (c) { } if (!a) a = ""; return a }, getAllResponseHeaders: function () { return this._xmlHttpRequest.getAllResponseHeaders() }, get_responseData: function () { return this._xmlHttpRequest.responseText }, get_statusCode: function () { var a = 0; try { a = this._xmlHttpRequest.status } catch (b) { } return a }, get_statusText: function () { return this._xmlHttpRequest.statusText }, get_xml: function () { var a = this._xmlHttpRequest.responseXML; if (!a || !a.documentElement) { a = Sys.Net.XMLDOM(this._xmlHttpRequest.responseText); if (!a || !a.documentElement) return null } else if (navigator.userAgent.indexOf("MSIE") !== -1) a.setProperty("SelectionLanguage", "XPath"); if (a.documentElement.namespaceURI === "http://www.mozilla.org/newlayout/xml/parsererror.xml" && a.documentElement.tagName === "parsererror") return null; if (a.documentElement.firstChild && a.documentElement.firstChild.tagName === "parsererror") return null; return a }, abort: function () { if (this._aborted || this._responseAvailable || this._timedOut) return; this._aborted = true; this._clearTimer(); if (this._xmlHttpRequest && !this._responseAvailable) { this._xmlHttpRequest.onreadystatechange = Function.emptyMethod; this._xmlHttpRequest.abort(); this._xmlHttpRequest = null; this._webRequest.completed(Sys.EventArgs.Empty) } } }; Sys.Net.XMLHttpExecutor.registerClass("Sys.Net.XMLHttpExecutor", Sys.Net.WebRequestExecutor); Sys.Net._WebRequestManager = function () { this._defaultTimeout = 0; this._defaultExecutorType = "Sys.Net.XMLHttpExecutor" }; Sys.Net._WebRequestManager.prototype = { add_invokingRequest: function (a) { this._get_eventHandlerList().addHandler("invokingRequest", a) }, remove_invokingRequest: function (a) { this._get_eventHandlerList().removeHandler("invokingRequest", a) }, add_completedRequest: function (a) { this._get_eventHandlerList().addHandler("completedRequest", a) }, remove_completedRequest: function (a) { this._get_eventHandlerList().removeHandler("completedRequest", a) }, _get_eventHandlerList: function () { if (!this._events) this._events = new Sys.EventHandlerList; return this._events }, get_defaultTimeout: function () { return this._defaultTimeout }, set_defaultTimeout: function (a) { this._defaultTimeout = a }, get_defaultExecutorType: function () { return this._defaultExecutorType }, set_defaultExecutorType: function (a) { this._defaultExecutorType = a }, executeRequest: function (webRequest) { var executor = webRequest.get_executor(); if (!executor) { var failed = false; try { var executorType = eval(this._defaultExecutorType); executor = new executorType } catch (a) { failed = true } webRequest.set_executor(executor) } if (executor.get_aborted()) return; var evArgs = new Sys.Net.NetworkRequestEventArgs(webRequest), handler = this._get_eventHandlerList().getHandler("invokingRequest"); if (handler) handler(this, evArgs); if (!evArgs.get_cancel()) executor.executeRequest() } }; Sys.Net._WebRequestManager.registerClass("Sys.Net._WebRequestManager"); Sys.Net.WebRequestManager = new Sys.Net._WebRequestManager; Sys.Net.NetworkRequestEventArgs = function (a) { Sys.Net.NetworkRequestEventArgs.initializeBase(this); this._webRequest = a }; Sys.Net.NetworkRequestEventArgs.prototype = { get_webRequest: function () { return this._webRequest } }; Sys.Net.NetworkRequestEventArgs.registerClass("Sys.Net.NetworkRequestEventArgs", Sys.CancelEventArgs); Sys.Net.WebRequest = function () { this._url = ""; this._headers = {}; this._body = null; this._userContext = null; this._httpVerb = null; this._executor = null; this._invokeCalled = false; this._timeout = 0 }; Sys.Net.WebRequest.prototype = { add_completed: function (a) { this._get_eventHandlerList().addHandler("completed", a) }, remove_completed: function (a) { this._get_eventHandlerList().removeHandler("completed", a) }, completed: function (b) { var a = Sys.Net.WebRequestManager._get_eventHandlerList().getHandler("completedRequest"); if (a) a(this._executor, b); a = this._get_eventHandlerList().getHandler("completed"); if (a) a(this._executor, b) }, _get_eventHandlerList: function () { if (!this._events) this._events = new Sys.EventHandlerList; return this._events }, get_url: function () { return this._url }, set_url: function (a) { this._url = a }, get_headers: function () { return this._headers }, get_httpVerb: function () { if (this._httpVerb === null) { if (this._body === null) return "GET"; return "POST" } return this._httpVerb }, set_httpVerb: function (a) { this._httpVerb = a }, get_body: function () { return this._body }, set_body: function (a) { this._body = a }, get_userContext: function () { return this._userContext }, set_userContext: function (a) { this._userContext = a }, get_executor: function () { return this._executor }, set_executor: function (a) { this._executor = a; this._executor._set_webRequest(this) }, get_timeout: function () { if (this._timeout === 0) return Sys.Net.WebRequestManager.get_defaultTimeout(); return this._timeout }, set_timeout: function (a) { this._timeout = a }, getResolvedUrl: function () { return Sys.Net.WebRequest._resolveUrl(this._url) }, invoke: function () { Sys.Net.WebRequestManager.executeRequest(this); this._invokeCalled = true } }; Sys.Net.WebRequest._resolveUrl = function (b, a) { if (b && b.indexOf("://") !== -1) return b; if (!a || a.length === 0) { var d = document.getElementsByTagName("base")[0]; if (d && d.href && d.href.length > 0) a = d.href; else a = document.URL } var c = a.indexOf("?"); if (c !== -1) a = a.substr(0, c); c = a.indexOf("#"); if (c !== -1) a = a.substr(0, c); a = a.substr(0, a.lastIndexOf("/") + 1); if (!b || b.length === 0) return a; if (b.charAt(0) === "/") { var e = a.indexOf("://"), g = a.indexOf("/", e + 3); return a.substr(0, g) + b } else { var f = a.lastIndexOf("/"); return a.substr(0, f + 1) + b } }; Sys.Net.WebRequest._createQueryString = function (c, b, f) { b = b || encodeURIComponent; var h = 0, e, g, d, a = new Sys.StringBuilder; if (c) for (d in c) { e = c[d]; if (typeof e === "function") continue; g = Sys.Serialization.JavaScriptSerializer.serialize(e); if (h++) a.append("&"); a.append(d); a.append("="); a.append(b(g)) } if (f) { if (h) a.append("&"); a.append(f) } return a.toString() }; Sys.Net.WebRequest._createUrl = function (a, b, c) { if (!b && !c) return a; var d = Sys.Net.WebRequest._createQueryString(b, null, c); return d.length ? a + (a && a.indexOf("?") >= 0 ? "&" : "?") + d : a }; Sys.Net.WebRequest.registerClass("Sys.Net.WebRequest"); Sys._ScriptLoaderTask = function (b, a) { this._scriptElement = b; this._completedCallback = a }; Sys._ScriptLoaderTask.prototype = { get_scriptElement: function () { return this._scriptElement }, dispose: function () { if (this._disposed) return; this._disposed = true; this._removeScriptElementHandlers(); Sys._ScriptLoaderTask._clearScript(this._scriptElement); this._scriptElement = null }, execute: function () { this._addScriptElementHandlers(); document.getElementsByTagName("head")[0].appendChild(this._scriptElement) }, _addScriptElementHandlers: function () { this._scriptLoadDelegate = Function.createDelegate(this, this._scriptLoadHandler); if (Sys.Browser.agent !== Sys.Browser.InternetExplorer) { this._scriptElement.readyState = "loaded"; $addHandler(this._scriptElement, "load", this._scriptLoadDelegate) } else $addHandler(this._scriptElement, "readystatechange", this._scriptLoadDelegate); if (this._scriptElement.addEventListener) { this._scriptErrorDelegate = Function.createDelegate(this, this._scriptErrorHandler); this._scriptElement.addEventListener("error", this._scriptErrorDelegate, false) } }, _removeScriptElementHandlers: function () { if (this._scriptLoadDelegate) { var a = this.get_scriptElement(); if (Sys.Browser.agent !== Sys.Browser.InternetExplorer) $removeHandler(a, "load", this._scriptLoadDelegate); else $removeHandler(a, "readystatechange", this._scriptLoadDelegate); if (this._scriptErrorDelegate) { this._scriptElement.removeEventListener("error", this._scriptErrorDelegate, false); this._scriptErrorDelegate = null } this._scriptLoadDelegate = null } }, _scriptErrorHandler: function () { if (this._disposed) return; this._completedCallback(this.get_scriptElement(), false) }, _scriptLoadHandler: function () { if (this._disposed) return; var a = this.get_scriptElement(); if (a.readyState !== "loaded" && a.readyState !== "complete") return; this._completedCallback(a, true) } }; Sys._ScriptLoaderTask.registerClass("Sys._ScriptLoaderTask", null, Sys.IDisposable); Sys._ScriptLoaderTask._clearScript = function (a) { if (!Sys.Debug.isDebug) a.parentNode.removeChild(a) }; Type.registerNamespace("Sys.Net"); Sys.Net.WebServiceProxy = function () { }; Sys.Net.WebServiceProxy.prototype = { get_timeout: function () { return this._timeout || 0 }, set_timeout: function (a) { if (a < 0) throw Error.argumentOutOfRange("value", a, Sys.Res.invalidTimeout); this._timeout = a }, get_defaultUserContext: function () { return typeof this._userContext === "undefined" ? null : this._userContext }, set_defaultUserContext: function (a) { this._userContext = a }, get_defaultSucceededCallback: function () { return this._succeeded || null }, set_defaultSucceededCallback: function (a) { this._succeeded = a }, get_defaultFailedCallback: function () { return this._failed || null }, set_defaultFailedCallback: function (a) { this._failed = a }, get_enableJsonp: function () { return !!this._jsonp }, set_enableJsonp: function (a) { this._jsonp = a }, get_path: function () { return this._path || null }, set_path: function (a) { this._path = a }, get_jsonpCallbackParameter: function () { return this._callbackParameter || "callback" }, set_jsonpCallbackParameter: function (a) { this._callbackParameter = a }, _invoke: function (d, e, g, f, c, b, a) { c = c || this.get_defaultSucceededCallback(); b = b || this.get_defaultFailedCallback(); if (a === null || typeof a === "undefined") a = this.get_defaultUserContext(); return Sys.Net.WebServiceProxy.invoke(d, e, g, f, c, b, a, this.get_timeout(), this.get_enableJsonp(), this.get_jsonpCallbackParameter()) } }; Sys.Net.WebServiceProxy.registerClass("Sys.Net.WebServiceProxy"); Sys.Net.WebServiceProxy.invoke = function (q, a, m, l, j, b, g, e, w, p) { var i = w !== false ? Sys.Net.WebServiceProxy._xdomain.exec(q) : null, c, n = i && i.length === 3 && (i[1] !== location.protocol || i[2] !== location.host); m = n || m; if (n) { p = p || "callback"; c = "_jsonp" + Sys._jsonp++ } if (!l) l = {}; var r = l; if (!m || !r) r = {}; var s, h, f = null, k, o = null, u = Sys.Net.WebRequest._createUrl(a ? q + "/" + encodeURIComponent(a) : q, r, n ? p + "=Sys." + c : null); if (n) { s = document.createElement("script"); s.src = u; k = new Sys._ScriptLoaderTask(s, function (d, b) { if (!b || c) t({ Message: String.format(Sys.Res.webServiceFailedNoMsg, a) }, -1) }); function v() { if (f === null) return; f = null; h = new Sys.Net.WebServiceError(true, String.format(Sys.Res.webServiceTimedOut, a)); k.dispose(); delete Sys[c]; if (b) b(h, g, a) } function t(d, e) { if (f !== null) { window.clearTimeout(f); f = null } k.dispose(); delete Sys[c]; c = null; if (typeof e !== "undefined" && e !== 200) { if (b) { h = new Sys.Net.WebServiceError(false, d.Message || String.format(Sys.Res.webServiceFailedNoMsg, a), d.StackTrace || null, d.ExceptionType || null, d); h._statusCode = e; b(h, g, a) } } else if (j) j(d, g, a) } Sys[c] = t; e = e || Sys.Net.WebRequestManager.get_defaultTimeout(); if (e > 0) f = window.setTimeout(v, e); k.execute(); return null } var d = new Sys.Net.WebRequest; d.set_url(u); d.get_headers()["Content-Type"] = "application/json; charset=utf-8"; if (!m) { o = Sys.Serialization.JavaScriptSerializer.serialize(l); if (o === "{}") o = "" } d.set_body(o); d.add_completed(x); if (e && e > 0) d.set_timeout(e); d.invoke(); function x(d) { if (d.get_responseAvailable()) { var f = d.get_statusCode(), c = null; try { var e = d.getResponseHeader("Content-Type"); if (e.startsWith("application/json")) c = d.get_object(); else if (e.startsWith("text/xml")) c = d.get_xml(); else c = d.get_responseData() } catch (m) { } var k = d.getResponseHeader("jsonerror"), h = k === "true"; if (h) { if (c) c = new Sys.Net.WebServiceError(false, c.Message, c.StackTrace, c.ExceptionType, c) } else if (e.startsWith("application/json")) c = !c || typeof c.d === "undefined" ? c : c.d; if (f < 200 || f >= 300 || h) { if (b) { if (!c || !h) c = new Sys.Net.WebServiceError(false, String.format(Sys.Res.webServiceFailedNoMsg, a)); c._statusCode = f; b(c, g, a) } } else if (j) j(c, g, a) } else { var i; if (d.get_timedOut()) i = String.format(Sys.Res.webServiceTimedOut, a); else i = String.format(Sys.Res.webServiceFailedNoMsg, a); if (b) b(new Sys.Net.WebServiceError(d.get_timedOut(), i, "", ""), g, a) } } return d }; Sys.Net.WebServiceProxy._generateTypedConstructor = function (a) { return function (b) { if (b) for (var c in b) this[c] = b[c]; this.__type = a } }; Sys._jsonp = 0; Sys.Net.WebServiceProxy._xdomain = /^\s*([a-zA-Z0-9\+\-\.]+\:)\/\/([^?#\/]+)/; Sys.Net.WebServiceError = function (d, e, c, a, b) { this._timedOut = d; this._message = e; this._stackTrace = c; this._exceptionType = a; this._errorObject = b; this._statusCode = -1 }; Sys.Net.WebServiceError.prototype = { get_timedOut: function () { return this._timedOut }, get_statusCode: function () { return this._statusCode }, get_message: function () { return this._message }, get_stackTrace: function () { return this._stackTrace || "" }, get_exceptionType: function () { return this._exceptionType || "" }, get_errorObject: function () { return this._errorObject || null } }; Sys.Net.WebServiceError.registerClass("Sys.Net.WebServiceError");
Type.registerNamespace('Sys'); Sys.Res = { 'argumentInteger': 'Value must be an integer.', 'invokeCalledTwice': 'Cannot call invoke more than once.', 'webServiceFailed': 'The server method \'{0}\' failed with the following error: {1}', 'argumentType': 'Object cannot be converted to the required type.', 'argumentNull': 'Value cannot be null.', 'scriptAlreadyLoaded': 'The script \'{0}\' has been referenced multiple times. If referencing Microsoft AJAX scripts explicitly, set the MicrosoftAjaxMode property of the ScriptManager to Explicit.', 'scriptDependencyNotFound': 'The script \'{0}\' failed to load because it is dependent on script \'{1}\'.', 'formatBadFormatSpecifier': 'Format specifier was invalid.', 'requiredScriptReferenceNotIncluded': '\'{0}\' requires that you have included a script reference to \'{1}\'.', 'webServiceFailedNoMsg': 'The server method \'{0}\' failed.', 'argumentDomElement': 'Value must be a DOM element.', 'invalidExecutorType': 'Could not create a valid Sys.Net.WebRequestExecutor from: {0}.', 'cannotCallBeforeResponse': 'Cannot call {0} when responseAvailable is false.', 'actualValue': 'Actual value was {0}.', 'enumInvalidValue': '\'{0}\' is not a valid value for enum {1}.', 'scriptLoadFailed': 'The script \'{0}\' could not be loaded.', 'parameterCount': 'Parameter count mismatch.', 'cannotDeserializeEmptyString': 'Cannot deserialize empty string.', 'formatInvalidString': 'Input string was not in a correct format.', 'invalidTimeout': 'Value must be greater than or equal to zero.', 'cannotAbortBeforeStart': 'Cannot abort when executor has not started.', 'argument': 'Value does not fall within the expected range.', 'cannotDeserializeInvalidJson': 'Cannot deserialize. The data does not correspond to valid JSON.', 'invalidHttpVerb': 'httpVerb cannot be set to an empty or null string.', 'nullWebRequest': 'Cannot call executeRequest with a null webRequest.', 'eventHandlerInvalid': 'Handler was not added through the Sys.UI.DomEvent.addHandler method.', 'cannotSerializeNonFiniteNumbers': 'Cannot serialize non finite numbers.', 'argumentUndefined': 'Value cannot be undefined.', 'webServiceInvalidReturnType': 'The server method \'{0}\' returned an invalid type. Expected type: {1}', 'servicePathNotSet': 'The path to the web service has not been set.', 'argumentTypeWithTypes': 'Object of type \'{0}\' cannot be converted to type \'{1}\'.', 'cannotCallOnceStarted': 'Cannot call {0} once started.', 'badBaseUrl1': 'Base URL does not contain ://.', 'badBaseUrl2': 'Base URL does not contain another /.', 'badBaseUrl3': 'Cannot find last / in base URL.', 'setExecutorAfterActive': 'Cannot set executor after it has become active.', 'paramName': 'Parameter name: {0}', 'nullReferenceInPath': 'Null reference while evaluating data path: \'{0}\'.', 'cannotCallOutsideHandler': 'Cannot call {0} outside of a completed event handler.', 'cannotSerializeObjectWithCycle': 'Cannot serialize object with cyclic reference within child properties.', 'format': 'One of the identified items was in an invalid format.', 'assertFailedCaller': 'Assertion Failed: {0}\r\nat {1}', 'argumentOutOfRange': 'Specified argument was out of the range of valid values.', 'webServiceTimedOut': 'The server method \'{0}\' timed out.', 'notImplemented': 'The method or operation is not implemented.', 'assertFailed': 'Assertion Failed: {0}', 'invalidOperation': 'Operation is not valid due to the current state of the object.', 'breakIntoDebugger': '{0}\r\n\r\nBreak into debugger?' };
;
(function ($) {
  function toggleImage() {
    const $header = this;
    const $icon = $header.find('i');
    // Children-Pfeile der Werksgruppierung werden im folgenden gedreht
    if ($icon.hasClass("clickflag")) {
      if ($icon.hasClass("icon-down-open")) {
        setPlus.apply($icon);
      } else if ($icon.hasClass("icon-right-open")) {
        setMinus.apply($icon);
      }
    } else {
      $icon.toggleClass("clickflag");
    }
  }
  function setPlus() {
    $(this).toggleClass("icon-down-open icon-right-open");
    return;
  }
  function setMinus() {
    $(this).toggleClass("icon-right-open icon-down-open");
  }
  function show($header) {
    const $icon = $header.find("i");
    containerOf($header).toggle(true);
    setMinus.apply($icon);
  }
  function toggle($header) {
    containerOf($header).toggle(function () {
      toggleImage.apply($header);
    });
  }
  function containerOf($header) {
    return $header.closest('div').find('>div');
  }
  $(function () {
    $("div.bo_werksgruppierung h6").on("click", function (e) {
      let $header = $(this);
      const $werksgruppierunglineIcon = $header.find("i");
      // Pfeile der Werksgruppierung werden im folgenden gedreht
      if ($werksgruppierunglineIcon.hasClass("clickflag")) {
        $werksgruppierunglineIcon.toggleClass("icon-down-open icon-right-open");
      } else {
        $werksgruppierunglineIcon.toggleClass("clickflag");
      }
      $header = $header.closest('div').find('>div');
      $header.toggle(); // Togglen des hidden Contents unter der werksgruppierung h6
    });
    $(".img-werksgruppierung").on("keypress", function (e) {
      const code = e.keyCode ? e.keyCode : e.which;
      if (code !== 9) {
        const $header = $(this);
        toggle($header);
      }
    });
    $(".bo_werksgruppierung_titel_jump, .bo_opus_jump").on({
      click: function () {
        const $target = $(this);
        const jumpTargetId = $target.attr("href");
        const $jumpTarget = $(jumpTargetId);
        const $header = $jumpTarget.closest(".bo_werksgruppierung").find("h6");
        show($header);
      },
      keypress: function (e) {
        const code = e.keyCode ? e.keyCode : e.which;
        if (code !== 9) {
          const $target = $(this);
          const jumpTargetId = $target.attr("href");
          const $jumpTarget = $(jumpTargetId);
          const $header = $jumpTarget.closest(".bo_werksgruppierung").find("h6");
          show($header);
        }
      }
    });
  });
})(jQuery);
function hideWerksgruppierung(element) {
  const $icon = element.closest("div.werksgruppierungline").find("i.icon-down-open");
  $icon.toggleClass("icon-down-open icon-right-open");
  const $werksgruppierung = element.closest("div.bo_werksgruppierung").find("div.show-children");
  $werksgruppierung.toggleClass("show-children hide-children");
}
//# sourceMappingURL=ToggleWerksgruppierung.js.map
;
let _spinnerHandler = null;
$(document).ready(function () {
  _spinnerHandler = new SpinnerHandler();
  $(".btn_markall").hide();
  checkMarkingCheckboxes();
});
function toggleMarkingDoc(docIdArray, targetAction, onComplete, onDone) {
  const $checkboxes = $("#mark_" + docIdArray.join(", #mark_"));
  const $spinners = $("#markprocess_" + docIdArray.join(", #markprocess_"));
  const promise = new Promise(function (resolve) {
    $.ajax({
      type: "POST",
      url: targetAction,
      data: {
        docIds: docIdArray
      },
      beforeSend: function () {
        _spinnerHandler.showSpinners($spinners, $checkboxes);
      },
      complete: function () {
        _spinnerHandler.hideSpinners($spinners, $checkboxes);
        if (onComplete) {
          toggleMarkingDocFinished();
        }
        resolve();
      },
      success: function (data) {
        $checkboxes.attr("title", data);
      }
    }).done(function () {
      if (typeof onDone === 'function') {
        onDone();
      }
    });
  });
  promise.finally(function () {
    handleCheckboxMarkAll();
    handleHitlistFunctionsState();
    checkMarkingCheckboxes();
  });
}
function setMarkingDoc(docIdArray, markallChecked, targetAction, onComplete) {
  const $checkboxes = $("#mark_" + docIdArray.join(", #mark_"));
  const $spinners = $(".markall,#markprocess_" + docIdArray.join(", #markprocess_"));

  //Wegen IE Unterstützung muss eine  Bibliothek von Drittanbietern eingebunden werden
  //https://www.npmjs.com/package/promise-polyfill
  const promise = new Promise(function (resolve) {
    $.ajax({
      type: "POST",
      url: targetAction,
      data: {
        docIds: docIdArray,
        isMarked: markallChecked
      },
      beforeSend: function () {
        _spinnerHandler.showSpinners($spinners, $checkboxes);
      },
      complete: function () {
        _spinnerHandler.hideSpinners($spinners, $checkboxes);
        onComplete();
        resolve();
      },
      success: function (data) {
        $checkboxes.attr("title", data);
      }
    });
  });
  promise.finally(function () {
    handleCheckboxMarkAll();
    handleHitlistFunctionsState();
    checkMarkingCheckboxes();
  });
}

// sind alle Dokumente markiert, muss auch "Alle markieren" angehakt werden
function handleCheckboxMarkAll() {
  const markAll = $('.markall');
  const checkBoxes = $("input[id^='mark_']");
  const doMarkAll = checkBoxes.length === checkBoxes.filter(":checked").length;
  markAll.prop('checked', doMarkAll);
  setTitleForCheckboxMarkAll(markAll, doMarkAll);
  updateZurAkteButton();
}
function handleHitlistFunctionsState() {
  const disabled = $("input[id^='mark_']:checked").length <= 0;
  $(".hitlistDocumentHeaderFunctions > .hitlist-functions").toggleClass("disabled", disabled);
}
function setTitleForCheckboxMarkAll(id, markallChecked) {
  $.ajax({
    type: "GET",
    data: {
      isMarked: markallChecked
    },
    url: "/Search/TitleForAllDocumentsCheckBox/",
    success: function (title) {
      $(id).attr("title", title);
    }
  });
}
function markAllDocumentCheckboxes(caller, targetAction, additionalOnComplete) {
  const $caller = $(caller);
  const $icons = $(".hitlistDocumentHeaderFunctions .treffer-funktion-icon a");
  const $spinner = $("div.hitlistmarking > .dots-circle-spinner");
  const $toMark = $("input[id^='mark_']");
  const markallChecked = $caller.prop("checked");
  _spinnerHandler.showSpinners($spinner, $caller);
  $icons.addClass("HitlistHead-funktion-icon-disabled");
  setTitleForCheckboxMarkAll(caller, markallChecked);
  $toMark.prop("checked", markallChecked);
  const docIdArray = $toMark.map(function () {
    return this.id.substring(this.id.indexOf("_") + 1);
  }).get();
  const onComplete = function () {
    $caller.show();
    _spinnerHandler.hideSpinners($spinner, $caller);
    $icons.removeClass("HitlistHead-funktion-icon-disabled");
    if (additionalOnComplete) {
      toggleMarkingDocFinished();
    }
  };
  setMarkingDoc(docIdArray, markallChecked, targetAction, onComplete);
}
function checkMarkingCheckboxes() {
  const markierteTrefferCheckboxInput = document.getElementById("markierteTrefferlisteRadiobutton");
  const urlSegment = window.location.href.indexOf("Dokumentenliste") !== -1 ? "AreDocumentsMarkedAndSelected" : "AreDocumentsMarked";
  $.ajax({
    type: "POST",
    url: "/DruckExportManager/" + urlSegment,
    success: function (data) {
      if (data === "true") {
        $(markierteTrefferCheckboxInput).removeAttr("disabled");
        $(markierteTrefferCheckboxInput).prop("checked", true);
        $("#angezeigteTrefferlisteRadiobutton").prop("checked", false);
        const gesTrefferRadioButton = $("#gesamteTrefferlisteRadiobutton");
        if (gesTrefferRadioButton.length > 0) {
          gesTrefferRadioButton.prop("checked", false);
        }
      } else if (data === "false") {
        $(markierteTrefferCheckboxInput).prop("checked", false);
        $(markierteTrefferCheckboxInput).attr("disabled", "disabled");
        $("#angezeigteTrefferlisteRadiobutton").prop("checked", true);
      }
    }
  });
}
//# sourceMappingURL=HandleCheckboxes.js.map
;
function refreshDokumentenlisteUndZurAkteIcon(isFromHitlistParam) {
  isFromHitlistParam = isFromHitlistParam || false;
  $.ajax({
    type: "POST",
    url: "/Toolleiste/RefreshMarkierungLoeschenIcon",
    data: {
      isfromhitlist: isFromHitlistParam
    },
    dataType: "html",
    success: function (data) {
      if (data.length > 0) {
        $("#loeschenIcon").replaceWith(data);
      }
    }
  });
}
function toggleSelection(docId) {
  toggleMarkingDoc(jQuery.makeArray(docId), '/Search/ToggleSelectionForMarkedDocuments/', true);
}
function toggleMarkingDocFinished() {
  const isFromHitlistStr = $('#standardansichticon').data('isfromhitlist');
  const isFromHitlistStrBool = isFromHitlistStr === 'true' || isFromHitlistStr === 'True';
  refreshDokumentenlisteUndZurAkteIcon(isFromHitlistStrBool);
}
function markAllCheckboxes(caller) {
  markAllDocumentCheckboxes(caller, '/Search/ToggleSelectionForMarkedDocuments/', true);
}
//# sourceMappingURL=MarkedDocuments.js.map
;
/*!
 * JavaScript Cookie v2.1.4
 * https://github.com/js-cookie/js-cookie
 *
 * Copyright 2006, 2015 Klaus Hartl & Fagner Brack
 * Released under the MIT license
 */
; (function (factory) {
    var registeredInModuleLoader = false;
    if (typeof define === 'function' && define.amd) {
        define(factory);
        registeredInModuleLoader = true;
    }
    if (typeof exports === 'object') {
        module.exports = factory();
        registeredInModuleLoader = true;
    }
    if (!registeredInModuleLoader) {
        var OldCookies = window.Cookies;
        var api = window.Cookies = factory();
        api.noConflict = function () {
            window.Cookies = OldCookies;
            return api;
        };
    }
}(function () {
    function extend() {
        var i = 0;
        var result = {};
        for (; i < arguments.length; i++) {
            var attributes = arguments[i];
            for (var key in attributes) {
                result[key] = attributes[key];
            }
        }
        return result;
    }

    function init(converter) {
        function api(key, value, attributes) {
            var result;
            if (typeof document === 'undefined') {
                return;
            }

            // Write

            if (arguments.length > 1) {
                attributes = extend({
                    path: '/'
                }, api.defaults, attributes);

                if (typeof attributes.expires === 'number') {
                    var expires = new Date();
                    expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5);
                    attributes.expires = expires;
                }

                // We're using "expires" because "max-age" is not supported by IE
                attributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';

                try {
                    result = JSON.stringify(value);
                    if (/^[\{\[]/.test(result)) {
                        value = result;
                    }
                } catch (e) { }

                if (!converter.write) {
                    value = encodeURIComponent(String(value))
                        .replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
                } else {
                    value = converter.write(value, key);
                }

                key = encodeURIComponent(String(key));
                key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);
                key = key.replace(/[\(\)]/g, escape);

                var stringifiedAttributes = '';

                for (var attributeName in attributes) {
                    if (!attributes[attributeName]) {
                        continue;
                    }
                    stringifiedAttributes += '; ' + attributeName;
                    if (attributes[attributeName] === true) {
                        continue;
                    }
                    stringifiedAttributes += '=' + attributes[attributeName];
                }
                return (document.cookie = key + '=' + value + stringifiedAttributes);
            }

            // Read

            if (!key) {
                result = {};
            }

            // To prevent the for loop in the first place assign an empty array
            // in case there are no cookies at all. Also prevents odd result when
            // calling "get()"
            var cookies = document.cookie ? document.cookie.split('; ') : [];
            var rdecode = /(%[0-9A-Z]{2})+/g;
            var i = 0;

            for (; i < cookies.length; i++) {
                var parts = cookies[i].split('=');
                var cookie = parts.slice(1).join('=');

                if (cookie.charAt(0) === '"') {
                    cookie = cookie.slice(1, -1);
                }

                try {
                    var name = parts[0].replace(rdecode, decodeURIComponent);
                    cookie = converter.read ?
                        converter.read(cookie, name) : converter(cookie, name) ||
                        cookie.replace(rdecode, decodeURIComponent);

                    if (this.json) {
                        try {
                            cookie = JSON.parse(cookie);
                        } catch (e) { }
                    }

                    if (key === name) {
                        result = cookie;
                        break;
                    }

                    if (!key) {
                        result[name] = cookie;
                    }
                } catch (e) { }
            }

            return result;
        }

        api.set = api;
        api.get = function (key) {
            return api.call(api, key);
        };
        api.getJSON = function () {
            return api.apply({
                json: true
            }, [].slice.call(arguments));
        };
        api.defaults = {};

        api.remove = function (key, attributes) {
            api(key, '', extend(attributes, {
                expires: -1
            }));
        };

        api.withConverter = init;

        return api;
    }

    return init(function () { });
}));
;
//jQuery Erweiterung, um mittels regex nach Elementen zu suchen, die bestimmte Patterns aufweisen
//https://j11y.io/javascript/regex-selector-for-jquery/
jQuery.expr[":"].regex = function (elem, index, match) {
    var matchParams = match[3].split(","),
        validLabels = /^(data|css):/,
        attr = {
            method: matchParams[0].match(validLabels) ?
                matchParams[0].split(":")[0] : "attr",
            property: matchParams.shift().replace(validLabels, "")
        },
        regexFlags = "ig",
        regex = new RegExp(matchParams.join("").replace(/^\s+|\s+$/g, ""), regexFlags);
    return regex.test(jQuery(elem)[attr.method](attr.property));
}

$.fn.scrollEnd = function(callback, timeout) {          
    $(this).scroll(function(){
        var $this = $(this);
        if ($this.data("scrollTimeout")) {
            clearTimeout($this.data("scrollTimeout"));
        }
        $this.data("scrollTimeout", setTimeout(callback,timeout));
    });
};

/**
 * Gibt die aktuelle Höhe eines Elements innerhalb des ViewPorts zurück
 * z.B. die sichtbare Höhe wenn das Element zur Hälfte aus dem Bild gescrolled ist
 * @param {any} cb callback Funktion
 */
$.fn.visibleHeight = function(cb) {
    return this.each(function(i, el) {
        var elH = $(el).outerHeight(),
            h = $(window).height(),
            r = el.getBoundingClientRect(),
            t = r.top,
            b = r.bottom;
        return cb.call(el, Math.max(0, t > 0 ? Math.min(elH, h - t) : Math.min(b, h)));
    });
}

/**
 * Berechnet die Breite eines Textes in Pixeln, z.B. die Breite des Inhalts eines TextInput Elements
 * @param {any} text
 * @param {any} font
 */
$.fn.textWidth = function () {
    var canvas = document.createElement("canvas");
    var context = canvas.getContext("2d");
    context.font = $(this).fontShorthand();
    var metrics = context.measureText($(this).val());
    return parseInt(metrics.width);
};

/**
 * Baut aus allen Font-Properties das Font-Shorthand Property zusammen und gibt dies als String zurück
 * Wird benötigt, da bei Edge/IE das Shorthand Property nicht ausgelesen werden kann
 */
$.fn.fontShorthand = function() {
    var fontStyle = $(this).css("font-style") || "";
    var fontVariant = $(this).css("font-variant") || "";
    var fontWeight = $(this).css("font-weight") || "";
    var fontSize = $(this).css("font-size") || "";
    var lineHeight = $(this).css("line-height") || "";
    var fontFamily = $(this).css("font-family") || "";

    // Syntax: font-style font-variant font-weight font-size/line-height font-family
    return fontStyle +
        " " +
        fontVariant +
        " " +
        fontWeight +
        " " +
        fontSize +
        "/" +
        lineHeight +
        " " +
        fontFamily;
}

/**
 * Ignoriert den übergebenen Selektor
 * Bsp: <div>Hallo<span>Welt</span></div>
 * $("div").ignore("span").text() => Hallo
 * @param {any} sel
 */
$.fn.ignore = function (sel) {
    return this.clone().find(sel || ">*").remove().end();
};;
function SpinnerHandler() {
  const loadingSpinner = document.createElement("span");
  this.show = function show() {
    loadingSpinner.setAttribute("class", "dots-circle-spinner loading ansichtloadericon");
    $("body").append(loadingSpinner);
  };
  this.hide = function hide() {
    loadingSpinner.remove();
  };
  this.showSpinners = function ($spinners, $replacedElements) {
    $replacedElements.css('visibility', 'hidden');
    $spinners.addClass('loading');
  };
  this.hideSpinners = function ($spinners, $replacedElements) {
    $spinners.removeClass('loading');
    $replacedElements.css('visibility', '');
  };
}
//# sourceMappingURL=loading.js.map
;
function HotkeyManager() {
  let windowsKeyPressed = false;
  const windowsKeys = [91, 92];
  let hookRegistered = false;
  const settings = {
    ignoredElementsSelectors: ["input", "textarea"],
    hotkeys: [],
    enabled: true
  };

  // private
  const getHotkey = function (key, keyCode, shiftKey, ctrlKey, altKey) {
    return settings.hotkeys.find(hotkey => (hotkey.key === key || hotkey.keyCode === keyCode) && hotkey.shiftKey === shiftKey && hotkey.ctrlKey === ctrlKey && hotkey.altKey === altKey);
  };
  const isWindowsKey = function (keyCode) {
    return windowsKeys.indexOf(keyCode) >= 0;
  };
  const ignoredElementHasFocus = function () {
    let isElementFocused = false;
    settings.ignoredElementsSelectors.forEach(function (id) {
      isElementFocused = isElementFocused || $(id).is(":focus");
    });
    return isElementFocused;
  };
  const handleHotkey = function (hotkey, event) {
    if (!hotkey) return;

    // reset flag
    if (isWindowsKey(event.which)) {
      windowsKeyPressed = false;
      return;
    }

    // ignoriere system shortcuts
    if (event.metaKey || windowsKeyPressed) return;

    // ignoriere wenn z.B. ein input Feld fokusiert ist (kann mit triggerActionAlsoOnIgnoredElements = true abgeschaltet werden)
    if (hotkey.triggerActionAlsoOnIgnoredElements === false && ignoredElementHasFocus()) return;
    event.preventDefault();
    if (isNotNull(hotkey.action) && typeof hotkey.action === "function") {
      hotkey.action(event);
    }
  };
  const registerHook = function () {
    if (hookRegistered) {
      return;
    }

    // IE und Firefox setzt das event.metaKey nicht. Als Fallback wird beim keydown die windowsKeyPressed Variable gesetzt.
    document.addEventListener('keydown', function (e) {
      if (settings.enabled) {
        windowsKeyPressed = isWindowsKey(e.which);
        const registeredHotkey = getHotkey(e.key, e.keyCode, e.shiftKey, e.ctrlKey, e.altKey);
        if (isNotNull(registeredHotkey)) {
          handleHotkey(registeredHotkey, e);
        }
      }
    });
    hookRegistered = true;
  };

  // public
  this.enable = function () {
    settings.enabled = true;
  };
  this.disable = function () {
    settings.enabled = false;
  };

  /**
   * Registriert einen Hotkey
   * @param {string} key: der Key als string
   * @param {int} keyCode: der KeyCode als int (Fallback wenn der Key nicht gefunden wird)
   * @param {function} action: Methode die beim Ausf�hren des Hotkeys ausgel�st wird
   * @param {object} modifiers: (optional) Modifier Keys {altKey, shiftKey, ctrlKey}
   * @param {bool} triggerActionAlsoOnIgnoredElements: (optional; Default = false) Action auch dann ausführen, wenn Cursor in einem "ignoredElement" steht
   */
  this.registerHotkey = function (key, keyCode, action, modifiers, triggerActionAlsoOnIgnoredElements) {
    const hotkey = {
      key: key,
      keyCode: keyCode,
      action: action,
      triggerActionAlsoOnIgnoredElements: triggerActionAlsoOnIgnoredElements
    };
    if (isNotNull(modifiers)) {
      hotkey.altKey = modifiers.altKey || false;
      hotkey.shiftKey = modifiers.shiftKey || false;
      hotkey.ctrlKey = modifiers.ctrlKey || false;
    }
    if (hookRegistered === false) registerHook();
    settings.hotkeys.push(hotkey);
  };
  this.isHotkeyRegistered = function (key, keyCode, shiftKey, ctrlKey, altKey) {
    return isNotNull(getHotkey(key, keyCode, shiftKey, ctrlKey, altKey));
  };
}
window.hotkeyManager = new HotkeyManager();
//# sourceMappingURL=HotkeyManager.js.map
;
//___________________________________________Variablendeklarationsbereich______________________________________
//_____________________________________________Allgemeine Funktionen____________________________________________
//____________________________________________Benutzerspezifische Funktionen_____________________________________
function getToggleIcon(on) {
  return on ? "icon-toggle-on" : "icon-toggle-off";
}
function setupZitierFunktion(enabled) {
  window.sourceOfInformation.setActive(enabled);
}
function toggleKeywordsCloud(sender) {
  const $icon = $(".action i", $(sender).closest(".row"));
  if (isDisabled($icon)) return false;
  showProgress($icon);
  $.post(BO.config.searchSettings.toggleKeywordsUrl, function (result) {
    const visible = result.showKeywords;
    $("#keywordcloud").toggleClass("out-of-viewport", !visible);

    // flip icon state
    $icon.toggleClass(BO.config.searchSettings.iconToggleOn, visible);
    $icon.toggleClass(BO.config.searchSettings.iconToggleOff, !visible);
    hideProgress($icon);
    trackMatomoEvent(result.Category, result.Action);
  });
  return false;
}
function toggleTopEntries() {
  $(".no-top-paragraph").toggle();
  const $icon = $("#top-entries-arrow");
  const iconDown = $icon.data("toggle-down-icon");
  const iconUp = $icon.data("toggle-up-icon");
  const $iconClass = $icon.hasClass(iconUp) ? iconDown : iconUp;
  $icon.attr("class", "icon " + $iconClass);
}
function toggleEnableKeyboardShortcuts(sender) {
  const $icon = $(".action i", $(sender).closest(".row"));
  if (isDisabled($icon)) return false;
  showProgress($icon);
  $.post(BO.config.searchSettings.toggleEnableKeyboardShortcutsUrl, function (result) {
    const visible = result.EnableKeyboardShortcuts;
    if (typeof setEnableKeyboardShortcuts === 'function') {
      setEnableKeyboardShortcuts(visible);
    }

    // flip icon state
    $icon.toggleClass(BO.config.searchSettings.iconToggleOn, visible);
    $icon.toggleClass(BO.config.searchSettings.iconToggleOff, !visible);
    hideProgress($icon);
    trackMatomoEvent(result.Category, result.Action);
  });
  return false;
}
function togglePersonalSearchHistory(sender) {
  const $icon = $(".action i", $(sender).closest(".row"));
  if (isDisabled($icon)) return false;
  showProgress($icon);
  $.post(BO.config.searchSettings.togglePersonalSearchHistoryUrl, function (result) {
    const visible = result.savePersonalSearchHistory;
    // flip icon state
    $icon.toggleClass(BO.config.searchSettings.iconToggleOn, visible);
    $icon.toggleClass(BO.config.searchSettings.iconToggleOff, !visible);
    hideProgress($icon);
    trackMatomoEvent(result.Category, result.Action);
  });
  return false;
}
function toggleHitlistTopEntries(sender) {
  const $icon = $(".action i", $(sender).closest(".row"));
  if (isDisabled($icon)) return false;
  showProgress($icon);
  $.post(BO.config.searchSettings.topLeisteFeatureUrl, function (result) {
    const visible = result.showTopFeature;
    $("#topParagraphs").toggleClass("out-of-viewport", !visible);

    // flip icon state
    $icon.toggleClass(BO.config.searchSettings.iconToggleOn, visible);
    $icon.toggleClass(BO.config.searchSettings.iconToggleOff, !visible);
    hideProgress($icon);
    trackMatomoEvent(result.Category, result.Action);
  });
  return false;
}
function toggleMarkText(sender) {
  const $icon = $(".action i", $(sender).closest(".row"));
  if (isDisabled($icon)) return false;
  showProgress($icon);
  $.post(BO.config.searchSettings.markTextUrl, function (result) {
    const visible = result.zitierFunktionAktiv;
    setupZitierFunktion(visible);

    // flip icon state
    $icon.toggleClass(BO.config.searchSettings.iconToggleOn, visible);
    $icon.toggleClass(BO.config.searchSettings.iconToggleOff, !visible);
    hideProgress($icon);
    trackMatomoEvent(result.Category, result.Action);
  });
  return false;
}
//# sourceMappingURL=bo.settingsbox.js.map
;
//_____________Variablen Deklarationsbereich_____________

// ~~~Beispiel:~~~
// let init = false
// const columns = 2

//_________________Allgemeine Funktionen_________________
// ~~~Beispiel:~~~
/* $(document).ready(function () {

})*/
//___________Benutzerspezifische Funktionen______________

const OnSaveAnnotationCompleted = function () {
  const $annotation = $('.bo-annotation-box');
  const hasContent = $annotation !== null && $annotation.val() !== '';
  window.collapseLinknoteTree.restoreState();
  if (!hasContent && $('#annotationwithcontentoff').length) {
    $('#annotationwithcontentoff').attr('id', 'annotationoff');
  } else if (hasContent && $('#annotationoff').length) {
    $('#annotationoff').attr('id', 'annotationwithcontentoff');
  }
  if (!hasContent && $('#annotationwithcontenton').length) {
    $('#annotationwithcontenton').attr('id', 'annotationon');
  } else if (hasContent && $('#annotationon').length) {
    $('#annotationon').attr('id', 'annotationwithcontenton');
  }
};
function RemoveAnnotation(vpath, docid, annotationId) {
  $.ajax({
    type: "POST",
    url: "/Annotation/ClearAnnotation",
    data: {
      VPath: vpath,
      DocId: docid
    },
    success: function (data) {
      if (data) {
        if (data.length > 0) {
          $("#" + annotationId).html(data);
        }
      }
    }
  });
}
//# sourceMappingURL=Annotations.js.map
;
const Detailsuche = new function () {/* empty */}();
let datepickerSettings;
let headingSelected;
let selectedPublikationstyp;
function showDetailsuche() {
  Detailsuche.showDialog($(this), '/Detailsuche/GetDialog', $('#dialogdetailsuche'));
  return false;
}

// Öffnet Detailsuche mit Fokus auf "Alle Publikationen"
window.hotkeyManager.registerHotkey("5", 53, () => {
  if ($('#dialogdetailsuche').dialog('instance') === undefined || $('#dialogdetailsuche').dialog('isOpen') === false) {
    showDetailsuche();
  }
  setTimeout(() => {
    document.getElementById("chkdoktyp").focus();
  }, 350);
}, {
  ctrlKey: false,
  altKey: true,
  shiftKey: false
}, true);

// Öffnet Detailsuche mit Fokus auf "Datum/ Zeitraum"
window.hotkeyManager.registerHotkey("6", 54, () => {
  if ($('#dialogdetailsuche').dialog('instance') === undefined || $('#dialogdetailsuche').dialog('isOpen') === false) {
    showDetailsuche();
  }
  setTimeout(() => {
    document.getElementById("TxtDatum").focus();
  }, 300);
}, {
  ctrlKey: false,
  altKey: true,
  shiftKey: false
}, true);

// Schließt Detailsuche, geht zu einzeiligen Suche
window.hotkeyManager.registerHotkey("7", 55, () => {
  $('#dialogdetailsuche').dialog('close');
  setTimeout(() => {
    document.getElementById("words").focus();
  }, 300);
}, {
  ctrlKey: false,
  altKey: true,
  shiftKey: false
}, true);
Detailsuche.showDialog = function (element, url, container) {
  if (!$.trim(container.html()).length) {
    jQuery.ajax({
      url: url,
      dataType: 'html',
      type: 'GET',
      success: function (content) {
        //Wenn showDialog mehrmals aufgerufen wird und die ersten Anfragen noch andauern, kann es passieren das der Content mehrfach in den Dialog eingefügt wird
        if (!$.trim(container.html()).length) {
          container.append(content);
          container.dialog(getDialogOptions());
          init();
          //Für das Responsive Desigen muss die Größe der Deteilsuche evtl. neu angepasst werden
          reSizeDetailsuche();
        }
      }
    });
  } else {
    if ($('#onlyLexiconCheckbox').length) {
      $('#NurLexikon').val($('#onlyLexiconCheckbox').is(':checked'));
    }
    container.dialog("open");
    //Für das Responsive Desigen muss die Größe der Deteilsuche evtl. neu angepasst werden
    reSizeDetailsuche();
  }
};

/**
* Fügt den angebenen Text in das Suchfeld ein
* @param string strText Der einzufügende Text
* @param boolean walkback Gibt an ob der Cursor zurück gesetzt wird oder nicht
*/
Detailsuche.appendQuery = function (strText, walkback) {
  const obj = document.getElementById('words');
  if (isNotNull(obj)) {
    // ---
    obj.focus();

    /* für Internet Explorer */
    if (isNotNull(document.selection)) {
      /* Einfügen des Formatierungscodes */
      let range = document.selection.createRange();
      const insText = range.text;
      range.text = strText;

      /* Anpassen der Cursorposition */
      range = document.selection.createRange();
      if (insText.length === 0) {
        if (walkback) range.move("character", -2);
      } else {
        if (walkback) range.moveStart("character", insText.length);
      }
      range.select();
    } /* für neuere auf Gecko basierende Browser */else if (isNotNull(obj.selectionStart)) {
      /* Einfügen des Formatierungscodes */
      const start = obj.selectionStart;
      const end = obj.selectionEnd;
      const insText = obj.value.substring(start, end);
      obj.value = obj.value.substr(0, start) + strText + obj.value.substr(end);

      /* Anpassen der Cursorposition */
      let pos;
      if (insText.length === 0) pos = start + strText.length;else pos = start + insText.length;
      obj.selectionStart = pos;
      if (walkback) {
        obj.selectionEnd = pos - 2;
      } else {
        obj.selectionEnd = pos;
      }
    } else {
      /* für die übrigen Browser */
      obj.value += strText;
    }
  }
};

/*
Sestzt alle Eingabefelder auf ihren jeweiligen Standardwert
*/
Detailsuche.reset = function (isMainSearch) {
  const checkedCheckboxes = jQuery("#chkdoktyp, input[name=chkGeltZeitInKraft], input[name=chkGeltZeitOffen]");
  const checkboxes = jQuery("#dialogdetailsuche input:checkbox").not(checkedCheckboxes).not(jQuery("#ChkSucheinstellungenBehalten"));
  const inputs = jQuery("#dialogdetailsuche input:text").add("#Words, #Filter");
  const dropdowns = jQuery("#dialogdetailsuche select").not(".ui-datepicker-year");
  const isRememberSearchChecked = jQuery("#ChkSucheinstellungenBehalten").prop("checked");
  if (isMainSearch && isRememberSearchChecked) {
    jQuery("#Words").val("");
  } else {
    checkboxes.each(function (index, checkbox) {
      jQuery(checkbox).prop("checked", false).change();
    });
    inputs.each(function (index, input) {
      jQuery(input).val("").change();
    });
    dropdowns.each(function (index, dropdown) {
      jQuery(dropdown).find("option:first").prop("selected", true).change();
    });
    checkedCheckboxes.each(function (index, checkbox) {
      jQuery(checkbox).prop("checked", true).change();
    });
  }
  $.ajax({
    type: "GET",
    url: "Search/ResetDetailsuche",
    dataType: "text",
    success: function (data) {
      if (data === "True") {
        jQuery("#ChkSucheinstellungenBehalten").prop("checked", true);
      } else {
        jQuery("#ChkSucheinstellungenBehalten").prop("checked", false);
      }
    }
  });
};
Detailsuche.clear = function (target) {
  target.val("");
};
Detailsuche.toggle = function (element, target) {
  const classOffen = "abschnittspfeil-offen";
  const classGeschlossen = "abschnittspfeil-geschlossen";
  const aktClass = element.attr("class") === classOffen ? classGeschlossen : classOffen;
  element.attr("class", aktClass);

  //Es werden nun je nach Zustand der Pfeile (auf- oder zugeklappt) auch andere Texte als Tooltip angezeigt
  const alternativerTitle = element.data("alt-title");
  const aktuellerTitle = element.attr("title");
  element.data("alt-title", aktuellerTitle);
  element.attr("title", alternativerTitle);
  target.toggle();
};
Detailsuche.toggleOnKeypress = function (event, element, target) {
  const e = event || window.event;
  const code = e.keyCode ? e.keyCode : e.which;
  if (code !== 9 && code === 13) {
    Detailsuche.toggle(element, target);
  }
};
Detailsuche.hideSection = function (element, target, img) {
  const imgGeschlossen = "/bilder/PfeilKinderUnten.png";
  if (element.is(":visible")) {
    target.hide();
    img.attr("src", imgGeschlossen);
  }
};

/*
Selektiert alle Checkboxen, wenn keine Checkbox selektiert ist.
Wenn eine Checkbox bereits selektiert ist, wird nichts verändert.
*/
Detailsuche.select = function (element, checkboxes) {
  if (element.prop("checked")) {
    let isCheckboxSelected = false;
    checkboxes.each(function (index, checkbox) {
      if (jQuery(checkbox).prop("checked")) {
        isCheckboxSelected = true;
      }
    });
    if (!isCheckboxSelected) {
      checkboxes.prop("checked", true).change();
    }
  }
};

/*
Deselektiert das Ziel-Element, wenn keine der übergebenen Checkboxen mehr selektiert ist
*/
Detailsuche.deselect = function (checkboxes, target) {
  let disable = true;
  checkboxes.each(function (index, element) {
    const checkbox = jQuery(element);
    if (checkbox.prop("checked")) {
      disable = false;
    }
  });
  if (disable) {
    target.prop("checked", false).change();
  }
};

/*
Deselektiert alle Checkboxen
*/
Detailsuche.deselectAll = function (checkbox, checkboxes) {
  if (checkbox.prop("checked")) {
    checkboxes.prop("checked", false).change();
  }
};
Detailsuche.disable = function (element, target) {
  if (element.prop("checked")) {
    target.prop("disabled", false);
  } else {
    target.prop("disabled", true);
  }
};
Detailsuche.hide = function (element, target) {
  if (element.prop("checked")) {
    target.show();
  } else {
    target.hide();
  }
};
function getDialogOptions() {
  return {
    height: "auto",
    width: "650",
    position: {
      my: "left top",
      at: "left bottom",
      of: $("#SearchFormControl"),
      collision: "none"
    },
    resizable: false,
    draggable: false,
    open: function () {
      $("#dialogdetailsuche input").not("input:hidden").first().focus();
      $('#dialogdetailsuche').parent().css('position', 'fixed');

      // Bei fixiertem Header und geöffneter Detailsuche Hintergrund scrollen blockieren (BON-10274)
      if ($("#HeaderControl").css("position") === "fixed") {
        $("body").css("overflow-y", "hidden");
      }
      window.setTimeout(function () {
        // ein wenig warten und dann die CSS-Klassen für den Button richtig setzen - geht ned anders :-()
        $('#dialogdetailsuche button#submitbtn').removeClass('ui-button ui-corner-all ui-widget').addClass('beck-btn beck-btn-primary beck-btn-sm');
      }, 100);
    },
    close: function () {
      $("body").css("overflow-y", "");
    },
    buttons: [{
      text: "Suchen",
      id: 'submitbtn',
      title: "Suche ausf\u00FChren",
      click: function () {
        jQuery("#FormSuchen").submit();
      }
    }]
  };
}
function init() {
  addSuggestions();
  addDatepicker();
  handlePublikationstypen();
  handleSpezialPublikationstypen();
  handleSubCheckboxes();
  handleUI();
  handleInputs();
  handleBundeslaenderInputs();
  handleGeltungszeitraumInputs();
  handleMainSearch();

  // Fix: Der Dialog erhöt den z-index um eins, nachdem suggest aufgerufen wurde und man in den Dialog klickt, somit ist beim zweiten Aufruf das suggest hinter dem Dialog
  jQuery("#dialogdetailsuche").on("click", function () {
    $("#dialogdetailsuche").parents("div.ui-dialog").css("z-index", "");
  });
  jQuery("#Profisuche").hide();
  if (headingSelected === "True") {
    Detailsuche.toggle($("#profisuche_pfeil"), $("#Profisuche"));
  }
  if ($('#onlyLexiconCheckbox').length) {
    $('#NurLexikon').val($('#onlyLexiconCheckbox').is(':checked'));
  }
  function submit(event) {
    if (event.which == 13) $(this).closest("form").submit();
  }
  jQuery("#FormSuchen").submit(function () {
    if (!validateGeltungsbereich()) {
      return false;
    }

    // BON-9817: Verhindert, dass der Button in der Detailsuche doppelt geklickt wird und eine Fehlermeldung erscheint (nur 1 Suche pro Sekunde)
    $(this).find("button[type=button]").prop("disabled", true);
    search();
    return true;
  });
  jQuery("#dialogdetailsuche input:checkbox").on("keyup", submit);
}
function addSuggestions() {
  const suggests = jQuery("#dialogdetailsuche input:text[suggest]");
  suggests.each(function (index, element) {
    const suggest = jQuery(element);
    const query = suggest.attr("suggest");
    bosuggest.init({
      control: suggest,
      query: query,
      multivalues: true
    });
  });
}
function addDatepicker() {
  const dates = jQuery("#dialogdetailsuche input:text[hasdatepicker]");
  const onClose = function (text) {
    dates.val(text);
  };
  dates.each(function (index, element) {
    const date = jQuery(element);
    const id = date.prop("id");

    // override default config
    const config = $.extend(true, {}, datepickerSettings);
    if (date.attr("datepickerRange")) {
      const range = date.attr("datepickerRange") === "true";
      config.rangeSelection = range;
    }
    BODateControl.initDatePicker(id, config, onClose);
  });
}
function handlePublikationstypen() {
  const checkboxes = jQuery("#Publikationstypen input:checkbox").not("#chkdoktyp");
  jQuery("#chkdoktyp").change(function () {
    if (this.checked) {
      $("#TitelseitensucheAllgemein").hide();
      $("input[name=chkTitelseitenSuche]").prop("checked", false);
      showFeld(jQuery(this).attr("fieldset"));
      checkboxes.each(function (index, checkbox) {
        jQuery(checkbox).prop("checked", false);
      });
    } else {
      const selectedCheckboxes = jQuery("#Publikationstypen input:checkbox:checked");
      if (selectedCheckboxes.length === 0) {
        jQuery("#chkdoktyp").prop("checked", true);
        $("#TitelseitensucheAllgemein").hide();
        $("input[name=chkTitelseitenSuche]").prop("checked", false);
      }
    }
  });
  checkboxes.each(function (index, element) {
    const checkbox = jQuery(element);
    let selectedCheckboxes;
    checkbox.change(function () {
      if (this.checked) {
        jQuery("#chkdoktyp").prop("checked", false);
        selectedCheckboxes = jQuery("#Publikationstypen input:checkbox:checked");
        if (selectedCheckboxes.length > 1) {
          showFeld(jQuery("#chkdoktyp").attr("fieldset"));
        }
      }
      selectedCheckboxes = jQuery("#Publikationstypen input:checkbox:checked");
      if (selectedCheckboxes.length === 0) {
        jQuery("#chkdoktyp").prop("checked", true);
        showFeld(jQuery("#chkdoktyp").attr("fieldset"));
      } else if (selectedCheckboxes.length === 1) {
        showFeld(jQuery(selectedCheckboxes[0]).attr("fieldset"));
      }
      const relevantCBsChecked = relevntCheckBoxesForTitelseitensucheChecked(selectedCheckboxes);
      if (relevantCBsChecked) {
        $("#TitelseitensucheAllgemein").show();
      } else {
        $("#TitelseitensucheAllgemein").hide();
        $("input[name=chkTitelseitenSuche]").prop("checked", false);
      }
    });
  });
}
function relevntCheckBoxesForTitelseitensucheChecked(selectedCheckboxes) {
  let returnVal = false;
  if (selectedCheckboxes.length === 2 && (selectedCheckboxes[0].name === "chkRechtsvor" || selectedCheckboxes[1].name === "chkRechtsvor") && (selectedCheckboxes[0].name === "chkVerw" || selectedCheckboxes[1].name === "chkVerw")) {
    returnVal = true;
  }
  return returnVal;
}
function handleSpezialPublikationstypen() {
  const puplikationen = jQuery("#TxtOpus");
  showSpezialpublikationstyp(puplikationen);
  puplikationen.on("input change focusout keyup", function () {
    showSpezialpublikationstyp(puplikationen);
  });
}

/*
Synchronisiert die Input Elemente mit dem gleichen Namen
*/
function handleInputs() {
  jQuery("#Publikationsfelder input:text").change(function (event) {
    const element = $(event.target);
    const name = element.prop("name");
    const value = element.val();
    $("[name=" + name + "]").prop("value", value);
  });
  jQuery("#Publikationsfelder input:checkbox").change(function (event) {
    const element = $(event.target);
    const name = element.prop("name");
    const value = element.prop("checked");
    const checkboxes = $("[name=" + name + "]").not(element);
    checkboxes.each(function (index, checkbox) {
      jQuery(checkbox).prop("checked", value).triggerHandler("click");
    });
  });
}
function handleSubCheckboxes() {
  $(document).ready(function () {
    const checkboxes = jQuery("[name=chkEU], [name = chkBund], [name=chkLaender], [name=chkGeltZeitDatum]");
    checkboxes.each(function (index, checkbox) {
      jQuery(checkbox).triggerHandler("click");
    });
  });
}
function handleBundeslaenderInputs() {
  const bundeslaender = jQuery("#chkRechtsvorLaender, #chkVertrLaender");
  bundeslaender.each(function (index, land) {
    jQuery(land).change(function () {
      jQuery(land).triggerHandler("click");
    });
  });
}
function handleGeltungszeitraumInputs() {
  const inputs = jQuery("[name=chkGeltZeitDatum]");
  inputs.each(function (index, input) {
    jQuery(input).change(function () {
      jQuery(input).triggerHandler("click");
    });
  });
}

/*
Berücksichtigung der Hauptsuche (Lupe)
*/
function handleMainSearch() {
  jQuery("#form1").submit(function (event) {
    if (isNotNull($("#dialogdetailsuche").dialog("instance")) && $("#dialogdetailsuche").dialog("isOpen")) {
      jQuery("#FormSuchen").submit();
      event.preventDefault();
    }
  });
}
function showSpezialpublikationstyp(publikationen) {
  const spezialpublikationen = jQuery("#Spezialpublikationen fieldset").map(function () {
    return $(this).attr("id");
  }); //["AP", "Adajur", "IMM-DAT", "LSK"];

  const found = isSpezialpublikationstyp(spezialpublikationen, publikationen);
  const selectedPubtyp = jQuery("#Publikationsfelder").children("fieldset").not("fieldset[disabled]").prop("id");
  if (isNotNull(selectedPubtyp)) {
    selectedPublikationstyp = "#" + selectedPubtyp;
  }
  if (found !== "") {
    showFeld("#" + found);
  } else {
    showFeld(selectedPublikationstyp);
  }
}
function isSpezialpublikationstyp(spezialpublikationen, input) {
  let found = "";
  spezialpublikationen.each(function (index, spezialpublikation) {
    const regexp = new RegExp("^" + spezialpublikation + "(?![\\d\\wäüö])", "i");
    if (regexp.test(input.val())) {
      found = spezialpublikation;
      return false;
    }
    return true;
  });
  return found;
}
function showFeld(selectedFieldset) {
  jQuery("#Publikationsfelder " + selectedFieldset).prop("disabled", false).show();
  const fieldsets = jQuery("#Publikationsfelder, #Spezialpublikationen, #Dokumentationsfeld").children("fieldset").not(selectedFieldset);
  jQuery(fieldsets).prop("disabled", true);
  fieldsets.hide();
}
function validateGeltungsbereich() {
  let isValid = false;
  const isRechtsvor = jQuery("#Rechtsvorschriften").is(":visible");
  const isVerw = jQuery("#Verwaltungsvorschriften").is(":visible");
  const validateCheckboxes = jQuery("[name=chkGeltZeitDatum], [name=chkGeltZeitOffen], [name=chkGeltZeitInKraft], [name=chkGeltZeitNichtInKraft], [name=chkGeltZeitAusserKraft]");
  if (isRechtsvor ^ isVerw) {
    validateCheckboxes.each(function (index, checkbox) {
      if (jQuery(checkbox).prop("checked")) {
        isValid = true;
        return false;
      }
      return true;
    });
  } else {
    isValid = true;
  }
  if (!isValid) {
    jQuery("#error_geltungsbereich").show();
  } else {
    jQuery("#error_geltungsbereich").hide();
  }
  return isValid;
}
function search() {
  const words = jQuery("#Words");
  words.val(jQuery("#words").val());
  const fieldsets = jQuery("#dialogdetailsuche fieldset").not("fieldset[disabled]");
  const inputs = fieldsets.find("input:text, input:hidden, select").add("#dialogdetailsuche input:hidden");
  inputs.each(function (index, element) {
    const input = jQuery(element);
    if (input.val() === "") {
      input.prop("disabled", true);
    }
  });
}
function handleUI() {
  const button = document.getElementById('submitbtn');
  button.classList.remove('ui-button');
  button.classList.add('beck-btn');
  button.classList.add('beck-btn-primary');
}
//# sourceMappingURL=Detailsuche.js.map
;
const SearchJob = function ($) {
  const result = {};
  let clickInProgress = false;
  result.ShowDialog = function (element, url, container) {
    if (clickInProgress) return;
    if (!$.trim(container.html()).length) {
      clickInProgress = true;
      const searchJobReadable = $("#SearchJobReadable").val();
      $.ajax({
        url: url,
        type: "GET",
        data: {
          searchJobReadable: searchJobReadable
        },
        success: function (response) {
          container.append(response.html);
          trackMatomoEvent(response.Category, response.Action);
        },
        complete: function () {
          clickInProgress = false;
        }
      });
    }
  };
  result.Focus = function (elem) {
    const obj = $get(elem);
    if (isNotNull(obj)) obj.focus();
  };
  result.Reset = function () {
    const obj0 = $get("SearchJobTitle");
    const obj1 = $get("SearchJobDuration");
    const obj2 = $get("SearchJobNotification");
    const obj3 = $get("Notiz");
    if (isNotNull(obj0) && isNotNull(obj1) && isNotNull(obj2) && isNotNull(obj3)) {
      obj0.value = "";
      obj1.selectedIndex = 2;
      obj2.checked = true;
      obj3.value = "";
    }
  };
  result.refreshMeineSuchauftraege = function () {
    $.ajax({
      type: "POST",
      url: this.attributes.uri.value,
      dataType: "html",
      success: function (data) {
        if (data.length > 0) {
          $("#meineSuchauftraege").replaceWith(data);
        }
      }
    });
  };
  result.submit = function () {
    const $form = $('#suchauftragform');
    $.ajax({
      type: "POST",
      url: $form.attr("action"),
      data: $form.serialize(),
      success: function (data) {
        if (data.Category !== null) {
          trackMatomoEvent(data.Category, data.Action, data.Name);
        }
        if (data.Url !== null) {
          location.href = data.Url;
        }
      }
    });
    return false;
  };
  return result;
}(jQuery);
jQuery(function () {
  const icondate = $("#searchdate .icon");
  const iconsearchterm = $("#searchterm .icon");
  $("#searchdate").click(function () {
    icondate.toggleClass("icon-up-dir icon-down-dir");
    if (!icondate.hasClass("icon-site-color")) {
      icondate.addClass("icon-site-color");
    }
    iconsearchterm.removeClass("icon-site-color");
  });
  $("#searchterm").click(function () {
    iconsearchterm.toggleClass("icon-up-dir icon-down-dir");
    if (!iconsearchterm.hasClass("icon-site-color")) {
      iconsearchterm.addClass("icon-site-color");
    }
    icondate.removeClass("icon-site-color");
  });
});
//# sourceMappingURL=SearchJob.js.map
;
const SearchFormSuggestControl = new function () {
  $(document).ready(function () {
    SearchFormSuggestControl.init('words', 'btsearch1');
  });
}();
SearchFormSuggestControl.init = function (searchFieldControlId, searchButtonControlId) {
  bosuggest.init({
    control: jQuery("#" + searchFieldControlId),
    query: "std",
    minlen: autocompleteHandler.getSuggestionInputMinLen(),
    width: $("#words").width(),
    onselect: function (selectedValue) {
      this.control.val(selectedValue);
      $("#SearchFormControl #" + searchButtonControlId).trigger("click");
    },
    onenter: function () {
      this.control.autocomplete("close");
    }
  });
};
//# sourceMappingURL=SearchFormSuggestControl.js.map
;
(function ($) {
  let waitingforresponse;

  //TODO Toggle Methoden zusammenfassen
  function toggleVorgaenge(element, target) {
    element.toggleClass("widget-offen");
    element.toggleClass("widget-geschlossen");
    target.toggle();
  }
  function addContent(anchor, content) {
    let target;
    const anchorTarget = $(anchor).next("div.datacontainer");
    if (anchorTarget.length === 0) {
      target = makeTargetFor(anchor);
    } else {
      target = anchorTarget;
    }
    target.html(content);
    return target;
  }
  function loadVorgaenge(element, url, target) {
    if (waitingforresponse) return;
    if (!!target.length || target.is(":visible")) {
      toggleVorgaenge(element, target);
    } else {
      this.waitingforresponse = true;
      jQuery.ajax({
        url: url,
        dataType: "html",
        cache: false,
        type: "GET",
        success: function (content) {
          const newTarget = addContent(element, content);
          toggleVorgaenge(element, newTarget);
          waitingforresponse = false;
        },
        error: function () {
          waitingforresponse = false;
        }
      });
    }
  }
  function makeTargetFor(anchor) {
    return $("<div class=\"datacontainer\"></div>").css("display", "none").insertAfter(anchor);
  }
  function onClick() {
    const $this = $(this);
    const url = $this.attr("data-vorgang");
    const target = $this.next("div");
    loadVorgaenge($this, url, target);
    return false;
  }
  $(function () {
    $("[data-vorgang]").on("click", onClick);
  });
})(jQuery);
//# sourceMappingURL=MeineVorgaenge.js.map
;
const PopUpDialog = function ($) {
  function getContainer() {
    const container = $("#PopUpDialog");
    if (container.length) return container;
    const result = $("<div></div>").attr("id", "PopUpDialog");
    let parent = $("#zweispaltencontent");
    if (!parent.length) parent = $("#dreispaltencontent");
    result.prependTo(parent);
    return result;
  }
  return {
    setDialog: function ($dialog) {
      const container = getContainer();
      container.empty();
      container.append($dialog);
    },
    close: function () {
      const container = getContainer();
      container.empty();
    }
  };
}(jQuery);
//# sourceMappingURL=PopUpDialog.js.map
;
const FeedbackDialog = function ($) {
  const result = {};
  result.ShowDialog = function (url) {
    const feedbackDiv = document.getElementById("FeedbackDialog");
    if (feedbackDiv) {
      feedbackDiv.style.display = "flex";
      feedbackDiv.querySelector("#feedback").focus();
      document.getElementById("feedbackdialog-close").addEventListener("click", closeEventFunction);
      window.addEventListener("click", closeEventWindow);
      return;
    }
    const hdUrlElem = document.querySelector("#FeedbackDialog #HdUrl");
    const hdUrlValue = isNull(hdUrlElem) ? null : hdUrlElem.value;
    $.ajax({
      url: url,
      dataType: "html",
      type: "GET",
      data: {
        hdUrl: hdUrlValue
      },
      success: function (content) {
        const div = document.getElementById("bo_center");
        div.insertAdjacentHTML("beforeend", content);
        const feedbackDialogElem = document.getElementById("FeedbackDialog");
        feedbackDialogElem.style.display = "flex";
        feedbackDialogElem.focus();
        document.getElementById("feedbackdialog-close").addEventListener("click", closeEventFunction);
        window.addEventListener("click", closeEventWindow);
        const nameElem = document.querySelector("#FeedbackDialog #name");
        const emailElem = document.querySelector("#FeedbackDialog #email");
        const feedbackElem = document.querySelector("#FeedbackDialog #feedback");
        new BeckInput(nameElem.closest(".beck-input-container"));
        nameElem.addEventListener("change", function () {
          validateInput(nameElem);
        });
        new BeckInput(emailElem.closest(".beck-input-container"));
        emailElem.addEventListener("change", function () {
          validateInput(emailElem);
        });
        new BeckTextarea(feedbackElem, document.querySelector("#FeedbackDialog #feedback_counter"));
        feedbackElem.addEventListener("change", function () {
          validateTextarea(feedbackElem);
        });
      }
    });
  };
  result.Submit = function (url) {
    const categoryValue = document.querySelector("#FeedbackDialog input[name='Kategorie']:checked").value;
    const feedbackElem = document.querySelector("#FeedbackDialog #feedback");
    const nameElem = document.querySelector("#FeedbackDialog #name");
    const emailElem = document.querySelector("#FeedbackDialog #email");
    const feedbackValid = validateTextarea(feedbackElem);
    const nameValid = validateInput(nameElem);
    const emailValid = validateInput(emailElem);
    if (!feedbackValid || !nameValid || !emailValid) {
      return;
    }
    const securityEmail = document.querySelector("#FeedbackDialog #SecurityEmail").value;
    const hdUrl = document.querySelector("#FeedbackDialog #HdUrl").value;
    document.getElementById('feedback-dialog-submit').disabled = true;
    const model = {
      Kategorie: categoryValue,
      Feedback: feedbackElem.value,
      Name: nameElem.value,
      Email: emailElem.value,
      SecurityEmail: securityEmail,
      HdUrl: hdUrl
    };
    const form = $('#feedbackForm');
    const token = $('input[name="__RequestVerificationToken"]', form).val();
    const params = {
      __RequestVerificationToken: token,
      model: model
    };
    $.post(url, params, function (data) {
      if (data.length > 0) {
        document.getElementById("FeedbackDialog").remove();
        document.getElementById("bo_center").insertAdjacentHTML("beforeend", data);
        document.getElementById("FeedbackDialog").style.display = "flex";
        if (document.getElementById("feedback") !== null) document.getElementById("feedback").focus();
        document.getElementById("feedbackdialog-close").addEventListener("click", closeEventFunction);
        window.addEventListener("click", closeEventWindow);
      }
    });
  };
  result.CloseDialog = function () {
    document.getElementById("feedbackdialog-close").removeEventListener("click", closeEventFunction);
    window.removeEventListener("click", closeEventWindow);
    document.getElementById("FeedbackDialog").style.display = "none";
  };
  return result;
}(jQuery);
function closeEventFunction(e) {
  if (isNotNull(e)) e.preventDefault();
  const dlg = document.getElementById("FeedbackDialog");
  if (isNotNull(dlg)) dlg.remove();
}
function closeEventWindow(event) {
  const fd = document.getElementById("FeedbackDialog");
  if (isNotNull(fd)) {
    if (fd.style.display === "flex" && event.target === fd) fd.style.display = "none";
  }
}
function showFeedbackDlg() {
  FeedbackDialog.ShowDialog("/Feedback/FeedbackDialog");
  return false;
}
//# sourceMappingURL=FeedbackDialog.js.map
;
//_____________Variablen Deklarationsbereich_____________

// ~~~Beispiel:~~~
// let init = false
// const columns = 2

//_________________Allgemeine Funktionen_________________

$(document).ready(function () {
  initBeckOGK();
});
$(window).on('hashchange', function () {
  const hashid = location.hash.substring(1);
  openContentListforshow(hashid);
});

//___________Benutzerspezifische Funktionen______________

function openContentListforshow(id) {
  $('ul.collapsible').removeClass('show');
  if (id != "") {
    $('#' + id + ' ul.collapsible').addClass('show');
  }
}
function toggleContentListforshow(id) {
  const parentid = '#' + id + ' ul.collapsible';
  const hasShow = $(parentid).hasClass('show');
  $('ul.collapsible').removeClass('show');
  if (!hasShow) {
    $(parentid).toggleClass('show');
  }
}
function initBeckOGK() {
  $('.collapse').on('click', function (e) {
    parentid = $(this).parents('.ogkteil').attr('id');
    toggleContentListforshow(parentid);
  });
  const hashid = location.hash.substring(1);
  openContentListforshow(hashid);
}
//# sourceMappingURL=BeckOGK.js.map
;
(function (popup, $) {
  function getShowLoaderFunction($element) {
    return function () {
      $element.hide();
      $("<img>").attr("src", "/bilder/loader.gif").attr("class", "document-manager-loader").insertBefore($element);
    };
  }
  function getHideLoaderFunction($element) {
    return function () {
      $element.parent().find(".document-manager-loader").remove();
      $element.show();
    };
  }
  function showDialog(data) {
    const $data = $(data);
    popup.setDialog($data);
    prepareDialog($data);
    $("#isnoteindoc").removeClass("nosee");
  }
  function prepareDialog($dialog) {
    prepareCloseButton($dialog);
    prepareDownloadButtons($dialog);
    preparePermalinkButton($dialog);
    prepareFileManagement($dialog);
  }
  function prepareFileManagement($dialog) {
    const submit = $dialog.find("[name='documentLinkType']");
    submit.button();
    submit.on("click", function () {
      const $form = $(this).closest("form");
      const url = $form.attr("action");
      const values = $form.serializeArray();
      values.push({
        name: this.name,
        value: this.value
      });
      addToFile(url, values, $dialog);
    });

    // Verhindert den Page-Reload nach submit und erm�glicht es die Button-Klick-Events auch an anderer Stelle (bsp: general.tracking.js) zu registrieren
    if (submit.length > 0) {
      $(submit[0].form).on("submit", function () {
        return false;
      });
    }
  }
  function refreshHitlistAndToolArea(data) {
    const markSearchList = $("div#ueberblick");
    if (markSearchList.length) {
      $.ajax({
        url: "/RefreshHitlist",
        datatyp: "html",
        success: function (data) {
          if (data.length <= 0) location.reload(true);
          markSearchList.html(data);
        }
      });
    } else {
      const hitlistDocuments = $("input:checkbox[id^='mark_']");
      $.each(hitlistDocuments, function (index, element) {
        refreshAktenIcon(element, data);
        element.checked = false;
      });
      $("input.markall").removeAttr("checked");
    }
  }
  function refreshAktenIcon(element, data) {
    if (data.isAktuelleAkte && element.checked) {
      const markedId = element.id.replace("mark_", "");
      const akteLinkIcon = $("#zurakte-treffer_" + markedId);
      akteLinkIcon.addClass("icon-disabled");
    }
  }
  function addToFile(url, values, $dialog) {
    removeFeedbackMessages($dialog);
    const $element = $dialog.find("#document-manager-file-management");
    const show = getShowLoaderFunction($element);
    const hide = getHideLoaderFunction($element);
    const hideMarkDocumentLabel = function () {
      $element.find("#markDokumentCount").hide();
    };
    const successFunctions = [hide, addToFileFinished, hideMarkDocumentLabel];
    if ($element.data("refreshhitlistandtoolarea")) {
      successFunctions.push(refreshHitlistAndToolArea);
    }
    show();
    $.ajax({
      type: "POST",
      url: url,
      data: values,
      success: successFunctions,
      error: [hide],
      context: $dialog
    });
  }
  function addToFileFinished(data, status, xhr) {
    if (!data) return;
    const $dialog = this;
    const isError = data.hasOwnProperty("error");
    if (isError) showAddToFileError($dialog, data.error);else {
      const permalink = data.permalink;
      const explanation = data.explanation;
      if (permalink) {
        const note = $dialog.find(".document-manager-permalink-note");
        if (explanation) {
          note.text(explanation);
        }
        note.next("form").replaceWith($("<a>").attr("href", permalink).text(permalink));
      }
      $(data.success).insertAfter($dialog.find(".document-link-types"));
    }
  }
  function showAddToFileError($dialog, message) {
    const error = $("<p>").addClass("add-to-file-error").css("color", "red").text(message);
    showError($dialog, error, ".document-manager-add-to-file-note");
  }
  function removeFeedbackMessages($dialog) {
    removeAddToFileSuccess($dialog);
    removeAddToFileError($dialog);
  }
  function removeAddToFileError($dialog) {
    $dialog.find(".add-to-file-error").remove();
  }
  function removeAddToFileSuccess($dialog) {
    $dialog.find(".document-manager-add-to-file-success").remove();
  }
  function prepareCloseButton($dialog) {
    let closeElements = $dialog.find(".document-manager-close");
    closeElements = closeElements.add("#dokumentManagerSchleier");
    $(closeElements).on("click", function () {
      popup.close();
      return false;
    });
    $dialog.find("button.document-manager-close").button();
  }
  function preparePermalinkButton($dialog) {
    const createPermalink = $dialog.find(".document-manager-create-permalink");
    createPermalink.button();
    createPermalink.on("click", function () {
      const $form = $(this).closest("form");
      const url = $form.attr("action");
      const values = $form.serializeArray();
      fetchPermalink(url, values, $dialog, $form);
      return false;
    });
  }
  function prepareDownloadButtons($dialog) {
    const downloadLinks = $dialog.find(".document-manager-conversion-link");
    downloadLinks.button();
  }
  function fetchPermalink(url, values, $dialog, $loaderTarget) {
    removePermalinkError($dialog);
    const show = getShowLoaderFunction($loaderTarget);
    const hide = getHideLoaderFunction($loaderTarget);
    show();
    $.ajax({
      url: url,
      data: values,
      dataType: "html",
      success: [hide, showPermalink],
      error: [hide],
      context: $dialog
    });
  }
  function isJson(xhr) {
    return xhr.getResponseHeader("Content-Type").indexOf("application/json") >= 0;
  }
  function showPermalinkError($dialog, message) {
    const error = $("<p>").addClass("permalink-error").css("color", "red").text(message);
    showError($dialog, error, ".document-manager-permalink-note");
  }
  function showError($dialog, $error, selector) {
    $error.insertAfter($dialog.find(selector));
  }
  function removePermalinkError($dialog) {
    $dialog.find(".permalink-error").remove();
  }
  function showPermalink(data, status, xhr) {
    const $dialog = this;
    const isError = isJson(xhr);
    if (isError) {
      const jsonResponse = JSON.parse(data);
      showPermalinkError($dialog, jsonResponse.message);
    } else {
      const $permalink = $(data);
      const form = $dialog.find(".document-manager-create-permalink").closest("form");
      form.replaceWith($permalink);
    }
  }
  function loadDialog($anchor) {
    const dialogUri = $anchor.attr("data-dialog-url");
    if (!dialogUri) return false;
    $.ajax({
      url: dialogUri,
      dataType: "html",
      context: $anchor,
      success: showDialog
    });
    return true;
  }
  $(function () {
    $(document).on("click", ".documentmanager-link", function () {
      if (loadDialog($(this))) return false;
      return true;
    });
  });
})(PopUpDialog, jQuery);
$(document).on("click", "#isnoteindoc", function (e) {
  $("div.conversion-format a.document-manager-conversion-link").each(function () {
    const href = $(this).attr("href");
    const index = href.indexOf("&isfootnoteintext");
    if (index === -1) {
      $(this).attr("href", href + "&isfootnoteintext=1");
    } else {
      $(this).attr("href", href.substring(0, index));
    }
  });
});
//# sourceMappingURL=DocumentManager.js.map
;
/*
Diese Klasse regelt die "neuen" Tooltips von BeckOnline
*/
$(function () {
  //Gibt an mit welcher Verzögerung in Millisekunden die Tooltips aufgehen sollen.
  const openDelay = 500;
  const closeDelay = 1500;
  const serviceUrl = "/ShowTooltip";
  const tooltip = new ToolTipHandler(openDelay, closeDelay);
  function getContentFromDataCache(link) {
    const cachedHtml = link.data("tooltip-data");
    if (cachedHtml) {
      return cachedHtml;
    }
    return null;
  }
  function fetchContentFromServer(link, completeCallback) {
    let tooltipLink = link.attr("href");
    if (link.data("overridevpath")) {
      tooltipLink += "&overridevpath=" + link.data("overridevpath");
    }
    const tooltipSource = document.URL;
    const data = {
      ToolTipLink: tooltipLink,
      ToolTipSource: tooltipSource
    };
    $.post(serviceUrl, data, function (result) {
      let tooltipContentHtml = $("<div>").append($.parseHTML(result.html)).html(); // Script Tags entfernen
      tooltipContentHtml = tooltipContentHtml.split("<div class=\"fn\">");
      link.data("tooltip-data", tooltipContentHtml);
      completeCallback(tooltipContentHtml);
      tooltipContentHtml = null;
      if (result.track) {
        trackMatomoEvent(result.matomoCategory, result.matomoAction, result.matomoName);
      }
    });
  }
  function getContentFromTTitle(link) {
    let htmlFromTTitle = link.data("title");
    if (htmlFromTTitle && htmlFromTTitle.length) {
      htmlFromTTitle = htmlFromTTitle.replace(/\n/g, "<br />");
      return htmlFromTTitle;
    }
    return null;
  }
  function getContentFromFussnoten(link) {
    let id = link.attr("href");
    id = id.replace("#", "");
    let targetElement = $('a[name="' + id + '"]').parent();
    if (targetElement.is("dt")) {
      const html = $("p", targetElement.next("dd.fntext")).html();
      targetElement = $("<div/>").append(html);
      $("span.fnback", targetElement).remove();
    } else {
      targetElement = targetElement.first().clone();
    }
    return targetElement.html();
  }
  function getContentFromFussnotenZeitschriftOrGesamtversion(link) {
    let id = link.attr("href");
    id = id.replace("#", "");
    const a = $('a[name="' + id + '"]');
    const dt = a.parent().next();
    const cloned = dt.children(':not(.fnback)').clone();
    cloned.children('.fnback').remove();
    return cloned.html();
  }
  function handleLinkEvent(event, showTooltipCallback) {
    // MouseEnter Event? Zeige Tooltip
    if (event.type === "mouseenter") {
      showTooltipCallback();
      return true;
    }

    // TouchStart Event? Verhindere Tooltip
    if (event.type === "touchstart") {
      $(event.currentTarget).addClass("noToolTip");
      return true;
    }
    return false;
  }
  function registerEvents() {
    // Tooltips für vpath, bcid, reference
    $("div#bo_center, div#verweiszettel-top, div#verweiszettel-bottom, div.search-verweiszettel, div#doktoc").on("mouseenter touchstart", 'a[href*="vpath"]:not([href*=\\&date\\=]), a[href*="bcid"]:not([href*="bcid-prev"]):not([href*="bcid-bezugsnorm"]), a[href*="reference"]', function (e) {
      return handleLinkEvent(e, function () {
        const target = $(e.currentTarget);

        // Daten bereits im Cache?
        const cached = target.data("tooltip-data") && target.data("tooltip-data").length > 0;
        // Dann verwende den Cache ansonsten hole Daten vom Server
        const source = cached ? getContentFromDataCache : fetchContentFromServer;
        tooltip.showTooltip(target, source, e);
      });
    });

    // Tooltip für Links/Elemente mit data-title Attribut.
    $("div#bo_center, div#verweiszettel-top, div#verweiszettel-bottom, div#toolleiste, div.search-verweiszettel, div.search-settings, div.settingsBoxTable, div.rechtespalte").on('mouseenter touchstart', 'a[data-title], span[data-title], i[data-title]', function (e) {
      return handleLinkEvent(e, function () {
        const target = $(e.currentTarget);
        tooltip.showTooltip(target, getContentFromTTitle, e);
      });
    });
    $(document).tooltip({
      items: 'svg[data-title]',
      tooltipClass: "ui-tooltip-content",
      content: function () {
        $('.ui-tooltip').remove();
        return $(this).data('title');
      },
      hide: {
        delay: closeDelay
      }
    });

    // Fussnoten Variante 1
    $('div#bo_center *:not(.fnback):not(sup) > a[href*="#FN"]').on("mouseenter touchstart", function (e) {
      return handleLinkEvent(e, function () {
        const target = $(e.currentTarget);
        const alterTooltip = $("div.ui-tooltip-content a[name^=FN]");
        let istGleicherTooltip = false;
        if (alterTooltip[0]) {
          istGleicherTooltip = alterTooltip[0].name === target.name.replace("FR", "FN");
          const toolTipEventHandler = new OnTooltipInsert();
          toolTipEventHandler.trigger(e);
        }
        if (!istGleicherTooltip) {
          tooltip.showTooltip(target, getContentFromFussnoten, e);
        }
      });
    });

    // Fussnoten Variante 2
    let fussnoteZeitschriftOrGesamtversionSelector = $('div#bo_center sup > a[href*="#FN"]');
    if (fussnoteZeitschriftOrGesamtversionSelector.length < 1) {
      fussnoteZeitschriftOrGesamtversionSelector = $('div#bo_center *:not(.fnback):not(sup) > a[href^="#V-"]');
    }
    fussnoteZeitschriftOrGesamtversionSelector.on("mouseenter touchstart", function (e) {
      return handleLinkEvent(e, function () {
        const target = $(e.currentTarget);
        tooltip.showTooltip(target, getContentFromFussnotenZeitschriftOrGesamtversion, e);
      });
    });

    /*
    Wird gebraucht um die Tooltips wieder zu schließen wenn Teile vom TocTree per Ajax neu geladen werden.
    Ansonsten würde der Tooltip stehen bleiben.
    */
    $(document).on("click", function (e) {
      // Klick außerhalb des Tooltips?
      if ($(e.target).closest(".ui-tooltip").length <= 0) {
        tooltip.destroyAllTooltips();
      }
    });

    // Bei fixiertem Kopfbereich werden Tooltips beim Scrollen innerhalb 700ms ausgeblendet.
    $(document).on("scroll", function () {
      $(".ui-tooltip").fadeOut(700, function () {
        tooltip.destroyAllTooltips();
      });
    });
  }
  registerEvents();
});
//# sourceMappingURL=OpenToolTip.js.map
;
function ToggleOpusToFavourite(opusid, werkPath) {
  // MyFavouritOpusBox aktualisieren
  $.ajax({
    type: "GET",
    url: "/Favourite/GetOpusLinkWithFavouriteIcon",
    data: {
      werkId: opusid,
      werkPath: werkPath
    },
    beforeSend: function () {
      showMyFavouriteLoader($(".favouriteOpusClass_" + opusid));
      showMyFavouriteLoader($("#favouriteOpusId_" + opusid));
      $.each($(".maxElementsReached"), function (index, value) {
        $(this).hide();
      });
    },
    success: function (data) {
      $.each($(".favouriteOpusClass_" + opusid), function (index, value) {
        $(this).html(data);
        if (data.indexOf("maxElementsReached") > 0) {
          //matomo Max Elements
          _paq.push(["trackEvent", "Favoriten", "max favourites reached"]);
        }
      });
      refreshMyFavouritIcon(opusid);
      refreshMyFavourites();
    },
    complete: function () {
      hideMyFavouriteLoader($(".favouriteOpusClass_" + opusid));
      hideMyFavouriteLoader($("#favouriteOpusId_" + opusid));
    }
  });
}
function refreshMyFavouritIcon(opusid) {
  $.ajax({
    type: "GET",
    async: false,
    url: "/Favourite/ToggleFavouriteOpus",
    data: {
      werkId: opusid
    },
    success: function (data) {
      $("#myFavouriteBox").html(data);
    }
  });
}
function refreshMyFavourites() {
  $.ajax({
    type: "GET",
    url: "/Favourite/RefreshMyFavouriteFilterAjax",
    success: function (data) {
      if (data) {
        const $anchor = $("a.myFavouriteFilter");
        const input = $anchor.siblings("input.checkboxFilter");
        if (data.checkboxStatus !== "") {
          input.removeAttr("disabled");
          input.removeAttr("checked");
          if (data.checkboxStatus === "checked") {
            input.prop("checked", "checked");
          }
          if (data.checkboxStatus === "disabled") {
            input.attr("disabled", "true");
          }
        }
        $anchor.attr("href", data.anchorUrl);
      }
    }
  });
}
function showMyFavouriteLoader($elements) {
  $elements.each(function (index, element) {
    $(this).hide();
    const img = $("<img>").attr("src", "/bilder/loader.gif");
    $("<div>").attr("class", "myFavourite-loader").html(img).insertBefore($(this));
  });
}
function hideMyFavouriteLoader($elements) {
  $elements.each(function (index, element) {
    $(this).parent().find(".myFavourite-loader").remove();
    $(this).show();
  });
}
function SetConfigurationMatomo(isConfigActive) {
  // Matomo: Ob ConfigMode Aktiviert wurde.
  if (isConfigActive) _paq.push(["trackEvent", "Favoriten", "activate configuration mode"]);
}
//# sourceMappingURL=MyFavourite.js.map
;
/**
 * jquery.simple-combobox v1.1.26 (2015-11-05): jQuery combobox plugin | (c) 2014-2015 Ilya Kremer
 * MIT license http://www.opensource.org/licenses/mit-license.php
 */
!function (t, e) { "use strict"; function i(t) { return { fast: 200, normal: 400, slow: 600 }[t] || t } function a(t, e, i, a) { if ("function" != typeof i) { var s = t + ("string" == typeof i ? "." + i : "string" == typeof a ? "." + a : ""); e.trigger(s) } else n.call(e, t, i, a); return this } function n(t, e, i) { var a = t + ("string" == typeof i ? "." + i : ""); this.bind(a, e) } function s() { return JSON.parse(this.find(O + A).val() || "[]") } function l() { var e = t(this).find(O + P + " p"), i = t(this).children(O + A), a = []; e.each(function () { var e = t(this), i = e.find(":checkbox"); i.prop("checked") && a.push(e.data("value")) }), t(this).children("select").val(a), i.val(JSON.stringify(a)) } function r(e) { for (var i, a = t(this).find(O + P + " p"), n = t(this).children(O + A), s = [], l = 0; l < a.length; l++) { var r = a.eq(l), o = e.indexOf(r.data("value")); e.indexOf(r.data("value")) >= 0 ? (i = r.find(":checkbox").prop("checked", !0), s.push(e[o])) : r.find(":checkbox").prop("checked", !1) } t(this).children("select").val(e), i && (i.trigger(y + "-chupdate", [!0]), n.val(JSON.stringify(s))) } function o(e) { var i = t(this), a = this.data(y), n = i.children("select"), s = i.children(O + A), l = i.children(O + I), r = n.find("option").filter(function () { return this.value == e }); return l.removeClass(y + L).siblings(O + j).removeClass(y + j + L), r.length ? (i.find(O + P + " p").eq(r[0].index).addClass(y + M).siblings().removeClass(y + M), s.val(e).data("changed", !0), void n.val(e).change()) : (i.find(O + P + " p").removeClass(y + M), n.children().prop("selected", !1), a.invalidAsValue ? (a.highlightInvalid || (a.invalidAsValue ? a.highlightInvalid : null === a.highlightInvalid)) && l.addClass(y + L).siblings(O + j).addClass(y + j + L) : e = "", s.val(e), void l.val(e)) } function d() { if (!this.data("listenersAdded")) { var i = this, a = i.data(y), n = null; this.on("keyup", O + I + ", " + O + T, function (e) { if (!([38, 40, 13, 27, 9, 37, 39, 17, 18, 16, 20, 33, 34, 35, 36].indexOf(e.which) >= 0)) { var i = function (e) { if ((e.ctrlKey || e.shiftKey || 45 != e.which) && (!e.ctrlKey || 65 != e.which)) { var i = a.fullMatch, n = a.highlight; n = i ? n !== !1 : !!n; var s = t(this), l = this.value.trim(); a.filterIgnoreCase && (l = l.toLowerCase()), a.filterIgnoreAccents && String.prototype.latinize && (l = l.latinize()); var r = s.closest(O).children(O + P); m.call(r, "down", !0); var o = s.closest(O).find("select option"); if (t(O + " " + O + P).each(function () { r[0] != this && m.call(t(this), "up") }), !l) return void r.children("p").show().each(function () { t(O + "-marker", this).contents().unwrap() }); var d = a.hideSeparatorsOnSearch ? "p" : "p:not(" + O + N + ", " + O + V + ")"; r.children(d).hide(), o.each(function () { var e = t(this).text().trim(); if (a.filterIgnoreCase && (e = e.toLowerCase()), a.filterIgnoreAccents && String.prototype.latinize && (e = e.latinize()), i ? e.indexOf(l) >= 0 : 0 == e.indexOf(l)) { var s = a.filterIgnoreCase ? "i" : "", d = new RegExp("(" + l.replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1") + ")", i ? s + "g" : s), h = r.children("p:eq(" + o.index(this) + "):not(" + O + N + ", " + O + V + ")").show(); n && h.each(function () { t(O + "-marker", this).contents().unwrap(); var e = t(O + F, this)[0]; e.innerHTML = e.innerHTML.replace(d, '<span class="' + y + '-marker">$1</span>') }) } }) } }, s = this, l = a.filterDelay; l ? (clearTimeout(n), n = setTimeout(function () { i.call(s, e) }, l)) : i.call(s, e) } }), this.on("keydown", O + I, function (e) { if ([38, 40, 13, 27, 9].indexOf(e.which) >= 0) { 9 != e.which && e.preventDefault(); var i, n, s = t(this).closest(O), l = s.children(O + P), r = t(O + M, l[0]), o = t("p:first", l[0]), d = a.loopScrolling, h = ":not(" + O + N + "):not(" + O + V + ")", c = "default" == a.mode ? a.fillOnArrowPress : !1; if (!l.is(":animated")) { var p = this.value.trim(); p = a.filterIgnoreCase ? p.toLowerCase() : p; var f = l.scrollTop(); if (40 == e.which) { if (l.is(":hidden")) return void m.call(l, "down"); if (0 == r.length) i = o.is(":visible" + h) ? o.addClass(y + M) : o.nextAll(":visible" + h).first().addClass(y + M); else { if (!d && !r.nextAll(":visible" + h).first().length) return; i = r.removeClass(y + M).nextAll(":visible" + h).first().addClass(y + M), 0 == i.length && (i = o.is(":visible") ? o.addClass(y + M) : o.nextAll(":visible" + h).first().addClass(y + M)), 0 == i.length && (i = o), n = i.position().top - l.position().top; var u = i.outerHeight(); n + 6 * u > l.height() ? n + 6 * u - l.height() > 1.5 * u ? l.scrollTop(f + n) : l.scrollTop(f + u) : 0 > n && l.scrollTop(f - -n) } c && (this.value = i.find(O + F).text(), s.children(O + I).data("fillonarrow", !0)) } else if (38 == e.which) { if (l.is(":visible")) { if (!d && !r.prevAll(":visible" + h).first().length) return; i = r.removeClass(y + M).prevAll(":visible" + h).first().addClass(y + M), 0 == i.length && (i = t("p:visible" + h + ":last", l[0]).addClass(y + M)), n = i.position().top - l.position().top, u = i.outerHeight(), 3 * u > n ? l.scrollTop(f - -n - 3 * u) : n > l.height() - 3 * u && l.scrollTop(f + n - 3 * u), c && (this.value = i.find(O + F).text(), s.children(O + I).data("fillonarrow", !0)) } } else if (13 == e.which) { if (a.fillOnBlur) return void w(l).click(); l.children(O + M).click(), "default" == a.mode && m.call(l, "up") } else if (27 == e.which) { a.blurOnEscape ? t(this).blur() : t(this); l.is(":visible") && (m.call(l, "up"), e.stopPropagation()) } else if (9 == e.which && a.fillOnTab && p) { var v = l.children(O + M); v.length && v.click() } } } }), this.on("change", "select", function (e, i) { var a = t(this).closest(O), n = t("option:selected", this).text(); a.children(O + I).val(n).data("value", n); var s = a.children(O + A); return s.data("changed") ? void s.data("changed", !1) : i ? (l.call(a), void s.change()) : (s.change(), void m.call(a.children(O + P), "up")) }), this.on(y + "-chupdate", O + P + " p :checkbox", function (e, i) { i && (e.stopPropagation(), x.call(t(this).parent(), e, !0)) }), this.on("click", O + P + " p", function (e) { if (clearTimeout(k), e.stopPropagation(), !t(this).is(O + N + ", " + O + V)) { i.children(O + L).removeClass(y + L), i.children(O + j).removeClass(y + j + L); var a = t(this), n = a.parent(), s = n.children(), l = s.index(this); if ("checkboxes" == i.data(y).mode) return void x.call(this, e); var r = n.closest(O).children("select"); r.children("option").eq(l).prop("selected", !0), r.siblings(O + A).val(r.val()), r.change(), m.call(a.parent(), "up"), a.addClass(y + M).siblings().removeClass(y + M) } }), this.on("blur", O + I, function (n) { var s = t(this), l = t(n.relatedTarget).closest(O); if (!(l.length > 0 && l[0] === s.closest(O)[0])) { k = setTimeout(function () { var a = t(this); i.data(y); this === e.activeElement && a.data("silentfocus", !0), a.data("fillonarrow", !1), m.call(a.closest(O).children(O + P), "up") }.bind(this), 200); var r = s.val().trim(), o = s.siblings(O + A), d = o.val(); if (r) { var h; s.siblings("select").find("option").each(function () { a.filterIgnoreCase ? r.toLowerCase() == t(this).text().trim().toLowerCase() && (h = this.value) : r == t(this).text().trim() && (h = this.value) }), h ? o.val(h) : o.val(a.invalidAsValue ? r : "") } else o.val(""); d !== o.val() && o.change().data("changed", !0) } }), this.on("focus", O + I, function () { if (t(this).data("silentfocus")) return void t(this).data("silentfocus", !1); if (this.value.trim()) { if (i.data(y).expandOnFocusWithValue || t(this).data("expandfocus")) if (i[y]("val")) { var e = i.children(O + P); e.children().show(), m.call(e, "down") } else t(this).keyup() } else (i.data(y).expandOnFocus || t(this).data("expandfocus")) && t(this).keyup(); t(this).data("expandfocus", !1) }), this.on("click", O + I + "-div", function () { i.data(y).disabled || m.call(t(this).siblings(O + P), "down") }), this.on("click", O + I, function (e) { var i = t(this).closest(O)[0]; t(O).each(function () { this != i && t(this)[y]("close") }), e.stopPropagation() }), this.on("click", O + z, function (e) { clearTimeout(k); var i = t(this), a = i.closest(O), n = a.children(O + P); n.is(":visible") ? (m.call(n, "up"), a.children(O + I).data("silentfocus", !0).focus()) : a.children(O + I).data("expandfocus", !0).focus() }), this.on("click", O + S, function (e) { clearTimeout(k), e.stopPropagation(); var n = t(this), s = n.parent(), l = i.children(O + P); l.children("p").eq(n.data("index")).find(":checkbox").prop("checked", !1), s.fadeOut(a.animation.duration), n.closest(O).children("select").trigger("change", [!0]) }), a.autoLoad != t.noop && t(O + P, this).scroll(function () { var e = t(this), n = i.children("select"), s = e.scrollTop(), l = 50; s > e.data("scrollTop") ? this.scrollHeight - s - l < e.height() && (i.data("pending") || (i.data("pending", !0), a.autoLoad.call(i, n.find("option[value]:last").val(), "bottom"))) : s < e.height() / 2 && (i.data("pending") || (i.data("pending", !0), a.autoLoad.call(i, n.find("option[value]:first").val(), "top"))), e.data("scrollTop", s) }).data("scrollTop", 0), t(e).bind("click." + y, { thisIs: this }, function (e) { m.call(t(e.data.thisIs).children(O + P), "up") }), this.data("listenersAdded", !0) } } function h(e) { if ("string" == typeof e && (e = t.parseJSON(e), null == e)) return []; if (!e) return !1; if (!(e instanceof Array)) { if ("object" != typeof e) return !1; "undefined" == typeof e.length && (e.length = Object.keys(e).length), e = [].slice.call(e) } return e } function c(t) { for (var e = 0; e < t.length; e++)t[e].value && t[e].text || t[e].hasOwnProperty("separator") || t.splice(e, 1) } function p(e) { for (var i = 0; i < e.length; i++)e[i].value || t(e[i]).hasClass(y + N) || "optgroup" == e[i].tagName.toLowerCase() || t(e[i]).remove() } function f(t, e) { var i = t.text.trim().toLowerCase(), a = e.text.trim().toLowerCase(); return i > a ? 1 : i == a ? 0 : -1 } function u(t) { for (var e = 0; e < t.length; e++)for (var i = e + 1; i < t.length; i++)t[e] && t[i] && t[e].value == t[i].value && t.splice(e, 1) } function v(e) { for (var i = 0; i < e.length; i++)for (var a = i + 1; a < e.length; a++)e[i] && e[a] && e[i].value == e[a].value && "optgroup" != e[i].tagName.toLowerCase() && t(e[i]).remove() } function g() { var e, i = this.children(O + I), a = this.children("select"), n = this.data(y), s = i.val().trim(); s = n.filterIgnoreCase ? s.toLowerCase() : s, a.find("option").each(function () { var i = t(this).text().trim(); i = n.filterIgnoreCase ? i.toLowerCase() : i, i == s && (e = this.value) }); var l = !e && s; l ? (n.forbidInvalid ? i.closest(O).find(O + I).val("").data("value", "") : (n.highlightInvalid || (n.invalidAsValue ? n.highlightInvalid : null === n.highlightInvalid)) && i.addClass(y + L).siblings(O + j).addClass(y + j + L), n.invalidAsValue || i.siblings("select, " + O + A).val("")) : i.removeClass(y + L).siblings(O + j).removeClass(y + j + L) } function m(e, i) { if (!this.is(":animated") && this.length && ("up" != e || !this.is(":hidden") || 1 != this.length)) { var a = this.parent().data(y).animation; t.easing[a.easing] || (console.warn("no such easing: " + a.easing), a.easing = "swing"); var n = this.parent(), s = n.data(y); "up" == e ? (s.beforeClose.call(n), a.complete = function () { "checkboxes" != s.mode && g.call(n), s.afterClose.call(n) }, this.slideUp(a).data("p-clicked-index", -1), n.children(O + z).removeClass(y + z + "-up")) : (s.beforeOpen.call(n), a.complete = function () { s.afterOpen.call(n) }, this.slideDown(a), n.children(O + z).addClass(y + z + "-up"), n.find(O + M).removeClass(y + M), t(O + "-marker", n).contents().unwrap(), n.children(O + P).children("p").show()); var l = n.children(O + I); l.each(function () { var a = t(this); if (a.data("fillonarrow") && !i && a.data("fillonarrow", !1).val(a.data("value")), "down" == e) { var l = this.value.trim(); s.filterIgnoreCase && (l = l.toLowerCase()); var r = n.find("select option"); r.each(function () { var e = t(this).text().trim(); return s.filterIgnoreCase && (e = e.toLowerCase()), e == l ? (n.children(O + P).children("p:eq(" + r.index(this) + "):not(" + O + N + ", " + O + V + ")").first().addClass(y + M), !1) : void 0 }) } }) } } function x(e, a) { var n = t(this), s = n.closest(O), l = n.parent(), r = l.children("p"), o = r.index(this), d = i(l.parent().data(y).animation.duration); if (!a) { var h = n.find(":checkbox"); t(e.target).is(":checkbox") || h.prop("checked", !h.prop("checked")); var c = h.prop("checked"); if (e.shiftKey && l.data("p-clicked-index") >= 0) for (var p = l.data("p-clicked-index"), f = o > p ? p : o, u = o > p ? o : p, v = f; u >= v; v++)t(r[v]).find(":checkbox").prop("checked", c) } var g = s.find(O + q).prepend("<span />"); s.find(O + q).fadeOut(d / 5, function () { g.empty().show(), r.each(function (e) { var i = t(this); i.find(":checkbox").prop("checked") && g.append(t("<div />").addClass(y + D).append(t("<div />").addClass(y + D + "-text").text(i.find(O + F).text())).append(t("<div />").addClass(y + S).text("×").data("index", e)).fadeIn(1.5 * d).attr("title", i.attr("title"))) }), g.append('<div style="clear: both" />') }), l.data("p-clicked-index", o), n.closest(O).children("select").trigger("change", [!0]) } function b(e, i) { for (var a = this.data(y), n = this.find("select"), s = this.find(O + P), l = 0; l < e.length; l++) { if (e[l].hasOwnProperty("separator")) { if (e[l].hasOwnProperty("header")) r = t('<p class="' + y + V + '" />').text(e[l].header); else var r = t('<p class="' + y + N + '" />'); var o = t("<option />") } else o = t("<option />").val(e[l].value).text(e[l].text).prop("selected", !!e[l].selected), r = a.pFillFunc.call(this, e[l], a), "checkboxes" == a.mode && r.prepend('<input type="checkbox" />'); r.data("value", e[l].value), i ? (n.prepend(o), s.prepend(r)) : (n.append(o), s.append(r)) } } function w(t) { var e = t.children(O + M + ":visible"); return 0 == e.length && (e = t.children(":visible:first")), e } function C(t) { if (null == t) return null; for (var e = Object.keys(t), i = 0; i < e.length; i++) { var a = e[i].replace(/-([a-z])/g, function (t) { return t[1].toUpperCase() }); e[i] != a && (t[a] = t[e[i]], delete t[e[i]]), "object" == typeof t[a] && "data" != a && C(t[a]) } return t } var k, y = "scombobox", O = "." + y, I = "-display", A = "-value", L = "-invalid", T = I + "-div", D = T + "-item", S = D + "-remove", q = T + "-holder", P = "-list", F = "-mainspan", M = "-hovered", N = "-separator", V = "-header", j = "-dropdown-background", z = "-dropdown-arrow", H = "-disabled", $ = "-required", E = parseInt, J = { init: function () { var e = this.find(O + P), i = this.find("select"), a = this.find(O + j), n = this.find(O + z), s = this.data(y); if (this.addClass(y), 0 == i.length && this.append(t("<select />")), this.attr("id") && i.removeAttr("id"), i.attr("multiple") && (this.data(y).mode = "checkboxes"), 0 == a.length && this.append('<div class="' + y + j + '" />'), 0 == n.length && this.append('<div class="' + y + z + '" />'), J.displayDropdown.call(this, s.showDropDown), "checkboxes" != s.mode && 0 == this.find(O + I).length) { var l = t('<input class="' + y + I + '" type="text" />'); l.attr("title", i.attr("title")), l.attr("placeholder", s.placeholder), this.append(l), this.height(+l.css("font-size") + +l.css("padding-top") + +l.css("padding-bottom")) } if (null != s.tabindex && this.find(O + I).attr("tabindex", s.tabindex), 0 == this.find(O + A).length && this.append('<input class="' + y + A + '" type="hidden" />'), (this.find(O + I).is(":disabled") || s.disabled) && this.find(O + j + ", " + O + z).hide(), s.disabled && (this.find(O + I).prop("disabled", !0), this.addClass(y + H)), (i.attr("required") || s.required) && (this.find(O + I).prop("required", "required"), this.addClass(y + $)), 0 == e.length && this.append(e = t('<div class="' + y + P + '"></div>')), "checkboxes" == s.mode) { this.addClass(y + "-checkboxes"), this.find(O + I).remove(); var r = this.find(O + I + "-div"); 0 == r.length && (r = this.append('<div class="' + y + T + '"><div class="' + y + q + '" /></div>')), r.attr("title", i.attr("title")), e.insertAfter(this.find(O + I + "-div")); var o = this.find(O + q), h = t('<div class="' + y + D + '" id="' + y + '-test-item"><div class="' + y + D + '-text">x</div></div>'); o.append(h.css("margin-left", "-9999px").show()); var c = h.height() + E(h.css("padding-top")) + E(h.css("padding-top")) + E(h.css("margin-top")) + E(h.css("margin-top")) + E(h.css("border-top-width")) + E(h.css("border-top-width")) + E(o.css("padding-top")) + E(o.css("padding-top")); this.find(O + I + "-div").css("min-height", c + "px"), h.remove() } else this.find(O + "-display-div").remove(), e.insertAfter(this.find(O + I)); return e.css({ "max-width": s.listMaxWidth, "max-height": s.maxHeight }), 1 == s.wrap && e.css("white-space", "normal"), s.autoLoad != t.noop && (s.loopScrolling = !1), d.call(this), this.data(y + "-init", !0), J.fill.call(this, s.data) }, fill: function (e, i) { var a = this.find("select").children("option, optgroup"), n = this.find("." + y + P), s = this.find("select"); e = h(e); var l = this.data(y), r = l.mode; if (e ? (l.removeDuplicates && u(e), c(e), l.sort && (e.sort(f), l.sortAsc || e.reverse()), i || (s.empty(), n.empty(), this.children(O + A + ", " + O + I).val("")), b.call(this, e, 2 == i)) : (l.removeDuplicates && (v(a), p(a), a = this.find("select").children("option, optgroup")), 0 == a.length || a.each(function () { var e = t(this), i = t("<p />"); if (i.attr("title", e.attr("title")), e.hasClass(y + N)) e.hasClass(y + V) ? n.append(i.addClass(y + V).text(e.text())) : i.addClass(y + N); else { if ("optgroup" == this.tagName.toLowerCase()) { var a = e.attr("label"), s = t("option", this); return e.before("<option />"), e.after(s), e.remove(), n.append(a ? i.addClass(y + V).text(a) : i.addClass(y + N)), void s.each(function () { n.append(t("<p />").attr("title", this.title).append(t('<span class="' + y + F + '" />').text(t(this).text())).data("value", this.value)) }) } i.append(t('<span class="' + y + F + '" />').text(e.text())).data("value", this.value), "checkboxes" == r && i.prepend('<input type="checkbox" />') } n.append(i) })), this.data(y + "-init") && (l.callback.func.apply(this, l.callback.args), this.data(y + "-init", !1)), a = this.find("select").children("option"), !l.empty) if ("checkboxes" != r) this[y]("val", a.filter("option:selected:last").val()); else { var o = a.filter(":selected").map(function () { return t(this).val() }).get(); this[y]("val", o) } return this }, clear: function () { return this.children("select").empty(), this.children(O + P).empty().width(""), this.children(O + I).removeClass(y + L), this.children(O + j).removeClass(y + j + L), this }, data: function (t) { return 0 == arguments.length ? this.data(y).data : (this.data(y).data = t, this) }, disabled: function (t) { var e = this.data(y).mode; return 0 == arguments.length ? "checkboxes" == e ? this.hasClass(y + H) : this.children(O + I).prop("disabled") : (t = !!t, this.children(O + I).prop("disabled", t), t ? (this.addClass(y + H), this.children(O + j + ", " + O + z).hide()) : (this.removeClass(y + H), this.children(O + j + ", " + O + z).show()), this) }, tabindex: function (t) { var e = this.find(O + I); return 0 == arguments.length ? e.attr("tabindex") : (e.attr("tabindex", t), this) }, options: function (e) { return 0 == arguments.length ? this.data(y) : (t.extend(!0, this.data(y), C(e)), this) }, val: function (t) { var e = this.data(y), i = e.mode; if (0 == arguments.length) { if ("default" == i) var a = this.find(O + A).val(); return "default" == i ? this.find(O + I).is(":disabled") ? "" : a : "checkboxes" == i ? s.call(this) : null } return "default" == i ? o.call(this, t) : "checkboxes" == i && r.call(this, t), this }, open: function () { return m.call(this.children(O + P), "down"), this }, close: function () { return m.call(this.children(O + P), "up"), this }, change: function (t, e) { return a.call(this, "change", this.children(O + A), t, e) }, focus: function (t, e) { return a.call(this, "focus", this.children(O + I), t, e) }, blur: function (t, e) { return a.call(this, "blur", this.children(O + I), t, e) }, keyup: function (t, e) { return a.call(this, "keyup", this.children(O + I), t, e) }, keydown: function (t, e) { return a.call(this, "keydown", this.children(O + I), t, e) }, keypress: function (t, e) { return a.call(this, "keypress", this.children(O + I), t, e) }, click: function (t, e) { return a.call(this, "click", this.children(O + I), t, e) }, mousedown: function (t, e) { return a.call(this, "mousedown", this.children(O + I), t, e) }, clickDropdown: function (t, e) { return a.call(this, "click", this.children(O + z), t, e) }, toSelect: function () { var t = this.children("select").insertAfter(this); return this.data(y).reassignId && t.attr("id", this.attr("id")), this.remove(), t }, displayDropdown: function (t) { return arguments.length ? t ? this.children(O + z + ", " + O + j).show() : this.children(O + z + ", " + O + j).hide() : this.data(y).showDropdown ? this.children(O + z + ", " + O + j).show() : this.children(O + z + ", " + O + j).hide(), this }, placeholder: function (t) { var e = this.children(O + I); return arguments.length ? (e.attr("placeholder", t), this) : e.attr("placeholder") } }; t.fn[y] = function (e) { if ("string" == typeof e) { this.length || t.error("Calling " + y + "." + e + "() method on empty collection"), null == this.data(y + "-init") && t.error("Calling " + y + "." + e + "() method prior to initialization"); var i = J[e]; i || t.error("No such method: " + e + " in jQuery." + y + "()") } else { if (!(["object", "undefined"].indexOf(typeof e) >= 0)) return t.error("Incorrect usage"), this; var a = t.extend(!0, {}, t.fn[y].defaults, C(e)) } return i ? i.apply(this, Array.prototype.slice.call(arguments, 1)) : this.each(function () { var e = t(this); e.parent().hasClass(y) || (e.is("select") && (e.wrap("<div />"), a.reassignId && e.parent().attr("id", e.attr("id")), e = e.parent()), e.data(y, t.extend(!0, {}, a)), J.init.apply(e)) }) }, t.fn[y].defaults = { data: null, empty: !1, required: !1, disabled: !1, sort: !0, sortAsc: !0, removeDuplicates: !0, fullMatch: !1, highlight: null, filterIgnoreCase: !0, filterIgnoreAccents: !1, filterDelay: 0, hideSeparatorsOnSearch: !1, expandOnFocus: !0, expandOnFocusWithValue: !0, tabindex: null, forbidInvalid: !1, invalidAsValue: !1, highlightInvalid: null, reassignId: !0, mode: "default", pMarkup: '<span class="' + y + F + '">${text}</span> <span>${additional}</span>', pFillFunc: function (e, i) { return t("<p />").html(i.pMarkup.replace("${text}", e.text).replace("${additional}", e.additional ? e.additional : "")) }, animation: { duration: "fast", easing: "swing" }, listMaxWidth: window.screen.width / 2, wrap: !0, maxHeight: "", fillOnArrowPress: !0, fillOnBlur: !1, blurOnEscape: !1, fillOnTab: !0, showDropDown: !0, callback: { func: t.noop, args: [] }, beforeOpen: t.noop, beforeClose: t.noop, afterOpen: t.noop, afterClose: t.noop, autoLoad: t.noop, loopScrolling: !0, placeholder: "" }, t.fn[y].extendDefaults = function (e) { t.extend(!0, t.fn[y].defaults, e) } }(jQuery, document);;
//_____________Variablen Deklarationsbereich_____________

// ~~~Beispiel:~~~
// let init = false
// const columns = 2

//_________________Allgemeine Funktionen_________________
// ~~~Beispiel:~~~
/* $(document).ready(function () {

})*/
//___________Benutzerspezifische Funktionen______________

function manageAktenListeChange(selectedAktenId) {
  $.ajax({
    type: "POST",
    url: "/AktenAuswahl/CreateAktenAuswahlAjax",
    dataType: "html",
    data: {
      idAkte: selectedAktenId
    },
    success: function (data) {
      if (data) {
        if (data.length > 0) {
          $("#currentfile").replaceWith(data);
        }
      }
      updateZurAkteButton();
    }
  });
}
function auswahlUebernehmen(event, aktenId) {
  const e = event || window.event;
  const selectedAkteElement = $(e.target);
  const currentAkteElement = $("#aktuelleAkteText");
  const detailLinkElement = $(".aktenAuswahlDetailLink a.aktenauswahlLink");
  const detailUrl = selectedAkteElement.data("url");
  const detailLinkVisible = typeof detailUrl == "string" && detailUrl.length > 0;
  const clickedAktenText = selectedAkteElement.text();
  const prefix = currentAkteElement.data("prefix");
  const displayAkteText = prefix + clickedAktenText;
  toggleAktenAuswahl();
  $.ajax({
    type: "POST",
    url: "/AktenAuswahl/AktenAuswahlUebernehmenAjax",
    dataType: "html",
    data: {
      aktenId: aktenId
    }
  });
  currentAkteElement.text(displayAkteText);
  currentAkteElement.attr("title", displayAkteText);
  detailLinkElement.attr("href", detailUrl);
  detailLinkElement.attr("title", displayAkteText);
  setDetailLinkVisibility(detailLinkVisible);
  toggleVerwaltungLinkTopLineCssClass(detailLinkVisible === false);
  setIconsStateInHitlist(aktenId);
  if ($("select[name='akte']").length) {
    $("select[name='akte'] option").removeAttr('selected');
    $("select[name='akte'] option[value=" + aktenId + "]").prop('selected', 'selected');
    $("select[name='akte'] option[value=" + aktenId + "]").click();
    updateZurAkteButton();
  }
  return false;
}
function toogleTabIndex() {
  const $first = $("#currentfile").children()[0];
  const $elemente = $(".aktenauswahlLink");
  for (let i = 0; i < $elemente.length; i++) {
    const $element = $elemente[i];
    const index = $element.tabIndex;
    if ($element !== $first && isNotNull(index)) {
      if (index === 0) $element.tabIndex = -1;else if (index === -1) $element.tabIndex = 0;
    }
  }
}
function toggleAktenAuswahl() {
  $("#aktenAuswahl").toggleClass("out-of-viewport");
  toogleTabIndex();
}
function hideAktenAuswahl() {
  $("#aktenAuswahl").addClass("out-of-viewport");
}
function setDetailLinkVisibility(visible) {
  $(".aktenAuswahlDetailLink").toggle(visible);
}
function toggleVerwaltungLinkTopLineCssClass(visible) {
  $(".aktenAuswahlVerwaltungLink").toggleClass("topLine", visible);
}
(function ($) {
  $(function () {
    const url = $(".aktenAuswahlDetailLink a.aktenauswahlLink").attr("href");
    const detailLinkVisible = typeof url == "string" && url.length > 0;
    setDetailLinkVisibility(detailLinkVisible);
    toggleVerwaltungLinkTopLineCssClass(detailLinkVisible === false);
    $(document).on("click", function (e) {
      // Check if cursor is not inside our dropdown
      if (!$(e.target).closest("#currentfile").length) {
        hideAktenAuswahl();
      }
    });
  });
})(jQuery);
function matomoAkteFilterTracking() {
  _paq.push(["trackEvent", "Akten", "Filter: im Einzeldokumentbezug"]);
}
function matomoAkteHistorieTabTracking() {
  _paq.push(["trackEvent", "Akten", "Tab: Historie"]);
}
function setIconsStateInHitlist(fileId) {
  if (isNull(document.getElementById("trefferliste"))) {
    return;
  }
  const fileSelected = fileId && /[1-9]+/.test(fileId);
  fetchDocumentsInFile(fileSelected).done(function (documentsInCurrentFile) {
    updateHitlistIcons(fileSelected, documentsInCurrentFile);
  });
}
function fetchDocumentsInFile(fileSelected) {
  const deferred = $.Deferred();
  if (!fileSelected) {
    // return empty array
    deferred.resolve([]);
  } else {
    // disable while fetching from server
    const icons = $("#trefferliste .icon-dokumentmanager");
    icons.each(function (i, elem) {
      showLoaderForHitlist($(elem));
    });
    $.getJSON("/Search/HitlistDocumentGetDocsInFile", function (data) {
      icons.each(function (i, elem) {
        hideLoaderForHitlist($(elem));
      });

      // return object
      deferred.resolve(data);
    });
  }
  return deferred.promise();
}

/** @param {boolean} fileSelected @param {string[]} documentsInCurrentFile */
function updateHitlistIcons(fileSelected, documentsInCurrentFile) {
  const idPrefix = "zurakte-treffer_";
  const links = document.querySelectorAll("#trefferliste .icon-dokumentmanager[id^='" + idPrefix + "']");
  const linkCssClass = "icon icon-dokumentmanager noToolTip treffer-funktion-icon";
  const disableCssClass = "icon icon-dokumentmanager noToolTip treffer-funktion-icon icon-disabled";
  links.forEach(function (link) {
    let onClick = "return false;";
    let cssClass = disableCssClass;
    let title = BO.config.hitlist.file.tooltips.noFileSelected;
    if (fileSelected) {
      const vpath = link.getAttribute("data-vpath");
      const isDocumentInFile = documentsInCurrentFile.indexOf(vpath) >= 0;
      title = BO.config.hitlist.file.tooltips.alreadyExist;
      if (!isDocumentInFile) {
        onClick = "trefferZurAkteHinzufuegen('" + link.id.substring(idPrefix.length) + "'); return false;";
        cssClass = linkCssClass;
        title = BO.config.hitlist.file.tooltips.addToFile;
      }
    }
    link.setAttribute("onClick", onClick);
    link.setAttribute("class", cssClass);
    link.setAttribute("title", title);
    link.parentElement.setAttribute("title", title);
  });
}
function OpenPopUpDialogToSelectAkteForDelete(akteId) {
  $.ajax({
    type: "POST",
    dataType: "html",
    url: "/PopUpDialogDeleteAkte",
    data: {
      id: akteId
    },
    success: function (data) {
      $("#akteDeleteDialog").empty();
      $("#akteDeleteDialog").removeClass("noscriptAkteDelete");
      $("#akteDeleteDialog").html(data);
    }
  });
}
//# sourceMappingURL=AktenAuswahl.js.map
;
$(document).ready(function () {
  $("input.checkboxFilter").click(function (e) {
    const url = $(this).data("url");
    if (url) window.location = url;
  });
});
//# sourceMappingURL=MyBoCheckBox.js.map
;
(function ($) {
  "use strict";

  const foldedCssClass = "folded";
  const dataIconFoldedAttribute = "icon-folded";
  const dataIconUnFoldedAttribute = "icon-unfolded";
  const toggleIcon = function (icon, folded) {
    const $icon = $(icon);
    const foldedIcon = $icon.data(dataIconFoldedAttribute) || "icon-right-open";
    const unfoldedIcon = $icon.data(dataIconUnFoldedAttribute) || "icon-down-open";
    if (typeof folded === 'undefined') {
      folded = $icon.hasClass(foldedIcon);
      folded = !folded;
    }
    if ($icon.hasClass("clickflag")) {
      $icon.toggleClass(foldedIcon, folded);
      $icon.toggleClass(unfoldedIcon, !folded);
    } else {
      $icon.addClass("clickflag");
    }
  };
  const fold = function (event) {
    const $element = $(event.currentTarget);
    const $parentMenu = $element.closest("li.foldable");
    const $target = $parentMenu.next("li.foldable-target");
    if ($target) {
      $target.toggleClass(foldedCssClass);
      $parentMenu.toggleClass(foldedCssClass);
      const $icon = $parentMenu.find("i");
      toggleIcon($icon);
    }
    return false;
  };
  $(function () {
    $(document).on("click", "div.search-verweiszettel li.foldable .trigger", fold);
  });
})(jQuery);
//# sourceMappingURL=search-verweiszettel.js.map
;
const MOBILE_RESOLUTION = 1023;
function isMobile() {
  return window.matchMedia("(max-width:" + MOBILE_RESOLUTION + "px)").matches;
}
function rechteSpalteBoBox(activeBoxId) {
  $(".jsShow").removeClass('jsShow');
  $(".noJsDisabled").removeClass('noJsDisabled');
  $(".withoutJSOpenBox").removeClass('withoutJSOpenBox');
  const icon = $("#toolleiste #toolleiste-indicatoriconwrapper i");
  const boxTeilenId = "viewTeilen";
  const boxAnsichtId = "viewAnsicht";
  const boxAkteId = "viewAkte";
  const boxExportId = "viewExport";
  const boxAnmerkungId = "viewAnnotation";
  const boxSieheAuchId = "viewVerweiszettel";
  const boxExportHitlistId = "viewExporthitlist";
  const boxAkteHitlistId = "viewAktehitlist";
  const boxKeywordId = "keywordcloud";
  const boxSearchId = "viewSearch";
  const boxSettingId = "viewSetting";
  const url = window.location.href;
  let boxActiveId = activeBoxId;
  const boxUnsetId = "unset";
  const togglePassword = document.querySelector('#togglePassword');
  if (isNotNull(togglePassword)) {
    togglePassword.addEventListener('click', function (e) {
      togglePasswordViewModus(this);
    });
  }
  if (!$(".bo-box").length) {
    return;
  }
  if (!boxActiveId.length || boxActiveId === boxUnsetId) {
    if (includes(url, "/Search?")) {
      boxActiveId = boxSearchId;
      handleIndicatorMovements(boxActiveId);
    } else if (includes(url, "/Dokumentenliste")) {
      closeBoxList($("div.bo-box"));
      moveIndicatorToDocListIcon(isMobile() ? "91.5px" : "113.5px");
      boxActiveId = boxUnsetId;
    } else {
      boxActiveId = boxSieheAuchId;
      handleIndicatorMovements(boxActiveId);
    }
  } else {
    handleIndicatorMovements(activeBoxId);
  }
  $("#toolleiste .toolleiste-icon #emailIcon i:nth-child(2)").click(function () {
    boxActiveId = boxTeilenId;
    handleIndicatorMovements(boxActiveId);
    return false;
  });
  function handleIndicatorMovements(boxActiveId) {
    let position = "1.5px";
    $("div.toolleiste-icon a i").removeClass("activebox");
    switch (boxActiveId) {
      case boxExportId:
        position = isMobile() ? "31.5px" : "38.5px";
        moveIndicatorToExportIcon(position);
        $("div.printmanagericon a i").addClass("activebox");
        break;
      case boxTeilenId:
        position = isMobile() ? "61.5px" : "75.5px";
        moveIndicatorToShareIcon(position);
        $("div#emailIcon a i").addClass("activebox");
        break;
      case boxAkteId:
        position = isMobile() ? "91.5px" : "113.5px";
        moveIndicatorToAktenmanagerIcon(position);
        $("div.toolleiste-icon a.documentmanager-link i").addClass("activebox");
        break;
      case boxAnmerkungId:
        position = isMobile() ? "121.5px" : "148.5px";
        moveIndicatorToAnmerkungenIcon(position);
        $("div#anmerkungicon a i").addClass("activebox");
        break;
      case boxAkteHitlistId:
        position = isMobile() ? "61.5px" : "75.5px";
        moveIndicatorToAktenmanagerIcon(position);
        $("div.toolleiste-icon a.documentmanager-link i").addClass("activebox");
        break;
      case boxUnsetId:
        closeBoxList($("div.bo-box"));
        if (includes(url, "/Dokumentenliste")) {
          moveIndicatorToDocListIcon(isMobile() ? "91.5px" : "113.5px");
        } else {
          moveIndicatorToAnsichtIcon("1.5px");
        }
        break;
      default:
        icon.css("left", position);
    }
  }
  $("#toolleiste .toolleiste-icon #emailIcon .icon-envelope-open-o, #toolleiste .toolleiste-icon .icon-share").click(function () {
    boxActiveId = boxTeilenId;
    handleIndicatorMovements(boxActiveId);
    scrollToBoxPosition(boxActiveId);
  });
  function openBoxList(boxListToOpen) {
    $.each(boxListToOpen, function () {
      $(toDivIdSelector(this)).find(".content").toggleClass("hidden", false);
      $(toDivIdSelector(this)).find("i.icon-down-dir").toggleClass("hidden", true);
      $(toDivIdSelector(this)).find("i.icon-up-dir").toggleClass("hidden", false);
    });
  }

  // Funktion um bei einem Click auf ein Toolleistensymbol zur sich öffnenden Box automatisch zu scrollen (Bedingung: Kopfleiste fixiert und Scrollposition > 0)
  function scrollToBoxPosition(divboxActiveId) {
    let settingsBoxTable = $(toDivIdSelector(boxSettingId)).find(".settingsBoxTable");
    let settingsBoxTablerowiconfixed;
    let settingsBoxTablerowicon;
    let icount = 0;
    if (settingsBoxTable.length == 0) {
      settingsBoxTable = $("div.search-settings"); // Aufgrund der Inkonsistenz des HTML zwischen der rechten Spalte der Trefferlist und des Dokuments, muss bei nicht gefundener .settingsBoxTable dieses HTML Element genommen werden
    }
    const settingsBoxTablerow = settingsBoxTable.find(".row");
    const settingsBoxRowText = settingsBoxTablerow.find(".column.text");
    settingsBoxTablerowicon = settingsBoxTablerow.find(".column.action");
    for (icount; icount < settingsBoxTablerow.length; icount++) {
      if (settingsBoxRowText.length != 0) {
        if (settingsBoxTablerowicon.length == 0) {
          settingsBoxTablerowicon = settingsBoxTablerow.find(".column.action.settingsIcon"); // Aufgrund der Inkonsistenz des HTML zwischen der rechten Spalte der Trefferlist und des Dokuments, muss dieses HTML Element genommen werden
        }
        settingsBoxTablerowiconfixed = settingsBoxTablerowicon[icount].children[0].children[0];
        break;
      }
    }
    if (isNotNull(settingsBoxTablerowiconfixed) && settingsBoxTablerowiconfixed.className.indexOf("icon icon-toggle-on") != -1 && window.scrollY != 0) {
      // Internet Explorer 6-11
      const isIE = false || !!document.documentMode;
      // Safari 3.0+
      const isSafari = /constructor/i.test(window.HTMLElement) || function (p) {
        return p.toString() === "[object SafariRemoteNotification]";
      }(!window['safari'] || typeof safari !== 'undefined' && safari.pushNotification);
      // Edge 20+
      const isEdge = !isIE && !!window.StyleMedia;
      if (isIE || isSafari || isEdge) {
        $(toDivIdSelector(divboxActiveId))[0].scrollIntoView(false);
      } else {
        $(toDivIdSelector(divboxActiveId))[0].scrollIntoView({
          block: "end",
          inline: "nearest",
          behavior: 'smooth'
        });
      }
    }
  }
  function moveIndicatorToDocListIcon(position) {
    icon.attr("class", "icon-site-color icon-up-dir documentlistactive");
    icon.css("left", position);
  }
  function closeBoxList(boxListToClose) {
    boxListToClose.find(".content").toggleClass("hidden", true);
    boxListToClose.find("i.icon-down-dir").toggleClass("hidden", false);
    boxListToClose.find("i.icon-up-dir").toggleClass("hidden", true);
  }
  function moveIndicatorToShareIcon(position) {
    closeBoxList($("div.bo-box").not($(toDivIdSelector(boxTeilenId))));
    openBoxList([boxTeilenId]);
    icon.attr("class", "icon-site-color icon-up-dir teileniconactive");
    icon.css("left", position);
    adjustableColumns.showRightColumnIfHidden();
  }
  $("#toolleiste .toolleiste-icon .icon-file-text-o").click(function () {
    boxActiveId = boxSieheAuchId;
    moveIndicatorToAnsichtIcon("1.5px");
    $("div.toolleiste-icon a i").removeClass("activebox");
    $("div#standardansichticon a i").addClass("activebox");
    scrollToBoxPosition(boxActiveId);
    return false;
  });
  function moveIndicatorToAnsichtIcon(position) {
    closeBoxList($("div.bo-box").not($(toDivIdSelector(boxSieheAuchId))).not($(toDivIdSelector(boxAnsichtId))));
    openBoxList([boxSieheAuchId, boxAnsichtId]);
    icon.attr("class", "icon-site-color icon-up-dir ansichticonactive");
    icon.css("left", position);
    adjustableColumns.showRightColumnIfHidden();
  }
  $("#toolleiste .toolleiste-icon .printmanagericon, #toolleiste .toolleiste-icon .icon-print, #hitlist-header .icon-print").click(function () {
    boxActiveId = boxExportId;
    handleIndicatorMovements(boxActiveId);
    if (boxActiveId.length === 0) {
      boxActiveId = boxExportHitlistId;
    }
    scrollToBoxPosition(boxActiveId);
    return false;
  });
  function moveIndicatorToExportIcon(position) {
    closeBoxList($("div.bo-box").not($(toDivIdSelector(boxAnsichtId))).not($(toDivIdSelector(boxExportId))).not($(toDivIdSelector(boxExportHitlistId))));
    openBoxList([boxAnsichtId, boxExportId, boxExportHitlistId]);
    icon.attr("class", "icon-site-color icon-up-dir exporticonactive");
    icon.css("left", position);
    adjustableColumns.showRightColumnIfHidden();
  }
  $("#toolleiste .toolleiste-icon .icon-dokumentmanager, #hitlist-header .icon-dokumentmanager").click(function () {
    if (includes(url, "/Search?") || includes(url, "/AngeseheneDokumente") || includes(url, "/Dokumentenliste") || includes(url, "/Annotated") || includes(url, "/Rechtsprechung") || includes(url, "/Verwaltungsvorschriften") || includes(url, "/SonstigeRechtsquellen")) {
      boxActiveId = boxAkteHitlistId;
    } else {
      boxActiveId = boxAkteId;
    }
    handleIndicatorMovements(boxActiveId);
    if (boxActiveId.length === 0) {
      boxActiveId = boxAkteHitlistId;
    }
    scrollToBoxPosition(boxActiveId);
    return false;
  });
  function moveIndicatorToAktenmanagerIcon(position) {
    closeBoxList($("div.bo-box").not($(toDivIdSelector(boxAkteId))).not($(toDivIdSelector(boxAkteHitlistId))));
    openBoxList([boxAkteId, boxAkteHitlistId]);
    if (includes(url, "/Search?") || includes(url, "/AngeseheneDokumente") || includes(url, "/Dokumentenliste") || includes(url, "/Annotated") || includes(url, "/Rechtsprechung") || includes(url, "/Verwaltungsvorschriften") || includes(url, "/SonstigeRechtsquellen")) {
      icon.attr("class", "icon-site-color icon-up-dir docmanagericonactivehitlist");
      icon.css("left", position);
    } else {
      icon.attr("class", "icon-site-color icon-up-dir docmanagericonactivedokumentansicht");
      icon.css("left", position);
    }
    adjustableColumns.showRightColumnIfHidden();
  }
  $("#toolleiste .toolleiste-icon .icon-edit").click(function () {
    boxActiveId = boxAnmerkungId;
    handleIndicatorMovements(boxActiveId);
    scrollToBoxPosition(boxActiveId);
    return false;
  });
  function moveIndicatorToAnmerkungenIcon(position) {
    closeBoxList($("div.bo-box").not($(toDivIdSelector(boxAnmerkungId))));
    openBoxList([boxAnmerkungId]);
    icon.attr("class", "icon-site-color icon-up-dir editiconactive");
    icon.css("left", position);
    adjustableColumns.showRightColumnIfHidden();
  }
  $("#toolleiste .toolleiste-icon .icon-list-alt").click(function () {
    boxActiveId = "standardAnsichtBeiHitlist";
    $("div.toolleiste-icon a i").removeClass("activebox");
    $("div#standardansichticon a i").addClass("activebox");
    moveIndicatorToStandardansichtIcon("1.5px");
    scrollToBoxPosition(boxKeywordId);
    return false;
  });
  function moveIndicatorToStandardansichtIcon(position) {
    closeBoxList($("div.bo-box").not($(toDivIdSelector(boxKeywordId))).not($(toDivIdSelector(boxSearchId))));
    openBoxList([boxKeywordId, boxSearchId]);
    icon.attr("class", "icon-site-color icon-up-dir ansichticonactive");
    icon.css("left", position);
    adjustableColumns.showRightColumnIfHidden();
  }
  $("#toolleiste .toolleiste-icon .icon-dokument-markieren").on("click", function () {
    moveIndicatorToDokumentMarkierenIcon();
  });
  $("#toolleiste .toolleiste-icon .icon-dokument-markiert").on("click", function () {
    moveIndicatorToDokumentMarkierenIcon();
  });
  $(window).on("resize", function () {
    handleIndicatorMovements(boxActiveId);
  });
  function moveIndicatorToDokumentMarkierenIcon() {
    icon.attr("class", "icon-site-color icon-up-dir markdocumenticonactivedokumentansicht");
  }
  function toDivIdSelector(id) {
    return "div#" + id;
  }
}

//Extra Funktion, da includes() von jQuery nicht vom IE unterstützt wird...
function includes(container, value) {
  let returnValue = false;
  const pos = container.indexOf(value);
  if (pos >= 0) {
    returnValue = true;
  }
  return returnValue;
}
function refreshDokumentenlisteIcon(isFromHitlistParam) {
  isFromHitlistParam = isFromHitlistParam || false;
  $.ajax({
    type: "POST",
    url: "/Toolleiste/RefreshDokumentenlisteIcon",
    data: {
      isfromhitlist: isFromHitlistParam
    },
    dataType: "html",
    success: function (data) {
      if (data) {
        if (data.length > 0) {
          $("#dokumentenlisteicon").replaceWith(data);
        }
      }
    }
  });
}
//# sourceMappingURL=RechteSpalteBoBox.js.map
;
//_____________Variablen Deklarationsbereich_____________

// ~~~Beispiel:~~~
// let init = false
// const columns = 2

//_________________Allgemeine Funktionen_________________

jQuery(function () {
  $(".archive-doku").addClass("nosee");
});

//___________Benutzerspezifische Funktionen______________

function AddMarkedDocumentsToFile(element) {
  const $this = $(element);
  const $form = $this.closest("form");
  const messageContainer = $(".add-to-file-message-container");
  const url = $form.attr("action");
  const values = $form.serializeArray();
  const toFileIcons = $('.documentmanager-link');
  const show = getShowLoaderFunction($this);
  const hide = getHideLoaderFunction($this);
  const doReload = includes(element.formAction, "Dokumentenliste");
  $.ajax({
    type: "POST",
    url: url,
    data: values,
    beforeSend: function () {
      messageContainer.empty();
      show();
      toFileIcons.each(function (i, elem) {
        showLoaderForHitlist($(elem));
      });
    },
    success: function (data) {
      toFileIcons.each(function (i, elem) {
        hideLoaderForHitlist($(elem));
      });
      const eltToFind = $("a.icon-dokumentmanager");
      $("input[id^='mark_']:checked").parent().parent().find(eltToFind).each(function (index, child) {
        $(child).toggleClass("icon-disabled", true);
        child.attributes.onclick.value = "";
      });
      refreshHitlistAndToolArea(doReload);
      hide();
      showAddFileSuccess(data);
      trackMatomoEvent(data.matomoCategory, data.matomoAction);
    },
    error: function () {
      toFileIcons.each(function (i, elem) {
        hideLoaderForHitlist($(elem));
      });
      hide();
    }
  });
}
function addFile(element) {
  const $form = $(element).closest("form");
  const $target = $(".AddbuttonsContainer");
  const messageContainer = $(".add-to-file-message-container");
  const url = $form.attr("action");
  const values = $form.serializeArray();
  messageContainer.empty();
  addToFile(url, values, $(element), $target);
}
function getPermalink(element) {
  const $form = $(element).closest("form");
  const $target = $(".archive-doku");
  const messageContainer = $(".add-to-file-message-container");
  const url = $form.attr("action");
  const values = $form.serializeArray();
  messageContainer.empty();
  fetchPermalink(url, values, $(element), $target);
}
function fetchPermalink(url, values, $element, $loaderTarget) {
  const show = getShowLoaderFunction($loaderTarget);
  const hide = getHideLoaderFunction($loaderTarget);
  show();
  $.ajax({
    url: url,
    data: values,
    dataType: "html",
    success: [hide, showPermalink],
    error: [hide],
    context: $element
  });
}
function addToFile(url, values, $element, $loaderTarget) {
  const show = getShowLoaderFunction($loaderTarget);
  const hide = getHideLoaderFunction($loaderTarget);
  show();
  $.ajax({
    type: "POST",
    url: url,
    data: values,
    success: [hide, showAddFileSuccess],
    error: [hide],
    context: $element
  });
}
function refreshHitlistAndToolArea(doReload) {
  if (doReload) {
    const markSearchList = $("div#ueberblick");
    if (markSearchList.length) {
      $.ajax({
        url: "/RefreshHitlist",
        datatyp: "html",
        success: function (data) {
          if (data.length <= 0) location.reload(true);
          markSearchList.html(data);
          showMarkDocumentCheckboxes();
          updateZurAkteButton();
        }
      });
    }
  } else {
    const hitlistDocuments = $("input:checkbox[id^='mark_']");
    $.each(hitlistDocuments, function (index, element) {
      element.checked = false;
    });
    $("input.markall").removeAttr("checked");
    updateZurAkteButton();
  }
}
function updateZurAkteButton() {
  const regexGuidEmpty = /^[0-]+$/;
  const isNoAkte = regexGuidEmpty.test($("select[name='akte'] option:selected").val());
  const markedCheckboxCount = $("input:checkbox[id^='mark_']:checked").length;
  $("#markierteDokumeneAnzahl").text(markedCheckboxCount);
  if (markedCheckboxCount > 0) {
    if (!isNoAkte) {
      $(".rechtespalte .aktenmanager-container .AddbuttonsContainer button[value='HitlistLinks']").prop("disabled", false);
    } else {
      $(".rechtespalte .aktenmanager-container .AddbuttonsContainer button[value='HitlistLinks']").prop("disabled", true);
    }
    const messageContainer = $(".add-to-file-message-container");
    messageContainer.empty();
  } else {
    $(".rechtespalte .aktenmanager-container .AddbuttonsContainer button[value='HitlistLinks']").prop("disabled", true);
  }
  $(".rechtespalte .aktenmanager-container .AddbuttonsContainer button[value='Permalink']").prop("disabled", isNoAkte);
  $(".rechtespalte .aktenmanager-container .AddbuttonsContainer button[value='BcidLink']").prop("disabled", isNoAkte);
}
function showPermalink(data, status, xhr) {
  const $target = $(".archive-doku");
  const $icon = $(".aktenverwaltung-link button.link").prev("i");
  const isError = isJson(xhr);
  if (isError) {
    const jsonResponse = JSON.parse(data);
    showPermalinkError($target, jsonResponse.message);
  } else if (data == "") {
    showPermalinkError($target, "Es konnten keine Daten empfangen werden");
  } else {
    const $permalink = $(data);
    const $permalinkContainer = $target.find(".permalink");
    $permalink.prependTo($permalinkContainer);
    $icon.toggleClass("icon-down-open icon-right-open");
  }
}
function showAddFileSuccess(data) {
  const $target = $(".aktenmanager-container .add-to-file-message-container");
  $target.empty();
  const isError = data.hasOwnProperty("error");
  if (isError) {
    showAddToFileError($target, data.error);
  } else {
    const $success = $(data.success);
    const $successContainer = $target;
    $success.prependTo($successContainer);
  }
}
function getShowLoaderFunction($target) {
  return function () {
    $target.addClass("nosee");
    $("<img>").attr("src", "/bilder/loader.gif").attr("class", "akten-manager-loader").insertBefore($target);
  };
}
function getHideLoaderFunction($target) {
  return function () {
    $target.parent().find(".akten-manager-loader").remove();
    $target.removeClass("nosee");
  };
}
function isJson(xhr) {
  return xhr.getResponseHeader("Content-Type").indexOf("application/json") >= 0;
}
function showPermalinkError($target, message) {
  const error = $("<p>").addClass("permalink-error").css("color", "red").text(message);
  showError($target, error);
}
function showAddToFileError($target, message) {
  const error = $("<p>").addClass("add-to-file-error").css("color", "red").text(message);
  showError($target, error);
}
function showError($target, $error) {
  $target.empty();
  $error.prependTo($target);
}
//# sourceMappingURL=bo.aktenmanager.js.map
;
AJAX_REDIRECT_STATUS_CODE = 278;
function handleAjaxRedirect(xhr) {
  const redirectUrl = xhr.getResponseHeader("Location");
  if (xhr.status !== AJAX_REDIRECT_STATUS_CODE) {
    return;
  }
  if (!redirectUrl) {
    return;
  }
  window.location.assign(redirectUrl);
}
AjaxRedirectStatusCodeHandler = {
  [AJAX_REDIRECT_STATUS_CODE]: (_, __, xhr) => handleAjaxRedirect(xhr)
};
//# sourceMappingURL=ajaxRedirect.js.map
;
//_____________Variablen Deklarationsbereich_____________

let _spinnerAnsichtBox = null;
$(function () {
  _spinnerAnsichtBox = new SpinnerHandler();
});

//_________________Allgemeine Funktionen_________________

$(document).ready(function () {
  $("input#ansichtbox_selection_CurrentDoc").prop("checked", true);
  const url = window.location.href;
  let activeboxid;
  if (includes(url, "/Search?")) {
    activeboxid = "keywordcloud";
  } else if (includes(url, "/Dokumentenliste")) {
    activeboxid = "unset";
  } else {
    activeboxid = "viewVerweiszettel";
  }
  rechteSpalteBoBox(activeboxid);
});
$(document).on("input", "div#ansichtoptionabschnitt input, div#ansichtoptionrandnummer input", function () {
  toggleAnsichtOptionBereichButton();
  showAnsichtOptionBereichRadioButton();
});
$(document).on("click", "input#ansichtbox_selection_CurrentDoc", function () {
  const link = $('#dokgesamtansichtlink').prop('href');
  if (link) {
    location.href = link;
  } else {
    location.reload();
  }
  return false;
});
$(document).on("click", "input#ansichtbox_selection_ParentChapter", function () {
  if ($("input#ansichtbox_doc_type").val() === "norm") {
    showAbschnittNorm("2");
  } else if ($("input#ansichtbox_doc_type").val() === "buecher") {
    showParentSectionBook();
  }
});
$(document).on("click", "input#ansichtbox_selection_CurrentChapter", function () {
  if ($("input#ansichtbox_doc_type").val() === "norm") {
    showAbschnittNorm("1");
  } else if ($("input#ansichtbox_doc_type").val() === "buecher") {
    showCurrentSectionBook();
  }
});
$(document).on("click", "div#ansichtoptionabschnitt a#typeabschnittbutton", function () {
  $("input#typeabschnitt").prop("checked", true);
  showParagraph();
  return false;
});
$(document).on("click", "div#ansichtoptionrandnummer a#typeabschnittbutton", function () {
  $("input#ansichtbox_selection_randnummer").prop("checked", true);
  showRandnummern();
  return false;
});
$(document).on("click", "input#ansichtbox_selection_CompeleteLaw", function () {
  if ($("input#ansichtbox_doc_type").val() === "norm") {
    showGesamtVersionNorm();
  }
  return false;
});
$(document).on("click", "input#ansichtbox_selection_AllDoc", function () {
  if ($("input#ansichtbox_doc_type").val() === "fach") {
    showGesamtVersionFach();
  }
  return false;
});
$(document).on("click", "ul.VerfuegbareGesamtversionen li", function () {
  const link = $(this).find("a");
  link.attr('id', "selected");
  const url = $(link).attr('href');
  versgesversion(url);
  $(link).removeAttr('id');
  return false;
});

//___________Benutzerspezifische Funktionen______________

jQuery(function ModifyRechteSpalteInGesamtansicht() {
  const url = document.URL;
  if (includes(url, "Gesamtversion")) {
    $("input#ansichtbox_selection_CompeleteLaw").prop("checked", true);
    if ($("input#docvpath").val().length > 0) {
      refreshToolleisteForEinzeldokumentansicht(false);
      refreshPrintExportManager("CompeleteLaw", true, false, null, null);
    }
  }
});

//Extra Funktion, da includes() von jQuery nicht vom IE unterstützt wird...
function includes(container, value) {
  let returnValue = false;
  const pos = container.indexOf(value);
  if (pos >= 0) {
    returnValue = true;
  }
  return returnValue;
}
function toggleHighlighting(sender) {
  const $icon = $(".action i", $(sender).closest(".ansichtoption"));
  if (isDisabled($icon)) return false;
  showProgress($icon);
  $.post(BO.config.ansichtSettings.highlightUrl, function (result) {
    const visible = result.highlighting;
    setupHighlighting(visible);

    // flip icon state
    $icon.toggleClass(BO.config.ansichtSettings.iconToggleOn, visible);
    $icon.toggleClass(BO.config.ansichtSettings.iconToggleOff, !visible);
    trackMatomoEvent(result.category, result.action);

    // Beim Aktivieren des Highlighting wird die Seite neu geladen, daher muss der
    // Progress nicht mehr ausgeblendet werden
    if (visible) return;
    hideProgress($icon);
  });
  return false;
}
function setupHighlighting(enabled) {
  if (enabled) {
    window.location.reload(true);
  } else {
    $("span.highlight").contents().unwrap();
  }
}
function toggleAnsichtOptionBereichButton() {
  if ($('div.ansichtoption div.section input:first-of-type').val() !== "" && $('div.ansichtoption div.section input:last-of-type').val() !== "") {
    $('a#typeabschnittbutton').toggleClass("beck-btn-disabled", false);
  } else {
    $('a#typeabschnittbutton').toggleClass("beck-btn-disabled", true);
  }
}
function showAnsichtOptionBereichRadioButton() {
  $("div.ansichtoption-label input[name='ansichttype']").prop("checked", true);
}
function showDokumentAnsicht(data) {
  if ($("input#ansichtbox_doc_type").val() === "fach" || $("input#ansichtbox_doc_type").val() === "buecher") {
    refreshPrintExportManager("CurrentDoc", false, true, null, null);
  } else {
    refreshPrintExportManager("CurrentLaw", false, false, null, null);
  }
  $("div#bo_center").html(data.aktuellDocMiddleStr);
  $("div#bo_left_content").html(data.aktuellDocTocStr);
  initJSForDocument();
  refreshToolleisteForEinzeldokumentansicht(true);
  $("#viewAnsicht").toggleClass("hidden", false);
  $("#viewVerweiszettel").toggleClass("hidden", false);
  $("#viewTeilen").toggleClass("hidden", false);
  $("#viewAktel").toggleClass("hidden", false);
  $("#viewAnnotation").toggleClass("hidden", false);
}
function showAbschnittNorm(typeAbschnitt) {
  $.ajax({
    type: "POST",
    url: "/DACore/ShowAbschnitt/",
    data: {
      docVPath: $("input#docvpath").val(),
      abschnittType: typeAbschnitt
    },
    beforeSend: function () {
      showProgressAnsicht();
    },
    complete: function () {
      hideProgressAnsicht();
    },
    statusCode: {
      ...AjaxRedirectStatusCodeHandler
    },
    success: function (data) {
      if (!data) return;
      if (data.err) {
        showError(data);
      }
      if (typeAbschnitt === "1") {
        refreshPrintExportManager("CurrentChapter", true, false, null, null);
      }
      if (typeAbschnitt === "2") {
        refreshPrintExportManager("ParentChapter", true, false, null, null);
      }
      displayAbschnittNorm(data);
    }
  });
}
function displayAbschnittNorm(data) {
  $("div#bo_center").html(data);
  refreshToolleisteForEinzeldokumentansicht(false);
  initJSForDocument();
}
function showParagraph() {
  showAnsichtOptionBereichRadioButton();
  if (checkBereich(true)) {
    $.ajax({
      type: "POST",
      url: "/DACore/ShowAbschnitt/",
      data: {
        docVPath: $("input#docvpath").val(),
        vonVal: $('div#ansichtoptionabschnitt div.section input:first-of-type').val(),
        bisVal: $('div#ansichtoptionabschnitt div.section input:last-of-type').val()
      },
      beforeSend: function () {
        showProgressAnsicht();
      },
      complete: function () {
        hideProgressAnsicht();
      },
      statusCode: {
        ...AjaxRedirectStatusCodeHandler
      },
      success: function (data) {
        if (!data) return;
        if (data.err) {
          showError(data);
        }
        $("input#typeabschnitt").prop("checked", true);
        refreshPrintExportManager("SelectedParagraphRangeInDoc", true, false, $('div#ansichtoptionabschnitt div.section input:first-of-type').val(), $('div#ansichtoptionabschnitt div.section input:last-of-type').val());
        displayAbschnittNorm(data);
      }
    });
  }
  return false;
}
function displayAbschnittBook(data) {
  $("div#bo_center").html(data);
  refreshToolleisteForEinzeldokumentansicht(false);
  initJSForDocument();
}
function showRandnummern() {
  showAnsichtOptionBereichRadioButton();
  if (checkBereich(false)) {
    $.ajax({
      type: "POST",
      url: "/DACore/ShowRandnummernbereich/",
      data: {
        docVPath: $("input#docvpath").val(),
        vonVal: $('div#ansichtoptionrandnummer div.section input#ansichtbox_selection_von').val(),
        bisVal: $('div#ansichtoptionrandnummer div.section input#ansichtbox_selection_bis').val()
      },
      beforeSend: function () {
        showProgressAnsicht();
      },
      complete: function () {
        hideProgressAnsicht();
      },
      statusCode: {
        ...AjaxRedirectStatusCodeHandler
      },
      success: function (data) {
        if (!data) return;
        if (data.err) {
          showError(data);
        }
        if (data.errormessage !== null && data.errormessage.length > 0) {
          const errormsg = data.errormessage.toLowerCase();
          showRandnummernbereichErrorMessageBasedOnAjaxResult(errormsg);
          return;
        }
        if (data.gesetz !== null && data.gesetz.length > 0) {
          $("input#typeabschnitt").prop("checked", true);
          refreshPrintExportManager("SelectedBorderNumbersInDoc", true, true, $("div#ansichtoptionrandnummer div.section input#ansichtbox_selection_von").val(), $("div#ansichtoptionrandnummer div.section input#ansichtbox_selection_bis").val());
          displayAbschnittBook(data.gesetz);
        }
      }
    });
  }
  return false;
}
function showCurrentSectionBook() {
  $.ajax({
    type: "POST",
    url: "/DACore/ShowCurrentSection/",
    data: {
      docVPath: $("input#docvpath").val()
    },
    beforeSend: function () {
      showProgressAnsicht();
    },
    complete: function () {
      hideProgressAnsicht();
    },
    statusCode: {
      ...AjaxRedirectStatusCodeHandler
    },
    success: function (data) {
      if (!data) return;
      if (data.err) {
        showError(data);
      }
      if (data.gesetz !== null && data.gesetz.length > 0) {
        refreshPrintExportManager("CurrentChapter", true, true, null, null);
        displayAbschnittBook(data.gesetz);
      }
    }
  });
}
function showParentSectionBook() {
  $.ajax({
    type: "POST",
    url: "/DACore/ShowParentSection/",
    data: {
      docVPath: $("input#docvpath").val()
    },
    beforeSend: function () {
      showProgressAnsicht();
    },
    complete: function () {
      hideProgressAnsicht();
    },
    success: function (data) {
      if (!data) return;
      if (data.err) {
        showError(data);
      }
      if (data.gesetz !== null && data.gesetz.length > 0) {
        refreshPrintExportManager("ParentChapter", true, true, null, null);
        displayAbschnittBook(data.gesetz);
      }
    }
  });
}
function isValidNumberCharInput(input) {
  // Regex to match the pattern: 1-4 digits followed by a single character from a to z
  const pattern = /^\d{1,5}[a-z]$/;
  return pattern.test(input);
}
function isCharBigger(inputVon, inputBis) {
  const charVon = inputVon.slice(-1);
  const charBis = inputBis.slice(-1);
  return charBis > charVon;
}
function checkBereich(rdn) {
  const paragrafInputVon = $("div.ansichtoption div.section input#ansichtbox_selection_von").val();
  const paragrafInputBis = $("div.ansichtoption div.section input#ansichtbox_selection_bis").val();
  const $divErrorMsg = $("div.ansichtoption div.ansichtoptionerrorlabel");
  const errormsgs = $divErrorMsg.find("p");
  for (let i = 0; i < errormsgs.length; i++) {
    hideBereichErrorMessage(errormsgs[i]);
  }
  const isDecimal = $.isNumeric(paragrafInputVon) && $.isNumeric(paragrafInputBis);
  if (!isDecimal && !rdn) {
    showBereichErrorMessage("div.ansichtoption p#printmng_meldung_num");
    return false;
  }
  if (rdn && isValidNumberCharInput(paragrafInputVon) && isValidNumberCharInput(paragrafInputBis) && !isDecimal) {
    if (isCharBigger(paragrafInputVon, paragrafInputBis)) {
      return true;
    }
    showBereichErrorMessage("div.ansichtoption p#printmng_meldung_bis");
    return false;
  }
  const numberVon = parseInt(paragrafInputVon);
  const numberBis = parseInt(paragrafInputBis);
  if (numberVon > numberBis) {
    showBereichErrorMessage("div.ansichtoption p#printmng_meldung_bis");
    return false;
  }
  if ($("input#ansichtbox_doc_type").val() === "buecher") {
    if (numberBis - numberVon > 30) {
      showBereichErrorMessage("div.ansichtoption p#printmng_meldung_min");
      return false;
    }
    if (numberVon <= 0 || numberBis >= 923) {
      showBereichErrorMessage("div.ansichtoption p#printmng_meldung_zsc");
      return false;
    }
  }
  return true;
}
function showRandnummernbereichErrorMessageBasedOnAjaxResult(errormsg) {
  if (errormsg === "randnummernnichtnumerisch") {
    showBereichErrorMessage("div#ansichtoptionrandnummer p#printmng_meldung_num");
  }
  if (errormsg === "bisgroesservon") {
    showBereichErrorMessage("div#ansichtoptionrandnummer p#printmng_meldung_bis");
  }
  if (errormsg === "zuvielerandnummern") {
    showBereichErrorMessage("div#ansichtoptionrandnummer p#printmng_meldung_min");
  }
  if (errormsg === "randnummeroutofrange") {
    showBereichErrorMessage("div#ansichtoptionrandnummer p#printmng_meldung_zsc");
  }
  if (errormsg === "printlististleer") {
    showBereichErrorMessage("div#ansichtoptionrandnummer p#printmng_meldung_exi");
    showBereichErrorMessage("div#ansichtoptionrandnummer p#printmng_meldung_exi_ende");
  }
}
function showBereichErrorMessage(errorMessageId) {
  if ($(errorMessageId).hasClass("hidden")) {
    $(errorMessageId).removeClass("hidden");
  }
}
function hideBereichErrorMessage(errorMessageId) {
  if (!$(errorMessageId).hasClass("hidden")) {
    $(errorMessageId).addClass("hidden");
  }
}
function changeRightColumn() {
  $("div.bo-box").not($("div#viewAnsicht")).not($("div#viewExport")).find(".content").toggleClass("hidden", true);
  $("div.bo-box").not($("div#viewAnsicht")).not($("div#viewExport")).find("i.icon-down-dir").toggleClass("hidden", false);
  $("div.bo-box").not($("div#viewAnsicht")).not($("div#viewExport")).find("i.icon-up-dir").toggleClass("hidden", true);
  $("div#viewExport").find(".content").toggleClass("hidden", false);
  $("div#viewExport").find("i.icon-down-dir").toggleClass("hidden", true);
  $("div#viewExport").find("i.icon-up-dir").toggleClass("hidden", false);
  $("div#search-in-document-wrapper").toggleClass("hidden", true);
  $("div#leseansichtoption div.ansichtoption-label").toggleClass("disabled", true);
  $("div#leseansichtoption a").toggleClass("disabled", true);
  $("div#leseansichtoption").attr("title", $("div#leseansichtoption").data("disabletxt"));
  $("div#DocumentViewHighlight div.ansichtoption-label").toggleClass("disabled", true);
  $("div#DocumentViewHighlight a").toggleClass("disabled", true);
  $("div#DocumentViewHighlight").attr("title", $("div#DocumentViewHighlight").data("disabletxt"));
  if ($("li#anmerkungenOption div.active_checkbox").length) $("li#anmerkungenOption div.active_checkbox").removeClass("active_checkbox").addClass("inactive_checkbox");
  if ($("li#sieheAuchOption div.active_checkbox").length) $("li#sieheAuchOption div.active_checkbox").removeClass("active_checkbox").addClass("inactive_checkbox");
  $("div.dokgesamtansichtlink").toggleClass("hidden", false);
  $("#verweiszettel-top .bo-box-rechtespalte").addClass("hidden");
  $("div#viewTeilen").addClass("hidden");
  $("#viewAkte").addClass("hidden");
  $("#viewAnnotation").addClass("hidden");
}
function reinitRightColumn() {
  $("div.bo-box").not($("div#viewAnsicht")).not($("div#viewVerweiszettel")).find(".content").toggleClass("hidden", true);
  $("div.bo-box").not($("div#viewAnsicht")).not($("div#viewVerweiszettel")).find("i.icon-down-dir").toggleClass("hidden", false);
  $("div.bo-box").not($("div#viewAnsicht")).not($("div#viewVerweiszettel")).find("i.icon-up-dir").toggleClass("hidden", true);
  $("div#viewVerweiszettel").find(".content").toggleClass("hidden", false);
  $("div#viewVerweiszettel").find("i.icon-down-dir").toggleClass("hidden", true);
  $("div#viewVerweiszettel").find("i.icon-up-dir").toggleClass("hidden", false);
  $("div#search-in-document-wrapper").toggleClass("hidden", false);
  $("div#DocumentViewHighlight div.ansichtoption-label").toggleClass("disabled", false);
  $("div#DocumentViewHighlight a").toggleClass("disabled", false);
  $("div#DocumentViewHighlight").attr("title", "");
  if ($("li#anmerkungenOption div.inactive_checkbox").length) $("li#anmerkungenOption div.active_checkbox").removeClass("inactive_checkbox").addClass("active_checkbox");
  if ($("li#sieheAuchOption div.inactive_checkbox").length) $("li#sieheAuchOption div.active_checkbox").removeClass("inactive_checkbox").addClass("active_checkbox");
  $("div.dokgesamtansichtlink").toggleClass("hidden", false);
  $("#verweiszettel-top .bo-box-rechtespalte").removeClass("hidden");
  $("div#viewTeilen").removeClass("hidden");
  $("div#viewAkte").removeClass("hidden");
  $("div#viewAnnotation").removeClass("hidden");
}
function changeRightColumnFachdienstAndBooks() {
  changeRightColumn();
  $(".rs_button_link").css("display", "none");
  $(".exportbuttons").addClass("deactivate");
}
function reinitRightColumnFachdienstAndBooks() {
  reinitRightColumn();
  $(".rs_button_link").css("display", "block");
  $("li#sieheAuchOption .active_checkbox").removeClass("inactive_checkbox");
  $("li#anmerkungenOption .active_checkbox").removeClass("inactive_checkbox");
  $(".exportbuttons").removeClass("deactivate");
}
function showGesamtVersionNorm() {
  $.ajax({
    type: "GET",
    datatype: "json",
    url: "/DACore/ShowGesamtVersion/",
    data: {
      docVPath: $("input#docvpath").val()
    },
    beforeSend: function () {
      showProgressAnsicht();
    },
    complete: function () {
      hideProgressAnsicht();
    },
    statusCode: {
      ...AjaxRedirectStatusCodeHandler
    },
    success: function (data) {
      if (!data) return false;
      if (data.err) {
        showError(data);
      }
      refreshPrintExportManager("CompeleteLaw", true, false, null, null);
      displayGesamtVersionInPage(data);
      if (data.matomo && data.matomo !== 'null') {
        const m = JSON.parse(data.matomo);
        trackMatomoEvent(m.Category, m.Action, m.Name);
      }
      return false;
    }
  });
  return false;
}
function versgesversion(url) {
  $.ajax({
    type: "GET",
    url: url,
    dataType: "json",
    beforeSend: function () {
      showProgressAnsicht();
    },
    complete: function () {
      hideProgressAnsicht();
    },
    success: function (data) {
      if (data.isAktuellGueltigeGesamtversion) {
        displayGesamtVersionInPage(data);
        refreshPrintExportManager("CompeleteLaw", true, false, null, null, null);
        return false;
      }
      displayVersionierteGesamtversionInPage(data);
      refreshPrintExportManager("CompeleteLaw", true, false, null, null, data.gesamtversionPath);
      return false;
    }
  });
}
function showGesamtVersionFach() {
  $.ajax({
    type: "GET",
    datatype: "json",
    url: "/DACore/ShowFachdienstContent/",
    data: {
      vPath: $("input#docvpath").val()
    },
    beforeSend: function () {
      showProgressAnsicht();
    },
    complete: function () {
      hideProgressAnsicht();
    },
    statusCode: {
      ...AjaxRedirectStatusCodeHandler
    },
    success: function (data) {
      if (!data) return false;
      if (data.err) {
        showError(data);
      }
      refreshPrintExportManager("AllDoc", true, true, null, null);
      displayGesamtVersionInPageFach(data);
      return false;
    }
  });
  return false;
}
function displayGesamtVersionInPage(data) {
  $("div#bo_center").html(data.gesamtMiddleStr);
  $("div#bo_left_content").html(data.gesamtTocStr);
  $("div.dokgesamtansichtlink").toggleClass("hidden", true);
  $("input#ansichtbox_selection_CompeleteLaw").prop("checked", true);
  refreshToolleisteForEinzeldokumentansicht(false);
  $("#viewAnsicht").removeClass("hidden");
  $("#standardansichticon a i").removeClass("icon-disabled");
  $("#standardansichticon a i").addClass("icon");
  const activeBox = $("div#viewVerweiszettel");
  rechteSpalteBoBox(activeBox);
  initJSForDocument();
}
function displayVersionierteGesamtversionInPage(data) {
  $("div#bo_center").html(data.gesamtMiddleStr);
  $("div#bo_left_content").html(data.gesamtTocStr);
  refreshToolleisteForEinzeldokumentansicht(false);
  if ($("ul.VerfuegbareGesamtversionen li p").hasClass("marked")) {
    $("#standardansichticon a i").removeClass("icon");
    $("#standardansichticon a i").addClass("icon-disabled");
    $("#viewAnsicht").toggleClass("hidden", true);
    $("#viewExport .rechtespalte").toggleClass("hidden", false);
    rechteSpalteBoBox($("div#viewExport"));
    initJSForDocument();
  }
}
function displayGesamtVersionInPageFach(data) {
  refreshToolleisteForEinzeldokumentansicht(false);
  $("div#bo_center").html(data.htmlDoc);
  $("input#ansichtbox_selection_AllDoc").prop("checked", true);
  initJSForDocument();
}
function showProgressAnsicht() {
  $("div#bo_center,div#bo_left").toggleClass("loadansicht", true);
  _spinnerAnsichtBox.show();
}
function hideProgressAnsicht() {
  $("div#bo_center,div#bo_left").toggleClass("loadansicht", false);
  _spinnerAnsichtBox.hide();
}
function refreshPrintExportManager(viewMode, changeColumn, isBookOrFachdienst, abschnittVon, abschnittBis, gesverspath) {
  const vPath = $("input#docvpath").val();
  const isBoxOpen = $("div#viewExport div.content").hasClass("hidden") === false;
  const showMoreOptions = $("div.moreOptionsContainer div.target").hasClass("nosee") === false;
  const data = {
    vPath: vPath,
    viewMode: viewMode,
    isBoxOpen: isBoxOpen,
    showMoreOptions: showMoreOptions,
    gesverspath: gesverspath
  };
  if (abschnittVon !== null) {
    $.extend(data, {
      abschnittVon: abschnittVon
    });
  }
  if (abschnittBis !== null) {
    $.extend(data, {
      abschnittBis: abschnittBis
    });
  }
  $.ajax({
    type: "GET",
    datatype: "json",
    url: "/DruckExportManager/RefreshPrintExportManagerForEinzelDokumentAnsicht/",
    data: data,
    beforeSend: function () {
      showProgressAnsicht();
    },
    complete: function () {
      if (isBookOrFachdienst) {
        if (changeColumn) {
          changeRightColumnFachdienstAndBooks();
        } else {
          reinitRightColumnFachdienstAndBooks();
        }
      } else {
        if (changeColumn) {
          changeRightColumn();
        } else {
          reinitRightColumn();
        }
      }
      initDropdownToggle();
      hideProgressAnsicht();
    },
    success: function (result) {
      $("div#viewExport").replaceWith(result);
    }
  });
}
function refreshToolleisteForEinzeldokumentansicht(isSingleDocument) {
  const vPath = $("input#docvpath").val();
  const url = document.URL;
  const showAllVersions = includes(url, "ShowAllVersions");
  const showVersionenVergleich = includes(url, "VersionenVergleich");
  if (typeof adjustableColumns !== 'undefined') adjustableColumns.initColumns();
  $.ajax({
    type: "POST",
    url: "/Toolleiste/RefreshToolleisteForEinzeldokumentansicht",
    data: {
      vPath: vPath,
      isSingleDocument: isSingleDocument,
      showAllVersions: showAllVersions,
      showVersionenVergleich: showVersionenVergleich
    },
    dataType: "html",
    success: function (data) {
      if (data.length > 0) {
        $("div#toolleiste").replaceWith(data);
        rechteSpalteBoBox($("div#standardansichticon"));
      }
    }
  });
}
function showError(data) {
  window.location.href = `/${data.err.controller}/${data.err.action}${data.err.param}`;
  return false;
}
//# sourceMappingURL=AnsichtBox.js.map
;
let btn;
const enableButton = () => {
  btn.textContent = btn.dataset.ready;
  btn.disabled = false;
};
const utcNow = () => {
  const date = new Date();
  return Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds());
};
const showTimerOnFraud = t => {
  if (typeof t === "undefined" || t === null || t === '') {
    enableButton();
    return;
  }
  const elapsed = new Date(parseInt(t.replace(/\D/g, '')));
  const txt = btn.dataset.timer;
  let now = utcNow();
  if (elapsed > now) {
    const int = setInterval(() => {
      now = utcNow();
      btn.disabled = elapsed > now;
      btn.textContent = txt.replace('{0}', parseInt((elapsed - now) / 1000));
      if (elapsed <= now) {
        clearInterval(int);
        enableButton();
      }
    }, 250);
  } else {
    enableButton();
  }
};
document.addEventListener('DOMContentLoaded', () => {
  const mc = document.getElementById('mainContent');
  if (mc === null) return;
  if (mc.dataset.fg !== null && mc.dataset.fg !== '') {
    btn = document.querySelector('#fraudDetectionShowTimerButton');
    if (btn) {
      btn.disabled = true;
      showTimerOnFraud(mc.dataset.fg);
    }
  }
});
//# sourceMappingURL=fraudGuard.js.map
;
