Finished socket_fans, fixed bug with wrong piecewise approximation

This commit is contained in:
eddyem 2020-11-02 23:08:17 +03:00
parent f65617cca5
commit 80ec528155
46 changed files with 3537 additions and 97 deletions

View File

@ -91,21 +91,21 @@ int16_t getNTC(int nch){
if(nch < 0 || nch > 3) return -30000;
uint16_t val = getADCval(nch);
// find interval
int idx = (NKNOTS+1)/2; // middle
while(idx > 0 && idx < NKNOTS){
int16_t left = ADU[idx];
int half = idx / 2;
if(val < left){
int idx = (NKNOTS)/2, left = 0, right = NKNOTS-1; // left, right, middle
while(idx > left && idx < right){
int16_t midval = ADU[idx];
if(val < midval){
if(idx == 0) break;
if(val > ADU[idx-1]){ // found
--idx;
break;
}
idx = half;
right = idx - 1;
idx = (left + right)/2;
}else{
if(idx == NKNOTS - 1) break; // more than max value
if(val < ADU[idx+1]) break; // found
idx += half;
left = idx + 1;
idx = (left + right)/2;
}
}
if(idx < 0) idx = 0;

Binary file not shown.

View File

@ -1,5 +1,164 @@
# PWM fan control
Контроллер питания и охлаждения.
===============================
-- Четыре канала измерения температуры с точностью +-1degrC (три канала управляют активностью кулеров, четвертый - для общего отключения питания в случае достижения критической температуры).
-- Два канала управления четырехпроводными кулерами с контролем их активности.
-- Две кнопки управления (включить/экстренно выключить нагрузку).
-- Внешний сигнал (пищалка 12В): короткий сигнал раз в 10 секунд - один из кулеров не вращается (а должен), непрерывные сигналы - критическая ситуация, питание скоро будет отключено, (сигналы в течение 4с с паузой в 6с - резерв).
-- Режим ручного управления (без контроля температур с соответствующими действиями) или мониторинга (в этом режиме нельзя вручную задавать параметры кулера или внешнего сигнала).
== help ==
```
'0x' - turn cooler0 on/off (x=1/0) or get status (x - any other)
'1x' - turn cooler1 on/off (x=1/0) or get status (x - any other)
'Ax' - get ADC raw value (x=0..7)
'B' - buttons' state
'bx' - buzzer: x==0 - off, x==1 - on, x==l - long beeps, x==s - short beeps
'Cx' - get cooler x (0/1) RPS
'D' - activate DFU mode
'E' - show current state
'Gx' - get cooler x (0..3) PWM settings
'M' - get MCU temperature
'm' - toggle monitoring
'R' - software reset
'rx' - relay on/off (x=1/0) or get status
'Sx y' - set coolerx PWM to y
's' - show settings
'T' - get time from start (ms)
'tx' - get temperature x (0..3)
'V' - get voltage
'Z' - reinit ADC
'!' - switch between manual and automatic modes
```
=== 0x,1x ===
x=='0' - выключить питание кулера; x=='1' - включить питание; любое другое значение - проверить состояние.
=== Ax ===
x=={0..7} - получить "сырое значение" x-го канала АЦП (в ADU).
Каналы: 0..3 - термометры, 4 - измерение 12В, 5 - измерение 5В, 6 - температура МК, 7 - уровень 3.3В.
=== B ===
Состояние обеих кнопок, например:
```
BUTTON0=0
BUTTON1=0
```
Нажатие кнопок проверяется один раз в секунду. Кнопка BUTTON0 переводит систему в автоматический режим и включает реле. Кнопка BUTTON1 отключает реле, отключает все кулеры и сигнал и переводит систему в ручной режим.
=== bx ===
Изменить состояние внешнего сигнала. 0 - выключить, 1 - включить серию непрерывных сигналов, l - включить серию коротких сигналов в течение 4 секунд с паузой в 6 секунд, s - включить короткий сигнал (0.5с) с паузой 9.5с.
=== Cx ===
Получить значения скорости вращения четырехпроводного кулера (обороты в секунду). Например:
```
C0
RPM0=78
C1
RPM1=0
```
=== D ===
Активировать режим DFU для перепрошивки. После прошивки нужно перезапустить МК, закоротив контакты "reset" или кратковременно отключив от питания.
=== E ===
Отобразить текущее состояние системы, например:
```
TIME=1229247
T0=293
T1=264
T2=262
T3=254
BUZZER=OFF
BUTTON0=0
BUTTON1=0
RPS0=82
RPS1=107
PWM0=30
PWM1=40
PWM2=33
COOLER0=1
COOLER1=1
RELAY=1
```
Где
TIME - время с момента включения (мс, приблизительно);
Tx - температуры (x10) соответствующих каналов в градусах Цельсия;
BUZZER - состояние сигнала;
BUTTONx - состояние кнопок (1 - нажата, 0 - отпущена);
RPSx - скорость вращения кулера x (оборотов в секунду);
PWMx - установленное значение ШИМ (в процентах, 0..100) канала x;
COOLERx - включено ли питание кулера x (0..1), из-за неправильной схемотехники не рекомендуется отключать питание четырехпроводных кулеров (+12В поступает в этом случае на измерительный вход);
RELAY - состояние реле (1 - включено, 0 - выключено).
=== Gx ===
Отобразить значения настройки ШИМ кулера x.
=== M ===
Отобразить температуру МК (приближенная температура, x10 градусов Цельсия).
=== m ===
Переключить (вкл/выкл) режим мониторинга, когда каждые 5 секунд отображается состояние системы.
=== R ===
Программный перезапуск системы.
=== rx ===
x==0 - выключить реле, x==1 - включить реле, любое другое значение - получить состояние реле.
=== Sx y ===
Установить значение заполнения ШИМ кулера x (0..2) в y (0..100). Согласно опыту, четырехпроводные кулеры не стартуют при значении PWM<15, а двухпроводные не стартуют при PWM<35, поэтому для получения малых оборотов необходимо стартовать на большей скорости, а затем уже установить нужное значение заполнения ШИМ.
=== s ===
Отобразить "вшитые" в код настройки, например:
```
Thysteresis=30
Tmin={400, 350, 350}
Tmax={900, 800, 600}
T3max=850
```
В данном случае гистерезис температуры установлен в 3 градуса, область допустимых значений температур - 40..90 градусов для канала 0, 35..80 градусов для канала 1 и 35..60 градусов для канала 2. Критическая температура канала 3 установлена в 85 градусов. Если в течение 20 секунд превышено значение одной из критических температур (для T0..2 они равны Tmax+Thysteresis), то реле отключается, система остается в автоматическом режиме.
=== T ===
Отобразить время (условное) в миллисекундах со старта.
=== tx ===
Получить значение температуры x-го канала (0..3). Температура умножена на 10. Например:
```
t0
T0=294
t1
T1=265
t2
T2=264
t3
T3=256
```
Соответственно, температуры равны: t0=29.4, t1=26.5, t2=26.4 и t3=25.6.
Учитывая то, что величина вычисляется кусочно-линейной аппроксимацией с погрешностью до 0.1 градуса, а сами NTC дают разброс не лучше +-0.5 градуса, не стоит надеяться на то, что температуры будут достаточно точными.
=== V ===
Получить значения напряжения (x100) в каналах, например:
```
V3_3=330
V5=428
V12=1055
```
Означает, что питание МК =3.3В, на входе 5В присутствует 4.28В, а на входе 12В присутствует 10.55В.
=== Z ===
Реинициализация АЦП (ХЗ, зачем я это добавил).
=== ! ===
Переключение между автоматическим и ручным режимами управления.
Control of 2 4-pin & 1 2-pin 12V fans according to 4 thermal sensors.
Turn on/off one ~220V channels (normally opened).
Buzzer signal.

View File

@ -112,21 +112,21 @@ int16_t getNTC(int nch){
if(nch < 0 || nch > 3) return -30000;
uint16_t val = getADCval(nch);
// find interval
int idx = (NKNOTS+1)/2; // middle
while(idx > 0 && idx < NKNOTS){
int16_t left = ADU[idx];
int half = idx / 2;
if(val < left){
int idx = (NKNOTS)/2, left = 0, right = NKNOTS-1; // left, right, middle
while(idx > left && idx < right){
int16_t midval = ADU[idx];
if(val < midval){
if(idx == 0) break;
if(val > ADU[idx-1]){ // found
--idx;
break;
}
idx = half;
right = idx - 1;
idx = (left + right)/2;
}else{
if(idx == NKNOTS - 1) break; // more than max value
if(val < ADU[idx+1]) break; // found
idx += half;
left = idx + 1;
idx = (left + right)/2;
}
}
if(idx < 0) idx = 0;

View File

@ -160,7 +160,6 @@ void Jump2Boot(){
// reset systick
SysTick->CTRL = 0;
// reset clocks
RCC->APB1RSTR = RCC_APB1RSTR_CECRST | RCC_APB1RSTR_DACRST | RCC_APB1RSTR_PWRRST | RCC_APB1RSTR_CRSRST |
RCC_APB1RSTR_CANRST | RCC_APB1RSTR_USBRST | RCC_APB1RSTR_I2C2RST | RCC_APB1RSTR_I2C1RST |
RCC_APB1RSTR_USART4RST | RCC_APB1RSTR_USART3RST | RCC_APB1RSTR_USART2RST | RCC_APB1RSTR_SPI2RST |
@ -177,6 +176,15 @@ void Jump2Boot(){
RCC->AHBRSTR = 0;
RCC->APB1RSTR = 0;
RCC->APB2RSTR = 0;
/* // reset GPIO - DON'T WORK! ???
GPIOA->MODER = 0; GPIOA->PUPDR = 0; GPIOA->ODR = 0;
GPIOB->MODER = 0; GPIOB->PUPDR = 0; GPIOB->ODR = 0;
GPIOC->MODER = 0; GPIOC->PUPDR = 0; GPIOC->ODR = 0;
#ifdef STM32F072xB
GPIOD->MODER = 0; GPIOD->PUPDR = 0; GPIOD->ODR = 0;
GPIOE->MODER = 0; GPIOE->PUPDR = 0; GPIOE->ODR = 0;
#endif
GPIOF->MODER = 0; GPIOF->PUPDR = 0; GPIOF->ODR = 0; */
// remap memory to 0 (only for STM32F0)
SYSCFG->CFGR1 = 0x01; __DSB(); __ISB();
SysMemBootJump = (void (*)(void)) (*((uint32_t *)(addr + 4)));
@ -196,50 +204,39 @@ void buzzer_chk(){ // check buzzer state
case BUZZER_LONG:
B = LONG_BUZZER_PERIOD;
S = LONG_BUZZER_PAUSE;
SEND("long ");
break;
case BUZZER_SHORT:
B = SHORT_BUZZER_PERIOD;
S = SHORT_BUZZER_PAUSE;
SEND("short ");
break;
default:
return;
}
if(CHK(BUZZER)){ // is ON
SEND("1->0\n");
OFF(BUZZER);
lastTms = Tms + S;
}else{ // is OFF
SEND("0->1\n");
ON(BUZZER);
lastTms = Tms + B;
}
sendbuf();
return;
}
SEND("New state: ");
switch(buzzer){ // change buzzer state
case BUZZER_ON:
ON(BUZZER);
SEND("on");
break;
case BUZZER_OFF:
OFF(BUZZER);
SEND("off");
break;
case BUZZER_LONG:
ON(BUZZER);
lastTms = Tms + LONG_BUZZER_PERIOD;
SEND("long");
break;
case BUZZER_SHORT:
ON(BUZZER);
lastTms = Tms + SHORT_BUZZER_PERIOD;
SEND("short");
break;
}
newline(); sendbuf();
oldstate = buzzer;
}

View File

@ -0,0 +1,13 @@
function [X0 Y0 K] = buildk(X, Y, dYmax)
%
% [X0 Y0 K] = buildk(X, Y, dYmax) - build arrays of knots (X0, Y0) and linear koefficients K
% for piecewise-linear approximation of Y(X) with max deviation `dYmax`
%
X0 = []; Y0 = []; K = [];
knots = [1 getknots(X, Y, dYmax) max(size(X))];
for i = 1:max(size(knots))-1
idx = knots(i):knots(i+1);
[x y k] = linearapprox(X(idx), Y(idx));
X0 = [X0 x]; Y0 = [Y0 y]; K = [K k];
endfor
endfunction

View File

@ -0,0 +1,29 @@
function T = calcT(ADU)
%
% T = calcT(ADU) - piecewise calculation prototype
%
X0 = [732.44 944.75 1197.23 2034.68 2308.60 2541.55 2738.63 2859.45 2969.21 3067.67 3153.52 3228.22 3292.84 3347.15];
Y0 = [10.000 16.000 22.700 43.750 50.800 57.100 62.800 66.550 70.200 73.750 77.150 80.450 83.700 86.900];
K = [0.028261 0.026536 0.025136 0.025738 0.027044 0.028922 0.031038 0.033255 0.036056 0.039606 0.044173 0.050296 0.058920 0.071729];
imax = max(size(X0)); idx = int32((imax+1)/2);
T = [];
% find index
while(idx > 0 && idx <= imax)
x = X0(idx);
half = int32(idx/2);
if(ADU < x)
%printf("%g < %g\n", ADU, x);
if(idx == 1) break; endif; % less than first index
if(ADU > X0(idx-1)) idx -= 1; break; endif; % found
idx = half; % another half
else
%printf("%g > %g\n", ADU, x);
if(idx == imax) break; endif; % more than last index
if(ADU < X0(idx+1)) break; endif; % found
idx += half;
endif
endwhile
if(idx < 1) printf("too low (<%g)!\n", X0(1)); idx = 1; endif
if(idx > imax) idx = imax; endif;
T = Y0(idx) + K(idx) * (ADU - X0(idx));
endfunction

View File

@ -0,0 +1,13 @@
function idx = getknots(X, Y, dYmax)
%
% idx = getknots(X, Y, dYmax) - calculate piecewise-linear approximation knots for Y(X)
% dYmax - maximal deviation
%
idx = [];
I = getnewpt(X, Y, dYmax);
if(I > 0)
L = getknots(X(1:I), Y(1:I), dYmax);
R = I-1 + getknots(X(I:end), Y(I:end), dYmax);
idx = [L I R];
endif
endfunction

View File

@ -0,0 +1,17 @@
function idx = getnewpt(X, Y, delt)
%
% idx = getnewpt(X, Y, delt)
% find point where Y-`linear approx` is maximal
% return index of max deviation or -1 if it is less than `delt`
%
% make approximation
[x0 y0 k] = linearapprox(X,Y);
% find new knot
adiff = abs(Y - (y0 + k*(X-x0)));
maxadiff = max(adiff);
if(maxadiff < delt)
idx = -1;
else
idx = find(adiff == max(adiff));
endif
endfunction

View File

@ -0,0 +1,8 @@
function [x0 y0 k] = linearapprox(X,Y)
%
% [a b] = linearapprox(X,Y) - find linear approximation of function Y(X) through first and last points
% y = y0 + k*(X-x0)
%
x0 = X(1); y0 = Y(1);
k = (Y(end) - y0) / (X(end) - x0);
endfunction

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,8 @@
<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="a_data/a.js" async="false"></script>
</head>
<body>
</body></html>

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,5 @@
/* >>> file start: js/crossStorageServ.js */
var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(){function e(e){var t="LJ.CrossStorage"===e.data.source;if(!t)return null;var n=e.data;if("object"===("undefined"==typeof n?"undefined":_typeof(n))&&n.fn&&("getItem"===n.fn&&o.parent.postMessage({crossStorageServResponse:localStorage.getItem(n.args[0]),requestID:n.requestID},"*"),"setItem"===n.fn)){var r=n.args[1],f="";"string"==typeof r?f=r:"object"===("undefined"==typeof r?"undefined":_typeof(r))&&(f=JSON.stringify(r)),localStorage.setItem(n.args[0],f)}}function t(){try{return window.self!==window.top}catch(e){return!0}}if(!t())return null;var o=window;"object"===("undefined"==typeof LJMocks?"undefined":_typeof(LJMocks))&&LJMocks.window&&(o=LJMocks.window),o.addEventListener("message",e)}();
/* <<< file end: js/crossStorageServ.js */
//# map link was there [crossStorageServ.js.map]

Binary file not shown.

After

Width:  |  Height:  |  Size: 655 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 632 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 612 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 664 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 820 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 613 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 628 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 640 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 607 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 B

View File

@ -0,0 +1,101 @@
(function(){var f,h=h||{},k=this;function n(a){return void 0!==a}function p(){}function aa(a){a.B=function(){return a.vb?a.vb:a.vb=new a}}
function ba(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";
else if("function"==b&&"undefined"==typeof a.call)return"object";return b}function q(a){return"array"==ba(a)}function ca(a){var b=ba(a);return"array"==b||"object"==b&&"number"==typeof a.length}function t(a){return"string"==typeof a}function u(a){return"function"==ba(a)}var da="closure_uid_"+(1E9*Math.random()>>>0),ea=0;function fa(a,b,c){return a.call.apply(a.bind,arguments)}
function ga(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}}function v(a,b,c){v=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?fa:ga;return v.apply(null,arguments)}var w=Date.now||function(){return+new Date};
function x(a,b){function c(){}c.prototype=b.prototype;a.yc=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.Lc=function(a,c,g){for(var l=Array(arguments.length-2),m=2;m<arguments.length;m++)l[m-2]=arguments[m];return b.prototype[c].apply(a,l)}};var ha={};function ia(){}ia.prototype.send=function(a,b,c){k.navigator.sendBeacon(a,b)?c.eb():c.error()};function ja(){this.b=this.a=void 0}ja.prototype.send=function(a,b){this.a=new Image;this.a.onload=v(this.f,this,b.eb);this.a.onerror=v(this.c,this,b.error);this.a.onabort=v(this.c,this,b.error);this.a.src=a;this.b=k.setTimeout(v(this.c,this,b.error),ka)};function la(a){a.b&&(k.clearTimeout(a.b),a.b=null)}function ma(a){a.a.src="";a.a.onload=function(){};a.a.onabort=function(){};a.a.onerror=function(){}}ja.prototype.f=function(a){la(this);a()};ja.prototype.c=function(a){ma(this);la(this);a()};y.a={};y.a.Nc=/iPad|iPhone|iPod/.test(k.navigator.userAgent)&&!k.Ic;y.a.i={};y.a.i.Bb=!1;y.a.i.Jb="Silverlight Plug-In";y.a.i.qa="application/x-silverlight";y.a.i.Ib=[y.a.i.qa,y.a.i.qa+"-2",y.a.i.qa+"-2-b2",y.a.i.qa+"-2-b1"];y.a.i.Db="AgControl.AgControl";y.a.i.oa=!1;y.a.i.va="";
y.a.i.tc=function(){var a=k.navigator;if(a.plugins&&a.plugins.length){var b=a.plugins[y.a.i.Jb];b&&(y.a.i.oa=!0,b.description&&(y.a.i.va=y.a.i.Xa(b.description)))}else if(a.mimeTypes&&a.mimeTypes.length)for(var c=y.a.i.Ib,b=0;b<c.length;b++){var d=a.mimeTypes[c[b]];if(d&&d.enabledPlugin){y.a.i.oa=!!d.enabledPlugin;y.a.i.oa&&(y.a.i.va=y.a.i.Xa(d.enabledPlugin.description));break}}else{a=[0,0,0,0];try{c=new ActiveXObject(y.a.i.Db);y.a.i.oa=!0;for(b=0;b<a.length;b++){for(var e=0,g=1048575,l=0;e<g;)d=
a[b]=e+(g-e>>1),c.IsVersionSupported(a.join("."))?(l=d,e=d+1):g=d;a[b]=l}y.a.i.va=y.a.i.Xa(a.join("."))}catch(m){}}};y.a.i.Xa=function(a){return"1.0.30226.2"===a?"2.0.30226.2":a};y.a.i.Bb||y.a.i.tc();y.a.i.Cc=y.a.i.oa;y.a.i.VERSION=y.a.i.va;y.u={};
y.u.zc=function(a){var b=typeof a;if("object"===b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"===c)return"object";if("[object Array]"===c||"number"===typeof a.length&&"undefined"!==typeof a.splice&&"undefined"!==typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"===c||"undefined"!==typeof a.call&&"undefined"!==typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";else if("function"===
b&&"undefined"===typeof a.call)return"object";return b};y.u.uc=function(a){var b=typeof a;return"object"==b&&null!=a||"function"==b};y.u.isArray=function(a){return"array"===y.u.zc(a)};y.W={};y.W.wc=function(){console.warn("\u0412\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 syncUserId.\n\u041e\u0431 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u043f\u043e\u0447\u0438\u0442\u0430\u0439\u0442\u0435 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 http://top100.rambler.ru/doc/guide-rambler-top100.pdf")};
y.W.log=function(){if(k.console){var a=new Date;console.log([a.getHours(),a.getMinutes(),a.getSeconds(),a.getMilliseconds()].join(":")+"\t",Array.prototype.slice.call(arguments).join(" "))}};y.G={};y.G.Vb=function(a){if("function"===typeof k.CustomEvent)return new k.CustomEvent(a);var b=document.createEvent("CustomEvent");b.initCustomEvent(a,!0,!0,!0);return b};y.G.oc=function(a){try{var b=y.G.Vb(a);b&&document.dispatchEvent(b)}catch(c){console.error("Event initKraken unsupported!")}};var na=!1;function z(){var a=void 0;na?a={$:!0,vc:!0}:a=!0;return a}try{var qa=Object.defineProperty&&Object.defineProperty({},"passive",{get:function(){na=!0}});k.addEventListener&&k.addEventListener("testPassiveEvents",null,qa)}catch(a){console.error(a)};y.H={};y.H.fb=function(a,b){function c(){e=k.setTimeout(d,1E3);a.apply(null,l)}function d(){e=null;g&&(g=!1,c())}b&&(a=v(a,b));var e=null,g=!1,l=[];return function(a){l=arguments;e?g=!0:c()}};y.g={};y.g.Ba=function(){return Math.round(2147483647*Math.random())};y.g.trunc=function(a,b){var c=b||1;return(a/c>>0)*c};y.g.wb=function(a){return"number"==typeof a&&!k.isNaN(a)&&k.isFinite(a)};y.g.Aa=function(a){return y.g.wb(a)&&0<a};function ra(a,b){this.b=a;this.a=b}ra.prototype.toString=function(){return this.b+"x"+this.a};function sa(a,b){this.c=a;this.f=b||ta;this.b=!1;this.a=void 0}var ta=1E3;sa.prototype.start=function(){this.b=!0;this.a||ua(this)};sa.prototype.g=function(){this.b&&(this.a&&va(this),this.c(),this.b&&ua(this))};function ua(a){a.a=k.setTimeout(v(a.g,a),a.f)}function va(a){a.a&&(k.clearTimeout(a.a),a.a=null)};y.Gc={};function wa(a,b){this.a=a;this.I=b};function A(){this.c=this.b=0;this.a=[]}A.prototype.enqueue=function(a){return this.a[this.c++]=a};A.prototype.na=function(){return this.D()?null:this.a[this.b++]};A.prototype.M=function(){return this.a[this.b]};A.prototype.D=function(){return this.b>=this.c};y.c={};y.c.ta="top100_id";y.c.$b=864E5;y.c.I="";y.c.Oa=function(a){for(var b=1,c=0,d=0;d<a.length;d++)c=a.charCodeAt(d),b=(b<<7&4294967295)+(c<<16)+c,c=b&4278190080,0!==c&&(b=b^c>>24);return b};y.c.Xb=function(){return"."+k.document.location.hostname.split(".").reverse().splice(0,2).reverse().join(".")};y.c.Wb=function(a){var b=k.navigator.userAgent+h.cookie+h.referrer+h.innerWidth+h.innerHeight+Math.random().toString(36).substr(2,9);return["t1",a,y.c.Oa(b),+new Date].join(".")};
y.c.pb=function(a,b){var c=b||y.c.Wb(a);B.set(y.c.ta,c,y.c.$b,"/",y.c.Xb());y.c.I=c};y.c.ub=function(){return!!y.c.I};y.c.xa=function(a){var b=B.get(y.c.ta);b||y.c.ub()?b&&!y.c.ub()&&y.c.pb(a,b):y.c.pb(a);return y.c.I};y.j={};y.j.Lb=0;y.j.Ma="kraken_uid_property_"+y.g.Ba();y.j.sc=function(a){return!!a[y.j.Ma]};y.j.qc=function(a){y.j.sc(a)||(a[y.j.Ma]=++y.j.Lb);return a[y.j.Ma]};y.l={};y.l.xc=function(a){for(var b=[],c={},d=0;d<a.length;){var e=a[d++],g;g=e;var l=void 0;g=l=y.u.uc(g)?"o"+y.j.qc(g):(typeof g).charAt(0)+g;c[g]||(c[g]=!0,b.push(e))}return b};y.l.map=function(a,b,c){if(Array.prototype.map)return Array.prototype.map.call(a,b,c);for(var d=[],e=a.length,g=0;g<e;++g)d[g]=b.call(c,a[g],g,a);return d};y.l.includes=function(a,b,c){var d=a.length;for(c=c||0;c<d;++c)if(a[c]===b)return!0;return!1};y.h={};y.h.ta="_ym_uid";y.h.I="";y.h.mc=function(a){y.h.I=a};y.h.Yb=function(){return y.h.I};y.h.rc=function(){var a=B.get(y.h.ta);a&&y.h.mc(a);return y.h.Yb()};function xa(a,b,c){this.f=c;this.c=a;this.g=b;this.b=0;this.a=null}xa.prototype.get=function(){var a;0<this.b?(this.b--,a=this.a,this.a=a.next,a.next=null):a=this.c();return a};function ya(a,b){a.g(b);a.b<a.f&&(a.b++,b.next=a.a,a.a=b)};function C(a){if(Error.captureStackTrace)Error.captureStackTrace(this,C);else{var b=Error().stack;b&&(this.stack=b)}a&&(this.message=String(a))}x(C,Error);C.prototype.name="CustomError";function za(a,b,c,d,e){this.reset(a,b,c,d,e)}za.prototype.a=null;var Aa=0;za.prototype.reset=function(a,b,c,d,e){"number"==typeof e||Aa++;d||w();this.b=b;delete this.a};function Ba(){0!=Ca&&(this[da]||(this[da]=++ea));this.H=this.H;this.Ia=this.Ia}var Ca=0;Ba.prototype.H=!1;function Da(a,b){this.type=a;this.a=this.target=b}Da.prototype.c=function(){};var Ea="closure_listenable_"+(1E6*Math.random()|0),Fa=0;function Ga(a,b,c,d,e){this.listener=a;this.a=null;this.src=b;this.type=c;this.$=!!d;this.za=e;++Fa;this.da=this.ua=!1}function Ha(a){a.da=!0;a.listener=null;a.a=null;a.src=null;a.za=null};var Ia;function Ja(a){var b=[];Ka(new La,a,b);return b.join("")}function La(){}
function Ka(a,b,c){if(null==b)c.push("null");else{if("object"==typeof b){if(q(b)){var d=b;b=d.length;c.push("[");for(var e="",g=0;g<b;g++)c.push(e),Ka(a,d[g],c),e=",";c.push("]");return}if(b instanceof String||b instanceof Number||b instanceof Boolean)b=b.valueOf();else{c.push("{");e="";for(d in b)Object.prototype.hasOwnProperty.call(b,d)&&(g=b[d],"function"!=typeof g&&(c.push(e),Ma(d,c),c.push(":"),Ka(a,g,c),e=","));c.push("}");return}}switch(typeof b){case "string":Ma(b,c);break;case "number":c.push(isFinite(b)&&
!isNaN(b)?String(b):"null");break;case "boolean":c.push(String(b));break;case "function":c.push("null");break;default:throw Error("Unknown type: "+typeof b);}}}var Na={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\u000b"},Oa=/\uffff/.test("\uffff")?/[\\\"\x00-\x1f\x7f-\uffff]/g:/[\\\"\x00-\x1f\x7f-\xff]/g;
function Ma(a,b){b.push('"',a.replace(Oa,function(a){var b=Na[a];b||(b="\\u"+(a.charCodeAt(0)|65536).toString(16).substr(1),Na[a]=b);return b}),'"')};function Pa(a,b){for(var c in a)b.call(void 0,a[c],c,a)}function Qa(a){var b=[],c=0,d;for(d in a)b[c++]=a[d];return b}function Ra(a){var b=[],c=0,d;for(d in a)b[c++]=d;return b}function Sa(a){return null!==a&&"withCredentials"in a}var Ta="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");
function Ua(a,b){for(var c,d,e=1;e<arguments.length;e++){d=arguments[e];for(c in d)a[c]=d[c];for(var g=0;g<Ta.length;g++)c=Ta[g],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c])}};function Va(a,b){this.b=a;this.a=b}f=Va.prototype;f.clone=function(){return new Va(this.b,this.a)};f.toString=function(){return"("+this.b+" x "+this.a+")"};f.nc=function(){return this.b*this.a};f.D=function(){return!this.nc()};f.ceil=function(){this.b=Math.ceil(this.b);this.a=Math.ceil(this.a);return this};f.floor=function(){this.b=Math.floor(this.b);this.a=Math.floor(this.a);return this};f.round=function(){this.b=Math.round(this.b);this.a=Math.round(this.a);return this};function Wa(a){a.prototype.then=a.prototype.then;a.prototype.$goog_Thenable=!0}function Xa(a){if(!a)return!1;try{return!!a.$goog_Thenable}catch(b){return!1}};function Ya(a){this.a=a}var Za=/\s*;\s*/;f=Ya.prototype;f.set=function(a,b,c,d,e,g){if(/[;=\s]/.test(a))throw Error('Invalid cookie name "'+a+'"');if(/[;\r\n]/.test(b))throw Error('Invalid cookie value "'+b+'"');n(c)||(c=-1);e=e?";domain="+e:"";d=d?";path="+d:"";g=g?";secure":"";c=0>c?"":0==c?";expires="+(new Date(1970,1,1)).toUTCString():";expires="+(new Date(w()+1E3*c)).toUTCString();this.a.cookie=a+"="+b+e+d+c+g};
f.get=function(a,b){for(var c=a+"=",d=(this.a.cookie||"").split(Za),e=0,g;g=d[e];e++){if(0==g.lastIndexOf(c,0))return g.substr(c.length);if(g==a)return""}return b};f.remove=function(a,b,c){var d=n(this.get(a));this.set(a,"",0,b,c);return d};f.R=function(){return $a(this).keys};f.S=function(){return $a(this).values};f.D=function(){return!this.a.cookie};f.clear=function(){for(var a=$a(this).keys,b=a.length-1;0<=b;b--)this.remove(a[b])};
function $a(a){a=(a.a.cookie||"").split(Za);for(var b=[],c=[],d,e,g=0;e=a[g];g++)d=e.indexOf("="),-1==d?(b.push(""),c.push(e)):(b.push(e.substring(0,d)),c.push(e.substring(d+1)));return{keys:b,values:c}}var B=new Ya(document);B.b=3950;function ab(){}ab.prototype.a=null;function bb(a){var b;(b=a.a)||(b={},cb(a)&&(b[0]=!0,b[1]=!0),b=a.a=b);return b};function db(a){db[" "](a);return a}db[" "]=p;function eb(a,b){for(var c=a.split("%s"),d="",e=Array.prototype.slice.call(arguments,1);e.length&&1<c.length;)d+=c.shift()+e.shift();return d+c.join("%s")}var fb=String.prototype.trim?function(a){return a.trim()}:function(a){return a.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")};function gb(a,b){return a<b?-1:a>b?1:0};function D(a){this.b=[];this.f=[];this.a={};this.h=this.c=0;this.g=a||!1}f=D.prototype;f.D=function(){return 0===this.c&&0===this.h};f.clone=function(){for(var a=new D(this.g),b=this.f.concat(),c=this.b.concat(),d=0,e=b.length;d<e;++d)a.K(b[d],this.a[b[d]]);d=0;for(e=c.length;d<e;++d)a.set(c[d],this.a[c[d]]);return a};f.get=function(a,b){a=hb(this,a);return Object.prototype.hasOwnProperty.call(this.a,a)?this.a[a]:b};
f.set=function(a,b){a=hb(this,a);Object.prototype.hasOwnProperty.call(this.a,a)||(this.c++,this.b.push(a));this.a[a]=b};f.remove=function(a){a=hb(this,a);if(Object.prototype.hasOwnProperty.call(this.a,a)){delete this.a[a];for(var b=[],c=0,d=this.b.length;c<d;++c)this.b[c]!==a&&b.push(this.b[c]);this.b=b;this.c=b.length}};f.K=function(a,b){a=hb(this,a);Object.prototype.hasOwnProperty.call(this.a,a)||(this.h++,this.f.push(a));this.a[a]=b};
f.toString=function(){if(this.D())return"";for(var a=[],b=this.f.concat().concat(this.b.concat()),c=void 0,d=void 0,c="",e=0,g=b.length;e<g;++e)c=b[e],d=this.get(c),c=encodeURIComponent(String(c)),""!==d&&(c+="="+encodeURIComponent(String(d))),a.push(c);return a.join("&")};function hb(a,b){var c=String(b);a.g&&(c=c.toLowerCase());return c}var E=D.prototype;E.set=E.set;E.get=E.get;E.setMeta=E.K;E.remove=E.remove;E.isEmpty=E.D;E.toString=E.toString;y.ia={};y.ia.Va=function(){var a=new D;a.K("et","uid");return a};y.ga={};y.ga.zb=function(a){var b=new D,c;for(c in a)a.hasOwnProperty(c)&&b.set(c,a[c]);return b};y.ha={};y.ha.Va=function(a){var b=new D;a=y.ga.zb(a);b.K("et","cv");b.set("cv",a.toString());return b};function ib(a,b){b.unshift(a);C.call(this,eb.apply(null,b));b.shift()}x(ib,C);ib.prototype.name="AssertionError";function jb(a,b){throw new ib("Failure"+(a?": "+a:""),Array.prototype.slice.call(arguments,1));};var F=Array.prototype.indexOf?function(a,b,c){return Array.prototype.indexOf.call(a,b,c)}:function(a,b,c){c=null==c?0:0>c?Math.max(0,a.length+c):c;if(t(a))return t(b)&&1==b.length?a.indexOf(b,c):-1;for(;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1},kb=Array.prototype.forEach?function(a,b,c){Array.prototype.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=t(a)?a.split(""):a,g=0;g<d;g++)g in e&&b.call(c,e[g],g,a)},lb=Array.prototype.filter?function(a,b,c){return Array.prototype.filter.call(a,
b,c)}:function(a,b,c){for(var d=a.length,e=[],g=0,l=t(a)?a.split(""):a,m=0;m<d;m++)if(m in l){var r=l[m];b.call(c,r,m,a)&&(e[g++]=r)}return e},mb=Array.prototype.some?function(a,b,c){return Array.prototype.some.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=t(a)?a.split(""):a,g=0;g<d;g++)if(g in e&&b.call(c,e[g],g,a))return!0;return!1};
function nb(a,b){var c;a:{c=a.length;for(var d=t(a)?a.split(""):a,e=0;e<c;e++)if(e in d&&b.call(void 0,d[e],e,a)){c=e;break a}c=-1}return 0>c?null:t(a)?a.charAt(c):a[c]}function ob(a,b){var c=F(a,b),d;(d=0<=c)&&Array.prototype.splice.call(a,c,1);return d}function pb(a){return Array.prototype.concat.apply(Array.prototype,arguments)}function qb(a){for(var b=[],c=0;c<a;c++)b[c]=0;return b};function rb(){this.a=[]}rb.prototype.remove=function(){var a=this.a,b=a.length,c=a[0];if(0!==b){if(1===b){if(!q(a))for(b=a.length-1;0<=b;b--)delete a[b];a.length=0}else{a[0]=a.pop();for(var a=0,b=this.a,d=b.length,e=void 0,g=void 0,e=void 0,l=b[a];a<d>>1;){e=2*a+1;g=2*a+2;e=g<d&&b[g].a<b[e].a?g:e;if(b[e].a>l.a)break;b[a]=b[e];a=e}b[a]=l}return c.I}};rb.prototype.M=function(){return 0===this.a.length?void 0:this.a[0].I};rb.prototype.D=function(){return 0==this.a.length};function sb(){this.a=new rb}sb.prototype.enqueue=function(a,b){var c=this.a;c.a.push(new wa(a,b));for(var d=c.a.length-1,c=c.a,e=c[d],g=void 0;0<d;)if(g=d-1>>1,c[g].a>e.a)c[d]=c[g],d=g;else break;c[d]=e};sb.prototype.na=function(){return this.a.remove()};sb.prototype.M=function(){return this.a.M()};sb.prototype.D=function(){return this.a.D()};function tb(){this.b=this.a=null}var vb=new xa(function(){return new ub},function(a){a.reset()},100);tb.prototype.remove=function(){var a=null;this.a&&(a=this.a,this.a=this.a.next,this.a||(this.b=null),a.next=null);return a};function ub(){this.next=this.b=this.a=null}ub.prototype.set=function(a,b){this.a=a;this.b=b;this.next=null};ub.prototype.reset=function(){this.next=this.b=this.a=null};function wb(a){this.src=a;this.A={};this.a=0}function xb(a,b,c,d,e){var g=b.toString();b=a.A[g];b||(b=a.A[g]=[],a.a++);var l=yb(b,c,d,e);-1<l?(a=b[l],a.ua=!1):(a=new Ga(c,a.src,g,!!d,e),a.ua=!1,b.push(a));return a}wb.prototype.remove=function(a,b,c,d){a=a.toString();if(!(a in this.A))return!1;var e=this.A[a];b=yb(e,b,c,d);return-1<b?(Ha(e[b]),Array.prototype.splice.call(e,b,1),0==e.length&&(delete this.A[a],this.a--),!0):!1};
function zb(a,b){var c=b.type;c in a.A&&ob(a.A[c],b)&&(Ha(b),0==a.A[c].length&&(delete a.A[c],a.a--))}function yb(a,b,c,d){for(var e=0;e<a.length;++e){var g=a[e];if(!g.da&&g.listener==b&&g.$==!!c&&g.za==d)return e}return-1};function Ab(a,b){this.a=n(a)?a:0;this.J=n(b)?b:0}f=Ab.prototype;f.clone=function(){return new Ab(this.a,this.J)};f.toString=function(){return"("+this.a+", "+this.J+")"};f.ceil=function(){this.a=Math.ceil(this.a);this.J=Math.ceil(this.J);return this};f.floor=function(){this.a=Math.floor(this.a);this.J=Math.floor(this.J);return this};f.round=function(){this.a=Math.round(this.a);this.J=Math.round(this.J);return this};var Bb;function Cb(){}x(Cb,ab);function Db(a){return(a=cb(a))?new ActiveXObject(a):new XMLHttpRequest}function cb(a){if(!a.b&&"undefined"==typeof XMLHttpRequest&&"undefined"!=typeof ActiveXObject){for(var b=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],c=0;c<b.length;c++){var d=b[c];try{return new ActiveXObject(d),a.b=d}catch(e){}}throw Error("Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed");}return a.b}Bb=new Cb;function Eb(a,b){this.b={};this.a=[];this.c=0;var c=arguments.length;if(1<c){if(c%2)throw Error("Uneven number of arguments");for(var d=0;d<c;d+=2)this.set(arguments[d],arguments[d+1])}else if(a){a instanceof Eb?(c=a.R(),d=a.S()):(c=Ra(a),d=Qa(a));for(var e=0;e<c.length;e++)this.set(c[e],d[e])}}f=Eb.prototype;f.S=function(){Fb(this);for(var a=[],b=0;b<this.a.length;b++)a.push(this.b[this.a[b]]);return a};f.R=function(){Fb(this);return this.a.concat()};f.D=function(){return 0==this.c};
f.clear=function(){this.b={};this.c=this.a.length=0};f.remove=function(a){return Object.prototype.hasOwnProperty.call(this.b,a)?(delete this.b[a],this.c--,this.a.length>2*this.c&&Fb(this),!0):!1};function Fb(a){if(a.c!=a.a.length){for(var b=0,c=0;b<a.a.length;){var d=a.a[b];Object.prototype.hasOwnProperty.call(a.b,d)&&(a.a[c++]=d);b++}a.a.length=c}if(a.c!=a.a.length){for(var e={},c=b=0;b<a.a.length;)d=a.a[b],Object.prototype.hasOwnProperty.call(e,d)||(a.a[c++]=d,e[d]=1),b++;a.a.length=c}}
f.get=function(a,b){return Object.prototype.hasOwnProperty.call(this.b,a)?this.b[a]:b};f.set=function(a,b){Object.prototype.hasOwnProperty.call(this.b,a)||(this.c++,this.a.push(a));this.b[a]=b};f.forEach=function(a,b){for(var c=this.R(),d=0;d<c.length;d++){var e=c[d],g=this.get(e);a.call(b,g,e,this)}};f.clone=function(){return new Eb(this)};function Gb(a){if(a.S&&"function"==typeof a.S)return a.S();if(t(a))return a.split("");if(ca(a)){for(var b=[],c=a.length,d=0;d<c;d++)b.push(a[d]);return b}return Qa(a)}
function Hb(a,b){if(a.forEach&&"function"==typeof a.forEach)a.forEach(b,void 0);else if(ca(a)||t(a))kb(a,b,void 0);else{var c;if(a.R&&"function"==typeof a.R)c=a.R();else if(a.S&&"function"==typeof a.S)c=void 0;else if(ca(a)||t(a)){c=[];for(var d=a.length,e=0;e<d;e++)c.push(e)}else c=Ra(a);for(var d=Gb(a),e=d.length,g=0;g<e;g++)b.call(void 0,d[g],c&&c[g],a)}};var Ib=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#(.*))?$/;var Jb=!1,G="";function Kb(a){a=a.match(/[\d]+/g);if(!a)return"";a.length=3;return a.join(".")}
(function(){if(navigator.plugins&&navigator.plugins.length){var a=navigator.plugins["Shockwave Flash"];if(a&&(Jb=!0,a.description)){G=Kb(a.description);return}if(navigator.plugins["Shockwave Flash 2.0"]){Jb=!0;G="2.0.0.11";return}}if(navigator.mimeTypes&&navigator.mimeTypes.length&&(a=navigator.mimeTypes["application/x-shockwave-flash"],Jb=!!a&&a.enabledPlugin)){G=Kb(a.enabledPlugin.description);return}try{var b=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");Jb=!0;G=Kb(b.GetVariable("$version"));
return}catch(c){}try{b=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");Jb=!0;G="6.0.21";return}catch(c){}try{b=new ActiveXObject("ShockwaveFlash.ShockwaveFlash"),Jb=!0,G=Kb(b.GetVariable("$version"))}catch(c){}})();var Lb=G;var Mb;a:{var Nb=k.navigator;if(Nb){var Ob=Nb.userAgent;if(Ob){Mb=Ob;break a}}Mb=""}function H(a){return-1!=Mb.indexOf(a)};function Pb(a){k.setTimeout(function(){throw a;},0)}var Qb;
function Rb(){var a=k.MessageChannel;"undefined"===typeof a&&"undefined"!==typeof window&&window.postMessage&&window.addEventListener&&!H("Presto")&&(a=function(){var a=document.createElement("IFRAME");a.style.display="none";a.src="";document.documentElement.appendChild(a);var b=a.contentWindow,a=b.document;a.open();a.write("");a.close();var c="callImmediate"+Math.random(),d="file:"==b.location.protocol?"*":b.location.protocol+"//"+b.location.host,a=v(function(a){if(("*"==d||a.origin==d)&&a.data==
c)this.port1.onmessage()},this);b.addEventListener("message",a,!1);this.port1={};this.port2={postMessage:function(){b.postMessage(c,d)}}});if("undefined"!==typeof a&&!H("Trident")&&!H("MSIE")){var b=new a,c={},d=c;b.port1.onmessage=function(){if(n(c.next)){c=c.next;var a=c.qb;c.qb=null;a()}};return function(a){d.next={qb:a};d=d.next;b.port2.postMessage(0)}}return"undefined"!==typeof document&&"onreadystatechange"in document.createElement("SCRIPT")?function(a){var b=document.createElement("SCRIPT");
b.onreadystatechange=function(){b.onreadystatechange=null;b.parentNode.removeChild(b);b=null;a();a=null};document.documentElement.appendChild(b)}:function(a){k.setTimeout(a,0)}};function Sb(a,b){Tb||Ub();Vb||(Tb(),Vb=!0);var c=Wb,d=vb.get();d.set(a,b);c.b?c.b.next=d:c.a=d;c.b=d}var Tb;function Ub(){if(k.Promise&&k.Promise.resolve){var a=k.Promise.resolve(void 0);Tb=function(){a.then(Xb)}}else Tb=function(){var a=Xb;!u(k.setImmediate)||k.Window&&k.Window.prototype&&!H("Edge")&&k.Window.prototype.setImmediate==k.setImmediate?(Qb||(Qb=Rb()),Qb(a)):k.setImmediate(a)}}var Vb=!1,Wb=new tb;
function Xb(){for(var a=null;a=Wb.remove();){try{a.a.call(a.b)}catch(b){Pb(b)}ya(vb,a)}Vb=!1};function J(a,b){this.a=Yb;this.j=void 0;this.c=this.b=this.f=null;this.g=this.h=!1;if(a!=p)try{var c=this;a.call(b,function(a){Zb(c,$b,a)},function(a){try{if(a instanceof Error)throw a;throw Error("Promise rejected.");}catch(b){}Zb(c,K,a)})}catch(d){Zb(this,K,d)}}var Yb=0,$b=2,K=3;function ac(){this.next=this.context=this.b=this.c=this.a=null;this.f=!1}ac.prototype.reset=function(){this.context=this.b=this.c=this.a=null;this.f=!1};var bc=new xa(function(){return new ac},function(a){a.reset()},100);
function cc(a,b,c){var d=bc.get();d.c=a;d.b=b;d.context=c;return d}J.prototype.then=function(a,b,c){return dc(this,u(a)?a:null,u(b)?b:null,c)};Wa(J);function ec(a,b){a.b||a.a!=$b&&a.a!=K||fc(a);a.c?a.c.next=b:a.b=b;a.c=b}function dc(a,b,c,d){var e=cc(null,null,null);e.a=new J(function(a,l){e.c=b?function(c){try{var e=b.call(d,c);a(e)}catch(I){l(I)}}:a;e.b=c?function(b){try{var e=c.call(d,b);a(e)}catch(I){l(I)}}:l});e.a.f=a;ec(a,e);return e.a}J.prototype.u=function(a){this.a=Yb;Zb(this,$b,a)};
J.prototype.v=function(a){this.a=Yb;Zb(this,K,a)};function Zb(a,b,c){if(a.a==Yb){a==c&&(b=K,c=new TypeError("Promise cannot resolve to itself"));a.a=1;var d;a:{var e=c,g=a.u,l=a.v;if(e instanceof J)ec(e,cc(g||p,l||null,a)),d=!0;else if(Xa(e))e.then(g,l,a),d=!0;else{var m=typeof e;if("object"==m&&null!=e||"function"==m)try{var r=e.then;if(u(r)){gc(e,r,g,l,a);d=!0;break a}}catch(I){l.call(a,I);d=!0;break a}d=!1}}d||(a.j=c,a.a=b,a.f=null,fc(a),b!=K||hc(a,c))}}
function gc(a,b,c,d,e){function g(a){m||(m=!0,d.call(e,a))}function l(a){m||(m=!0,c.call(e,a))}var m=!1;try{b.call(a,l,g)}catch(r){g(r)}}function fc(a){a.h||(a.h=!0,Sb(a.l,a))}function ic(a){var b=null;a.b&&(b=a.b,a.b=b.next,b.next=null);a.b||(a.c=null);return b}
J.prototype.l=function(){for(var a=null;a=ic(this);){var b=this.a,c=this.j;if(b==K&&a.b&&!a.f)for(var d=void 0,d=this;d&&d.g;d=d.f)d.g=!1;if(a.a)a.a.f=null,jc(a,b,c);else try{a.f?a.c.call(a.context):jc(a,b,c)}catch(e){kc.call(null,e)}ya(bc,a)}this.h=!1};function jc(a,b,c){b==$b?a.c.call(a.context,c):a.b&&a.b.call(a.context,c)}function hc(a,b){a.g=!0;Sb(function(){a.g&&kc.call(null,b)})}var kc=Pb;function lc(a){Ba.call(this);this.h=1;this.f=[];this.c=0;this.a=[];this.b={};this.j=Boolean(a)}x(lc,Ba);function mc(a,b,c,d){if(b=a.b[b]){var e=a.a;if(b=nb(b,function(a){return e[a+1]==c&&e[a+2]==d}))return a.g(b)}return!1}lc.prototype.g=function(a){var b=this.a[a];if(b){var c=this.b[b];0!=this.c?(this.f.push(a),this.a[a+1]=p):(c&&ob(c,a),delete this.a[a],delete this.a[a+1],delete this.a[a+2])}return!!b};
lc.prototype.l=function(a,b){var c=this.b[a];if(c){for(var d=Array(arguments.length-1),e=1,g=arguments.length;e<g;e++)d[e-1]=arguments[e];if(this.j)for(e=0;e<c.length;e++){var l=c[e];nc(this.a[l+1],this.a[l+2],d)}else{this.c++;try{for(e=0,g=c.length;e<g;e++)l=c[e],this.a[l+1].apply(this.a[l+2],d)}finally{if(this.c--,0<this.f.length&&0==this.c)for(;c=this.f.pop();)this.g(c)}}return 0!=e}return!1};function nc(a,b,c){Sb(function(){a.apply(b,c)})}
lc.prototype.clear=function(a){if(a){var b=this.b[a];b&&(kb(b,this.g,this),delete this.b[a])}else this.a.length=0,this.b={}};var oc=H("Opera")||H("OPR"),L=H("Trident")||H("MSIE"),pc=H("Edge"),qc=H("Gecko")&&!(-1!=Mb.toLowerCase().indexOf("webkit")&&!H("Edge"))&&!(H("Trident")||H("MSIE"))&&!H("Edge"),rc=-1!=Mb.toLowerCase().indexOf("webkit")&&!H("Edge"),sc=rc&&H("Mobile");function tc(){var a=k.document;return a?a.documentMode:void 0}var uc;
a:{var vc="",wc=function(){var a=Mb;if(qc)return/rv\:([^\);]+)(\)|;)/.exec(a);if(pc)return/Edge\/([\d\.]+)/.exec(a);if(L)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a);if(rc)return/WebKit\/(\S+)/.exec(a);if(oc)return/(?:Version)[ \/]?(\S+)/.exec(a)}();wc&&(vc=wc?wc[1]:"");if(L){var xc=tc();if(null!=xc&&xc>parseFloat(vc)){uc=String(xc);break a}}uc=vc}var yc={};
function M(a){var b;if(!(b=yc[a])){b=0;for(var c=fb(String(uc)).split("."),d=fb(String(a)).split("."),e=Math.max(c.length,d.length),g=0;0==b&&g<e;g++){var l=c[g]||"",m=d[g]||"",r=RegExp("(\\d*)(\\D*)","g"),I=RegExp("(\\d*)(\\D*)","g");do{var oa=r.exec(l)||["","",""],pa=I.exec(m)||["","",""];if(0==oa[0].length&&0==pa[0].length)break;b=gb(0==oa[1].length?0:parseInt(oa[1],10),0==pa[1].length?0:parseInt(pa[1],10))||gb(0==oa[2].length,0==pa[2].length)||gb(oa[2],pa[2])}while(0==b)}b=yc[a]=0<=b}return b}
var zc=k.document,Ac=zc&&L?tc()||("CSS1Compat"==zc.compatMode?parseInt(uc,10):5):void 0;y.b={};y.b.Cb=!1;y.b.jb=!1;y.b.Nb=y.b.Cb||y.b.jb;y.b.Ga=!1;y.b.Kb={Ab:"a"};
y.b.ready=function(a){function b(){c||(c=!0,y.b.Ga=!0,a())}var c=!1;y.b.Ga&&a();if(document.addEventListener)document.addEventListener("DOMContentLoaded",function(){b()},!1);else if(document.attachEvent){if(document.documentElement.doScroll&&window==window.top){var d=function(){if(!c&&document.body)try{document.documentElement.doScroll("left"),b()}catch(a){setTimeout(d,0)}};d()}document.attachEvent("onreadystatechange",function(){"complete"===document.readyState&&b()})}window.addEventListener?window.addEventListener("load",
b,!1):window.attachEvent&&window.attachEvent("onload",b)};y.b.ready(function(){y.b.Ga=!0});y.b.P=function(a){return t(a)?document.getElementById(a):a};y.b.getElementsByTagName=function(a){a=a.toUpperCase();return k.document.getElementsByTagName(a)};y.b.Ua=function(){var a=k.document.body,b=k.document.documentElement,a=lb([a.scrollHeight,b.scrollHeight,a.offsetHeight,b.offsetHeight,a.clientHeight,b.clientHeight],function(a){return a?!0:!1});return Math.max.apply(null,a)};
y.b.tb=function(a){a=a||k;var b=a.document;if(rc&&!sc){n(a.innerHeight)||(a=k);var b=a.innerHeight,c=a.document.documentElement.scrollHeight;a==a.top&&c<b&&(b-=15);return new ra(a.innerWidth,b)}a=y.b.Zb(b)?b.documentElement:b.body;return new ra(a.clientWidth,a.clientHeight)};y.b.Zb=function(a){return y.b.Nb?y.b.jb:"CSS1Compat"==a.compatMode};function Bc(){this.a=[];k.setTimeout(v(function(){Cc(this)},this),0)}aa(Bc);function Cc(a){for(var b=y.b.getElementsByTagName(y.b.Kb.Ab),c=[],d=0,e=b.length;d<e;++d)c.push(b[d]);b=y.l.map(c,function(a){return a.href});a.a=y.l.xc(b)};function Dc(a){this.f=a;this.b=this.c=this.a=null}function Ec(a,b){this.name=a;this.value=b}Ec.prototype.toString=function(){return this.name};var Fc=new Ec("SEVERE",1E3),Gc=new Ec("CONFIG",700),Hc=new Ec("FINE",500);function Jc(a){if(a.c)return a.c;if(a.a)return Jc(a.a);jb("Root logger has no level set.");return null}
Dc.prototype.log=function(a,b,c){if(a.value>=Jc(this).value)for(u(b)&&(b=b()),a=new za(a,String(b),this.f),c&&(a.a=c),c="log:"+a.b,k.console&&(k.console.timeStamp?k.console.timeStamp(c):k.console.markTimeline&&k.console.markTimeline(c)),k.msWriteProfilerMark&&k.msWriteProfilerMark(c),c=this;c;)c=c.a};var Kc={},Lc=null;
function Mc(a){Lc||(Lc=new Dc(""),Kc[""]=Lc,Lc.c=Gc);var b;if(!(b=Kc[a])){b=new Dc(a);var c=a.lastIndexOf("."),d=a.substr(c+1),c=Mc(a.substr(0,c));c.b||(c.b={});c.b[d]=b;b.a=c;Kc[a]=b}return b};var Nc=!L||9<=Number(Ac),Oc=L&&!M("9");!rc||M("528");qc&&M("1.9b")||L&&M("8")||oc&&M("9.5")||rc&&M("528");qc&&!M("8")||L&&M("9");function Pc(a,b){Da.call(this,a?a.type:"");this.a=this.target=null;this.keyCode=this.button=this.screenY=this.screenX=0;this.metaKey=this.shiftKey=this.ctrlKey=!1;this.b=this.state=null;if(a){this.type=a.type;var c=a.changedTouches?a.changedTouches[0]:null;this.target=a.target||a.srcElement;this.a=b;var d=a.relatedTarget;if(d&&qc)try{db(d.nodeName)}catch(e){}null===c?(this.screenX=a.screenX||0,this.screenY=a.screenY||0):(this.screenX=c.screenX||0,this.screenY=c.screenY||0);this.button=a.button;this.keyCode=
a.keyCode||0;this.ctrlKey=a.ctrlKey;this.shiftKey=a.shiftKey;this.metaKey=a.metaKey;this.state=a.state;this.b=a;a.defaultPrevented&&this.c()}}x(Pc,Da);Pc.prototype.c=function(){Pc.yc.c.call(this);var a=this.b;if(a.preventDefault)a.preventDefault();else if(a.returnValue=!1,Oc)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};Pc.prototype.O=function(){return this.b};var Qc="closure_lm_"+(1E6*Math.random()|0),Rc={},Sc=0;
function N(a,b,c,d,e){if(q(b))for(var g=0;g<b.length;g++)N(a,b[g],c,d,e);else if(c=Tc(c),a&&a[Ea])Uc(a,b,c,d,e);else{if(!b)throw Error("Invalid event type");var g=!!d,l=Vc(a);l||(a[Qc]=l=new wb(a));c=xb(l,b,c,d,e);if(!c.a){d=Wc();c.a=d;d.src=a;d.listener=c;if(a.addEventListener)a.addEventListener(b.toString(),d,g);else if(a.attachEvent)a.attachEvent(Xc(b.toString()),d);else throw Error("addEventListener and attachEvent are unavailable.");Sc++}}}
function Wc(){var a=Yc,b=Nc?function(c){return a.call(b.src,b.listener,c)}:function(c){c=a.call(b.src,b.listener,c);if(!c)return c};return b}function Zc(a,b,c,d,e){if(q(b))for(var g=0;g<b.length;g++)Zc(a,b[g],c,d,e);else(c=Tc(c),a&&a[Ea])?a.pa.remove(String(b),c,d,e):a&&(a=Vc(a))&&(b=a.A[b.toString()],a=-1,b&&(a=yb(b,c,!!d,e)),(c=-1<a?b[a]:null)&&$c(c))}
function $c(a){if("number"!=typeof a&&a&&!a.da){var b=a.src;if(b&&b[Ea])zb(b.pa,a);else{var c=a.type,d=a.a;b.removeEventListener?b.removeEventListener(c,d,a.$):b.detachEvent&&b.detachEvent(Xc(c),d);Sc--;(c=Vc(b))?(zb(c,a),0==c.a&&(c.src=null,b[Qc]=null)):Ha(a)}}}function Xc(a){return a in Rc?Rc[a]:Rc[a]="on"+a}function ad(a,b,c,d){var e=!0;if(a=Vc(a))if(b=a.A[b.toString()])for(b=b.concat(),a=0;a<b.length;a++){var g=b[a];g&&g.$==c&&!g.da&&(g=bd(g,d),e=e&&!1!==g)}return e}
function bd(a,b){var c=a.listener,d=a.za||a.src;a.ua&&$c(a);return c.call(d,b)}
function Yc(a,b){if(a.da)return!0;if(!Nc){var c;if(!(c=b))a:{c=["window","event"];for(var d=k,e;e=c.shift();)if(null!=d[e])d=d[e];else{c=null;break a}c=d}e=c;c=new Pc(e,this);d=!0;if(!(0>e.keyCode||void 0!=e.returnValue)){a:{var g=!1;if(0==e.keyCode)try{e.keyCode=-1;break a}catch(r){g=!0}if(g||void 0==e.returnValue)e.returnValue=!0}e=[];for(g=c.a;g;g=g.parentNode)e.push(g);for(var g=a.type,l=e.length-1;0<=l;l--){c.a=e[l];var m=ad(e[l],g,!0,c),d=d&&m}for(l=0;l<e.length;l++)c.a=e[l],m=ad(e[l],g,!1,
c),d=d&&m}return d}return bd(a,new Pc(b,this))}function Vc(a){a=a[Qc];return a instanceof wb?a:null}var cd="__closure_events_fn_"+(1E9*Math.random()>>>0);function Tc(a){if(u(a))return a;a[cd]||(a[cd]=function(b){return a.handleEvent(b)});return a[cd]};y.f={};y.f.Bc={Jc:"scroll"};y.f.s=0;y.f.Za=!1;y.f.sa=[];y.f.La=300;y.f.la=48;y.f.Kc=function(a){if(!k.addEventListener)return!1;0===y.f.sa.length&&y.f.Na();y.f.sa.push(a);return!0};
y.f.Na=function(){var a=void 0,b={},c={$:!0,vc:!0};k.document.addEventListener("touchstart",function(c){1===c.touches.length&&(a=w(),b=c.changedTouches.item(0))},y.f.Za?c:!0);k.document.addEventListener("touchend",function(c){if(1!==c.changedTouches.length)b={};else{var e=w(),g=c.changedTouches.item(0);if(g.identifier!==b.identifier)b={};else if(e-a>=y.f.La)b={};else{var e=b.radiusX||y.f.la,l=b.radiusY||y.f.la;if(Math.abs(g.pageX-b.pageX)>e||Math.abs(g.pageY-b.pageY)>l||Math.abs(g.screenX-b.screenX)>
e||Math.abs(g.screenY-b.screenY)>l)b={};else{g=0;for(e=y.f.sa.length;g<e;++g)y.f.sa[g](c,y.f.s++);b={}}}}},y.f.Za?c:!0)};try{qa=Object.defineProperty&&Object.defineProperty({},"passive",{get:function(){y.f.Za=!0}}),k.addEventListener&&k.addEventListener("testPassiveEvents",null,qa)}catch(a){console.error(a)};var O={m:{}};O.m.keydown=void 0;O.addListener=function(a,b){switch(a){case "keydown":O.Pb();break;default:return}O.m[a]=b};O.Pb=function(){N(k.document,"keydown",O.gc,z())};O.gc=function(a){O.m.keydown(a)};var P={m:{}};P.m.click=void 0;P.m.mousedown=void 0;P.m.tap=void 0;P.m.touchstart=void 0;P.m.touchend=void 0;P.X={};P.X.mousedown=new A;P.X.click=new A;P.X.tap=new A;P.La=300;P.la=48;P.addListener=function(a,b){switch(a){case "click":P.Ob();break;case "tap":P.Na();break;case "mousedown":P.Qb();break;case "touchstart":P.Tb();break;default:return}P.m[a]=b};P.Ob=function(){N(k.document,"click",P.bc,z())};P.Qb=function(){N(k.document,"mousedown",P.hc,z())};
P.Tb=function(){N(k.document,"touchstart",P.kc,z())};
P.Na=function(){if(!k.addEventListener)return!1;var a=void 0,b={};k.document.addEventListener("touchstart",function(c){1===c.touches.length&&(a=w(),b=c.changedTouches.item(0))},z());k.document.addEventListener("touchend",function(c){if(1!==c.changedTouches.length)b={};else{var d=w(),e=c.changedTouches.item(0);if(e.identifier!==b.identifier)b={};else if(d-a>=P.La)b={};else{var d=b.radiusX||P.la,g=b.radiusY||P.la;Math.abs(e.pageX-b.pageX)>d||Math.abs(e.pageY-b.pageY)>g||Math.abs(e.screenX-b.screenX)>
d||Math.abs(e.screenY-b.screenY)>g?b={}:(c.getBrowserEvent=c.O,P.Qa(c),b={})}}},z());return null};P.bc=function(a){a.getBrowserEvent=a.O;P.m.click(a)};P.hc=function(a){if(!P.ob("tap",a)){var b=P.X.mousedown;b.enqueue({target:a.target,yb:k.setTimeout(function(){b.na()},1E3)});a.getBrowserEvent=a.O;P.m.mousedown(a)}};P.kc=function(a){a.getBrowserEvent=a.O;P.m.touchstart(a)};
P.Qa=function(a){if(!P.ob("mousedown",a)){var b=P.X.tap;b.enqueue({target:a.target,yb:k.setTimeout(function(){b.na()},1E3)});a.Oc=!0;a.getBrowserEvent=a.O;P.m.tap(a)}};P.ob=function(a,b){var c=P.X[a];if(c.D()||c.M().target!==b.target)return!1;k.clearTimeout(c.M().yb);c.na();return!0};var Q={m:{}};Q.m.scroll=void 0;Q.addListener=function(a,b){switch(a){case "scroll":Q.Sb();break;default:return}Q.m[a]=b};Q.Sb=function(){N(k.document,"scroll",Q.jc,z())};Q.jc=function(a){Q.m.scroll(a)};var R={m:{}};R.m.beforeunload=void 0;R.m.resize=void 0;R.addListener=function(a,b){switch(a){case "beforeunload":R.Ub();break;case "resize":R.Rb();break;default:return}R.m[a]=b};R.Ub=function(){N(k,"beforeunload",R.Ra,z())};R.Rb=function(){N(k,"resize",R.Pa,z())};R.Ra=function(a){R.m.beforeunload(a)};R.Pa=function(a){R.m.resize(a)};function S(){this.c=new lc;this.f={}}aa(S);S.prototype.a=function(a,b,c){var d=this.c,e=d.b[a];e||(e=d.b[a]=[]);var g=d.h;d.a[g]=a;d.a[g+1]=b;d.a[g+2]=c;d.h=g+3;e.push(g);return g};S.prototype.g=function(a,b,c){return mc(this.c,a,b,c)};S.prototype.b=function(a,b){return this.c.l.apply(this.c,arguments)};S.prototype.addListener=function(a,b,c){a=y.u.isArray(a)?a:[a];for(var d=0,e=a.length;d<e;++d)dd(this,a[d]).A.push({Z:b,context:c})};
function dd(a,b){var c=a.f[b];c||(c=a.f[b]={A:[],Ya:void 0});c.Ya||(c.Ya=ed(b),c.Ya.addListener(b,fd(a,b)));return c}function ed(a){switch(a){case "click":case "mousedown":case "tap":case "touchstart":return P;case "beforeunload":case "resize":return R;case "keydown":return O;case "scroll":return Q;default:return null}}
function fd(a,b){return v(function(){for(var a=dd(this,b).A,d=Array(arguments.length),e=0,g=arguments.length;e<g;e++)d[e]=arguments[e];e=0;for(g=a.length;e<g;++e)a[e].Z.apply(a[e].context,d)},a)}var T=S.prototype;T.subscribe=T.a;T.unsubscribe=T.g;T.publish=T.b;T.addListener=T.addListener;function gd(){this.c=S.B();this.a=0;w();this.b=!0;k.setTimeout(v(this.f,this),hd(this));var a=y.H.fb(this.g,this);this.c.addListener(id,a,this)}var jd=[0,10,30,60,120,180,240,300,360,420,480,540,600,720,840,960,1080,1200],id=["click","mousedown","keydown","scroll"];gd.prototype.g=function(){this.b=!0};function hd(a){return++a.a>=jd.length?12E4:1E3*(jd[a.a]-jd[a.a-1])}gd.prototype.f=function(){this.b&&(this.c.b("ping"),this.b=!1);k.setTimeout(v(this.f,this),hd(this))};function kd(){this.c=this.a=void 0;this.b=this.f="";this.g=void 0;var a;a:if("visibilityState"in document)this.f="visibilitychange",this.b="hidden",a=!0;else{a=void 0;for(var b=0;b<ld;++b)if(a=ld[b],a+"VisibilityState"in document){this.f=a+"visibilitychange";this.b=a+"Hidden";a=!0;break a}a=!1}if(this.c=a)this.g=S.B(),this.a=!k.document[this.b],N(k.document,this.f,this.h,!1,this)}var ld=["webkit","moz","ms","o"];kd.prototype.h=function(){this.a=!k.document[this.b];this.g.b("visibility")};function md(){Ba.call(this);this.pa=new wb(this);this.ra=this}x(md,Ba);md.prototype[Ea]=!0;md.prototype.removeEventListener=function(a,b,c,d){Zc(this,a,b,c,d)};function U(a,b){var c=a.ra,d=b,e=d.type||d;if(t(d))d=new Da(d,c);else if(d instanceof Da)d.target=d.target||c;else{var g=d,d=new Da(e,c);Ua(d,g)}c=d.a=c;nd(c,e,!0,d);nd(c,e,!1,d)}function Uc(a,b,c,d,e){xb(a.pa,String(b),c,d,e)}
function nd(a,b,c,d){if(b=a.pa.A[String(b)]){b=b.concat();for(var e=!0,g=0;g<b.length;++g){var l=b[g];if(l&&!l.da&&l.$==c){var m=l.listener,r=l.za||l.src;l.ua&&zb(a.pa,l);e=!1!==m.call(r,d)&&e}}}};function od(){this.b=S.B();this.a=void 0;this.c=Bc.B();pd(this)}var qd=/^javascript\:/i,rd=/^_(self|parent|top)$/i;function pd(a){a.b.addListener("mousedown",function(a){var c=a.O().button;0!==c&&1!==c||sd(this,a)},a);a.b.addListener("keydown",function(a){13===a.O().keyCode&&sd(this,a)},a)}
function sd(a,b){var c;for(c=b.target;c&&(!n(c.tagName)||"a"!==c.tagName.toLowerCase()||!c.href);)c=c.parentNode;var d=new D;if(c&&c.href){a.a=c.href;var e=a.a;-1!==e.indexOf(k.location.host)||e.match(qd)||(c.target&&c.target.match(rd),d.K("et","extln"),d.set("extln",a.a),y.l.includes(a.c.a,a.a)&&d.set("um_log","cl"),a.b.b("extLink",d))}};!qc&&!L||L&&9<=Number(Ac)||qc&&M("1.9.1");L&&M("9");function td(a,b){Pa(b,function(b,d){"style"==d?a.style.cssText=b:"class"==d?a.className=b:"for"==d?a.htmlFor=b:ud.hasOwnProperty(d)?a.setAttribute(ud[d],b):0==d.lastIndexOf("aria-",0)||0==d.lastIndexOf("data-",0)?a.setAttribute(d,b):a[d]=b})}var ud={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",frameborder:"frameBorder",height:"height",maxlength:"maxLength",nonce:"nonce",role:"role",rowspan:"rowSpan",type:"type",usemap:"useMap",valign:"vAlign",width:"width"};
function vd(a){a=a.document;a="CSS1Compat"==a.compatMode?a.documentElement:a.body;return new Va(a.clientWidth,a.clientHeight)}function wd(a){return a.parentWindow||a.defaultView}function xd(a){this.a=a||k.document||document}xd.prototype.P=function(a){return t(a)?this.a.getElementById(a):a};xd.prototype.tb=function(a){return vd(a||wd(this.a)||window)};
xd.prototype.Ua=function(){var a;a:{var b=wd(this.a),c=b.document;a=0;if(c){a=c.body;var d=c.documentElement;if(!d||!a){a=0;break a}b=vd(b).a;if("CSS1Compat"==c.compatMode&&d.scrollHeight)a=d.scrollHeight!=b?d.scrollHeight:d.offsetHeight;else{var c=d.scrollHeight,e=d.offsetHeight;d.clientHeight!=e&&(c=a.scrollHeight,e=a.offsetHeight);a=c>b?c>e?c:e:c<e?c:e}}}return a};
xd.prototype.contains=function(a,b){if(!a||!b)return!1;if(a.contains&&1==b.nodeType)return a==b||a.contains(b);if("undefined"!=typeof a.compareDocumentPosition)return a==b||Boolean(a.compareDocumentPosition(b)&16);for(;b&&a!=b;)b=b.parentNode;return b==a};function yd(){this.b=new D;this.a=void 0;var a=this.b;a.K("et","pv");a.set("bs",y.b.tb());a.set("ce",navigator.cookieEnabled?1:0);var b=k.document;b&&(a.set("rf",b.referrer||""),a.set("en",b.characterSet||b.charset||""),a.set("pt",b.title.substring(0,255)));if(b=k.screen)a.set("sr",b.width+"x"+b.height),a.set("cd",b.colorDepth+"-bit");if(b=k.navigator)a.set("la",b.language||b.browserLanguage||""),a.set("ja",b.javaEnabled()?1:0),a.set("acn",b.appCodeName),a.set("an",b.appName),a.set("pl",b.platform);
a.set("tz",(new Date).getTimezoneOffset());a.set("fv",zd());a.set("sv",y.a.i.VERSION);a.set("lv",Ad(this))}function Bd(a,b,c,d){var e=a.b.clone(),g=b.hb&&a.Oa();d=d||b.cb||k.location.href.split("#")[0];e.set("pt",document.title.substring(0,255));var l;if(l=b.C){var m;a:{l=b.C;for(m in l){m=!1;break a}m=!0}l=!m}l&&(m=y.ga.zb(b.C),e.set("cv",m.toString()));q(b.ma)&&b.ma.length&&(a=a.c(b.ma),e.set("ch",Ja(a)));g&&e.set("hash",g);(c||0==c)&&e.set("le",c);d&&e.set("url",d);return e}
function Ad(a){if(!a.a){a.a=B.get("last_visit");for(var b=["/",k.document.pathname],c=0,d=b.length;c<d;++c)B.remove("last_visit",b[c]);b=new Date;b=b.getTime()+6E4*b.getTimezoneOffset()+"::"+b.getTime();c="."+k.document.location.hostname.split("www.").pop();B.set("last_visit",b,864E5,"/",c)}return a.a||""}yd.prototype.c=function(a){for(var b=[],c=0,d=a.length;c<d;++c)b.push(a[c].substring(0,255));return b};
function zd(){var a=Lb.match(/[\d]+/g);if(!a||!a.length)return"";a.length=3;return a[0]+"."+a[1]+" r"+a[2]}yd.prototype.c=function(a){for(var b=[],c=0,d=a.length;c<d;++c)b.push(a[c].substring(0,255));return b};yd.prototype.Oa=function(){var a=k.location.hash.split("#")[1];return y.b.P(a)?null:a};function Cd(){this.a=this.c=this.b=void 0;this.g=!1;k.setTimeout(v(this.f,this),0)}Cd.prototype.f=function(){this.a=y.b.Ua();this.b=vd(window).a;this.c=this.a/10;var a=y.g.Aa(this.a),b=y.g.Aa(this.b);a&&b?(this.g=!0,S.B().addListener("resize",y.H.fb(this.Pa,this),this)):k.setTimeout(v(this.f,this),1E3)};Cd.prototype.Pa=function(){this.b=vd(window).a};function V(a,b){a&&a.log(Hc,b,void 0)};function Dd(a,b,c){if(u(a))c&&(a=v(a,c));else if(a&&"function"==typeof a.handleEvent)a=v(a.handleEvent,a);else throw Error("Invalid listener argument");return 2147483647<Number(b)?-1:k.setTimeout(a,b||0)};function Ed(a){md.call(this);this.Ha=new Eb;this.G=a||null;this.b=!1;this.v=this.a=null;this.g=this.ga=this.j="";this.f=this.W=this.h=this.V=!1;this.c=0;this.l=null;this.ia=Fd;this.u=this.ja=!1}x(Ed,md);var Fd="",Gd=Ed.prototype,Hd=Mc("goog.net.XhrIo");Gd.F=Hd;var Id=/^https?$/i,Jd=["POST","PUT"];
Ed.prototype.send=function(a,b,c,d){if(this.a)throw Error("[goog.net.XhrIo] Object is active with another request="+this.j+"; newUri="+a);b=b?b.toUpperCase():"GET";this.j=a;this.g="";this.ga=b;this.V=!1;this.b=!0;this.a=this.G?Db(this.G):Db(Bb);this.v=this.G?bb(this.G):bb(Bb);this.a.onreadystatechange=v(this.ha,this);try{V(this.F,W(this,"Opening Xhr")),this.W=!0,this.a.open(b,String(a),!0),this.W=!1}catch(g){V(this.F,W(this,"Error opening Xhr: "+g.message));Kd(this,g);return}a=c||"";var e=this.Ha.clone();
d&&Hb(d,function(a,b){e.set(b,a)});d=nb(e.R(),Ld);c=k.FormData&&a instanceof k.FormData;!(0<=F(Jd,b))||d||c||e.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");e.forEach(function(a,b){this.a.setRequestHeader(b,a)},this);this.ia&&(this.a.responseType=this.ia);Sa(this.a)&&(this.a.withCredentials=this.ja);try{Md(this),0<this.c&&(this.u=Nd(this.a),V(this.F,W(this,"Will abort after "+this.c+"ms if incomplete, xhr2 "+this.u)),this.u?(this.a.timeout=this.c,this.a.ontimeout=v(this.Da,
this)):this.l=Dd(this.Da,this.c,this)),V(this.F,W(this,"Sending request")),this.h=!0,this.a.send(a),this.h=!1}catch(g){V(this.F,W(this,"Send error: "+g.message)),Kd(this,g)}};function Nd(a){return L&&M(9)&&"number"==typeof a.timeout&&n(a.ontimeout)}function Ld(a){return"content-type"==a.toLowerCase()}
Ed.prototype.Da=function(){"undefined"!=typeof h&&this.a&&(this.g="Timed out after "+this.c+"ms, aborting",V(this.F,W(this,this.g)),U(this,"timeout"),this.a&&this.b&&(V(this.F,W(this,"Aborting")),this.b=!1,this.f=!0,this.a.abort(),this.f=!1,U(this,"complete"),U(this,"abort"),Od(this)))};function Kd(a,b){a.b=!1;a.a&&(a.f=!0,a.a.abort(),a.f=!1);a.g=b;Pd(a);Od(a)}function Pd(a){a.V||(a.V=!0,U(a,"complete"),U(a,"error"))}Ed.prototype.ha=function(){this.H||(this.W||this.h||this.f?Qd(this):this.Ja())};
Ed.prototype.Ja=function(){Qd(this)};
function Qd(a){if(a.b&&"undefined"!=typeof h)if(a.v[1]&&4==Rd(a)&&2==Sd(a))V(a.F,W(a,"Local request error detected and ignored"));else if(a.h&&4==Rd(a))Dd(a.ha,0,a);else if(U(a,"readystatechange"),4==Rd(a)){V(a.F,W(a,"Request complete"));a.b=!1;try{var b=Sd(a),c;a:switch(b){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:c=!0;break a;default:c=!1}var d;if(!(d=c)){var e;if(e=0===b){var g=String(a.j).match(Ib)[1]||null;if(!g&&k.self&&k.self.location)var l=k.self.location.protocol,g=
l.substr(0,l.length-1);e=!Id.test(g?g.toLowerCase():"")}d=e}if(d)U(a,"complete"),U(a,"success");else{var m;try{m=2<Rd(a)?a.a.statusText:""}catch(r){V(a.F,"Can not get status: "+r.message),m=""}a.g=m+" ["+Sd(a)+"]";Pd(a)}}finally{Od(a)}}}function Od(a){if(a.a){Md(a);var b=a.a,c=a.v[0]?p:null;a.a=null;a.v=null;U(a,"ready");try{b.onreadystatechange=c}catch(d){(a=a.F)&&a.log(Fc,"Problem encountered resetting onreadystatechange: "+d.message,void 0)}}}
function Md(a){a.a&&a.u&&(a.a.ontimeout=null);"number"==typeof a.l&&(k.clearTimeout(a.l),a.l=null)}function Rd(a){return a.a?a.a.readyState:0}function Sd(a){try{return 2<Rd(a)?a.a.status:-1}catch(b){return-1}}function W(a,b){return b+" ["+a.ga+" "+a.j+" "+Sd(a)+"]"};function Td(){this.a=void 0}Td.prototype.send=function(a,b,c){Ud(this,c);this.a.send(a,"POST",b)};function Ud(a,b){a.a=new Ed;a.a.ja=!0;a.a.c=Math.max(0,ka);Uc(a.a,"success",function(){b.eb()});Uc(a.a,"error",function(){b.error()})};function Vd(){this.a=new ja;this.c=new Td;this.b=new ia}aa(Vd);var ka=1E3,Wd="withCredentials"in new XMLHttpRequest,Xd=!!k.navigator.sendBeacon;Vd.prototype.send=function(a,b,c,d,e){a=e||a.ya();c===Yd?this.b.send(a,b.toString(),d):c===Zd?this.c.send(a,b.toString(),d):c===$d&&(b.setMeta("rn",y.g.Ba()),a+="?"+b.toString(),this.a.send(a,d))};function ae(){this.a=new sb;this.u=new Vd;this.h=!1;this.b=0;this.c=!1;this.f=0}aa(ae);var Yd="beacon",Zd="xhr",$d="image";ae.prototype.g=function(){if(this.a.D())this.h=!1;else{var a=this.a.M(),b=a.url;this.u.send(a.data[0][0],a.data[0][1],a.type,{eb:v(this.l,this),error:v(this.j,this)},b)}};ae.prototype.l=function(){this.c=!1;this.b=this.f=0;var a=this.a.M();a.data.shift();0===a.data.length&&(a=this.a.na(),a.Z&&a.Z());this.g()};
ae.prototype.j=function(){if(5<=this.f++)this.c=!1,this.b=this.f=0;else{if(!this.c){this.c=!0;var a=this.a.M();a&&a.data&&a.data[0][1].set("retry",1)}this.b+=250;k.setTimeout(v(this.g,this),this.b)}};function be(){this.b=S.B();this.g=new kd;this.j=new Cd;this.h=new sa(v(this.v,this));this.f=!0;this.c=this.a=void 0;this.b.a("visibility",this.u,this);this.a={time:0,ea:qb(10)};Xd&&this.g.c?this.g.a&&this.h.start():new gd;var a=y.H.fb(this.l,this);this.b.addListener(ce,a,this);de(this)}var ce=["click","mousedown","keydown","scroll"];be.prototype.u=function(){var a=this.g.a;if(Xd){var b=this.h;a?b.start():(b.b=!1,va(b))}};
be.prototype.v=function(){if(this.f){var a=this.j,b,c;c=(k||window).document;b=(c?new xd(9==c.nodeType?c:c.ownerDocument||c.document):Ia||(Ia=new xd)).a;c=b.scrollingElement?b.scrollingElement:rc||"CSS1Compat"!=b.compatMode?b.body||b.documentElement:b.documentElement;b=wd(b);var d=(L&&M("10")&&b.pageYOffset!=c.scrollTop?new Ab(c.scrollLeft,c.scrollTop):new Ab(b.pageXOffset||c.scrollLeft,b.pageYOffset||c.scrollTop)).J;a.a=y.b.Ua();b=Math.floor(d/a.c+.3);c=Math.floor((d+a.b)/a.c+.7)-1;a.a<d+a.b&&(c=
y.g.trunc(c,10)-1);a=Math.ceil(a.a/a.c)-1;d=y.g.wb(b)&&y.g.Aa(c)&&y.g.Aa(a);if(this.j.g&&d)for(a+1>this.a.ea.length&&(this.a.ea=pb(this.a.ea,qb(a-this.a.ea.length+1))),a=b;a<=c;++a)this.a.ea[a]++;this.a.time++}};be.prototype.l=function(){this.f=!0;de(this)};function de(a){a.c&&k.clearTimeout(a.c);a.c=k.setTimeout(v(function(){this.f=!1},a),3E4)};
function ee(a,b){this.f=[];this.H=b||null;this.a=this.b=!1;this.c=void 0;this.u=this.v=this.h=!1;this.g=0;this.j=null;this.G=0}ee.prototype.l=function(a,b){this.h=!1;fe(this,a,b)};function fe(a,b,c){a.b=!0;a.c=c;a.a=!b;ge(a)}function he(a){if(a.b){if(!a.u)throw new ie;a.u=!1}}ee.prototype.Z=function(a){he(this);fe(this,!0,a)};function je(a,b,c){a.f.push([b,c,void 0]);a.b&&ge(a)}
ee.prototype.then=function(a,b,c){var d,e,g=new J(function(a,b){d=a;e=b});je(this,d,function(a){e(a)});return g.then(a,b,c)};Wa(ee);function ke(a){return mb(a.f,function(a){return u(a[1])})}
function ge(a){if(a.g&&a.b&&ke(a)){var b=a.g,c=le[b];c&&(k.clearTimeout(c.a),delete le[b]);a.g=0}a.j&&(a.j.G--,delete a.j);for(var b=a.c,d=c=!1;a.f.length&&!a.h;){var e=a.f.shift(),g=e[0],l=e[1],e=e[2];if(g=a.a?l:g)try{var m=g.call(e||a.H,b);n(m)&&(a.a=a.a&&(m==b||m instanceof Error),a.c=b=m);if(Xa(b)||"function"===typeof k.Promise&&b instanceof k.Promise)d=!0,a.h=!0}catch(r){b=r,a.a=!0,ke(a)||(c=!0)}}a.c=b;d&&(m=v(a.l,a,!0),d=v(a.l,a,!1),b instanceof ee?(je(b,m,d),b.v=!0):b.then(m,d));c&&(b=new me(b),
le[b.a]=b,a.g=b.a)}function ie(){C.call(this)}x(ie,C);ie.prototype.message="Deferred has already fired";ie.prototype.name="AlreadyCalledError";function me(a){this.a=k.setTimeout(v(this.c,this),0);this.b=a}me.prototype.c=function(){delete le[this.a];throw this.b;};var le={};function ne(a){var b={},c=b.document||document,d=document.createElement("SCRIPT"),e={Qc:d,Da:void 0},g=new ee(0,e),l=null,m=null!=b.timeout?b.timeout:5E3;0<m&&(l=window.setTimeout(function(){oe(d,!0);var b=new pe(qe,"Timeout reached for loading script "+a);he(g);fe(g,!1,b)},m),e.Da=l);d.onload=d.onreadystatechange=function(){d.readyState&&"loaded"!=d.readyState&&"complete"!=d.readyState||(oe(d,b.Mc||!1,l),g.Z(null))};d.onerror=function(){oe(d,!0,l);var b=new pe(re,"Error while loading script "+a);
he(g);fe(g,!1,b)};e=b.attributes||{};Ua(e,{type:"text/javascript",charset:"UTF-8",src:a});td(d,e);se(c).appendChild(d)}function se(a){var b=a.getElementsByTagName("HEAD");return b&&0!=b.length?b[0]:a.documentElement}function oe(a,b,c){null!=c&&k.clearTimeout(c);a.onload=p;a.onerror=p;a.onreadystatechange=p;b&&window.setTimeout(function(){a&&a.parentNode&&a.parentNode.removeChild(a)},0)}var re=0,qe=1;function pe(a,b){var c="Jsloader error (code #"+a+")";b&&(c+=": "+b);C.call(this,c)}x(pe,C);function te(){this.b={};this.a={};this.c=S.B();for(var a in ue)this.a[ue[a].name]=[];this.c.a("module_init",this.f,this)}aa(te);var ve="//st.top100.ru/top100/1.8.0/",ue={Mb:{name:"usability",path:"usability.js"},Eb:{name:"ecommerce",path:"ecommerce.js"}};function we(a,b,c){a.b[b.name]||(ne(ve+b.path),a.a[b.name].push(c))}te.prototype.f=function(a,b){for(this.b[a]=b;this.a[a].length;)this.a[a].shift()(b)};function xe(){this.j=this.h=this.b=this.g=void 0;this.v=ae.B();this.u=te.B();this.a=[];this.f=[];this.l=!1;this.c=S.B();this.g=new yd;new od;this.h=Bc.B();this.c.a("extLink",this.fc,this);this.c.a("click",this.cc,this);this.c.a("tap",this.Qa,this);this.c.a("ecommerce",this.dc,this);this.j=new be;this.c.a("activity",this.ac,this);this.c.a("ping",this.ic,this);this.c.addListener("beforeunload",this.Ra,this)}aa(xe);
function ye(a,b){var c=ze(a,b);if(!c.ca){for(var d=0,e=a.a.length;d<e;++d)a.a[d].id==c.id&&a.a.splice(d,1);c.w&&0<c.w.length&&we(a.u,ue.Mb,v(a.lc,a));c.L&&we(a.u,ue.Eb,v(a.ec,a));c.aa&&Ae(a,c.aa);a.a.push(c);c.ca||(c.element?(d=y.b.P(c.element))&&1===d.nodeType&&(d.innerHTML=a.ba(c.s,0)):a.U(c.s));c.s.o.Ea&&k.setTimeout(v(function(){var a=c.s,b;b=this.h;if(0===b.a.length)b=null;else{var d=new D;d.K("et","ll");d.set("ll",Ja(b.a));b=d}b&&(b=X(a,b),Y(this,[[a,b]],void 0,void 0,a.Wa()))},a),0)}}f=xe.prototype;
f.U=function(a,b,c){b=Bd(this.g,a.o,b,c);b=X(a,b);Y(this,[[a,b]]);if(b=Be(this,a)){c=0;for(var d=b.w.length;c<d;++c)b.Ca[b.w[c]]=[];!a.o.Fa&&Ce(this,b)}};f.ba=function(a,b,c){b=Bd(this.g,a.o,b,c);b=X(a,b);b.K("rn",y.g.Ba());c=a.o.T;return'<a href="https://top100.rambler.ru'+(c?"/home?id="+c:"")+'" target="_blank"><img src="'+(a.ya()+"?"+b.toString())+'" title="Rambler\'s Top100" alt="Rambler\'s Top100" border="0" /></a>'};
function Y(a,b,c,d,e){a=a.v;var g={};c=c||5;if(1===c)g.type=Yd;else{var l=b[0][1],m=void 0,r=l.get("et"),I=["bv","cl","ec","extln","ll"];0<=F(["extln","act"],r)&&Xd?m=Yd:0<=F(I,r)&&Wd?m=Zd:2E3>=l.toString().length?m=$d:Wd&&(m=Zd);g.type=m}g.type&&(g.data=b,g.Z=d,g.url=e,a.a.enqueue(c,g),a.h||(a.h=!0,a.g()))}f.cc=function(){for(var a=void 0,b=0,c=this.a.length;b<c;++b){var a=this.a[b],d=this.b.getClicks(a.w);d&&(d=X(a.s,d),Y(this,[[a.s,d]]))}this.b.eraseClicksData()};
f.Qa=function(){for(var a=void 0,b=0,c=this.a.length;b<c;++b){var a=this.a[b],d=this.b.getClicks(a.w);d&&(d.set("clt","tap"),d=X(a.s,d),Y(this,[[a.s,d]]))}this.b.eraseClicksData()};f.ic=function(){var a=new D;a.set("et","ping");for(var b=void 0,c=[],d=0,e=this.a.length;d<e;++d)this.a[d].s.o.ca||(b=X(this.a[d].s,a.clone())),c.push([this.a[d].s,b]);0!==c.length&&Y(this,c)};
f.dc=function(a){for(var b=[],c=0,d=this.a.length;c<d;++c)if(this.a[c].L){var e=X(this.a[c].s,a.clone());b.push([this.a[c].s,e])}0!==b.length&&Y(this,b)};f.fc=function(a,b){for(var c=[],d=0,e=this.a.length;d<e;++d)this.a[d].s.o.Ea||a.remove("um_log"),c.push([this.a[d].s,X(this.a[d].s,a.clone())]);0!==c.length&&Y(this,c,void 0,b)};f.ac=function(a,b){for(var c=[],d=b?1:5,e=0,g=this.a.length;e<g;++e)c.push([this.a[e].s,X(this.a[e].s,a.clone())]);0!==c.length&&Y(this,c,d)};
function ze(a,b){var c={},d=b.o;c.id=b.wa();c.s=b;c.element=d.P();c.w=d.Sa;c.L=d.L;c.ca=d.ca;c.Pc=!1;c.Ca={};c.aa=d.Ta;if(c.aa.length)for(var d=0,e=c.aa.length;d<e;++d)0<=F(c.w,c.aa[d])||c.w.push(c.aa[d]);if(a.f.length)for(d=0,e=a.f.length;d<e;++d)0<=F(c.w,a.f[d])||c.w.push(a.f[d]);d=0;for(e=c.w.length;d<e;++d)c.Ca[c.w[d]]=[];return c}function Be(a,b){for(var c=b.wa(),d=0,e=a.a.length;d<e;++d)if(a.a[d].id===c)return a.a[d];return null}
function Ae(a,b){for(var c=0,d=a.a.length;c<d;++c)for(var e=a.a[c],g=b,l=0,m=g.length;l<m;++l)0<=F(e.w,g[l])||(e.w.push(g[l]),e.Ca[g[l]]=[]);c=0;for(d=b.length;c<d;++c)0<=F(a.f,b[c])||a.f.push(b[c]);a.b&&a.b.addAttributes(b);a.Y()}function Ce(a,b){if(a.b){var c=a.b.getBlocks(b.w,b.Ca),d=void 0;if(c)for(var e=0,g=c.length;e<g;++e)d=c[e],d.isEmpty()||(d=X(b.s,d),Y(a,[[b.s,d]]))}}
f.lc=function(a){this.b=a();a=0;for(var b=this.a.length;a<b;++a)this.b.addAttributes(this.a[a].w);this.Y();k.setTimeout(v(this.Y,this),1E3);k.setTimeout(v(this.Y,this),2E3);k.setTimeout(v(this.Y,this),4E3);k.setTimeout(v(this.Y,this),8E3)};f.Y=function(){for(var a=0,b=this.a.length;a<b;++a)!this.a[a].s.o.Fa&&Ce(this,this.a[a])};f.ec=function(a){for(var b=void 0,c=0,d=this.a.length;c<d;++c)if(this.a[c].L){b=this.a[c].L;break}a(b)};
f.Ra=function(){if(!this.l){if(Xd){var a=this.j,b=new D,c=Ja({time:a.a.time,screens:a.a.ea});b.K("et","act");b.set("meta",c);a.b.b("activity",b,!0)}this.l=!0}};function De(a,b){this.a=this.b=void 0;Ee(this);this.version="1.8.0";if(a){if(this.T=a.project,this.Sa=a.attributes_dataset||[],this.Ta=a.common_attributes||[],this.fa=a.splits||[],this.ma=a.chapters||[],this.C=a.custom_vars||{},this.L=a.ecommerce||void 0,this.element=a.element||void 0,this.hb=a.trackHashes||!1,this.Ea=a.trackLinks||!1,this.cb=a.url||void 0,this.Fa=a.usabilityManualControl||!1,a.user_id||null===a.user_id?this.N=a.user_id:this.N=void 0,!0===a.useYmId&&(this.Ka=y.h.rc()),a.sync){var c=
a.sync;this.C=this.C||{};this.C.__uid=c}}else this.T=ha.Ac,this.Sa=[],this.Ta=[],this.fa=[],this.ma=[],this.N=this.element=this.L=this.C=void 0,this.Ea=this.hb=!1,this.cb=void 0,this.Fa=!1;var c=this.T||"-1",d=a&&a.protocol;if(d){var e=void 0,g;for(g in Fe)if(e=Fe[g],d.split(":")[0]===e){":"!==e[e.length-1]&&(e=e+":");this.ka=e;break}ve=this.ka+ve}else this.ka=void 0;g=a.top100Id;this.gb=y.c.xa(c);if("string"===typeof g||"number"===typeof g)this.rb=g;c=void 0;this.ka?c=this.ka:c="https:"===k.location.protocol?
"https:":"http:";this.b=c+"//kraken.rambler.ru/cnt/";this.a=c+"//kraken.rambler.ru/um_cnt/";this.ca=b||!1}var Fe={Dc:"http",Ec:"https"};f=De.prototype;f.version=void 0;f.gb="";f.Ka="";f.rb=void 0;f.T=void 0;f.$a=void 0;f.Sa=void 0;f.Ta=void 0;f.fa=void 0;f.ma=void 0;f.C=void 0;f.name=void 0;f.L=void 0;f.element=void 0;f.ka=void 0;f.ca=void 0;f.N=void 0;f.hb=void 0;f.Ea=void 0;f.cb=void 0;f.Fa=!1;f.ya=function(){return this.b};f.Wa=function(){return this.a};f.bb=function(a){this.name=a};f.P=function(){return this.element};
function Ee(a){a.$a=(new Date/1E3).toString()+"-"+y.g.Ba().toString()};function Ge(a,b){this.o=new De(a,b);this.a=xe.B();ye(this.a,this)}f=Ge.prototype;f.ya=function(){return this.o.ya()};f.Wa=function(){return this.o.Wa()};f.bb=function(a){this.o.bb(a)};f.wa=function(){return this.o.T};f.ab=function(a){this.o.T=a};f.U=function(a){Ee(this.o);this.a.U(this,1,a)};f.ib=function(a,b){var c=y.b.P(a);c&&1===c.nodeType?c.innerHTML=this.a.ba(this,0,b):this.a.U(this,0,b)};f.sb=function(a,b){var c=y.b.P(a);c&&1===c.nodeType&&(c.innerHTML=this.a.ba(this,2,b))};f.pc=function(){return this.o.$a};
f.ba=function(){return this.a.ba(this,0)};f.kb=function(){};f.nb=function(a){var b=this.o;a.splits&&(b.fa=a.splits);a.custom_vars&&(b.C=a.custom_vars)};f.mb=function(a,b){var c=this.o;c.C=c.C||{};c.C[a]=b};f.xb=function(a){this.b("__uid",a)};f.lb=function(a){var b=this.a;a=y.ha.Va(a);a=X(this,a);Y(b,[[this,a]])};f.Gb=function(){var a=this.a;Ce(a,Be(a,this))};f.Hb=function(a){var b=this.o;b.N||null===b.N?(this.o.N=a,a=this.a,b=y.ia.Va(),b=X(this,b),Y(a,[[this,b]])):y.W.wc()};
function X(a,b){var c=a.o;b.setMeta("pid",c.T);b.setMeta("rid",c.$a);b.setMeta("tid",c.rb||c.gb);b.setMeta("v",c.version);q(c.fa)&&c.fa.length&&b.set("sp",Ja(c.fa));a.o.N&&b.setMeta("uid",c.N);c.Ka&&b.setMeta("yid",c.Ka);return b}f.xa=function(){return this.o.gb};var Z=Ge.prototype;Z.setAccount=Z.ab;Z.getAccount=Z.wa;Z.trackPageview=Z.U;Z.trackPageView=Z.U;Z.trackPageviewByLogo=Z.ib;Z.trackPageViewByLogo=Z.ib;Z.drawLogoTo=Z.sb;Z.setCustomVar=Z.mb;Z.getCustomVar=Z.kb;Z.sendCustomVars=Z.lb;
Z.getWidgetHtml=Z.ba;Z.syncUserId=Z.Hb;Z.sync=Z.xb;Z.getRequestId=Z.pc;Z.sendBlocks=Z.Gb;Z.getTop100Id=Z.xa;Z.updateOptions=Z.nb;function y(a,b){a.checkInit&&k.setTimeout(function(){y.G.oc("initKraken"+a.project)},0);if(b)return new Ge(a,b);y.v[a.project]=new Ge(a,b);return y.v[a.project]}y.v={};y.Hc={};y.Ha=0;y.Ia=function(){return S.B()};y.Fc=function(){return S.B()};y.V=function(a,b){var c=void 0!==a?a:"~"+y.Ha++,d=new y({},!0);y.v[c]=d;d.bb(c);b&&d.ab(b);return d};y.Ja=function(a){return y.V(void 0,a)};y.ja=function(a){a=a||"";return y.v[a]||y.V(a)};y.loaded=!0;y.Fb=!0;
y.ra=function(a){var b=k[a];b&&b.isTop100Namespace||(k[a]=y)};y.ra("Kraken");y.ra("top100");function He(){}He.prototype.push=function(){for(var a=arguments,b=0;b<a.length;b++)try{if("function"===typeof a[b])a[b]();else{var c="",d=a[b][0],e=d.lastIndexOf(".");0<e&&(c=d.substring(0,e),d=d.substring(e+1));var g=y.ja(c);g[d].apply(g,a[b].slice(1))}}catch(l){console.error(l)}};
if(k._top100q&&q(k._top100q)){var Ie=new He;for(k._top100q=k._top100q.reverse();k._top100q.length;)Ie.push(k._top100q.pop());k._top100q=Ie}k._top100q||(k._top100q=new He);Z=Ge.prototype;Z.setAccount=Z.ab;Z.getAccount=Z.wa;Z.trackPageview=Z.U;Z.trackPageviewByLogo=Z.ib;Z.drawLogoTo=Z.sb;Z.setCustomVar=Z.mb;Z.getCustomVar=Z.kb;Z.sendCustomVars=Z.lb;Z.sync=Z.xb;Z.getTop100Id=Z.xa;Z.updateOptions=Z.nb;window._top100||(window._top100={},window._top100.createTracker=y.V,window._top100.getTrackerByName=y.ja,window._top100.getTracker=y.Ja,window._top100.getPubSub=y.Ia,window._top100.loaded=y.loaded,y.isTop100Namespace=y.Fb);})();

