<script>
	if (typeof (window.themehouse) !== 'object') {
		window.themehouse = {};
	}
	if (typeof (window.themehouse.settings) !== 'object') {
		window.themehouse.settings = {};
	}
	window.themehouse.settings = {
		common: {
			'20210125': {
				init: false,
			},
		},
		data: {
			version: '{{property('uix_version')}}',
			jsVersion: 'No JS Files',
			templateVersion: '2.1.8.0_Release',
			betaMode: {{property('uix_betaMode')}},
			theme: '',
			url: '{{ base_url(null, true)|escape("js") }}',
			user: '{$xf.visitor.user_id}',
		},
		inputSync: {},
		minimalSearch: {
			breakpoint: "{{ 0 + property('uix_search_maxResponsiveWidth') }}",
			dropdownBreakpoint: "{{ 0 + property('uix_search_maxResponsiveWidth') }}",
		},
		sidebar: {
            enabled: '{{$uix_canCollapseSidebar}}',
			link: '{{ link("uix/toggle-sidebar.json", null, {"t": csrf_token()}) }}',
            state: '{{$uix_sidebarCollapsed}}',
		},
        sidebarNav: {
            enabled: '{{$uix_canCollapseSidebarNav}}',
			link: '{{ link("uix/toggle-sidebar-navigation.json", null, {"t": csrf_token()}) }}',
            state: '{{$uix_sidebarNavCollapsed}}',
		},
		fab: {
			enabled: {{property('uix_fabScroll')}},
		},
		checkRadius: {
			enabled: {{property('uix_borderRadiusJs')}},
			selectors: '{{property("uix_borderRadiusSelectors")}}',
		},
		nodes: {
			enabled: {{property('uix_nodeClickable')}},
		},
        nodesCollapse: {
            enabled: '{{$uix_canCollapseCategories}}',
			link: '{{ link("uix/toggle-category.json", null, {"t": csrf_token()}) }}',
			state: '{{$uix_collapsedCategoriesJson}}',
        },
		widthToggle: {
			enabled: '{{$uix_canTogglePageWidth}}',
			link: '{{ link("uix/toggle-width.json", null, {"t": csrf_token()}) }}',
			state: '{{$uix_pageWidth}}',
		},
	}

	window.document.addEventListener('DOMContentLoaded', function() {
		<xf:if is="{{property('uix_betaMode')}}">
			window.themehouse.common['20210125'].init();
			window.themehouse.common['20180112'] = window.themehouse.common['20210125'];
		<xf:else />
			try {
			   window.themehouse.common['20210125'].init();
			   window.themehouse.common['20180112'] = window.themehouse.common['20210125']; // custom projects fallback
			} catch(e) {
			   console.log('Error caught', e);
			}
		</xf:if>


		var jsVersionPrefix = 'No JS Files';
		if (typeof(window.themehouse.settings.data.jsVersion) === 'string') {
			var jsVersionSplit = window.themehouse.settings.data.jsVersion.split('_');
			if (jsVersionSplit.length) {
				jsVersionPrefix = jsVersionSplit[0];
			}
		}
		var templateVersionPrefix = 'No JS Template Version';
		if (typeof(window.themehouse.settings.data.templateVersion) === 'string') {
			var templateVersionSplit = window.themehouse.settings.data.templateVersion.split('_');
			if (templateVersionSplit.length) {
				templateVersionPrefix = templateVersionSplit[0];
			}
		}
		if (jsVersionPrefix !== templateVersionPrefix) {
			var splitFileVersion = jsVersionPrefix.split('.');
			var splitTemplateVersion = templateVersionPrefix.split('.');
			console.log('version mismatch', jsVersionPrefix, templateVersionPrefix);
		}

	});
</script>