PageSourceSearch

http://www.meki62.ru/bitrix/cache/js/s1/simai.framework/page_14406…12782ff9a04672ef51471_v1.js?179092312778780

js meki62.ru collected 2026-10-02 17:41:28 UTC 78,780 bytes, 2,191 lines download raw bytes

1
2; /* Start:"a:4:{s:4:"full";s:101:"/bitrix/templates/simai.framework/components/bitrix/map.yandex.view/contacts/script.js?17133513821540";s:6:"source";s:86:"/bitrix/templates/simai.framework/components/bitrix/map.yandex.view/contacts/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
3if (!window.BX_YMapAddPlacemark)
4{
5	window.BX_YMapAddPlacemark = function(map, arPlacemark)
6	{
7		if (null == map)
8			return false;
9
10		if(!arPlacemark.LAT || !arPlacemark.LON)
11			return false;
12
13		var props = {};
14		if (null != arPlacemark.TEXT && arPlacemark.TEXT.length > 0)
15		{
16			var value_view = '';
17
18			if (arPlacemark.TEXT.length > 0)
19			{
20				var rnpos = arPlacemark.TEXT.indexOf("\n");
21				value_view = rnpos <= 0 ? arPlacemark.TEXT : arPlacemark.TEXT.substring(0, rnpos);
22			}
23
24			props.balloonContent = arPlacemark.TEXT.replace(/\n/g, '<br />');
25			props.hintContent = value_view;
26		}
27
28		var obPlacemark = new ymaps.Placemark(
29			[arPlacemark.LAT, arPlacemark.LON],
30			props,
31			{balloonCloseButton: true}
32		);
33
34		map.geoObjects.add(obPlacemark);
35
36		return obPlacemark;
37	}
38}
39
40if (!window.BX_YMapAddPolyline)
41{
42	window.BX_YMapAddPolyline = function(map, arPolyline)
43	{
44		if (null == map)
45			return false;
46
47		if (null != arPolyline.POINTS && arPolyline.POINTS.length > 1)
48		{
49			var arPoints = [];
50			for (var i = 0, len = arPolyline.POINTS.length; i < len; i++)
51			{
52				arPoints.push([arPolyline.POINTS[i].LAT, arPolyline.POINTS[i].LON]);
53			}
54		}
55		else
56		{
57			return false;
58		}
59
60		var obParams = {clickable: true};
61		if (null != arPolyline.STYLE)
62		{
63			obParams.strokeColor = arPolyline.STYLE.strokeColor;
64			obParams.strokeWidth = arPolyline.STYLE.strokeWidth;
65		}
66		var obPolyline = new ymaps.Polyline(
67			arPoints, {balloonContent: arPolyline.TITLE}, obParams
68		);
69
70		map.geoObjects.add(obPolyline);
71
72		return obPolyline;
73	}
74}
75/* End */
76;
77; /* Start:"a:4:{s:4:"full";s:61:"/simai/asset/simai.property/ui/js/property.js?178785087816954";s:6:"source";s:45:"/simai/asset/simai.property/ui/js/property.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
78(function() {
79	'use strict';
80
81	if (window.SIMAIPropertyUiInitialized) {
82		return;
83	}
84	window.SIMAIPropertyUiInitialized = true;
85
86	var protocols = ['https://', 'http://', '/', './', '../'];
87
88	function trimSlashes(value) {
89		while (value.charAt(0) === '/') {
90			value = value.substring(1);
91		}
92		return value;
93	}
94
95	function parseLink(row) {
96		prepareLinkRow(row);
97
98		var protocol = row.querySelector('[data-sp-link-protocol]');
99		var input = row.querySelector('[data-sp-link-input]');
100		var full = row.querySelector('[data-sp-link-full]');
101		if (!input || !full) {
102			return;
103		}
104		if (!protocol) {
105			full.value = String(input.value || '').trim();
106			return;
107		}
108
109		var value = String(input.value || '').trim();
110		var lowered = value.toLowerCase();
111		var matched = '';
112
113		if (lowered.indexOf('//') === 0) {
114			matched = 'http://';
115			value = trimSlashes(value);
116		} else {
117			for (var i = 0; i < protocols.length; i++) {
118				if (lowered.indexOf(protocols[i]) === 0) {
119					matched = protocols[i];
120					break;
121				}
122			}
123
124			if (matched !== '') {
125				value = value.substring(matched.length);
126			}
127		}
128
129		if (matched !== '') {
130			protocol.value = matched;
131		}
132
133		if (protocol.value === '/' || protocol.value === './' || protocol.value === '../') {
134			if (protocol.value === './') {
135				while (value.indexOf('./') === 0) {
136					value = value.substring(2);
137				}
138			} else if (protocol.value === '../') {
139				while (value.indexOf('../') === 0) {
140					value = value.substring(3);
141				}
142			} else {
143				value = trimSlashes(value);
144			}
145		} else {
146			value = trimSlashes(value);
147		}
148
149		input.value = value;
150		full.value = value.length > 0 ? protocol.value + value : '';
151	}
152
153	function updateProtocol(row) {
154		var protocol = row.querySelector('[data-sp-link-protocol]');
155		var input = row.querySelector('[data-sp-link-input]');
156		var full = row.querySelector('[data-sp-link-full]');
157		if (!protocol || !input || !full) {
158			return;
159		}
160
161		var value = String(input.value || '').trim();
162		for (var i = 0; i < protocols.length; i++) {
163			if (value.toLowerCase().indexOf(protocols[i]) === 0) {
164				value = value.substring(protocols[i].length);
165				break;
166			}
167		}
168
169		input.value = protocol.value === '/' ? trimSlashes(value) : value.replace(/^(\.\/|\.\.\/)+/, '');
170		full.value = input.value.length > 0 ? protocol.value + input.value : '';
171	}
172
173	function prepareLinkRow(row) {
174		if (!row || row.getAttribute('data-sp-link-row-ready') === 'Y') {
175			return;
176		}
177
178		var unique = 'sp' + Math.random().toString(16).slice(2) + String(Date.now());
179		var protocol = row.querySelector('[data-sp-link-protocol]');
180		var input = row.querySelector('[data-sp-link-input]');
181		var full = row.querySelector('[data-sp-link-full]');
182
183		if (protocol) {
184			protocol.id = protocol.id || 'pro' + unique;
185		}
186		if (input) {
187			input.id = input.id || 'link' + unique;
188		}
189		if (full) {
190			full.id = full.id || 'full' + unique;
191		}
192
193		row.setAttribute('data-sp-link-row-ready', 'Y');
194	}
195
196	function updateRepeatableRows(control) {
197		if (!control || control.getAttribute('data-sp-property-ui-multiple') !== 'Y') {
198			return;
199		}
200
201		var rows = getRepeatableRows(control);
202		var visibleRows = getVisibleRepeatableRows(control);
203		for (var i = 0; i < rows.length; i++) {
204			var remove = rows[i].querySelector('[data-sp-property-remove-row]');
205			if (!remove) {
206				continue;
207			}
208
209			if (visibleRows.length <= 1) {
210				remove.setAttribute('disabled', 'disabled');
211				remove.classList.add('ui-btn-disabled');
212				remove.style.visibility = 'hidden';
213			} else {
214				remove.removeAttribute('disabled');
215				remove.classList.remove('ui-btn-disabled');
216				remove.style.visibility = '';
217			}
218		}
219	}
220
221	function getRepeatableRows(control) {
222		if (!control) {
223			return [];
224		}
225		return control.querySelectorAll('[data-sp-property-ui-row], [data-sp-property-ui-link-row]');
226	}
227
228	function getVisibleRepeatableRows(control) {
229		var rows = getRepeatableRows(control);
230		var visible = [];
231		for (var i = 0; i < rows.length; i++) {
232			if (rows[i].hidden || rows[i].getAttribute('data-sp-property-row-disabled') === 'Y') {
233				continue;
234			}
235			visible.push(rows[i]);
236		}
237		return visible;
238	}
239
240	function clearRowValue(row) {
241		if (!row) {
242			return;
243		}
244		row.querySelectorAll('input, textarea, select').forEach(function(field) {
245			if (field.type === 'checkbox' || field.type === 'radio') {
246				field.checked = false;
247			} else if (field.tagName === 'SELECT') {
248				field.selectedIndex = -1;
249			} else {
250				field.value = '';
251			}
252			if (field.matches('[data-sp-link-input]') || field.matches('[data-sp-link-full]')) {
253				field.value = '';
254			}
255			if (field.matches('[data-simai-content-blocks-disabled]')) {
256				field.setAttribute('data-simai-content-blocks-disabled', 'Y');
257			}
258		});
259	}
260
261	function setRowDisabled(row, disabled) {
262		if (!row) {
263			return;
264		}
265		row.hidden = disabled;
266		row.setAttribute('data-sp-property-row-disabled', disabled ? 'Y' : 'N');
267		row.querySelectorAll('input, textarea, select').forEach(function(field) {
268			field.disabled = disabled;
269			if (field.matches('[data-simai-content-blocks-disabled]')) {
270				field.setAttribute('data-simai-content-blocks-disabled', disabled ? 'Y' : 'N');
271			}
272		});
273	}
274
275	function nextRowIndex(control) {
276		var index = parseInt(control.getAttribute('data-sp-property-next-index') || '0', 10);
277		if (!Number.isFinite(index) || index < 0) {
278			index = 0;
279		}
280		control.setAttribute('data-sp-property-next-index', String(index + 1));
281		return index;
282	}
283
284	function addRepeatableRow(control) {
285		if (!control) {
286			return;
287		}
288
289		var hiddenRows = control.querySelectorAll('[data-sp-property-ui-row][data-sp-property-row-disabled="Y"], [data-sp-property-ui-link-row][data-sp-property-row-disabled="Y"]');
290		if (hiddenRows.length > 0) {
291			setRowDisabled(hiddenRows[0], false);
292			updateRepeatableRows(control);
293			var revealedInput = hiddenRows[0].querySelector('input:not([type="hidden"]), textarea, select');
294			if (revealedInput) {
295				revealedInput.focus();
296			}
297			return;
298		}
299
300		var rows = control.querySelector('.sp-property-ui__rows');
301		var template = control.querySelector('[data-sp-property-row-template]');
302		if (!rows || !template) {
303			return;
304		}
305		var index = nextRowIndex(control);
306		var wrapper = document.createElement('div');
307		wrapper.innerHTML = template.innerHTML.replace(/__index__/g, String(index));
308		var row = wrapper.firstElementChild;
309		if (!row) {
310			return;
311		}
312
313		rows.appendChild(row);
314		parseLink(row);
315		row.querySelectorAll('input, textarea, select').forEach(function(field) {
316			field.disabled = false;
317			if (field.matches('[data-simai-content-blocks-disabled]')) {
318				field.setAttribute('data-simai-content-blocks-disabled', 'N');
319			}
320		});
321		document.dispatchEvent(new CustomEvent('SIMAIPropertyRepeatableRowAdd', {detail: {row: row, control: control}}));
322		updateRepeatableRows(control);
323		var input = row.querySelector('[data-sp-link-input], input:not([type="hidden"]), textarea, select');
324		if (input) {
325			input.focus();
326		}
327	}
328
329	function splitTags(value) {
330		return String(value || '')
331			.split(',')
332			.map(function(item) {
333				return item.trim();
334			})
335			.filter(function(item, index, list) {
336				return item !== '' && list.indexOf(item) === index;
337			});
338	}
339
340	function syncTags(control) {
341		var hidden = control.querySelector('[data-sp-tags-value]');
342		var chips = control.querySelectorAll('[data-sp-tags-chip]');
343		if (!hidden) {
344			return;
345		}
346
347		var values = [];
348		for (var i = 0; i < chips.length; i++) {
349			var value = chips[i].getAttribute('data-sp-tags-chip') || '';
350			if (value !== '') {
351				values.push(value);
352			}
353		}
354
355		hidden.value = values.join(', ');
356	}
357
358	function getTagSuggestions(control) {
359		var raw = control.getAttribute('data-sp-tags-suggestions-source') || '[]';
360		try {
361			var parsed = JSON.parse(raw);
362			return Array.isArray(parsed) ? parsed.map(String) : [];
363		} catch (error) {
364			return [];
365		}
366	}
367
368	function hideTagSuggestions(control) {
369		var list = control.parentNode && control.parentNode.querySelector('[data-sp-tags-suggestions]');
370		if (!list) {
371			return;
372		}
373
374		list.hidden = true;
375		list.innerHTML = '';
376	}
377
378	function renderTagSuggestions(control) {
379		var input = control.querySelector('[data-sp-tags-input]');
380		var list = control.parentNode && control.parentNode.querySelector('[data-sp-tags-suggestions]');
381		if (!input || !list) {
382			return;
383		}
384
385		var query = String(input.value || '').trim().toLowerCase();
386		if (query === '') {
387			hideTagSuggestions(control);
388			return;
389		}
390
391		var selected = splitTags(control.querySelector('[data-sp-tags-value]').value).map(function(tag) {
392			return tag.toLowerCase();
393		});
394		var suggestions = getTagSuggestions(control).filter(function(tag) {
395			var lowered = tag.toLowerCase();
396			return selected.indexOf(lowered) === -1 && lowered.indexOf(query) !== -1;
397		}).slice(0, 8);
398
399		if (suggestions.length === 0) {
400			hideTagSuggestions(control);
401			return;
402		}
403
404		list.innerHTML = '';
405		suggestions.forEach(function(tag) {
406			var item = document.createElement('button');
407			item.type = 'button';
408			item.className = 'sp-property-ui-tags__suggestion';
409			item.setAttribute('data-sp-tags-suggestion', tag);
410			item.textContent = tag;
411			list.appendChild(item);
412		});
413		list.hidden = false;
414	}
415
416	function createTagChip(value) {
417		var chip = document.createElement('span');
418		chip.className = 'sp-property-ui-tags__chip';
419		chip.setAttribute('data-sp-tags-chip', value);
420
421		var title = document.createElement('span');
422		title.className = 'sp-property-ui-tags__chip-title';
423		title.textContent = value;
424		chip.appendChild(title);
425
426		var remove = document.createElement('button');
427		remove.className = 'sp-property-ui-tags__remove';
428		remove.type = 'button';
429		remove.setAttribute('data-sp-tags-remove', 'Y');
430		remove.setAttribute('aria-label', 'Удалить тег ' + value);
431		remove.textContent = '×';
432		chip.appendChild(remove);
433
434		return chip;
435	}
436
437	function renderTags(control) {
438		var hidden = control.querySelector('[data-sp-tags-value]');
439		var chipsContainer = control.querySelector('[data-sp-tags-chips]');
440		if (!hidden || !chipsContainer) {
441			return;
442		}
443
444		chipsContainer.innerHTML = '';
445		splitTags(hidden.value).forEach(function(tag) {
446			chipsContainer.appendChild(createTagChip(tag));
447		});
448		syncTags(control);
449	}
450
451	function addTags(control, rawValue) {
452		var input = control.querySelector('[data-sp-tags-input]');
453		var chipsContainer = control.querySelector('[data-sp-tags-chips]');
454		if (!chipsContainer) {
455			return;
456		}
457
458		var existing = splitTags(control.querySelector('[data-sp-tags-value]').value);
459		splitTags(rawValue).forEach(function(tag) {
460			if (existing.indexOf(tag) === -1) {
461				chipsContainer.appendChild(createTagChip(tag));
462				existing.push(tag);
463			}
464		});
465
466		if (input) {
467			input.value = '';
468		}
469		syncTags(control);
470		hideTagSuggestions(control);
471	}
472
473	function initializeTags(root) {
474		var scope = root || document;
475		scope.querySelectorAll('[data-sp-property-ui-tags-control]').forEach(function(control) {
476			if (control.getAttribute('data-sp-tags-ready') === 'Y') {
477				return;
478			}
479			control.setAttribute('data-sp-tags-ready', 'Y');
480			var nativeTableId = control.getAttribute('data-sp-tags-native-table');
481			if (nativeTableId) {
482				var nativeTable = document.getElementById('tbl' + nativeTableId);
483				var scope = nativeTable && nativeTable.parentNode ? nativeTable.parentNode : nativeTable;
484				if (scope) {
485					scope.querySelectorAll('input[type="button"][onclick*="addNewTableRow"]').forEach(function(button) {
486						button.hidden = true;
487					});
488				}
489			}
490			renderTags(control);
491			hideTagSuggestions(control);
492		});
493	}
494
495	function initialize(root) {
496		var scope = root || document;
497		var rows = scope.querySelectorAll('[data-sp-property-ui-link-row]');
498		for (var i = 0; i < rows.length; i++) {
499			parseLink(rows[i]);
500		}
501		scope.querySelectorAll('[data-sp-property-ui-link]').forEach(function(control) {
502			updateRepeatableRows(control);
503		});
504		scope.querySelectorAll('[data-sp-property-ui-repeatable]').forEach(function(control) {
505			getRepeatableRows(control).forEach(function(row) {
506				if (row.getAttribute('data-sp-property-row-disabled') === 'Y') {
507					setRowDisabled(row, true);
508				}
509			});
510			updateRepeatableRows(control);
511		});
512		initializeTags(scope);
513		scope.querySelectorAll('[data-sp-phone-mask]').forEach(function(input) {
514			formatPhoneInput(input);
515		});
516	}
517
518	function formatPhoneInput(input) {
519		if (!input) {
520			return;
521		}
522		var digits = String(input.value || '').replace(/\D/g, '').slice(0, 11);
523		if (digits === '') {
524			input.value = '';
525			return;
526		}
527		var result = '+' + digits.charAt(0);
528		if (digits.length > 1) result += ' (' + digits.slice(1, 4);
529		if (digits.length >= 4) result += ')';
530		if (digits.length > 4) result += ' ' + digits.slice(4, 7);
531		if (digits.length > 7) result += '-' + digits.slice(7, 11);
532		input.value = result;
533	}
534
535	document.addEventListener('input', function(event) {
536		if (event.target && event.target.matches('[data-sp-phone-mask]')) {
537			formatPhoneInput(event.target);
538		}
539		if (event.target && event.target.matches('[data-sp-link-input]')) {
540			parseLink(event.target.closest('[data-sp-property-ui-link-row]'));
541		}
542		if (event.target && event.target.matches('[data-sp-tags-input]')) {
543			renderTagSuggestions(event.target.closest('[data-sp-property-ui-tags-control]'));
544		}
545	});
546
547	document.addEventListener('change', function(event) {
548		if (event.target && event.target.matches('[data-sp-link-input]')) {
549			parseLink(event.target.closest('[data-sp-property-ui-link-row]'));
550		}
551		if (event.target && event.target.matches('[data-sp-link-protocol]')) {
552			updateProtocol(event.target.closest('[data-sp-property-ui-link-row]'));
553		}
554	});
555
556	document.addEventListener('keydown', function(event) {
557		if (!event.target || !event.target.matches('[data-sp-tags-input]')) {
558			return;
559		}
560
561		if (event.key === 'Enter' || event.key === ',') {
562			event.preventDefault();
563			addTags(event.target.closest('[data-sp-property-ui-tags-control]'), event.target.value);
564			return;
565		}
566
567		if (event.key === 'Escape') {
568			hideTagSuggestions(event.target.closest('[data-sp-property-ui-tags-control]'));
569		}
570	});
571
572	document.addEventListener('blur', function(event) {
573		if (event.target && event.target.matches('[data-sp-tags-input]')) {
574			var control = event.target.closest('[data-sp-property-ui-tags-control]');
575			addTags(control, event.target.value);
576			window.setTimeout(function() {
577				hideTagSuggestions(control);
578			}, 120);
579		}
580	}, true);
581
582	document.addEventListener('click', function(event) {
583		var suggestion = event.target && event.target.closest('[data-sp-tags-suggestion]');
584		if (suggestion) {
585			var suggestionControl = suggestion.closest('.sp-property-ui-tags').querySelector('[data-sp-property-ui-tags-control]');
586			addTags(suggestionControl, suggestion.getAttribute('data-sp-tags-suggestion') || suggestion.textContent || '');
587			var suggestionInput = suggestionControl.querySelector('[data-sp-tags-input]');
588			if (suggestionInput) {
589				suggestionInput.focus();
590			}
591			return;
592		}
593
594		var remove = event.target && event.target.closest('[data-sp-tags-remove]');
595		if (remove) {
596			var control = remove.closest('[data-sp-property-ui-tags-control]');
597			remove.closest('[data-sp-tags-chip]').remove();
598			syncTags(control);
599			renderTagSuggestions(control);
600			return;
601		}
602
603		var rowRemove = event.target && event.target.closest('[data-sp-property-remove-row]');
604		if (rowRemove) {
605			var repeatableControl = rowRemove.closest('[data-sp-property-ui-repeatable], [data-sp-property-ui-link]');
606			var row = rowRemove.closest('[data-sp-property-ui-row], [data-sp-property-ui-link-row]');
607			if (repeatableControl && row && getVisibleRepeatableRows(repeatableControl).length > 1) {
608				if (row.getAttribute('data-sp-property-row-prerendered') === 'Y') {
609					clearRowValue(row);
610					setRowDisabled(row, true);
611				} else {
612					row.remove();
613				}
614				updateRepeatableRows(repeatableControl);
615			}
616			return;
617		}
618
619		var rowAdd = event.target && event.target.closest('[data-sp-property-add-row]');
620		if (rowAdd) {
621			addRepeatableRow(rowAdd.closest('[data-sp-property-ui-repeatable], [data-sp-property-ui-link]'));
622			return;
623		}
624
625		var control = event.target && event.target.closest('[data-sp-property-ui-tags-control]');
626		if (control) {
627			var input = control.querySelector('[data-sp-tags-input]');
628			if (input) {
629				input.focus();
630				renderTagSuggestions(control);
631			}
632		}
633	});
634
635	document.addEventListener('mousedown', function(event) {
636		if (event.target && event.target.closest('[data-sp-tags-suggestion]')) {
637			event.preventDefault();
638		}
639	});
640
641	if (window.BX && BX.addCustomEvent) {
642		BX.addCustomEvent('onAdminTabsChange', function() {
643			initialize(document);
644		});
645	}
646
647	if (document.readyState === 'loading') {
648		document.addEventListener('DOMContentLoaded', function() {
649			initialize(document);
650		});
651	} else {
652		initialize(document);
653	}
654
655	window.SIMAIPropertyUiInit = initialize;
656})();
657
658/* End */
659;
660; /* Start:"a:4:{s:4:"full";
660s:60:"/simai/asset/simai.property/sf4/js/script.js?178785087836366";s:6:"source";s:44:"/simai/asset/simai.property/sf4/js/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
661
662function property() {
663
664    var list = document.body.querySelectorAll('input:not([type="hidden"])');
665    var select = document.body.querySelectorAll('select');
666    var textarea = document.body.querySelectorAll('textarea');
667    var checkbox = document.body.querySelectorAll('input[type="checkbox"]');
668    var listImage = document.body.querySelectorAll('[data-list]');
669    var cond = document.querySelectorAll('.radio-change');
670    var sort = document.querySelectorAll('[data-sort]');
671
672    function isTrue(el) {
673        if(el != null && el != undefined) return true; else return false;
674    }
675
676    var inactive = document.body.querySelectorAll('.sf4_property_inactive');
677
678    if(isTrue(inactive)) {
679        for(var k = 0; k < inactive.length; k++) {
680            var el = inactive[k];
681            el.addEventListener('click', function(e) {
682                e.currentTarget.classList.remove('sf4_property_inactive');
683                var input = e.currentTarget.querySelector('.hidden-input'),
684                    allElements = e.currentTarget.querySelectorAll('[disabled=""]');
685
686                for(var k = 0; k < allElements.length; k++)
687                    if(allElements[k].hasAttribute('disabled')) allElements[k].removeAttribute('disabled');
688                if(isTrue(input)) {
689                    input.setAttribute('value', "Y");
690                    input.value = "Y";
691                }
692                var allInput = e.currentTarget.querySelectorAll('input'),
693                    event = new Event('input');
694                if(isTrue(allInput)) {
695                    for(var x = 0; x < allInput.length; x++) {
696                        var eIn = allInput[x];
697                        if(eIn.classList.contains('hidden-input')) {
698                            eIn.focus();
699                        }
700                    }
701                }
702            })
703        }
704    }
705
706
707    var btnMulti = document.body.querySelectorAll('input[data-button-property=""]');
708        if(btnMulti != null) {
709            for(var k = 0; k < btnMulti.length; k++) {
710                btnMulti[k].onclick = function(e) {
711                    addField(e);
712                }
713            }
714        }
715
716
717    // ----------- SELECT ------------- //
718
719    if(select != null) {
720        for(var k = 0; k < select.length; k++) {
721            var slc = select[k];
722                slc.addEventListener('change', function(e) {
723                    var el = e.currentTarget;
724                    var chang = el.parentNode.querySelector('[if-type="checkbox"]');
725                    for(var s = 0; s < el.options.length; s++) {
726                        var opt = el.options[s];
727                        if(opt.selected) {
728                            opt.setAttribute('selected', '');
729                            if (chang != null) {
730                                chang.setAttribute('checked', 'checked');
731                                chang.setAttribute('value', opt.value);
732                            }
733                        } else {
734                            opt.removeAttribute('selected');
735                            if (chang != null) {
736                                chang.removeAttribute('checked');
737                            }
738                        }
739                    }
740                    var chan = new Event('change');
741                    if (chang != null) {
742                        chang.dispatchEvent(chan);
743                    }
744                });
745        }
746    }
747
748    if(isTrue(list)) {
749        for(var k = 0; k < list.length; k++) {
750            var el = list[k];
751            el.addEventListener('input', function(e) {
752                var input = e.target,
753                    condition = input.nextElementSibling,
754                    event = new Event('change');
755                if(condition.type != "hidden" || condition.type != "hidden") {
756                    if(isTrue(condition)) {
757                        condition.setAttribute('value', linkConditionSetValue(input) + input.value)
758                        condition.setAttribute('checked', 'checked');
759                        condition.dispatchEvent(event);
760                        if(input.hasAttribute('data-protocol')) {
761                            condition.value = linkConditionSetValue(input) + input.value;
762                        } else condition.value = input.value;
763                        condition.checked = true;
764                    }
765                    if(isTrue(input)) {
766                        if(input.classList.contains('form-check-input')) {
767                            if(input.checked) {
768                                input.value = "Y";
769                                input.checked = true;
770                                input.setAttribute('value', 'Y');
771                                input.setAttribute('checked', 'checked');
772                            } else {
773                                input.setAttribute('value', 'N');
774                                input.removeAttribute('checked');
775                                input.checked = false;
776                                input.value = "N";
777                            }
778                        }
779                    }
780                }
781                
782                
783            });
784        }
785    }
786
787    function linkConditionSetValue(input) {
788        if(input) {
789            if(input.hasAttribute('data-protocol')) {
790                
791                var container = input.parentNode,
792                    selectProtocol = container.querySelector('select[data-protocol=""]');
793                if(selectProtocol) {
794                    for(var k = 0; k < selectProtocol.options.length; k++) {
795                        var opt = selectProtocol.options[k];
796                        if(opt.selected) {
797                            return opt.value;
798                        }
799                    }
800                }
801            }
802        }
803    }
804
805    if(isTrue(textarea)) {
806        for(var k = 0; k < textarea.length; k++) {
807            var el = textarea[k];
808            el.addEventListener('input', function(e) {
809                var input = e.target,
810                    condition = input.nextElementSibling,
811                    event = new Event('change');
812                if(isTrue(condition)) {
813                    condition.setAttribute('value', input.value)
814                    condition.setAttribute('checked', 'checked');
815                    condition.dispatchEvent(event);
816                    condition.value = input.value;
817                    condition.checked = true;
818                }
819            })
820        }
821    }
822
823    if(isTrue(listImage)) {
824        for(var k = 0; k < listImage.length; k++) {
825            var data = listImage[k];
826            if(data.hasAttribute('data-list')) {
827                var dataList = data.getAttribute('data-list');
828                //imageAction(data);
829            }
830        }
831    }
832
833    // ----------- CHECKBOX ------------- //
834
835    if(checkbox != null) {
836        for(var k = 0; k < checkbox.length; k++) {
837            var check = checkbox[k],
838                chang = check.nextElementSibling;
839
840            if(check.checked) {
841                check.setAttribute('checked', '');
842                if(chang != null && chang != undefined)
843                    chang.setAttribute('checked', 'checked');
844            } else {
845                check.removeAttribute('checked', '');
846                if(chang != null && chang != undefined)
847                    chang.removeAttribute('checked');
848            }
849
850            if(chang != null && chang != undefined) {
851                var chan = new Event('change');
852                chang.dispatchEvent(chan);
853            }
854        }
855    }
856
857    var checkbox = document.body.querySelectorAll('[data-property-checkbox]');
858
859    if(checkbox != null) {
860        for(var k = 0; k < checkbox.length; k++) {
861            checkbox[k].addEventListener('change', function(e) {
862                var el = e.target,
863                    chang = el.nextElementSibling
864                if(el.checked) {
865                    el.value = 'Y'
866                    el.setAttribute('value', 'Y');
867                    el.setAttribute('checked', '');
868                    chang.setAttribute('checked', 'checked');
869                    chang.setAttribute('value', el.value);
870                } else {
871                    el.value = "N";
872                    el.setAttribute('value', 'N');
873                    el.setAttribute('checked', '');
874                    el.removeAttribute('checked');      
875                    chang.removeAttribute('checked');   
876                    chang.setAttribute('value', el.value);
877                }
878                var chan = new Event('change');
879                chang.dispatchEvent(chan);
880            });
881        }
882    }
883        if(inactive != null) {
884            for(var i = 0; i < inactive.length; i++) {
885
886                var input = inactive[i].querySelectorAll('input'),
887                    select = inactive[i].querySelectorAll('select'),
888                    textarea = inactive[i].querySelectorAll('textarea');
889
890                if(inactive[i].hasAttribute('data-input')) {
891                    inactive[i].ondragend = function(e) {
892                        e.target.parentNode.parentNode.querySelector('.hidden-input').value = 'Y'; 
893                        searchParent(e.target);				
894                    }
895                }
896
897                if(input != null) {
898                    for(var k = 0; k < input.length; k++) {
899                        var data = input[k];
900
901                        
902
903                        if(data.hasAttribute('data-property-checkbox')) {
904                            var dataCheck = data.getAttribute('data-property-checkbox');
905                                data.addEventListener('input', function(e) {
906                                    var el = e.target,
907                                        elHidden = el.parentNode.querySelector('.hidden-input');
908
909                                    if(el.checked) {
910                                        el.value = 'Y';
911                                        el.setAttribute('value', 'Y');
912                                        el.setAttribute('checked', 'checked');
913                                    } else {
914                                        el.value = 'N';
915                                        el.setAttribute('value', 'N');
916                                        el.removeAttribute('checked')
917                                    }
918                                    
919                                    if(elHidden != null) {
920                                        elHidden.value = 'Y'; 
921                                        elHidden.setAttribute('value', 'Y');                                                                       
922                                    }
923                                    searchParent(el);
924                                });
925                        }
926
927                        if(data.hasAttribute('data-entity')) {
928                            if(data.getAttribute('data-entity')) {
929
930                                var btn = data.parentNode.querySelector('input[type="button"]');
931                                if(btn != null) {
932                                    btn.addEventListener('click', function(e) {
933                                        var el = e.target;
934                                        var hidden = el.parentNode.parentNode.querySelector('.hidden-input');
935                                        hidden.value = "Y";
936                                        hidden.setAttribute('value', 'Y');
937                                        searchParent(el);
938                                    });
939                                }
940                            }
941                        }
942
943                        if(data.hasAttribute('data-datetime')) {
944                            if(data.getAttribute('data-datetime') == 'inactive-public') {
945                                data.addEventListener('click', function(e) {
946                                    data.classList.remove("sf4_property_inactive");
947                                })
948                                inactiveMode(data);
949                            }
950                        }
951                    }
952                }
953            }
954        }
955
956
957        if(list != null) {
958            for(var k = 0; k < list.length; k++) {
959                var listOne = list[k];
960                
961                if(listOne.hasAttribute('data-list')) {
962                    switch(listOne.getAttribute('data-list')) {
963                        case 'public-button':
964                            imageAction(listOne, true);
965                            break;
966                        case 'public-button-radio':
967                            imageAction(listOne, true);
968                            break;
969                        case 'public-image-list-one':
970                            imageAction(listOne);
971                        break;
972                        case 'public-image-list-multi':
973                            imageAction(listOne);
974                            break;                  
975                    }
976                }
977
978                if(listOne.hasAttribute('data-number')) {
979                    switch(listOne.getAttribute('data-number')) {
980                        case 'public-one':
981                            
982                            listOne.addEventListener('input', function(e) {
983                                var chang = e.target.nextElementSibling;
984                                chang.setAttribute('value', e.target.value);
985                                chang.setAttribute('checked', 'checked')
986                                var chan = new Event('change');
987                                chang.dispatchEvent(chan);
988                            });
989                            break;
990                    }
991                }
992            }
993        }
994
995        function addField(e) {
996            var btn = e.target,
997                container = btn.parentNode;
998            if(container != null) {
999                var el = container.querySelectorAll("*");
1000                var propContainerElement = btn.parentNode.parentNode.querySelectorAll('*');
1001                var input = [],
1002                    entity = [],
1003                    string = [],
1004                    text = [],
1005                    number = [],
1006                    phone = [],
1007                    url = [],
1008                    link = [],
1009                    date = [];
1010
1011                for(var i = 0; i < el.length; i++) {
1012                    if(el[i].hasAttribute('data-property-field')) {
1013                        switch(el[i].getAttribute('data-property-field')) {
1014                            case 'entity':
1015                                entity.push(el[i]);
1016                                break;
1017                            case 'string':
1018                                string.push(el[i]);
1019                                break;
1020                            case 'text':
1021                                text.push(el[i]);
1022                                break;
1023                            case 'number':
1024                                number.push(el[i]);
1025                                break;
1026                            case 'phone':
1027                                phone.push(el[i]);
1028                                break;
1029                            case 'url':
1030                                url.push(el[i]);
1031                                break;
1032                            /*case 'link':
1033                                link.push(el[i]);
1034                                break;*/
1035                            case 'date':
1036                                date.push(el[i]);
1037                                break;
1038                        }
1039                    }
1040                }
1041                for(var k = 0; k < propContainerElement.length; k++) {
1042                    if(propContainerElement[k].hasAttribute('data-property-field')) {
1043                        switch(propContainerElement[k].getAttribute('data-property-field')) {
1044                            case 'link':
1045                                link.push(propContainerElement[k]);
1046                                break;
1047                        }
1048                    }
1049                }
1050                if(entity.length != 0) addEntity(entity, e);
1051                if(text.length != 0) addText(text, e);
1052                if(string.length != 0) addString(string, e);
1053                if(number.length != 0) addString(number, e);
1054                if(phone.length != 0) addString(phone, e);
1055                if(url.length != 0) addString(url, e);
1056                if(link.length != 0) addStringLink(link, e);
1057                if(date.length != 0) addDate(date, e);
1058            }
1059        }
1060        
1061        function inactiveMode(input) {
1062
1063
1064            input.addEventListener('input', function(e) {
1065                var el = e.target;
1066                el.parentNode.parentNode.querySelector('.hidden-input').value = 'Y'; 
1067                searchParent(el);
1068            });
1069
1070            input.addEventListener('change', function(e) {
1071                var el = e.target;            
1072                el.parentNode.parentNode.querySelector('.hidden-input').value = 'Y'; 					
1073                searchParent(el);
1074            });
1075        }
1076
1077        function imageAction(input, active) {
1078            input.addEventListener('click', function(e) {
1079                var el = e.target;
1080                var radio = el.parentNode.parentNode.querySelectorAll('input');
1081                
1082
1083                var chang = el.nextElementSibling;
1084                if(isTrue(chang))
1085                    var par = chang.parentNode.parentNode.querySelectorAll('.radio-ch
1085ange');
1086                else {
1087                    chang = el.parentNode.parentNode.querySelector('.radio-change');
1088                    par = el.parentNode.parentNode.querySelectorAll('.radio-change');
1089                }
1090
1091                var checkedValue = '';
1092
1093                for(var k = 0; k < radio.length; k++) {
1094                    if(radio[k].checked && radio.length == 1) {
1095                        checkedValue += radio[k].value
1096                    } else if(radio[k].checked && radio.length > 1) {
1097                        checkedValue += radio[k].value;
1098                    }
1099                }
1100
1101                par[0].setAttribute('value', checkedValue)
1102
1103                chang.setAttribute('checked', 'checked')
1104                
1105
1106                var chan = new Event('change');
1107                chang.dispatchEvent(chan);
1108                par[0].dispatchEvent(chan)
1109                chang.setAttribute('value', el.value);
1110
1111
1112                if(input.type == 'radio') {
1113                    for(var k = 0; k < radio.length; k++) {
1114                        radio[k].checked = false;
1115                        radio[k].removeAttribute('checked');
1116                        if(active) radio[k].parentNode.classList.remove('active');   
1117                    }
1118                    el.checked = true;
1119                    el.setAttribute('checked', '');
1120                    if(active) el.parentNode.classList.add('active');
1121                } else if(input.type == 'checkbox') {
1122                    if(!el.checked) {
1123                        el.checked = false;
1124                        el.removeAttribute('checked');
1125                        if(active) el.parentNode.classList.remove('active');
1126                    } else {
1127                        el.checked = true;
1128                        el.setAttribute('checked', '');
1129                        if(active) el.parentNode.classList.add('active');
1130                    }
1131                }
1132            });
1133        }
1134
1135        function searchParent(el) {
1136            if(el != null && el.tagName != 'BODY') {
1137                if(!el.parentNode.classList.contains('sf4_property_inactive')) searchParent(el.parentNode);
1138                else el.parentNode.classList.remove('sf4_property_inactive');
1139            }
1140        }
1141        
1142        function rand() {
1143            return Math.random() * (500000000000000000 - 50000000000000000) + 50000000000000000;
1144        }
1145
1146        function addStringLink(link, e) {
1147            var btnContainer = document.createElement('div');
1148            btnContainer.className = e.currentTarget.parentNode.getAttribute('class');
1149            var endClone = link[link.length - 1].cloneNode(true),
1150                btnClone = e.currentTarget.cloneNode(true),
1151                input = endClone.querySelectorAll('input'),
1152                name = [];
1153            if(input) {
1154                for(var k = 0; k < input.length; k++) name.push(input[k].name);
1155                for(var k = 0; k < input.length; k++) {
1156                    input[k].value = '';
1157                    input[k].name = fieldIncrementName(name[k], link);
1158                    input[k].removeAttribute('required');
1159                }
1160                btnClone.onclick = function(ev) {
1161                    addField(ev);
1162                }
1163                btnContainer.appendChild(btnClone);
1164                link.push(endClone);
1165                link.push(btnContainer);
1166                var parent = link[0].parentNode;
1167                parent.innerHTML = '';
1168                for(var i = 0; i < link.length; i++) parent.appendChild(link[i]);
1169            }
1170        }
1171
1172        function addString(string, e) {
1173            var endClone = string[string.length - 1].cloneNode(true),
1174                btnClone = e.target.cloneNode(true),
1175                input = endClone.querySelectorAll('input'),
1176                name = input[0].name;
1177                btnClone.onclick = function(e) {
1178                    addField(e);
1179                }
1180                if(input == null)
1181                    input = endClone.querySelectorAll('textarea');
1182                input[0].value = '';
1183                input[0].name = nameReplace(name, string);
1184                input[0].removeAttribute('required');
1185
1186                if(input[0].hasAttribute('data-phone')) {
1187                    var id = 'phone_mask_' + rand();
1188                    input[0].id = id;
1189                    id = '#' + id;
1190
1191                    jQuery(function($) {
1192                        $(id).mask('+9 (999) 999-9999');
1193                    });
1194                }
1195
1196                if(input[0].hasAttribute('data-url')) {
1197                    var id = rand();
1198                    input[0].id = id;
1199                    var btn = input[1];
1200                    if(btn != null) {
1201                        btn.addEventListener('click', function(e) {
1202                                BX.adminShowMenu(this, [
1203                                    {'TEXT':'Site directory','TITLE':'#SITE_DIR# - Site directory','ONCLICK':'SF.SFSetUrlVar(\'#
1203SITE_DIR#\', \''+ id + '\')'},
1204                                    {'SEPARATOR':true},
1205                                    {'TEXT':'Storage id','TITLE':'#STORAGE_ID# - Storage id','ONCLICK':'SF.SFSetUrlVar(\'#STORAGE_ID#\', \''+ id + '\')'},
1206                                    {'TEXT':'Section id','TITLE':'#SECTION_ID# - Section id','ONCLICK':'SF.SFSetUrlVar(\'#SECTION_ID#\', \''+ id + '\')'},
1207                                    {'TEXT':'Item id','TITLE':'#ITEM_ID# - Item id','ONCLICK':'SF.SFSetUrlVar(\'#ITEM_ID#\', \''+ id + '\')'}], ''
1208                                );
1209                            });
1210                    }
1211                }
1212                
1213                string.push(endClone);
1214                string.push(btnClone);
1215                var parent = string[0].parentNode;
1216                parent.innerHTML = '';
1217                for(var i = 0; i < string.length; i++) parent.appendChild(string[i]);
1218        }
1219
1220        function addDate(date, e) {
1221            var endClone = date[date.length - 1].cloneNode(true),
1222                btnClone = e.target.cloneNode(true);
1223                var input = endClone.querySelectorAll('input'),
1224                name = input[0].name;
1225                btnClone.onclick = function(e) {
1226                    addField(e);
1227                }
1228                input[0].value = '';
1229                input[0].name = nameReplace(name, date);
1230                input[0].removeAttribute('required');
1231                date.push(endClone);
1232                date.push(btnClone);
1233                var parent = date[0].parentNode;
1234                parent.innerHTML = '';
1235                for(var i = 0; i < date.length; i++) parent.appendChild(date[i]);
1236
1237                jQuery(function($) {
1238                    $('input[name="' + input[0].name + '"]').flatpickr({
1239                        dateFormat: "d.m.Y",
1240                        allowInput: true,
1241                        locale: 'ru',
1242                    });
1243                });
1244        }
1245
1246        function addText(text, e) {
1247            var endClone = text[text.length - 1].cloneNode(true),
1248                btnClone = e.target.cloneNode(true),
1249                textArea = endClone.querySelectorAll('textarea'),
1250                name = textArea[0].name;
1251                btnClone.onclick = function(e) {
1252                    addField(e);
1253                }
1254                var newText = document.createElement('textarea'),
1255                    conText = document.createElement('div');
1256                conText.className = 'form-group';
1257                conText.setAttribute('data-property-field', 'text');
1258                newText.name = nameReplace(name, text);
1259                newText.className = 'form-control';
1260                newText.removeAttribute('required');
1261                newText.rows = textArea[0].rows;
1262                newText.cols = textArea[0].cols;
1263                conText.appendChild(newText);  
1264                text.push(conText);
1265                text.push(btnClone);
1266                var parent = text[0].parentNode;
1267                parent.innerHTML = '';
1268                for(var i = 0; i < text.length; i++) parent.appendChild(text[i]);
1269        }
1270
1271        function nameReplace(name, text) {
1272            /*var startIndex = name.indexOf('[n', 0);
1273            var length = 2;
1274            if (startIndex < 0) {
1275                startIndex = name.indexOf('[', 0);
1276                length = 1;
1277            }
1278
1279            if(text.length > 11) {
1280                var index = name.substr(startIndex + length, 2);
1281                var name = name.substr(0, name.length - 3);
1282            }
1283            else {
1284                var index = name.substr(startIndex + length, 1);
1285                var name = name.substr(0, name.length - 2);
1286            }
1287            
1288            name += (Number(index)) + rand() + ']';*/
1289            
1290            var name_arr = name.split('[n');
1291            var n_index = name_arr.pop();
1292            if (n_index && name_arr.length > 0)
1293            {
1294                n_index = '0' + n_index.replace(/\D+/g,"");
1295                n_index = parseInt(n_index);
1296                n_index ++;
1297                name = name_arr.join('[n');
1298                name += '[n' +  n_index + ']';
1299            }
1300            else
1301            {
1302                var name_arr = name.split('[');
1303                name_arr.pop();
1304                name = name_arr.join('[');
1305                name += '[n0]';
1306            }
1307            
1308            return name;
1309        }
1310
1311        function fieldIncrementName(name, text) {
1312            var limit = name.substr(name.indexOf('[n', 0) + 2),
1313                index = name.substr(name.indexOf('[n', 0) + 2, limit.length - 2),
1314                name = name.substr(0, name.indexOf('[n', 0) + 2);
1315            index++;
1316            return name + index + '1]';
1317        }
1318
1319        function addEntity(entity, e) {
1320            var cI = entity[entity.length - 1].cloneNode(true),
1321                cB = e.target.cloneNode(true),
1322                inp = cI.querySelectorAll('input'),
1323                id = inp[0].id,
1324                btn = inp[1].getAttribute('onclick'),
1325                name = inp[0].name,
1326                randId = rand();
1327
1328            cB.onclick = function(e) {
1329                addField(e);
1330            }
1331            btn = btn.replace(id, randId);
1332            inp[0].value = '';
1333            inp[0].name = nameReplace(name, entity);
1334            inp[0].setAttribute('id', randId);
1335            inp[1].setAttribute('onclick', btn);
1336            entity.push(cI);
1337            entity.push(cB);
1338            var parent = entity[0].parentNode;
1339            parent.innerHTML = '';
1340            for(var j = 0; j < entity.length; j++) parent.appendChild(entity[j]);
1341        }
1342
1343
1344    // #region Link
1345    
1346        var link = document.body.querySelectorAll('.container-link');
1347        for(var k = 0; k < link.length; k++) {
1348            var container = link[k].querySelectorAll('.property_link');
1349            for(var w = 0; w < container.length; w++) {
1350                var input = container[w].querySelectorAll('input');
1351                var select = container[w].querySelector('select');
1352                for(var h = 0; h < input.length; h++) {
1353                    if(input[h].hasAttribute('data-protocol')) {
1354                        deleteSpace(input[h]);
1355                        replaiceProtocol(select, input[h]);
1356                        identifyProtocol(input[h]);
1357                    }
1358                }
1359            }
1360        }
1361
1362       /* window.addEventListener('click', function(e) {
1363            var el = e.target;
1364            if(el.oninput != null)
1365                identifyProtocol(el);
1366            if(el.hasAttribute('data-protocol'))
1367                identifyProtocol(el);
1368        });*/
1369
1370        function deleteSpace(input) {
1371            var str = '';                
1372            for(var s = 0; s < input.value.length; s++) if(input.value[s] != ' ') str += input.value[s];
1373            input.value = str;
1374        }
1375
1376        function identifyProtocol(el) {
1377            if(el.hasAttribute('data-protocol')) { 
1378                var input = el;
1379                var select = el.parentNode.querySelector('select');
1380                if(input != null) {
1381                    if(input.hasAttribute('data-protocol')) {
1382                        el.elSelect = select;
1383                        select.elInput = el;
1384                        el.oninput = function(e) {
1385                            let input = e.currentTarget;
1386                            replaiceProtocol(input.elSelect, input);
1387                        }
1388                        select.addEventListener('change', function(e) {
1389                            var sel = e.currentTarget;
1390                            replaiceProtocol(sel, sel.elInput);
1391                        })
1392                    }
1393                }
1394            }
1395        }
1396
1397        function replaiceProtocol(select, input) {
1398            deleteSpace(input);
1399            var fullLink = select.parentNode.querySelector('input[data-link-full=""]');
1400            for(var j = 0; j < select.options.length; j++) {
1401                var options = select.options[j];
1402                if(input.value.substring(0, options.value.length) == options.value) {
1403                    select.selectedIndex = j;
1404                    input.value = input.value.substring(options.value.length, input.value.length);
1405                    select.options[j].setAttribute('selected', '');
1406                    select.options[j].selected = true;
1407                } else if(input.value.substring(0, 1) === '/') {
1408                    select.selectedIndex = 2;
1409                    select.options[2].selected = true;
1410                    select.options[2].setAttribute('selected', '');
1411                } else if(input.value.substring(0, options.value.length) === './') {
1412                    select.selectedIndex = 3;
1413                    select.options[3].selected = true;
1414                    select.options[3].setAttribute('selected', '');
1415                } else if(input.value.substring(0, options.value.length) === '../') {
1416                    select.selectedIndex = 4;
1417                    select.options[4].selected = true;
1418                    select.options[4].setAttribute('selected', '');
1419                }
1420            }
1421            if(input.value != "") fullLink.value = setFullLink(select) + input.value;
1422            else fullLink.value = '';
1423        }
1424
1425        function setFullLink(select) {
1426            for(var k = 0; k < select.options.length; k++) if(select.options[k].selected) return select.options[k].value;
1427            return false;
1428        }
1429
1430        if(isTrue(cond)) {
1431            for(var k = 0; k < cond.length; k++) {
1432                var el = cond[k],
1433                    event = new Event('change');
1434                el.dispatchEvent(event);
1435            }
1436        }
1437
1438    // #endregion Link
1439
1440    SF.SFSetUrlVar = function(id, el_id) {
1441    var obj_ta = BX(el_id);
1442    //IE
1443    if (document.selection) {
1444        obj_ta.focus();
1445        var sel = document.selection.createRange();
1446        sel.text = id;
1447        //var range = obj_ta.createTextRange();
1448        //range.move('character', caretPos);
1449        //range.select();
1450    }
1451    //FF
1452    else if (obj_ta.selectionStart || obj_ta.selectionStart == '0')
1453    {
1454        var startPos = obj_ta.selectionStart;
1455        var endPos = obj_ta.selectionEnd;
1456        var caretPos = startPos + id.length;
1457        obj_ta.value = obj_ta.value.substring(0, startPos) + id + obj_ta.value.substring(endPos, obj_ta.value.length);
1458        obj_ta.setSelectionRange(caretPos, caretPos);
1459        obj_ta.focus();
1460    }
1461    else
1462    {
1463        obj_ta.value += id;
1464        obj_ta.focus();
1465    }
1466
1467    BX.fireEvent(obj_ta, 'change');
1468    obj_ta.focus();
1469}
1470
1471
1472'use strict';
1473
1474;( function ( document, window, index ) {
1475    var inputs = document.querySelectorAll( '[data-file=""]' );
1476    
1477    Array.prototype.forEach.call( inputs, function( input )
1478    {
1479        var label	 = input.nextElementSibling,
1480            labelVal = label.innerHTML;
1481
1482        input.addEventListener( 'change', function(e) {  
1483            var fileName = '';
1484            if( this.files && this.files.length > 1 )
1485                fileName = ( this.getAttribute( 'data-multiple-caption' ) || '' ).replace( '{count}', this.files.length );
1486            else fileName = e.target.value.split( '\\' ).pop();
1487
1488            if( fileName ) {
1489                if(fileName.length > 16)
1490                    label.querySelector( 'span' ).innerHTML = fileName.slice(0, 16) + '...';
1491                else label.querySelector( 'span' ).innerHTML = fileName;
1492            }
1493            else label.innerHTML = labelVal;
1494
1495            // Для свойств
1496            var el = e.target;
1497            if(el.hasAttribute('data-inactive'))
1498                el.parentNode.parentNode.classList.remove('sf4_property_inactive')
1499        });
1500
1501        // Firefox bug fix
1502        input.addEventListener( 'focus', function(){ input.classList.add( 'has-focus' ); });
1503        input.addEventListener( 'blur', function(){ input.classList.remove( 'has-focus' ); });
1504    });
1505}( document, window, 0 ));
1506
1507
1508};
1509
1510
1511try {
1512    property();
1513} catch(error) {
1514    window.addEventListener('DOMContentLoaded', function(e) {
1515        property();
1516    });
1517}
1518
1519
1520
1521
1522
1523SF.send = function(event, element) {
1524    if(document.createEvent){
1525        var e = document.createEvent('Events');
1526        e.initEvent(event, true, false);
1527    }
1528    else if(document.createEventObject()) {
1529        var e = document.createEventObject();
1530    }
1531    else return;
1532
1533    if(element.dispatchEvent)
1534        element.dispatchEvent(e);
1535    else if(element.fireEvent) element.fireEvent(event, e);
1536}
1537
1538SF.receive = function(event, el, handler) {
1539    if(window.addEventListener)
1540        el.addEventListener(event, handler, false);
1541    else if(window.attachEvent)
1542        el.attachEvent(event, handler);
1543}
1544
1545SF.receive('open-setting', window, property);
1546
1547
1548/* End */
1549;
1550; /* Start:"a:4:{s:4:"full";s:54:"/simai/asset/mask/js/jquery.mask.min.js?17133513648185";s:6:"source";s:39:"/simai/asset/mask/js/jquery.mask.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
1551// jQuery Mask Plugin v1.14.15
1552// github.com/igorescobar/jQuery-Mask-Plugin
1553var $jscomp={scope:{},findInternal:function(a,l,d){a instanceof String&&(a=String(a));for(var p=a.length,h=0;h<p;h++){var b=a[h];if(l.call(d,b,h,a))return{i:h,v:b}}return{i:-1,v:void 0}}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(a,l,d){if(d.get||d.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[l]=d.value)};
1554$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(a,l,d,p){if(l){d=$jscomp.global;a=a.split(".");for(p=0;p<a.length-1;p++){var h=a[p];h in d||(d[h]={});d=d[h]}a=a[a.length-1];p=d[a];l=l(p);l!=p&&null!=l&&$jscomp.defineProperty(d,a,{configurable:!0,writable:!0,value:l})}};
1555$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,d){return $jscomp.findInternal(this,a,d).v}},"es6-impl","es3");
1556(function(a,l,d){"function"===typeof define&&define.amd?define(["jquery"],a):"object"===typeof exports?module.exports=a(require("jquery")):a(l||d)})(function(a){var l=function(b,e,f){var c={invalid:[],getCaret:function(){try{var a,r=0,g=b.get(0),e=document.selection,f=g.selectionStart;if(e&&-1===navigator.appVersion.indexOf("MSIE 10"))a=e.createRange(),a.moveStart("character",-c.val().length),r=a.text.length;else if(f||"0"===f)r=f;return r}catch(C){}},setCaret:function(a){try{if(b.is(":focus")){var c,
1557g=b.get(0);g.setSelectionRange?g.setSelectionRange(a,a):(c=g.createTextRange(),c.collapse(!0),c.moveEnd("character",a),c.moveStart("character",a),c.select())}}catch(B){}}
vendor: 4,309 bytes, lines 1557-1565
1557,events:function(){b.on("keydown.mask",function(a){b.data("mask-keycode",a.keyCode||a.which);b.data("mask-previus-value",b.val());b.data("mask-previus-caret-pos",c.getCaret());c.maskDigitPosMapOld=c.maskDigitPosMap}).on(a.jMaskGlobals.useInput?"input.mask":"keyup.mask",c.behaviour).on("paste.mask drop.mask",function(){setTimeout(function(){b.keydown().keyup()},
1558100)}).on("change.mask",function(){b.data("changed",!0)}).on("blur.mask",function(){d===c.val()||b.data("changed")||b.trigger("change");b.data("changed",!1)}).on("blur.mask",function(){d=c.val()}).on("focus.mask",function(b){!0===f.selectOnFocus&&a(b.target).select()}).on("focusout.mask",function(){f.clearIfNotMatch&&!h.test(c.val())&&c.val("")})},getRegexMask:function(){for(var a=[],b,c,f,n,d=0;d<e.length;d++)(b=m.translation[e.charAt(d)])?(c=b.pattern.toString().replace(/.{1}$|^.{1}/g,""),f=b.optional,
1559(b=b.recursive)?(a.push(e.charAt(d)),n={digit:e.charAt(d),pattern:c}):a.push(f||b?c+"?":c)):a.push(e.charAt(d).replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"));a=a.join("");n&&(a=a.replace(new RegExp("("+n.digit+"(.*"+n.digit+")?)"),"($1)?").replace(new RegExp(n.digit,"g"),n.pattern));return new RegExp(a)},destroyEvents:function(){b.off("input keydown keyup paste drop blur focusout ".split(" ").join(".mask "))},val:function(a){var c=b.is("input")?"val":"text";if(0<arguments.length){if(b[c]()!==a)b[c](a);
1560c=b}else c=b[c]();return c},calculateCaretPosition:function(){var a=b.data("mask-previus-value")||"",e=c.getMasked(),g=c.getCaret();if(a!==e){var f=b.data("mask-previus-caret-pos")||0,e=e.length,d=a.length,m=a=0,h=0,l=0,k;for(k=g;k<e&&c.maskDigitPosMap[k];k++)m++;for(k=g-1;0<=k&&c.maskDigitPosMap[k];k--)a++;for(k=g-1;0<=k;k--)c.maskDigitPosMap[k]&&h++;for(k=f-1;0<=k;k--)c.maskDigitPosMapOld[k]&&l++;g>d?g=10*e:f>=g&&f!==d?c.maskDigitPosMapOld[g]||(f=g,g=g-(l-h)-a,c.maskDigitPosMap[g]&&(g=f)):g>f&&
1561(g=g+(h-l)+m)}return g},behaviour:function(f){f=f||window.event;c.invalid=[];var e=b.data("mask-keycode");if(-1===a.inArray(e,m.byPassKeys)){var e=c.getMasked(),g=c.getCaret();setTimeout(function(){c.setCaret(c.calculateCaretPosition())},a.jMaskGlobals.keyStrokeCompensation);c.val(e);c.setCaret(g);return c.callbacks(f)}},getMasked:function(a,b){var g=[],d=void 0===b?c.val():b+"",n=0,h=e.length,q=0,l=d.length,k=1,r="push",p=-1,t=0,y=[],v,z;f.reverse?(r="unshift",k=-1,v=0,n=h-1,q=l-1,z=function(){return-1<
1562n&&-1<q}):(v=h-1,z=function(){return n<h&&q<l});for(var A;z();){var x=e.charAt(n),w=d.charAt(q),u=m.translation[x];if(u)w.match(u.pattern)?(g[r](w),u.recursive&&(-1===p?p=n:n===v&&n!==p&&(n=p-k),v===p&&(n-=k)),n+=k):w===A?(t--,A=void 0):u.optional?(n+=k,q-=k):u.fallback?(g[r](u.fallback),n+=k,q-=k):c.invalid.push({p:q,v:w,e:u.pattern}),q+=k;else{if(!a)g[r](x);w===x?(y.push(q),q+=k):(A=x,y.push(q+t),t++);n+=k}}d=e.charAt(v);h!==l+1||m.translation[d]||g.push(d);g=g.join("");c.mapMaskdigitPositions(g,
1563y,l);return g},mapMaskdigitPositions:function(a,b,e){a=f.reverse?a.length-e:0;c.maskDigitPosMap={};for(e=0;e<b.length;e++)c.maskDigitPosMap[b[e]+a]=1},callbacks:function(a){var h=c.val(),g=h!==d,m=[h,a,b,f],q=function(a,b,c){"function"===typeof f[a]&&b&&f[a].apply(this,c)};q("onChange",!0===g,m);q("onKeyPress",!0===g,m);q("onComplete",h.length===e.length,m);q("onInvalid",0<c.invalid.length,[h,a,b,c.invalid,f])}};b=a(b);var m=this,d=c.val(),h;e="function"===typeof e?e(c.val(),void 0,b,f):e;m.mask=
1564e;m.options=f;m.remove=function(){var a=c.getCaret();m.options.placeholder&&b.removeAttr("placeholder");b.data("mask-maxlength")&&b.removeAttr("maxlength");c.destroyEvents();c.val(m.getCleanVal());c.setCaret(a);return b};m.getCleanVal=function(){return c.getMasked(!0)};m.getMaskedVal=function(a){return c.getMasked(!1,a)};m.init=function(d){d=d||!1;f=f||{};m.clearIfNotMatch=a.jMaskGlobals.clearIfNotMatch;m.byPassKeys=a.jMaskGlobals.byPassKeys;m.translation=a.extend({},a.jMaskGlobals.translation,f.translation);
1565m=a.extend(!0,{},m,f);h=c.getRegexMask();if(d)c.events(),c.val(c.getMasked());else{f.placeholder&&b.attr("placeholder",f.placeholder);b.data("mask")&&b.attr("autocomplete","off");d=0;for(var l=!0;d<e.length;d++){var g=m.translation[e.charAt(d)];if(g&&g.recursive){l=!1;break}}l&&b.attr("maxlength",e.length).data("mask-maxlength",!0);c.destroyEvents();c.events();d=c.getCaret();c.val(c.getMasked());
1565c.setCaret(d)}};m.init(!b.is("input"))};a.maskWatchers={};var d=function(){var b=a(this),e={},f=b.attr("data-mask");
1566b.attr("data-mask-reverse")&&(e.reverse=!0);b.attr("data-mask-clearifnotmatch")&&(e.clearIfNotMatch=!0);"true"===b.attr("data-mask-selectonfocus")&&(e.selectOnFocus=!0);if(p(b,f,e))return b.data("mask",new l(this,f,e))},p=function(b,e,f){f=f||{};var c=a(b).data("mask"),d=JSON.stringify;b=a(b).val()||a(b).text();try{return"function"===typeof e&&(e=e(b)),"object"!==typeof c||d(c.options)!==d(f)||c.mask!==e}catch(t){}},h=function(a){var b=document.createElement("div"),d;a="on"+a;d=a in b;d||(b.setAttribute(a,
1567"return;"),d="function"===typeof b[a]);return d};a.fn.mask=function(b,d){d=d||{};var e=this.selector,c=a.jMaskGlobals,h=c.watchInterval,c=d.watchInputs||c.watchInputs,t=function(){if(p(this,b,d))return a(this).data("mask",new l(this,b,d))};a(this).each(t);e&&""!==e&&c&&(clearInterval(a.maskWatchers[e]),a.maskWatchers[e]=setInterval(function(){a(document).find(e).each(t)},h));return this};a.fn.masked=function(a){return this.data("mask").getMaskedVal(a)};a.fn.unmask=function(){clearInterval(a.maskWatchers[this.selector]);
1568delete a.maskWatchers[this.selector];return this.each(function(){var b=a(this).data("mask");b&&b.remove().removeData("mask")})};a.fn.cleanVal=function(){return this.data("mask").getCleanVal()};a.applyDataMask=function(b){b=b||a.jMaskGlobals.maskElements;(b instanceof a?b:a(b)).filter(a.jMaskGlobals.dataMaskAttr).each(d)};h={maskElements:"input,td,span,div",dataMaskAttr:"*[data-mask]",dataMask:!0,watchInterval:300,watchInputs:!0,keyStrokeCompensation:10,useInput:!/Chrome\/[2-4][0-9]|SamsungBrowser/.test(window.navigator.userAgent)&&
1569h("input"),watchDataMask:!1,byPassKeys:[9,16,17,18,36,37,38,39,40,91],translation:{0:{pattern:/\d/},9:{pattern:/\d/,optional:!0},"#":{pattern:/\d/,recursive:!0},A:{pattern:/[a-zA-Z0-9]/},S:{pattern:/[a-zA-Z]/}}};a.jMaskGlobals=a.jMaskGlobals||{};h=a.jMaskGlobals=a.extend(!0,{},h,a.jMaskGlobals);h.dataMask&&a.applyDataMask();setInterval(function(){a.jMaskGlobals.watchDataMask&&a.applyDataMask()},h.watchInterval)},window.jQuery,window.Zepto);
1570
1571/* End */
1572;
1573; /* Start:"a:4:{s:4:"full";s:113:"/bitrix/templates/simai.framework/components/bitrix/main.userconsent.request/main/user_consent.js?178186526114059";s:6:"source";s:97:"/bitrix/templates/simai.framework/components/bitrix/main.userconsent.request/main/user_consent.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
1574;(function(){
1575
1576	function UserConsentControl (params)
1577	{
1578		this.caller = params.caller;
1579		this.formNode = params.formNode;
1580		this.controlNode = params.controlNode;
1581		this.inputNode = params.inputNode;
1582		this.config = params.config;
1583	}
1584	UserConsentControl.prototype = {
1585
1586	};
1587
1588	BX.UserConsent = {
1589		msg: {
1590			'title': 'MAIN_USER_CONSENT_REQUEST_TITLE',
1591			'btnAccept': 'MAIN_USER_CONSENT_REQUEST_BTN_ACCEPT',
1592			'btnReject': 'MAIN_USER_CONSENT_REQUEST_BTN_REJECT',
1593			'loading': 'MAIN_USER_CONSENT_REQUEST_LOADING',
1594			'errTextLoad': 'MAIN_USER_CONSENT_REQUEST_ERR_TEXT_LOAD'
1595		},
1596		events: {
1597			'save': 'main-user-consent-request-save',
1598			'refused': 'main-user-consent-request-refused',
1599			'accepted': 'main-user-consent-request-accepted'
1600		},
1601		current: null,
1602		autoSave: false,
1603		isFormSubmitted: false,
1604		isConsentSaved: false,
1605		savedConsentIds: {},
1606		attributeControl: 'data-bx-user-consent',
1607		load: function (context)
1608		{
1609			var item = this.find(context)[0];
1610			if (!item)
1611			{
1612				return null;
1613			}
1614		
1615			this.bind(item);
1616			return item;
1617		},
1618		loadAll: function (context, limit)
1619		{
1620			this.find(context, limit).forEach(this.bind, this);
1621		},
1622		loadFromForms: function ()
1623		{
1624			var formNodes = document.getElementsByTagName('FORM');
1625			formNodes = BX.convert.nodeListToArray(formNodes);
1626
1627
1628			let arr = [];
1629			formNodes.forEach(e => {
1630				if(e.id.includes('form-proverka-')){
1631					arr.push(e.id);
1632				}
1633			});
1634			if(arr.length > 1){
1635				for (let i = 0; i < formNodes.length; i++){
1636					if(formNodes[i].id == arr[0]){
1637						formNodes.splice(i, 1);
1638					}
1639				}
1640			}
1641		
1642
1643			formNodes.forEach(this.loadAll, this);
1644		},
1645		find: function (context)
1646		{
1647			if (!context)
1648			{
1649				return [];
1650			}
1651
1652			var controlNodes = context.querySelectorAll('[' + this.attributeControl + ']');
1653			controlNodes = BX.convert.nodeListToArray(controlNodes);
1654
1655			return controlNodes.map(this.createItem.bind(this, context)).filter(function (item) { return !!item });
1656		},
1657		bind: function (item)
1658		{
1659			if (item.config.submitEventName)
1660			{
1661				BX.addCustomEvent(item.config.submitEventName, this.onSubmit.bind(this, item));
1662			}
1663			else if(item.formNode)
1664			{
1665				BX.bind(item.formNode, 'submit', this.onSubmit.bind(this, item));
1666			}
1667			BX.bind(item.controlNode, 'click', this.onClick.bind(this, item));
1668		},
1669		createItem: function (context, controlNode)
1670		{
1671			var inputNode = controlNode.querySelector('input[type="checkbox"]');
1672			if (!inputNode)
1673			{
1674				return;
1675			}
1676
1677			try
1678			{
1679				var config = JSON.parse(controlNode.getAttribute(this.attributeControl));
1680				var parameters = {
1681					'formNode': null,
1682					'controlNode': controlNode,
1683					'inputNode': inputNode,
1684					'config': config
1685				};
1686
1687				if (context.tagName == 'FORM')
1688				{
1689					parameters.formNode = context;
1690				}
1691				else
1692				{
1693					parameters.formNode = BX.findParent(inputNode, {tagName: 'FORM'})
1694				}
1695
1696				parameters.caller = this;
1697				return new UserConsentControl(parameters);
1698			}
1699			catch (e)
1700			{
1701				return null;
1702			}
1703		},
1704		onClick: function (item, e)
1705		{
1706
1707			
1708			if (item.config.url)
1709			{
1710				return;
1711			}
1712			
1713
1714			this.requestForItem(item);
1715
1716			if(document.querySelectorAll('.main-user-consent-request-popup').length > 1){
1717				countPopup = 0;
1718				popupCurse = document.querySelectorAll('.main-user-consent-request-popup');
1719				popupCurse.forEach(element => {
1720					let style = element.getAttribute("style");
1721					if(style == ''){
1722						countPopup++
1723					}else{
1724						element.style.display = 'none';
1725					}
1726				});
1727				if(document.querySelectorAll('.main-user-consent-request-popup').length == countPopup){
1728						popupCurse[0].style.display = 'none';
1729				}
1730			}
1731
1732			e.preventDefault();
1733		},
1734		onSubmit: function (item, e)
1735		{
1736			this.isFormSubmitted = true;
1737			if (this.check(item))
1738			{
1739				return true;
1740			}
1741			else
1742			{
1743				if (e)
1744				{
1745					e.preventDefault();
1746				}
1747
1748				return false;
1749			}
1750		},
1751		check: function (item)
1752		{
1753			if (item.inputNode.checked)
1754			{
1755				this.saveConsent(item);
1756				return true;
1757			}
1758
1759			this.requestForItem(item);
1760			return false;
1761		},
1762		requestForItem: function (item)
1763		{
1764			this.setCurrent(item);
1765			this.requestConsent(
1766				item.config.id,
1767				{
1768					'sec': item.config.sec,
1769					'replace': item.config.replace
1770				},
1771				this.onAccepted,
1772				this.onRefused
1773			);
1774		},
1775		setCurrent: function (item)
1776		{
1777			this.current = item;
1778			this.autoSave = item.config.autoSave;
1779			this.actionRequestUrl = item.config.actionUrl;
1780		},
1781		getConsentSaveKey: function (item)
1782		{
1783			return item && item.config ? String(item.config.id) : '';
1784		},
1785		isItemConsentSaved: function (item)
1786		{
1787			return !!this.savedConsentIds[this.getConsentSaveKey(item)];
1788		},
1789		markItemConsentSaved: function (item)
1790		{
1791			this.savedConsentIds[this.getConsentSaveKey(item)] = true;
1792		},
1793		onAccepted: function ()
1794		{
1795			if (!this.current)
1796			{
1797				return;
1798			}
1799
1800			var item = this.current;
1801			this.saveConsent(
1802				this.current,
1803				function ()
1804				{
1805					BX.onCustomEvent(item, this.events.accepted, []);
1806					BX.onCustomEvent(this, this.events.accepted, [item]);
1807
1808					this.markItemConsentSaved(item);
1809					this.isConsentSaved = true;
1810
1811					if (this.isFormSubmitted && item.formNode && !item.config.submitEventName)
1812					{
1813						BX.submit(item.formNode);
1814					}
1815				}
1816			);
1817
1818			this.current.inputNode.checked = true;
1819			this.current = null;
1820		},
1821		onRefused: function ()
1822		{
1823			BX.onCustomEvent(this.current, this.events.refused, []);
1824			BX.onCustomEvent(this, this.events.refused, [this.current]);
1825			this.current.inputNode.checked = false;
1826			this.current = null;
1827			this.isFormSubmitted = false;
1828		},
1829		initPopup: function ()
1830		{
1831			if (this.popup)
1832			{
1833				return;
1834			}
1835
1836
1837			this.popup = {
1838
1839			};
1840		},
1841		popup: {
1842			isInit: false,
1843			caller: null,
1844			nodes: {
1845				container: null,
1846				shadow: null,
1847				head: null,
1848				loader: null,
1849				content: null,
1850				textarea: null,
1851				buttonAccept: null,
1852				buttonReject: null
1853			},
1854			onAccept: function ()
1855			{
1856				this.hide();
1857				BX.onCustomEvent(this, 'accept', []);
1858			},
1859			onReject: function ()
1860			{
1861				this.hide();
1862				BX.onCustomEvent(this, 'reject', []);
1863			},
1864			init: function ()
1865			{
1866				if (this.isInit)
1867				{
1868					return true;
1869				}
1870
1871				var tmplNode = document.querySelector('script[data-bx-template]');
1872				if (!tmplNode)
1873				{
1874					return false;
1875				}
1876
1877				var popup = document.createElement('DIV');
1878				popup.innerHTML = tmplNode.innerHTML;
1879				popup = popup.children[0];
1880				if (!popup)
1881				{
1882					return false;
1883				}
1884				document.body.insertBefore(popup, document.body.children[0]);
1885
1886				this.isInit = true;
1887				this.nodes.container = popup;
1888				this.nodes.shadow = this.nodes.container.querySelector('[data-bx-shadow]');
1889				this.nodes.head = this.nodes.container.querySelector('[data-bx-head]');
1890				this.nodes.loader = this.nodes.container.querySelector('[data-bx-loader]');
1891				this.nodes.content = this.nodes.container.querySelector('[data-bx-content]');
1892				this.nodes.textarea = this.nodes.container.querySelector('[data-bx-textarea]');
1893
1894				this.nodes.link = this.nodes.container.querySelector('[data-bx-link]');
1895				this.nodes.linkA = this.nodes.link ? this.nodes.link.querySelector('a') : null;
1896
1897				this.nodes.buttonAccept = this.nodes.container.querySelector('[data-bx-btn-accept]');
1898				this.nodes.buttonReject = this.nodes.container.querySelector('[data-bx-btn-reject]');
1899				this.nodes.buttonAccept.textContent = BX.message(this.caller.msg.btnAccept);
1900				this.nodes.buttonReject.textContent = BX.message(this.caller.msg.btnReject);
1901				BX.bind(this.nodes.buttonAccept, 'click', this.onAccept.bind(this));
1902				BX.bind(this.nodes.buttonReject, 'click', this.onReject.bind(this));
1903
1904				return true;
1905			},
1906			setTitle: function (text)
1907			{
1908				if (!this.nodes.head)
1909				{
1910					return;
1911				}
1912				this.nodes.head.textContent = text;
1913			},
1914			setContent: function (text)
1915			{
1916				if (!this.nodes.textarea)
1917				{
1918					return;
1919				}
1920				this.nodes.textarea.innerHTML = text;
1921				this.nodes.textarea.style.display = '';
1922			},
1923			setUrl: function (url)
1924			{
1925				if (!this.nodes.link)
1926				{
1927					return;
1928				}
1929
1930				this.nodes.linkA.textContent = url;
1931				this.nodes.linkA.href = url;
1932
1933				this.nodes.link.style.display = '';
1934				this.nodes.textarea.style.display = 'none';
1935			},
1936			show: function (isContentVisible)
1937			{
1938				if (typeof isContentVisible == 'boolean')
1939				{
1940					this.nodes.loader.style.display = !isContentVisible ? '' : 'none';
1941					this.nodes.content.style.display = isContentVisible ? '' : 'none';
1942				}
1943
1944				this.nodes.container.style.display = '';
1945			},
1946			hide: function ()
1947			{
1948				this.nodes.container.style.display = 'none';
1949			}
1950		},
1951
1952		cache: {
1953			list: [],
1954			stringifyKey: function (key)
1955			{
1956				return BX.type.isString(key) ? key : JSON.stringify({'key': key});
1957			},
1958			set: function (key, data)
1959			{
1960				var item = this.get(key);
1961				if (item)
1962				{
1963					item.data = data;
1964				}
1965				else
1966				{
1967					this.list.push({
1968						'key': this.stringifyKey(key),
1969						'data': data
1970					});
1971				}
1972			},
1973			getData: function (key)
1974			{
1975				var item = this.get(key);
1976				return item ? item.data : null;
1977			},
1978			get: function (key)
1979			{
1980				key = this.stringifyKey(key);
1981				var filtered = this.list.filter(function (item) {
1982					return (item.key == key);
1983				});
1984				return (filtered.length > 0 ? filtered[0] : null);
1985			},
1986			has: function (key)
1987			{
1988				return !!this.get(key);
1989			}
1990		},
1991		stripHtml: function (text)
1992		{
1993			var tmp = document.createElement('DIV');
1994			tmp.innerHTML = String(text || '')
1995				.replace(/<br\s*\/?>/gi, "\n")
1996				.replace(/<\/p>/gi, "\n");
1997
1998			return (tmp.textContent || tmp.innerText || '')
1999				.replace(/\u00a0/g, ' ')
2000				.replace(/[ \t]+\n/g, "\n")
2001				.replace(/\n[ \t]+/g, "\n")
2002				.replace(/[ \t]{2,}/g, ' ')
2003				.trim();
2004		},
2005		normalizeConsentHtml: function (text)
2006		{
2007			return String(text || '')
2008				.replace(/&lt;br\s*\/?&gt;/gi, '<br>')
2009				.replace(/&lt;p&gt;/gi, '<p>')
2010				.replace(/&lt;\/p&gt;/gi, '</p>');
2011		},
2012		requestConsent: function (id, sendData, onAccepted, onRefused)
2013		{
2014			sendData = sendData || {};
2015			sendData.id = id;
2016
2017			var cacheHash = this.cache.stringifyKey(sendData);
2018
2019			if (!this.popup.isInit)
2020			{
2021				this.popup.caller = this;
2022				if (!this.popup.init())
2023				{
2024					return;
2025				}
2026
2027				BX.addCustomEvent(this.popup, 'accept', onAccepted.bind(this));
2028				BX.addCustomEvent(this.popup, 'reject', onRefused.bind(this));
2029			}
2030
2031			if (this.current && this.current.config.text)
2032			{
2033				this.cache.set(cacheHash, this.current.config.text);
2034			}
2035
2036
2037			if (this.current && this.current.config.url)
2038			{
2039				this.setTextToPopup('', this.current.config.url);
2040			}
2041			else if (this.cache.has(cacheHash))
2042			{
2043				this.setTextToPopup(this.cache.getData(cacheHash));
2044			}
2045			else
2046			{
2047				this.popup.setTitle(BX.message(this.msg.loading));
2048				this.popup.show(false);
2049				BX.ajax.runAction('main.agreement.get', {
2050					data: sendData,
2051				})
2052				.then((response) => {
2053					this.cache.set(cacheHash, this.normalizeConsentHtml(response.data.content.html || ''));
2054					this.setTextToPopup(this.cache.getData(cacheHash));
2055				})
2056				.catch(() => {
2057					this.popup.hide();
2058					alert(BX.message(this.msg.errTextLoad));
2059				})
2060		
2061			}
2062		},
2063		setTextToPopup: function (text, url)
2064		{
2065			// set title from a first line from text.
2066			var titleBar = '';
2067			var plainText = this.stripHtml(text);
2068			var textTitlePositions = [plainText.indexOf("\n"), plainText.indexOf(".")].filter(function (position) {
2069				return position >= 0;
2070			});
2071			var textTitlePos = textTitlePositions.length ? Math.min.apply(Math, textTitlePositions) : -1;
2072			if (textTitlePos >= 0 && textTitlePos <= 100)
2073			{
2074				titleBar = plainText.substr(0, textTitlePos).trim();
2075				titleBar  = titleBar.split(".").map(Function.prototype.call, String.prototype.trim).filter(String)[0];
2076			}
2077			this.popup.setTitle(titleBar ? titleBar : BX.message(this.msg.title));
2078			if (url)
2079			{
2080				this.popup.setUrl(url);
2081			}
2082			else
2083			{
2084				this.popup.setContent(text);
2085			}
2086			this.popup.show(true);
2087		},
2088		saveConsent: function (item, callback)
2089		{
2090			this.setCurrent(item);
2091
2092			var data = {
2093				'id': item.config.id,
2094				'sec': item.config.sec,
2095				'url': window.location.href
2096			};
2097			if (item.config.originId)
2098			{
2099				var originId = item.config.originId;
2100				if (item.formNode && originId.indexOf('%') >= 0)
2101				{
2102					var inputs = item.formNode.querySelectorAll('input[type="text"], input[type="hidden"]');
2103					inputs = BX.convert.nodeListToArray(inputs);
2104					inputs.forEach(function (input) {
2105						if (!input.name)
2106						{
2107							return;
2108						}
2109						originId = originId.replace('%' + input.name +  '%', input.value ? input.value : '');
2110					});
2111				}
2112				data.originId = originId;
2113			}
2114			if (item.config.originatorId)
2115			{
2116				data.originatorId = item.config.originatorId;
2117			}
2118
2119			BX.onCustomEvent(item, this.events.save, [data]);
2120			BX.onCustomEvent(this, this.events.save, [item, data]);
2121
2122			if (this.isItemConsentSaved(item) || !item.config.autoSave)
2123			{
2124				if (callback)
2125				{
2126					callback.apply(this, []);
2127				}
2128			}
2129			else
2130			{
2131				this.sendActionRequest(
2132					'saveConsent',
2133					data,
2134					callback,
2135					callback
2136				);
2137			}
2138		},
2139		sendActionRequest: function (action, sendData, callbackSuccess, callbackFailure)
2140		{
2141			callbackSuccess = callbackSuccess || null;
2142			callbackFailure = callbackFailure || null;
2143
2144			sendData.action = action;
2145			sendData.sessid = BX.bitrix_sessid();
2146			sendData.action = action;
2147
2148			BX.ajax({
2149				url: this.actionRequestUrl,
2150				method: 'POST',
2151				data: sendData,
2152				timeout: 10,
2153				dataType: 'json',
2154				processData: true,
2155				onsuccess: BX.proxy(function(data){
2156					data = data || {};
2157					if(data.error)
2158					{
2159						callbackFailure.apply(this, [data]);
2160					}
2161					else if(callbackSuccess)
2162					{
2163						callbackSuccess.apply(this, [data]);
2164					}
2165				}, this),
2166				onfailure: BX.proxy(function(){
2167					var data = {'error': true, 'text': ''};
2168					if (callbackFailure)
2169					{
2170						callbackFailure.apply(this, [data]);
2171					}
2172				}, this)
2173			});
2174		}
2175	};
2176
2177	BX.ready(function () {
2178		BX.UserConsent.loadFromForms();
2179	});
2180
2181
2182	
2183
2184})();
2185
2186/* End */
2187;; /* /bitrix/templates/simai.framework/components/bitrix/map.yandex.view/contacts/script.js?17133513821540*/
2188; /* /simai/asset/simai.property/ui/js/property.js?178785087816954*/
2189;
2189 /* /simai/asset/simai.property/sf4/js/script.js?178785087836366*/
2190; /* /simai/asset/mask/js/jquery.mask.min.js?17133513648185*/
2191; /* /bitrix/templates/simai.framework/components/bitrix/main.userconsent.request/main/user_consent.js?178186526114059*/

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.