Binary file not shown.

After

Width:  |  Height:  |  Size: 579 B

View File

@ -76,7 +76,7 @@ static char *get_USB(){
}
int main(void){
uint32_t lastT = 0;
uint32_t lastT = 0, lastTmon = 0;
char *txt;
sysreset();
SysTick_Config(6000, 1);
@ -94,11 +94,17 @@ int main(void){
process_monitor();
lastT = Tms;
}
if(showMon && Tms - lastTmon > 4999){
showState();
IWDG->KR = IWDG_REFRESH;
lastTmon = Tms;
}
usb_proc();
if((txt = get_USB())){
IWDG->KR = IWDG_REFRESH;
cmd_parser(txt);
}
IWDG->KR = IWDG_REFRESH;
buzzer_chk();
}
return 0;

View File

@ -33,31 +33,58 @@ static const int16_t tmax[3] = {900, 800, 600}; // critical T, turn off power af
static const int16_t t3max = 850;
static uint8_t dontprocess = 0; // don't process monitor
static uint32_t TOff = 0; // time to turn off power
// show hardcoded settings
void showSettings(){
SEND("Thysteresis=30\n");
SEND("Tmin={400, 350, 350}\n");
SEND("Tmax={900, 800, 600}\n");
SEND("T3max=850");
}
static void chkOffRelay(){
static uint32_t scntr = 0;
if(!TOff){ // warning cleared
scntr = 0;
return;
}
if(Tms > TOff){
TOff = 0;
OFF(RELAY);
SEND("Turn off power");
//TIM1->CCR1 = 0; TIM1->CCR2 = 0; TIM1->CCR3 = 0;
//dontprocess = 1;
SEND("POWEROFF");
buzzer = BUZZER_OFF;
}else SEND("TCRITSHUTDOWNn");
scntr = 0;
}else{
SEND("TCRITSHUTDOWN");
printu(++scntr);
}
NL();
}
static void startOff(){
SEND("TCRITSHUTDOWN"); NL();
SEND("TCRITSHUTDOWN0"); NL();
TOff = Tms + TturnOff;
if(TOff == 0) TOff = 1;
buzzer = BUZZER_LONG;
buzzer = BUZZER_ON;
}
void SetDontProcess(uint8_t newstate){ // set dontprocess value
dontprocess = newstate;
}
uint8_t GetDontProcess(){ // get dontprocess value
return dontprocess;
}
// check buttons state
static void chkButtons(){
static uint32_t Tpressed = 0;
if(CHK(BUTTON0) == 0){ // button 0 pressed - turn on power if was off
if(CHK(RELAY) == 0){
ON(RELAY);
SEND("Button0: relay ON");NL();
SEND("POWERON"); NL();
}
dontprocess = 0;
}
@ -71,10 +98,13 @@ static void chkButtons(){
TIM1->CCR1 = 0; TIM1->CCR2 = 0; TIM1->CCR3 = 0;
OFF(RELAY);
dontprocess = 1;
SEND("Everything is OFF immediately");NL();
SEND("POWEROFF"); NL();
}else Tpressed = 0;
}
// maximum value of coolerproblem counter
#define MAXCOOLERPROBLEM (10)
// monitor temperatures and do something
void process_monitor(){
chkButtons();
@ -92,9 +122,8 @@ void process_monitor(){
if(T < tmin[x] - Thysteresis){ // turn off fan
*ccr = 0;
}else if(T > tmax[x] + Thysteresis){
if(TOff){
chkOffRelay();
}else{
gett('0'+x); NL();
if(!TOff){
offreason[x] = 1;
startOff();
*ccr = 100;
@ -104,18 +133,17 @@ void process_monitor(){
// check working fan
int chk = (x==0) ? CHK(COOLER0) : CHK(COOLER1);
if(chk){ // fan is working, check RPM
if(RPM && speed == 0){
SEND("RPM: "); printu(RPM); SEND(", speed: "); printu(speed); newline();
SEND("Cooler"); bufputchar('0'+x); SEND(" died!");NL();
buzzer = BUZZER_SHORT;
coolerproblem[x] = 1;
if(RPM && (speed == 0)){
if(coolerproblem[x] > MAXCOOLERPROBLEM){
buzzer = BUZZER_SHORT;
SEND("COOLER"); bufputchar('0'+x); SEND("DEAD");NL();
}else ++coolerproblem[x];
}else if(coolerproblem[x]){
buzzer = BUZZER_OFF;
coolerproblem[x] = 0;
SEND("Cooler OK");NL();
SEND("COOLER"); bufputchar('0'+x); SEND("OK");NL();
}
}else{ // turn on fan
SEND("Turn fan ON"); NL();
if(x==0) ON(COOLER0);
else ON(COOLER1);
}
@ -125,7 +153,6 @@ SEND("RPM: "); printu(RPM); SEND(", speed: "); printu(speed); newline();
uint32_t pwm = 20 + tx;
if(pwm < 20) pwm = 20;
else if(pwm > 100) pwm = 100;
SEND("Set pwm"); bufputchar('0'+x);SEND(" to "); printu(pwm);NL();
*ccr = pwm;
}
}
@ -135,9 +162,8 @@ SEND("Set pwm"); bufputchar('0'+x);SEND(" to "); printu(pwm);NL();
if(T < tmin[2] - Thysteresis){ // turn off fan
TIM1->CCR3 = 0;
}else if(T > tmax[2] + Thysteresis){
if(TOff){
chkOffRelay();
}else{
gett('2'); NL();
if(!TOff){
offreason[2] = 1;
startOff();
TIM1->CCR3 = 100;
@ -150,15 +176,18 @@ SEND("Set pwm"); bufputchar('0'+x);SEND(" to "); printu(pwm);NL();
uint32_t pwm = 40 + tx;
if(pwm < 40) pwm = 40;
else if(pwm > 100) pwm = 100;
SEND("Set pwm3 to "); printu(pwm);NL();
TIM1->CCR3 = pwm;
}
}
// T3 - turn off power after TturnOff
if(getNTC(3) > t3max){
if(TOff){
chkOffRelay();
}else{
gett('3'); NL();
// all coolers to max value
TIM1->CCR1 = 100;
TIM1->CCR2 = 100;
TIM1->CCR3 = 100;
ON(COOLER0); ON(COOLER1);
if(!TOff){
offreason[3] = 1;
startOff();
}
@ -172,9 +201,10 @@ SEND("Set pwm3 to "); printu(pwm);NL();
break;
}
if(!stillbad){
SEND("No reason to panic");NL();
SEND("CLRPANIC");NL();
TOff = 0;
buzzer = BUZZER_OFF;
}
chkOffRelay();
}
}

View File

@ -19,10 +19,14 @@
#pragma once
#ifndef MONITOR_H__
#include <stdint.h>
// run monitor each 1s
#define MONITOR_PERIOD (999)
void process_monitor();
void showSettings();
void SetDontProcess(uint8_t newstate);
uint8_t GetDontProcess();
#define MONITOR_H__
#endif // MONITOR_H__

View File

@ -22,11 +22,15 @@
*/
#include "adc.h"
#include "hardware.h"
#include "monitor.h"
#include "proto.h"
#include "usb.h"
#include <string.h> // strlen
uint8_t showMon = 0; // start monitoring @ each 5s
static char buff[BUFSZ+1], *bptr = buff;
static uint8_t blen = 0;
@ -130,6 +134,7 @@ char *getnum(char *txt, uint32_t *N){
return getdec(txt, N);
}
// change pin state
static void onoff(char state, GPIO_TypeDef *port, uint32_t pin, char *text){
switch(state){
case '0': // off
@ -153,32 +158,54 @@ static inline void ADCget(char chno){
return;
}
int nch = chno - '0';
SEND("ADCval");
SEND("ADCVAL");
bufputchar(chno);
bufputchar('=');
printu(getADCval(nch));
}
// get coolerx RPM
static inline void coolerRPM(char n){
// get coolerx RPS
static inline void coolerRPS(char n){
if(n < '0' || n > '1'){
SEND("Cooler number should be 0 or 1\n");
SEND("Cooler number should be 0 or 1");
return;
}
SEND("RPM");
SEND("RPS");
bufputchar(n);
bufputchar('=');
printu(Coolerspeed[n - '0']);
}
// change Coolerx RPM
static inline void changeRPM(char *str){
static inline void getPWM(char n){
if(n < '0' || n > '2'){
SEND("Cooler number should be from 0 to 2");
return;
}
SEND("PWM");
bufputchar(n);
bufputchar('=');
uint32_t pwm;
switch(n){
case '0':
pwm = TIM1->CCR1;
break;
case '1':
pwm = TIM1->CCR2;
break;
default:
pwm = TIM1->CCR3;
}
printu(pwm);
}
// change Coolerx PWM
static inline void changePWM(char *str){
char channel = *str++;
str = omit_spaces(str);
uint32_t rpm;
getnum(str, &rpm);
if(rpm > 100){
SEND("RPM should be from 0 to 100%\n");
SEND("PWM should be from 0 to 100%");
return;
}
switch(channel){
@ -192,35 +219,35 @@ static inline void changeRPM(char *str){
TIM1->CCR3 = rpm;
break;
default:
SEND("Cooler number should be from 0 to 2\n");
SEND("Cooler number should be from 0 to 2");
}
}
static inline void buzzercmd(char cmd){
SEND("Buzzer: ");
SEND("BUZZER=");
switch(cmd){
case '0':
buzzer = BUZZER_OFF;
SEND("off");
SEND("OFF");
break;
case '1':
buzzer = BUZZER_ON;
SEND("on");
SEND("ON");
break;
case 'l':
buzzer = BUZZER_LONG;
SEND("long beeps");
SEND("LONG");
break;
case 's':
buzzer = BUZZER_SHORT;
SEND("short beeps");
SEND("SHORT");
break;
default:
SEND("wrong command");
SEND("BADSTATE");
}
}
static inline void gett(char chno){
void gett(char chno){
if(chno < '0' || chno > '3'){
SEND("Temperature channel should be 0..3");
return;
@ -229,6 +256,56 @@ static inline void gett(char chno){
printi(getNTC(chno - '0'));
}
static inline void chkButtons(){
SEND("BUTTON0=");
bufputchar('1' - CHK(BUTTON0)); // buttons are inverted
SEND("\nBUTTON1=");
bufputchar('1' - CHK(BUTTON1));
}
// show current device state: T, RPM, PWM, relay
void showState(){
SEND("TIME=");
printu(Tms);
newline();
for(char x = '0'; x < '4'; ++x){
gett(x);
newline();
}
SEND("BUZZER=");
switch(buzzer){
case BUZZER_ON:
SEND("ON");
break;
case BUZZER_OFF:
SEND("OFF");
break;
case BUZZER_SHORT:
SEND("SHORT");
break;
case BUZZER_LONG:
SEND("LONG");
break;
}
newline();
chkButtons();
newline();
coolerRPS('0');
newline();
coolerRPS('1');
newline();
for(char x = '0'; x < '3'; ++x){
getPWM(x);
newline();
}
onoff('c', COOLER0_port, COOLER0_pin, "COOLER0");
newline();
onoff('c', COOLER1_port, COOLER1_pin, "COOLER1");
newline();
onoff('c', RELAY_port, RELAY_pin, "RELAY");
NL();
}
/**
* @brief cmd_parser - command parsing
* @param txt - buffer with commands & data
@ -241,11 +318,11 @@ void cmd_parser(char *txt){
*/
switch(_1st){
case '0': // cooler0: set/clear/check
onoff(txt[1], COOLER0_port, COOLER0_pin, "Cooler0");
onoff(txt[1], COOLER0_port, COOLER0_pin, "COOLER0");
goto eof;
break;
case '1': // cooler0: set/clear/check
onoff(txt[1], COOLER1_port, COOLER1_pin, "Cooler1");
case '1': // cooler1: set/clear/check
onoff(txt[1], COOLER1_port, COOLER1_pin, "COOLER1");
goto eof;
break;
case 'A': // ADC raw values
@ -256,16 +333,20 @@ void cmd_parser(char *txt){
buzzercmd(txt[1]);
goto eof;
break;
case 'C': // Cooler RPM
coolerRPM(txt[1]);
case 'C': // Get real Cooler RPM
coolerRPS(txt[1]);
goto eof;
break;
case 'G': // get cooler PWM from settings
getPWM(txt[1]);
goto eof;
break;
case 'r': // relay: set/clear/check
onoff(txt[1], RELAY_port, RELAY_pin, "Relay");
onoff(txt[1], RELAY_port, RELAY_pin, "RELAY");
goto eof;
break;
case 'S': // set RPM
changeRPM(txt+1);
case 'S': // set PWM
changePWM(txt+1);
goto eof;
break;
case 't':
@ -275,33 +356,38 @@ void cmd_parser(char *txt){
}
if(txt[1] != '\n') *txt = '?'; // help for wrong message length
switch(_1st){
case 'a':
SEND("ADC1->DR=");
printu(ADC1->DR);
break;
case 'B':
SEND("Button0=");
bufputchar('1' - CHK(BUTTON0)); // buttons are inverted
SEND("\nButton1=");
bufputchar('1' - CHK(BUTTON1));
chkButtons();
break;
case 'D':
SEND("Go into DFU mode\n");
sendbuf();
Jump2Boot();
break;
case 'E':
showState();
break;
case 'M': // MCU temperature
SEND("MCUtemp=");
SEND("MCUTEMP=");
printu(getMCUtemp());
break;
case 'm': // toggle monitoring
showMon = !showMon;
SEND("MONITORING=");
if(showMon) SEND("on");
else SEND("off");
break;
case 'R':
SEND("Soft reset\n");
sendbuf();
pause_ms(5); // a little pause to transmit data
NVIC_SystemReset();
break;
case 's':
showSettings();
break;
case 'T':
SEND("Time (ms): ");
SEND("TIME=");
printu(Tms);
newline();
break;
@ -317,24 +403,34 @@ void cmd_parser(char *txt){
adc_setup();
SEND("ADC restarted\n");
break;
case '!':
SetDontProcess(!GetDontProcess());
if(GetDontProcess()) SEND("\n\tManual");
else SEND("\n\tAutomatic");
SEND(" mode\n");
break;
default: // help
SEND(
"'0x' - turn cooler0 on/off (x=1/0) or get status (x - any other)\n"
"'1x' - turn cooler1 on/off (x=1/0) or get status (x - any other)\n"
"'Ax' - get ADC raw value (x=0..7)\n"
"'a' - show current value of ADC1->DR\n"
"'B' - buttons' state\n"
"'bx' - buzzer: x==0 - off, x==1 - on, x==l - long beeps, x==s - short beeps\n"
"'Cx' - get cooler x (0/1) RPM\n"
"'Cx' - get cooler x (0/1) RPS\n"
"'D' - activate DFU mode\n"
"'E' - show current state\n"
"'Gx' - get cooler x (0..3) PWM settings\n"
"'M' - get MCU temperature\n"
"'m' - toggle monitoring\n"
"'R' - software reset\n"
"'rx' - relay on/off (x=1/0) or get status\n"
"'Sx y' - set coolerx RPM to y\n"
"'Sx y' - set coolerx PWM to y\n"
"'s' - show settings\n"
"'T' - get time from start (ms)\n"
"'tx' - get temperature x (0..3)\n"
"'V' - get voltage\n"
"'Z' - reinit ADC\n"
"'!' - switch between manual and automatic modes\n"
);
break;
}

View File

@ -42,13 +42,17 @@
// newline with buffer sending
#define NL() do{bufputchar('\n'); sendbuf();}while(0)
extern uint8_t showMon;
void cmd_parser(char *buf);
void addtobuf(const char *txt);
void bufputchar(char ch);
void gett(char chno);
void printu(uint32_t val);
void printi(int32_t val);
void printuhex(uint32_t val);
void sendbuf();
void showState();
char *omit_spaces(char *buf);
char *getnum(char *buf, uint32_t *N);

Binary file not shown.