<commit_before>// Documents viewer

'use strict';

var _                  = require('mano').i18n.bind('Document: preview')
  , resolveArchivePath = require('../utils/resolve-document-archive-path')
  , syncHeight         = require('./utils/sync-height')
  , getFilePreview = require('./utils/get-file-preview');

module.exports = function (doc) {
	var elem;
	return [
		div({ class: 'business-process-document-preview' },
			div({ class: 'container-with-nav' },
				div({ class: 'business-process-document-preview-external-links' },
					a({ target: '_blank', href: _if(doc.files.ordered._size,
						_if(eq(doc.files.ordered._size, 1),
							resolve(doc.files.ordered._first, 'url'),  '/' + resolveArchivePath(doc)
							))
						}, "Open document in new tab"),
					a({ href: _if(doc.files.ordered._size,
						_if(eq(doc.files.ordered._size, 1),
							resolve(doc.files.ordered._first, 'url'),  '/' + resolveArchivePath(doc)
							)),
						download: _if(doc.files.ordered._size, _if(eq(doc.files.ordered._size, 1),
							resolve(doc.files.ordered._first, 'path'),  resolveArchivePath(doc)
							))
						}, "Download document")),

				_if(gt(doc.files.ordered._size, 1),
					div({ class: 'business-process-document-preview-navigation' },
						div(
							{ id: 'submitted-preview-new-navigation-top' },
							a({ class: 'previous' }, span({ class: 'fa fa-chevron-circle-left' },
									_("Previous"))),
							span(span({ class: 'current-index' }, "1"), " / ",
								doc.files.ordered._size),
							a({ class: 'next' }, span({ class: 'fa fa-chevron-circle-right' }, _("Next")))
						))
					)
				),

			elem = ul({ id: 'doc-previews', class: 'submitted-preview-new-image-placeholder' },
				doc.files.ordered, function (file) {
					li({ class: _if(eq(file, doc.files.ordered._first), 'active') },
						getFilePreview(file));
				}, doc),

			insert(_if(gt(doc.files.ordered._size, 1),
				div({ class: 'business-process-document-preview-navigation' },
					div(
						{ id: 'submitted-preview-new-navigation-bottom' },
						a({ class: 'previous' }, span({ class: 'fa fa-chevron-circle-left' }, _("Previous"))),
						span(span({ class: 'current-index' }, "1"), " / ",
							doc.files.ordered._size),
						a({ class: 'next' }, span({ class: 'fa fa-chevron-circle-right' }, _("Next"))),
						legacy('hashNavOrderedListControls',
							'submitted-preview-new-navigation-top', 'doc-previews',
								'doc-preview'),
						legacy('hashNavOrderedListControls',
								'submitted-preview-new-navigation-bottom', 'doc-previews',
								'doc-preview'),
						legacy('hashNavOrderedList', 'doc-previews', 'doc-preview')
					)))),

			syncHeight(elem),

			div({ class: "container-with-nav" },
				div({ class: "business-process-document-preview-external-links" },
					a({ target: '_blank', href: _if(doc.files.ordered._size,
						_if(eq(doc.files.ordered._size, 1),
							resolve(doc.files.ordered._first, 'url'),  '/' + resolveArchivePath(doc)
							))<commit_msg>Add right class to preview-image-placeholder<commit_after>// Documents viewer

'use strict';

var _                  = require('mano').i18n.bind('Document: preview')
  , resolveArchivePath = require('../utils/resolve-document-archive-path')
  , syncHeight         = require('./utils/sync-height')
  , getFilePreview = require('./utils/get-file-preview');

module.exports = function (doc) {
	var elem;
	return [
		div({ class: 'business-process-document-preview' },
			div({ class: 'container-with-nav' },
				div({ class: 'business-process-document-preview-external-links' },
					a({ target: '_blank', href: _if(doc.files.ordered._size,
						_if(eq(doc.files.ordered._size, 1),
							resolve(doc.files.ordered._first, 'url'),  '/' + resolveArchivePath(doc)
							))
						}, "Open document in new tab"),
					a({ href: _if(doc.files.ordered._size,
						_if(eq(doc.files.ordered._size, 1),
							resolve(doc.files.ordered._first, 'url'),  '/' + resolveArchivePath(doc)
							)),
						download: _if(doc.files.ordered._size, _if(eq(doc.files.ordered._size, 1),
							resolve(doc.files.ordered._first, 'path'),  resolveArchivePath(doc)
							))
						}, "Download document")),

				_if(gt(doc.files.ordered._size, 1),
					div({ class: 'business-process-document-preview-navigation' },
						div(
							{ id: 'submitted-preview-new-navigation-top' },
							a({ class: 'previous' }, span({ class: 'fa fa-chevron-circle-left' },
									_("Previous"))),
							span(span({ class: 'current-index' }, "1"), " / ",
								doc.files.ordered._size),
							a({ class: 'next' }, span({ class: 'fa fa-chevron-circle-right' }, _("Next")))
						))
					)
				),

			elem = ul({ id: 'doc-previews',
				class: 'business-process-document-preview-image-placeholder' },
				doc.files.ordered, function (file) {
					li({ class: _if(eq(file, doc.files.ordered._first), 'active') },
						getFilePreview(file));
				}, doc),

			insert(_if(gt(doc.files.ordered._size, 1),
				div({ class: 'business-process-document-preview-navigation' },
					div(
						{ id: 'submitted-preview-new-navigation-bottom' },
						a({ class: 'previous' }, span({ class: 'fa fa-chevron-circle-left' }, _("Previous"))),
						span(span({ class: 'current-index' }, "1"), " / ",
							doc.files.ordered._size),
						a({ class: 'next' }, span({ class: 'fa fa-chevron-circle-right' }, _("Next"))),
						legacy('hashNavOrderedListControls',
							'submitted-preview-new-navigation-top', 'doc-previews',
								'doc-preview'),
						legacy('hashNavOrderedListControls',
								'submitted-preview-new-navigation-bottom', 'doc-previews',
								'doc-preview'),
						legacy('hashNavOrderedList', 'doc-previews', 'doc-preview')
					)))),

			syncHeight(elem),

			div({ class: "container-with-nav" },
				div({ class: "business-process-document-preview-external-links" },
					a({ target: '_blank', href: _if(doc.files.ordered._size,
						_if(eq(doc.files.ordered._size, 1),
							resolve(doc.files.ordered._first, 'url'),  '/' + resolveArchivePath(doc)
							))
{'fraction_non_alphanumeric': 0.19097395055583208, 'fraction_numerical': 0.003318400530944085, 'mean_word_length': 3.08955223880597, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2000643', 'n_tokens_mistral': 2519, 'n_tokens_neox': 1939, 'n_words': 330}