{# GLOBAL VARIABLES #}
<script type="text/javascript" nonce="{{ cspNonce }}">
    var appName = "{{theme.getThemeConfig("app_name")}}";
    var userPreferencesUrl = "{{ url_for("user.pref") }}";

    // TODO: Change this to a call to all route permissions ( something like currentUser.getRoutePermissions() )
    var userRoutePermissions = {
        tags: "{{ currentUser.featureEnabled('tag.tagging') }}"
    };

    var tagGetByNameUrl = "{{ url_for("tag.getByName") }}";
    var tagEditMultipleUrl = "{{ url_for("tag.editMultiple", {type: '[type]'}) }}";
    var tagSearchUrl = "{{ url_for("tag.search") }}";
    var urlForLayoutSearch = "{{ url_for("layout.search") }}";
    var calendarType = "{{ settings.CALENDAR_TYPE }}";
    var language = "{{ translate.jsLocale }}";
    var timezone = "{{ settings.defaultTimezone }}";
    var dateFormat = "{{ settings.DATE_FORMAT }}";
    var jsDateFormat = (CALENDAR_TYPE == "Jalali") ? "{{ settings.DATE_FORMAT_JALALI_JS }}" : "{{ settings.DATE_FORMAT_JS }}";
    var timeFormat = "{{ settings.TIME_FORMAT }}";
    var jsTimeFormat = "{{ settings.TIME_FORMAT_JS }}";
    var dateOnlyFormat = "{{ settings.DATE_ONLY_FORMAT }}";
    var jsDateOnlyFormat = (CALENDAR_TYPE == "Jalali") ? "{{ settings.DATE_ONLY_FORMAT_JALALI_JS }}" : "{{ settings.DATE_ONLY_FORMAT_JS }}";
    var systemDateFormat = "{{ settings.systemDateFormat }}";
    var systemTimeFormat = "{{ settings.systemTimeFormat }}";
    var clockUrl = "{{ url_for("clock") }}";
    var calendarLanguage = "{{ translate.jsShortLocale }}";
    var pingUrl = "{{ url_for("ping") }}";
    var foldersUrl = "{{ url_for("folders.search") }}";
    var permissionsUrl = "{{ url_for("user.set.permissions.multi", {entity: ":entity"}) }}";
    var addMediaThumbnailUrl = "{{ url_for("library.thumbnail.add") }}";
    var revokeApplicationAccess = "{{ url_for('application.revoke', {id:":id", userId:":userId"}) }}";
    var getFontsUrl = "{{ url_for("font.search") }}";
    var libraryFontCSS = "{{ url_for("library.font.css") }}";
    var imageDownloadUrl = "{{ url_for("library.download", {id: ':id'}) }}?preview=1";
    var commandSearchUrl = "{{ url_for("command.search") }}";
    var welcomeViewURL = "{{ url_for("welcome.view") }}";
    var supportURL = '{{ theme.getThemeConfig("product_support_url", "https://community.xibo.org.uk/c/support") }}';
    var isXiboThemed = (appName == "Xibo");
    var accountId = "{{ accountId }}";
    var currentUserName = "{{ currentUser.userName }}";
    var currentUserEmail = "{{ currentUser.email }}";

    var dataTablesTemplate = "<'row'<'dataTables_folder col-sm-12 col-lg-5'><'col-sm-12 col-lg-7 text-right'<'d-inline-block mr-2'l><'dataTables_buttons d-inline-block'>>>" +
        "<'row'<'col-sm-12'tr>>" +
        "<'row'<'col-sm-12 col-lg-5'i><'col-lg-7 col-sm-12'p>>";

    // User preference regarding Folder tree state
    var rememberFolderTreeStateGlobally = {{ currentUser.getOptionValue("rememberFolderTreeStateGlobally", "1") }}
</script>
