PageSourceSearch

https://smart-lab.ru/templates/cache/smart-lab-x3/a2af1f4bc8001b0a783b035fd52e8e8e.js?5528

js smart-lab.ru collected 2026-09-24 17:44:00 UTC 501,634 bytes, 7,072 lines download raw bytes

1// Automatic generation on 2026-09-24 11:42:02
2var aRouter = {};
3aRouter['error'] = '/error/';
4aRouter['registration'] = '/registration/';
5aRouter['profile'] = '/profile/';
6aRouter['blog'] = '/blog/';
7aRouter['top'] = '/top/';
8aRouter['index'] = '/index/';
9aRouter['topic'] = '/topic/';
10aRouter['login'] = '/login/';
11aRouter['people'] = '/people/';
12aRouter['settings'] = '/settings/';
13aRouter['tag'] = '/tag/';
14aRouter['talk'] = '/talk/';
15aRouter['allcomments'] = '/allcomments/';
16aRouter['rss'] = '/rss/';
17aRouter['link'] = '/link/';
18aRouter['question'] = '/question/';
19aRouter['blogs'] = '/blogs/';
20aRouter['search'] = '/search/';
21aRouter['admin'] = '/admin/';
22aRouter['page'] = '/page/';
23aRouter['allpaid'] = '/allpaid/';
24aRouter['allpremium'] = '/allpremium/';
25aRouter['allblog'] = '/allblog/';
26aRouter['news'] = '/news/';
27aRouter['allsignals'] = '/allsignals/';
28aRouter['disclosure'] = '/disclosure/';
29aRouter['votes'] = '/votes/';
30aRouter['vopros'] = '/vopros/';
31aRouter['pushes'] = '/pushes/';
32aRouter['tags'] = '/tags/';
33aRouter['flow'] = '/flow/';
34aRouter['flow_old'] = '/flow_old/';
35aRouter['smm'] = '/smm/';
36aRouter['thisday'] = '/thisday/';
37aRouter['comments_week'] = '/comments_week/';
38aRouter['premium'] = '/premium/';
39aRouter['print'] = '/print/';
40aRouter['maintheme'] = '/maintheme/';
41aRouter['my'] = '/my/';
42aRouter['allvotes'] = '/allvotes/';
43aRouter['tradingreads'] = '/tradingreads/';
44aRouter['moderator'] = '/moderator/';
45aRouter['corp-stat'] = '/corp-stat/';
46aRouter['friends'] = '/friends/';
47aRouter['my-trading-account'] = '/my-trading-account/';
48aRouter['user-trading-account'] = '/user-trading-account/';
49aRouter['finansoviy-slovar'] = '/finansoviy-slovar/';
50aRouter['forums'] = '/forums/';
51aRouter['forum'] = '/forum/';
52aRouter['kompanii'] = '/kompanii/';
53aRouter['bonds'] = '/bonds/';
54aRouter['banki'] = '/banki/';
55aRouter['options'] = '/options/';
56aRouter['algotrading'] = '/algotrading/';
57aRouter['brokers-rating'] = '/brokers-rating/';
58aRouter['brokers'] = '/brokers/';
59aRouter['forex'] = '/forex/';
60aRouter['trading-software'] = '/trading-software/';
61aRouter['dividends'] = '/dividends/';
62aRouter['dividends_us'] = '/dividends_us/';
63aRouter['trading'] = '/trading/';
64aRouter['crypto'] = '/crypto/';
65aRouter['chat'] = '/chat/';
66aRouter['stocks'] = '/stocks/';
67aRouter['stocks-rating'] = '/stocks-rating/';
68aRouter['data'] = '/data/';
69aRouter['company'] = '/company/';
70aRouter['panel'] = '/panel/';
71aRouter['books'] = '/books/';
72aRouter['review'] = '/review/';
73aRouter['g'] = '/g/';
74aRouter['gr'] = '/gr/';
75aRouter['gg'] = '/gg/';
76aRouter['q'] = '/q/';
77aRouter['poll'] = '/poll/';
78aRouter['consumer-confidence-russia'] = '/consumer-confidence-russia/';
79aRouter['console'] = '/console/';
80aRouter['oil'] = '/oil/';
81aRouter['lchi2016'] = '/lchi2016/';
82aRouter['lchi2017'] = '/lchi2017/';
83aRouter['lchi2018'] = '/lchi2018/';
84aRouter['lchi2019'] = '/lchi2019/';
85aRouter['lchi2020'] = '/lchi2020/';
86aRouter['lchi2021'] = '/lchi2021/';
87aRouter['lchi2022'] = '/lchi2022/';
88aRouter['lchi2023'] = '/lchi2023/';
89aRouter['summoner'] = '/summoner/';
90aRouter['calendar'] = '/calendar/';
91aRouter['stat'] = '/stat/';
92aRouter['statx'] = '/statx/';
93aRouter['favtop'] = '/favtop/';
94aRouter['vtop'] = '/vtop/';
95aRouter['smartlab-tv'] = '/smartlab-tv/';
96aRouter['blacklist'] = '/blacklist/';
97aRouter['abuse'] = '/abuse/';
98aRouter['mobile'] = '/mobile/';
99
vendor: 11,348 bytes, lines 100-101
100/*! jQuery v3.7.1 | (c) OpenJS Foundation and other contributors | jquery.org/license */
101!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(ie,e){"use strict";var oe=[],r=Object.getPrototypeOf,ae=oe.slice,g=oe.flat?function(e){return oe.flat.call(e)}:function(e){return oe.concat.apply([],e)},s=oe.push,se=oe.indexOf,n={},i=n.toString,ue=n.hasOwnProperty,o=ue.toString,a=o.call(Object),le={},v=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},y=function(e){return null!=e&&e===e.window},C=ie.document,u={type:!0,src:!0,nonce:!0,noModule:!0};function m(e,t,n){var r,i,o=(n=n||C).createElement("script");if(o.text=e,t)for(r in u)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[i.call(e)]||"object":typeof e}var t="3.7.1",l=/HTML$/i,ce=function(e,t){return new ce.fn.init(e,t)};function c(e){var t=!!e&&"length"in e&&e.length,n=x(e);return!v(e)&&!y(e)&&("array"===n||0===t||"number"==typeof t&&0<t&&t-1 in e)}function fe(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}ce.fn=ce.prototype={jquery:t,constructor:ce,length:0,toArray:function(){return ae.call(this)},get:function(e){return null==e?ae.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=ce.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return ce.each(this,e)},map:function(n){return this.pushStack(ce.map(this,function(e,t){return n.call(e,t,e)}))},slice:function(){return this.pushStack(ae.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(ce.grep(this,function(e,t){return(t+1)%2}))},odd:function(){return this.pushStack(ce.grep(this,function(e,t){return t%2}))},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(0<=n&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:s,sort:oe.sort,splice:oe.splice},ce.extend=ce.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||v(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)r=e[t],"__proto__"!==t&&a!==r&&(l&&r&&(ce.isPlainObject(r)||(i=Array.isArray(r)))?(n=a[t],o=i&&!Array.isArray(n)?[]:i||ce.isPlainObject(n)?n:{},i=!1,a[t]=ce.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},ce.extend({expando:"jQuery"+(t+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==i.call(e))&&(!(t=r(e))||"function"==typeof(n=ue.call(t,"constructor")&&t.constructor)&&o.call(n)===a)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e,t,n){m(e,{nonce:t&&t.nonce},n)},each:function(e,t){var n,r=0;if(c(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},text:function(e){var t,n="",r=0,i=e.nodeType;if(!i)while(t=e[r++])n+=ce.text(t);return 1===i||11===i?e.textContent:9===i?e.documentElement.textContent:3===i||4===i?e.nodeValue:n},makeArray:function(e,t){var n=t||[];return null!=e&&(c(Object(e))?ce.merge(n,"string"==typeof e?[e]:e):s.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:se.call(t,e,n)},isXMLDoc:function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return!l.test(t||n&&n.nodeName||"HTML")},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r=[],i=0,o=e.length,a=!n;i<o;i++)!t(e[i],i)!==a&&r.push(e[i]);return r},map:function(e,t,n){var r,i,o=0,a=[];if(c(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&a.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&a.push(i);return g(a)},guid:1,support:le}),"function"==typeof Symbol&&(ce.fn[Symbol.iterator]=oe[Symbol.iterator]),ce.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){n["[object "+t+"]"]=t.toLowerCase()});var pe=oe.pop,de=oe.sort,he=oe.splice,ge="[\\x20\\t\\r\\n\\f]",ve=new RegExp("^"+ge+"+|((?:^|[^\\\\])(?:\\\\.)*)"+ge+"+$","g");ce.contains=function(e,t){var n=t&&t.parentNode;return e===n||!(!n||1!==n.nodeType||!(e.contains?e.contains(n):e.compareDocumentPosition&&16&e.compareDocumentPosition(n)))};var f=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;function p(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e}ce.escapeSelector=function(e){return(e+"").replace(f,p)};var ye=C,me=s;!function(){var e,b,w,o,a,T,r,C,d,i,k=me,S=ce.expando,E=0,n=0,s=W(),c=W(),u=W(),h=W(),l=function(e,t){return e===t&&(a=!0),0},f="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",t="(?:\\\\[\\da-fA-F]{1,6}"+ge+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",p="\\["+ge+"*("+t+")(?:"+ge+"*([*^$|!~]?=)"+ge+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+t+"))|)"+ge+"*\\]",g=":("+t+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+p+")*)|.*)\\)|)",v=new RegExp(ge+"+","g"),y=new RegExp("^"+ge+"*,"+ge+"*"),m=new RegExp("^"+ge+"*([>+~]|"+ge+")"+ge+"*"),x=new RegExp(ge+"|>"),j=new RegExp(g),A=new RegExp("^"+t+"$"),D={ID:new RegExp("^#("+t+")"),CLASS:new RegExp("^\\.("+t+")"),TAG:new RegExp("^("+t+"|[*])"),ATTR:new RegExp("^"+p),PSEUDO:new RegExp("^"+g),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ge+"*(even|odd|(([+-]|)(\\d*)n|)"+ge+"*(?:([+-]|)"+ge+"*(\\d+)|))"+ge+"*\\)|)","i"),bool:new RegExp("^(?:"+f+")$","i"),needsContext:new RegExp("^"+ge+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ge+"*((?:-\\d)?\\d*)"+ge+"*\\)|)(?=[^-]|$)","i")},N=/^(?:input|select|textarea|button)$/i,q=/^h\d$/i,L=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,H=/[+~]/,O=new RegExp("\\\\[\\da-fA-F]{1,6}"+ge+"?|\\\\([^\\r\\n\\f])","g"),P=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},M=function(){V()},R=J(function(e){return!0===e.disabled&&fe(e,"fieldset")},{dir:"parentNode",next:"legend"});try{k.apply(oe=ae.call(ye.childNodes),ye.childNodes),oe[ye.childNodes.length].nodeType}catch(e){k={apply:function(e,t){me.apply(e,ae.call(t))},call:function(e){me.apply(e,ae.call(arguments,1))}}}function I(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(V(e),e=e||T,C)){if(11!==p&&(u=L.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return k.call(n,a),n}else if(f&&(a=f.getElementById(i))&&I.contains(e,a)&&a.id===i)return k.call(n,a),n}else{if(u[2])return k.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&e.getElementsByClassName)return k.apply(n,e.getElementsByClassName(i)),n}if(!(h[t+" "]||d&&d.test(t))){if(c=t,f=e,1===p&&(x.test(t)||m.test(t))){(f=H.test(t)&&U(e.parentNode)||e)==e&&le.scope||((s=e.getAttribute("id"))?s=ce.escapeSelector(s):e.setAttribute("id",s=S)),o=(l=Y(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+Q(l[o]);c=l.join(",")}try{return k.apply(n,f.querySelectorAll(c)),n}catch(e){h(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return re(t.replace(ve,"$1"),e,n,r)}function W(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function F(e){return e[S]=!0,e}function $(e){var t=T.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function B(t){return function(e){return fe(e,"input")&&e.type===t}}function _(t){return function(e){return(fe(e,"input")||fe(e,"button"))&&e.type===t}}function z(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&R(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function X(a){return F(function(o){return o=+o,F(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function U(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function V(e){var t,n=e?e.ownerDocument||e:ye;return n!=T&&9===n.nodeType&&n.documentElement&&(r=(T=n).documentElement,C=!ce.isXMLDoc(T),i=r.matches||r.webkitMatchesSelector||r.msMatchesSelector,r.msMatchesSelector&&ye!=T&&(t=T.defaultView)&&t.top!==t&&t.addEventListener("unload",M),le.getById=$(function(e){return r.appendChild(e).id=ce.expando,!T.getElementsByName||!T.getElementsByName(ce.expando).length}),le.disconnectedMatch=$(function(e){return i.call(e,"*")}),le.scope=$(function(){return T.querySelectorAll(":scope")}),le.cssHas=$(function(){try{return T.querySelector(":has(*,:jqfake)"),!1}catch(e){return!0}}),le.getById?(b.filter.ID=function(e){var t=e.replace(O,P);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&C){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(O,P);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&C){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):t.querySelectorAll(e)},b.find.CLASS=function(e,t){if("undefined"!=typeof t.getElementsByClassName&&C)return t.getElementsByClassName(e)},d=[],$(function(e){var t;r.appendChild(e).innerHTML="<a id='"+S+"' href='' disabled='disabled'></a><select id='"+S+"-\r\\' disabled='disabled'><option selected=''></option></select>",e.querySelectorAll("[selected]").length||d.push("\\["+ge+"*(?:value|"+f+")"),e.querySelectorAll("[id~="+S+"-]").length||d.push("~="),e.querySelectorAll("a#"+S+"+*").length||d.push(".#.+[+~]"),e.querySelectorAll(":checked").length||d.push(":checked"),(t=T.createElement("input")).setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),r.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&d.push(":enabled",":disabled"),(t=T.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||d.push("\\["+ge+"*name"+ge+"*="+ge+"*(?:''|\"\")")}),le.cssHas||d.push(":has"),d=d.length&&new RegExp(d.join("|")),l=function(e,t){if(e===t)return a=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!le.sortDetached&&t.compareDocumentPosition(e)===n?e===T||e.ownerDocument==ye&&I.contains(ye,e)?-1:t===T||t.ownerDocument==ye&&I.contains(ye,t)?1:o?se.call(o,e)-se.call(o,t):0:4&n?-1:1)}),T}for(e in I.matches=function(e,t){return I(e,null,null,t)}
vendor: 4,763 bytes, line 101
101,I.matchesSelector=function(e,t){if(V(e),C&&!h[t+" "]&&(!d||!d.test(t)))try{var n=i.call(e,t);if(n||le.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){h(t,!0)}return 0<I(t,T,null,[e]).length},I.contains=function(e,t){return(e.ownerDocument||e)!=T&&V(e),ce.contains(e,t)},I.attr=function(e,t){(e.ownerDocument||e)!=T&&V(e);var n=b.attrHandle[t.toLowerCase()],r=n&&ue.call(b.attrHandle,t.toLowerCase())?n(e,t,!C):void 0;return void 0!==r?r:e.getAttribute(t)},I.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},ce.uniqueSort=function(e){var t,n=[],r=0,i=0;if(a=!le.sortStable,o=!le.sortStable&&ae.call(e,0),de.call(e,l),a){while(t=e[i++])t===e[i]&&(r=n.push(i));while(r--)he.call(e,n[r],1)}return o=null,e},ce.fn.uniqueSort=function(){return this.pushStack(ce.uniqueSort(ae.apply(this)))},(b=ce.expr={cacheLength:50,createPseudo:F,match:D,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(O,P),e[3]=(e[3]||e[4]||e[5]||"").replace(O,P),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||I.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&I.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return D.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&j.test(n)&&(t=Y(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(O,P).toLowerCase();return"*"===e?function(){return!0}:function(e){return fe(e,t)}},CLASS:function(e){var t=s[e+" "];return t||(t=new RegExp("(^|"+ge+")"+e+"("+ge+"|$)"))&&s(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=I.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1<t.indexOf(i):"$="===r?i&&t.slice(-i.length)===i:"~="===r?-1<(" "+t.replace(v," ")+" ").indexOf(i):"|="===r&&(t===i||t.slice(0,i.length+1)===i+"-"))}},CHILD:function(d,e,t,h,g){var v="nth"!==d.slice(0,3),y="last"!==d.slice(-4),m="of-type"===e;return 1===h&&0===g?function(e){return!!e.parentNode}:function(e,t,n){var r,i,o,a,s,u=v!==y?"nextSibling":"previousSibling",l=e.parentNode,c=m&&e.nodeName.toLowerCase(),f=!n&&!m,p=!1;if(l){if(v){while(u){o=e;while(o=o[u])if(m?fe(o,c):1===o.nodeType)return!1;s=u="only"===d&&!s&&"nextSibling"}return!0}if(s=[y?l.firstChild:l.lastChild],y&&f){p=(a=(r=(i=l[S]||(l[S]={}))[d]||[])[0]===E&&r[1])&&r[2],o=a&&l.childNodes[a];while(o=++a&&o&&o[u]||(p=a=0)||s.pop())if(1===o.nodeType&&++p&&o===e){i[d]=[E,a,p];break}}else if(f&&(p=a=(r=(i=e[S]||(e[S]={}))[d]||[])[0]===E&&r[1]),!1===p)while(o=++a&&o&&o[u]||(p=a=0)||s.pop())if((m?fe(o,c):1===o.nodeType)&&++p&&(f&&((i=o[S]||(o[S]={}))[d]=[E,p]),o===e))break;return(p-=g)===h||p%h==0&&0<=p/h}}},PSEUDO:function(e,o){var t,a=b.pseudos[e]||b.setFilters[e.toLowerCase()]||I.error("unsupported pseudo: "+e);return a[S]?a(o):1<a.length?(t=[e,e,"",o],b.setFilters.hasOwnProperty(e.toLowerCase())?F(function(e,t){var n,r=a(e,o),i=r.length;while(i--)e[n=se.call(e,r[i])]=!(t[n]=r[i])}):function(e){return a(e,0,t)}):a}},pseudos:{not:F(function(e){var r=[],i=[],s=ne(e.replace(ve,"$1"));return s[S]?F(function(e,t,n,r){var i,o=s(e,null,r,[]),a=e.length;while(a--)(i=o[a])&&(e[a]=!(t[a]=i))}):function(e,t,n){return r[0]=e,s(r,null,n,i),r[0]=null,!i.pop()}}),has:F(function(t){return function(e){return 0<I(t,e).length}}),contains:F(function(t){return t=t.replace(O,P),function(e){return-1<(e.textContent||ce.text(e)).indexOf(t)}}),lang:F(function(n){return A.test(n||"")||I.error("unsupported lang: "+n),n=n.replace(O,P).toLowerCase(),function(e){var t;do{if(t=C?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return(t=t.toLowerCase())===n||0===t.indexOf(n+"-")}while((e=e.parentNode)&&1===e.nodeType);return!1}}),target:function(e){var t=ie.location&&ie.location.hash;return t&&t.slice(1)===e.id},root:function(e){return e===r},focus:function(e){return e===function(){try{return T.activeElement}catch(e){}}()&&T.hasFocus()&&!!(e.type||e.href||~e.tabIndex)},enabled:z(!1),disabled:z(!0),checked:function(e){return fe(e,"input")&&!!e.checked||fe(e,"option")&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!b.pseudos.empty(e)},header:function(e){return q.test(e.nodeName)}
vendor: 6,770 bytes, line 101
101,input:function(e){return N.test(e.nodeName)},button:function(e){return fe(e,"input")&&"button"===e.type||fe(e,"button")},text:function(e){var t;return fe(e,"input")&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:X(function(){return[0]}),last:X(function(e,t){return[t-1]}),eq:X(function(e,t,n){return[n<0?n+t:n]}),even:X(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:X(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:X(function(e,t,n){var r;for(r=n<0?n+t:t<n?t:n;0<=--r;)e.push(r);return e}),gt:X(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}}).pseudos.nth=b.pseudos.eq,{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})b.pseudos[e]=B(e);for(e in{submit:!0,reset:!0})b.pseudos[e]=_(e);function G(){}function Y(e,t){var n,r,i,o,a,s,u,l=c[e+" "];if(l)return t?0:l.slice(0);a=e,s=[],u=b.preFilter;while(a){for(o in n&&!(r=y.exec(a))||(r&&(a=a.slice(r[0].length)||a),s.push(i=[])),n=!1,(r=m.exec(a))&&(n=r.shift(),i.push({value:n,type:r[0].replace(ve," ")}),a=a.slice(n.length)),b.filter)!(r=D[o].exec(a))||u[o]&&!(r=u[o](r))||(n=r.shift(),i.push({value:n,type:o,matches:r}),a=a.slice(n.length));if(!n)break}return t?a.length:a?I.error(e):c(e,s).slice(0)}function Q(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function J(a,e,t){var s=e.dir,u=e.next,l=u||s,c=t&&"parentNode"===l,f=n++;return e.first?function(e,t,n){while(e=e[s])if(1===e.nodeType||c)return a(e,t,n);return!1}:function(e,t,n){var r,i,o=[E,f];if(n){while(e=e[s])if((1===e.nodeType||c)&&a(e,t,n))return!0}else while(e=e[s])if(1===e.nodeType||c)if(i=e[S]||(e[S]={}),u&&fe(e,u))e=e[s]||e;else{if((r=i[l])&&r[0]===E&&r[1]===f)return o[2]=r[2];if((i[l]=o)[2]=a(e,t,n))return!0}return!1}}function K(i){return 1<i.length?function(e,t,n){var r=i.length;while(r--)if(!i[r](e,t,n))return!1;return!0}:i[0]}function Z(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;s<u;s++)(o=e[s])&&(n&&!n(o,r,i)||(a.push(o),l&&t.push(s)));return a}function ee(d,h,g,v,y,e){return v&&!v[S]&&(v=ee(v)),y&&!y[S]&&(y=ee(y,e)),F(function(e,t,n,r){var i,o,a,s,u=[],l=[],c=t.length,f=e||function(e,t,n){for(var r=0,i=t.length;r<i;r++)I(e,t[r],n);return n}(h||"*",n.nodeType?[n]:n,[]),p=!d||!e&&h?f:Z(f,u,d,n,r);if(g?g(p,s=y||(e?d:c||v)?[]:t,n,r):s=p,v){i=Z(s,l),v(i,[],n,r),o=i.length;while(o--)(a=i[o])&&(s[l[o]]=!(p[l[o]]=a))}if(e){if(y||d){if(y){i=[],o=s.length;while(o--)(a=s[o])&&i.push(p[o]=a);y(null,s=[],i,r)}o=s.length;while(o--)(a=s[o])&&-1<(i=y?se.call(e,a):u[o])&&(e[i]=!(t[i]=a))}}else s=Z(s===t?s.splice(c,s.length):s),y?y(null,t,s,r):k.apply(t,s)})}function te(e){for(var i,t,n,r=e.length,o=b.relative[e[0].type],a=o||b.relative[" "],s=o?1:0,u=J(function(e){return e===i},a,!0),l=J(function(e){return-1<se.call(i,e)},a,!0),c=[function(e,t,n){var r=!o&&(n||t!=w)||((i=t).nodeType?u(e,t,n):l(e,t,n));return i=null,r}];s<r;s++)if(t=b.relative[e[s].type])c=[J(K(c),t)];else{if((t=b.filter[e[s].type].apply(null,e[s].matches))[S]){for(n=++s;n<r;n++)if(b.relative[e[n].type])break;return ee(1<s&&K(c),1<s&&Q(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace(ve,"$1"),t,s<n&&te(e.slice(s,n)),n<r&&te(e=e.slice(n)),n<r&&Q(e))}c.push(t)}return K(c)}function ne(e,t){var n,v,y,m,x,r,i=[],o=[],a=u[e+" "];if(!a){t||(t=Y(e)),n=t.length;while(n--)(a=te(t[n]))[S]?i.push(a):o.push(a);(a=u(e,(v=o,m=0<(y=i).length,x=0<v.length,r=function(e,t,n,r,i){var o,a,s,u=0,l="0",c=e&&[],f=[],p=w,d=e||x&&b.find.TAG("*",i),h=E+=null==p?1:Math.random()||.1,g=d.length;for(i&&(w=t==T||t||i);l!==g&&null!=(o=d[l]);l++){if(x&&o){a=0,t||o.ownerDocument==T||(V(o),n=!C);while(s=v[a++])if(s(o,t||T,n)){k.call(r,o);break}i&&(E=h)}m&&((o=!s&&o)&&u--,e&&c.push(o))}if(u+=l,m&&l!==u){a=0;while(s=y[a++])s(c,f,t,n);if(e){if(0<u)while(l--)c[l]||f[l]||(f[l]=pe.call(r));f=Z(f)}k.apply(r,f),i&&!e&&0<f.length&&1<u+y.length&&ce.uniqueSort(r)}return i&&(E=h,w=p),c},m?F(r):r))).selector=e}return a}function re(e,t,n,r){var i,o,a,s,u,l="function"==typeof e&&e,c=!r&&Y(e=l.selector||e);if(n=n||[],1===c.length){if(2<(o=c[0]=c[0].slice(0)).length&&"ID"===(a=o[0]).type&&9===t.nodeType&&C&&b.relative[o[1].type]){if(!(t=(b.find.ID(a.matches[0].replace(O,P),t)||[])[0]))return n;l&&(t=t.parentNode),e=e.slice(o.shift().value.length)}i=D.needsContext.test(e)?0:o.length;while(i--){if(a=o[i],b.relative[s=a.type])break;if((u=b.find[s])&&(r=u(a.matches[0].replace(O,P),H.test(o[0].type)&&U(t.parentNode)||t))){if(o.splice(i,1),!(e=r.length&&Q(o)))return k.apply(n,r),n;break}}}return(l||ne(e,c))(r,t,!C,n,!t||H.test(e)&&U(t.parentNode)||t),n}G.prototype=b.filters=b.pseudos,b.setFilters=new G,le.sortStable=S.split("").sort(l).join("")===S,V(),le.sortDetached=$(function(e){return 1&e.compareDocumentPosition(T.createElement("fieldset"))}),ce.find=I,ce.expr[":"]=ce.expr.pseudos,ce.unique=ce.uniqueSort,I.compile=ne,I.select=re,I.setDocument=V,I.tokenize=Y,I.escape=ce.escapeSelector,I.getText=ce.text,I.isXML=ce.isXMLDoc,I.selectors=ce.expr,I.support=ce.support,I.uniqueSort=ce.uniqueSort}();var d=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&ce(e).is(n))break;r.push(e)}return r},h=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},b=ce.expr.match.needsContext,w=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function T(e,n,r){return v(n)?ce.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?ce.grep(e,function(e){return e===n!==r}):"string"!=typeof n?ce.grep(e,function(e){return-1<se.call(n,e)!==r}):ce.filter(n,e,r)}ce.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?ce.find.matchesSelector(r,e)?[r]:[]:ce.find.matches(e,ce.grep(t,function(e){return 1===e.nodeType}))},ce.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(ce(e).filter(function(){for(t=0;t<r;t++)if(ce.contains(i[t],this))return!0}));for(n=this.pushStack([]),t=0;t<r;t++)ce.find(e,i[t],n);return 1<r?ce.uniqueSort(n):n},filter:function(e){return this.pushStack(T(this,e||[],!1))},not:function(e){return this.pushStack(T(this,e||[],!0))},is:function(e){return!!T(this,"string"==typeof e&&b.test(e)?ce(e):e||[],!1).length}});var k,S=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(ce.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||k,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:S.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof ce?t[0]:t,ce.merge(this,ce.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:C,!0)),w.test(r[1])&&ce.isPlainObject(t))for(r in t)v(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=C.getElementById(r[2]))&&(this[0]=i,this.length=1),this}
vendor: 6,600 bytes, line 101
101return e.nodeType?(this[0]=e,this.length=1,this):v(e)?void 0!==n.ready?n.ready(e):e(ce):ce.makeArray(e,this)}).prototype=ce.fn,k=ce(C);var E=/^(?:parents|prev(?:Until|All))/,j={children:!0,contents:!0,next:!0,prev:!0};function A(e,t){while((e=e[t])&&1!==e.nodeType);return e}ce.fn.extend({has:function(e){var t=ce(e,this),n=t.length;return this.filter(function(){for(var e=0;e<n;e++)if(ce.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,o=[],a="string"!=typeof e&&ce(e);if(!b.test(e))for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?-1<a.index(n):1===n.nodeType&&ce.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(1<o.length?ce.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?se.call(ce(e),this[0]):se.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(ce.uniqueSort(ce.merge(this.get(),ce(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),ce.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return d(e,"parentNode")},parentsUntil:function(e,t,n){return d(e,"parentNode",n)},next:function(e){return A(e,"nextSibling")},prev:function(e){return A(e,"previousSibling")},nextAll:function(e){return d(e,"nextSibling")},prevAll:function(e){return d(e,"previousSibling")},nextUntil:function(e,t,n){return d(e,"nextSibling",n)},prevUntil:function(e,t,n){return d(e,"previousSibling",n)},siblings:function(e){return h((e.parentNode||{}).firstChild,e)},children:function(e){return h(e.firstChild)},contents:function(e){return null!=e.contentDocument&&r(e.contentDocument)?e.contentDocument:(fe(e,"template")&&(e=e.content||e),ce.merge([],e.childNodes))}},function(r,i){ce.fn[r]=function(e,t){var n=ce.map(this,i,e);return"Until"!==r.slice(-5)&&(t=e),t&&"string"==typeof t&&(n=ce.filter(t,n)),1<this.length&&(j[r]||ce.uniqueSort(n),E.test(r)&&n.reverse()),this.pushStack(n)}});var D=/[^\x20\t\r\n\f]+/g;function N(e){return e}function q(e){throw e}function L(e,t,n,r){var i;try{e&&v(i=e.promise)?i.call(e).done(t).fail(n):e&&v(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}ce.Callbacks=function(r){var e,n;r="string"==typeof r?(e=r,n={},ce.each(e.match(D)||[],function(e,t){n[t]=!0}),n):ce.extend({},r);var i,t,o,a,s=[],u=[],l=-1,c=function(){for(a=a||r.once,o=i=!0;u.length;l=-1){t=u.shift();while(++l<s.length)!1===s[l].apply(t[0],t[1])&&r.stopOnFalse&&(l=s.length,t=!1)}r.memory||(t=!1),i=!1,a&&(s=t?[]:"")},f={add:function(){return s&&(t&&!i&&(l=s.length-1,u.push(t)),function n(e){ce.each(e,function(e,t){v(t)?r.unique&&f.has(t)||s.push(t):t&&t.length&&"string"!==x(t)&&n(t)})}(arguments),t&&!i&&c()),this},remove:function(){return ce.each(arguments,function(e,t){var n;while(-1<(n=ce.inArray(t,s,n)))s.splice(n,1),n<=l&&l--}),this},has:function(e){return e?-1<ce.inArray(e,s):0<s.length},empty:function(){return s&&(s=[]),this},disable:function(){return a=u=[],s=t="",this},disabled:function(){return!s},lock:function(){return a=u=[],t||i||(s=t=""),this},locked:function(){return!!a},fireWith:function(e,t){return a||(t=[e,(t=t||[]).slice?t.slice():t],u.push(t),i||c()),this},fire:function(){return f.fireWith(this,arguments),this},fired:function(){return!!o}};return f},ce.extend({Deferred:function(e){var o=[["notify","progress",ce.Callbacks("memory"),ce.Callbacks("memory"),2],["resolve","done",ce.Callbacks("once memory"),ce.Callbacks("once memory"),0,"resolved"],["reject","fail",ce.Callbacks("once memory"),ce.Callbacks("once memory"),1,"rejected"]],i="pending",a={state:function(){return i},always:function(){return s.done(arguments).fail(arguments),this},"catch":function(e){return a.then(null,e)},pipe:function(){var i=arguments;return ce.Deferred(function(r){ce.each(o,function(e,t){var n=v(i[t[4]])&&i[t[4]];s[t[1]](function(){var e=n&&n.apply(this,arguments);e&&v(e.promise)?e.promise().progress(r.notify).done(r.resolve).fail(r.reject):r[t[0]+"With"](this,n?[e]:arguments)})}),i=null}).promise()},then:function(t,n,r){var u=0;function l(i,o,a,s){return function(){var n=this,r=arguments,e=function(){var e,t;if(!(i<u)){if((e=a.apply(n,r))===o.promise())throw new TypeError("Thenable self-resolution");t=e&&("object"==typeof e||"function"==typeof e)&&e.then,v(t)?s?t.call(e,l(u,o,N,s),l(u,o,q,s)):(u++,t.call(e,l(u,o,N,s),l(u,o,q,s),l(u,o,N,o.notifyWith))):(a!==N&&(n=void 0,r=[e]),(s||o.resolveWith)(n,r))}},t=s?e:function(){try{e()}catch(e){ce.Deferred.exceptionHook&&ce.Deferred.exceptionHook(e,t.error),u<=i+1&&(a!==q&&(n=void 0,r=[e]),o.rejectWith(n,r))}};i?t():(ce.Deferred.getErrorHook?t.error=ce.Deferred.getErrorHook():ce.Deferred.getStackHook&&(t.error=ce.Deferred.getStackHook()),ie.setTimeout(t))}}return ce.Deferred(function(e){o[0][3].add(l(0,e,v(r)?r:N,e.notifyWith)),o[1][3].add(l(0,e,v(t)?t:N)),o[2][3].add(l(0,e,v(n)?n:q))}).promise()},promise:function(e){return null!=e?ce.extend(e,a):a}},s={};return ce.each(o,function(e,t){var n=t[2],r=t[5];a[t[1]]=n.add,r&&n.add(function(){i=r},o[3-e][2].disable,o[3-e][3].disable,o[0][2].lock,o[0][3].lock),n.add(t[3].fire),s[t[0]]=function(){return s[t[0]+"With"](this===s?void 0:this,arguments),this},s[t[0]+"With"]=n.fireWith}),a.promise(s),e&&e.call(s,s),s},when:function(e){var n=arguments.length,t=n,r=Array(t),i=ae.call(arguments),o=ce.Deferred(),a=function(t){return function(e){r[t]=this,i[t]=1<arguments.length?ae.call(arguments):e,--n||o.resolveWith(r,i)}};if(n<=1&&(L(e,o.done(a(t)).resolve,o.reject,!n),"pending"===o.state()||v(i[t]&&i[t].then)))return o.then();while(t--)L(i[t],a(t),o.reject);return o.promise()}});var H=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;ce.Deferred.exceptionHook=function(e,t){ie.console&&ie.console.warn&&e&&H.test(e.name)&&ie.console.warn("jQuery.Deferred exception: "+e.message,e.stack,t)},ce.readyException=function(e){ie.setTimeout(function(){throw e})};var O=ce.Deferred();function P(){C.removeEventListener("DOMContentLoaded",P),ie.removeEventListener("load",P),ce.ready()}ce.fn.ready=function(e){return O.then(e)["catch"](function(e){ce.readyException(e)}),this},ce.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--ce.readyWait:ce.isReady)||(ce.isReady=!0)!==e&&0<--ce.readyWait||O.resolveWith(C,[ce])}}),ce.ready.then=O.then,"complete"===C.readyState||"loading"!==C.readyState&&!C.documentElement.doScroll?ie.setTimeout(ce.ready):(C.addEventListener("DOMContentLoaded",P),ie.addEventListener("load",P));var M=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;
vendor: 13,727 bytes, line 101
101if("object"===x(n))for(s in i=!0,n)M(e,t,s,n[s],!0,o,a);else if(void 0!==r&&(i=!0,v(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(ce(e),n)})),t))for(;s<u;s++)t(e[s],n,a?r:r.call(e[s],s,t(e[s],n)));return i?e:l?t.call(e):u?t(e[0],n):o},R=/^-ms-/,I=/-([a-z])/g;function W(e,t){return t.toUpperCase()}function F(e){return e.replace(R,"ms-").replace(I,W)}var $=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};function B(){this.expando=ce.expando+B.uid++}B.uid=1,B.prototype={cache:function(e){var t=e[this.expando];return t||(t={},$(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if("string"==typeof t)i[F(t)]=n;else for(r in t)i[F(r)]=t[r];return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][F(t)]},access:function(e,t,n){return void 0===t||t&&"string"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){n=(t=Array.isArray(t)?t.map(F):(t=F(t))in r?[t]:t.match(D)||[]).length;while(n--)delete r[t[n]]}(void 0===t||ce.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!ce.isEmptyObject(t)}};var _=new B,z=new B,X=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,U=/[A-Z]/g;function V(e,t,n){var r,i;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(U,"-$&").toLowerCase(),"string"==typeof(n=e.getAttribute(r))){try{n="true"===(i=n)||"false"!==i&&("null"===i?null:i===+i+""?+i:X.test(i)?JSON.parse(i):i)}catch(e){}z.set(e,t,n)}else n=void 0;return n}ce.extend({hasData:function(e){return z.hasData(e)||_.hasData(e)},data:function(e,t,n){return z.access(e,t,n)},removeData:function(e,t){z.remove(e,t)},_data:function(e,t,n){return _.access(e,t,n)},_removeData:function(e,t){_.remove(e,t)}}),ce.fn.extend({data:function(n,e){var t,r,i,o=this[0],a=o&&o.attributes;if(void 0===n){if(this.length&&(i=z.get(o),1===o.nodeType&&!_.get(o,"hasDataAttrs"))){t=a.length;while(t--)a[t]&&0===(r=a[t].name).indexOf("data-")&&(r=F(r.slice(5)),V(o,r,i[r]));_.set(o,"hasDataAttrs",!0)}return i}return"object"==typeof n?this.each(function(){z.set(this,n)}):M(this,function(e){var t;if(o&&void 0===e)return void 0!==(t=z.get(o,n))?t:void 0!==(t=V(o,n))?t:void 0;this.each(function(){z.set(this,n,e)})},null,e,1<arguments.length,null,!0)},removeData:function(e){return this.each(function(){z.remove(this,e)})}}),ce.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=_.get(e,t),n&&(!r||Array.isArray(n)?r=_.access(e,t,ce.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=ce.queue(e,t),r=n.length,i=n.shift(),o=ce._queueHooks(e,t);"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,function(){ce.dequeue(e,t)},o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return _.get(e,n)||_.access(e,n,{empty:ce.Callbacks("once memory").add(function(){_.remove(e,[t+"queue",n])})})}}),ce.fn.extend({queue:function(t,n){var e=2;return"string"!=typeof t&&(n=t,t="fx",e--),arguments.length<e?ce.queue(this[0],t):void 0===n?this:this.each(function(){var e=ce.queue(this,t,n);ce._queueHooks(this,t),"fx"===t&&"inprogress"!==e[0]&&ce.dequeue(this,t)})},dequeue:function(e){return this.each(function(){ce.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=ce.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=void 0),e=e||"fx";while(a--)(n=_.get(o[a],e+"queueHooks"))&&n.empty&&(r++,n.empty.add(s));return s(),i.promise(t)}});var G=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,Y=new RegExp("^(?:([+-])=|)("+G+")([a-z%]*)$","i"),Q=["Top","Right","Bottom","Left"],J=C.documentElement,K=function(e){return ce.contains(e.ownerDocument,e)},Z={composed:!0};J.getRootNode&&(K=function(e){return ce.contains(e.ownerDocument,e)||e.getRootNode(Z)===e.ownerDocument});var ee=function(e,t){return"none"===(e=t||e).style.display||""===e.style.display&&K(e)&&"none"===ce.css(e,"display")};function te(e,t,n,r){var i,o,a=20,s=r?function(){return r.cur()}:function(){return ce.css(e,t,"")},u=s(),l=n&&n[3]||(ce.cssNumber[t]?"":"px"),c=e.nodeType&&(ce.cssNumber[t]||"px"!==l&&+u)&&Y.exec(ce.css(e,t));if(c&&c[3]!==l){u/=2,l=l||c[3],c=+u||1;while(a--)ce.style(e,t,c+l),(1-o)*(1-(o=s()/u||.5))<=0&&(a=0),c/=o;c*=2,ce.style(e,t,c+l),n=n||[]}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}var ne={};function re(e,t){for(var n,r,i,o,a,s,u,l=[],c=0,f=e.length;c<f;c++)(r=e[c]).style&&(n=r.style.display,t?("none"===n&&(l[c]=_.get(r,"display")||null,l[c]||(r.style.display="")),""===r.style.display&&ee(r)&&(l[c]=(u=a=o=void 0,a=(i=r).ownerDocument,s=i.nodeName,(u=ne[s])||(o=a.body.appendChild(a.createElement(s)),u=ce.css(o,"display"),o.parentNode.removeChild(o),"none"===u&&(u="block"),ne[s]=u)))):"none"!==n&&(l[c]="none",_.set(r,"display",n)));for(c=0;c<f;c++)null!=l[c]&&(e[c].style.display=l[c]);return e}ce.fn.extend({show:function(){return re(this,!0)},hide:function(){return re(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){ee(this)?ce(this).show():ce(this).hide()})}});var xe,be,we=/^(?:checkbox|radio)$/i,Te=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i,Ce=/^$|^module$|\/(?:java|ecma)script/i;xe=C.createDocumentFragment().appendChild(C.createElement("div")),(be=C.createElement("input")).setAttribute("type","radio"),be.setAttribute("checked","checked"),be.setAttribute("name","t"),xe.appendChild(be),le.checkClone=xe.cloneNode(!0).cloneNode(!0).lastChild.checked,xe.innerHTML="<textarea>x</textarea>",le.noCloneChecked=!!xe.cloneNode(!0).lastChild.defaultValue,xe.innerHTML="<option></option>",le.option=!!xe.lastChild;var ke={thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};function Se(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&fe(e,t)?ce.merge([e],n):n}function Ee(e,t){for(var n=0,r=e.length;n<r;n++)_.set(e[n],"globalEval",!t||_.get(t[n],"globalEval"))}ke.tbody=ke.tfoot=ke.colgroup=ke.caption=ke.thead,ke.th=ke.td,le.option||(ke.optgroup=ke.option=[1,"<select multiple='multiple'>","</select>"]);var je=/<|&#?\w+;/;function Ae(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d<h;d++)if((o=e[d])||0===o)if("object"===x(o))ce.merge(p,o.nodeType?[o]:o);else if(je.test(o)){a=a||f.appendChild(t.createElement("div")),s=(Te.exec(o)||["",""])[1].toLowerCase(),u=ke[s]||ke._default,a.innerHTML=u[1]+ce.htmlPrefilter(o)+u[2],c=u[0];while(c--)a=a.lastChild;ce.merge(p,a.childNodes),(a=f.firstChild).textContent=""}else p.push(t.createTextNode(o));f.textContent="",d=0;while(o=p[d++])if(r&&-1<ce.inArray(o,r))i&&i.push(o);else if(l=K(o),a=Se(f.appendChild(o),"script"),l&&Ee(a),n){c=0;while(o=a[c++])Ce.test(o.type||"")&&n.push(o)}return f}var De=/^([^.]*)(?:\.(.+)|)/;function Ne(){return!0}function qe(){return!1}function Le(e,t,n,r,i,o){var a,s;if("object"==typeof t){for(s in"string"!=typeof n&&(r=r||n,n=void 0),t)Le(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=qe;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return ce().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=ce.guid++)),e.each(function(){ce.event.add(this,t,i,r,n)})}function He(e,r,t){t?(_.set(e,r,!1),ce.event.add(e,r,{namespace:!1,handler:function(e){var t,n=_.get(this,r);if(1&e.isTrigger&&this[r]){if(n)(ce.event.special[r]||{}).delegateType&&e.stopPropagation();else if(n=ae.call(arguments),_.set(this,r,n),this[r](),t=_.get(this,r),_.set(this,r,!1),n!==t)return e.stopImmediatePropagation(),e.preventDefault(),t}else n&&(_.set(this,r,ce.event.trigger(n[0],n.slice(1),this)),e.stopPropagation(),e.isImmediatePropagationStopped=Ne)}})):void 0===_.get(e,r)&&ce.event.add(e,r,Ne)}ce.event={global:{},add:function(t,e,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=_.get(t);if($(t)){n.handler&&(n=(o=n).handler,i=o.selector),i&&ce.find.matchesSelector(J,i),n.guid||(n.guid=ce.guid++),(u=v.events)||(u=v.events=Object.create(null)),(a=v.handle)||(a=v.handle=function(e){return"undefined"!=typeof ce&&ce.event.triggered!==e.type?ce.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(D)||[""]).length;while(l--)d=g=(s=De.exec(e[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=ce.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=ce.event.special[d]||{},c=ce.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&ce.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,h,a)||t.addEventListener&&t.addEventListener(d,a)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),ce.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=_.hasData(e)&&_.get(e);if(v&&(u=v.events)){l=(t=(t||"").match(D)||[""]).length;while(l--)if(d=g=(s=De.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d){f=ce.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,v.handle)||ce.removeEvent(e,d,v.handle),delete u[d])}else for(d in u)ce.event.remove(e,d+t[l],n,r,!0);ce.isEmptyObject(u)&&_.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,s=new Array(arguments.length),u=ce.event.fix(e),l=(_.get(this,"events")||Object.create(null))[u.type]||[],c=ce.event.special[u.type]||{};for(s[0]=u,t=1;t<arguments.length;t++)s[t]=arguments[t];if(u.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,u)){a=ce.event.handlers.call(this,u,l),t=0;while((i=a[t++])&&!u.isPropagationStopped()){u.currentTarget=i.elem,n=0;while((o=i.handlers[n++])&&!u.isImmediatePropagationStopped())u.rnamespace&&!1!==o.namespace&&!u.rnamespace.test(o.namespace)||(u.handleObj=o,u.data=o.data,void 0!==(r=((ce.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,s))&&!1===(u.result=r)&&(u.preventDefault(),u.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,u),u.result}},handlers:function(e,t){var n,r,i,o,a,s=[],u=t.delegateCount,l=e.target;if(u&&l.nodeType&&!("click"===e.type&&1<=e.button))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n<u;n++)void 0===a[i=(r=t[n]).selector+" "]&&(a[i]=r.needsContext?-1<ce(i,this).index(l):ce.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u<t.length&&s.push({elem:l,handlers:t.slice(u)}),s},addProp:function(t,e){Object.defineProperty(ce.Event.prototype,t,{enumerable:!0,configurable:!0,get:v(e)?function(){if(this.originalEvent)return e(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[t]},set:function(e){Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:e})}})},fix:function(e){return e[ce.expando]?e:new ce.Event(e)},special:{load:{noBubble:!0},click:{setup:function(e){var t=this||e;return we.test(t.type)&&t.click&&fe(t,"input")&&He(t,"click",!0),!1},trigger:function(e){var t=this||e;return we.test(t.type)&&t.click&&fe(t,"input")&&He(t,"click"),!0},_default:function(e){var t=e.target;return we.test(t.type)&&t.click&&fe(t,"input")&&_.get(t,"click")||fe(t,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},ce.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},ce.Event=function(e,t){if(!(this instanceof ce.Event))return new ce.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?Ne:qe,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&ce.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),this[ce.expando]=!0},ce.Event.prototype={constructor:ce.Event,isDefaultPrevented:qe,isPropagationStopped:qe,isImmediatePropagationStopped:qe,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=Ne,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=Ne,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=Ne,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},ce.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,code:!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:!0},ce.event.addProp),ce.each({focus:"focusin",blur:"focusout"},function(r,i){function o(e){if(C.documentMode){var t=_.get(this,"handle"),n=ce.event.fix(e);
vendor: 6,944 bytes, line 101
101n.type="focusin"===e.type?"focus":"blur",n.isSimulated=!0,t(e),n.target===n.currentTarget&&t(n)}else ce.event.simulate(i,e.target,ce.event.fix(e))}ce.event.special[r]={setup:function(){var e;if(He(this,r,!0),!C.documentMode)return!1;(e=_.get(this,i))||this.addEventListener(i,o),_.set(this,i,(e||0)+1)},trigger:function(){return He(this,r),!0},teardown:function(){var e;if(!C.documentMode)return!1;(e=_.get(this,i)-1)?_.set(this,i,e):(this.removeEventListener(i,o),_.remove(this,i))},_default:function(e){return _.get(e.target,r)},delegateType:i},ce.event.special[i]={setup:function(){var e=this.ownerDocument||this.document||this,t=C.documentMode?this:e,n=_.get(t,i);n||(C.documentMode?this.addEventListener(i,o):e.addEventListener(r,o,!0)),_.set(t,i,(n||0)+1)},teardown:function(){var e=this.ownerDocument||this.document||this,t=C.documentMode?this:e,n=_.get(t,i)-1;n?_.set(t,i,n):(C.documentMode?this.removeEventListener(i,o):e.removeEventListener(r,o,!0),_.remove(t,i))}}}),ce.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,i){ce.event.special[e]={delegateType:i,bindType:i,handle:function(e){var t,n=e.relatedTarget,r=e.handleObj;return n&&(n===this||ce.contains(this,n))||(e.type=r.origType,t=r.handler.apply(this,arguments),e.type=i),t}}}),ce.fn.extend({on:function(e,t,n,r){return Le(this,e,t,n,r)},one:function(e,t,n,r){return Le(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,ce(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return!1!==t&&"function"!=typeof t||(n=t,t=void 0),!1===n&&(n=qe),this.each(function(){ce.event.remove(this,e,n,t)})}});var Oe=/<script|<style|<link/i,Pe=/checked\s*(?:[^=]|=\s*.checked.)/i,Me=/^\s*<!\[CDATA\[|\]\]>\s*$/g;function Re(e,t){return fe(e,"table")&&fe(11!==t.nodeType?t:t.firstChild,"tr")&&ce(e).children("tbody")[0]||e}function Ie(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function We(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Fe(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(_.hasData(e)&&(s=_.get(e).events))for(i in _.remove(t,"handle events"),s)for(n=0,r=s[i].length;n<r;n++)ce.event.add(t,i,s[i][n]);z.hasData(e)&&(o=z.access(e),a=ce.extend({},o),z.set(t,a))}}function $e(n,r,i,o){r=g(r);var e,t,a,s,u,l,c=0,f=n.length,p=f-1,d=r[0],h=v(d);if(h||1<f&&"string"==typeof d&&!le.checkClone&&Pe.test(d))return n.each(function(e){var t=n.eq(e);h&&(r[0]=d.call(this,e,t.html())),$e(t,r,i,o)});if(f&&(t=(e=Ae(r,n[0].ownerDocument,!1,n,o)).firstChild,1===e.childNodes.length&&(e=t),t||o)){for(s=(a=ce.map(Se(e,"script"),Ie)).length;c<f;c++)u=e,c!==p&&(u=ce.clone(u,!0,!0),s&&ce.merge(a,Se(u,"script"))),i.call(n[c],u,c);if(s)for(l=a[a.length-1].ownerDocument,ce.map(a,We),c=0;c<s;c++)u=a[c],Ce.test(u.type||"")&&!_.access(u,"globalEval")&&ce.contains(l,u)&&(u.src&&"module"!==(u.type||"").toLowerCase()?ce._evalUrl&&!u.noModule&&ce._evalUrl(u.src,{nonce:u.nonce||u.getAttribute("nonce")},l):m(u.textContent.replace(Me,""),u,l))}return n}function Be(e,t,n){for(var r,i=t?ce.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||ce.cleanData(Se(r)),r.parentNode&&(n&&K(r)&&Ee(Se(r,"script")),r.parentNode.removeChild(r));return e}ce.extend({htmlPrefilter:function(e){return e},clone:function(e,t,n){var r,i,o,a,s,u,l,c=e.cloneNode(!0),f=K(e);if(!(le.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||ce.isXMLDoc(e)))for(a=Se(c),r=0,i=(o=Se(e)).length;r<i;r++)s=o[r],u=a[r],void 0,"input"===(l=u.nodeName.toLowerCase())&&we.test(s.type)?u.checked=s.checked:"input"!==l&&"textarea"!==l||(u.defaultValue=s.defaultValue);if(t)if(n)for(o=o||Se(e),a=a||Se(c),r=0,i=o.length;r<i;r++)Fe(o[r],a[r]);else Fe(e,c);return 0<(a=Se(c,"script")).length&&Ee(a,!f&&Se(e,"script")),c},cleanData:function(e){for(var t,n,r,i=ce.event.special,o=0;void 0!==(n=e[o]);o++)if($(n)){if(t=n[_.expando]){if(t.events)for(r in t.events)i[r]?ce.event.remove(n,r):ce.removeEvent(n,r,t.handle);n[_.expando]=void 0}n[z.expando]&&(n[z.expando]=void 0)}}}),ce.fn.extend({detach:function(e){return Be(this,e,!0)},remove:function(e){return Be(this,e)},text:function(e){return M(this,function(e){return void 0===e?ce.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return $e(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Re(this,e).appendChild(e)})},prepend:function(){return $e(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Re(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return $e(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return $e(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(ce.cleanData(Se(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return ce.clone(this,e,t)})},html:function(e){return M(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Oe.test(e)&&!ke[(Te.exec(e)||["",""])[1].toLowerCase()]){e=ce.htmlPrefilter(e);try{for(;n<r;n++)1===(t=this[n]||{}).nodeType&&(ce.cleanData(Se(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var n=[];return $e(this,arguments,function(e){var t=this.parentNode;ce.inArray(this,n)<0&&(ce.cleanData(Se(this)),t&&t.replaceChild(e,this))},n)}}),ce.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,a){ce.fn[e]=function(e){for(var t,n=[],r=ce(e),i=r.length-1,o=0;o<=i;o++)t=o===i?this:this.clone(!0),ce(r[o])[a](t),s.apply(n,t.get());return this.pushStack(n)}});var _e=new RegExp("^("+G+")(?!px)[a-z%]+$","i"),ze=/^--/,Xe=function(e){var t=e.ownerDocument.defaultView;return t&&t.opener||(t=ie),t.getComputedStyle(e)},Ue=function(e,t,n){var r,i,o={};for(i in t)o[i]=e.style[i],e.style[i]=t[i];for(i in r=n.call(e),t)e.style[i]=o[i];return r},Ve=new RegExp(Q.join("|"),"i");function Ge(e,t,n){var r,i,o,a,s=ze.test(t),u=e.style;return(n=n||Xe(e))&&(a=n.getPropertyValue(t)||n[t],s&&a&&(a=a.replace(ve,"$1")||void 0),""!==a||K(e)||(a=ce.style(e,t)),!le.pixelBoxStyles()&&_e.test(a)&&Ve.test(t)&&(r=u.width,i=u.minWidth,o=u.maxWidth,u.minWidth=u.maxWidth=u.width=a,a=n.width,u.width=r,u.minWidth=i,u.maxWidth=o)),void 0!==a?a+"":a}function Ye(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}!function(){function e(){if(l){u.style.cssText="position:absolute;
vendor: 25,800 bytes, line 101
101left:-11111px;width:60px;margin-top:1px;padding:0;border:0",l.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",J.appendChild(u).appendChild(l);var e=ie.getComputedStyle(l);n="1%"!==e.top,s=12===t(e.marginLeft),l.style.right="60%",o=36===t(e.right),r=36===t(e.width),l.style.position="absolute",i=12===t(l.offsetWidth/3),J.removeChild(u),l=null}}function t(e){return Math.round(parseFloat(e))}var n,r,i,o,a,s,u=C.createElement("div"),l=C.createElement("div");l.style&&(l.style.backgroundClip="content-box",l.cloneNode(!0).style.backgroundClip="",le.clearCloneStyle="content-box"===l.style.backgroundClip,ce.extend(le,{boxSizingReliable:function(){return e(),r},pixelBoxStyles:function(){return e(),o},pixelPosition:function(){return e(),n},reliableMarginLeft:function(){return e(),s},scrollboxSize:function(){return e(),i},reliableTrDimensions:function(){var e,t,n,r;return null==a&&(e=C.createElement("table"),t=C.createElement("tr"),n=C.createElement("div"),e.style.cssText="position:absolute;left:-11111px;border-collapse:separate",t.style.cssText="box-sizing:content-box;border:1px solid",t.style.height="1px",n.style.height="9px",n.style.display="block",J.appendChild(e).appendChild(t).appendChild(n),r=ie.getComputedStyle(t),a=parseInt(r.height,10)+parseInt(r.borderTopWidth,10)+parseInt(r.borderBottomWidth,10)===t.offsetHeight,J.removeChild(e)),a}}))}();var Qe=["Webkit","Moz","ms"],Je=C.createElement("div").style,Ke={};function Ze(e){var t=ce.cssProps[e]||Ke[e];return t||(e in Je?e:Ke[e]=function(e){var t=e[0].toUpperCase()+e.slice(1),n=Qe.length;while(n--)if((e=Qe[n]+t)in Je)return e}(e)||e)}var et=/^(none|table(?!-c[ea]).+)/,tt={position:"absolute",visibility:"hidden",display:"block"},nt={letterSpacing:"0",fontWeight:"400"};function rt(e,t,n){var r=Y.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function it(e,t,n,r,i,o){var a="width"===t?1:0,s=0,u=0,l=0;if(n===(r?"border":"content"))return 0;for(;a<4;a+=2)"margin"===n&&(l+=ce.css(e,n+Q[a],!0,i)),r?("content"===n&&(u-=ce.css(e,"padding"+Q[a],!0,i)),"margin"!==n&&(u-=ce.css(e,"border"+Q[a]+"Width",!0,i))):(u+=ce.css(e,"padding"+Q[a],!0,i),"padding"!==n?u+=ce.css(e,"border"+Q[a]+"Width",!0,i):s+=ce.css(e,"border"+Q[a]+"Width",!0,i));return!r&&0<=o&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))||0),u+l}function ot(e,t,n){var r=Xe(e),i=(!le.boxSizingReliable()||n)&&"border-box"===ce.css(e,"boxSizing",!1,r),o=i,a=Ge(e,t,r),s="offset"+t[0].toUpperCase()+t.slice(1);if(_e.test(a)){if(!n)return a;a="auto"}return(!le.boxSizingReliable()&&i||!le.reliableTrDimensions()&&fe(e,"tr")||"auto"===a||!parseFloat(a)&&"inline"===ce.css(e,"display",!1,r))&&e.getClientRects().length&&(i="border-box"===ce.css(e,"boxSizing",!1,r),(o=s in e)&&(a=e[s])),(a=parseFloat(a)||0)+it(e,t,n||(i?"border":"content"),o,r,a)+"px"}function at(e,t,n,r,i){return new at.prototype.init(e,t,n,r,i)}ce.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Ge(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,aspectRatio:!0,borderImageSlice:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,scale:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeMiterlimit:!0,strokeOpacity:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=F(t),u=ze.test(t),l=e.style;if(u||(t=Ze(s)),a=ce.cssHooks[t]||ce.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];"string"===(o=typeof n)&&(i=Y.exec(n))&&i[1]&&(n=te(e,t,i),o="number"),null!=n&&n==n&&("number"!==o||u||(n+=i&&i[3]||(ce.cssNumber[s]?"":"px")),le.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=F(t);return ze.test(t)||(t=Ze(s)),(a=ce.cssHooks[t]||ce.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=Ge(e,t,r)),"normal"===i&&t in nt&&(i=nt[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),ce.each(["height","width"],function(e,u){ce.cssHooks[u]={get:function(e,t,n){if(t)return!et.test(ce.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?ot(e,u,n):Ue(e,tt,function(){return ot(e,u,n)})},set:function(e,t,n){var r,i=Xe(e),o=!le.scrollboxSize()&&"absolute"===i.position,a=(o||n)&&"border-box"===ce.css(e,"boxSizing",!1,i),s=n?it(e,u,n,a,i):0;return a&&o&&(s-=Math.ceil(e["offset"+u[0].toUpperCase()+u.slice(1)]-parseFloat(i[u])-it(e,u,"border",!1,i)-.5)),s&&(r=Y.exec(t))&&"px"!==(r[3]||"px")&&(e.style[u]=t,t=ce.css(e,u)),rt(0,t,s)}}}),ce.cssHooks.marginLeft=Ye(le.reliableMarginLeft,function(e,t){if(t)return(parseFloat(Ge(e,"marginLeft"))||e.getBoundingClientRect().left-Ue(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),ce.each({margin:"",padding:"",border:"Width"},function(i,o){ce.cssHooks[i+o]={expand:function(e){for(var t=0,n={},r="string"==typeof e?e.split(" "):[e];t<4;t++)n[i+Q[t]+o]=r[t]||r[t-2]||r[0];return n}},"margin"!==i&&(ce.cssHooks[i+o].set=rt)}),ce.fn.extend({css:function(e,t){return M(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=Xe(e),i=t.length;a<i;a++)o[t[a]]=ce.css(e,t[a],!1,r);return o}return void 0!==n?ce.style(e,t,n):ce.css(e,t)},e,t,1<arguments.length)}}),((ce.Tween=at).prototype={constructor:at,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||ce.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(ce.cssNumber[n]?"":"px")},cur:function(){var e=at.propHooks[this.prop];return e&&e.get?e.get(this):at.propHooks._default.get(this)},run:function(e){var t,n=at.propHooks[this.prop];return this.options.duration?this.pos=t=ce.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):at.propHooks._default.set(this),this}}).init.prototype=at.prototype,(at.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=ce.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){ce.fx.step[e.prop]?ce.fx.step[e.prop](e):1!==e.elem.nodeType||!ce.cssHooks[e.prop]&&null==e.elem.style[Ze(e.prop)]?e.elem[e.prop]=e.now:ce.style(e.elem,e.prop,e.now+e.unit)}}}).scrollTop=at.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},ce.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},ce.fx=at.prototype.init,ce.fx.step={};var st,ut,lt,ct,ft=/^(?:toggle|show|hide)$/,pt=/queueHooks$/;function dt(){ut&&(!1===C.hidden&&ie.requestAnimationFrame?ie.requestAnimationFrame(dt):ie.setTimeout(dt,ce.fx.interval),ce.fx.tick())}function ht(){return ie.setTimeout(function(){st=void 0}),st=Date.now()}function gt(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=Q[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function vt(e,t,n){for(var r,i=(yt.tweeners[t]||[]).concat(yt.tweeners["*"]),o=0,a=i.length;o<a;o++)if(r=i[o].call(n,t,e))return r}function yt(o,e,t){var n,a,r=0,i=yt.prefilters.length,s=ce.Deferred().always(function(){delete u.elem}),u=function(){if(a)return!1;for(var e=st||ht(),t=Math.max(0,l.startTime+l.duration-e),n=1-(t/l.duration||0),r=0,i=l.tweens.length;r<i;r++)l.tweens[r].run(n);return s.notifyWith(o,[l,n,t]),n<1&&i?t:(i||s.notifyWith(o,[l,1,0]),s.resolveWith(o,[l]),!1)},l=s.promise({elem:o,props:ce.extend({},e),opts:ce.extend(!0,{specialEasing:{},easing:ce.easing._default},t),originalProperties:e,originalOptions:t,startTime:st||ht(),duration:t.duration,tweens:[],createTween:function(e,t){var n=ce.Tween(o,l.opts,e,t,l.opts.specialEasing[e]||l.opts.easing);return l.tweens.push(n),n},stop:function(e){var t=0,n=e?l.tweens.length:0;if(a)return this;for(a=!0;t<n;t++)l.tweens[t].run(1);return e?(s.notifyWith(o,[l,1,0]),s.resolveWith(o,[l,e])):s.rejectWith(o,[l,e]),this}}),c=l.props;for(!function(e,t){var n,r,i,o,a;for(n in e)if(i=t[r=F(n)],o=e[n],Array.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(a=ce.cssHooks[r])&&"expand"in a)for(n in o=a.expand(o),delete e[r],o)n in e||(e[n]=o[n],t[n]=i);else t[r]=i}(c,l.opts.specialEasing);r<i;r++)if(n=yt.prefilters[r].call(l,o,c,l.opts))return v(n.stop)&&(ce._queueHooks(l.elem,l.opts.queue).stop=n.stop.bind(n)),n;return ce.map(c,vt,l),v(l.opts.start)&&l.opts.start.call(o,l),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always),ce.fx.timer(ce.extend(u,{elem:o,anim:l,queue:l.opts.queue})),l}ce.Animation=ce.extend(yt,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return te(n.elem,e,Y.exec(t),n),n}]},tweener:function(e,t){v(e)?(t=e,e=["*"]):e=e.match(D);for(var n,r=0,i=e.length;r<i;r++)n=e[r],yt.tweeners[n]=yt.tweeners[n]||[],yt.tweeners[n].unshift(t)},prefilters:[function(e,t,n){var r,i,o,a,s,u,l,c,f="width"in t||"height"in t,p=this,d={},h=e.style,g=e.nodeType&&ee(e),v=_.get(e,"fxshow");for(r in n.queue||(null==(a=ce._queueHooks(e,"fx")).unqueued&&(a.unqueued=0,s=a.empty.fire,a.empty.fire=function(){a.unqueued||s()}),a.unqueued++,p.always(function(){p.always(function(){a.unqueued--,ce.queue(e,"fx").length||a.empty.fire()})})),t)if(i=t[r],ft.test(i)){if(delete t[r],o=o||"toggle"===i,i===(g?"hide":"show")){if("show"!==i||!v||void 0===v[r])continue;g=!0}d[r]=v&&v[r]||ce.style(e,r)}if((u=!ce.isEmptyObject(t))||!ce.isEmptyObject(d))for(r in f&&1===e.nodeType&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],null==(l=v&&v.display)&&(l=_.get(e,"display")),"none"===(c=ce.css(e,"display"))&&(l?c=l:(re([e],!0),l=e.style.display||l,c=ce.css(e,"display"),re([e]))),("inline"===c||"inline-block"===c&&null!=l)&&"none"===ce.css(e,"float")&&(u||(p.done(function(){h.display=l}),null==l&&(c=h.display,l="none"===c?"":c)),h.display="inline-block")),n.overflow&&(h.overflow="hidden",p.always(function(){h.overflow=n.overflow[0],h.overflowX=n.overflow[1],h.overflowY=n.overflow[2]})),u=!1,d)u||(v?"hidden"in v&&(g=v.hidden):v=_.access(e,"fxshow",{display:l}),o&&(v.hidden=!g),g&&re([e],!0),p.done(function(){for(r in g||re([e]),_.remove(e,"fxshow"),d)ce.style(e,r,d[r])})),u=vt(g?v[r]:0,r,p),r in v||(v[r]=u.start,g&&(u.end=u.start,u.start=0))}],prefilter:function(e,t){t?yt.prefilters.unshift(e):yt.prefilters.push(e)}}),ce.speed=function(e,t,n){var r=e&&"object"==typeof e?ce.extend({},e):{complete:n||!n&&t||v(e)&&e,duration:e,easing:n&&t||t&&!v(t)&&t};return ce.fx.off?r.duration=0:"number"!=typeof r.duration&&(r.duration in ce.fx.speeds?r.duration=ce.fx.speeds[r.duration]:r.duration=ce.fx.speeds._default),null!=r.queue&&!0!==r.queue||(r.queue="fx"),r.old=r.complete,r.complete=function(){v(r.old)&&r.old.call(this),r.queue&&ce.dequeue(this,r.queue)},r},ce.fn.extend({fadeTo:function(e,t,n,r){return this.filter(ee).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(t,e,n,r){var i=ce.isEmptyObject(t),o=ce.speed(e,n,r),a=function(){var e=yt(this,ce.extend({},t),o);(i||_.get(this,"finish"))&&e.stop(!0)};return a.finish=a,i||!1===o.queue?this.each(a):this.queue(o.queue,a)},stop:function(i,e,o){var a=function(e){var t=e.stop;delete e.stop,t(o)};return"string"!=typeof i&&(o=e,e=i,i=void 0),e&&this.queue(i||"fx",[]),this.each(function(){var e=!0,t=null!=i&&i+"queueHooks",n=ce.timers,r=_.get(this);if(t)r[t]&&r[t].stop&&a(r[t]);else for(t in r)r[t]&&r[t].stop&&pt.test(t)&&a(r[t]);for(t=n.length;t--;)n[t].elem!==this||null!=i&&n[t].queue!==i||(n[t].anim.stop(o),e=!1,n.splice(t,1));!e&&o||ce.dequeue(this,i)})},finish:function(a){return!1!==a&&(a=a||"fx"),this.each(function(){var e,t=_.get(this),n=t[a+"queue"],r=t[a+"queueHooks"],i=ce.timers,o=n?n.length:0;for(t.finish=!0,ce.queue(this,a,[]),r&&r.stop&&r.stop.call(this,!0),e=i.length;e--;)i[e].elem===this&&i[e].queue===a&&(i[e].anim.stop(!0),i.splice(e,1));for(e=0;e<o;e++)n[e]&&n[e].finish&&n[e].finish.call(this);delete t.finish})}}),ce.each(["toggle","show","hide"],function(e,r){var i=ce.fn[r];ce.fn[r]=function(e,t,n){return null==e||"boolean"==typeof e?i.apply(this,arguments):this.animate(gt(r,!0),e,t,n)}}),ce.each({slideDown:gt("show"),slideUp:gt("hide"),slideToggle:gt("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,r){ce.fn[e]=function(e,t,n){return this.animate(r,e,t,n)}}),ce.timers=[],ce.fx.tick=function(){var e,t=0,n=ce.timers;for(st=Date.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||ce.fx.stop(),st=void 0},ce.fx.timer=function(e){ce.timers.push(e),ce.fx.start()},ce.fx.interval=13,ce.fx.start=function(){ut||(ut=!0,dt())},ce.fx.stop=function(){ut=null},ce.fx.speeds={slow:600,fast:200,_default:400},ce.fn.delay=function(r,e){return r=ce.fx&&ce.fx.speeds[r]||r,e=e||"fx",this.queue(e,function(e,t){var n=ie.setTimeout(e,r);t.stop=function(){ie.clearTimeout(n)}})},lt=C.createElement("input"),ct=C.createElement("select").appendChild(C.createElement("option")),lt.type="checkbox",le.checkOn=""!==lt.value,le.optSelected=ct.selected,(lt=C.createElement("input")).value="t",lt.type="radio",le.radioValue="t"===lt.value;var mt,xt=ce.expr.attrHandle;ce.fn.extend({attr:function(e,t){return M(this,ce.attr,e,t,1<arguments.length)},removeAttr:function(e){return this.each(function(){ce.removeAttr(this,e)})}}),ce.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?ce.prop(e,t,n):(1===o&&ce.isXMLDoc(e)||(i=ce.attrHooks[t.toLowerCase()]||(ce.expr.match.bool.test(t)?mt:void 0)),void 0!==n?null===n?void ce.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=ce.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!le.radioValue&&"radio"===t&&fe(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(D);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),mt={set:function(e,t,n){return!1===t?ce.removeAttr(e,n):e.setAttribute(n,n),n}},ce.each(ce.expr.match.bool.source.match(/\w+/g),function(e,t){var a=xt[t]||ce.find.attr;xt[t]=function(e,t,n){var r,i,o=t.toLowerCase();return n||(i=xt[o],xt[o]=r,r=null!=a(e,t,n)?o:null,xt[o]=i),r}});var bt=/^(?:input|select|textarea|button)$/i,wt=/^(?:a|area)$/i;function Tt(e){return(e.match(D)||[]).join(" ")}function Ct(e){return e.getAttribute&&e.getAttribute("class")||""}function kt(e){return Array.isArray(e)?e:"string"==typeof e&&e.match(D)||[]}ce.fn.extend({prop:function(e,t){return M(this,ce.prop,e,t,1<arguments.length)},removeProp:function(e){return this.each(function(){delete this[ce.propFix[e]||e]})}}),ce.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&ce.isXMLDoc(e)||(t=ce.propFix[t]||t,i=ce.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=ce.find.attr(e,"tabindex");return t?parseInt(t,10):bt.test(e.nodeName)||wt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),le.optSelected||(ce.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),ce.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){ce.propFix[this.toLowerCase()]=this}),ce.fn.extend({addClass:function(t){var e,n,r,i,o,a;return v(t)?this.each(function(e){ce(this).addClass(t.call(this,e,Ct(this)))}):(e=kt(t)).length?this.each(function(){if(r=Ct(this),n=1===this.nodeType&&" "+Tt(r)+" "){for(o=0;o<e.length;o++)i=e[o],n.indexOf(" "+i+" ")<0&&(n+=i+" ");a=Tt(n),r!==a&&this.setAttribute("class",a)}}):this},removeClass:function(t){var e,n,r,i,o,a;return v(t)?this.each(function(e){ce(this).removeClass(t.call(this,e,Ct(this)))}):arguments.length?(e=kt(t)).length?this.each(function(){if(r=Ct(this),n=1===this.nodeType&&" "+Tt(r)+" "){for(o=0;o<e.length;o++){i=e[o];while(-1<n.indexOf(" "+i+" "))n=n.replace(" "+i+" "," ")}a=Tt(n),r!==a&&this.setAttribute("class",a)}}):this:this.attr("class","")},toggleClass:function(t,n){var e,r,i,o,a=typeof t,s="string"===a||Array.isArray(t);return v(t)?this.each(function(e){ce(this).toggleClass(t.call(this,e,Ct(this),n),n)}):"boolean"==typeof n&&s?n?this.addClass(t):this.removeClass(t):(e=kt(t),this.each(function(){if(s)for(o=ce(this),i=0;i<e.length;i++)r=e[i],o.hasClass(r)?o.removeClass(r):o.addClass(r);else void 0!==t&&"boolean"!==a||((r=Ct(this))&&_.set(this,"__className__",r),this.setAttribute&&this.setAttribute("class",r||!1===t?"":_.get(this,"__className__")||""))}))},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(1===n.nodeType&&-1<(" "+Tt(Ct(n))+" ").indexOf(t))return!0;return!1}});var St=/\r/g;ce.fn.extend({val:function(n){var r,e,i,t=this[0];return arguments.length?(i=v(n),this.each(function(e){var t;1===this.nodeType&&(null==(t=i?n.call(this,e,ce(this).val()):n)?t="":"number"==typeof t?t+="":Array.isArray(t)&&(t=ce.map(t,function(e){return null==e?"":e+""})),(r=ce.valHooks[this.type]||ce.valHooks[this.nodeName.toLowerCase()])&&"set"in r&&void 0!==r.set(this,t,"value")||(this.value=t))})):t?(r=ce.valHooks[t.type]||ce.valHooks[t.nodeName.toLowerCase()])&&"get"in r&&void 0!==(e=r.get(t,"value"))?e:"string"==typeof(e=t.value)?e.replace(St,""):null==e?"":e:void 0}}),ce.extend({valHooks:{option:{get:function(e){var t=ce.find.attr(e,"value");return null!=t?t:Tt(ce.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r<u;r++)if(((n=i[r]).selected||r===o)&&!n.disabled&&(!n.parentNode.disabled||!fe(n.parentNode,"optgroup"))){if(t=ce(n).val(),a)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=ce.makeArray(t),a=i.length;while(a--)((r=i[a]).selected=-1<ce.inArray(ce.valHooks.option.get(r),o))&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),ce.each(["radio","checkbox"],function(){ce.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=-1<ce.inArray(ce(e).val(),t)}},le.checkOn||(ce.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Et=ie.location,jt={guid:Date.now()},At=/\?/;ce.parseXML=function(e){var t,n;if(!e||"string"!=typeof e)return null;try{t=(new ie.DOMParser).parseFromString(e,"text/xml")}catch(e){}return n=t&&t.getElementsByTagName("parsererror")[0],t&&!n||ce.error("Invalid XML: "+(n?ce.map(n.childNodes,function(e){return e.textContent}).join("\n"):e)),t};var Dt=/^(?:focusinfocus|focusoutblur)$/,Nt=function(e){e.stopPropagation()};ce.extend(ce.event,{trigger:function(e,t,n,r){var i,o,a,s,u,l,c,f,p=[n||C],d=ue.call(e,"type")?e.type:e,h=ue.call(e,"namespace")?e.namespace.split("."):[];if(o=f=a=n=n||C,3!==n.nodeType&&8!==n.nodeType&&!Dt.test(d+ce.event.triggered)&&(-1<d.indexOf(".")&&(d=(h=d.split(".")).shift(),h.sort()),u=d.indexOf(":")<0&&"on"+d,(e=e[ce.expando]?e:new ce.Event(d,"object"==typeof e&&e)).isTrigger=r?2:3,e.namespace=h.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),t=null==t?[e]:ce.makeArray(t,[e]),c=ce.event.special[d]||{},r||!c.trigger||!1!==c.trigger.apply(n,t))){if(!r&&!c.noBubble&&!y(n)){for(s=c.delegateType||d,Dt.test(s+d)||(o=o.parentNode);o;o=o.parentNode)p.push(o),a=o;a===(n.ownerDocument||C)&&p.push(a.defaultView||a.parentWindow||ie)}i=0;while((o=p[i++])&&!e.isPropagationStopped())f=o,e.type=1<i?s:c.bindType||d,(l=(_.get(o,"events")||Object.create(null))[e.type]&&_.get(o,"handle"))&&l.apply(o,t),(l=u&&o[u])&&l.apply&&$(o)&&(e.result=l.apply(o,t),!1===e.result&&e.preventDefault());return e.type=d,r||e.isDefaultPrevented()||c._default&&!1!==c._default.apply(p.pop(),t)||!$(n)||u&&v(n[d])&&!y(n)&&((a=n[u])&&(n[u]=null),ce.event.triggered=d,e.isPropagationStopped()&&f.addEventListener(d,Nt),n[d](),e.isPropagationStopped()&&f.removeEventListener(d,Nt),ce.event.triggered=void 0,a&&(n[u]=a)),e.result}},simulate:function(e,t,n){var r=ce.extend(new ce.Event,n,{type:e,isSimulated:!0});ce.event.trigger(r,null,t)}}),ce.fn.extend({trigger:function(e,t){return this.each(function(){ce.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return ce.event.trigger(e,t,n,!0)}});var qt=/\[\]$/,Lt=/\r?\n/g,Ht=/^(?:submit|button|image|reset|file)$/i,Ot=/^(?:input|select|textarea|keygen)/i;function Pt(n,e,r,i){var t;if(Array.isArray(e))ce.each(e,function(e,t){r||qt.test(n)?i(n,t):Pt(n+"["+("object"==typeof t&&null!=t?e:"")+"]",t,r,i)});else if(r||"object"!==x(e))i(n,e);else for(t in e)Pt(n+"["+t+"]",e[t],r,i)}ce.param=function(e,t){var n,r=[],i=function(e,t){var n=v(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(null==e)return"";if(Array.isArray(e)||e.jquery&&!ce.isPlainObject(e))ce.each(e,function(){i(this.name,this.value)});else for(n in e)Pt(n,e[n],t,i);return r.join("&")},ce.fn.extend({serialize:function(){return ce.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=ce.prop(this,"elements");return e?ce.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!ce(this).is(":disabled")&&Ot.test(this.nodeName)&&!Ht.test(e)&&(this.checked||!we.test(e))}).map(function(e,t){var n=ce(this).val();return null==n?null:Array.isArray(n)?ce.map(n,function(e){return{name:t.name,value:e.replace(Lt,"\r\n")}}):{name:t.name,value:n.replace(Lt,"\r\n")}}).get()}});var Mt=/%20/g,Rt=/#.*$/,It=/([?&])_=[^&]*/,Wt=/^(.*?):[ \t]*([^\r\n]*)$/gm,Ft=/^(?:GET|HEAD)$/,$t=/^\/\//,Bt={},_t={},zt="*/".concat("*"),Xt=C.createElement("a");function Ut(o){return function(e,t){"string"!=typeof e&&(t=e,e="*");var n,r=0,i=e.toLowerCase().match(D)||[];if(v(t))while(n=i[r++])"+"===n[0]?(n=n.slice(1)||"*",(o[n]=o[n]||[]).unshift(t)):(o[n]=o[n]||[]).push(t)}}function Vt(t,i,o,a){var s={},u=t===_t;function l(e){var r;return s[e]=!0,ce.each(t[e]||[],function(e,t){var n=t(i,o,a);return"string"!=typeof n||u||s[n]?u?!(r=n):void 0:(i.dataTypes.unshift(n),l(n),!1)}),r}return l(i.dataTypes[0])||!s["*"]&&l("*")}function Gt(e,t){var n,r,i=ce.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&ce.extend(!0,e,r),e}Xt.href=Et.href,ce.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Et.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(Et.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":zt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":ce.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Gt(Gt(e,ce.ajaxSettings),t):Gt(ce.ajaxSettings,e)},ajaxPrefilter:Ut(Bt),ajaxTransport:Ut(_t),ajax:function(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var c,f,p,n,d,r,h,g,i,o,v=ce.ajaxSetup({},t),y=v.context||v,m=v.context&&(y.nodeType||y.jquery)?ce(y):ce.event,x=ce.Deferred(),b=ce.Callbacks("once memory"),w=v.statusCode||{},a={},s={},u="canceled",T={readyState:0,getResponseHeader:function(e){var t;if(h){if(!n){n={};while(t=Wt.exec(p))n[t[1].toLowerCase()+" "]=(n[t[1].toLowerCase()+" "]||[]).concat(t[2])}t=n[e.toLowerCase()+" "]}return null==t?null:t.join(", ")},getAllResponseHeaders:function(){return h?p:null},setRequestHeader:function(e,t){return null==h&&(e=s[e.toLowerCase()]=s[e.toLowerCase()]||e,a[e]=t),this},overrideMimeType:function(e){return null==h&&(v.mimeType=e),this},statusCode:function(e){var t;if(e)if(h)T.always(e[T.status]);else for(t in e)w[t]=[w[t],e[t]];return this},abort:function(e){var t=e||u;return c&&c.abort(t),l(0,t),this}};if(x.promise(T),v.url=((e||v.url||Et.href)+"").replace($t,Et.protocol+"//"),v.type=t.method||t.type||v.method||v.type,v.dataTypes=(v.dataType||"*").toLowerCase().match(D)||[""],null==v.crossDomain){r=C.createElement("a");try{r.href=v.url,r.href=r.href,v.crossDomain=Xt.protocol+"//"+Xt.host!=r.protocol+"//"+r.host}catch(e){v.crossDomain=!0}}if(v.data&&v.processData&&"string"!=typeof v.data&&(v.data=ce.param(v.data,v.traditional)),Vt(Bt,v,t,T),h)return T;for(i in(g=ce.event&&v.global)&&0==ce.active++&&ce.event.trigger("ajaxStart"),v.type=v.type.toUpperCase(),v.hasContent=!Ft.test(v.type),f=v.url.replace(Rt,""),v.hasContent?v.data&&v.processData&&0===(v.contentType||"").indexOf("application/x-www-form-urlencoded")&&(v.data=v.data.replace(Mt,"+")):(o=v.url.slice(f.length),v.data&&(v.processData||"string"==typeof v.data)&&(f+=(At.test(f)?"&":"?")+v.data,delete v.data),!1===v.cache&&(f=f.replace(It,"$1"),o=(At.test(f)?"&":"?")+"_="+jt.guid+++o),v.url=f+o),v.ifModified&&(ce.lastModified[f]&&T.setRequestHeader("If-Modified-Since",ce.lastModified[f]),ce.etag[f]&&T.setRequestHeader("If-None-Match",ce.etag[f])),(v.data&&v.hasContent&&!1!==v.contentType||t.contentType)&&T.setRequestHeader("Content-Type",v.contentType),T.setRequestHeader("Accept",v.dataTypes[0]&&v.accepts[v.dataTypes[0]]?v.accepts[v.dataTypes[0]]+("*"!==v.dataTypes[0]?", "+zt+"; q=0.01":""):v.accepts["*"]),v.headers)T.setRequestHeader(i,v.headers[i]);
vendor: 11,581 bytes, line 101
101if(v.beforeSend&&(!1===v.beforeSend.call(y,T,v)||h))return T.abort();if(u="abort",b.add(v.complete),T.done(v.success),T.fail(v.error),c=Vt(_t,v,t,T)){if(T.readyState=1,g&&m.trigger("ajaxSend",[T,v]),h)return T;v.async&&0<v.timeout&&(d=ie.setTimeout(function(){T.abort("timeout")},v.timeout));try{h=!1,c.send(a,l)}catch(e){if(h)throw e;l(-1,e)}}else l(-1,"No Transport");function l(e,t,n,r){var i,o,a,s,u,l=t;h||(h=!0,d&&ie.clearTimeout(d),c=void 0,p=r||"",T.readyState=0<e?4:0,i=200<=e&&e<300||304===e,n&&(s=function(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}(v,T,n)),!i&&-1<ce.inArray("script",v.dataTypes)&&ce.inArray("json",v.dataTypes)<0&&(v.converters["text script"]=function(){}),s=function(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(a=l[u+" "+o]||l["* "+o]))for(i in l)if((s=i.split(" "))[1]===o&&(a=l[u+" "+s[0]]||l["* "+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}(v,s,T,i),i?(v.ifModified&&((u=T.getResponseHeader("Last-Modified"))&&(ce.lastModified[f]=u),(u=T.getResponseHeader("etag"))&&(ce.etag[f]=u)),204===e||"HEAD"===v.type?l="nocontent":304===e?l="notmodified":(l=s.state,o=s.data,i=!(a=s.error))):(a=l,!e&&l||(l="error",e<0&&(e=0))),T.status=e,T.statusText=(t||l)+"",i?x.resolveWith(y,[o,l,T]):x.rejectWith(y,[T,l,a]),T.statusCode(w),w=void 0,g&&m.trigger(i?"ajaxSuccess":"ajaxError",[T,v,i?o:a]),b.fireWith(y,[T,l]),g&&(m.trigger("ajaxComplete",[T,v]),--ce.active||ce.event.trigger("ajaxStop")))}return T},getJSON:function(e,t,n){return ce.get(e,t,n,"json")},getScript:function(e,t){return ce.get(e,void 0,t,"script")}}),ce.each(["get","post"],function(e,i){ce[i]=function(e,t,n,r){return v(t)&&(r=r||n,n=t,t=void 0),ce.ajax(ce.extend({url:e,type:i,dataType:r,data:t,success:n},ce.isPlainObject(e)&&e))}}),ce.ajaxPrefilter(function(e){var t;for(t in e.headers)"content-type"===t.toLowerCase()&&(e.contentType=e.headers[t]||"")}),ce._evalUrl=function(e,t,n){return ce.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(e){ce.globalEval(e,t,n)}})},ce.fn.extend({wrapAll:function(e){var t;return this[0]&&(v(e)&&(e=e.call(this[0])),t=ce(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(n){return v(n)?this.each(function(e){ce(this).wrapInner(n.call(this,e))}):this.each(function(){var e=ce(this),t=e.contents();t.length?t.wrapAll(n):e.append(n)})},wrap:function(t){var n=v(t);return this.each(function(e){ce(this).wrapAll(n?t.call(this,e):t)})},unwrap:function(e){return this.parent(e).not("body").each(function(){ce(this).replaceWith(this.childNodes)}),this}}),ce.expr.pseudos.hidden=function(e){return!ce.expr.pseudos.visible(e)},ce.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},ce.ajaxSettings.xhr=function(){try{return new ie.XMLHttpRequest}catch(e){}};var Yt={0:200,1223:204},Qt=ce.ajaxSettings.xhr();le.cors=!!Qt&&"withCredentials"in Qt,le.ajax=Qt=!!Qt,ce.ajaxTransport(function(i){var o,a;if(le.cors||Qt&&!i.crossDomain)return{send:function(e,t){var n,r=i.xhr();if(r.open(i.type,i.url,i.async,i.username,i.password),i.xhrFields)for(n in i.xhrFields)r[n]=i.xhrFields[n];for(n in i.mimeType&&r.overrideMimeType&&r.overrideMimeType(i.mimeType),i.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest"),e)r.setRequestHeader(n,e[n]);o=function(e){return function(){o&&(o=a=r.onload=r.onerror=r.onabort=r.ontimeout=r.onreadystatechange=null,"abort"===e?r.abort():"error"===e?"number"!=typeof r.status?t(0,"error"):t(r.status,r.statusText):t(Yt[r.status]||r.status,r.statusText,"text"!==(r.responseType||"text")||"string"!=typeof r.responseText?{binary:r.response}:{text:r.responseText},r.getAllResponseHeaders()))}},r.onload=o(),a=r.onerror=r.ontimeout=o("error"),void 0!==r.onabort?r.onabort=a:r.onreadystatechange=function(){4===r.readyState&&ie.setTimeout(function(){o&&a()})},o=o("abort");try{r.send(i.hasContent&&i.data||null)}catch(e){if(o)throw e}},abort:function(){o&&o()}}}),ce.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),ce.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return ce.globalEval(e),e}}}),ce.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),ce.ajaxTransport("script",function(n){var r,i;if(n.crossDomain||n.scriptAttrs)return{send:function(e,t){r=ce("<script>").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),C.head.appendChild(r[0])},abort:function(){i&&i()}}});var Jt,Kt=[],Zt=/(=)\?(?=&|$)|\?\?/;ce.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Kt.pop()||ce.expando+"_"+jt.guid++;return this[e]=!0,e}}),ce.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Zt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Zt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=v(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Zt,"$1"+r):!1!==e.jsonp&&(e.url+=(At.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||ce.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=ie[r],ie[r]=function(){o=arguments},n.always(function(){void 0===i?ce(ie).removeProp(r):ie[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Kt.push(r)),o&&v(i)&&i(o[0]),o=i=void 0}),"script"}),le.createHTMLDocument=((Jt=C.implementation.createHTMLDocument("").body).innerHTML="<form></form><form></form>",2===Jt.childNodes.length),ce.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(le.createHTMLDocument?((r=(t=C.implementation.createHTMLDocument("")).createElement("base")).href=C.location.href,t.head.appendChild(r)):t=C),o=!n&&[],(i=w.exec(e))?[t.createElement(i[1])]:(i=Ae([e],t,o),o&&o.length&&ce(o).remove(),ce.merge([],i.childNodes)));var r,i,o},ce.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1<s&&(r=Tt(e.slice(s)),e=e.slice(0,s)),v(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),0<a.length&&ce.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){o=arguments,a.html(r?ce("<div>").append(ce.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},ce.expr.pseudos.animated=function(t){return ce.grep(ce.timers,function(e){return t===e.elem}).length},ce.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=ce.css(e,"position"),c=ce(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=ce.css(e,"top"),u=ce.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),v(t)&&(t=t.call(e,n,ce.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},ce.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){ce.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===ce.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===ce.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=ce(e).offset()).top+=ce.css(e,"borderTopWidth",!0),i.left+=ce.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-ce.css(r,"marginTop",!0),left:t.left-i.left-ce.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===ce.css(e,"position"))e=e.offsetParent;return e||J})}}),ce.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;ce.fn[t]=function(e){return M(this,function(e,t,n){var r;if(y(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),ce.each(["top","left"],function(e,n){ce.cssHooks[n]=Ye(le.pixelPosition,function(e,t){if(t)return t=Ge(e,n),_e.test(t)?ce(e).position()[n]+"px":t})}),ce.each({Height:"height",Width:"width"},function(a,s){ce.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){ce.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return M(this,function(e,t,n){var r;return y(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?ce.css(e,t,i):ce.style(e,t,n,i)},s,n?e:void 0,n)}})}),ce.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){ce.fn[t]=function(e){return this.on(t,e)}}),ce.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.on("mouseenter",e).on("mouseleave",t||e)}}),ce.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){ce.fn[n]=function(e,t){return 0<arguments.length?this.on(n,null,e,t):this.trigger(n)}});var en=/^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g;ce.proxy=function(e,t){var n,r,i;if("string"==typeof t&&(n=e[t],t=e,e=n),v(e))return r=ae.call(arguments,2),(i=function(){return e.apply(t||this,r.concat(ae.call(arguments)))}).guid=e.guid=e.guid||ce.guid++,i},ce.holdReady=function(e){e?ce.readyWait++:ce.ready(!0)},ce.isArray=Array.isArray,ce.parseJSON=JSON.parse,ce.nodeName=fe,ce.isFunction=v,ce.isWindow=y,ce.camelCase=F,ce.type=x,ce.now=Date.now,ce.isNumeric=function(e){var t=ce.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},ce.trim=function(e){return null==e?"":(e+"").replace(en,"$1")},"function"==typeof define&&define.amd&&define("jquery",[],function(){return ce});var tn=ie.jQuery,nn=ie.$;return ce.noConflict=function(e){return ie.$===ce&&(ie.$=nn),e&&ie.jQuery===ce&&(ie.jQuery=tn),ce},"undefined"==typeof e&&(ie.jQuery=ie.$=ce),ce});
vendor: 1,688 bytes, lines 102-104
102
103/*! jQuery Color [email protected] http://github.com/jquery/jquery-color | jquery.org/license */
104(function(a,b){function m(a,b,c){var d=h[b.type]||{};return a==null?c||!b.def?null:b.def:(a=d.floor?~~a:parseFloat(a),isNaN(a)?b.def:d.mod?(a+d.mod)%d.mod:0>a?0:d.max<a?d.max:a)}function n(b){var c=f(),d=c._rgba=[];return b=b.toLowerCase(),l(e,function(a,e){var f,h=e.re.exec(b),i=h&&e.parse(h),j=e.space||"rgba";if(i)return f=c[j](i),c[g[j].cache]=f[g[j].cache],d=c._rgba=f._rgba,!1}),d.length?(d.join()==="0,0,0,0"&&a.extend(d,k.transparent),c):k[b]}function o(a,b,c){return c=(c+1)%1,c*6<1?a+(b-a)*c*6:c*2<1?b:c*3<2?a+(b-a)*(2/3-c)*6:a}var c="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",d=/^([\-+])=\s*(\d+\.?\d*)/,e=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(a){return[a[1],a[2],a[3],a[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(a){return[a[1]*2.55,a[2]*2.55,a[3]*2.55,a[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(a){return[parseInt(a[1],16),parseInt(a[2],16),parseInt(a[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(a){return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(a){return[a[1],a[2]/100,a[3]/100,a[4]]}}],f=a.Color=function(b,c,d,e){return new a.Color.fn.parse(b,c,d,e)},g={rgba:{props:{red:{idx:0,type:"byte"}
104,green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},h={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},i=f.support={},j=a("<p>")[0],k,l=a.each;j.style.cssText="background-color:rgba(1,1,1,.5)",i.rgba=j.style.backgroundColor.indexOf("rgba")>-1,l(g,function(a,b){b.cache="_"+a,b.props.alpha={idx:3,type:"percent",def:1}}),f.fn=a.extend(f.prototype,{parse:function(c,d,e,h){if(c===b)return this._rgba=[null,null,null,null],this;if(c.jquery||c.nodeType)c=a(c).css(d),d=b;var i=this,j=a.type(c),o=this._rgba=[];d!==b&&(c=[c,d,e,h],j="array");if(j==="string")return this.parse(n(c)||k._default);if(j==="array")return l(g.rgba.props,function(a,b){o[b.idx]=m(c[b.idx],b)}),this;if(j==="object")return c instanceof f?l(g,function(a,b){c[b.cache]&&(i[b.cache]=c[b.cache].slice())}):l(g,function(b,d){var e=d.cache;l(d.props,function(a,b){if(!i[e]&&d.to){if(a==="alpha"||c[a]==null)return;i[e]=d.to(i._rgba)}i[e][b.idx]=m(c[a],b,!0)}),i[e]&&a.inArray(null,i[e].slice(0,3))<0&&(i[e][3]=1,d.from&&(i._rgba=d.from(i[e])))}),this},is:function(a){var b=f(a),c=!0,d=this;return l(g,function(a,e){var f,g=b[e.cache];return g&&(f=d[e.cache]||e.to&&e.to(d._rgba)||[],l(e.props,function(a,b){if(g[b.idx]!=null)return c=g[b.idx]===f[b.idx],c})),c}),c},_space:function(){var a=[],b=this;return l(g,function(c,d){b[d.cache]&&a.push(c)}),a.pop()},transition:function(a,b){var c=f(a),d=c._space(),e=g[d],i=this.alpha()===0?f("transparent"):this,j=i[e.cache]||e.to(i._rgba),k=j.slice();return c=c[e.cache],l(e.props,function(a,d){var e=d.idx,f=j[e],g=c[e],i=h[d.type]||{};if(g===null)return;f===null?k[e]=g:(i.mod&&(g-f>i.mod/2?f+=i.mod:f-g>i.mod/2&&(f-=i.mod)),k[e]=m((g-f)*b+f,d))}),this[d](k)},blend:function(b){if(this._rgba[3]===1)return this;var c=this._rgba.slice(),d=c.pop(),e=f(b)._rgba;return f(a.map(c,function(a,b){return(1-d)*e[b]+d*a}))},toRgbaString:function(){var b="rgba(",c=a.map(this._rgba,function(a,b){return a==null?b>2?1:0:a});return c[3]===1&&(c.pop(),b="rgb("),b+c.join()+")"},toHslaString:function(){var b="hsla(",c=a.map(this.hsla(),function(a,b){return a==null&&(a=b>2?1:0),b&&b<3&&(a=Math.round(a*100)+"%"),a});return c[3]===1&&(c.pop(),b="hsl("),b+c.join()+")"},toHexString:function(b){var c=this._rgba.slice(),d=c.pop();return b&&c.push(~~(d*255)),"#"+a.map(c,function(a){return a=(a||0).toString(16),a.length===1?"0"+a:a}).join("")},toString:function(){return this._rgba[3]===0?"transparent":this.toRgbaString()}}),f.fn.parse.prototype=f.fn,g.hsla.to=function(a){if(a[0]==null||a[1]==null||a[2]==null)return[null,null,null,a[3]];var b=a[0]/255,c=a[1]/255,d=a[2]/255,e=a[3],f=Math.max(b,c,d),g=Math.min(b,c,d),h=f-g,i=f+g,j=i*.5,k,l;return g===f?k=0:b===f?k=60*(c-d)/h+360:c===f?k=60*(d-b)/h+120:k=60*(b-c)/h+240,h===0?l=0:j<=.5?l=h/i:l=h/(2-i),[Math.round(k)%360,l,j,e==null?1:e]},g.hsla.from=function(a){if(a[0]==null||a[1]==null||a[2]==null)return[null,null,null,a[3]];var b=a[0]/360,c=a[1],d=a[2],e=a[3],f=d<=.5?d*(1+c):d+c-d*c,g=2*d-f;return[Math.round(o(g,f,b+1/3)*255),Math.round(o(g,f,b)*255),Math.round(o(g,f,b-1/3)*255),e]},l(g,function(c,e){var g=e.props,h=e.cache,i=e.to,j=e.from;f.fn[c]=function(c){i&&!this[h]&&(this[h]=i(this._rgba));if(c===b)return this[h].slice();var d,e=a.type(c),k=e==="array"||e==="object"?c:arguments,n=this[h].slice();return l(g,function(a,b){var c=k[e==="object"?a:b.idx];c==null&&(c=n[b.idx]),n[b.idx]=m(c,b)}),j?(d=f(j(n)),d[h]=n,d):f(n)},l(g,function(b,e){if(f.fn[b])return;f.fn[b]=function(f){var g=a.type(f),h=b==="alpha"?this._hsla?"hsla":"rgba":c,i=this[h](),j=i[e.idx],k;return g==="undefined"?j:(g==="function"&&(f=f.call(this,j),g=a.type(f)),f==null&&e.empty?this:(g==="string"&&(k=d.exec(f),k&&(f=j+parseFloat(k[2])*(k[1]==="+"?1:-1))),i[e.idx]=f,this[h](i)))}})}),f.hook=function(b){var c=b.split(" ");l(c,function(b,c){a.cssHooks[c]={set:function(b,d){var e,g,h="";if(d!=="transparent"&&(a.type(d)!=="string"||(e=n(d)))){d=f(e||d);if(!i.rgba&&d._rgba[3]!==1){g=c==="backgroundColor"?b.parentNode:b;while((h===""||h==="transparent")&&g&&g.style)try{h=a.css(g,"backgroundColor"),g=g.parentNode}catch(j){}d=d.blend(h&&h!=="transparent"?h:"_default")}d=d.toRgbaString()}try{b.style[c]=d}catch(j){}}},a.fx.step[c]=function(b){b.colorInit||(b.start=f(b.elem,c),b.end=f(b.end),b.colorInit=!0),a.cssHooks[c].set(b.elem,b.start.transition(b.end,b.pos))}})},f.hook(c),a.cssHooks.borderColor={expand:function(a){var b={};return l(["Top","Right","Bottom","Left"],function(c,d){b["border"+d+"Color"]=a}),b}},k=a.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}})(jQuery);
105/**
106 * Copyright (c) 2007 Ariel Flesler - aflesler ○ gmail • com | https://github.com/flesler
107 * Licensed under MIT
108 * @author Ariel Flesler
109 * @version 2.1.3
110 */
111;(function(factory){'use strict';if(typeof define==='function'&&define.amd){define(['jquery'],factory)}else if(typeof module!=='undefined'&&module.exports){module.exports=factory(require('jquery'))}else{factory(jQuery)}})(function($){'use strict';var $scrollTo=$.scrollTo=function(target,duration,settings){return $(window).scrollTo(target,duration,settings)};
vendor: 1,706 bytes, line 111
111$scrollTo.defaults={axis:'xy',duration:0,limit:true};function isWin(elem){return!elem.nodeName||$.inArray(elem.nodeName.toLowerCase(),['iframe','#document','html','body'])!==-1}function isFunction(obj){return typeof obj==='function'}$.fn.scrollTo=function(target,duration,settings){if(typeof duration==='object'){settings=duration;duration=0}if(typeof settings==='function'){settings={onAfter:settings}}if(target==='max'){target=9e9}settings=$.extend({},$scrollTo.defaults,settings);duration=duration||settings.duration;var queue=settings.queue&&settings.axis.length>1;if(queue){duration/=2}settings.offset=both(settings.offset);settings.over=both(settings.over);return this.each(function(){if(target===null){return}var win=isWin(this),elem=win?this.contentWindow||window:this,$elem=$(elem),targ=target,attr={},toff;switch(typeof targ){case 'number':case 'string':if(/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(targ)){targ=both(targ);break}targ=win?$(targ):$(targ,elem);case 'object':if(targ.length===0){return}if(targ.is||targ.style){toff=(targ=$(targ)).offset()}}var offset=isFunction(settings.offset)&&settings.offset(elem,targ)||settings.offset;$.each(settings.axis.split(''),function(i,axis){var Pos=axis==='x'?'Left':'Top',pos=Pos.toLowerCase(),key='scroll'+Pos,prev=$elem[key](),max=$scrollTo.max(elem,axis);if(toff){attr[key]=toff[pos]+(win?0:prev-$elem.offset()[pos]);if(settings.margin){attr[key]-=parseInt(targ.css('margin'+Pos),10)||0;attr[key]-=parseInt(targ.css('border'+Pos+'Width'),10)||0}attr[key]+=offset[pos]||0;if(settings.over[pos]){attr[key]+=targ[axis==='x'?'width':'height']()*settings.over[pos]}}else{var val=targ[pos];attr[key]=val.slice&&val.slice(-1)==='%'?parseFloat(val)/100*max:val}
111if(settings.limit&&/^\d+$/.test(attr[key])){attr[key]=attr[key]<=0?0:Math.min(attr[key],max)}if(!i&&settings.axis.length>1){if(prev===attr[key]){attr={}}else if(queue){animate(settings.onAfterFirst);attr={}}}});animate(settings.onAfter);function animate(callback){var opts=$.extend({},settings,{queue:true,duration:duration,complete:callback&&function(){callback.call(elem,targ,settings)}});$elem.animate(attr,opts)}})};$scrollTo.max=function(elem,axis){var Dim=axis==='x'?'Width':'Height',scroll='scroll'+Dim;if(!isWin(elem)){return elem[scroll]-$(elem)[Dim.toLowerCase()]()}var size='client'+Dim,doc=elem.ownerDocument||elem.document,html=doc.documentElement,body=doc.body;return Math.max(html[scroll],body[scroll])-Math.min(html[size],body[size])};function both(val){return isFunction(val)||$.isPlainObject(val)?val:{top:val,left:val}}$.Tween.propHooks.scrollLeft=$.Tween.propHooks.scrollTop={get:function(t){return $(t.elem)[t.prop]()},set:function(t){var curr=this.get(t);if(t.options.interrupt&&t._last&&t._last!==curr){return $(t.elem).stop()}var next=Math.round(t.now);if(curr!==next){$(t.elem)[t.prop](next);t._last=this.get(t)}}};return $scrollTo});
112
113/*
114 Sticky-kit v1.1.3 | MIT | Leaf Corcoran 2015 | http://leafo.net
115*/
116(function(){var c,f;c=window.jQuery;f=c(window);c.fn.stick_in_parent=function(b){var A,w,J,n,B,K,p,q,L,k,E,t;null==b&&(b={});t=b.sticky_class;B=b.inner_scrolling;E=b.recalc_every;k=b.parent;q=b.offset_top;p=b.spacer;w=b.bottoming;null==q&&(q=0);null==k&&(k=void 0);null==B&&(B=!0);null==t&&(t="is_stuck");A=c(document);null==w&&(w=!0);L=function(a){var b;return window.getComputedStyle?(a=window.getComputedStyle(a[0]),b=parseFloat(a.getPropertyValue("width"))+parseFloat(a.getPropertyValue("margin-left"))+
117parseFloat(a.getPropertyValue("margin-right")),"border-box"!==a.getPropertyValue("box-sizing")&&(b+=parseFloat(a.getPropertyValue("border-left-width"))+parseFloat(a.getPropertyValue("border-right-width"))+parseFloat(a.getPropertyValue("padding-left"))+parseFloat(a.getPropertyValue("padding-right"))),b):a.outerWidth(!0)};J=function(a,b,n,C,F,u,r,G){var v,H,m,D,I,d,g,x,y,z,h,l;if(!a.data("sticky_kit")){a.data("sticky_kit",!0);I=A.height();g=a.parent();null!=k&&(g=g.closest(k));if(!g.length)throw"failed to find stick parent";
118v=m=!1;(h=null!=p?p&&a.closest(p):c("<div />"))&&h.css("position",a.css("position"));x=function(){var d,f,e;if(!G&&(I=A.height(),d=parseInt(g.css("border-top-width"),10),f=parseInt(g.css("padding-top"),10),b=parseInt(g.css("padding-bottom"),10),n=g.offset().top+d+f,C=g.height(),m&&(v=m=!1,null==p&&(a.insertAfter(h),h.detach()),a.css({position:"",top:"",width:"",bottom:""}).removeClass(t),e=!0),F=a.offset().top-(parseInt(a.css("margin-top"),10)||0)-q,u=a.outerHeight(!0),r=a.css("float"),h&&h.css({width:L(a),
119height:u,display:a.css("display"),"vertical-align":a.css("vertical-align"),"float":r}),e))return l()};x();if(u!==C)return D=void 0,d=q,z=E,l=function(){var c,l,e,k;if(!G&&(e=!1,null!=z&&(--z,0>=z&&(z=E,x(),e=!0)),e||A.height()===I||x(),e=f.scrollTop(),null!=D&&(l=e-D),D=e,m?(w&&(k=e+u+d>C+n,v&&!k&&(v=!1,a.css({position:"fixed",bottom:"",top:d}).trigger("sticky_kit:unbottom"))),e<F&&(m=!1,d=q,null==p&&("left"!==r&&"right"!==r||a.insertAfter(h),h.detach()),c={position:"",width:"",top:""},a.css(c).removeClass(t).trigger("sticky_kit:unstick")),
120B&&(c=f.height(),u+q>c&&!v&&(d-=l,d=Math.max(c-u,d),d=Math.min(q,d),m&&a.css({top:d+"px"})))):e>F&&(m=!0,c={position:"fixed",top:d},c.width="border-box"===a.css("box-sizing")?a.outerWidth()+"px":a.width()+"px",a.css(c).addClass(t),null==p&&(a.after(h),"left"!==r&&"right"!==r||h.append(a)),a.trigger("sticky_kit:stick")),m&&w&&(null==k&&(k=e+u+d>C+n),!v&&k)))return v=!0,"static"===g.css("position")&&g.css({position:"relative"}),a.css({position:"absolute",bottom:b,top:"auto"}).trigger("sticky_kit:bottom")},
121y=function(){x();return l()},H=function(){G=!0;f.off("touchmove",l);f.off("scroll",l);f.off("resize",y);c(document.body).off("sticky_kit:recalc",y);a.off("sticky_kit:detach",H);a.removeData("sticky_kit");a.css({position:"",bottom:"",top:"",width:""});g.position("position","");if(m)return null==p&&("left"!==r&&"right"!==r||a.insertAfter(h),h.remove()),a.removeClass(t)},f.on("touchmove",l),f.on("scroll",l),f.on("resize",y),c(document.body).on("sticky_kit:recalc",y),a.on("sticky_kit:detach",H),setTimeout(l,
1220)}};n=0;for(K=this.length;n<K;n++)b=this[n],J(c(b));return this}}).call(this);
123
124/**
125*  Ajax Autocomplete for jQuery, version 1.4.11
126*  (c) 2017 Tomas Kirda
127*
128*  Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT
128-style license.
129*  For details, see the web site: https://github.com/devbridge/jQuery-Autocomplete
130*/
131
132/*jslint  browser: true, white: true, single: true, this: true, multivar: true */
133/*global define, window, document, jQuery, exports, require */
134
135// Expose plugin as an AMD module if AMD loader is present:
136(function (factory) {
137    "use strict";
138    if (typeof define === 'function' && define.amd) {
139        // AMD. Register as an anonymous module.
140        define(['jquery'], factory);
141    } else if (typeof exports === 'object' && typeof require === 'function') {
142        // Browserify
143        factory(require('jquery'));
144    } else {
145        // Browser globals
146        factory(jQuery);
147    }
148}(function ($) {
149    'use strict';
150
151    var
152        utils = (function () {
153            return {
154                escapeRegExChars: function (value) {
155                    return value.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&");
156                },
157                createNode: function (containerClass) {
158                    var div = document.createElement('div');
159                    div.className = containerClass;
160                    div.style.position = 'absolute';
161                    div.style.display = 'none';
162                    return div;
163                }
164            };
165        }()),
166
167        keys = {
168            ESC: 27,
169            TAB: 9,
170            RETURN: 13,
171            LEFT: 37,
172            UP: 38,
173            RIGHT: 39,
174            DOWN: 40
175        },
176
177        noop = $.noop;
178
179    function Autocomplete(el, options) {
180        var that = this;
181
182        // Shared variables:
183        that.element = el;
184        that.el = $(el);
185        that.suggestions = [];
186        that.badQueries = [];
187        that.selectedIndex = -1;
188        that.currentValue = that.element.value;
189        that.timeoutId = null;
190        that.cachedResponse = {};
191        that.onChangeTimeout = null;
192        that.onChange = null;
193        that.isLocal = false;
194        that.suggestionsContainer = null;
195        that.noSuggestionsContainer = null;
196        that.options = $.extend(true, {}, Autocomplete.defaults, options);
197        that.classes = {
198            selected: 'autocomplete-selected',
199            suggestion: 'autocomplete-suggestion'
200        };
201        that.hint = null;
202        that.hintValue = '';
203        that.selection = null;
204
205        // Initialize and set options:
206        that.initialize();
207        that.setOptions(options);
208    }
209
210    Autocomplete.utils = utils;
211
212    $.Autocomplete = Autocomplete;
213
214    Autocomplete.defaults = {
215            ajaxSettings: {},
216            autoSelectFirst: false,
217            appendTo: 'body',
218            serviceUrl: null,
219            lookup: null,
220            onSelect: null,
221            onHint: null,
222            width: 'auto',
223            minChars: 1,
224            maxHeight: 300,
225            deferRequestBy: 0,
226            params: {},
227            formatResult: _formatResult,
228            formatGroup: _formatGroup,
229            delimiter: null,
230            zIndex: 9999,
231            type: 'GET',
232            noCache: false,
233            onSearchStart: noop,
234            onSearchComplete: noop,
235            onSearchError: noop,
236            preserveInput: false,
237            containerClass: 'autocomplete-suggestions',
238            tabDisabled: false,
239            dataType: 'text',
240            currentRequest: null,
241            triggerSelectOnValidInput: true,
242            preventBadQueries: true,
243            lookupFilter: _lookupFilter,
244            paramName: 'query',
245            transformResult: _transformResult,
246            showNoSuggestionNotice: false,
247            noSuggestionNotice: 'No results',
248            orientation: 'bottom',
249            forceFixPosition: false
250    };
251
252    function _lookupFilter(suggestion, originalQuery, queryLowerCase) {
253        return suggestion.value.toLowerCase().indexOf(queryLowerCase) !== -1;
254    };
255
256    function _transformResult(response) {
257        return typeof response === 'string' ? $.parseJSON(response) : response;
258    };
259
260    function _formatResult(suggestion, currentValue) {
261        // Do not replace anything if the current value is empty
262        if (!currentValue) {
263            return suggestion.value;
264        }
265
266        var pattern = '(' + utils.escapeRegExChars(currentValue) + ')';
267
268        return suggestion.value
269            .replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>')
270            .replace(/&/g, '&amp;')
271            .replace(/</g, '&lt;')
272            .replace(/>/g, '&gt;')
273            .replace(/"/g, '&quot;')
274            .replace(/&lt;(\/?strong)&gt;/g, '<$1>');
275    };
276
277    function _formatGroup(suggestion, category) {
278        return '<div class="autocomplete-group">' + category + '</div>';
279    };
280
281    Autocomplete.prototype = {
282
283        initialize: function () {
284            var that = this,
285                suggestionSelector = '.' + that.classes.suggestion,
286                selected = that.classes.selected,
287                options = that.options,
288                container;
289
290            that.element.setAttribute('autocomplete', 'off');
291
292            // html() deals with many types: htmlString or Element or Array or jQuery
293            that.noSuggestionsContainer = $('<div class="autocomplete-no-suggestion"></div>')
294                                          .html(this.options.noSuggestionNotice).get(0);
295
296            that.suggestionsContainer = Autocomplete.utils.createNode(options.containerClass);
297
298            container = $(that.suggestionsContainer);
299
300            container.appendTo(options.appendTo || 'body');
301
302            // Only set width if it was provided:
303            if (options.width !== 'auto') {
304                container.css('width', options.width);
305            }
306
307            // Listen for mouse over event on suggestions list:
308            container.on('mouseover.autocomplete', suggestionSelector, function () {
309                that.activate($(this).data('index'));
310            });
311
312            // Deselect active element when mouse leaves suggestions container:
313            container.on('mouseout.autocomplete', function () {
314                that.selectedIndex = -1;
315                container.children('.' + selected).removeClass(selected);
316            });
317
318            // Listen for click event on suggestions list:
319            container.on('click.autocomplete', suggestionSelector, function () {
320                that.select($(this).data('index'));
321            });
322
323            container.on('click.autocomplete', function () {
324                clearTimeout(that.blurTimeoutId);
325            })
326
327            that.fixPositionCapture = function () {
328                if (that.visible) {
329                    that.fixPosition();
330                }
331            };
332
333            $(window).on('resize.autocomplete', that.fixPositionCapture);
334
335            that.el.on('keydown.autocomplete', function (e) { that.onKeyPress(e); });
336            that.el.on('keyup.autocomplete', function (e) { that.onKeyUp(e); });
337            that.el.on('blur.autocomplete', function () { that.onBlur(); });
338            that.el.on('focus.autocomplete', function () { that.onFocus(); });
339            that.el.on('change.autocomplete', function (e) { that.onKeyUp(e); });
340            that.el.on('input.autocomplete', function (e) { that.onKeyUp(e); });
341        },
342
343        onFocus: function () {
344            var that = this;
345
346            if (that.disabled) {
347                return;
348            }
349
350            that.fixPosition();
351
352            if (that.el.val().length >= that.options.minChars) {
353                that.onValueChange();
354            }
355        },
356
357        onBlur: function () {
358            var that = this,
359                options = that.options,
360                value = that.el.val(),
361                query = that.getQuery(value);
362
363            // If user clicked on a suggestion, hide() will
364            // be canceled, otherwise close suggestions
365            that.blurTimeoutId = setTimeout(function () {
366                that.hide();
367
368                if (that.selection && that.currentValue !== query) {
369                    (options.onInvalidateSelection || $.noop).call(that.element);
370                }
371            }, 200);
372        },
373
374        abortAjax: function () {
375            var that = this;
376            if (that.currentRequest) {
377                that.currentRequest.abort();
378                that.currentRequest = null;
379            }
380        },
381
382        setOptions: function (suppliedOptions) {
383            var that = this,
384                options = $.extend({}, that.options, suppliedOptions);
385
386            that.isLocal = Array.isArray(options.lookup);
387
388            if (that.isLocal) {
389                options.lookup = that.verifySuggestionsFormat(options.lookup);
390            }
391
392            options.orientation = that.validateOrientation(options.orientation, 'bottom');
393
394            // Adjust height, width and z-index:
395            $(that.suggestionsContainer).css({
396                'max-height': options.maxHeight + 'px',
397                'width': options.width + 'px',
398                'z-index': options.zIndex
399            });
400
401            this.options = options;
402        },
403
404
405        clearCache: function () {
406            this.cachedResponse = {};
407            this.badQueries = [];
408        },
409
410        clear: function () {
411            this.clearCache();
412            this.currentValue = '';
413            this.suggestions = [];
414        },
415
416        disable: function () {
417            var that = this;
418            that.disabled = true;
419            clearTimeout(that.onChangeTimeout);
420            that.abortAjax();
421        },
422
423        enable: function () {
424            this.disabled = false;
425        },
426
427        fixPosition: function () {
428            // Use only when container has already its content
429
430            var that = this,
431                $container = $(that.suggestionsContainer),
432                containerParent = $container.parent().get(0);
433            // Fix position automatically when appended to body.
434            // In other cases force parameter must be given.
435            if (containerParent !== document.body && !that.options.forceFixPosition) {
436                return;
437            }
438
439            // Choose orientation
440            var orientation = that.options.orientation,
441                containerHeight = $container.outerHeight(),
442                height = that.el.outerHeight(),
443                offset = that.el.offset(),
444                styles = { 'top': offset.top, 'left': offset.left };
445
446            if (orientation === 'auto') {
447                var viewPortHeight = $(window).height(),
448                    scrollTop = $(window).scrollTop(),
449                    topOverflow = -scrollTop + offset.top - containerHeight,
450                    bottomOverflow = scrollTop + viewPortHeight - (offset.top + height + containerHeight);
451
452                orientation = (Math.max(topOverflow, bottomOverflow) === topOverflow) ? 'top' : 'bottom';
453            }
454
455            if (orientation === 'top') {
456                styles.top += -containerHeight;
457            } else {
458                styles.top += height;
459            }
460
461            // If container is not positioned to body,
462            // correct its position using offset parent offset
463            if(containerParent !== document.body) {
464                var opacity = $container.css('opacity'),
465                    parentOffsetDiff;
466
467                    if (!that.visible){
468                        $container.css('opacity', 0).show();
469                    }
470
471                parentOffsetDiff = $container.offsetParent().offset();
472                styles.top -= parentOffsetDiff.top;
473                styles.top += containerParent.scrollTop;
474                styles.left -= parentOffsetDiff.left;
475
476                if (!that.visible){
477                    $container.css('opacity', opacity).hide();
478                }
479            }
480
481            if (that.options.width === 'auto') {
482                styles.width = that.el.outerWidth() + 'px';
483            }
484
485            $container.css(styles);
486        },
487
488        isCursorAtEnd: function () {
489            var that = this,
490                valLength = that.el.val().length,
491                selectionStart = that.element.selectionStart,
492                range;
493
494            if (typeof selectionStart === 'number') {
495                return selectionStart === valLength;
496            }
497            if (document.selection) {
498                range = document.selection.createRange();
499                range.moveStart('character', -valLength);
500                return valLength === range.text.length;
501            }
502            return true;
503        },
504
505        onKeyPress: function (e) {
506            var that = this;
507
508            // If suggestions are hidden and user presses arrow down, display suggestions:
509            if (!that.disabled && !that.visible && e.which === keys.DOWN && that.currentValue) {
510                that.suggest();
511                return;
512            }
513
514            if (that.disabled || !that.visible) {
515                return;
516            }
517
518            switch (e.which) {
519                case keys.ESC:
520                    that.el.val(that.currentValue);
521                    that.hide();
522                    break;
523                case keys.RIGHT:
524                    if (that.hint && that.options.onHint && that.isCursorAtEnd()) {
525                        that.selectHint();
526                        break;
527                    }
528                    return;
529                case keys.TAB:
530                    if (that.hint && that.options.onHint) {
531                        that.selectHint();
532                        return;
533                    }
534                    if (that.selectedIndex === -1) {
535                        that.hide();
536                        return;
537                    }
538                    that.select(that.selectedIndex);
539                    if (that.options.tabDisabled === false) {
540                        return;
541                    }
542                    break;
543                case keys.RETURN:
544                    if (that.selectedIndex === -1) {
545                        that.hide();
546                        return;
547                    }
548                    that.select(that.selectedIndex);
549                    break;
550                case keys.UP:
551                    that.moveUp();
552                    break;
553                case keys.DOWN:
554                    that.moveDown();
555                    break;
556                default:
557                    return;
558            }
559
560            // Cancel event if function did not return:
561            e.stopImmediatePropagation();
562            e.preventDefault();
563        },
564
565        onKeyUp: function (e) {
566            var that = this;
567
568            if (that.disabled) {
569                return;
570            }
571
572            switch (e.which) {
573                case keys.UP:
574                case keys.DOWN:
575                    return;
576            }
577
578            clearTimeout(that.onChangeTimeout);
579
580            if (that.currentValue !== that.el.val()) {
581                that.findBestHint();
582                if (that.options.deferRequestBy > 0) {
583                    // Defer lookup in case when value changes very quickly:
584                    that.onChangeTimeout = setTimeout(function () {
585                        that.onValueChange();
586                    }, that.options.deferRequestBy);
587                } else {
588                    that.onValueChange();
589                }
590            }
591        },
592
593        onValueChange: function () {
594            if (this.ignoreValueChange) {
595                this.ignoreValueChange = false;
596                return;
597            }
598
599            var that = this,
600                options = that.options,
601                value = that.el.val(),
602                query = that.getQuery(value);
603
604            if (that.selection && that.currentValue !== query) {
605                that.selection = null;
606                (options.onInvalidateSelection || $.noop).call(that.element);
607            }
608
609            clearTimeout(that.onChangeTimeout);
610            that.currentValue = value;
611            that.selectedIndex = -1;
612
613            // Check existing suggestion for the match before proceeding:
614            if (options.triggerSelectOnValidInput && that.isExactMatch(query)) {
615                that.select(0);
616                return;
617            }
618
619            if (query.length < options.minChars) {
620                that.hide();
621            } else {
622                that.getSuggestions(query);
623            }
624        },
625
626        isExactMatch: function (query) {
627            var suggestions = this.suggestions;
628
629            return (suggestions.length === 1 && suggestions[0].value.toLowerCase() === query.toLowerCase());
630        },
631
632        getQuery: function (value) {
633            var delimiter = this.options.delimiter,
634                parts;
635
636            if (!delimiter) {
637                return value;
638            }
639            parts = value.split(delimiter);
640            return $.trim(parts[parts.length - 1]);
641        },
642
643        getSuggestionsLocal: function (query) {
644            var that = this,
645                options = that.options,
646                queryLowerCase = query.toLowerCase(),
647                filter = options.lookupFilter,
648                limit = parseInt(options.lookupLimit, 10),
649                data;
650
651            data = {
652                suggestions: $.grep(options.lookup, function (suggestion) {
653                    return filter(suggestion, query, queryLowerCase);
654                })
655            };
656
657            if (limit && data.suggestions.length > limit) {
658                data.suggestions = data.suggestions.slice(0, limit);
659            }
660
661            return data;
662        },
663
664        getSuggestions: function (q) {
665            var response,
666                that = this,
667                options = that.options,
668                serviceUrl = options.serviceUrl,
669                params,
670                cacheKey,
671                ajaxSettings;
672
673            options.params[options.paramName] = q;
674
675            if (options.onSearchStart.call(that.element, options.params) === false) {
676                return;
677            }
678
679            params = options.ignoreParams ? null : options.params;
680
681            if ($.isFunction(options.lookup)){
682                options.lookup(q, function (data) {
683                    that.suggestions = data.suggestions;
684                    that.suggest();
685                    options.onSearchComplete.call(that.element, q, data.suggestions);
686                });
687                return;
688            }
689
690            if (that.isLocal) {
691                response = that.getSuggestionsLocal(q);
692            } else {
693                if ($.isFunction(serviceUrl)) {
694                    serviceUrl = serviceUrl.call(that.element, q);
695                }
696                cacheKey = serviceUrl + '?' + $.param(params || {});
697                response = that.cachedResponse[cacheKey];
698            }
699
700            if (response && Array.isArray(response.suggestions)) {
701                that.suggestions = response.suggestions;
702                that.suggest();
703                options.onSearchComplete.call(that.element, q, response.suggestions);
704            } else if (!that.isBadQuery(q)) {
705                that.abortAjax();
706
707                ajaxSettings = {
708                    url: serviceUrl,
709                    data: params,
710                    type: options.type,
711                    dataType: options.dataType
712                };
713
714                $.extend(ajaxSettings, options.ajaxSettings);
715
716                that.currentRequest = $.ajax(ajaxSettings).done(function (data) {
717                    var result;
718                    that.currentRequest = null;
719                    result = options.transformResult(data, q);
720                    that.processResponse(result, q, cacheKey);
721                    options.onSearchComplete.call(that.element, q, result.suggestions);
722                }).fail(function (jqXHR, textStatus, errorThrown) {
723                    options.onSearchError.call(that.element, q, jqXHR, textStatus, errorThrown);
724                });
725            } else {
726                options.onSearchComplete.call(that.element, q, []);
727            }
728        },
729
730        isBadQuery: function (q) {
731            if (!this.options.preventBadQueries){
732                return false;
733            }
734
735            var badQueries = this.badQueries,
736                i = badQueries.length;
737
738            while (i--) {
739                if (q.indexOf(badQueries[i]) === 0) {
740                    return true;
741                }
742            }
743
744            return false;
745        },
746
747        hide: function () {
748            var that = this,
749                container = $(that.suggestionsContainer);
750
751            if ($.isFunction(that.options.onHide) && that.visible) {
752                that.options.onHide.call(that.element, container);
753            }
754
755            that.visible = false;
756            that.selectedIndex = -1;
757            clearTimeout(that.onChangeTimeout);
758            $(that.suggestionsContainer).hide();
759            that.onHint(null);
760        },
761
762        suggest: function () {
763            if (!this.suggestions.length) {
764                if (this.options.showNoSuggestionNotice) {
765                    this.noSuggestions();
766                } else {
767                    this.hide();
768                }
769                return;
770            }
771
772            var that = this,
773                options = that.options,
774                groupBy = options.groupBy,
775                formatResult = options.formatResult,
776                value = that.getQuery(that.currentValue),
777                className = that.classes.suggestion,
778                classSelected = that.classes.selected,
779                container = $(that.suggestionsContainer),
780                noSuggestionsContainer = $(that.noSuggestionsContainer),
781                beforeRender = options.beforeRender,
782                html = '',
783                category,
784                formatGroup = function (suggestion, index) {
785                        var currentCategory = suggestion.data[groupBy];
786
787                        if (category === currentCategory){
788                            return '';
789                        }
790
791                        category = currentCategory;
792
793                        return options.formatGroup(suggestion, category);
794                    };
795
796            if (options.triggerSelectOnValidInput && that.isExactMatch(value)) {
797                that.select(0);
798                return;
799            }
800
801            // Build suggestions inner HTML:
802            $.each(that.suggestions, function (i, suggestion) {
803                if (groupBy){
804                    html += formatGroup(suggestion, value, i);
805                }
806
807                html += '<div class="' + className + '" data-index="' + i + '">' + formatResult(suggestion, value, i) + '</div>';
808            });
809
810            this.adjustContainerWidth();
811
812            noSuggestionsContainer.detach();
813            container.html(html);
814
815            if ($.isFunction(beforeRender)) {
816                beforeRender.call(that.element, container, that.suggestions);
817            }
818
819            that.fixPosition();
820            container.show();
821
822            // Select first value by default:
823            if (options.autoSelectFirst) {
824                that.selectedIndex = 0;
825                container.scrollTop(0);
826                container.children('.' + className).first().addClass(classSelected);
827            }
828
829            that.visible = true;
830            that.findBestHint();
831        },
832
833        noSuggestions: function() {
834             var that = this,
835                 beforeRender = that.options.beforeRender,
836                 container = $(that.suggestionsContainer),
837                 noSuggestionsContainer = $(that.noSuggestionsContainer);
838
839            this.adjustContainerWidth();
840
841            // Some explicit steps. Be careful here as it easy to get
842            // noSuggestionsContainer removed from DOM if not detached properly.
843            noSuggestionsContainer.detach();
844
845            // clean suggestions if any
846            container.empty();
847            container.append(noSuggestionsContainer);
848
849            if ($.isFunction(beforeRender)) {
850                beforeRender.call(that.element, container, that.suggestions);
851            }
852
853            that.fixPosition();
854
855            container.show();
856            that.visible = true;
857        },
858
859        adjustContainerWidth: function() {
860            var that = this,
861                options = that.options,
862                width,
863                container = $(that.suggestionsContainer);
864
865            // If width is auto, adjust width before displaying suggestions,
866            // because if instance was created before input had width, it will be zero.
867            // Also it adjusts if input width has changed.
868            if (options.width === 'auto') {
869                width = that.el.outerWidth();
870                container.css('width', width > 0 ? width : 300);
871            } else if(options.width === 'flex') {
872                // Trust the source! Unset the width property so it will be the max length
873                // the containing elements.
874                container.css('width', '');
875            }
876        },
877
878        findBestHint: function () {
879            var that = this,
880                value = that.el.val().toLowerCase(),
881                bestMatch = null;
882
883            if (!value) {
884                return;
885            }
886
887            $.each(that.suggestions, function (i, suggestion) {
888                var foundMatch = suggestion.value.toLowerCase().indexOf(value) === 0;
889                if (foundMatch) {
890                    bestMatch = suggestion;
891                }
892                return !foundMatch;
893            });
894
895            that.onHint(bestMatch);
896        },
897
898        onHint: function (suggestion) {
899            var that = this,
900                onHintCallback = that.options.onHint,
901                hintValue = '';
902            
903            if (suggestion) {
904                hintValue = that.currentValue + suggestion.value.substr(that.currentValue.length);
905            }
906            if (that.hintValue !== hintValue) {
907                that.hintValue = hintValue;
908                that.hint = suggestion;
909                if ($.isFunction(onHintCallback)) {
910                    onHintCallback.call(that.element, hintValue);
911                }
912            }  
913        },
914
915        verifySuggestionsFormat: function (suggestions) {
916            // If suggestions is string array, convert them to supported format:
917            if (suggestions.length && typeof suggestions[0] === 'string') {
918                return $.map(suggestions, function (value) {
919                    return { value: value, data: null };
920                });
921            }
922
923            return suggestions;
924        },
925
926        validateOrientation: function(orientation, fallback) {
927            orientation = $.trim(orientation || '').toLowerCase();
928
929            if($.inArray(orientation, ['auto', 'bottom', 'top']) === -1){
930                orientation = fallback;
931            }
932
933            return orientation;
934        },
935
936        processResponse: function (result, originalQuery, cacheKey) {
937            var that = this,
938                options = that.options;
939
940            result.suggestions = that.verifySuggestionsFormat(result.suggestions);
941
942            // Cache results if cache is not disabled:
943            if (!options.noCache) {
944                that.cachedResponse[cacheKey] = result;
945                if (options.preventBadQueries && !result.suggestions.length) {
946                    that.badQueries.push(originalQuery);
947                }
948            }
949
950            // Return if originalQuery is not matching current query:
951            if (originalQuery !== that.getQuery(that.currentValue)) {
952                return;
953            }
954
955            that.suggestions = result.suggestions;
956            that.suggest();
957        },
958
959        activate: function (index) {
960            var that = this,
961                activeItem,
962                selected = that.classes.selected,
963                container = $(that.suggestionsContainer),
964                children = container.find('.' + that.classes.suggestion);
965
966            container.find('.' + selected).removeClass(selected);
967
968            that.selectedIndex = index;
969
970            if (that.selectedIndex !== -1 && children.length > that.selectedIndex) {
971                activeItem = children.get(that.selectedIndex);
972                $(activeItem).addClass(selected);
973                return activeItem;
974            }
975
976            return null;
977        },
978
979        selectHint: function () {
980            var that = this,
981                i = $.inArray(that.hint, that.suggestions);
982
983            that.select(i);
984        },
985
986        select: function (i) {
987            var that = this;
988            that.hide();
989            that.onSelect(i);
990        },
991
992        moveUp: function () {
993            var that = this;
994
995            if (that.selectedIndex === -1) {
996                return;
997            }
998
999            if (that.selectedIndex === 0) {
1000                $(that.suggestionsContainer).children('.' + that.classes.suggestion).first().removeClass(that.classes.selected);
1001                that.selectedIndex = -1;
1002                that.ignoreValueChange = false;
1003                that.el.val(that.currentValue);
1004                that.findBestHint();
1005                return;
1006            }
1007
1008            that.adjustScroll(that.selectedIndex - 1);
1009        },
1010
1011        moveDown: function () {
1012            var that = this;
1013
1014            if (that.selectedIndex === (that.suggestions.length - 1)) {
1015                return;
1016            }
1017
1018            that.adjustScroll(that.selectedIndex + 1);
1019        },
1020
1021        adjustScroll: function (index) {
1022            var that = this,
1023                activeItem = that.activate(index);
1024
1025            if (!activeItem) {
1026                return;
1027            }
1028
1029            var offsetTop,
1030                upperBound,
1031                lowerBound,
1032                heightDelta = $(activeItem).outerHeight();
1033
1034            offsetTop = activeItem.offsetTop;
1035            upperBound = $(that.suggestionsContainer).scrollTop();
1036            lowerBound = upperBound + that.options.maxHeight - heightDelta;
1037
1038            if (offsetTop < upperBound) {
1039                $(that.suggestionsContainer).scrollTop(offsetTop);
1040            } else if (offsetTop > lowerBound) {
1041                $(that.suggestionsContainer).scrollTop(offsetTop - that.options.maxHeight + heightDelta);
1042            }
1043
1044            if (!that.options.preserveInput) {
1045                // During onBlur event, browser will trigger "change" event,
1046                // because value has changed, to avoid side effect ignore,
1047                // that event, so that correct suggestion can be selected
1048                // when clicking on suggestion with a mouse
1049                that.ignoreValueChange = true;
1050                that.el.val(that.getValue(that.suggestions[index].value));
1051            }
1052
1053            that.onHint(null);
1054        },
1055
1056        onSelect: function (index) {
1057            var that = this,
1058                onSelectCallback = that.options.onSelect,
1059                suggestion = that.suggestions[index];
1060
1061            that.currentValue = that.getValue(suggestion.value);
1062
1063            if (that.currentValue !== that.el.val() && !that.options.preserveInput) {
1064                that.el.val(that.currentValue);
1065            }
1066
1067            that.onHint(null);
1068            that.suggestions = [];
1069            that.selection = suggestion;
1070
1071            if ($.isFunction(onSelectCallback)) {
1072                onSelectCallback.call(that.element, suggestion);
1073            }
1074        },
1075
1076        getValue: function (value) {
1077            var that = this,
1078                delimiter = that.options.delimiter,
1079                currentValue,
1080                parts;
1081
1082            if (!delimiter) {
1083                return value;
1084            }
1085
1086            currentValue = that.currentValue;
1087            parts = currentValue.split(delimiter);
1088
1089            if (parts.length === 1) {
1090                return value;
1091            }
1092
1093            return currentValue.substr(0, currentValue.length - parts[parts.length - 1].length) + value;
1094        },
1095
1096        dispose: function () {
1097            var that = this;
1098            that.el.off('.autocomplete').removeData('autocomplete');
1099            $(window).off('resize.autocomplete', that.fixPositionCapture);
1100            $(that.suggestionsContainer).remove();
1101        }
1102    };
1103
1104    // Create chainable jQuery plugin:
1105    $.fn.devbridgeAutocomplete = function (options, args) {
1106        var dataKey = 'autocomplete';
1107        // If function invoked without argument return
1108        // instance of the first matched element:
1109        if (!arguments.length) {
1110            return this.first().data(dataKey);
1111        }
1112
1113        return this.each(function () {
1114            var inputElement = $(this),
1115                instance = inputElement.data(dataKey);
1116
1117            if (typeof options === 'string') {
1118                if (instance && typeof instance[options] === 'function') {
1119                    instance[options](args);
1120                }
1121            } else {
1122                // If instance already exists, destroy it:
1123                if (instance && instance.dispose) {
1124                    instance.dispose();
1125                }
1126                instance = new Autocomplete(this, options);
1127                inputElement.data(dataKey, instance);
1128            }
1129        });
1130    };
1131
1132    // Don't overwrite if it already exists
1133    if (!$.fn.autocomplete) {
1134        $.fn.autocomplete = $.fn.devbridgeAutocomplete;
1135    }
1136}));
1137
1138(function(j,f){var c=j(window);function n(){return new Date(Date.UTC.apply(Date,arguments));}function g(){var q=new Date();return n(q.getFullYear(),q.getMonth(),q.getDate());
1139}function l(q){return function(){return this[q].apply(this,arguments);};}var e=(function(){var q={get:function(r){return this.slice(r)[0];},contains:function(u){var t=u&&u.valueOf();
1140for(var s=0,r=this.length;s<r;s++){if(this[s].valueOf()===t){return s;}}return -1;},remove:function(r){this.splice(r,1);},replace:function(r){if(!r){return;
1141}if(!j.isArray(r)){r=[r];}this.clear();this.push.apply(this,r);},clear:function(){this.splice(0);},copy:function(){var r=new e();r.replace(this);return r;
1142}};return function(){var r=[];r.push.apply(r,arguments);j.extend(r,q);return r;};})();var k=function(r,q){this.dates=new e();this.viewDate=g();this.focusDate=null;
1143this._process_options(q);this.element=j(r);this.isInline=false;this.isInput=this.element.is("input");this.component=this.element.is(".date")?this.element.find(".add-on, .input-group-addon, .btn"):false;
1144this.hasInput=this.component&&this.element.find("input").length;if(this.component&&this.component.length===0){this.component=false;}this.picker=j(m.template);
1145this._buildEvents();this._attachEvents();if(this.isInline){this.picker.addClass("datepicker-inline").appendTo(this.element);}else{this.picker.addClass("datepicker-dropdown dropdown-menu");
1146}if(this.o.rtl){this.picker.addClass("datepicker-rtl");}this.viewMode=this.o.startView;if(this.o.calendarWeeks){this.picker.find("tfoot th.today").attr("colspan",function(s,t){return parseInt(t)+1;
1147});}this._allow_update=false;this.setStartDate(this._o.startDate);this.setEndDate(this._o.endDate);this.setDaysOfWeekDisabled(this.o.daysOfWeekDisabled);
1148this.fillDow();this.fillMonths();this._allow_update=true;this.update();this.showMode();if(this.isInline){this.show();}};k.prototype={constructor:k,_process_options:function(q){this._o=j.extend({},this._o,q);
1149var u=this.o=j.extend({},this._o);var t=u.language;if(!b[t]){t=t.split("-")[0];if(!b[t]){t=h.language;}}u.language=t;switch(u.startView){case 2:case"decade":u.startView=2;
1150break;case 1:case"year":u.startView=1;break;default:u.startView=0;}switch(u.minViewMode){case 1:case"months":u.minViewMode=1;break;case 2:case"years":u.minViewMode=2;
1151break;default:u.minViewMode=0;}u.startView=Math.max(u.startView,u.minViewMode);
1151if(u.multidate!==true){u.multidate=Number(u.multidate)||false;if(u.multidate!==false){u.multidate=Math.max(0,u.multidate);
1152}else{u.multidate=1;}}u.multidateSeparator=String(u.multidateSeparator);u.weekStart%=7;u.weekEnd=((u.weekStart+6)%7);var r=m.parseFormat(u.format);if(u.startDate!==-Infinity){if(!!u.startDate){if(u.startDate instanceof Date){u.startDate=this._local_to_utc(this._zero_time(u.startDate));
1153}else{u.startDate=m.parseDate(u.startDate,r,u.language);}}else{u.startDate=-Infinity;}}if(u.endDate!==Infinity){if(!!u.endDate){if(u.endDate instanceof Date){u.endDate=this._local_to_utc(this._zero_time(u.endDate));
1154}else{u.endDate=m.parseDate(u.endDate,r,u.language);}}else{u.endDate=Infinity;}}u.daysOfWeekDisabled=u.daysOfWeekDisabled||[];if(!j.isArray(u.daysOfWeekDisabled)){u.daysOfWeekDisabled=u.daysOfWeekDisabled.split(/[,\s]*/);
1155}u.daysOfWeekDisabled=j.map(u.daysOfWeekDisabled,function(w){return parseInt(w,10);});var s=String(u.orientation).toLowerCase().split(/\s+/g),v=u.orientation.toLowerCase();
1156s=j.grep(s,function(w){return(/^auto|left|right|top|bottom$/).test(w);});u.orientation={x:"auto",y:"auto"};if(!v||v==="auto"){}else{if(s.length===1){switch(s[0]){case"top":case"bottom":u.orientation.y=s[0];
1157break;case"left":case"right":u.orientation.x=s[0];break;}}else{v=j.grep(s,function(w){return(/^left|right$/).test(w);});u.orientation.x=v[0]||"auto";v=j.grep(s,function(w){return(/^top|bottom$/).test(w);
1158});u.orientation.y=v[0]||"auto";}}},_events:[],_secondaryEvents:[],_applyEvents:function(q){for(var r=0,t,s,u;r<q.length;r++){t=q[r][0];if(q[r].length===2){s=f;
1159u=q[r][1];}else{if(q[r].length===3){s=q[r][1];u=q[r][2];}}t.on(u,s);}},_unapplyEvents:function(q){for(var r=0,t,u,s;r<q.length;r++){t=q[r][0];if(q[r].length===2){s=f;
1160u=q[r][1];}else{if(q[r].length===3){s=q[r][1];u=q[r][2];}}t.off(u,s);}},_buildEvents:function(){if(this.isInput){this._events=[[this.element,{focus:j.proxy(this.show,this),keyup:j.proxy(function(q){if(j.inArray(q.keyCode,[27,37,39,38,40,32,13,9])===-1){this.update();
1161}},this),keydown:j.proxy(this.keydown,this)}]];}else{if(this.component&&this.hasInput){this._events=[[this.element.find("input"),{focus:j.proxy(this.show,this),keyup:j.proxy(function(q){if(j.inArray(q.keyCode,[27,37,39,38,40,32,13,9])===-1){this.update();
1162}},this),keydown:j.proxy(this.keydown,this)}],[this.component,{click:j.proxy(this.show,this)}]];}else{if(this.element.is("div")){this.isInline=true;}else{this._events=[[this.element,{click:j.proxy(this.show,this)}]];
1163}}}this._events.push([this.element,"*",{blur:j.proxy(function(q){this._focused_from=q.target;},this)}],[this.element,{blur:j.proxy(function(q){this._focused_from=q.target;
1164},this)}]);this._secondaryEvents=[[this.picker,{click:j.proxy(this.click,this)}],[j(window),{resize:j.proxy(this.place,this)}],[j(document),{"mousedown touchstart":j.proxy(function(q){if(!(this.element.is(q.target)||this.element.find(q.target).length||this.picker.is(q.target)||this.picker.find(q.target).length)){this.hide();
1165}},this)}]];},_attachEvents:function(){this._detachEvents();this._applyEvents(this._events);},_detachEvents:function(){this._unapplyEvents(this._events);
1166},_attachSecondaryEvents:function(){this._detachSecondaryEvents();this._applyEvents(this._secondaryEvents);},_detachSecondaryEvents:function(){this._unapplyEvents(this._secondaryEvents);
1167},_trigger:function(s,t){var r=t||this.dates.get(-1),q=this._utc_to_local(r);this.element.trigger({type:s,date:q,dates:j.map(this.dates,this._utc_to_local),format:j.proxy(function(u,w){if(arguments.length===0){u=this.dates.length-1;
1168w=this.o.format;}else{if(typeof u==="string"){w=u;u=this.dates.length-1;}}w=w||this.o.format;var v=this.dates.get(u);return m.formatDate(v,w,this.o.language);
1169},this)});},show:function(){if(!this.isInline){this.picker.appendTo("body");}this.picker.show();this.place();this._attachSecondaryEvents();this._trigger("show");
1170},hide:function(){if(this.isInline){return;}if(!this.picker.is(":visible")){return;}this.focusDate=null;this.picker.hide().detach();this._detachSecondaryEvents();
1171this.viewMode=this.o.startView;this.showMode();if(this.o.forceParse&&(this.isInput&&this.element.val()||this.hasInput&&this.element.find("input").val())){this.setValue();
1172}this._trigger("hide");},remove:function(){this.hide();this._detachEvents();this._detachSecondaryEvents();this.picker.remove();delete this.element.data().datepicker;
1173if(!this.isInput){delete this.element.data().date;}},_utc_to_local:function(q){return q&&new Date(q.getTime()+(q.getTimezoneOffset()*60000));},_local_to_utc:function(q){return q&&new Date(q.getTime()-(q.getTimezoneOffset()*60000));
1174},_zero_time:function(q){return q&&new Date(q.getFullYear(),q.getMonth(),q.getDate());},_zero_utc_time:function(q){return q&&new Date(Date.UTC(q.getUTCFullYear(),q.getUTCMonth(),q.getUTCDate()));
1175},getDates:function(){return j.map(this.dates,this._utc_to_local);},getUTCDates:function(){return j.map(this.dates,function(q){return new Date(q);});},getDate:function(){return this._utc_to_local(this.getUTCDate());
1176},getUTCDate:function(){return new Date(this.dates.get(-1));},setDates:function(){var q=j.isArray(arguments[0])?arguments[0]:arguments;this.update.apply(this,q);
1177this._trigger("changeDate");this.setValue();},setUTCDates:function(){var q=j.isArray(arguments[0])?arguments[0]:arguments;this.update.apply(this,j.map(q,this._utc_to_local));
1178this._trigger("changeDate");this.setValue();},setDate:l("setDates"),setUTCDate:l("setUTCDates"),setValue:function(){var q=this.getFormattedDate();if(!this.isInput){if(this.component){this.element.find("input").val(q).change();
1179}}else{this.element.val(q).change();}},getFormattedDate:function(q){if(q===f){q=this.o.format;}var r=this.o.language;return j.map(this.dates,function(s){return m.formatDate(s,q,r);
1180}).join(this.o.multidateSeparator);},setStartDate:function(q){this._process_options({startDate:q});this.update();this.updateNavArrows();},setEndDate:function(q){this._process_options({endDate:q});
1181this.update();this.updateNavArrows();},setDaysOfWeekDisabled:function(q){this._process_options({daysOfWeekDisabled:q});this.update();this.updateNavArrows();
1182},place:function(){if(this.isInline){return;}var E=this.picker.outerWidth(),A=this.picker.outerHeight(),u=10,w=c.width(),r=c.height(),v=c.scrollTop();
1182var C=parseInt(this.element.parents().filter(function(){return j(this).css("z-index")!=="auto";
1183}).first().css("z-index"))+10;var z=this.component?this.component.parent().offset():this.element.offset();var D=this.component?this.component.outerHeight(true):this.element.outerHeight(false);
1184var t=this.component?this.component.outerWidth(true):this.element.outerWidth(false);var y=z.left,B=z.top;this.picker.removeClass("datepicker-orient-top datepicker-orient-bottom datepicker-orient-right datepicker-orient-left");
1185if(this.o.orientation.x!=="auto"){this.picker.addClass("datepicker-orient-"+this.o.orientation.x);if(this.o.orientation.x==="right"){y-=E-t;}}else{this.picker.addClass("datepicker-orient-left");
1186if(z.left<0){y-=z.left-u;}else{if(z.left+E>w){y=w-E-u;}}}var q=this.o.orientation.y,s,x;if(q==="auto"){s=-v+z.top-A;x=v+r-(z.top+D+A);if(Math.max(s,x)===x){q="top";
1187}else{q="bottom";}}this.picker.addClass("datepicker-orient-"+q);if(q==="top"){B+=D;}else{B-=A+parseInt(this.picker.css("padding-top"));}this.picker.css({top:B,left:y,zIndex:C});
1188},_allow_update:true,update:function(){if(!this._allow_update){return;}var r=this.dates.copy(),s=[],q=false;if(arguments.length){j.each(arguments,j.proxy(function(u,t){if(t instanceof Date){t=this._local_to_utc(t);
1189}s.push(t);},this));q=true;}else{s=this.isInput?this.element.val():this.element.data("date")||this.element.find("input").val();if(s&&this.o.multidate){s=s.split(this.o.multidateSeparator);
1190}else{s=[s];}delete this.element.data().date;}s=j.map(s,j.proxy(function(t){return m.parseDate(t,this.o.format,this.o.language);},this));s=j.grep(s,j.proxy(function(t){return(t<this.o.startDate||t>this.o.endDate||!t);
1191},this),true);this.dates.replace(s);if(this.dates.length){this.viewDate=new Date(this.dates.get(-1));}else{if(this.viewDate<this.o.startDate){this.viewDate=new Date(this.o.startDate);
1192}else{if(this.viewDate>this.o.endDate){this.viewDate=new Date(this.o.endDate);}}}if(q){this.setValue();}else{if(s.length){if(String(r)!==String(this.dates)){this._trigger("changeDate");
1193}}}if(!this.dates.length&&r.length){this._trigger("clearDate");}this.fill();},fillDow:function(){var r=this.o.weekStart,s="<tr>";if(this.o.calendarWeeks){var q='<th class="cw">&nbsp;</th>';
1194s+=q;this.picker.find(".datepicker-days thead tr:first-child").prepend(q);}while(r<this.o.weekStart+7){s+='<th class="dow">'+b[this.o.language].daysMin[(r++)%7]+"</th>";
1195}s+="</tr>";this.picker.find(".datepicker-days thead").append(s);},fillMonths:function(){var r="",q=0;while(q<12){r+='<span class="month">'+b[this.o.language].monthsShort[q++]+"</span>";
1196}this.picker.find(".datepicker-months td").html(r);},setRange:function(q){if(!q||!q.length){delete this.range;}else{this.range=j.map(q,function(r){return r.valueOf();
1197});}this.fill();},getClassNames:function(s){var q=[],t=this.viewDate.getUTCFullYear(),u=this.viewDate.getUTCMonth(),r=new Date();if(s.getUTCFullYear()<t||(s.getUTCFullYear()===t&&s.getUTCMonth()<u)){q.push("old");
1198}else{if(s.getUTCFullYear()>t||(s.getUTCFullYear()===t&&s.getUTCMonth()>u)){q.push("new");}}if(this.focusDate&&s.valueOf()===this.focusDate.valueOf()){q.push("focused");
1199}if(this.o.todayHighlight&&s.getUTCFullYear()===r.getFullYear()&&s.getUTCMonth()===r.getMonth()&&s.getUTCDate()===r.getDate()){q.push("today");}if(this.dates.contains(s)!==-1){q.push("active");
1200}if(s.valueOf()<this.o.startDate||s.valueOf()>this.o.endDate||j.inArray(s.getUTCDay(),this.o.daysOfWeekDisabled)!==-1){q.push("disabled");}if(this.range){if(s>this.range[0]&&s<this.range[this.range.length-1]){q.push("range");
1201}if(j.inArray(s.valueOf(),this.range)!==-1){q.push("selected");}}return q;},fill:function(){var L=new Date(this.viewDate),A=L.getUTCFullYear(),M=L.getUTCMonth(),F=this.o.startDate!==-Infinity?this.o.startDate.getUTCFullYear():-Infinity,J=this.o.startDate!==-Infinity?this.o.startDate.getUTCMonth():-Infinity,x=this.o.endDate!==Infinity?this.o.endDate.getUTCFullYear():Infinity,G=this.o.endDate!==Infinity?this.o.endDate.getUTCMonth():Infinity,y=b[this.o.language].today||b.en.today||"",s=b[this.o.language].clear||b.en.clear||"",u;
1202this.picker.find(".datepicker-days thead th.datepicker-switch").text(b[this.o.language].months[M]+" "+A);this.picker.find("tfoot th.today").text(y).toggle(this.o.todayBtn!==false);
1203this.picker.find("tfoot th.clear").text(s).toggle(this.o.clearBtn!==false);this.updateNavArrows();this.fillMonths();var O=n(A,M-1,28),I=m.getDaysInMonth(O.getUTCFullYear(),O.getUTCMonth());
1204O.setUTCDate(I);O.setUTCDate(I-(O.getUTCDay()-this.o.weekStart+7)%7);var q=new Date(O);q.setUTCDate(q.getUTCDate()+42);q=q.valueOf();var z=[];var D;while(O.valueOf()<q){if(O.getUTCDay()===this.o.weekStart){z.push("<tr>");
1205if(this.o.calendarWeeks){var r=new Date(+O+(this.o.weekStart-O.getUTCDay()-7)%7*86400000),v=new Date(Number(r)+(7+4-r.getUTCDay())%7*86400000),t=new Date(Number(t=n(v.getUTCFullYear(),0,1))+(7+4-t.getUTCDay())%7*86400000),B=(v-t)/86400000/7+1;
1206z.push('<td class="cw">'+B+"</td>");}}D=this.getClassNames(O);D.push("day");if(this.o.beforeShowDay!==j.noop){var C=this.o.beforeShowDay(this._utc_to_local(O));
1207if(C===f){C={};}else{if(typeof(C)==="boolean"){C={enabled:C};}
1207else{if(typeof(C)==="string"){C={classes:C};}}}if(C.enabled===false){D.push("disabled");}if(C.classes){D=D.concat(C.classes.split(/\s+/));
1208}if(C.tooltip){u=C.tooltip;}}D=j.unique(D);z.push('<td class="'+D.join(" ")+'"'+(u?' title="'+u+'"':"")+">"+O.getUTCDate()+"</td>");if(O.getUTCDay()===this.o.weekEnd){z.push("</tr>");
1209}O.setUTCDate(O.getUTCDate()+1);}this.picker.find(".datepicker-days tbody").empty().append(z.join(""));var w=this.picker.find(".datepicker-months").find("th:eq(1)").text(A).end().find("span").removeClass("active");
1210j.each(this.dates,function(P,Q){if(Q.getUTCFullYear()===A){w.eq(Q.getUTCMonth()).addClass("active");}});if(A<F||A>x){w.addClass("disabled");}if(A===F){w.slice(0,J).addClass("disabled");
1211}if(A===x){w.slice(G+1).addClass("disabled");}z="";A=parseInt(A/10,10)*10;var N=this.picker.find(".datepicker-years").find("th:eq(1)").text(A+"-"+(A+9)).end().find("td");
1212A-=1;var E=j.map(this.dates,function(P){return P.getUTCFullYear();}),K;for(var H=-1;H<11;H++){K=["year"];if(H===-1){K.push("old");}else{if(H===10){K.push("new");
1213}}if(j.inArray(A,E)!==-1){K.push("active");}if(A<F||A>x){K.push("disabled");}z+='<span class="'+K.join(" ")+'">'+A+"</span>";A+=1;}N.html(z);},updateNavArrows:function(){if(!this._allow_update){return;
1214}var s=new Date(this.viewDate),q=s.getUTCFullYear(),r=s.getUTCMonth();switch(this.viewMode){case 0:if(this.o.startDate!==-Infinity&&q<=this.o.startDate.getUTCFullYear()&&r<=this.o.startDate.getUTCMonth()){this.picker.find(".prev").css({visibility:"hidden"});
1215}else{this.picker.find(".prev").css({visibility:"visible"});}if(this.o.endDate!==Infinity&&q>=this.o.endDate.getUTCFullYear()&&r>=this.o.endDate.getUTCMonth()){this.picker.find(".next").css({visibility:"hidden"});
1216}else{this.picker.find(".next").css({visibility:"visible"});}break;case 1:case 2:if(this.o.startDate!==-Infinity&&q<=this.o.startDate.getUTCFullYear()){this.picker.find(".prev").css({visibility:"hidden"});
1217}else{this.picker.find(".prev").css({visibility:"visible"});}if(this.o.endDate!==Infinity&&q>=this.o.endDate.getUTCFullYear()){this.picker.find(".next").css({visibility:"hidden"});
1218}else{this.picker.find(".next").css({visibility:"visible"});}break;}},click:function(u){u.preventDefault();var v=j(u.target).closest("span, td, th"),x,w,y;
1219if(v.length===1){switch(v[0].nodeName.toLowerCase()){case"th":switch(v[0].className){case"datepicker-switch":this.showMode(1);break;case"prev":case"next":var q=m.modes[this.viewMode].navStep*(v[0].className==="prev"?-1:1);
1220switch(this.viewMode){case 0:this.viewDate=this.moveMonth(this.viewDate,q);this._trigger("changeMonth",this.viewDate);break;case 1:case 2:this.viewDate=this.moveYear(this.viewDate,q);
1221if(this.viewMode===1){this._trigger("changeYear",this.viewDate);}break;}this.fill();break;case"today":var r=new Date();r=n(r.getFullYear(),r.getMonth(),r.getDate(),0,0,0);
1222this.showMode(-2);var s=this.o.todayBtn==="linked"?null:"view";this._setDate(r,s);break;case"clear":var t;if(this.isInput){t=this.element;}else{if(this.component){t=this.element.find("input");
1223}}if(t){t.val("").change();}this.update();this._trigger("changeDate");if(this.o.autoclose){this.hide();}break;}break;case"span":if(!v.is(".disabled")){this.viewDate.setUTCDate(1);
1224if(v.is(".month")){y=1;w=v.parent().find("span").index(v);x=this.viewDate.getUTCFullYear();this.viewDate.setUTCMonth(w);this._trigger("changeMonth",this.viewDate);
1225if(this.o.minViewMode===1){this._setDate(n(x,w,y));}}else{y=1;w=0;x=parseInt(v.text(),10)||0;this.viewDate.setUTCFullYear(x);this._trigger("changeYear",this.viewDate);
1226if(this.o.minViewMode===2){this._setDate(n(x,w,y));}}this.showMode(-1);this.fill();}break;case"td":if(v.is(".day")&&!v.is(".disabled")){y=parseInt(v.text(),10)||1;
1227x=this.viewDate.getUTCFullYear();w=this.viewDate.getUTCMonth();if(v.is(".old")){if(w===0){w=11;x-=1;}else{w-=1;}}else{if(v.is(".new")){if(w===11){w=0;x+=1;
1228}else{w+=1;}}}this._setDate(n(x,w,y));}break;}}if(this.picker.is(":visible")&&this._focused_from){j(this._focused_from).focus();}delete this._focused_from;
1229},_toggle_multidate:function(r){var q=this.dates.contains(r);if(!r){this.dates.clear();}else{if(q!==-1){this.dates.remove(q);}else{this.dates.push(r);}}if(typeof this.o.multidate==="number"){while(this.dates.length>this.o.multidate){this.dates.remove(0);
1230}}},_setDate:function(q,s){if(!s||s==="date"){this._toggle_multidate(q&&new Date(q));}if(!s||s==="view"){this.viewDate=q&&new Date(q);}this.fill();this.setValue();
1231this._trigger("changeDate");var r;if(this.isInput){r=this.element;}else{if(this.component){r=this.element.find("input");}}if(r){r.change();}if(this.o.autoclose&&(!s||s==="date")){this.hide();
1232}},moveMonth:function(q,r){if(!q){return f;}if(!r){return q;}var u=new Date(q.valueOf()),y=u.getUTCDate(),v=u.getUTCMonth(),t=Math.abs(r),x,w;r=r>0?1:-1;
1233if(t===1){w=r===-1?function(){return u.getUTCMonth()===v;}:function(){return u.getUTCMonth()!==x;};x=v+r;u.setUTCMonth(x);if(x<0||x>11){x=(x+12)%12;}}else{for(var s=0;
1234s<t;s++){u=this.moveMonth(u,r);}x=u.getUTCMonth();u.setUTCDate(y);w=function(){return x!==u.getUTCMonth();};}while(w()){u.setUTCDate(--y);u.setUTCMonth(x);
1235}return u;},moveYear:function(r,q){return this.moveMonth(r,q*12);},dateWithinRange:function(q){return q>=this.o.startDate&&q<=this.o.endDate;},keydown:function(w){if(this.picker.is(":not(:visible)")){if(w.keyCode===27){this.show();
1236}return;}var s=false,r,q,u,v=this.focusDate||this.viewDate;switch(w.keyCode){case 27:if(this.focusDate){this.focusDate=null;this.viewDate=this.dates.get(-1)||this.viewDate;
1237this.fill();}else{this.hide();}w.preventDefault();break;case 37:case 39:if(!this.o.keyboardNavigation){break;}r=w.keyCode===37?-1:1;if(w.ctrlKey){q=this.moveYear(this.dates.get(-1)||g(),r);
1238u=this.moveYear(v,r);this._trigger("changeYear",this.viewDate);}else{if(w.shiftKey){q=this.moveMonth(this.dates.get(-1)||g(),r);u=this.moveMonth(v,r);this._trigger("changeMonth",this.viewDate);
1239}else{q=new Date(this.dates.get(-1)||g());q.setUTCDate(q.getUTCDate()+r);u=new Date(v);u.setUTCDate(v.getUTCDate()+r);}}if(this.dateWithinRange(q)){this.focusDate=this.viewDate=u;
1240this.setValue();this.fill();w.preventDefault();}break;case 38:case 40:if(!this.o.keyboardNavigation){break;}r=w.keyCode===38?-1:1;if(w.ctrlKey){q=this.moveYear(this.dates.get(-1)||g(),r);
1241u=this.moveYear(v,r);this._trigger("changeYear",this.viewDate);}else{if(w.shiftKey){q=this.moveMonth(this.dates.get(-1)||g(),r);u=this.moveMonth(v,r);this._trigger("changeMonth",this.viewDate);
1242}else{q=new Date(this.dates.get(-1)||g());q.setUTCDate(q.getUTCDate()+r*7);u=new Date(v);u.setUTCDate(v.getUTCDate()+r*7);}}if(this.dateWithinRange(q)){this.focusDate=this.viewDate=u;
1243this.setValue();this.fill();w.preventDefault();}break;case 32:break;case 13:v=this.focusDate||this.dates.get(-1)||this.viewDate;this._toggle_multidate(v);
1244s=true;this.focusDate=null;this.viewDate=this.dates.get(-1)||this.viewDate;this.setValue();this.fill();if(this.picker.is(":visible")){w.preventDefault();
1245if(this.o.autoclose){this.hide();}}break;case 9:this.focusDate=null;this.viewDate=this.dates.get(-1)||this.viewDate;this.fill();this.hide();break;}if(s){if(this.dates.length){this._trigger("changeDate");
1246}else{this._trigger("clearDate");}var t;if(this.isInput){t=this.element;}else{if(this.component){t=this.element.find("input");}}if(t){t.change();}}},showMode:function(q){if(q){this.viewMode=Math.max(this.o.minViewMode,Math.min(2,this.viewMode+q));
1247}this.picker.find(">div").hide().filter(".datepicker-"+m.modes[this.viewMode].clsName).css("display","block");this.updateNavArrows();}};var p=function(r,q){this.element=j(r);
1248this.inputs=j.map(q.inputs,function(s){return s.jquery?s[0]:s;});delete q.inputs;j(this.inputs).datepicker(q).bind("changeDate",j.proxy(this.dateUpdated,this));
1249this.pickers=j.map(this.inputs,function(s){return j(s).data("datepicker");});this.updateDates();};p.prototype={updateDates:function(){this.dates=j.map(this.pickers,function(q){return q.getUTCDate();
1250});this.updateRanges();},updateRanges:function(){var q=j.map(this.dates,function(r){return r.valueOf();});j.each(this.pickers,function(r,s){s.setRange(q);
1251});},dateUpdated:function(t){if(this.updating){return;}this.updating=true;var u=j(t.target).data("datepicker"),s=u.getUTCDate(),r=j.inArray(t.target,this.inputs),q=this.inputs.length;
1252if(r===-1){return;}j.each(this.pickers,function(v,w){if(!w.getUTCDate()){w.setUTCDate(s);}});if(s<this.dates[r]){while(r>=0&&s<this.dates[r]){this.pickers[r--].setUTCDate(s);
1253}}else{if(s>this.dates[r]){while(r<q&&s>this.dates[r]){this.pickers[r++].setUTCDate(s);}}}this.updateDates();delete this.updating;},remove:function(){j.map(this.pickers,function(q){q.remove();
1254});delete this.element.data().datepicker;}};function i(t,w){var v=j(t).data(),q={},u,s=new RegExp("^"+w.toLowerCase()+"([A-Z])");w=new RegExp("^"+w.toLowerCase());
1255function x(z,y){return y.toLowerCase();}for(var r in v){if(w.test(r)){u=r.replace(s,x);q[u]=v[r];}}return q;}function a(s){var q={};if(!b[s]){s=s.split("-")[0];
1256if(!b[s]){return;}}var r=b[s];j.each(o,function(u,t){if(t in r){q[t]=r[t];}});return q;}var d=j.fn.datepicker;j.fn.datepicker=function(s){var q=Array.apply(null,arguments);
1257q.shift();var r;this.each(function(){var A=j(this),y=A.data("datepicker"),u=typeof s==="object"&&s;if(!y){var w=i(this,"date"),t=j.extend({},h,w,u),v=a(t.language),x=j.extend({},h,v,w,u);
1258if(A.is(".input-daterange")||x.inputs){var z={inputs:x.inputs||A.find("input").toArray()};A.data("datepicker",(y=new p(this,j.extend(x,z))));}else{A.data("datepicker",(y=new k(this,x)));
1259}}if(typeof s==="string"&&typeof y[s]==="function"){r=y[s].apply(y,q);if(r!==f){return false;}}});if(r!==f){return r;}else{return this;}};var h=j.fn.datepicker.defaults={autoclose:false,beforeShowDay:j.noop,calendarWeeks:false,clearBtn:false,daysOfWeekDisabled:[],endDate:Infinity,forceParse:true,format:"mm/dd/yyyy",keyboardNavigation:true,language:"en",minViewMode:0,multidate:false,multidateSeparator:",",orientation:"auto",rtl:false,startDate:-Infinity,startView:0,todayBtn:false,todayHighlight:false,weekStart:0};
1260var o=j.fn.datepicker.locale_opts=["format","rtl","weekStart"];j.fn.datepicker.Constructor=k;var b=j.fn.datepicker.dates={en:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sun"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa","Su"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],today:"Today",clear:"Clear"}};
1261var m={modes:[{clsName:"days",navFnc:"Month",navStep:1},{clsName:"months",navFnc:"FullYear",navStep:1},{clsName:"years",navFnc:"FullYear",navStep:10}],isLeapYear:function(q){return(((q%4===0)&&(q%100!==0))||(q%400===0));
1262},getDaysInMonth:function(q,r){return[31,(m.isLeapYear(q)?29:28),31,30,31,30,31,31,30,31,30,31][r];},validParts:/dd?|DD?|mm?|MM?|yy(?:yy)?/g,nonpunctuation:/[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g,parseFormat:function(s){var q=s.replace(this.validParts,"\0").split("\0"),r=s.match(this.validParts);
1263if(!q||!q.length||!r||r.length===0){throw new Error("Invalid date format.");}return{separators:q,parts:r};},parseDate:function(H,E,B){if(!H){return f;}if(H instanceof Date){return H;
1264}if(typeof E==="string"){E=m.parseFormat(E);}var t=/([\-+]\d+)([dmwy])/,z=H.match(/([\-+]\d+)([dmwy])/g),A,y,D;if(/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(H)){H=new Date();
1265for(D=0;D<z.length;D++){A=t.exec(z[D]);y=parseInt(A[1]);switch(A[2]){case"d":H.setUTCDate(H.getUTCDate()+y);break;case"m":H=k.prototype.moveMonth.call(k.prototype,H,y);
1266break;case"w":H.setUTCDate(H.getUTCDate()+y*7);break;case"y":H=k.prototype.moveYear.call(k.prototype,H,y);break;}}return n(H.getUTCFullYear(),H.getUTCMonth(),H.getUTCDate(),0,0,0);
1267}z=H&&H.match(this.nonpunctuation)||[];H=new Date();var u={},F=["yyyy","yy","M","MM","m","mm","d","dd"],x={yyyy:function(J,s){return J.setUTCFullYear(s);
1268},yy:function(J,s){return J.setUTCFullYear(2000+s);},m:function(J,s){if(isNaN(J)){return J;}s-=1;while(s<0){s+=12;}s%=12;J.setUTCMonth(s);while(J.getUTCMonth()!==s){J.setUTCDate(J.getUTCDate()-1);
1269}return J;},d:function(J,s){return J.setUTCDate(s);}},I,r;x.M=x.MM=x.mm=x.m;x.dd=x.d;H=n(H.getFullYear(),H.getMonth(),H.getDate(),0,0,0);var q=E.parts.slice();
1270if(z.length!==q.length){q=j(q).filter(function(s,J){return j.inArray(J,F)!==-1;}).toArray();}function G(){var s=this.slice(0,z[D].length),J=z[D].slice(0,s.length);
1271return s===J;}if(z.length===q.length){var C;for(D=0,C=q.length;D<C;D++){I=parseInt(z[D],10);A=q[D];if(isNaN(I)){switch(A){case"MM":r=j(b[B].months).filter(G);
1272I=j.inArray(r[0],b[B].months)+1;break;case"M":r=j(b[B].monthsShort).filter(G);I=j.inArray(r[0],b[B].monthsShort)+1;break;}}u[A]=I;}var v,w;for(D=0;D<F.length;
1273D++){w=F[D];if(w in u&&!isNaN(u[w])){v=new Date(H);x[w](v,u[w]);if(!isNaN(v)){H=v;}}}}return H;},formatDate:function(q,u,w){if(!q){return"";}if(typeof u==="string"){u=m.parseFormat(u);
1274}var v={d:q.getUTCDate(),D:b[w].daysShort[q.getUTCDay()],DD:b[w].days[q.getUTCDay()],m:q.getUTCMonth()+1,M:b[w].monthsShort[q.getUTCMonth()],MM:b[w].months[q.getUTCMonth()],yy:q.getUTCFullYear().toString().substring(2),yyyy:q.getUTCFullYear()};
1275v.dd=(v.d<10?"0":"")+v.d;v.mm=(v.m<10?"0":"")+v.m;q=[];var t=j.extend([],u.separators);for(var s=0,r=u.parts.length;s<=r;s++){if(t.length){q.push(t.shift());
1276}q.push(v[u.parts[s]]);}return q.join("");},headTemplate:'<thead><tr><th class="prev">&laquo;</th><th colspan="5" class="datepicker-switch"></th><th class="next">&raquo;</th></tr></thead>',contTemplate:'<tbody><tr><td colspan="7"></td></tr></tbody>',footTemplate:'<tfoot><tr><th colspan="7" class="today"></th></tr><tr><th colspan="7" class="clear"></th></tr></tfoot>'};
1277m.template='<div class="datepicker"><div class="datepicker-days"><table class=" table-condensed">'+m.headTemplate+"<tbody></tbody>"+m.footTemplate+'</table></div><div class="datepicker-months"><table class="table-condensed">'+m.headTemplate+m.contTemplate+m.footTemplate+'</table></div><div class="datepicker-years"><table class="table-condensed">'+m.headTemplate+m.contTemplate+m.footTemplate+"</table></div></div>";
1278j.fn.datepicker.DPGlobal=m;j.fn.datepicker.noConflict=function(){j.fn.datepicker=d;return this;};j(document).on("focus.datepicker.data-api click.datepicker.data-api",'[data-provide="datepicker"]',function(r){var q=j(this);
1279if(q.data("datepicker")){return;}r.preventDefault();q.datepicker("show");});j(function(){j('[data-provide="datepicker-inline"]').datepicker();});}(window.jQuery));
1280
1281(function(a){a.fn.datepicker.dates.ru={days:["Воскресенье","Понедельник","Вторник","Среда","Четверг","Пятница","Суббота","Воскресенье"],daysShort:["Вск","Пнд","Втр","Срд","Чтв","Птн","Суб","Вск"],daysMin:["Вс","Пн","Вт","Ср","Чт","Пт","Сб","Вс"],months:["Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"],monthsShort:["Янв","Фев","Мар","Апр","Май","Июн","Июл","Авг","Сен","Окт","Ноя","Дек"],today:"Сегодня",clear:"Убрать дату",weekStart:1};
1282a.fn.datepicker.defaults.format="dd.mm.yyyy";a.fn.datepicker.defaults.language="ru";a.fn.datepicker.defaults.autoclose=true;a.fn.datepicker.defaults.todayHighlight = true;}(jQuery));
1283document.addEventListener('DOMContentLoaded', function(e)
1284{
1285    let isMobile = {
1286    Android: function () {
1287      return navigator.userAgent.match(/Android/i);
1288    },
1289    BlackBerry: function () {
1290      return navigator.userAgent.match(/BlackBerry/i);
1291    },
1292    iOS: function () {
1293      return navigator.userAgent.match(/iPhone|iPad|iPod/i);
1294    },
1295    Opera: function () {
1296      return navigator.userAgent.match(/Opera Mini/i);
1297    },
1298    Windows: function () {
1299      return navigator.userAgent.match(/IEMobile/i);
1300    },
1301    any: function () {
1302      return (
1303        isMobile.Android() ||
1304        isMobile.BlackBerry() ||
1305        isMobile.iOS() ||
1306        isMobile.Opera() ||
1307        isMobile.Windows()
1308      );
1309    },
1310  };
1311  /**
1312   * если устройство является тачпадом, body присваивается класс ._touch
1313   */
1314  if (isMobile.any()) {
1315    document.body.classList.add("_touch");
1316  } else {
1317    document.body.classList.remove("_touch");
1318  }
1319
1320
1321  if (typeof(blockOverflow) != 'function')
1322  {
1323    const bodyGlobal = document.querySelector("body");
1324    const scrollWidth = window.innerWidth - document.documentElement.clientWidth; // ширина скролл-бара окна
1325    /**
1326     * функции для блокировки скролла при открытии модального окна
1327     */
1328    function blockOverflow() {
1329      bodyGlobal.style.overflow = `hidden`;
1330      bodyGlobal.style.touchAction = `none`;
1331      if (!isMobile.any()) {
1332        bodyGlobal.style.paddingRight = scrollWidth + "px";
1333      }
1334    }
1335
1336    /**
1337     * функции для разблокировки скролла при закрытии модального окна
1338     */
1339    function unBlockOverflow(time = 400) {
1340      bodyGlobal.style.overflow = ``;
1341      bodyGlobal.style.touchAction = ``;
1342      bodyGlobal.style.paddingRight = ``;
1343      console.log("unBlockOverflow");
1344    }
1345
1346    function toggleOverflow() {
1347      if (window.getComputedStyle(bodyGlobal).overflow != "hidden") blockOverflow();
1348      else unBlockOverflow();
1349    }
1350
1351    window.blockOverflow = blockOverflow;
1352    window.unBlockOverflow = unBlockOverflow;
1353    window.toggleOverflow = toggleOverflow;
1354  }
1355
1356}, false);
1357/**
1358 * Реализованы следующие типы модальных окон 
1359 * class ModalDialog
1360 * class ConfirmDialog
1361 */
1362
1363document.addEventListener('DOMContentLoaded', function(e)
1364{
1365	document.body.addEventListener('keyup', function(e)
1366	{
1367		if (e.key === 'Escape')
1368		{
1369			const aCustomPopups = Array.from(document.querySelectorAll('.custom-pop-up--open'));
1370			if (aCustomPopups.length)
1371			{
1372				aCustomPopups.sort(function(a,b)
1373				{
1374					return b.style.zIndex - a.style.zIndex;
1375				});
1376
1377				aCustomPopups[0].querySelector('.custom-pop-up__close').dispatchEvent(new Event('click', {
1378					'bubbles': true,
1379					'cancelable': false
1380				}));
1381			}
1382		}
1383
1384	}, false);
1385
1386	document.body.addEventListener('open-custom-pop-up', function(e)
1387	{
1388		if (typeof(blockOverflow) === 'function') blockOverflow();
1389
1390	}, false);
1391
1392	document.body.addEventListener('close-custom-pop-up', function(e)
1393	{
1394		const nOpenedCustomPopups = document.querySelectorAll('.custom-pop-up--open');
1395		if (!nOpenedCustomPopups.length && (typeof(unBlockOverflow) === 'function')) unBlockOverflow();
1396
1397	}, false);
1398
1399}, false);
1400
1401
1402class ModalDialog
1403{
1404	options = {
1405		id: null,
1406		class: null,
1407		title: null,
1408		content: null,
1409		onOpen: function(){},
1410		onClose: function(){},
1411	};
1412
1413	dialog = null;
1414
1415	constructor(options)
1416	{
1417		if (typeof(options) === 'object')
1418		{
1419			for (var name in options)
1420			{
1421				if (options.hasOwnProperty(name) && (options[name] !== undefined))
1422				{
1423					if ( name === '__proto__' || this.options[name] === options[name] ) continue;
1424					this.options[name] = options[name];
1425				}
1426			}
1427		}
1428
1429		this.dialogEvents = this._dialogEvents.bind(this);
1430	}
1431
1432	setTitle(title, params)
1433	{
1434		const nTitle = this.dialog.querySelector('.custom-pop-up__title');
1435		if (nTitle)
1436		{
1437			while (nTitle.hasChildNodes())
1438			{
1439				nTitle.removeChild(nTitle.firstChild);
1440			}
1441
1442			if (title !== null)
1443			{
1444				var sTitle = (typeof(title) !== 'function') ? title : title(params);
1445				if (typeof(sTitle) === 'string') this.dialog.querySelector('.custom-pop-up__title').insertAdjacentHTML('afterbegin', sTitle);
1446				if ((typeof(sTitle) === 'object') && (sTitle !== null) && ('nodeType' in sTitle) && ((sTitle.nodeType === 1) || (sTitle.nodeType === 11))) this.dialog.querySelector('.custom-pop-up__title').appendChild(sTitle);
1447			}
1448		}
1449	}
1450
1451	setContent(content, params)
1452	{
1453		const nContent = this.dialog.querySelector('.custom-pop-up__inner');
1454		if (nContent)
1455		{
1456			while (nContent.hasChildNodes())
1457			{
1458				nContent.removeChild(nContent.firstChild);
1459			}
1460		}
1461
1462		if (content !== null)
1463		{
1464			var sContent = (typeof(content) !== 'function') ? content : content(params);
1465			if (sContent !== null)
1466			{
1467				if (typeof(sContent) === 'string') this.dialog.querySelector('.custom-pop-up__inner').insertAdjacentHTML('afterbegin', sContent);
1468				if ((typeof(sContent) === 'object') && ('nodeType' in sContent) && ((sContent.nodeType === 1) || (sContent.nodeType === 11))) this.dialog.querySelector('.custom-pop-up__inner').appendChild(sContent);
1469				return;
1470			}
1471		}
1472	}
1473
1474	open(params)
1475	{
1476		this.dialog = document.createElement('div');
1477		this.dialog.classList.add('custom-pop-up');
1478
1479		this.dialog.insertAdjacentHTML('afterbegin', '\
1480		<div class="custom-pop-up__body">\
1481			<div class="custom-pop-up__cover"></div>\
1482			<div class="custom-pop-up__content">\
1483				<button class="custom-pop-up__close"></button>\
1484				<div class="custom-pop-up__title"></div>\
1485				<div class="custom-pop-up__inner"></div>\
1486			</div>\
1487		</div>');
1488
1489		if (this.options.id !== null)
1490		{
1491			var sId = (typeof(this.options.id) !== 'function') ? this.options.id : this.options.id(params);
1492			if (typeof(sId) === 'string') this.dialog.setAttribute('id', sId);
1493		}
1494
1495		if (this.options.class !== null)
1496		{
1497			var sClasses = (typeof(this.options.class) !== 'function') ? this.options.class : this.options.class(params);
1498			if (typeof(sClasses) === 'string')
1499			{
1500				const nBody = this.dialog.querySelector('.custom-pop-up__body');
1501				const nContent = this.dialog.querySelector('.custom-pop-up__content');
1502				const nTitle = this.dialog.querySelector('.custom-pop-up__title'); 
1503				const nInner = this.dialog.querySelector('.custom-pop-up__inner');
1504				sClasses.split(' ').forEach(function(e,i,a)
1505				{
1506					this.dialog.classList.add(e);
1507					
1508					nBody.classList.add(e + '__body');
1509					nContent.classList.add(e + '__content');
1510					nTitle.classList.add(e + '__title');
1511					nInner.classList.add(e + '__inner');
1512
1513				}, this);
1514			}
1515		}
1516
1517		if ((typeof(params) === 'object') && (params !== null))
1518		{
1519			this.setTitle('title' in params  ? params.title : this.options.title, params);
1520			this.setContent('content' in params ? params.content : this.options.content, params);
1521		} else
1522		{
1523			this.setTitle(this.options.title, params);
1524			this.setContent(this.options.content, params);
1525		}
1526
1527		document.body.appendChild(this.dialog);
1528		this.dialog.addEventListener('click', this.dialogEvents, false);
1529
1530		var zIndex = 1000;
1531		const nOpenedCustomPopups = Array.from(document.querySelectorAll('.custom-pop-up--open'));
1532		const zIndexes = nOpenedCustomPopups.map((n) => n.style.zIndex).filter((i) => ( !!i && i != 'auto'));
1533		if (zIndexes.length) zIndex = Math.max.apply(null, zIndexes);
1534
1535		this.dialog.style.zIndex = zIndex + 1;
1536		
1537		this._onOpen(params);	
1538		
1539		this.dialog.dispatchEvent(new Event('open-custom-pop-up', {
1540			'bubbles': true,
1541			'cancelable': false
1542		}));
1543
1544		setTimeout(function()
1545		{
1546			this.dialog.classList.add('custom-pop-up--open', '_open');
1547
1548		}.bind(this), 100); // кастылечик для transition
1549	}
1550
1551	close()
1552	{
1553		this.dialog.classList.remove('custom-pop-up--open', '_open');
1554
1555		setTimeout(function()
1556		{
1557			this.dialog.dispatchEvent(new Event('close-custom-pop-up', {
1558				'bubbles': true,
1559				'cancelable': false
1560			}));		
1561
1562			this._onClose();
1563
1564			this.dialog.removeEventListener('click', this.dialogEvents, false);
1565			document.body.removeChild(this.dialog);
1566		
1567		}.bind(this), 300); // делаем задержку для transition
1568	}
1569
1570	_onOpen(params)
1571	{
1572		this.options.onOpen.call(this, params);
1573	}
1574
1575	_onClose()
1576	{
1577		this.options.onClose.call(this);
1578	}
1579
1580	_dialogEvents(e)
1581	{
1582		if (e.type === 'click')
1583		{
1584			if (e.target.classList.contains('custom-pop-up__close') || e.target.classList.contains('custom-pop-up__cover'))
1585			{
1586				e.stopPropagation();
1587				this.close();
1588				return true;
1589			}
1590		}
1591		return false;
1592	}
1593}
1594
1595class ConfirmDialog extends ModalDialog
1596{
1597	confirmBtn = null;
1598
1599	constructor(options)
1600	{
1601		if (typeof(options.class) !== 'string') options.class = 'warning-popup';
1602		if (typeof(options.onConfirm) !== 'function') options.onConfirm = function(){};
1603
1604		super(options);
1605	}
1606
1607	setContent(content, params)
1608	{
1609		const nContent = document.createElement('template');
1610		nContent.innerHTML = '\
1611		<div class="warning-popup__text"></div>\
1612		<div class="warning-popup__btns">\
1613			<button class="warning-popup__cancel-btn cancel-btn">Отмена</button>\
1614			<button class="warning-popup__ok-btn blue-btn">ОК</button>\
1615		</div>';
1616
1617		nContent.content.querySelector('.warning-popup__text').insertAdjacentHTML('afterbegin', this.options.content);
1618		nContent.content.querySelector('.warning-popup__ok-btn').textContent = this.options.confirmText ? this.options.confirmText : 'OK';
1619		super.setContent(nContent.content, params);
1620	}
1621
1622	open(params)
1623	{
1624		super.open(params);
1625		
1626		// выглядит все это какахой, но поскольку transition - фокус можно поставить не сразу
1627		setTimeout(function()
1628		{
1629			this.dialog.querySelector('.warning-popup__ok-btn').focus();
1630		
1631		}.bind(this), 200);
1632	}
1633
1634	_onOpen(params)
1635	{
1636		this.confirmBtn = this.dialog.querySelector('.warning-popup__ok-btn');
1637		super._onOpen(params);
1638	}
1639
1640	_dialogEvents(e)
1641	{
1642		if (super._dialogEvents(e)) return true;
1643		if (e.type === 'click')
1644		{
1645			if (e.target.classList.contains('warning-popup__ok-btn')) this.options.onConfirm.call(this);
1646			if (e.target.classList.contains('warning-popup__cancel-btn'))
1647			{
1648				e.stopPropagation();
1649				this.close();
1650				return true;
1651			}
1652		}
1653		return false;
1654	}
1655}
1656
1657function Confirm(text, title, confirmText = null)
1658{
1659	return new Promise(function(resolve, reject)
1660	{
1661		var bConfirm = false;
1662		const oConfirm = new ConfirmDialog({
1663			class: 'warning-popup',
1664			title: title,
1665			content: text,
1666			confirmText: confirmText,
1667			onConfirm: function()
1668			{
1669				this.confirmBtn.disabled = true;
1670				bConfirm = true;
1671				this.close();
1672			},
1673			onClose: function()
1674			{
1675				return bConfirm ? resolve() : reject();
1676			}
1677		});
1678		oConfirm.open();
1679	});
1680}
1681
1682document.documentElement.addEventListener('click', function (e)
1683{
1684	const nOpener = e.target.closest('.auto-opener');
1685	if (nOpener)
1686	{
1687		const nPopup = document.getElementById(nOpener.dataset.targetId);
1688		if (nPopup)
1689		{
1690			const oParams = {};
1691			if (nPopup.classList.contains('custom-pop-up'))
1692			{
1693				// попап
1694				oParams.class = function()
1695				{
1696					const aClasses = [];
1697					nPopup.classList.forEach(function(v,k,l)
1698					{
1699						if (v !== 'custom-pop-up') aClasses.push(v);
1700					});
1701					return aClasses.join(' ');
1702				};
1703
1704				oParams.title = function()
1705				{
1706					const nTitle = nPopup.querySelector('.custom-pop-up__title');
1707					return nTitle ? nTitle.innerHTML : '';
1708				};
1709				
1710				oParams.content = function()
1711				{
1712					const nContent = nPopup.querySelector('.custom-pop-up__inner');
1713					return nContent ? nContent.innerHTML : null;
1714				};
1715
1716			} else
1717			{
1718				// только контент
1719				oParams.content = nPopup.innerHTML;
1720				if (nPopup.hasAttribute('title')) oParams.title = nPopup.getAttribute('title');
1721				if (nPopup.hasAttribute('class')) oParams.class = nPopup.getAttribute('class');
1722			}
1723
1724			nOpener.classList.add('_open');
1725			(new ModalDialog(oParams)).open();
1726		}
1727	}
1728});
1729
1730(function()
1731{
1732	const nAside = document.createElement('aside');
1733	nAside.classList.add('system-messages');
1734
1735	const fClose = function(e)
1736	{
1737		const nNotice = e.target.closest('.system-messages__item');
1738		if (nNotice)
1739		{
1740			nNotice.style.height = '';
1741			nNotice.classList.remove('system-messages__item--visible');
1742			setTimeout(function()
1743			{
1744				nAside.removeChild(nNotice);
1745
1746			}, 1000);
1747		}
1748	};
1749
1750	document.addEventListener('DOMContentLoaded', function(e)
1751	{
1752		document.body.appendChild(nAside);
1753		nAside.addEventListener('click', fClose, false);
1754		nAside.addEventListener('close', fClose, false);
1755
1756	}, false);
1757
1758
1759	const makeNotice = function(options)
1760	{
1761		const nNotice = document.createElement('div');
1762		nNotice.classList.add('system-messages__item');
1763		nNotice.classList.add('system-messages__item--' + options.type);
1764
1765		nNotice.insertAdjacentHTML('afterbegin', '\
1766		<div class="system-messages__item-inner">\
1767			<div class="system-messages__title"></div>\
1768			<div class="system-messages__text"></div>\
1769		</div>');
1770
1771		const nTitle = nNotice.querySelector('.system-messages__title');
1772		if (nTitle)
1773		{
1774			if (typeof(options.title) === 'string')
1775			{
1776				nTitle.textContent = options.title;
1777			} else
1778			{
1779				nTitle.parentNode.removeChild(nTitle);
1780			}
1781		}
1782
1783		const nContent = nNotice.querySelector('.system-messages__text');
1784		if (nContent)
1785		{
1786			if (typeof(options.content) === 'string')
1787			{
1788				nContent.insertAdjacentHTML('afterbegin', options.content);
1789			} else
1790			{
1791				nContent.parentNode.removeChild(nContent);
1792			}
1793		}
1794
1795		nAside.appendChild(nNotice);
1796		nNotice.style.height = nNotice.querySelector('.system-messages__item-inner').offsetHeight + 'px';
1797		nNotice.classList.add('system-messages__item--visible');
1798
1799		if (('timeout' in options) && (options.timeout !== null))
1800		{
1801			setTimeout(function()
1802			{
1803				nNotice.dispatchEvent(new Event('close', {
1804					'bubbles': true,
1805					'cancelable': false
1806				}));
1807			
1808			}, options.timeout);
1809		}
1810	};
1811
1812	window.msgErrorBox = {
1813		alert : function(title, message)
1814		{
1815			makeNotice({
1816				title: title ? title : 'Ошибка!',
1817				content: message,
1818				type: 'error',
1819				timeout: 5000
1820			});
1821		}
1822	};
1823
1824	window.msgNoticeBox = {
1825		alert : function(title, message)
1826		{
1827			makeNotice({
1828				title: title ? title : 'Внимание!',
1829				content: message,
1830				type: 'success',
1831				timeout: 5000
1832			});
1833		}
1834	};
1835
1836})();
1837/**
1838 * Создает всплывающие увдобления при наведении (или клике) на таргет (целевой элемент)
1839 * Требуется подключения стилей js-tooltip.scss
1840 */
1841class Tooltips {
1842  constructor(options = {}) {
1843    this.attach = options.attach ?? ".smart-tooltip";         // селектор таргетов || NodeList или HTMLCollection тултипа
1844    this.mobileAttach = options.mobileAttach;                 // селектор таргетов тултипа для тачскринов 
1845                                                              // если задан и устройство тачскрин, this.mobileAttach переопределяет this.аttach 
1846                                                              // чтобы отключить создание тултипа на мобильных (тачскринах) надо присвоить `{mobileAttach: 'none'}`
1847    this.openTrigger = options.openTrigger ?? "mouseenter";   // тригер показа тултипа
1848    this.closeTrigger = options.closeTrigger ?? "mouseleave"; // по умолчанию "mouseleave", если openTrigger !== "click"
1849    this.content = options.content ?? "title";                // контент тултипа (HTML) может быть задан при создании экземпляра класса
1850
1851    this.beforeOpen = options.beforeOpen;                     // колбек вызывающийся перед открытием
1852    this.onOpen = options.onOpen;                             // колбек выполняется послле открытия тултипа
1853    this.onClose = options.onClose;                             // колбек выполняется послле закрытия тултипа
1854
1855    this.contentSource = options.contentSource ?? null;       // селектор блока, содержимое которого надо перенести в тултип 
1856    this.setContent = options.setContent ?? null;             // асинхронный колбек для получения контента (удаленно)
1857    this.setContentOnce = options.setContentOnce ?? false;    // флаг единоразовой загрузки контента из колбека если объект наведения/клика не изменился, 
1858                                                              // работает только если в setContent передана ф
1858ункция
1859
1860    this.awaitDone = options.awaitDone ?? false;              // флаг блокировки закрытия тултипа при асинхронной загрузке контента, 
1861                                                              // работает только если в setContent передана функция
1862
1863    this.popover = options.popover ?? false;                  // для того, чтоб тултип не закрывался при переводе курсора
1864                                                              // с таргета на него надо установить {popover: true}                   
1865
1866    // Настройки отображения
1867    this.offset = options.offset ?? "";                       // отступ от таргета
1868    this.hasPointer = options.hasPointer ?? true;             // признак существования стрелочки (указателя)
1869    this.pointerSize = options.pointerSize ?? "";             // размер стрелочки (указателя)
1870    this.maxWidth = options.maxWidth ?? null;                 // максимальная ширина
1871    this.width = options.width ?? null;                       // ширина тултипа
1872                                                              // если задана, то this.posMod.x = 'center' принудительно, иначе возникают баги
1873    this.posMod = {};
1874    this.posMod.x = options.posMod?.x ?? "center";            // позиция по горизонтали x: left|left-auto|center|right|right-auto
1875    this.posMod.y = options.posMod?.y ?? "auto";              // позиция по вертикали y: above|under|auto|, auto по умолчанию
1876    this.hMargin = options.hMargin ?? 10;                     // оттступ тултипа от края экрана
1877    this.textAlign = options.textAlign ?? '';                 // выравнивание текста в 
1878    this.theme = options.theme;                               // суфикс к классу, для кастомизации css
1879    this.addClass = options.addClass ?? null;                 // добавление своего класса к тултипу 
1880    this.timeout = options.timeout ?? 500;                    // таймаут показа тултипа при наведении (только если this.openTrigger === "mouseenter";)
1881    this.closeTimeout = options.closeTimeout ?? 400;          // таймаут закрытия тултипа при потере курсора (только если this.closeTrigger === "mouseleave";)
1882    this.attachCursorXPos = options.attachCursorXPos ?? 1.3;  // если ширина таргета больше тултипа в attachCursorXPos раз, 
1883                                                              // то позиция тултипа привязывается к позиции курсора по горизонтали
1884    this.attachCursorYPos = options.attachCursorYPos ?? false;// привязать вертикальную координату к курсору мыши, координаты определяются в рамках таргета
1885
1886    this.hasLoader = options.hasLoader ?? false;              // Включает лоадар
1887    this.loader = options.loader ?? `<div class="spinner-loader spinner-loader--p0" role="status">
1888                                      <div class="spinner-loader__ring"></div>
1889                                      <span class="spinner-loader__label">Загружаем...</span>
1890                                    </div>`; 
1891
1892    // вспомогательные свойства, не требуют конфигурирования (не определяются пользователем)
1893    this.closeBlocked = false;                                // рабочий флаг блокировки закрытия тултипа при асинхронной загрузке контента, основывается на awaitDone
1894    this.contentLoading = false;                              // флаг активного процесса загрузки контента
1895    this.presetPosMod = {...this.posMod}                      // Сохранение базовой предустановленной настройки 
1896    this.classMod = {};                                       // вспомогатольный объект для работы с модификаторами css
1897    this.isOpen = false;                                      // признак открытого тултипа
1898    this.isFirstOpen = true;                                  // признак первого открытия (нужен для исправления бага)
1899    this.fetchedConntent = null;                              // контент загруженный колбеком this.setContent
1900    this.borderRadius = 0;                                    // радиус контейнера
1901    this.mouseEnterThis = false;                              // признак, что курсор был наведен (переведен с таргета) на тултип, 
1902               
1903    if (!('isTouch' in options))
1904    {
1905                                                              // в этом случае тултип не закрвывается работает только при опции {popover: true} 
1906      this.isTouch = ('ontouchstart' in window) || (navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)
1907    } else
1908    {
1909      this.isTouch = options.isTouch; // кастылек
1910    }
1911    
1912    this.mainOpenTriggerListenersCB = []                        // Массив колбеков слушателей открытия, одна ссылка на колбек для каждого таргета
1913    this.mainCloseTriggerListenersCB = []                       // Массив колбеков слушателей закрытия, одна ссылка на колбек для каждого таргета
1914    this.removeTimerListenersCB = []                            // Массив колбеков слушателей удаления таймера, одна ссылка на колбек для каждого таргета
1915
1916    this._init();
1917  }
1918
1919  /**
1920   * Инициализация
1921   */
1922  _init() {
1923    // если тачскрин выходим или переопределяем this.attach  
1924    if (this.mobileAttach === 'none' && this.isTouch) {
1925      console.info(`Тултипы для селектора ${this.attach} на тачскринах отключены опцией {mobileAttach: 'none'}`);
1926      return;
1927    }
1928    else if(this.mobileAttach && this.isTouch) {
1929      this.attach = this.mobileAttach;
1930    }
1931
1932    if (this.attach instanceof NodeList || Array.isArray(this.attach)) {
1933      this.targets = this.attach;
1934    } else if ( (typeof this.attach) === 'string' ) {
1935      this.targets = document.querySelectorAll(this.attach);
1936    } else {
1937      throw `Параметр "attach" = ${this.attach}, должен быть экземпляром NodeList либо строкой`;
1938    }
1939 
1940    
1941    if (!this.targets.length)
1942      throw `Не найдены ноды по селектору ${this.attach}`;
1943
1944    // Создаем контейнер
1945    this.el = document.createElement("div");
1946    this.el.className = "js-tooltip";
1947    this.el.innerHTML =
1948      '<div class="js-tooltip__container"></div> <div class="js-tooltip__pointer js-tooltip__pointer--bottom"></div>';
1949    document.body.append(this.el);
1950    this.container = this.el.querySelector(".js-tooltip__container");
1951    if (this.addClass !== null) this.container.classList.add(this.addClass);
1952    this.pointer = this.el.querySelector(".js-tooltip__pointer");
1953
1954    if(this.theme) {
1955      this.el.classList.add(`js-tooltip-${this.theme}`)
1956    }
1957
1958    if (this.popover && (this.closeTrigger == 'mouseleave')) 
1959    {
1960      this.el.addEventListener('mouseenter', this._setHoverPopoverFlag.bind(this), false); 
1961      this.el.addEventListener('mouseleave', this._closePopoverOnMouseOut.bind(this), false);
1962    }
1963
1964    // закрывает тултип при клике на кнопку '.js-tooltip-close-btn'
1965    this.el.addEventListener('click', this._closeTooltipOnBtnClick.bind(this), false); 
1966
1967    // Если контент для тултипа уже загружен на страницу в виде html, переносим его в
1968    if (this.contentSource && typeof this.contentSource == "string") {
1969      const contentSourceEl = document.querySelector(this.contentSource);
1970      if (!contentSourceEl) {
1971        throw `По селектору ${this.contentSource} не найден блок для наполнения тултипа`;
1972      }
1973      this.contentSourceEl = contentSourceEl;
1974    }
1975
1976    // Если устройство тачскрин
1977    if (this.isTouch) {
1978      this.openTrigger = 'click';
1979    }
1980    // Устанавливаем обработчики
1981    this.targets.forEach((target) => {
1982      // добавляем класс js-tooltip-target для отслеживания этиго элемента 
1983      target.classList.add('js-tooltip-target');
1984
1985      // Чистим/переносим атрибуты 'title'
1986      if (this.content === "title") {
1987        target.dataset[this.content] = target.getAttribute(this.content) ?? "";
1988        target.removeAttribute(this.content);
1989
1990        this.maxWidth ??= 280;
1991        this.el.style.maxWidth = this.maxWidth + "px";
1992      }
1993
1994      // Главны обработчик отрытия
1995      const openTriggerCB = this._mainOpenTriggerListener.bind(this);
1996      this.mainOpenTriggerListenersCB.push(openTriggerCB);
1997      target.addEventListener(this.openTrigger, openTriggerCB, false);
1998
1999      // Тригер закрытия 
2000      this.openTrigger === "click" ? (this.closeTrigger = "click") : null;
2001      if (this.closeTrigger === "mouseleave") {
2002        const closeTriggerCB = this._mainCloseTriggerListener.bind(this);
2003        this.mainCloseTriggerListenersCB.push(closeTriggerCB);
2004        target.addEventListener(this.closeTrigger, closeTriggerCB, false);
2005      }
2006
2007      // Удаляем таймер при сведении курсора
2008      const removeTimerCB = this._removeTimerOnMouseOut.bind(this);
2009      this.removeTimerListenersCB.push(removeTimerCB);
2010
2011      target.addEventListener('mouseleave', removeTimerCB, false);
2012    });
2013
2014    // Если закрываем по клику вне тултипа
2015    if (this.closeTrigger !== "mouseleave" || this.popover) {
2016      document.documentElement.addEventListener("click", this._closeTooltipOutsideTargetClick.bind(this), false);
2017    }
2018
2019    // При изменении ширины экрана закрываем
2020    window.addEventListener("resize", this._closeTooltipOnResize.bind(this), false);
2021
2022    // Устанавливем свойства из "option"
2023    this._setProperty();
2024  }
2025
2026  /**
2027   * Вызывает колбек (может быть асинхронным) перед открытием тултипа и возвращает его результат
2028   * если колбек отсутствует возвращает true
2029   * @param {Element} target - таргет на котором показывается тултип 
2030   * @param {Event} e - событие 
2031   * @returns 
2032   */
2033  async _beforeOpen(target, event) {
2034    if (!this.beforeOpen || typeof this.beforeOpen !== 'function') return true
2035
2036    try {
2037      return await this.beforeOpen(target, event);
2038    } catch (error) {
2039      console.error(error);
2040      return false;
2041    }
2042  }
2043
2044  // Колбек target.addEventListener(this.openTrigger, ... )
2045  _mainOpenTriggerListener(e) {  
2046    console.log('_mainOpenTriggerListener');
2047    const currentTarget = e.target;
2048    this.target = currentTarget;
2049    // иначе сразу закрывается
2050    if ((e.type === 'click') && (this.closeTrigger == e.type))
2051    {
2052      if (this.isOpen) return;
2053      e.stopPropagation();
2054    }
2055    // Открытие по наведению
2056    if (e.type === "mouseenter") { 
2057      clearTimeout(this.closeTimer);
2058      if(this.popover && this.parentTarget === currentTarget) {
2059        // clearTimeout(this.closeTimer);
2060        this.mouseEnterThis = false;
2061        return;
2062      } else if (this.popover) {
2063        this.parentTarget = currentTarget;
2064      }
2065      this.openTimer = setTimeout(() => {
2066        this.open(currentTarget, e);
2067      }, this.timeout); 
2068      return;
2069    }
2070    // Если срабатывает не по наведению, то пауза не нужна
2071    this.mouseEnterThis = false;
2072    // Если предыдущий открытый тултип не равен текущему
2073    if (this.prevClickTarget != currentTarget) {
2074      this.prevClickTarget = currentTarget;
2075      this.open(currentTarget, e);
2076    }  else {
2077      this._close(); 
2078    }
2079  }
2080
2081  // Колбек target.addEventListener(this.closeTrigger, ... )
2082  _mainCloseTriggerListener() { 
2083    if (!this.popover) {
2084      this._close();
2085      return;
2086    }
2087    this.closeTimer = setTimeout(() => {
2088      this.parentTarget = null;
2089      this._close();
2090    }, this.closeTimeout);
2091  }
2092
2093  // Колбек target.addEventListener('mouseleave', ... )
2094  // Удаляем таймер при сведении курсора
2095  _removeTimerOnMouseOut(e) { 
2096    clearTimeout(this.openTimer);
2097  }
2098
2099  // Колбек слушателя this.el.addEventListener('mouseenter')
2100  // Устанавливает флаг при наведении на тултип, чтоб он не закрывался
2101  _setHoverPopoverFlag(e){
2102    console.log('setHoverPopoverFlag');
2103    console.log(this)
2104    clearTimeout(this.closeTimer);
2105    this.mouseEnterThis = true;
2106  }
2107
2108  // Колбек слушателя this.el.addEventListener('mouseleave', ...)
2109  // Закрывает тултип при снятии с него курсора
2110  _closePopoverOnMouseOut(e) {
2111    console.log('closePopoverOnMouseOut')
2112    console.log(this)
2113    if (!this.isOpen) return;
2114    this.closeTimer = setTimeout(() => {
2115        this.mouseEnterThis = false;
2116        this.parentTarget = null;
2117        this._close();
2118    }, this.closeTimeout); 
2119  }
2120
2121  // Колбек this.el.addEventListener('click', ...)
2122  // Закрывает тултип при клике на кнопку '.js-tooltip-close-btn'
2123  _closeTooltipOnBtnClick(e) {
2124    if (e.target.closest('.js-tooltip-close-btn')) { 
2125      this.mouseEnterThis = false;
2126      this._close();
2127    }
2128  }
2129
2130  // Колбек document.documentElement.addEventListener("click", ... )
2131  // Если закрываем по клику вне тултипа
2132  _closeTooltipOutsideTargetClick(e) {
2133    if (e.target.closest('.js-tooltip__container')) return;
2134    if (this.isOpen && e.target.closest('.js-tooltip-target') == this.target) return;
2135
2136    this.mouseEnterThis = false;
2137    this.prevClickTarget = null;
2138    if (this.isOpen) this._close();
2139  }
2140
2141  // Колбек window.addEventListener("resize", ... )
2142  // При изменении ширины экрана закрываем
2143  _closeTooltipOnResize(e) {
2144    this.mouseEnterThis = false;
2145    if (this.isOpen) 
2146      this._close();
2147  }
2148
2149
2150  /**
2151   * Демортирует объект
2152   */
2153  destroy() {
2154    this.targets.forEach((target, i) => {
2155
2156      target.removeEventListener(this.openTrigger, this.mainOpenTriggerListenersCB[i]);
2157      target.removeEventListener('mouseleave', this.removeTimerListenersCB[i]); 
2158
2159      if (this.closeTrigger === "mouseleave" && this.mainCloseTriggerListenersCB.length) {
2160        target.removeEventListener(this.closeTrigger, this.mainCloseTriggerListenersCB[i]);
2161      }
2162    });
2163
2164    if (this.popover && (this.closeTrigger == 'mouseleave')) 
2165    {
2166      this.el.removeEventListener('mouseenter', this._setHoverPopoverFlag); 
2167      this.el.removeEventListener('mouseleave', this._closePopoverOnMouseOut);
2168    }
2169
2170    this.el.removeEventListener('click', this._closeTooltipOnBtnClick); 
2171
2172    if (this.closeTrigger !== "mouseleave" || this.popover) {
2173      document.documentElement.removeEventListener("click", this._closeTooltipOutsideTargetClick);
2174    }
2175    window.removeEventListener("resize", this._closeTooltipOnResize);
2176
2177    // Удаление таймаутов, если они были установлены
2178     if (this.openTimer) {
2179      clearTimeout(this.openTimer);
2180    }
2181    if (this.closeTimer) {
2182      clearTimeout(this.closeTimer);
2183    }
2184    
2185    // Удаление контейнера из тултипа из DOM, если он есть
2186    this.el.remove();
2187
2188    // Обнуление свойств для освобождения памяти
2189    for (let  prop  in this) {
2190      if (this.hasOwnProperty( prop )) {
2191        delete this[ prop ];
2192        console.log( prop  + ": " + this[ prop ]);
2193      } 
2194    }
2195    let self = this;
2196    setTimeout(() => {
2197      self = null;
2198    }, 0); 
2199  }
2200
2201
2202  /**
2203   * Показывает tooltip - приватный метод
2204   * @param {Element} target - таргет на котором показывается тултип
2205   * @param {Event} e - событие
2206   */
2207  _open(target, e) {
2208    this._calcPos(target, e);
2209    this._modClasses();
2210    this.show();
2211
2212    if ((typeof this.onOpen === 'function') && !this.contentLoading) this.onOpen(target, e);
2213  }
2214
2215  /**
2216   * Получает контент и показывает tooltip
2217   * @param {Element} target - таргет на котором показывается тултип
2218   * @param {Event} e - событие
2219   */
2220  async open(target, e) {
2221    this.mouseEnterThis = false;
2222    const beforeOpenDone = await this._beforeOpen(target, e) 
2223    if ( !beforeOpenDone || this.closeBlocked) return; 
2224
2225    this.target
2226    // console.log('open Tooltips');
2227    let content = "";
2228    let hasLoader = null;
2229
2230    // Если контент требует асинхронной загрузки с, здесь this.getContent - функция возвращающая HTML
2231    if (this.setContent && typeof this.setContent === "function") { 
2232      hasLoader = this.hasLoader;
2233      // если предусмотрена одноразовая загрузка и контент уже загружен, просто паказываем тултип
2234      if (this.setContentOnce && this.fetchedConntent) {
2235        content = this.fetchedConntent;
2236      } else {
2237        content = `<div class="js-tooltip__content">${this.loader}</div>`;
2238        this._setContent(target, e);
2239      } 
2240    }
2241    // если контент передан в виде строки html
2242    else if (this.setContent && typeof this.setContent === 'string') {
2243      content = `<div class="js-tooltip__content">${this.setContent}</div>`;
2244    }
2245    // если контент находится на странице и имеет слектор contentSource
2246    else if (this.contentSourceEl) {
2247      content = this.contentSourceEl.outerHTML;
2248    }
2249    // контент лежит в атрибуте 'title' - принимается по умолчанию
2250    else if (this.content === "title") {
2251      const data = target.getAttribute("data-title") ?? "";
2252      data
2253        ? (content = `<div class="js-tooltip__content">${data}</div>`)
2254        : content = null;
2255    }
2256    // Контент задан при создании экземпляра класса
2257    else if (this.content) {
2258      content = this.content;
2259    }
2260
2261    if (hasLoader !== null && !hasLoader) return;
2262
2263    if (!content) {
2264      console.error('Контент тултипа не задан! \nСледует задать одно из свойств: setContent, content, contentSource в конструкторе new Tooltips() \nлибо заполнить атрибут "title" у целевых элементов')
2265      return;
2266    }
2267
2268    this.container.innerHTML = content;
2269    this._open(target, e);
2270  }
2271
2272  /**
2273   * Закрывает тултип
2274   * Публичный метод для вызова в колбеках
2275   * Убирает все блокировки и закрывает тултип
2276   */
2277  close() {
2278    this.mouseEnterThis = false;
2279    this.closeBlocked = false;
2280    this._close();
2281  }
2282
2283  /**
2284   * Закрывает тултип
2285   * Приватный метод
2286   */
2287  _close() {
2288
2289    if (this.mouseEnterThis || this.closeBlocked) return;
2290    // console.log('close Tooltips')
2291    this.prevClickTarget = null;
2292    this.hide();
2293    this._clearPos();
2294    if ((typeof this.onClose === 'function') && !this.contentLoading) this.onClose();
2295  }
2296
2297  show() {
2298    if (this.el) {
2299      this.el.classList.add("js-tooltip--shown");
2300    } 
2301    this.isOpen = true;
2302  }
2303
2304  hide() {
2305    if (this.el) {
2306      this.el.classList.remove("js-tooltip--shown");
2307    } 
2308    this.isOpen = false;
2309  }
2310
2311  /**
2312   * Получает контент асинхронно
2313   * @param {Node} target - пробрасываем событие, чтобы в колбеке получить доступ к атрибутам таргета (если нужны для запроса)
2314   * @returns null
2315   */
2316  async _setContent(target, e) { 
2317    
2318    if (!this.setContent || typeof this.setContent !== "function" || this.contentLoading ) return;  
2319    
2320    // устанавливаем флаг блокировки закрытия
2321    this.closeBlocked = this.awaitDone;
2322    this.contentLoading = true;
2323
2324    try {
2325      this.fetchedConntent = await this.setContent(target);
2326    } catch (e) {
2327      console.error(e); 
2328    }
2329
2330    this.closeBlocked = false;
2331    this.mouseEnterThis = false;
2332
2333    const isOpen = this.isOpen;
2334    this._close();
2335    
2336    this.contentLoading = false;
2337
2338    if (!this.fetchedConntent) {
2339      console.error('Контент не загрузился!');
2340      return;
2341    } 
2342    this.container.innerHTML = this.fetchedConntent;
2343    if (!this.setContentOnce) this.fetchedConntent = null;
2344
2345    // если тултип был закрыт до загрузки контента
2346    if (!isOpen && this.hasLoader) return;
2347
2348    setTimeout(() => {
2349      this._open(target, e);
2350    }, 200);
2351  }
2352
2353  /**
2354   * Вычисляет координаты
2355   * @param {Node} target - целевой элемент к которому привязывается тултип
2356   * @param {Event} e - пробрасываем событие для
2357   */
2358  _calcPos(target, e) {
2359    // if (this.width) {
2360    //   // иначе баг
2361    //   this.posMod.x = "auto";
2362    // }
2363
2364    const windowWidth = document.documentElement.clientWidth;
2365    const targetRect = target.getBoundingClientRect();
2366    if (this.hasPointer) {
2367      this.pointer.style.left = "";
2368    }
2369    const pageYOffset = window.scrollY;
2370    let width = this.el.offsetWidth;
2371    let height = this.el.offsetHeight + (this.isFirstOpen ? this.offset : 0);
2372    this.isFirstOpen = false;
2373    // Таргет шире тултипа
2374    const targetIsWider = (typeof this.attachCursorXPos === 'number') ? targetRect.width > width * this.attachCursorXPos: false ;
2375
2376    if (targetIsWider) {
2377      this.posMod.x = 'cursor-x-pos-auto';
2378    } else {
2379      this.posMod.x = this.presetPosMod.x;
2380    }
2381
2382    // сдвиг по вертикали 
2383    let yPosShiftFromTop = 0;
2384    let yPosShiftFromBottom = 0;
2385    if (this.attachCursorYPos) {
2386      // сдвиг от верха таргета
2387      yPosShiftFromTop = e.pageY - pageYOffset - targetRect.top;
2388      yPosShiftFromBottom = targetRect.bottom - (e.pageY - pageYOffset);
2389    }
2390
2391    // inset: [top] [right] [bottom] [left];
2392    let top = "auto";
2393    let right = "auto";
2394    let bottom = "auto";
2395    let left = "auto";
2396
2397
2398    // vertical: above|under|auto
2399    const getAbove = () => {
2400      this.classMod.y = "above";
2401      return (top = Math.ceil(targetRect.top + yPosShiftFromTop - height + pageYOffset));
2402    };
2403    const getUnder = () => {
2404      this.classMod.y = "under";
2405      return (top = Math.ceil(targetRect.bottom - yPosShiftFromBottom + pageYOffset));
2406    };
2407
2408    // Автоматическое позиционирование по вертикали
2409    (targetRect.top < height && this.posMod.y === "auto") ||
2410    this.posMod.y === "under"
2411      ? getUnder()
2412      : getAbove();
2413  
2414
2415    // horisontal left|left-auto|center|right|right-auto
2416
2417    /** Вычисляет левую позицию тултипа при позиционировании по центру таргета */
2418    const leftPos = () =>
2419      Math.ceil(targetRect.left - (width - targetRect.width) / 2);
2420    /** Вычисляет правую позицию тултипа при позиционировании по центру таргета */
2421    const rightPos = () => leftPos() + width;
2422
2423    // Позиционируем тултип по правому краю таргета
2424    var getRightToRightPos = (flag = "") => {
2425      left = "auto";
2426
2427      // если позиция всегда по правой стороне, установлен режим "right-auto" и сонтейнер выходит за левую гараницу
2428      if (flag === "auto" && leftPos() < this.hMargin) {
2429        return getLeftToLeftPos();
2430      }
2431
2432      const lPos = rightPos();
2433      // отступ от левого края
2434      if (targetRect.right < width - this.hMargin) {
2435        left = this.hMargin;
2436      }
2437
2438      if (this.hasPointer && width > targetRect.width) {
2439        setTimeout(() => {
2440          this.pointer.style.left =
2441            this.el.offsetWidth -
2442            Math.max((targetRect.width / 2 + this.pointerSize), this.borderRadius) +
2443            "px";
2444        }, 50);
2445      }
2446
2447      return (right = windowWidth - targetRect.right);
2448    };
2449
2450    // Позиционируем тултип по левовому краю таргета
2451    var getLeftToLeftPos = (flag = "") => {
2452      right = "auto";
2453
2454      // если позиция всегда по правой стороне, установлен режим "right-auto" и контейнер выходит за левую гараницу
2455      if (flag === "auto" && rightPos() > windowWidth - this.hMargin) {
2456        return getRightToRightPos();
2457      }
2458
2459      // отступ от правого края
2460      if (targetRect.left + width > windowWidth - this.hMargin) {
2461        right = this.hMargin + "px";
2462      }
2463
2464      // расчет позиции поинтера если таргет меньше тултипа
2465      if (this.hasPointer && width > targetRect.width) {
2466        setTimeout(() => {
2467          this.pointer.style.left = Math.max((targetRect.width / 2 - this.pointerSize), this.borderRadius) + "px";
2468        }, 50);
2469      }
2470
2471      return (left = targetRect.left);
2472    };
2473
2474    // Позиционируем по центру и если не помещается, позиционируем по правому/левому краю
2475    const getLeftToCenterPos = () => {
2476      right = "auto";
2477      const lPos = leftPos();
2478
2479      if (rightPos() > windowWidth - this.hMargin) {
2480        return getRightToRightPos();
2481      } else if (lPos < this.hMargin) {
2482        return getLeftToLeftPos();
2483      }
2484      return (left = lPos);
2485    };
2486
2487    // Если таргет шире тултипа, позиционирует по курсору
2488    const getHorizontalToCursorePos = () => {
2489      const cursorXPos = e.pageX;
2490      const d = width/2;
2491
2492      if ( cursorXPos > targetRect.right - d) {
2493        left = targetRect.right - width;
2494      } else if (cursorXPos > targetRect.left + d) {
2495        left = cursorXPos - width/2;
2496      } else {
2497        left = targetRect.left;
2498      }
2499      
2500      return {left, right}
2501    }
2502
2503    switch (this.posMod.x) {
2504      case "left":
2505        getLeftToLeftPos();
2506        break;
2507      case "left-auto":
2508        getLeftToLeftPos("auto");
2509        break;
2510      case "right":
2511        getRightToRightPos();
2512        break;
2513      case "right-auto":
2514        getRightToRightPos("auto");
2515        break;
2516      case "cursor-x-pos-auto":
2517        getHorizontalToCursorePos();
2518        break;
2519      default:
2520        getLeftToCenterPos();
2521        break;
2522    }
2523
2524    this.el.style.top = typeof top === "string" ? top : top + "px";
2525    this.el.style.right = typeof right === "string" ? right : right + "px";
2526    this.el.style.bottom = typeof bottom === "string" ? bottom : bottom + "px";
2527    this.el.style.left = typeof left === "string" ? left : left + "px";
2528  }
2529
2530  /**
2531   * Очищает позицию
2532   */
2533  _clearPos() {
2534    if (!this.el) return;
2535    this.el.style.top = "";
2536    this.el.style.right = "";
2537    this.el.style.bottom = "";
2538    this.el.style.left = "";
2539  }
2540
2541  /**
2542   * Обновляет модификаторы
2543   */
2544  _modClasses() {
2545    this.el.classList.remove(
2546      "js-tooltip--top",
2547      "js-tooltip--bottom"
2548      // "js-tooltip--right",
2549      // "js-tooltip--left"
2550    );
2551    this.pointer.classList.remove(
2552      "js-tooltip__pointer--top",
2553      "js-tooltip__pointer--bottom"
2554      // "js-tooltip__pointer--right",
2555      // "js-tooltip__pointer--left"
2556    );
2557
2558    switch (this.classMod.y) {
2559      case "above":
2560        this.el.classList.add("js-tooltip--top");
2561        this.pointer.classList.add("js-tooltip__pointer--bottom");
2562        break;
2563      case "under":
2564        this.el.classList.add("js-tooltip--bottom");
2565        this.pointer.classList.add("js-tooltip__pointer--top");
2566        break;
2567      // задел на будущее
2568      // case "right":
2569      //   this.el.classList.add("js-tooltip--right");
2570      //   this.pointer.classList.add("js-tooltip__pointer--left");
2571      // case "left":
2572      //   this.el.classList.add("js-tooltip--left");
2573      //   this.pointer.classList.add("js-tooltip__pointer--right");
2574      //   break;
2575
2576      default:
2577        break;
2578    }
2579  }
2580
2581  /**
2582   * Устанавливем CSS свойства
2583   */
2584  _setProperty() {
2585    if (this.offset) {
2586      this.el.style.setProperty("--offset", this.offset);
2587    } else {
2588      this.offset =
2589        parseFloat(
2590          window.getComputedStyle(this.el).getPropertyValue("--offset")
2591        ) ?? 12;
2592    }
2593
2594    if (!this.hasPointer) {
2595      this.pointer.style.display = "none";
2596    } else if (this.pointerSize) {
2597      this.el.style.setProperty("--pointer-size", this.pointerSize + "px");
2598    } else {
2599      this.pointerSize =
2600        parseFloat(
2601          window.getComputedStyle(this.el).getPropertyValue("--pointer-size")
2602        ) ?? "";
2603    }
2604
2605    if (this.textAlign) this.el.style.textAlign = this.textAlign;
2606
2607    if (this.maxWidth) {
2608      this.el.style.maxWidth =
2609        typeof this.maxWidth === "string"
2610          ? this.maxWidth
2611          : this.maxWidth + "px";
2612    }
2613    if (this.width) {
2614      this.el.style.width =
2615        typeof this.width === "string" ? this.width : this.width + "px";
2616    }
2617
2618    
2619    this.borderRadius = parseFloat(
2620      window.getComputedStyle(this.container).borderRadius
2621    ) ?? 0;
2622    
2623    ;
2624  }
2625}
2626// предупреждаем об использовании cookies
2627document.addEventListener('DOMContentLoaded', function(e)
2628{
2629	if (document.cookie.indexOf('cookies_warning=') === -1)
2630	{
2631		const nCookieBanner = document.createElement('div');
2632		nCookieBanner.setAttribute('id', 'cookies_warning');
2633		nCookieBanner.classList.add('cookie_warning');
2634		nCookieBanner.classList.add('cookie_warning--active');
2635		nCookieBanner.innerHTML = '<div class="cookie_warning__text">Во время посещения сайта вы соглашаетесь с использованием файлов <a href="https://ru.wikipedia.org/wiki/Cookie" class="cookie_warning__read" target="_blank">cookie</a></div><button class="cookie_warning__apply" type="button">Хорошо</button>';
2636
2637		document.body.appendChild(nCookieBanner);
2638
2639
2640		const nBtn = nCookieBanner.querySelector('.cookie_warning__apply');
2641		nBtn.addEventListener('click', function()
2642		{
2643			document.cookie = "cookies_warning=true; max-age=31536000; path=/";
2644			nCookieBanner.classList.remove('cookie_warning--active');
2645			document.body.removeChild(nCookieBanner);
2646
2647		}, false);
2648	}
2649}, false);
2650// @fancyapps/ui/Fancybox v4.0.26
2651!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).window=t.window||{})}(this,(function(t){"use strict";function e(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function i(t){for(var i=1;i<arguments.length;i++){var n=null!=arguments[i]?arguments[i]:{};i%2?e(Object(n),!0).forEach((function(e){r(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):e(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function s(t,e,i){return e&&a(t.prototype,e),i&&a(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function r(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&h(t,e)}
2651function c(t){return c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},c(t)}function h(t,e){return h=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},h(t,e)}function d(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function u(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return d(t)}function f(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=c(t);if(e){var o=c(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return u(this,i)}}function v(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=c(t)););return t}function p(){return p="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,i){var n=v(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(arguments.length<3?t:i):o.value}},p.apply(this,arguments)}function g(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==i)return;var n,o,a=[],s=!0,r=!1;try{for(i=i.call(t);!(s=(n=i.next()).done)&&(a.push(n.value),!e||a.length!==e);s=!0);}catch(t){r=!0,o=t}finally{try{s||null==i.return||i.return()}finally{if(r)throw o}}return a}(t,e)||y(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(t){return function(t){if(Array.isArray(t))return b(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||y(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(t,e){if(t){if("string"==typeof t)return b(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?b(t,e):void 0}}function b(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function x(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=y(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,r=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return s=t.done,t},e:function(t){r=!0,a=t},f:function(){try{s||null==i.return||i.return()}finally{if(r)throw a}}}}var w=function(t){return"object"===n(t)&&null!==t&&t.constructor===Object&&"[object Object]"===Object.prototype.toString.call(t)},k=function t(){for(var e=!1,i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];"boolean"==typeof o[0]&&(e=o.shift());var s=o[0];if(!s||"object"!==n(s))throw new Error("extendee must be an object");for(var r=o.slice(1),l=r.length,c=0;c<l;c++){var h=r[c];for(var d in h)if(h.hasOwnProperty(d)){var u=h[d];if(e&&(Array.isArray(u)||w(u))){var f=Array.isArray(u)?[]:{};s[d]=t(!0,s.hasOwnProperty(d)?s[d]:f,u)}else s[d]=u}}return s},S=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e4;return t=parseFloat(t)||0,Math.round((t+Number.EPSILON)*e)/e},C=function t(e){return!!(e&&"object"===n(e)&&e instanceof Element&&e!==document.body)&&(!e.__Panzoom&&(function(t){var e=getComputedStyle(t)["overflow-y"],i=getComputedStyle(t)["overflow-x"],n=("scroll"===e||"auto"===e)&&Math.abs(t.scrollHeight-t.clientHeight)>1,o=("scroll"===i||"auto"===i)&&Math.abs(t.scrollWidth-t.clientWidth)>1;return n||o}(e)?e:t(e.parentNode)))},$="undefined"!=typeof window&&window.ResizeObserver||function(){function t(e){o(this,t),this.observables=[],this.boundCheck=this.check.bind(this),this.boundCheck(),this.callback=e}return s(t,[{key:"observe",value:function(t){if(!this.observables.some((function(e){return e.el===t}))){var e={el:t,size:{height:t.clientHeight,width:t.clientWidth}};this.observables.push(e)}}},{key:"unobserve",value:function(t){this.observables=this.observables.filter((function(e){return e.el!==t}))}},{key:"disconnect",value:function(){this.observables=[]}},{key:"check",value:function(){var t=this.observables.filter((function(t){var e=t.el.clientHeight,i=t.el.clientWidth;if(t.size.height!==e||t.size.width!==i)return t.size.height=e,t.size.width=i,!0})).map((function(t){return t.el}));t.length>0&&this.callback(t),window.requestAnimationFrame(this.boundCheck)}}]),t}(),E=s((function t(e){o(this,t),this.id=self.Touch&&e instanceof Touch?e.identifier:-1,this.pageX=e.pageX,this.pageY=e.pageY,this.clientX=e.clientX,this.clientY=e.clientY})),P=function(t,e){return e?Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2)):0},T=function(t,e){return e?{clientX:(t.clientX+e.clientX)/2,clientY:(t.clientY+e.clientY)/2}:t},L=function(t){return"changedTouches"in t},_=function(){function t(e){var i=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=n.start,s=void 0===a?function(){return!0}:a,r=n.move,l=void 0===r?function(){}:r,c=n.end,h=void 0===c?function(){}:c;o(this,t),this._element=e,this.startPointers=[],this.currentPointers=[],this._pointerStart=function(t){if(!(t.buttons>0&&0!==t.button)){var e=new E(t);i.currentPointers.some((function(t){return t.id===e.id}))||i._triggerPointerStart(e,t)&&(window.addEventListener("mousemove",i._move),window.addEventListener("mouseup",i._pointerEnd))}},this._touchStart=function(t){for(var e=0,n=Array.from(t.changedTouches||[]);e<n.length;e++){var o=n[e];i._triggerPointerStart(new E(o),t)}},this._move=function(t){var e,n=i.currentPointers.slice(),o=L(t)?Array.from(t.changedTouches).map((function(t){return new E(t)})):[new E(t)],a=[],s=x(o);try{var r=function(){var t=e.value,n=i.currentPointers.findIndex((function(e){return e.id===t.id}));if(n<0)return"continue";a.push(t),i.currentPointers[n]=t};for(s.s();!(e=s.n()).done;)r()}catch(t){s.e(t)}finally{s.f()}i._moveCallback(n,i.currentPointers.slice(),t)},this._triggerPointerEnd=function(t,e){var n=i.currentPointers.findIndex((function(e){return e.id===t.id}));return!(n<0)&&(i.currentPointers.splice(n,1),i.startPointers.splice(n,1),i._endCallback(t,e),!0)},this._pointerEnd=function(t){t.buttons>0&&0!==t.button||i._triggerPointerEnd(new E(t),t)&&(window.removeEventListener("mousemove",i._move,{passive:!1}),window.removeEventListener("mouseup",i._pointerEnd,{passive:!1}))},this._touchEnd=function(t){for(var e=0,n=Array.from(t.changedTouches||[]);e<n.length;e++){var o=n[e];i._triggerPointerEnd(new E(o),t)}},this._startCallback=s,this._moveCallback=l,this._endCallback=h,this._element.addEventListener("mousedown",this._pointerStart,{passive:!1}),this._element.addEventListener("touchstart",this._touchStart,{passive:!1}),this._element.addEventListener("touchmove",this._move,{passive:!1}),this._element.addEventListener("touchend",this._touchEnd),this._element.addEventListener("touchcancel",this._touchEnd)}return s(t,[{key:"stop",value:function(){this._element.removeEventListener("mousedown",this._pointerStart,{passive:!1}),this._element.removeEventListener("touchstart",this._touchStart,{passive:!1}),this._element.removeEventListener("touchmove",this._move,{passive:!1}),this._element.removeEventListener("touchend",this._touchEnd),this._element.removeEventListener("touchcancel",this._touchEnd),window.removeEventListener("mousemove",this._move),window.removeEventListener("mouseup",this._pointerEnd)}},{key:"_triggerPointerStart",value:function(t,e){return!!this._startCallback(t,e)&&(this.currentPointers.push(t),this.startPointers.push(t),!0)}}]),t}(),A=function(t,e){return t.split(".").reduce((function(t,e){return t&&t[e]}
2651),e)},O=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,t),this.options=k(!0,{},e),this.plugins=[],this.events={};for(var i=0,n=["on","once"];i<n.length;i++)for(var a=n[i],s=0,r=Object.entries(this.options[a]||{});s<r.length;s++){var l=r[s];this[a].apply(this,m(l))}}return s(t,[{key:"option",value:function(t,e){t=String(t);var i=A(t,this.options);if("function"==typeof i){for(var n,o=arguments.length,a=new Array(o>2?o-2:0),s=2;s<o;s++)a[s-2]=arguments[s];i=(n=i).call.apply(n,[this,this].concat(a))}return void 0===i?e:i}},{key:"localize",value:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return t=(t=String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g,(function(t,n,o){var a="";o?a=e.option("".concat(n[0]+n.toLowerCase().substring(1),".l10n.").concat(o)):n&&(a=e.option("l10n.".concat(n))),a||(a=t);for(var s=0;s<i.length;s++)a=a.split(i[s][0]).join(i[s][1]);return a}))).replace(/\{\{(.*)\}\}/,(function(t,e){return e}))}},{key:"on",value:function(t,e){var i=this;if(w(t)){for(var n=0,o=Object.entries(t);n<o.length;n++){var a=o[n];this.on.apply(this,m(a))}return this}return String(t).split(" ").forEach((function(t){var n=i.events[t]=i.events[t]||[];-1==n.indexOf(e)&&n.push(e)})),this}},{key:"once",value:function(t,e){var i=this;if(w(t)){for(var n=0,o=Object.entries(t);n<o.length;n++){var a=o[n];this.once.apply(this,m(a))}return this}return String(t).split(" ").forEach((function(t){var n=function n(){i.off(t,n);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];e.call.apply(e,[i,i].concat(a))};n._=e,i.on(t,n)})),this}},{key:"off",value:function(t,e){var i=this;if(!w(t))return t.split(" ").forEach((function(t){var n=i.events[t];if(!n||!n.length)return i;for(var o=-1,a=0,s=n.length;a<s;a++){var r=n[a];if(r&&(r===e||r._===e)){o=a;break}}-1!=o&&n.splice(o,1)})),this;for(var n=0,o=Object.entries(t);n<o.length;n++){var a=o[n];this.off.apply(this,m(a))}}},{key:"trigger",value:function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];var o,a=x(m(this.events[t]||[]).slice());try{for(a.s();!(o=a.n()).done;){var s=o.value;if(s&&!1===s.call.apply(s,[this,this].concat(i)))return!1}}catch(t){a.e(t)}finally{a.f()}var r,l=x(m(this.events["*"]||[]).slice());try{for(l.s();!(r=l.n()).done;){var c=r.value;if(c&&!1===c.call.apply(c,[this,t,this].concat(i)))return!1}}catch(t){l.e(t)}finally{l.f()}return!0}},{key:"attachPlugins",value:function(t){for(var e={},i=0,n=Object.entries(t||{});i<n.length;i++){var o=g(n[i],2),a=o[0],s=o[1];!1===this.options[a]||this.plugins[a]||(this.options[a]=k({},s.defaults||{},this.options[a]),e[a]=new s(this))}for(var r=0,l=Object.entries(e);r<l.length;r++){var c=g(l[r],2);c[0],c[1].attach(this)}return this.plugins=Object.assign({},this.plugins,e),this}},{key:"detachPlugins",value:function(){for(var t in this.plugins){var e=void 0;(e=this.plugins[t])&&"function"==typeof e.detach&&e.detach(this)}return this.plugins={},this}}]),t}(),z={touch:!0,zoom:!0,pinchToZoom:!0,panOnlyZoomed:!1,lockAxis:!1,friction:.64,decelFriction:.88,zoomFriction:.74,bounceForce:.2,baseScale:1,minScale:1,maxScale:2,step:.5,textSelection:!1,click:"toggleZoom",wheel:"zoom",wheelFactor:42,wheelLimit:5,draggableClass:"is-draggable",draggingClass:"is-dragging",ratio:1},M=function(t){l(n,t);var e=f(n);function n(t){var i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};o(this,n),(i=e.call(this,k(!0,{},z,a))).state="init",i.$container=t;for(var s=0,r=["onLoad","onWheel","onClick"];s<r.length;s++){var l=r[s];i[l]=i[l].bind(d(i))}return i.initLayout(),i.resetValues(),i.attachPlugins(n.Plugins),i.trigger("init"),i.updateMetrics(),i.attachEvents(),i.trigger("ready"),!1===i.option("centerOnStart")?i.state="ready":i.panTo({friction:0}),t.__Panzoom=d(i),i}return s(n,[{key:"initLayout",value:function(){var t=this.$container;if(!(t instanceof HTMLElement))throw new Error("Panzoom: Container not found");var e=this.option("content")||t.querySelector(".panzoom__content");if(!e)throw new Error("Panzoom: Content not found");this.$content=e;var i,n=this.option("viewport")||t.querySelector(".panzoom__viewport");n||!1===this.option("wrapInner")||((n=document.createElement("div")).classList.add("panzoom__viewport"),(i=n).append.apply(i,m(t.childNodes)),t.appendChild(n));this.$viewport=n||e.parentNode}},{key:"resetValues",value:function(){this.updateRate=this.option("updateRate",/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)?250:24),this.container={width:0,height:0},this.viewport={width:0,height:0},this.content={origWidth:0,origHeight:0,width:0,height:0,x:this.option("x",0),y:this.option("y",0),scale:this.option("baseScale")},this.transform={x:0,y:0,scale:1},this.resetDragPosition()}},{key:"onLoad",value:function(t){this.updateMetrics(),this.panTo({scale:this.option("baseScale"),friction:0}),this.trigger("load",t)}},{key:"onClick",value:function(t){if(!t.defaultPrevented)if(this.option("textSelection")&&window.getSelection().toString().length)t.stopPropagation();else{var e=this.$content.getClientRects()[0];if("ready"!==this.state&&(this.dragPosition.midPoint||Math.abs(e.top-this.dragStart.rect.top)>1||Math.abs(e.left-this.dragStart.rect.left)>1))return t.preventDefault(),void t.stopPropagation();!1!==this.trigger("click",t)&&this.option("zoom")&&"toggleZoom"===this.option("click")&&(t.preventDefault(),t.stopPropagation(),this.zoomWithClick(t))}}},{key:"onWheel",value:function(t){!1!==this.trigger("wheel",t)&&this.option("zoom")&&this.option("wheel")&&this.zoomWithWheel(t)}},{key:"zoomWithWheel",value:function(t){void 0===this.changedDelta&&(this.changedDelta=0);var e=Math.max(-1,Math.min(1,-t.deltaY||-t.deltaX||t.wheelDelta||-t.detail)),i=this.content.scale,n=i*(100+e*this.option("wheelFactor"))/100;if(e<0&&Math.abs(i-this.option("minScale"))<.01||e>0&&Math.abs(i-this.option("maxScale"))<.01?(this.changedDelta+=Math.abs(e),n=i):(this.changedDelta=0,n=Math.max(Math.min(n,this.option("maxScale")),this.option("minScale"))),!(this.changedDelta>this.option("wheelLimit"))&&(t.preventDefault(),n!==i)){var o=this.$content.getBoundingClientRect(),a=t.clientX-o.left,s=t.clientY-o.top;this.zoomTo(n,{x:a,y:s}
2651)}}},{key:"zoomWithClick",value:function(t){var e=this.$content.getClientRects()[0],i=t.clientX-e.left,n=t.clientY-e.top;this.toggleZoom({x:i,y:n})}},{key:"attachEvents",value:function(){var t=this;this.$content.addEventListener("load",this.onLoad),this.$container.addEventListener("wheel",this.onWheel,{passive:!1}),this.$container.addEventListener("click",this.onClick,{passive:!1}),this.initObserver();var e=new _(this.$container,{start:function(i,n){if(!t.option("touch"))return!1;if(t.velocity.scale<0)return!1;var o=n.composedPath()[0];if(!e.currentPointers.length){if(-1!==["BUTTON","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].indexOf(o.nodeName))return!1;if(t.option("textSelection")&&function(t,e,i){for(var n=t.childNodes,o=document.createRange(),a=0;a<n.length;a++){var s=n[a];if(s.nodeType===Node.TEXT_NODE){o.selectNodeContents(s);var r=o.getBoundingClientRect();if(e>=r.left&&i>=r.top&&e<=r.right&&i<=r.bottom)return s}}return!1}(o,i.clientX,i.clientY))return!1}return!C(o)&&(!1!==t.trigger("touchStart",n)&&("mousedown"===n.type&&n.preventDefault(),t.state="pointerdown",t.resetDragPosition(),t.dragPosition.midPoint=null,t.dragPosition.time=Date.now(),!0))},move:function(i,n,o){if("pointerdown"===t.state)if(!1!==t.trigger("touchMove",o)){if(!(n.length<2&&!0===t.option("panOnlyZoomed")&&t.content.width<=t.viewport.width&&t.content.height<=t.viewport.height&&t.transform.scale<=t.option("baseScale"))&&(!(n.length>1)||t.option("zoom")&&!1!==t.option("pinchToZoom"))){var a=T(i[0],i[1]),s=T(n[0],n[1]),r=s.clientX-a.clientX,l=s.clientY-a.clientY,c=P(i[0],i[1]),h=P(n[0],n[1]),d=c&&h?h/c:1;t.dragOffset.x+=r,t.dragOffset.y+=l,t.dragOffset.scale*=d,t.dragOffset.time=Date.now()-t.dragPosition.time;var u=1===t.dragStart.scale&&t.option("lockAxis");if(u&&!t.lockAxis){if(Math.abs(t.dragOffset.x)<6&&Math.abs(t.dragOffset.y)<6)return void o.preventDefault();var f=Math.abs(180*Math.atan2(t.dragOffset.y,t.dragOffset.x)/Math.PI);t.lockAxis=f>45&&f<135?"y":"x"}if("xy"===u||"y"!==t.lockAxis){if(o.preventDefault(),o.stopPropagation(),o.stopImmediatePropagation(),t.lockAxis&&(t.dragOffset["x"===t.lockAxis?"y":"x"]=0),t.$container.classList.add(t.option("draggingClass")),t.transform.scale===t.option("baseScale")&&"y"===t.lockAxis||(t.dragPosition.x=t.dragStart.x+t.dragOffset.x),t.transform.scale===t.option("baseScale")&&"x"===t.lockAxis||(t.dragPosition.y=t.dragStart.y+t.dragOffset.y),t.dragPosition.scale=t.dragStart.scale*t.dragOffset.scale,n.length>1){var v=T(e.startPointers[0],e.startPointers[1]),p=v.clientX-t.dragStart.rect.x,g=v.clientY-t.dragStart.rect.y,m=t.getZoomDelta(t.content.scale*t.dragOffset.scale,p,g),y=m.deltaX,b=m.deltaY;t.dragPosition.x-=y,t.dragPosition.y-=b,t.dragPosition.midPoint=s}else t.setDragResistance();t.transform={x:t.dragPosition.x,y:t.dragPosition.y,scale:t.dragPosition.scale},t.startAnimation()}}}else o.preventDefault()},end:function(n,o){if("pointerdown"===t.state)if(t._dragOffset=i({},t.dragOffset),e.currentPointers.length)t.resetDragPosition();else if(t.state="decel",t.friction=t.option("decelFriction"),t.recalculateTransform(),t.$container.classList.remove(t.option("draggingClass")),!1!==t.trigger("touchEnd",o)&&"decel"===t.state){var a=t.option("minScale");if(t.transform.scale<a)t.zoomTo(a,{friction:.64});else{var s=t.option("maxScale");if(t.transform.scale-s>.01){var r=t.dragPosition.midPoint||n,l=t.$content.getClientRects()[0];t.zoomTo(s,{friction:.64,x:r.clientX-l.left,y:r.clientY-l.top})}else;}}}});this.pointerTracker=e}},{key:"initObserver",value:function(){var t=this;this.resizeObserver||(this.resizeObserver=new $((function(){t.updateTimer||(t.updateTimer=setTimeout((function(){var e=t.$container.getBoundingClientRect();e.width&&e.height?((Math.abs(e.width-t.container.width)>1||Math.abs(e.height-t.container.height)>1)&&(t.isAnimating()&&t.endAnimation(!0),t.updateMetrics(),t.panTo({x:t.content.x,y:t.content.y,scale:t.option("baseScale"),friction:0})),t.updateTimer=null):t.updateTimer=null}),t.updateRate))})),this.resizeObserver.observe(this.$container))}},{key:"resetDragPosition",value:function(){this.lockAxis=null,this.friction=this.option("friction"),this.velocity={x:0,y:0,scale:0};var t=this.content,e=t.x,n=t.y,o=t.scale;
2651this.dragStart={rect:this.$content.getBoundingClientRect(),x:e,y:n,scale:o},this.dragPosition=i(i({},this.dragPosition),{},{x:e,y:n,scale:o}),this.dragOffset={x:0,y:0,scale:1,time:0}}},{key:"updateMetrics",value:function(t){!0!==t&&this.trigger("beforeUpdate");var e,n=this.$container,o=this.$content,a=this.$viewport,s=o instanceof HTMLImageElement,r=this.option("zoom"),l=this.option("resizeParent",r),c=this.option("width"),h=this.option("height"),d=c||(e=o,Math.max(parseFloat(e.naturalWidth||0),parseFloat(e.width&&e.width.baseVal&&e.width.baseVal.value||0),parseFloat(e.offsetWidth||0),parseFloat(e.scrollWidth||0))),u=h||function(t){return Math.max(parseFloat(t.naturalHeight||0),parseFloat(t.height&&t.height.baseVal&&t.height.baseVal.value||0),parseFloat(t.offsetHeight||0),parseFloat(t.scrollHeight||0))}(o);Object.assign(o.style,{width:c?"".concat(c,"px"):"",height:h?"".concat(h,"px"):"",maxWidth:"",maxHeight:""}),l&&Object.assign(a.style,{width:"",height:""});var f=this.option("ratio");c=d=S(d*f),h=u=S(u*f);var v=o.getBoundingClientRect(),p=a.getBoundingClientRect(),g=a==n?p:n.getBoundingClientRect(),m=Math.max(a.offsetWidth,S(p.width)),y=Math.max(a.offsetHeight,S(p.height)),b=window.getComputedStyle(a);if(m-=parseFloat(b.paddingLeft)+parseFloat(b.paddingRight),y-=parseFloat(b.paddingTop)+parseFloat(b.paddingBottom),this.viewport.width=m,this.viewport.height=y,r){if(Math.abs(d-v.width)>.1||Math.abs(u-v.height)>.1){var x=function(t,e,i,n){var o=Math.min(i/t||0,n/e);return{width:t*o||0,height:e*o||0}}(d,u,Math.min(d,v.width),Math.min(u,v.height));c=S(x.width),h=S(x.height)}Object.assign(o.style,{width:"".concat(c,"px"),height:"".concat(h,"px"),transform:""})}if(l&&(Object.assign(a.style,{width:"".concat(c,"px"),height:"".concat(h,"px")}),this.viewport=i(i({},this.viewport),{},{width:c,height:h})),s&&r&&"function"!=typeof this.options.maxScale){var w=this.option("maxScale");this.options.maxScale=function(){return this.content.origWidth>0&&this.content.fitWidth>0?this.content.origWidth/this.content.fitWidth:w}}this.content=i(i({},this.content),{},{origWidth:d,origHeight:u,fitWidth:c,fitHeight:h,width:c,height:h,scale:1,isZoomable:r}),this.container={width:g.width,height:g.height},!0!==t&&this.trigger("afterUpdate")}},{key:"zoomIn",value:function(t){this.zoomTo(this.content.scale+(t||this.option("step")))}},{key:"zoomOut",value:function(t){this.zoomTo(this.content.scale-(t||this.option("step")))}},{key:"toggleZoom",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.option("maxScale"),i=this.option("baseScale"),n=this.content.scale>i+.5*(e-i)?i:e;this.zoomTo(n,t)}},{key:"zoomTo",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.option("baseScale"),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=e.x,n=void 0===i?null:i,o=e.y,a=void 0===o?null:o;t=Math.max(Math.min(t,this.option("maxScale")),this.option("minScale"));var s=S(this.content.scale/(this.content.width/this.content.fitWidth),1e7);null===n&&(n=this.content.width*s*.5),null===a&&(a=this.content.height*s*.5);var r=this.getZoomDelta(t,n,a),l=r.deltaX,c=r.deltaY;n=this.content.x-l,a=this.content.y-c,this.panTo({x:n,y:a,scale:t,friction:this.option("zoomFriction")})}},{key:"getZoomDelta",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=this.content.fitWidth*this.content.scale,o=this.content.fitHeight*this.content.scale,a=e>0&&n?e/n:0,s=i>0&&o?i/o:0,r=this.content.fitWidth*t,l=this.content.fitHeight*t,c=(r-n)*a,h=(l-o)*s;return{deltaX:c,deltaY:h}}},{key:"panTo",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.x,n=void 0===e?this.content.x:e,o=t.y,a=void 0===o?this.content.y:o,s=t.scale,r=t.friction,l=void 0===r?this.option("friction"):r,c=t.ignoreBounds,h=void 0!==c&&c;if(s=s||this.content.scale||1,!h){var d=this.getBounds(s),u=d.boundX,f=d.boundY;u&&(n=Math.max(Math.min(n,u.to),u.from)),f&&(a=Math.max(Math.min(a,f.to),f.from))}this.friction=l,this.transform=i(i({},this.transform),{},{x:n,y:a,scale:s}),l?(this.state="panning",this.velocity={x:(1/this.friction-1)*(n-this.content.x),y:(1/this.friction-1)*(a-this.content.y),scale:(1/this.friction-1)*(s-this.content.scale)},this.startAnimation()):this.endAnimation()}},{key:"startAnimation",value:function(){var t=this;this.rAF?cancelAnimationFrame(this.rAF):this.trigger("startAnimation"),this.rAF=requestAnimationFrame((function(){return t.animate()}))}},{key:"animate",value:function(){var t=this;if(this.setEdgeForce(),this.setDragForce(),this.velocity.x*=this.friction,this.velocity.y*=this.friction,this.velocity.scale*=this.friction,this.content.x+=this.velocity.x,this.content.y+=this.velocity.y,this.content.scale+=this.velocity.scale,this.isAnimating())this.setTransform();else if("pointerdown"!==this.state)return void this.endAnimation();this.rAF=requestAnimationFrame((function(){return t.animate()}))}},{key:"getBounds",value:function(t){var e=this.boundX,i=this.boundY;if(void 0!==e&&void 0!==i)return{boundX:e,boundY:i};e={from:0,to:0},i={from:0,to:0},t=t||this.transform.scale;var n=this.content.fitWidth*t,o=this.content.fitHeight*t,a=this.viewport.width,s=this.viewport.height;if(n<a){var r=S(.5*(a-n));e.from=r,e.to=r}else e.from=S(a-n);if(o<s){var l=.5*(s-o);i.from=l,i.to=l}else i.from=S(s-o);return{boundX:e,boundY:i}}},{key:"setEdgeForce",value:function(){if("decel"===this.state){var t,e,i,n,o=this.option("bounceForce"),a=this.getBounds(Math.max(this.transform.scale,this.content.scale)),s=a.boundX,r=a.boundY;if(s&&(t=this.content.x<s.from,e=this.content.x>s.to),r&&(i=this.content.y<r.from,n=this.content.y>r.to),t||e){var l=((t?s.from:s.to)-this.content.x)*o,c=this.content.x+(this.velocity.x+l)/this.friction;c>=s.from&&c<=s.to&&(l+=this.velocity.x),this.velocity.x=l,this.recalculateTransform()}if(i||n){var h=((i?r.from:r.to)-this.content.y)*o,d=this.content.y+(h+this.velocity.y)/this.friction;d>=r.from&&d<=r.to&&(h+=this.velocity.y),this.velocity.y=h,this.recalculateTransform()}}}},{key:"setDragResistance",value:function(){if("pointerdown"===this.state){var t,e,i,n,o=this.getBounds(this.dragPosition.scale),a=o.boundX,s=o.boundY;if(a&&(t=this.dragPosition.x<a.from,e=this.dragPosition.x>a.to),s&&(i=this.dragPosition.y<s.from,n=this.dragPosition.y>s.to),(t||e)&&(!t||!e)){var r=t?a.from:a.to,l=r-this.dragPosition.x;this.dragPosition.x=r-.3*l}if((i||n)&&(!i||!n)){var c=i?s.from:s.to,h=c-this.dragPosition.y;this.dragPosition.y=c-.3*h}}}},{key:"setDragForce",value:function(){"pointerdown"===this.state&&(this.velocity.x=this.dragPosition.x-this.content.x,this.velocity.y=this.dragPosition.y-this.content.y,this.velocity.scale=this.dragPosition.scale-this.content.scale)}},{key:"recalculateTransform",value:function(){this.transform.x=this.content.x+this.velocity.x/(1/this.friction-1),this.transform.y=this.content.y+this.velocity.y/(1/this.friction-1),this.transform.scale=this.content.scale+this.velocity.scale/(1/this.friction-1)}},{key:"isAnimating",value:function(){return!(!this.friction||!(Math.abs(this.velocity.x)>.05||Math.abs(this.velocity.y)>.05||Math.abs(this.velocity.scale)>.05))}},{key:"setTransform",value:function(t){var e,n,o,a,s;(t?(e=S(this.transform.x),n=S(this.transform.y),o=this.transform.scale,this.content=i(i({},this.content),{},{x:e,y:n,scale:o})):(e=S(this.content.x),n=S(this.content.y),o=this.content.scale/(this.content.width/this.content.fitWidth),this.content=i(i({},this.content),{},{x:e,y:n})),this.trigger("beforeTransform"),e=S(this.content.x),n=S(this.content.y),t&&this.option("zoom"))?(a=S(this.content.fitWidth*o),s=S(this.content.fitHeight*o),this.content.width=a,this.content.height=s,this.transform=i(i({},this.transform),{},{width:a,height:s,scale:o}),Object.assign(this.$content.style,{width:"".concat(a,"px"),height:"".concat(s,"px"),maxWidth:"none",maxHeight:"none",transform:"translate3d(".concat(e,"px, ").concat(n,"px, 0) scale(1)")})):this.$content.style.transform="translate3d(".concat(e,"px, ").concat(n,"px, 0) scale(").concat(o,")");this.trigger("afterTransform")}},{key:"endAnimation",value:function(t){cancelAnimationFrame(this.rAF),this.rAF=null,this.velocity={x:0,y:0,scale:0}
2651,this.setTransform(!0),this.state="ready",this.handleCursor(),!0!==t&&this.trigger("endAnimation")}},{key:"handleCursor",value:function(){var t=this.option("draggableClass");t&&this.option("touch")&&(1==this.option("panOnlyZoomed")&&this.content.width<=this.viewport.width&&this.content.height<=this.viewport.height&&this.transform.scale<=this.option("baseScale")?this.$container.classList.remove(t):this.$container.classList.add(t))}},{key:"detachEvents",value:function(){this.$content.removeEventListener("load",this.onLoad),this.$container.removeEventListener("wheel",this.onWheel,{passive:!1}),this.$container.removeEventListener("click",this.onClick,{passive:!1}),this.pointerTracker&&(this.pointerTracker.stop(),this.pointerTracker=null),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}},{key:"destroy",value:function(){"destroy"!==this.state&&(this.state="destroy",clearTimeout(this.updateTimer),this.updateTimer=null,cancelAnimationFrame(this.rAF),this.rAF=null,this.detachEvents(),this.detachPlugins(),this.resetDragPosition())}}]),n}(O);M.version="4.0.26",M.Plugins={};var I=function(t,e){var i=0;return function(){var n=(new Date).getTime();if(!(n-i<e))return i=n,t.apply(void 0,arguments)}},F=function(){function t(e){o(this,t),this.$container=null,this.$prev=null,this.$next=null,this.carousel=e,this.onRefresh=this.onRefresh.bind(this)}return s(t,[{key:"option",value:function(t){return this.carousel.option("Navigation.".concat(t))}},{key:"createButton",value:function(t){var e,i=this,n=document.createElement("button");n.setAttribute("title",this.carousel.localize("{{".concat(t.toUpperCase(),"}}")));var o=this.option("classNames.button")+" "+this.option("classNames.".concat(t));return(e=n.classList).add.apply(e,m(o.split(" "))),n.setAttribute("tabindex","0"),n.innerHTML=this.carousel.localize(this.option("".concat(t,"Tpl"))),n.addEventListener("click",(function(e){e.preventDefault(),e.stopPropagation(),i.carousel["slide".concat("next"===t?"Next":"Prev")]()})),n}},{key:"build",value:function(){var t;this.$container||(this.$container=document.createElement("div"),(t=this.$container.classList).add.apply(t,m(this.option("classNames.main").split(" "))),this.carousel.$container.appendChild(this.$container));this.$next||(this.$next=this.createButton("next"),this.$container.appendChild(this.$next)),this.$prev||(this.$prev=this.createButton("prev"),this.$container.appendChild(this.$prev))}},{key:"onRefresh",value:function(){var t=this.carousel.pages.length;t<=1||t>1&&this.carousel.elemDimWidth<this.carousel.wrapDimWidth&&!Number.isInteger(this.carousel.option("slidesPerPage"))?this.cleanup():(this.build(),this.$prev.removeAttribute("disabled"),this.$next.removeAttribute("disabled"),this.carousel.option("infiniteX",this.carousel.option("infinite"))||(this.carousel.page<=0&&this.$prev.setAttribute("disabled",""),this.carousel.page>=t-1&&this.$next.setAttribute("disabled","")))}},{key:"cleanup",value:function(){this.$prev&&this.$prev.remove(),this.$prev=null,this.$next&&this.$next.remove(),this.$next=null,this.$container&&this.$container.remove(),this.$container=null}},{key:"attach",value:function(){this.carousel.on("refresh change",this.onRefresh)}},{key:"detach",value:function(){this.carousel.off("refresh change",this.onRefresh),this.cleanup()}}]),t}();F.defaults={prevTpl:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M15 3l-9 9 9 9"/></svg>',nextTpl:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M9 3l9 9-9 9"/></svg>',classNames:{main:"carousel__nav",button:"carousel__button",next:"is-next",prev:"is-prev"}};var R=function(){function t(e){o(this,t),this.carousel=e,this.$list=null,this.events={change:this.onChange.bind(this),refresh:this.onRefresh.bind(this)}}return s(t,[{key:"buildList",value:function(){var t=this;if(!(this.carousel.pages.length<this.carousel.option("Dots.minSlideCount"))){var e=document.createElement("ol");return e.classList.add("carousel__dots"),e.addEventListener("click",(function(e){if("page"in e.target.dataset){e.preventDefault(),e.stopPropagation();var i=parseInt(e.target.dataset.page,10),n=t.carousel;i!==n.page&&(n.pages.length<3&&n.option("infinite")?n[0==i?"slidePrev":"slideNext"]():n.slideTo(i))}})),this.$list=e,this.carousel.$container.appendChild(e),this.carousel.$container.classList.add("has-dots"),e}}},{key:"removeList",value:function(){this.$list&&(this.$list.parentNode.removeChild(this.$list),this.$list=null),this.carousel.$container.classList.remove("has-dots")}},{key:"rebuildDots",value:function(){var t=this,e=this.$list,i=!!e,n=this.carousel.pages.length;if(n<2)i&&this.removeList();else{i||(e=this.buildList());var o=this.$list.children.length;if(o>n)for(var a=n;a<o;a++)this.$list.removeChild(this.$list.lastChild);else{for(var s=function(e){var i=document.createElement("li");i.classList.add("carousel__dot"),i.dataset.page=e,i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("title",t.carousel.localize("{{GOTO}}",[["%d",e+1]])),i.addEventListener("keydown",(function(t){var e,n=t.code;"Enter"===n||"NumpadEnter"===n?e=i:"ArrowRight"===n?e=i.nextSibling:"ArrowLeft"===n&&(e=i.previousSibling),e&&e.click()})),t.$list.appendChild(i)},r=o;r<n;r++)s(r);this.setActiveDot()}}}},{key:"setActiveDot",value:function(){if(this.$list){this.$list.childNodes.forEac
2651h((function(t){t.classList.remove("is-selected")}));var t=this.$list.childNodes[this.carousel.page];t&&t.classList.add("is-selected")}}},{key:"onChange",value:function(){this.setActiveDot()}},{key:"onRefresh",value:function(){this.rebuildDots()}},{key:"attach",value:function(){this.carousel.on(this.events)}},{key:"detach",value:function(){this.removeList(),this.carousel.off(this.events),this.carousel=null}}]),t}(),N=function(){function t(e){o(this,t),this.carousel=e,this.selectedIndex=null,this.friction=0,this.onNavReady=this.onNavReady.bind(this),this.onNavClick=this.onNavClick.bind(this),this.onNavCreateSlide=this.onNavCreateSlide.bind(this),this.onTargetChange=this.onTargetChange.bind(this)}return s(t,[{key:"addAsTargetFor",value:function(t){this.target=this.carousel,this.nav=t,this.attachEvents()}},{key:"addAsNavFor",value:function(t){this.target=t,this.nav=this.carousel,this.attachEvents()}},{key:"attachEvents",value:function(){this.nav.options.initialSlide=this.target.options.initialPage,this.nav.on("ready",this.onNavReady),this.nav.on("createSlide",this.onNavCreateSlide),this.nav.on("Panzoom.click",this.onNavClick),this.target.on("change",this.onTargetChange),this.target.on("Panzoom.afterUpdate",this.onTargetChange)}},{key:"onNavReady",value:function(){this.onTargetChange(!0)}},{key:"onNavClick",value:function(t,e,i){var n=i.target.closest(".carousel__slide");if(n){i.stopPropagation();var o=parseInt(n.dataset.index,10),a=this.target.findPageForSlide(o);this.target.page!==a&&this.target.slideTo(a,{friction:this.friction}),this.markSelectedSlide(o)}}},{key:"onNavCreateSlide",value:function(t,e){e.index===this.selectedIndex&&this.markSelectedSlide(e.index)}},{key:"onTargetChange",value:function(){var t=this.target.pages[this.target.page].indexes[0],e=this.nav.findPageForSlide(t);this.nav.slideTo(e),this.markSelectedSlide(t)}},{key:"markSelectedSlide",value:function(t){this.selectedIndex=t,m(this.nav.slides).filter((function(t){return t.$el&&t.$el.classList.remove("is-nav-selected")}));var e=this.nav.slides[t];e&&e.$el&&e.$el.classList.add("is-nav-selected")}},{key:"attach",value:function(t){var e=t.options.Sync;(e.target||e.nav)&&(e.target?this.addAsNavFor(e.target):e.nav&&this.addAsTargetFor(e.nav),this.friction=e.friction)}},{key:"detach",value:function(){this.nav&&(this.nav.off("ready",this.onNavReady),this.nav.off("Panzoom.click",this.onNavClick),this.nav.off("createSlide",this.onNavCreateSlide)),this.target&&(this.target.off("Panzoom.afterUpdate",this.onTargetChange),this.target.off("change",this.onTargetChange))}}]),t}();N.defaults={friction:.92};var D={Navigation:F,Dots:R,Sync:N},B={slides:[],preload:0,slidesPerPage:"auto",initialPage:null,initialSlide:null,friction:.92,center:!0,infinite:!0,fill:!0,dragFree:!1,prefix:"",classNames:{viewport:"carousel__viewport",track:"carousel__track",slide:"carousel__slide",slideSelected:"is-selected"},l10n:{NEXT:"Next slide",PREV:"Previous slide",GOTO:"Go to slide #%d"}},W=function(t){l(n,t);var e=f(n);function n(t){var i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(o(this,n),a=k(!0,{},B,a),(i=e.call(this,a)).state="init",i.$container=t,!(i.$container instanceof HTMLElement))throw new Error("No root element provided");return i.slideNext=I(i.slideNext.bind(d(i)),250),i.slidePrev=I(i.slidePrev.bind(d(i)),250),i.init(),t.__Carousel=d(i),i}return s(n,[{key:"init",value:function(){this.pages=[],this.page=this.pageIndex=null,this.prevPage=this.prevPageIndex=null,this.attachPlugins(n.Plugins),this.trigger("init"),this.initLayout(),this.initSlides(),this.updateMetrics(),this.$track&&this.pages.length&&(this.$track.style.transform="translate3d(".concat(-1*this.pages[this.page].left,"px, 0px, 0) scale(1)")),this.manageSlideVisiblity(),this.initPanzoom(),this.state="ready",this.trigger("ready")}},{key:"initLayout",value:function(){var t,e,i,n,o=this.option("prefix"),a=this.option("classNames");(this.$viewport=this.option("viewport")||this.$container.querySelector(".".concat(o).concat(a.viewport)),this.$viewport)||(this.$viewport=document.createElement("div"),(t=this.$viewport.classList).add.apply(t,m((o+a.viewport).split(" "))),(e=this.$viewport).append.apply(e,m(this.$container.childNodes)),this.$container.appendChild(this.$viewport));(this.$track=this.option("track")||this.$container.querySelector(".".concat(o).concat(a.track)),this.$track)||(this.$track=document.createElement("div"),(i=this.$track.classList).add.apply(i,m((o+a.track).split(" "))),(n=this.$track).append.apply(n,m(this.$viewport.childNodes)),this.$viewport.appendChild(this.$track))}},{key:"initSlides",value:function(){var t=this;this.slides=[],this.$viewport.querySelectorAll(".".concat(this.option("prefix")).c
2651oncat(this.option("classNames.slide"))).forEach((function(e){var i={$el:e,isDom:!0};t.slides.push(i),t.trigger("createSlide",i,t.slides.length)})),Array.isArray(this.options.slides)&&(this.slides=k(!0,m(this.slides),this.options.slides))}},{key:"updateMetrics",value:function(){var t,e=this,n=0,o=[];this.slides.forEach((function(i,a){var s=i.$el,r=i.isDom||!t?e.getSlideMetrics(s):t;i.index=a,i.width=r,i.left=n,t=r,n+=r,o.push(a)}));var a=Math.max(this.$track.offsetWidth,S(this.$track.getBoundingClientRect().width)),s=getComputedStyle(this.$track);a-=parseFloat(s.paddingLeft)+parseFloat(s.paddingRight),this.contentWidth=n,this.viewportWidth=a;var r=[],l=this.option("slidesPerPage");if(Number.isInteger(l)&&n>a)for(var c=0;c<this.slides.length;c+=l)r.push({indexes:o.slice(c,c+l),slides:this.slides.slice(c,c+l)});else for(var h=0,d=0,u=0;u<this.slides.length;u+=1){var f=this.slides[u];(!r.length||d+f.width>a)&&(r.push({indexes:[],slides:[]}),h=r.length-1,d=0),d+=f.width,r[h].indexes.push(u),r[h].slides.push(f)}var v=this.option("center"),p=this.option("fill");r.forEach((function(t,i){t.index=i,t.width=t.slides.reduce((function(t,e){return t+e.width}),0),t.left=t.slides[0].left,v&&(t.left+=.5*(a-t.width)*-1),p&&!e.option("infiniteX",e.option("infinite"))&&n>a&&(t.left=Math.max(t.left,0),t.left=Math.min(t.left,n-a))}));var g,y=[];r.forEach((function(t){var e=i({},t);g&&e.left===g.left?(g.width+=e.width,g.slides=[].concat(m(g.slides),m(e.slides)),g.indexes=[].concat(m(g.indexes),m(e.indexes))):(e.index=y.length,g=e,y.push(e))})),this.pages=y;var b=this.page;if(null===b){var x=this.option("initialSlide");b=null!==x?this.findPageForSlide(x):parseInt(this.option("initialPage",0),10)||0,y[b]||(b=y.length&&b>y.length?y[y.length-1].index:0),this.page=b,this.pageIndex=b}this.updatePanzoom(),this.trigger("refresh")}},{key:"getSlideMetrics",value:function(t){if(!t){var e,i,n=this.slides[0];if((t=document.createElement("div")).dataset.isTestEl=1,t.style.visibility="hidden",(e=t.classList).add.apply(e,m((this.option("prefix")+this.option("classNames.slide")).split(" "))),n.customClass)(i=t.classList).add.apply(i,m(n.customClass.split(" ")));this.$track.prepend(t)}var o=Math.max(t.offsetWidth,S(t.getBoundingClientRect().width)),a=t.currentStyle||window.getComputedStyle(t);return o=o+(parseFloat(a.marginLeft)||0)+(parseFloat(a.marginRight)||0),t.dataset.isTestEl&&t.remove(),o}},{key:"findPageForSlide",value:function(t){t=parseInt(t,10)||0;var e=this.pages.find((function(e){return e.indexes.indexOf(t)>-1}));return e?e.index:null}},{key:"slideNext",value:function(){this.slideTo(this.pageIndex+1)}},{key:"slidePrev",value:function(){this.slideTo(this.pageIndex-1)}},{key:"slideTo",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=e.x,n=void 0===i?-1*this.setPage(t,!0):i,o=e.y,a=void 0===o?0:o,s=e.friction,r=void 0===s?this.option("friction"):s;this.Panzoom.content.x===n&&!this.Panzoom.velocity.x&&r||(this.Panzoom.panTo({x:n,y:a,friction:r,ignoreBounds:!0}),"ready"===this.state&&"ready"===this.Panzoom.state&&this.trigger("settle"))}},{key:"initPanzoom",value:function(){var t=this;this.Panzoom&&this.Panzoom.destroy();var e=k(!0,{},{content:this.$track,wrapInner:!1,resizeParent:!1,zoom:!1,click:!1,lockAxis:"x",x:this.pages.length?-1*this.pages[this.page].left:0,centerOnStart:!1,textSelection:function(){return t.option("textSelection",!1)},panOnlyZoomed:function(){return this.content.width<=this.viewport.width}},this.option("Panzoom"));this.Panzoom=new M(this.$container,e),this.Panzoom.on({"*":function(e){for(var i=arguments.length,n=new Array(i>1?i-1:0),o=1;o<i;o++)n[o-1]=arguments[o];return t.trigger.apply(t,["Panzoom.".concat(e)].concat(n))},afterUpdate:function(){t.updatePage()},beforeTransform:this.onBeforeTransform.bind(this),touchEnd:this.onTouchEnd.bind(this),endAnimation:function(){t.trigger("settle")}}),this.updateMetrics(),this.manageSlideVisiblity()}},{key:"updatePanzoom",value:function(){this.Panzoom&&(this.Panzoom.content=i(i({},this.Panzoom.content),{},{fitWidth:this.contentWidth,origWidth:this.contentWidth,width:this.contentWidth}
2651),this.pages.length>1&&this.option("infiniteX",this.option("infinite"))?this.Panzoom.boundX=null:this.pages.length&&(this.Panzoom.boundX={from:-1*this.pages[this.pages.length-1].left,to:-1*this.pages[0].left}),this.option("infiniteY",this.option("infinite"))?this.Panzoom.boundY=null:this.Panzoom.boundY={from:0,to:0},this.Panzoom.handleCursor())}},{key:"manageSlideVisiblity",value:function(){var t=this,e=this.contentWidth,i=this.viewportWidth,n=this.Panzoom?-1*this.Panzoom.content.x:this.pages.length?this.pages[this.page].left:0,o=this.option("preload"),a=this.option("infiniteX",this.option("infinite")),s=parseFloat(getComputedStyle(this.$viewport,null).getPropertyValue("padding-left")),r=parseFloat(getComputedStyle(this.$viewport,null).getPropertyValue("padding-right"));this.slides.forEach((function(l){var c,h,d=0;c=n-s,h=n+i+r,c-=o*(i+s+r),h+=o*(i+s+r);var u=l.left+l.width>c&&l.left<h;c=n+e-s,h=n+e+i+r,c-=o*(i+s+r);var f=a&&l.left+l.width>c&&l.left<h;c=n-e-s,h=n-e+i+r,c-=o*(i+s+r);var v=a&&l.left+l.width>c&&l.left<h;f||u||v?(t.createSlideEl(l),u&&(d=0),f&&(d=-1),v&&(d=1),l.left+l.width>n&&l.left<=n+i+r&&(d=0)):t.removeSlideEl(l),l.hasDiff=d}));var l=0,c=0;this.slides.forEach((function(t,i){var n=0;t.$el?(i!==l||t.hasDiff?n=c+t.hasDiff*e:c=0,t.$el.style.left=Math.abs(n)>.1?"".concat(c+t.hasDiff*e,"px"):"",l++):c+=t.width})),this.markSelectedSlides()}},{key:"createSlideEl",value:function(t){var e;if(t){if(!t.$el){var i,n=document.createElement("div");if(n.dataset.index=t.index,(e=n.classList).add.apply(e,m((this.option("prefix")+this.option("classNames.slide")).split(" "))),t.customClass)(i=n.classList).add.apply(i,m(t.customClass.split(" ")));t.html&&(n.innerHTML=t.html);var o=[];this.slides.forEach((function(t,e){t.$el&&o.push(e)}));var a=t.index,s=null;if(o.length){var r=o.reduce((function(t,e){return Math.abs(e-a)<Math.abs(t-a)?e:t}));s=this.slides[r]}return this.$track.insertBefore(n,s&&s.$el?s.index<t.index?s.$el.nextSibling:s.$el:null),t.$el=n,this.trigger("createSlide",t,a),t}var l,c=t.$el.dataset.index;c&&parseInt(c,10)===t.index||(t.$el.dataset.index=t.index,t.$el.querySelectorAll("[data-lazy-srcset]").forEach((function(t){t.srcset=t.dataset.lazySrcset})),t.$el.querySelectorAll("[data-lazy-src]").forEach((function(t){var e=t.dataset.lazySrc;t instanceof HTMLImageElement?t.src=e:t.style.backgroundImage="url('".concat(e,"')")})),(l=t.$el.dataset.lazySrc)&&(t.$el.style.backgroundImage="url('".concat(l,"')")),t.state="ready")}}},{key:"removeSlideEl",value:function(t){t.$el&&!t.isDom&&(this.trigger("removeSlide",t),t.$el.remove(),t.$el=null)}},{key:"markSelectedSlides",value:function(){var t=this,e=this.option("classNames.slideSelected"),i="aria-hidden";this.slides.forEach((function(n,o){var a=n.$el;if(a){var s=t.pages[t.page];s&&s.indexes&&s.indexes.indexOf(o)>-1?(e&&!a.classList.contains(e)&&(a.classList.add(e),t.trigger("selectSlide",n)),a.removeAttribute(i)):(e&&a.classList.contains(e)&&(a.classList.remove(e),t.trigger("unselectSlide",n)),a.setAttribute(i,!0))}}))}},{key:"updatePage",value:function(){this.updateMetrics(),this.slideTo(this.page,{friction:0})}},{key:"onBeforeTransform",value:function(){this.option("infiniteX",this.option("infinite"))&&this.manageInfiniteTrack(),this.manageSlideVisiblity()}},{key:"manageInfiniteTrack",value:function(){var t=this.contentWidth,e=this.viewportWidth;if(!(!this.option("infiniteX",this.option("infinite"))||this.pages.length<2||t<e)){var i=this.Panzoom,n=!1;return i.content.x<-1*(t-e)&&(i.content.x+=t,this.pageIndex=this.pageIndex-this.pages.length,n=!0),i.content.x>e&&(i.content.x-=t,this.pageIndex=this.pageIndex+this.pages.length,n=!0),n&&"pointerdown"===i.state&&i.resetDragPosition(),n}}},{key:"onTouchEnd",value:function(t,e){var i=this.option("dragFree");if(!i&&this.pages.length>1&&t.dragOffset.time<350&&Math.abs(t.dragOffset.y)<1&&Math.abs(t.dragOffset.x)>5)this[t.dragOffset.x<0?"slideNext":"slidePrev"]();else if(i){var n=g(this.getPageFromPosition(-1*t.transform.x),2)[1];this.setPage(n)}else this.slideToClosest()}},{key:"slideToClosest",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.getPageFromPosition(-1*this.Panzoom.content.x),i=g(e,2),n=i[1];this.slideTo(n,t)}},{key:"getPageFromPosition",value:function(t){var e=this.pages.length;this.option("center")&&(t+=.5*this.viewportWidth);var i=Math.floor(t/this.contentWidth);t-=i*this.contentWidth;var n=this.slides.find((function(e){return e.left<=t&&e.left+e.width>t}));if(n){var o=this.findPageForSlide(n.index);return[o,o+i*e]}return[0,0]}},{key:"setPage",value:function(t,e){var i=0,n=parseInt(t,10)||0,o=this.page,a=this.pageIndex,s=this.pages.length,r=this.contentWidth,l=this.viewportWidth;if(t=(n%s+s)%s,this.option("infiniteX",this.option("infinite"))&&r>l){var c=Math.floor(n/s)||0,h=r;if(i=this.pages[t].left+c*h,!0===e&&s>2){var d=-1*this.Panzoom.content.x,u=i-h,f=i+h,v=Math.abs(d-i),p=Math.abs(d-u),g=Math.abs(d-f);g<v&&g<=p?(i=f,n+=s):p<v&&p<g&&(i=u,n-=s)}}else t=n=Math.max(0,Math.min(n,s-1)),i=this.pages.length?this.pages[t].left:0;return this.page=t,this.pageIndex=n,null!==o&&t!==o&&(this.prevPage=o,this.prevPageIndex=a,this.trigger("change",t,o)),i}},{key:"destroy",value:function(){var t=this;
2651this.state="destroy",this.slides.forEach((function(e){t.removeSlideEl(e)})),this.slides=[],this.Panzoom.destroy(),this.detachPlugins()}}]),n}(O);W.version="4.0.26",W.Plugins=D;var H=!("undefined"==typeof window||!window.document||!window.document.createElement),j=null,X=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden])","iframe","object","embed","video","audio","[contenteditable]",'[tabindex]:not([tabindex^="-"]):not([disabled]):not([aria-hidden])'],q=function(t){if(t&&H){null===j&&document.createElement("div").focus({get preventScroll(){return j=!0,!1}});try{if(t.setActive)t.setActive();else if(j)t.focus({preventScroll:!0});else{var e=window.pageXOffset||document.body.scrollTop,i=window.pageYOffset||document.body.scrollLeft;t.focus(),document.body.scrollTo({top:e,left:i,behavior:"auto"})}}catch(t){}}},U=function(){function t(e){o(this,t),this.fancybox=e,this.viewport=null,this.pendingUpdate=null;for(var i=0,n=["onReady","onResize","onTouchstart","onTouchmove"];i<n.length;i++){var a=n[i];this[a]=this[a].bind(this)}}return s(t,[{key:"onReady",value:function(){var t=window.visualViewport;t&&(this.viewport=t,this.startY=0,t.addEventListener("resize",this.onResize),this.updateViewport()),window.addEventListener("touchstart",this.onTouchstart,{passive:!1}),window.addEventListener("touchmove",this.onTouchmove,{passive:!1}),window.addEventListener("wheel",this.onWheel,{passive:!1})}},{key:"onResize",value:function(){this.updateViewport()}},{key:"updateViewport",value:function(){var t=this.fancybox,e=this.viewport,i=e.scale||1,n=t.$container;if(n){var o="",a="",s="";i-1>.1&&(o="".concat(e.width*i,"px"),a="".concat(e.height*i,"px"),s="translate3d(".concat(e.offsetLeft,"px, ").concat(e.offsetTop,"px, 0) scale(").concat(1/i,")")),n.style.width=o,n.style.height=a,n.style.transform=s}}},{key:"onTouchstart",value:function(t){this.startY=t.touches?t.touches[0].screenY:t.screenY}},{key:"onTouchmove",value:function(t){var e=this.startY,i=window.innerWidth/window.document.documentElement.clientWidth;if(t.cancelable&&!(t.touches.length>1||1!==i)){var n=C(t.composedPath()[0]);if(n){var o=window.getComputedStyle(n),a=parseInt(o.getPropertyValue("height"),10),s=t.touches?t.touches[0].screenY:t.screenY,r=e<=s&&0===n.scrollTop,l=e>=s&&n.scrollHeight-n.scrollTop===a;(r||l)&&t.preventDefault()}else t.preventDefault()}}},{key:"onWheel",value:function(t){C(t.composedPath()[0])||t.preventDefault()}},{key:"cleanup",value:function(){this.pendingUpdate&&(cancelAnimationFrame(this.pendingUpdate),this.pendingUpdate=null);var t=this.viewport;t&&(t.removeEventListener("resize",this.onResize),this.viewport=null),window.removeEventListener("touchstart",this.onTouchstart,!1),window.removeEventListener("touchmove",this.onTouchmove,!1),window.removeEventListener("wheel",this.onWheel,{passive:!1})}},{key:"attach",value:function(){this.fancybox.on("initLayout",this.onReady)}},{key:"detach",value:function(){this.fancybox.off("initLayout",this.onReady),this.cleanup()}}]),t}(),Y=function(){function t(e){o(this,t),this.fancybox=e,this.$container=null,this.state="init";for(var i=0,n=["onPrepare","onClosing","onKeydown"];i<n.length;i++){var a=n[i];this[a]=this[a].bind(this)}this.events={prepare:this.onPrepare,closing:this.onClosing,keydown:this.onKeydown}}return s(t,[{key:"onPrepare",value:function(){this.getSlides().length<this.fancybox.option("Thumbs.minSlideCount")?this.state="disabled":!0===this.fancybox.option("Thumbs.autoStart")&&this.fancybox.Carousel.Panzoom.content.height>=this.fancybox.option("Thumbs.minScreenHeight")&&this.build()}},{key:"onClosing",value:function(){this.Carousel&&this.Carousel.Panzoom.detachEvents()}},{key:"onKeydown",value:function(t,e){e===t.option("Thumbs.key")&&this.toggle()}},{key:"build",value:function(){var t=this;if(!this.$container){var e=document.createElement("div");e.classList.add("fancybox__thumbs"),this.fancybox.$carousel.parentNode.insertBefore(e,this.fancybox.$carousel.nextSibling),this.Carousel=new W(e,k(!0,{Dots:!1,Navigation:!1,Sync:{friction:0},infinite:!1,center:!0,fill:!0,dragFree:!0,slidesPerPage:1,preload:1},this.fancybox.option("Thumbs.Carousel"),{Sync:{target:this.fancybox.Carousel},slides:this.getSlides()})),this.Carousel.Panzoom.on("wheel",(function(e,i){i.preventDefault(),t.fancybox[i.deltaY<0?"prev":"next"]()})),this.$container=e,this.state="visible"}}},{key:"getSlides",value:function(){var t,e=[],i=x(this.fancybox.items);try{for(i.s();!(t=i.n()).done;){var n=t.value,o=n.thumb;o&&e.push({html:'<div class="fancybox__thumb" style="background-image:url(\''.concat(o,"')\"></div>"),customClass:"has-thumb has-".concat(n.type||"image")})}}catch(t){i.e(t)}finally{i.f()}return e}},{key:"toggle",value:function(){"visible"===this.state?this.hide():"hidden"===this.state?this.show():this.build()}},{key:"show",value:function(){"hidden"===this.state&&(this.$container.style.display="",this.Carousel.Panzoom.attachEvents(),this.state="visible")}},{key:"hide",value:function(){"visible"===this.state&&(this.Carousel.Panzoom.detachEvents(),this.$container.style.display="none",this.state="hidden")}},{key:"cleanup",value:function(){this.Carousel&&(this.Carousel.destroy(),this.Carousel=null),this.$container&&(this.$container.remove(),this.$container=null),this.state="init"}},{key:"attach",value:function(){this.fancybox.on(this.events)}},{key:"detach",value:function(){this.fancybox.off(this.events),this.cleanup()}}]),t}();Y.defaults={minSlideCount:2,minScreenHeight:500,autoStart:!0,key:"t",Carousel:{}};var V=function(t,e){for(var i=new URL(t),n=new URLSearchParams(i.search),o=new URLSearchParams,a=0,s=[].concat(m(n),m(Object.entries(e)));a<s.length;a++){var r=g(s[a],2),l=r[0],c=r[1];"t"===l?o.set("start",parseInt(c)):o.set(l,c)}o=o.toString();var h=t.match(/#t=((.*)?\d+s)/);return h&&(o+="#t=".concat(h[1])),o},Z={video:{autoplay:!0,ratio:16/9},youtube:{autohide:1,fs:1,rel:0,hd:1,wmode:"transparent",enablejsapi:1,html5:1},vimeo:{hd:1,show_title:1,show_byline:1,show_portrait:0,fullscreen:1},html5video:{tpl:'<video class="fancybox__html5video" playsinline controls controlsList="nodownload" poster="{{poster}}">\n  <source src="{{src}}" type="{{format}}" />Sorry, your browser doesn\'t support embedded videos.</video>',format:""}}
2651,G=function(){function t(e){o(this,t),this.fancybox=e;for(var i=0,n=["onInit","onReady","onCreateSlide","onRemoveSlide","onSelectSlide","onUnselectSlide","onRefresh","onMessage"];i<n.length;i++){var a=n[i];this[a]=this[a].bind(this)}this.events={init:this.onInit,ready:this.onReady,"Carousel.createSlide":this.onCreateSlide,"Carousel.removeSlide":this.onRemoveSlide,"Carousel.selectSlide":this.onSelectSlide,"Carousel.unselectSlide":this.onUnselectSlide,"Carousel.refresh":this.onRefresh}}return s(t,[{key:"onInit",value:function(){var t,e=x(this.fancybox.items);try{for(e.s();!(t=e.n()).done;){var i=t.value;this.processType(i)}}catch(t){e.e(t)}finally{e.f()}}},{key:"processType",value:function(t){if(t.html)return t.src=t.html,t.type="html",void delete t.html;var e=t.src||"",i=t.type||this.fancybox.options.type,n=null;if(!e||"string"==typeof e){if(n=e.match(/(?:youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(?:watch\?(?:.*&)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(?:.*)|[\w-]{11}|\?listType=(?:.*)&list=(?:.*))(?:.*)/i)){var o=V(e,this.fancybox.option("Html.youtube")),a=encodeURIComponent(n[1]);t.videoId=a,t.src="https://www.youtube-nocookie.com/embed/".concat(a,"?").concat(o),t.thumb=t.thumb||"https://i.ytimg.com/vi/".concat(a,"/mqdefault.jpg"),t.vendor="youtube",i="video"}else if(n=e.match(/^.+vimeo.com\/(?:\/)?([\d]+)(.*)?/)){var s=V(e,this.fancybox.option("Html.vimeo")),r=encodeURIComponent(n[1]);t.videoId=r,t.src="https://player.vimeo.com/video/".concat(r,"?").concat(s),t.vendor="vimeo",i="video"}else(n=e.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:(?:(?:maps\/(?:place\/(?:.*)\/)?\@(.*),(\d+.?\d+?)z))|(?:\?ll=))(.*)?/i))?(t.src="//maps.google.".concat(n[1],"/?ll=").concat((n[2]?n[2]+"&z="+Math.floor(n[3])+(n[4]?n[4].replace(/^\//,"&"):""):n[4]+"").replace(/\?/,"&"),"&output=").concat(n[4]&&n[4].indexOf("layer=c")>0?"svembed":"embed"),i="map"):(n=e.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:maps\/search\/)(.*)/i))&&(t.src="//maps.google.".concat(n[1],"/maps?q=").concat(n[2].replace("query=","q=").replace("api=1",""),"&output=embed"),i="map");i||("#"===e.charAt(0)?i="inline":(n=e.match(/\.(mp4|mov|ogv|webm)((\?|#).*)?$/i))?(i="html5video",t.format=t.format||"video/"+("ogv"===n[1]?"ogg":n[1])):e.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i)?i="image":e.match(/\.(pdf)((\?|#).*)?$/i)&&(i="pdf")),t.type=i||this.fancybox.option("defaultType","image"),"html5video"!==i&&"video"!==i||(t.video=k({},this.fancybox.option("Html.video"),t.video),t._width&&t._height?t.ratio=parseFloat(t._width)/parseFloat(t._height):t.ratio=t.ratio||t.video.ratio||Z.video.ratio)}}},{key:"onReady",value:function(){var t=this;this.fancybox.Carousel.slides.forEach((function(e){e.$el&&(t.setContent(e),e.index===t.fancybox.getSlide().index&&t.playVideo(e))}))}},{key:"onCreateSlide",value:function(t,e,i){"ready"===this.fancybox.state&&this.setContent(i)}},{key:"loadInlineContent",value:function(t){var e;if(t.src instanceof HTMLElement)e=t.src;else if("string"==typeof t.src){var i=t.src.split("#",2),n=2===i.length&&""===i[0]?i[1]:i[0];e=document.getElementById(n)}if(e){if("clone"===t.type||e.$placeHolder){var o=(e=e.cloneNode(!0)).getAttribute("id");o=o?"".concat(o,"--clone"):"clone-".concat(this.fancybox.id,"-").concat(t.index),e.setAttribute("id",o)}else{var a=document.createElement("div");a.classList.add("fancybox-placeholder"),e.parentNode.insertBefore(a,e),e.$placeHolder=a}this.fancybox.setContent(t,e)}else this.fancybox.setError(t,"{{ELEMENT_NOT_FOUND}}")}},{key:"loadAjaxContent",value:function(t){var e=this.fancybox,i=new XMLHttpRequest;e.showLoading(t),i.onreadystatechange=function(){i.readyState===XMLHttpRequest.DONE&&"ready"===e.state&&(e.hideLoading(t),200===i.status?e.setContent(t,i.responseText):e.setError(t,404===i.status?"{{AJAX_NOT_FOUND}}":"{{AJAX_FORBIDDEN}}"))},i.open("GET",t.src),i.setRequestHeader("X-Requested-With","XMLHttpRequest"),i.send(t.ajax||null),t.xhr=i}},{key:"loadIframeContent",value:function(t){var e=this,i=this.fancybox,n=document.createElement("iframe");
2651if(n.className="fancybox__iframe",n.setAttribute("id","fancybox__iframe_".concat(i.id,"_").concat(t.index)),n.setAttribute("allow","autoplay; fullscreen"),n.setAttribute("scrolling","auto"),t.$iframe=n,"iframe"!==t.type||!1===t.preload)return n.setAttribute("src",t.src),this.fancybox.setContent(t,n),void this.resizeIframe(t);i.showLoading(t);var o=document.createElement("div");o.style.visibility="hidden",this.fancybox.setContent(t,o),o.appendChild(n),n.onerror=function(){i.setError(t,"{{IFRAME_ERROR}}")},n.onload=function(){i.hideLoading(t);var o=!1;n.isReady||(n.isReady=!0,o=!0),n.src.length&&(n.parentNode.style.visibility="",e.resizeIframe(t),o&&i.revealContent(t))},n.setAttribute("src",t.src)}},{key:"setAspectRatio",value:function(t){var e=t.$content,i=t.ratio;if(e){var n=t._width,o=t._height;if(i||n&&o){Object.assign(e.style,{width:n&&o?"100%":"",height:n&&o?"100%":"",maxWidth:"",maxHeight:""});var a=e.offsetWidth,s=e.offsetHeight;if(o=o||s,(n=n||a)>a||o>s){var r=Math.min(a/n,s/o);n*=r,o*=r}Math.abs(n/o-i)>.01&&(i<n/o?n=o*i:o=n/i),Object.assign(e.style,{width:"".concat(n,"px"),height:"".concat(o,"px")})}}}},{key:"resizeIframe",value:function(t){var e=t.$iframe;if(e){var i=t._width||0,n=t._height||0;i&&n&&(t.autoSize=!1);var o=e.parentNode,a=o&&o.style;if(!1!==t.preload&&!1!==t.autoSize&&a)try{var s=window.getComputedStyle(o),r=parseFloat(s.paddingLeft)+parseFloat(s.paddingRight),l=parseFloat(s.paddingTop)+parseFloat(s.paddingBottom),c=e.contentWindow.document,h=c.getElementsByTagName("html")[0],d=c.body;a.width="",d.style.overflow="hidden",i=i||h.scrollWidth+r,a.width="".concat(i,"px"),d.style.overflow="",a.flex="0 0 auto",a.height="".concat(d.scrollHeight,"px"),n=h.scrollHeight+l}catch(t){}if(i||n){var u={flex:"0 1 auto"};i&&(u.width="".concat(i,"px")),n&&(u.height="".concat(n,"px")),Object.assign(a,u)}}}},{key:"onRefresh",value:function(t,e){var i=this;e.slides.forEach((function(t){t.$el&&(t.$iframe&&i.resizeIframe(t),t.ratio&&i.setAspectRatio(t))}))}},{key:"setContent",value:function(t){if(t&&!t.isDom){switch(t.type){case"html":this.fancybox.setContent(t,t.src);break;case"html5video":this.fancybox.setContent(t,this.fancybox.option("Html.html5video.tpl").replace(/\{\{src\}\}/gi,t.src).replace("{{format}}",t.format||t.html5video&&t.html5video.format||"").replace("{{poster}}",t.poster||t.thumb||""));break;case"inline":case"clone":this.loadInlineContent(t);break;case"ajax":this.loadAjaxContent(t);break;case"pdf":case"video":case"map":t.preload=!1;case"iframe":this.loadIframeContent(t)}t.ratio&&this.setAspectRatio(t)}}},{key:"onSelectSlide",value:function(t,e,i){"ready"===t.state&&this.playVideo(i)}},{key:"playVideo",value:function(t){if("html5video"===t.type&&t.video.autoplay)try{var e=t.$el.querySelector("video");if(e){var i=e.play();void 0!==i&&i.then((function(){})).catch((function(t){e.muted=!0,e.play()}))}}catch(t){}if("video"===t.type&&t.$iframe&&t.$iframe.contentWindow){!function e(){if("done"===t.state&&t.$iframe&&t.$iframe.contentWindow){var i;if(t.$iframe.isReady)return t.video&&t.video.autoplay&&(i="youtube"==t.vendor?{event:"command",func:"playVideo"}:{method:"play",value:"true"}),void(i&&t.$iframe.contentWindow.postMessage(JSON.stringify(i),"*"));"youtube"===t.vendor&&(i={event:"listening",id:t.$iframe.getAttribute("id")},t.$iframe.contentWindow.postMessage(JSON.stringify(i),"*"))}t.poller=setTimeout(e,250)}()}}},{key:"onUnselectSlide",value:function(t,e,i){if("html5video"!==i.type){var n=!1;"vimeo"==i.vendor?n={method:"pause",value:"true"}:"youtube"===i.vendor&&(n={event:"command",func:"pauseVideo"}),n&&i.$iframe&&i.$iframe.contentWindow&&i.$iframe.contentWindow.postMessage(JSON.stringify(n),"*"),clearTimeout(i.poller)}else try{i.$el.querySelector("video").pause()}catch(t){}}},{key:"onRemoveSlide",value:function(t,e,i){i.xhr&&(i.xhr.abort(),i.xhr=null),i.$iframe&&(i.$iframe.onload=i.$iframe.onerror=null,i.$iframe.src="//about:blank",i.$iframe=null);var n=i.$content;"inline"===i.type&&n&&(n.classList.remove("fancybox__content"),"none"!==n.style.display&&(n.style.display="none")),i.$closeButton&&(i.$closeButton.remove(),i.$closeButton=null);var o=n&&n.$placeHolder;o&&(o.parentNode.insertBefore(n,o),o.remove(),n.$placeHolder=null)}},{key:"onMessage",value:function(t){try{var e=JSON.parse(t.data);if("https://player.vimeo.com"===t.origin){if("ready"===e.event){var i,n=x(document.getElementsByClassName("fancybox__iframe"));try{for(n.s();!(i=n.n()).done;){var o=i.value;o.contentWindow===t.source&&(o.isReady=1)}}catch(t){n.e(t)}finally{n.f()}}}else"https://www.youtube-nocookie.com"===t.origin&&"onReady"===e.event&&(document.getElementById(e.id).isReady=1)}catch(t){}}},{key:"attach",value:function(){this.fancybox.on(this.events),window.addEventListener("message",this.onMessage,!1)}},{key:"detach",value:function(){this.fancybox.off(this.events),window.removeEventListener("message",this.onMessage,!1)}}]),t}();G.defaults=Z;var K=function(){function t(e){o(this,t),this.fancybox=e;for(var i=0,n=["onReady","onClosing","onDone","onPageChange","onCreateSlide","onRemoveSlide","onImageStatusChange"];
2651i<n.length;i++){var a=n[i];this[a]=this[a].bind(this)}this.events={ready:this.onReady,closing:this.onClosing,done:this.onDone,"Carousel.change":this.onPageChange,"Carousel.createSlide":this.onCreateSlide,"Carousel.removeSlide":this.onRemoveSlide}}return s(t,[{key:"onReady",value:function(){var t=this;this.fancybox.Carousel.slides.forEach((function(e){e.$el&&t.setContent(e)}))}},{key:"onDone",value:function(t,e){this.handleCursor(e)}},{key:"onClosing",value:function(t){clearTimeout(this.clickTimer),this.clickTimer=null,t.Carousel.slides.forEach((function(t){t.$image&&(t.state="destroy"),t.Panzoom&&t.Panzoom.detachEvents()})),"closing"===this.fancybox.state&&this.canZoom(t.getSlide())&&this.zoomOut()}},{key:"onCreateSlide",value:function(t,e,i){"ready"===this.fancybox.state&&this.setContent(i)}},{key:"onRemoveSlide",value:function(t,e,i){i.$image&&(i.$el.classList.remove(t.option("Image.canZoomInClass")),i.$image.remove(),i.$image=null),i.Panzoom&&(i.Panzoom.destroy(),i.Panzoom=null),i.$el&&i.$el.dataset&&delete i.$el.dataset.imageFit}},{key:"setContent",value:function(t){var e=this;if(!(t.isDom||t.html||t.type&&"image"!==t.type||t.$image)){t.type="image",t.state="loading";var i=document.createElement("div");i.style.visibility="hidden";var n=document.createElement("img");n.addEventListener("load",(function(i){i.stopImmediatePropagation(),e.onImageStatusChange(t)})),n.addEventListener("error",(function(){e.onImageStatusChange(t)})),n.src=t.src,n.alt="",n.draggable=!1,n.classList.add("fancybox__image"),t.srcset&&n.setAttribute("srcset",t.srcset),t.sizes&&n.setAttribute("sizes",t.sizes),t.$image=n;var o=this.fancybox.option("Image.wrap");if(o){var a=document.createElement("div");a.classList.add("string"==typeof o?o:"fancybox__image-wrap"),a.appendChild(n),i.appendChild(a),t.$wrap=a}else i.appendChild(n);t.$el.dataset.imageFit=this.fancybox.option("Image.fit"),this.fancybox.setContent(t,i),n.complete||n.error?this.onImageStatusChange(t):this.fancybox.showLoading(t)}}},{key:"onImageStatusChange",value:function(t){var e=this,i=t.$image;i&&"loading"===t.state&&(i.complete&&i.naturalWidth&&i.naturalHeight?(this.fancybox.hideLoading(t),"contain"===this.fancybox.option("Image.fit")&&this.initSlidePanzoom(t),t.$el.addEventListener("wheel",(function(i){return e.onWheel(t,i)}),{passive:!1}),t.$content.addEventListener("click",(function(i){return e.onClick(t,i)}),{passive:!1}),this.revealContent(t)):this.fancybox.setError(t,"{{IMAGE_ERROR}}"))}},{key:"initSlidePanzoom",value:function(t){var e=this;t.Panzoom||(t.Panzoom=new M(t.$el,k(!0,this.fancybox.option("Image.Panzoom",{}),{viewport:t.$wrap,content:t.$image,width:t._width,height:t._height,wrapInner:!1,textSelection:!0,touch:this.fancybox.option("Image.touch"),panOnlyZoomed:!0,click:!1,wheel:!1})),t.Panzoom.on("startAnimation",(function(){e.fancybox.trigger("Image.startAnimation",t)})),t.Panzoom.on("endAnimation",(function(){"zoomIn"===t.state&&e.fancybox.done(t),e.handleCursor(t),e.fancybox.trigger("Image.endAnimation",t)})),t.Panzoom.on("afterUpdate",(function(){e.handleCursor(t),e.fancybox.trigger("Image.afterUpdate",t)})))}},{key:"revealContent",value:function(t){null===this.fancybox.Carousel.prevPage&&t.index===this.fancybox.options.startIndex&&this.canZoom(t)?this.zoomIn():this.fancybox.revealContent(t)}},{key:"getZoomInfo",value:function(t){var e=t.$thumb.getBoundingClientRect(),i=e.width,n=e.height,o=t.$content.getBoundingClientRect(),a=o.width,s=o.height,r=o.top-e.top,l=o.left-e.left,c=this.fancybox.option("Image.zoomOpacity");return"auto"===c&&(c=Math.abs(i/n-a/s)>.1),{top:r,left:l,scale:a&&i?i/a:1,opacity:c}}},{key:"canZoom",value:function(t){var e=this.fancybox,i=e.$container;if(window.visualViewport&&1!==window.visualViewport.scale)return!1;if(t.Panzoom&&!t.Panzoom.content.width)return!1;if(!e.option("Image.zoom")||"contain"!==e.option("Image.fit"))return!1;var n=t.$thumb;if(!n||"loading"===t.state)return!1;i.classList.add("fancybox__no-click");var o,a=n.getBoundingClientRect();if(this.fancybox.option("Image.ignoreCoveredThumbnail")){var s=document.elementFromPoint(a.left+1,a.top+1)===n,r=document.elementFromPoint(a.right-1,a.bottom-1)===n;o=s&&r}else o=document.elementFromPoint(a.left+.5*a.width,a.top+.5*a.height)===n;return i.classList.remove("fancybox__no-click"),o}},{key:"zoomIn",value:function(){var t=this.fancybox,e=t.getSlide(),i=e.Panzoom,n=this.getZoomInfo(e),o=n.top,a=n.left,s=n.scale,r=n.opacity;t.trigger("reveal",e),i.panTo({x:-1*a,y:-1*o,scale:s,friction:0,ignoreBounds:!0}),e.$content.style.visibility="",e.state="zoomIn",!0===r&&i.on("afterTransform",(function(t){"zoomIn"!==e.state&&"zoomOut"!==e.state||(t.$content.style.opacity=Math.min(1,1-(1-t.content.scale)/(1-s)))})),i.panTo({x:0,y:0,scale:1,friction:this.fancybox.option("Image.zoomFriction")})}},{key:"zoomOut",value:function(){var t=this,e=this.fancybox,i=e.getSlide(),n=i.Panzoom;if(n){i.state="zoomOut",e.state="customClosing",i.$caption&&(i.$caption.style.visibility="hidden");var o=this.fancybox.option("Image.zoomFriction"),a=function(e){var a=t.getZoomInfo(i),s=a.top,r=a.left,l=a.scale,c=a.opacity;e||c||(o*=.82),n.panTo({x:-1*r,y:-1*s,scale:l,friction:o,ignoreBounds:!0}),o*=.98};window.addEventListener("scroll",a),n.once("endAnimation",(function(){window.removeEventListener("scroll",a),e.destroy()})),a()}}},{key:"handleCursor",value:function(t){if("image"===t.type&&t.$el){var e=t.Panzoom,i=this.fancybox.option("Image.click",!1,t),n=this.fancybox.option("Image.touch"),o=t.$el.classList,a=this.fancybox.option("Image.canZoomInClass"),s=this.fancybox.option("Image.canZoomOutClass");if(o.remove(s),o.remove(a),e&&"toggleZoom"===i)e&&1===e.content.scale&&e.option("maxScale")-e.content.scale>.01?o.add(a):e.content.scale>1&&!n&&o.add(s);else"close"===i&&o.add(s)}}},{key:"onWheel",value:function(t,e){if("ready"===this.fancybox.state&&!1!==this.fancybox.trigger("Image.
2651wheel",e))switch(this.fancybox.option("Image.wheel")){case"zoom":"done"===t.state&&t.Panzoom&&t.Panzoom.zoomWithWheel(e);break;case"close":this.fancybox.close();break;case"slide":this.fancybox[e.deltaY<0?"prev":"next"]()}}},{key:"onClick",value:function(t,e){var i=this;if("ready"===this.fancybox.state){var n=t.Panzoom;if(!n||!n.dragPosition.midPoint&&0===n.dragOffset.x&&0===n.dragOffset.y&&1===n.dragOffset.scale){if(this.fancybox.Carousel.Panzoom.lockAxis)return!1;var o=function(n){switch(n){case"toggleZoom":e.stopPropagation(),t.Panzoom&&t.Panzoom.zoomWithClick(e);break;case"close":i.fancybox.close();break;case"next":e.stopPropagation(),i.fancybox.next()}},a=this.fancybox.option("Image.click"),s=this.fancybox.option("Image.doubleClick");s?this.clickTimer?(clearTimeout(this.clickTimer),this.clickTimer=null,o(s)):this.clickTimer=setTimeout((function(){i.clickTimer=null,o(a)}),300):o(a)}}}},{key:"onPageChange",value:function(t,e){var i=t.getSlide();e.slides.forEach((function(t){t.Panzoom&&"done"===t.state&&t.index!==i.index&&t.Panzoom.panTo({x:0,y:0,scale:1,friction:.8})}))}},{key:"attach",value:function(){this.fancybox.on(this.events)}},{key:"detach",value:function(){this.fancybox.off(this.events)}}]),t}();K.defaults={canZoomInClass:"can-zoom_in",canZoomOutClass:"can-zoom_out",zoom:!0,zoomOpacity:"auto",zoomFriction:.82,ignoreCoveredThumbnail:!1,touch:!0,click:"toggleZoom",doubleClick:null,wheel:"zoom",fit:"contain",wrap:!1,Panzoom:{ratio:1}};var J=function(){function t(e){o(this,t),this.fancybox=e;for(var i=0,n=["onChange","onClosing"];i<n.length;i++){var a=n[i];this[a]=this[a].bind(this)}this.events={initCarousel:this.onChange,"Carousel.change":this.onChange,closing:this.onClosing},this.hasCreatedHistory=!1,this.origHash="",this.timer=null}return s(t,[{key:"onChange",value:function(t){var e=this,i=t.Carousel;this.timer&&clearTimeout(this.timer);var n=null===i.prevPage,o=t.getSlide(),a=new URL(document.URL).hash,s=!1;if(o.slug)s="#"+o.slug;else{var r=o.$trigger&&o.$trigger.dataset,l=t.option("slug")||r&&r.fancybox;l&&l.length&&"true"!==l&&(s="#"+l+(i.slides.length>1?"-"+(o.index+1):""))}n&&(this.origHash=a!==s?a:""),s&&a!==s&&(this.timer=setTimeout((function(){try{window.history[n?"pushState":"replaceState"]({},document.title,window.location.pathname+window.location.search+s),n&&(e.hasCreatedHistory=!0)}catch(t){}}),300))}},{key:"onClosing",value:function(){if(this.timer&&clearTimeout(this.timer),!0!==this.hasSilentClose)try{return void window.history.replaceState({},document.title,window.location.pathname+window.location.search+(this.origHash||""))}catch(t){}}},{key:"attach",value:function(t){t.on(this.events)}},{key:"detach",value:function(t){t.off(this.events)}}],[{key:"startFromUrl",value:function(){var e=t.Fancybox;if(e&&!e.getInstance()&&!1!==e.defaults.Hash){var i=t.getParsedURL(),n=i.hash,o=i.slug,a=i.index;if(o){var s=document.querySelector('[data-slug="'.concat(n,'"]'));if(s&&s.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})),!e.getInstance()){var r=document.querySelectorAll('[data-fancybox="'.concat(o,'"]'));r.length&&(null===a&&1===r.length?s=r[0]:a&&(s=r[a-1]),s&&s.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})))}}}}},{key:"onHashChange",value:function(){var e=t.getParsedURL(),i=e.slug,n=e.index,o=t.Fancybox,a=o&&o.getInstance();if(a&&a.plugins.Hash){if(i){var s=a.Carousel;if(i===a.option("slug"))return s.slideTo(n-1);var r,l=x(s.slides);try{for(l.s();!(r=l.n()).done;){var c=r.value;if(c.slug&&c.slug===i)return s.slideTo(c.index)}}catch(t){l.e(t)}finally{l.f()}var h=a.getSlide(),d=h.$trigger&&h.$trigger.dataset;if(d&&d.fancybox===i)return s.slideTo(n-1)}a.plugins.Hash.hasSilentClose=!0,a.close()}t.startFromUrl()}},{key:"create",value:function(e){function i(){window.addEventListener("hashchange",t.onHashChange,!1),t.startFromUrl()}t.Fancybox=e,H&&window.requestAnimationFrame((function(){/complete|interactive|loaded/.test(document.readyState)?i():document.addEventListener("DOMContentLoaded",i)}))}},{key:"destroy",value:function(){window.removeEventListener("hashchange",t.onHashChange,!1)}},{key:"getParsedURL",value:function(){var t=window.location.hash.substr(1),e=t.split("-"),i=e.length>1&&/^\+?\d+$/.test(e[e.length-1])&&parseInt(e.pop(-1),10)||null;return{hash:t,slug:e.join("-"),index:i}}}]),t}(),Q={pageXOffset:0,pageYOffset:0,element:function(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement},activate:function(t){Q.pageXOffset=window.pageXOffset,Q.pageYOffset=window.pageYOffset,t.requestFullscreen?t.requestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitRequestFullscreen?t.webkitRequestFullscreen():t.msRequestFullscreen&&t.msRequestFullscreen()},deactivate:function(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}},tt=function(){function t(e){o(this,t),this.fancybox=e,this.active=!1,this.handleVisibilityChange=this.handleVisibilityChange.bind(this)}return s(t,[{key:"isActive",value:function(){return this.active}},{key:"setTimer",value:function(){var t=this;if(this.active&&!this.timer){var e=this.fancybox.option("slideshow.delay",3e3);this.timer=setTimeout((function(){t.timer=null,t.fancybox.option("infinite")||t.fancybox.getSlide().index!==t.fancybox.Carousel.slides.length-1?t.fancybox.next():t.fancybox.jumpTo(0,{friction:0})}),e);var i=this.$progress;i||((i=document.createElement("div")).classList.add("fancybox__progress"),this.fancybox.$carousel.parentNode.insertBefore(i,this.fancybox.$carousel),this.$progress=i,i.offsetHeight),i.style.transitionDuration="".concat(e,"ms"),i.style.transform="scaleX(1)"}}},{key:"clearTimer",value:function(){clearTimeout(this.timer),this.timer=null,this.$progress&&(this.$progress.style.transitionDuration="",this.$progress.style.transform="",this.$progress.offsetHeight)}},{key:"activate",value:function(){this.active||(this.active=!0,this.fancybox.$container.classList.add("has-slideshow"),"done"===this.fancybox.getSlide().state&&this.setTimer(),document.addEventListener("visibilitychange",this.handleVisibilityChange,!1))}},{key:"handleVisibilityChange",value:function(){this.deactivate()}},{key:"deactivate",value:function(){this.active=!1,this.clearTimer(),this.fancybox.$container.classList.remove("has-slideshow"),document.removeEventListener("visibilitychange",this.handleVisibilityChange,!1)}},{key:"toggle",value:function(){this.active?this.deactivate():this.fancybox.Carousel.slides.length>1&&this.activate()}}]),t}(),et={display:["counter","zoom","slideshow","fullscreen","thumbs","close"],autoEnable:!0,items:{counter:{position:"left",type:"div",class:"fancybox__counter",html:'<span data-fancybox-index=""></span>&nbsp;/&nbsp;<span data-fancybox-count=""></span>',attr:{tabindex:-1}},prev:{type:"button",class:"fancybox__button--prev",label:"PREV",html:'<svg viewBox="0 0 24 24">
2651<path d="M15 4l-8 8 8 8"/></svg>',attr:{"data-fancybox-prev":""}},next:{type:"button",class:"fancybox__button--next",label:"NEXT",html:'<svg viewBox="0 0 24 24"><path d="M8 4l8 8-8 8"/></svg>',attr:{"data-fancybox-next":""}},fullscreen:{type:"button",class:"fancybox__button--fullscreen",label:"TOGGLE_FULLSCREEN",html:'<svg viewBox="0 0 24 24">\n                <g><path d="M3 8 V3h5"></path><path d="M21 8V3h-5"></path><path d="M8 21H3v-5"></path><path d="M16 21h5v-5"></path></g>\n                <g><path d="M7 2v5H2M17 2v5h5M2 17h5v5M22 17h-5v5"/></g>\n            </svg>',click:function(t){t.preventDefault(),Q.element()?Q.deactivate():Q.activate(this.fancybox.$container)}},slideshow:{type:"button",class:"fancybox__button--slideshow",label:"TOGGLE_SLIDESHOW",html:'<svg viewBox="0 0 24 24">\n                <g><path d="M6 4v16"/><path d="M20 12L6 20"/><path d="M20 12L6 4"/></g>\n                <g><path d="M7 4v15M17 4v15"/></g>\n            </svg>',click:function(t){t.preventDefault(),this.Slideshow.toggle()}},zoom:{type:"button",class:"fancybox__button--zoom",label:"TOGGLE_ZOOM",html:'<svg viewBox="0 0 24 24"><circle cx="10" cy="10" r="7"></circle><path d="M16 16 L21 21"></svg>',click:function(t){t.preventDefault();var e=this.fancybox.getSlide().Panzoom;e&&e.toggleZoom()}},download:{type:"link",label:"DOWNLOAD",class:"fancybox__button--download",html:'<svg viewBox="0 0 24 24"><path d="M12 15V3m0 12l-4-4m4 4l4-4M2 17l.62 2.48A2 2 0 004.56 21h14.88a2 2 0 001.94-1.51L22 17"/></svg>',click:function(t){t.stopPropagation()}},thumbs:{type:"button",label:"TOGGLE_THUMBS",class:"fancybox__button--thumbs",html:'<svg viewBox="0 0 24 24"><circle cx="4" cy="4" r="1" /><circle cx="12" cy="4" r="1" transform="rotate(90 12 4)"/><circle cx="20" cy="4" r="1" transform="rotate(90 20 4)"/><circle cx="4" cy="12" r="1" transform="rotate(90 4 12)"/><circle cx="12" cy="12" r="1" transform="rotate(90 12 12)"/><circle cx="20" cy="12" r="1" transform="rotate(90 20 12)"/><circle cx="4" cy="20" r="1" transform="rotate(90 4 20)"/><circle cx="12" cy="20" r="1" transform="rotate(90 12 20)"/><circle cx="20" cy="20" r="1" transform="rotate(90 20 20)"/></svg>',click:function(t){t.stopPropagation();var e=this.fancybox.plugins.Thumbs;e&&e.toggle()}},close:{type:"button",label:"CLOSE",class:"fancybox__button--close",html:'<svg viewBox="0 0 24 24"><path d="M20 20L4 4m16 0L4 20"></path></svg>',attr:{"data-fancybox-close":"",tabindex:0}}}},it=function(){function t(e){var i=this;o(this,t),this.fancybox=e,this.$container=null,this.state="init";for(var n=0,a=["onInit","onPrepare","onDone","onKeydown","onClosing","onChange","onSettle","onRefresh"];n<a.length;n++){var s=a[n];this[s]=this[s].bind(this)}this.events={init:this.onInit,prepare:this.onPrepare,done:this.onDone,keydown:this.onKeydown,closing:this.onClosing,"Carousel.change":this.onChange,"Carousel.settle":this.onSettle,"Carousel.Panzoom.touchStart":function(){return i.onRefresh()},"Image.startAnimation":function(t,e){return i.onRefresh(e)},"Image.afterUpdate":function(t,e){return i.onRefresh(e)}}}return s(t,[{key:"onInit",value:function(){if(this.fancybox.option("Toolbar.autoEnable")){var t,e=!1,i=x(this.fancybox.items);try{for(i.s();!(t=i.n()).done;){if("image"===t.value.type){e=!0;break}}}catch(t){i.e(t)}finally{i.f()}if(!e)return void(this.state="disabled")}var n,o=x(this.fancybox.option("Toolbar.display"));try{for(o.s();!(n=o.n()).done;){var a=n.value;if("close"===(w(a)?a.id:a)){this.fancybox.options.closeButton=!1;break}}}catch(t){o.e(t)}finally{o.f()}}},{key:"onPrepare",value:function(){var t=this.fancybox;if("init"===this.state&&(this.build(),this.update(),this.Slideshow=new tt(t),!t.Carousel.prevPage&&(t.option("slideshow.autoStart")&&this.Slideshow.activate(),t.option("fullscreen.autoStart")&&!Q.element())))try{Q.activate(t.$container)}catch(t){}}},{key:"onFsChange",value:function(){window.scrollTo(Q.pageXOffset,Q.pageYOffset)}},{key:"onSettle",value:function(){var t=this.fancybox,e=this.Slideshow;e&&e.isActive()&&(t.getSlide().index!==t.Carousel.slides.length-1||t.option("infinite")?"done"===t.getSlide().state&&e.setTimer():e.deactivate())}},{key:"onChange",value:function(){this.update(),this.Slideshow&&this.Slideshow.isActive()&&this.Slideshow.clearTimer()}},{key:"onDone",value:function(t,e){var i=this.Slideshow;e.index===t.getSlide().index&&(this.update(),i&&i.isActive()&&(t.option("infinite")||e.index!==t.Carousel.slides.length-1?i.setTimer():i.deactivate()))}},{key:"onRefresh",value:function(t){t&&t.index!==this.fancybox.getSlide().index||(this.update(),!this.Slideshow||!this.Slideshow.isActive()||t&&"done"!==t.state||this.Slideshow.deactivate())}}
2651,{key:"onKeydown",value:function(t,e,i){" "===e&&this.Slideshow&&(this.Slideshow.toggle(),i.preventDefault())}},{key:"onClosing",value:function(){this.Slideshow&&this.Slideshow.deactivate(),document.removeEventListener("fullscreenchange",this.onFsChange)}},{key:"createElement",value:function(t){var e,i;("div"===t.type?e=document.createElement("div"):(e=document.createElement("link"===t.type?"a":"button")).classList.add("carousel__button"),e.innerHTML=t.html,e.setAttribute("tabindex",t.tabindex||0),t.class)&&(i=e.classList).add.apply(i,m(t.class.split(" ")));for(var n in t.attr)e.setAttribute(n,t.attr[n]);t.label&&e.setAttribute("title",this.fancybox.localize("{{".concat(t.label,"}}"))),t.click&&e.addEventListener("click",t.click.bind(this)),"prev"===t.id&&e.setAttribute("data-fancybox-prev",""),"next"===t.id&&e.setAttribute("data-fancybox-next","");var o=e.querySelector("svg");return o&&(o.setAttribute("role","img"),o.setAttribute("tabindex","-1"),o.setAttribute("xmlns","http://www.w3.org/2000/svg")),e}},{key:"build",value:function(){var t=this;this.cleanup();var e,i=this.fancybox.option("Toolbar.items"),n=[{position:"left",items:[]},{position:"center",items:[]},{position:"right",items:[]}],o=this.fancybox.plugins.Thumbs,a=x(this.fancybox.option("Toolbar.display"));try{var s=function(){var a=e.value,s=void 0,r=void 0;if(w(a)?(s=a.id,r=k({},i[s],a)):r=i[s=a],["counter","next","prev","slideshow"].includes(s)&&t.fancybox.items.length<2)return"continue";if("fullscreen"===s){if(!document.fullscreenEnabled||window.fullScreen)return"continue";document.addEventListener("fullscreenchange",t.onFsChange)}if("thumbs"===s&&(!o||"disabled"===o.state))return"continue";if(!r)return"continue";var l=r.position||"right",c=n.find((function(t){return t.position===l}));c&&c.items.push(r)};for(a.s();!(e=a.n()).done;)s()}catch(t){a.e(t)}finally{a.f()}var r=document.createElement("div");r.classList.add("fancybox__toolbar");for(var l=0,c=n;l<c.length;l++){var h=c[l];if(h.items.length){var d=document.createElement("div");d.classList.add("fancybox__toolbar__items"),d.classList.add("fancybox__toolbar__items--".concat(h.position));var u,f=x(h.items);try{for(f.s();!(u=f.n()).done;){var v=u.value;d.appendChild(this.createElement(v))}}catch(t){f.e(t)}finally{f.f()}r.appendChild(d)}}this.fancybox.$carousel.parentNode.insertBefore(r,this.fancybox.$carousel),this.$container=r}},{key:"update",value:function(){var t,e=this.fancybox.getSlide(),i=e.index,n=this.fancybox.items.length,o=e.downloadSrc||("image"!==e.type||e.error?null:e.src),a=x(this.fancybox.$container.querySelectorAll("a.fancybox__button--download"));try{for(a.s();!(t=a.n()).done;){var s=t.value;o?(s.removeAttribute("disabled"),s.removeAttribute("tabindex"),s.setAttribute("href",o),s.setAttribute("download",o),s.setAttribute("target","_blank")):(s.setAttribute("disabled",""),s.setAttribute("tabindex",-1),s.removeAttribute("href"),s.removeAttribute("download"))}}catch(t){a.e(t)}finally{a.f()}var r,l=e.Panzoom,c=l&&l.option("maxScale")>l.option("baseScale"),h=x(this.fancybox.$container.querySelectorAll(".fancybox__button--zoom"));try{for(h.s();!(r=h.n()).done;){var d=r.value;c?d.removeAttribute("disabled"):d.setAttribute("disabled","")}}catch(t){h.e(t)}finally{h.f()}var u,f=x(this.fancybox.$container.querySelectorAll("[data-fancybox-index]"));try{for(f.s();!(u=f.n()).done;){u.value.innerHTML=e.index+1}}catch(t){f.e(t)}finally{f.f()}var v,p=x(this.fancybox.$container.querySelectorAll("[data-fancybox-count]"));try{for(p.s();!(v=p.n()).done;){v.value.innerHTML=n}}catch(t){p.e(t)}finally{p.f()}if(!this.fancybox.option("infinite")){var g,m=x(this.fancybox.$container.querySelectorAll("[data-fancybox-prev]"));try{for(m.s();!(g=m.n()).done;){var y=g.value;0===i?y.setAttribute("disabled",""):y.removeAttribute("disabled")}}catch(t){m.e(t)}finally{m.f()}var b,w=x(this.fancybox.$container.querySelectorAll("[data-fancybox-next]"));try{for(w.s();!(b=w.n()).done;){var k=b.value;i===n-1?k.setAttribute("disabled",""):k.removeAttribute("disabled")}}catch(t){w.e(t)}finally{w.f()}}}},{key:"cleanup",value:function(){this.Slideshow&&this.Slideshow.isActive()&&this.Slideshow.clearTimer(),this.$container&&this.$container.remove(),this.$container=null}},{key:"attach",value:function(){this.fancybox.on(this.events)}},{key:"detach",value:function(){this.fancybox.off(this.events),this.cleanup()}}]),t}();it.defaults=et;var nt={ScrollLock:U,Thumbs:Y,Html:G,Toolbar:it,Image:K,Hash:J},ot={startIndex:0,preload:1,infinite:!0,showClass:"fancybox-zoomInUp",hideClass:"fancybox-fadeOut",animated:!0,hideScrollbar:!0,parentEl:null,mainClass:null,autoFocus:!0,trapFocus:!0,placeFocusBack:!0,click:"close",closeButton:"inside",dragToClose:!0,keyboard:{Escape:"close",Delete:"close",Backspace:"close",PageUp:"next",PageDown:"prev",ArrowUp:"next",ArrowDown:"prev",ArrowRight:"next",ArrowLeft:"prev"},template:{closeButton:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1">
2651<path d="M20 20L4 4m16 0L4 20"/></svg>',spinner:'<svg xmlns="http://www.w3.org/2000/svg" width="50" height="50" viewBox="25 25 50 50" tabindex="-1"><circle cx="50" cy="50" r="20"/></svg>',main:null},l10n:{CLOSE:"Close",NEXT:"Next",PREV:"Previous",MODAL:"You can close this modal content with the ESC key",ERROR:"Something Went Wrong, Please Try Again Later",IMAGE_ERROR:"Image Not Found",ELEMENT_NOT_FOUND:"HTML Element Not Found",AJAX_NOT_FOUND:"Error Loading AJAX : Not Found",AJAX_FORBIDDEN:"Error Loading AJAX : Forbidden",IFRAME_ERROR:"Error Loading Page",TOGGLE_ZOOM:"Toggle zoom level",TOGGLE_THUMBS:"Toggle thumbnails",TOGGLE_SLIDESHOW:"Toggle slideshow",TOGGLE_FULLSCREEN:"Toggle full-screen mode",DOWNLOAD:"Download"}},at=new Map,st=0,rt=function(t){l(i,t);var e=f(i);function i(t){var n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return o(this,i),t=t.map((function(t){return t.width&&(t._width=t.width),t.height&&(t._height=t.height),t})),(n=e.call(this,k(!0,{},ot,a))).bindHandlers(),n.state="init",n.setItems(t),n.attachPlugins(i.Plugins),n.trigger("init"),!0===n.option("hideScrollbar")&&n.hideScrollbar(),n.initLayout(),n.initCarousel(),n.attachEvents(),at.set(n.id,d(n)),n.trigger("prepare"),n.state="ready",n.trigger("ready"),n.$container.setAttribute("aria-hidden","false"),n.option("trapFocus")&&n.focus(),n}return s(i,[{key:"option",value:function(t){for(var e,n=this.getSlide(),o=n?n[t]:void 0,a=arguments.length,s=new Array(a>1?a-1:0),r=1;r<a;r++)s[r-1]=arguments[r];if(void 0!==o){var l;if("function"==typeof o)o=(l=o).call.apply(l,[this,this].concat(s));return o}return(e=p(c(i.prototype),"option",this)).call.apply(e,[this,t].concat(s))}},{key:"bindHandlers",value:function(){for(var t=0,e=["onMousedown","onKeydown","onClick","onFocus","onCreateSlide","onSettle","onTouchMove","onTouchEnd","onTransform"];t<e.length;t++){var i=e[t];this[i]=this[i].bind(this)}}},{key:"attachEvents",value:function(){document.addEventListener("mousedown",this.onMousedown),document.addEventListener("keydown",this.onKeydown,!0),this.option("trapFocus")&&document.addEventListener("focus",this.onFocus,!0),this.$container.addEventListener("click",this.onClick)}},{key:"detachEvents",value:function(){document.removeEventListener("mousedown",this.onMousedown),document.removeEventListener("keydown",this.onKeydown,!0),document.removeEventListener("focus",this.onFocus,!0),this.$container.removeEventListener("click",this.onClick)}},{key:"initLayout",value:function(){var t=this;this.$root=this.option("parentEl")||document.body;var e=this.option("template.main");e&&(this.$root.insertAdjacentHTML("beforeend",this.localize(e)),this.$container=this.$root.querySelector(".fancybox__container")),this.$container||(this.$container=document.createElement("div"),this.$root.appendChild(this.$container)),this.$container.onscroll=function(){return t.$container.scrollLeft=0,!1},Object.entries({class:"fancybox__container",role:"dialog",tabIndex:"-1","aria-modal":"true","aria-hidden":"true","aria-label":this.localize("{{MODAL}}")}).forEach((function(e){var i;return(i=t.$container).setAttribute.apply(i,m(e))})),this.option("animated")&&this.$container.classList.add("is-animated"),this.$backdrop=this.$container.querySelector(".fancybox__backdrop"),this.$backdrop||(this.$backdrop=document.createElement("div"),this.$backdrop.classList.add("fancybox__backdrop"),this.$container.appendChild(this.$backdrop)),this.$carousel=this.$container.querySelector(".fancybox__carousel"),this.$carousel||(this.$carousel=document.createElement("div"),this.$carousel.classList.add("fancybox__carousel"),this.$container.appendChild(this.$carousel)),this.$container.Fancybox=this,this.id=this.$container.getAttribute("id"),this.id||(this.id=this.options.id||++st,this.$container.setAttribute("id","fancybox-"+this.id));var i,n=this.option("mainClass");n&&(i=this.$container.classList).add.apply(i,m(n.split(" ")));return document.documentElement.classList.add("with-fancybox"),this.trigger("initLayout"),this}},{key:"setItems",value:function(t){var e,i=[],n=x(t);try{for(n.s();!(e=n.n()).done;){var o=e.value,a=o.$trigger;if(a){var s=a.dataset||{};o.src=s.src||a.getAttribute("href")||o.src,o.type=s.type||o.type,!o.src&&a instanceof HTMLImageElement&&(o.src=a.currentSrc||o.$trigger.src)}var r=o.$thumb;if(!r){var l=o.$trigger&&o.$trigger.origTarget;l&&(r=l instanceof HTMLImageElement?l:l.querySelector("img:not([aria-hidden])")),!r&&o.$trigger&&(r=o.$trigger instanceof HTMLImageElement?o.$trigger:o.$trigger.querySelector("img:not([aria-hidden])"))}o.$thumb=r||null;var c=o.thumb;!c&&r&&!(c=r.currentSrc||r.src)&&r.dataset&&(c=r.dataset.lazySrc||r.dataset.src),c||"image"!==o.type||(c=o.src),o.thumb=c||null,o.caption=o.caption||"",i.push(o)}}catch(t){n.e(t)}finally{n.f()}this.items=i}},{key:"initCarousel",value:function(){var t=this;return this.Carousel=new W(this.$carousel,k(!0,{},{prefix:"",classNames:{viewport:"fancybox__viewport",track:"fancybox__track",slide:"fancybox__slide"},textSelection:!0,preload:this.option("preload"),friction:.88,slides:this.items,initialPage:this.options.startIndex,slidesPerPage:1,infiniteX:this.option("infinite"),infiniteY:!0,l10n:this.option("l10n"),Dots:!1,Navigation:{classNames:{main:"fancybox__nav",button:"carousel__button",next:"is-next",prev:"is-prev"}},Panzoom:{textSelection:!0,panOnlyZoomed:function(){return t.Carousel&&t.Carousel.pages&&t.Carousel.pages.length<2&&!t.option("dragToClose")},lockAxis:function(){if(t.Carousel){var e="x";return t.option("dragToClose")&&(e+="y"),e}}},on:{"*":function(e){for(var i=arguments.length,n=new Array(i>1?i-1:0),o=1;o<i;o++)n[o-1]=arguments[o];
2651return t.trigger.apply(t,["Carousel.".concat(e)].concat(n))},init:function(e){return t.Carousel=e},createSlide:this.onCreateSlide,settle:this.onSettle}},this.option("Carousel"))),this.option("dragToClose")&&this.Carousel.Panzoom.on({touchMove:this.onTouchMove,afterTransform:this.onTransform,touchEnd:this.onTouchEnd}),this.trigger("initCarousel"),this}},{key:"onCreateSlide",value:function(t,e){var i=e.caption||"";if("function"==typeof this.options.caption&&(i=this.options.caption.call(this,this,this.Carousel,e)),"string"==typeof i&&i.length){var n=document.createElement("div"),o="fancybox__caption_".concat(this.id,"_").concat(e.index);n.className="fancybox__caption",n.innerHTML=i,n.setAttribute("id",o),e.$caption=e.$el.appendChild(n),e.$el.classList.add("has-caption"),e.$el.setAttribute("aria-labelledby",o)}}},{key:"onSettle",value:function(){this.option("autoFocus")&&this.focus()}},{key:"onFocus",value:function(t){this.focus(t)}},{key:"onClick",value:function(t){if(!t.defaultPrevented){var e=t.composedPath()[0];if(e.matches("[data-fancybox-close]"))return t.preventDefault(),void i.close(!1,t);if(e.matches("[data-fancybox-next]"))return t.preventDefault(),void i.next();if(e.matches("[data-fancybox-prev]"))return t.preventDefault(),void i.prev();if(e.matches(X)||document.activeElement.blur(),!e.closest(".fancybox__content"))if(!getSelection().toString().length)if(!1!==this.trigger("click",t))switch(this.option("click")){case"close":this.close();break;case"next":this.next()}}}},{key:"onTouchMove",value:function(){var t=this.getSlide().Panzoom;return!t||1===t.content.scale}},{key:"onTouchEnd",value:function(t){var e=t.dragOffset.y;Math.abs(e)>=150||Math.abs(e)>=35&&t.dragOffset.time<350?(this.option("hideClass")&&(this.getSlide().hideClass="fancybox-throwOut".concat(t.content.y<0?"Up":"Down")),this.close()):"y"===t.lockAxis&&t.panTo({y:0})}},{key:"onTransform",value:function(t){if(this.$backdrop){var e=Math.abs(t.content.y),i=e<1?"":Math.max(.33,Math.min(1,1-e/t.content.fitHeight*1.5));this.$container.style.setProperty("--fancybox-ts",i?"0s":""),this.$container.style.setProperty("--fancybox-opacity",i)}}},{key:"onMousedown",value:function(){"ready"===this.state&&document.body.classList.add("is-using-mouse")}},{key:"onKeydown",value:function(t){if(i.getInstance().id===this.id){document.body.classList.remove("is-using-mouse");var e=t.key,n=this.option("keyboard");if(n&&!t.ctrlKey&&!t.altKey&&!t.shiftKey){var o=t.composedPath()[0],a=document.activeElement&&document.activeElement.classList,s=a&&a.contains("carousel__button");if("Escape"!==e&&!s)if(t.target.isContentEditable||-1!==["BUTTON","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].indexOf(o.nodeName))return;if(!1!==this.trigger("keydown",e,t)){var r=n[e];"function"==typeof this[r]&&this[r]()}}}}},{key:"getSlide",value:function(){var t=this.Carousel;if(!t)return null;var e=null===t.page?t.option("initialPage"):t.page,i=t.pages||[];return i.length&&i[e]?i[e].slides[0]:null}},{key:"focus",value:function(t){if(!(i.ignoreFocusChange||["init","closing","customClosing","destroy"].indexOf(this.state)>-1)){var e=this.$container,n=this.getSlide(),o="done"===n.state?n.$el:null;if(!o||!o.contains(document.activeElement)){t&&t.preventDefault(),i.ignoreFocusChange=!0;for(var a,s=[],r=0,l=Array.from(e.querySelectorAll(X));r<l.length;r++){var c=l[r],h=c.offsetParent,d=o&&o.contains(c),u=!this.Carousel.$viewport.contains(c);h&&(d||u)?(s.push(c),void 0!==c.dataset.origTabindex&&(c.tabIndex=c.dataset.origTabindex,c.removeAttribute("data-orig-tabindex")),(c.hasAttribute("autoFocus")||!a&&d&&!c.classList.contains("carousel__button"))&&(a=c)):(c.dataset.origTabindex=void 0===c.dataset.origTabindex?c.getAttribute("tabindex"):c.dataset.origTabindex,c.tabIndex=-1)}t?s.indexOf(t.target)>-1?this.lastFocus=t.target:this.lastFocus===e?q(s[s.length-1]):q(e):this.option("autoFocus")&&a?q(a):s.indexOf(document.activeElement)<0&&q(e),this.lastFocus=document.activeElement,i.ignoreFocusChange=!1}}}},{key:"hideScrollbar",value:function(){if(H){var t=window.innerWidth-document.documentElement.getBoundingClientRect().width,e="fancybox-style-noscroll",i=document.getElementById(e);i||t>0&&((i=document.createElement("style")).id=e,i.type="text/css",i.innerHTML=".compensate-for-scrollbar {padding-right: ".concat(t,"px;}"),document.getElementsByTagName("head")[0].appendChild(i),document.body.classList.add("compensate-for-scrollbar"))}}},{key:"revealScrollbar",value:function(){document.body.classList.remove("compensate-for-scrollbar");var t=document.getElementById("fancybox-style-noscroll");t&&t.remove()}},{key:"clearContent",value:function(t){this.Carousel.trigger("removeSlide",t),t.$content&&(t.$content.remove(),t.$content=null),t.$closeButton&&(t.$closeButton.remove(),t.$closeButton=null),t._className&&t.$el.classList.remove(t._className)}},{key:"setContent",value:function(t,e){var i,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=t.$el;if(e instanceof HTMLElement)["img","iframe","video","audio"].indexOf(e.nodeName.toLowerCase())>-1?(i=document.createElement("div")).appendChild(e):i=e;else{var a=document.createRange().createContextualFragment(e);(i=document.createElement("div")).appendChild(a)}if(t.filter&&!t.error&&(i=i.querySelector(t.filter)),i instanceof Element)return t._className="has-".concat(n.suffix||t.type||"unknown"),o.classList.add(t._className),i.classList.add("fancybox__content"),"none"!==i.style.display&&"none"!==getComputedStyle(i).getPropertyValue("display")||(i.style.display=t.display||this.option("defaultDisplay")||"flex"),t.id&&i.setAttribute("id",t.id),t.$content=i,o.prepend(i),this.manageCloseButton(t),"loading"!==t.state&&this.revealContent(t),i;this.setError(t,"{{ELEMENT_NOT_FOUND}}")}},{key:"manageCloseButton",value:function(t){var e=this,i=void 0===t.closeButton?this.option("closeButton"):t.closeButton;if(i&&("top"!==i||!this.$closeButton)){var n=document.createElement("button");n.classList.add("carousel__button","is-close"),n.setAttribute("title",this.options.l10n.CLOSE),n.innerHTML=this.option("template.closeButton"),n.addEventListener("click",(function(t){return e.close(t)})),"inside"===i?(t.$closeButton&&t.$closeButton.remove(),t.$closeButton=t.$content.appendChild(n)):this.$closeButton=this.$container.insertBefore(n,this.$container.firstChild)}}},{key:"revealContent",value:function(t){var e=this;this.trigger("reveal",t),t.$content.style.visibility="";var i=!1;t.error||"loading"===t.state||null!==this.Carousel.prevPage||t.index!==this.options.startIndex||(i=void 0===t.showClass?this.option("showClass"):t.showClass),i?(t.state="animating",this.animateCSS(t.$content,i,(function(){e.done(t)}))):this.done(t)}}
2651,{key:"animateCSS",value:function(t,e,i){if(t&&t.dispatchEvent(new CustomEvent("animationend",{bubbles:!0,cancelable:!0})),t&&e){t.addEventListener("animationend",(function n(o){o.currentTarget===this&&(t.removeEventListener("animationend",n),i&&i(),t.classList.remove(e))})),t.classList.add(e)}else"function"==typeof i&&i()}},{key:"done",value:function(t){t.state="done",this.trigger("done",t);var e=this.getSlide();e&&t.index===e.index&&this.option("autoFocus")&&this.focus()}},{key:"setError",value:function(t,e){t.error=e,this.hideLoading(t),this.clearContent(t);var i=document.createElement("div");i.classList.add("fancybox-error"),i.innerHTML=this.localize(e||"<p>{{ERROR}}</p>"),this.setContent(t,i,{suffix:"error"})}},{key:"showLoading",value:function(t){var e=this;t.state="loading",t.$el.classList.add("is-loading");var i=t.$el.querySelector(".fancybox__spinner");i||((i=document.createElement("div")).classList.add("fancybox__spinner"),i.innerHTML=this.option("template.spinner"),i.addEventListener("click",(function(){e.Carousel.Panzoom.velocity||e.close()})),t.$el.prepend(i))}},{key:"hideLoading",value:function(t){var e=t.$el&&t.$el.querySelector(".fancybox__spinner");e&&(e.remove(),t.$el.classList.remove("is-loading")),"loading"===t.state&&(this.trigger("load",t),t.state="ready")}},{key:"next",value:function(){var t=this.Carousel;t&&t.pages.length>1&&t.slideNext()}},{key:"prev",value:function(){var t=this.Carousel;t&&t.pages.length>1&&t.slidePrev()}},{key:"jumpTo",value:function(){var t;this.Carousel&&(t=this.Carousel).slideTo.apply(t,arguments)}},{key:"close",value:function(t){var e=this;if(t&&t.preventDefault(),!["closing","customClosing","destroy"].includes(this.state)&&!1!==this.trigger("shouldClose",t)&&(this.state="closing",this.Carousel.Panzoom.destroy(),this.detachEvents(),this.trigger("closing",t),"destroy"!==this.state)){this.$container.setAttribute("aria-hidden","true"),this.$container.classList.add("is-closing");var i=this.getSlide();if(this.Carousel.slides.forEach((function(t){t.$content&&t.index!==i.index&&e.Carousel.trigger("removeSlide",t)})),"closing"===this.state){var n=void 0===i.hideClass?this.option("hideClass"):i.hideClass;this.animateCSS(i.$content,n,(function(){e.destroy()}),!0)}}}},{key:"destroy",value:function(){if("destroy"!==this.state){this.state="destroy",this.trigger("destroy");var t=this.option("placeFocusBack")?this.getSlide().$trigger:null;this.Carousel.destroy(),this.detachPlugins(),this.Carousel=null,this.options={},this.events={},this.$container.remove(),this.$container=this.$backdrop=this.$carousel=null,t&&q(t),at.delete(this.id);var e=i.getInstance();e?e.focus():(document.documentElement.classList.remove("with-fancybox"),document.body.classList.remove("is-using-mouse"),this.revealScrollbar())}}}],[{key:"show",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new i(t,e)}},{key:"fromEvent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!t.defaultPrevented&&!(t.button&&0!==t.button||t.ctrlKey||t.metaKey||t.shiftKey)){var n,o,a,s=t.composedPath()[0],r=s;if((r.matches("[data-fancybox-trigger]")||(r=r.closest("[data-fancybox-trigger]")))&&(n=r&&r.dataset&&r.dataset.fancyboxTrigger),n){var l=document.querySelectorAll('[data-fancybox="'.concat(n,'"]')),c=parseInt(r.dataset.fancyboxIndex,10)||0;r=l.length?l[c]:r}r||(r=s),Array.from(i.openers.keys()).reverse().some((function(e){a=r;var i=!1;try{a instanceof Element&&("string"==typeof e||e instanceof String)&&(i=a.matches(e)||(a=a.closest(e)))}catch(t){}return!!i&&(t.preventDefault(),o=e,!0)}));var h=!1;if(o){e.event=t,e.target=a,a.origTarget=s,h=i.fromOpener(o,e);var d=i.getInstance();d&&"ready"===d.state&&t.detail&&document.body.classList.add("is-using-mouse")}return h}}},{key:"fromOpener",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=function(t){for(var e=["false","0","no","null","undefined"],i=["true","1","yes"],n=Object.assign({},t.dataset),o={},a=0,s=Object.entries(n);a<s.length;a++){var r=g(s[a],2),l=r[0],c=r[1];if("fancybox"!==l)if("width"===l||"height"===l)o["_".concat(l)]=c;else if("string"==typeof c||c instanceof String)if(e.indexOf(c)>-1)o[l]=!1;else if(i.indexOf(o[l])>-1)o[l]=!0;else try{o[l]=JSON.parse(c)}catch(t){o[l]=c}else o[l]=c}return t instanceof Element&&(o.$trigger=t),o}
2651,o=[],a=e.startIndex||0,s=e.target||null,r=void 0!==(e=k({},e,i.openers.get(t))).groupAll&&e.groupAll,l=void 0===e.groupAttr?"data-fancybox":e.groupAttr,c=l&&s?s.getAttribute("".concat(l)):"";if(!s||c||r){var h=e.root||(s?s.getRootNode():document.body);o=[].slice.call(h.querySelectorAll(t))}if(s&&!r&&(o=c?o.filter((function(t){return t.getAttribute("".concat(l))===c})):[s]),!o.length)return!1;var d=i.getInstance();return!(d&&o.indexOf(d.options.$trigger)>-1)&&(a=s?o.indexOf(s):a,new i(o=o.map(n),k({},e,{startIndex:a,$trigger:s})))}},{key:"bind",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};function n(){document.body.addEventListener("click",i.fromEvent,!1)}H&&(i.openers.size||(/complete|interactive|loaded/.test(document.readyState)?n():document.addEventListener("DOMContentLoaded",n)),i.openers.set(t,e))}},{key:"unbind",value:function(t){i.openers.delete(t),i.openers.size||i.destroy()}},{key:"destroy",value:function(){for(var t;t=i.getInstance();)t.destroy();i.openers=new Map,document.body.removeEventListener("click",i.fromEvent,!1)}},{key:"getInstance",value:function(t){return t?at.get(t):Array.from(at.values()).reverse().find((function(t){return!["closing","customClosing","destroy"].includes(t.state)&&t}))||null}},{key:"close",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1?arguments[1]:void 0;if(t){var n,o=x(at.values());try{for(o.s();!(n=o.n()).done;){var a=n.value;a.close(e)}}catch(t){o.e(t)}finally{o.f()}}else{var s=i.getInstance();s&&s.close(e)}}},{key:"next",value:function(){var t=i.getInstance();t&&t.next()}},{key:"prev",value:function(){var t=i.getInstance();t&&t.prev()}}]),i}(O);rt.version="4.0.26",rt.defaults=ot,rt.openers=new Map,rt.Plugins=nt,rt.bind("[data-fancybox]");for(var lt=0,ct=Object.entries(rt.Plugins||{});lt<ct.length;lt++){var ht=g(ct[lt],2);ht[0];var dt=ht[1];"function"==typeof dt.create&&dt.create(rt)}t.Carousel=W,t.Fancybox=rt,t.Panzoom=M}));
2652
2653jQuery.cachedScript = function( url, options )
2654{
2655	// пробрасываем ревизию кеша
2656	if ((typeof(REV) !== 'undefined') && (url.indexOf('?') === -1)) url += '?' + REV;
2657	
2658	// Allow user to set any option except for dataType, cache, and url
2659	options = $.extend( options || {},
2660	{
2661		dataType: "script",
2662		cache: true,
2663		url: url
2664	});
2665	// Use $.ajax() since it is more flexible than $.getScript
2666	// Return the jqXHR object so we can chain callbacks
2667	return jQuery.ajax( options );
2668};
2669
2670$(document).ready(function()
2671{
2672	$.ajaxSetup({
2673		cache: false, // по умолчанию выключаем кеш
2674		headers: {'X-Security-Ls-Key': LIVESTREET_SECURITY_KEY} // пробрасываем ls_security_key
2675	});
2676});
2677
2678function ajaxAddUserFriend(obj,idUser,sAction) {
2679	obj = $(obj).closest('li');
2680	
2681	sText='';
2682	
2683	if(sAction=='accept') {
2684		sPath=aRouter.profile+'ajaxfriendaccept/';
2685	} else {
2686		sPath=aRouter.profile+'ajaxfriendadd/';
2687	}
2688	
2689	$.ajax({
2690		type: 'POST',
2691		url: sPath,
2692		data: { idUser: idUser,userText: sText }
2693	}).done(function(result)
2694	{ 
2695		if (!result)
2696		{
2697			msgErrorBox.alert('Error','Please try again later');
2698			$('form > *',obj).removeProp('disabled');
2699		}
2700		
2701		if (result.bStateError)
2702		{
2703			msgErrorBox.alert(result.sMsgTitle,result.sMsg);
2704			$('form > *',obj).removeProp('disabled');
2705		} else
2706		{
2707			msgNoticeBox.alert(result.sMsgTitle,result.sMsg);
2708			if (obj.length)
2709			{
2710				item = $('<li></li>').html(result.sToggleText);
2711				obj.closest('ul').prepend(item);
2712				obj.remove();
2713			}
2714		}
2715	});
2716}
2717
2718
2719function ajaxDeleteUserFriend(obj,idUser,sAction)
2720{
2721	obj = $(obj).closest('li');
2722	
2723	$.ajax({
2724		type: 'POST',
2725		url: aRouter.profile+'ajaxfrienddelete/',
2726		data: { idUser: idUser,sAction: sAction }
2727	}).done(function(result)
2728	{
2729		if (!result)
2730		{
2731			msgErrorBox.alert('Error','Please try again later');
2732		}
2733
2734		if (result.bStateError)
2735		{
2736			msgErrorBox.alert(result.sMsgTitle,result.sMsg);
2737		} else
2738		{
2739			msgNoticeBox.alert(result.sMsgTitle,result.sMsg);
2740			if (obj.length)
2741			{
2742				item = $('<li></li>').html(result.sToggleText);
2743				obj.closest('ul').prepend(item);
2744				obj.remove();
2745			}
2746		}
2747	});
2748}
2749
2750
2751$(document).ready(function($)
2752{
2753	$('.flistlink').on('click', function(e)
2754	{
2755		var t = $(e.target);
2756		var url =  DIR_WEB_ROOT + '/profile/ajax' + t.attr('type') + 'list/';
2757		var login = t.attr('user');
2758
2759		var c = t.closest('tr').next('tr').find('.friends_w');
2760		$.ajax({
2761			type: 'GET',
2762			url: url,
2763			data: {'login': login}
2764		}).done(function(result)
2765		{
2766			if (!result)
2767			{
2768				msgErrorBox.alert('Error','Please try again later');
2769			}
2770			if (result.bStateError)
2771			{
2772				msgErrorBox.alert(result.sMsgTitle,result.sMsg);
2773			} else
2774			{
2775				c.empty();
2776				$.each(result.aUsersList, function(i,a)
2777				{
2778					$('<a></a>').attr('href', DIR_WEB_ROOT + '/profile/' + a.user_login + '/').text(a.user_profile_name).appendTo(c);
2779				});
2780
2781				c.show();
2782			}
2783		});
2784		t.remove();
2785
2786	});
2787
2788}); 
2789function premiumDialog(param)
2790{
2791	if (!window.premiumDialogParam)
2792	{
2793		$.cachedScript('/plugins/mobile/templates/skin/default/actions/ActionMobile/js/main.premium.js?' + REV).done(function(e)
2794		{
2795			premiumDialogParam(param);
2796		});
2797
2798	} else
2799	{
2800		premiumDialogParam(param);
2801	}
2802}
2803
2804function FormDesigner(iFormId)
2805{
2806	$.cachedScript('https://formdesigner.ru/js/widgets/popup.js?v=0.0.3').done(function()
2807	{
2808		FDPopup.open(iFormId,{'hideCloseBtn':false,'host':'formdesigner.ru','overlay':{'background':'#000000','opacity':0.1}}); return false;
2809	});
2810}
2811
2812function ajaxTopicRenewPaid(topicId)
2813{
2814	$.ajax({
2815		type: 'POST',
2816		url: aRouter.topic + 'renew_paid/' + topicId + '/?ajax=1',
2817		data: {}
2818	}).done(function(result)
2819	{
2820		if (!result)
2821		{
2822			msgErrorBox.alert('Ошибка', 'Попробуйте повторить это позже.');
2823		}
2824		
2825		if (result.bStateError)
2826		{
2827			msgErrorBox.alert(result.sMsgTitle, result.sMsg);
2828		} else
2829		{
2830			msgNoticeBox.alert(result.sMsgTitle, result.sMsg);
2831		}
2832	});
2833}
2834
2835function ajaxJoinLeaveBlog(obj,idBlog)
2836{   
2837	obj = $(obj);
2838	
2839	$.ajax({
2840		type: 'POST',
2841		url: DIR_WEB_ROOT+'/include/ajax/joinLeaveBlog.php',
2842		data: { idBlog: idBlog }
2843	}).done(function(result)
2844	{
2845		if (!result) msgErrorBox.alert('Error','Please try again later');
2846		
2847		if (result.bStateError)
2848		{
2849			msgErrorBox.alert(result.sMsgTitle,result.sMsg);
2850		} else
2851		{
2852			msgNoticeBox.alert(result.sMsgTitle,result.sMsg);
2853			if (obj.length)
2854			{
2855				obj.parent().removeClass('active');
2856				if (result.bState) obj.parent().addClass('active');
2857
2858				divCount=$('#blog_user_count_'+idBlog);
2859				if (divCount.length) divCount.text(result.iCountUser);
2860			}
2861		}
2862	});
2863}
2864
2865
2866
2867function ajaxTextPreview(textId, save, divPreview)
2868{
2869	var ed = tinyMCE.get(textId);
2870	var text = ed.getContent();
2871
2872	$.ajax({
2873		type: 'POST',
2874		url: DIR_WEB_ROOT + '/include/ajax/textPreview.php',
2875		data: { text: text, save: save ? 1 : 0 },
2876		success: function(result)
2877		{
2878			if (!result) msgErrorBox.alert('Ошибка', 'Попробуйте повторить это позже.');
2879			if (result.bStateError)
2880			{
2881				msgErrorBox.alert('Ошибка', 'Попробуйте повторить это позже.');
2882			} else
2883			{
2884				if (!divPreview) divPreview = '#text_preview';
2885
2886				var div = $(divPreview);
2887				if (div.length)
2888				{
2889					div.html(result.sText).show();
2890					$(document).scrollTo(div, 500);
2891				}
2892			}
2893		}
2894	});
2895}
2896
2897
2898// для опроса
2899function addField(btn)
2900{
2901	tr = $(btn).closest('tr');
2902	tr.after(tr.clone());
2903	checkFieldForLast();
2904}
2905
2906function checkFieldForLast()
2907{
2908	const aDropAnswers = $('[name="drop_answer"]');
2909	if (aDropAnswers.length)
2910	{
2911		aDropAnswers.prop('disabled', false);
2912		if (aDropAnswers.length <= 2) aDropAnswers.prop('disabled', true);
2913	}
2914}
2915
2916function dropField(btn)
2917{
2918	tr = $(btn).closest('tr');
2919	tr.remove();
2920	checkFieldForLast();
2921}
2922
2923
2924function checkAllTalk(checkbox)
2925{
2926	if (checkbox.checked)
2927	{
2928		$('.form_talks_checkbox').prop('checked', true);
2929	} else
2930	{
2931		$('.form_talks_checkbox').removeProp('checked');
2932	}
2933}
2934
2935function checkAllReport(checkbox)
2936{
2937	if (checkbox.checked)
2938	{
2939		$('.form_reports_checkbox').prop('checked', true);
2940	} else
2941	{
2942		$('.form_reports_checkbox').removeProp('checked');
2943	}
2944}
2945
2946function checkAllPlugins(checkbox) {
2947	
2948	if (checkbox.checked)
2949	{
2950		$('.form_plugins_checkbox').prop('checked', true);
2951	} else
2952	{
2953		$('.form_plugins_checkbox').removeProp('checked');
2954	}
2955}
2956
2957function ajaxTopicMore(topicId, sHash, content, callback_after)
2958{
2959	$.ajax({
2960		type: 'POST',
2961		url: '/blog/ajax_topic_more',
2962		data: { topicId: topicId, hash: sHash }
2963	}).done(function(result)
2964	{
2965		if (!result)
2966		{
2967			msgErrorBox.alert('Ошибка', 'Попробуйте повторить это позже.');
2968		}
2969		
2970		if (result.bStateError)
2971		{
2972			msgErrorBox.alert(result.sMsgTitle, result.sMsg);
2973		} else
2974		{
2975			var poll = content.find('.topic_question');
2976			content.empty();
2977			content.html(result.sTopicMore);
2978			if (poll.length) content.prepent(poll)
2979
2980			if (typeof(callback_after) == 'function') setTimeout(callback_after, 1);
2981		}
2982
2983	});
2984}
2985
2986function submitCommentForm(topicId)
2987{
2988	if (window.tinyMCE) tinyMCE.triggerSave();
2989	var commentText = $('#form_comment').find('#form_comment_text').val();
2990
2991	var mce = tinyMCE.get('form_comment_text');
2992	if (mce) mce.setProgressState(true);
2993
2994
2995	$.ajax({
2996		type: 'POST',
2997		url: aRouter.blog + 'ajaxaddcomment/',
2998		data: {cmt_target_id: topicId, comment_text: commentText, reply: '' }
2999	}).then(function(result)
3000	{
3001		var mce = tinyMCE.get('form_comment_text');
3002		if (mce) mce.setProgressState(false);
3003
3004		if (!result)
3005		{
3006			msgErrorBox.alert('Ошибка', 'Попробуйте повторить это позже.');
3007		}
3008		
3009		if (result.bStateError)
3010		{
3011			msgErrorBox.alert(result.sMsgTitle, result.sMsg);
3012		} else
3013		{
3014			msgNoticeBox.alert('Внимание!', 'Комментарий успешно добавлен.');
3015
3016			if (window.tinyMCE)
3017			{
3018				var mce = tinyMCE.get('form_comment_text');
3019				if (mce) mce.remove();
3020			}
3021			$('#form_comment').remove();			
3022		}
3023	}, function()
3024	{
3025		var mce = tinyMCE.get('form_comment_text');
3026		if (mce) mce.setProgressState(false);
3027
3028		msgErrorBox.alert('Ошибка', 'Попробуйте повторить это позже.');
3029	});
3030}
3031
3032function addCommentForm(NodeAfter, topicId)
3033{
3034	if (window.tinyMCE)
3035	{
3036		var mce = tinyMCE.get('form_comment_text');
3037		if (mce) mce.remove();
3038	}
3039
3040	$('#form_comment').remove();
3041
3042	var form = '<div id="form_comment" style="margin-bottom: 2em">\
3043		<textarea name="comment_text" id="form_comment_text"></textarea>\
3044		<input type="submit" name="submit_comment" value="комментировать" onclick="submitCommentForm(' + topicId + '); return false;">\
3045	</div>';
3046
3047	var formNode = $(form);
3048	NodeAfter.after(formNode);
3049
3050	var InitMCE = function()
3051	{
3052		var options = {
3053			content_css : DIR_STATIC_SKIN + '/css/tinyMCE.css',
3054			mode : "exact",
3055			elements : "form_comment_text",
3056			theme : "advanced",
3057			theme_advanced_toolbar_location : "top",
3058			theme_advanced_toolbar_align : "left",
3059			theme_advanced_buttons1 : "emotions,bold,italic,underline,strikethrough,|,forecolor,blockquote,|,lslink,unlink,lsvideo,lsimage,lsdictionary,code",
3060			theme_advanced_buttons2 : "",
3061			theme_advanced_buttons3 : "",
3062			theme_advanced_statusbar_location : "bottom",
3063			theme_advanced_resizing : true,
3064			theme_advanced_resize_horizontal : 0,
3065			theme_advanced_resizing_use_cookie : 0,
3066			theme_advanced_path : false,
3067			plugins : "lseditor,safari,inlinepopups,media,pagebreak,paste,mention",
3068			paste_auto_cleanup_on_paste : true,
3069			paste_remove_spans : true,
3070			object_resizing : true,
3071			force_br_newlines : true,
3072			forced_root_block : '', 
3073			force_p_newlines : false,
3074			convert_urls : false,
3075			extended_valid_elements : "embed[src|type|allowscriptaccess|allowfullscreen|width|height],img[src|alt|title|align|width|height|hspace|vspace|class|smile]",
3076			media_strict : false,
3077			language : TINYMCE_LANG,
3078			browser_spellcheck:true,
3079			gecko_spellcheck:true,
3080			setup : function(ed)
3081			{
3082				ed.onKeyDown.add(function(ed, evt)
3083				{
3084					if (evt.ctrlKey && !evt.shiftKey && !evt.altKey && !evt.metaKey && evt.keyCode == 13)
3085					{
3086						evt.preventDefault();
3087						$('form_comment').getElement('input[name=submit_comment]').click();
3088					}
3089				});
3090			},
3091			mentions: {
3092				queryBy: 't',
3093				source: function(query, process)
3094				{
3095					$.getJSON(aRouter['summoner'] + 'nick_autocomplete/' + encodeURIComponent(query), function(data)
3096					{
3097						//call process to show the result
3098						if (('bStateError' in data) && (data.bStateError == false))	process(data['results']);
3099					});
3100				},
3101				delimiter: '@',
3102				items: 5,
3103				insert: function(item)
3104				{
3105					return '<a href="' + item.p + '" title="' + item.l + '" class="summoner">@' + item.t + '</a>';
3106				},
3107				render: function(item)
3108				{
3109					return '<li><span><img src="' + item.i + '"></span><div><div>' + item.t + '</div><span>' + item.c + '</span></div></li>';
3110				},
3111				renderDropdown: function()
3112				{
3113					return '<ul class="rte-autocomplete mention-menu"></ul>';
3114				},
3115				sorter: function (items)
3116				{
3117					return items;
3118				}
3119			},
3120
3121			paste_preprocess: function(plugin, args)
3122			{
3123				if (!('content' in args)) return;
3124
3125				var sYouTybeTemplate = '<iframe width="560" height="315" src="https://www.youtube.com/embed/%%videoId%%" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>';
3126				var sContent = args.content.replace(/<a[^\>]*?>.*?<\/\s?a>|https?:\/\/(?:www\.)?youtu\.be\/([a-z0-9\-\_]+(?:\?t=\d+)?)/ig, function(sMatch, sVideoCode, offset, sString)
3127				{
3128					return (typeof(sVideoCode) == 'undefined') ? sMatch : sYouTybeTemplate.replace('%%videoId%%', sVideoCode);
3129				
3130				}).replace(/<a[^\>]*?>.*?<\/\s?a>|https?:\/\/(?:www\.)?youtube\.com\/watch\?v=([a-z0-9\-\_]+(?:\?t=\d+)?)/ig, function(sMatch, sVideoCode, offset, sString)
3131				{
3132					return (typeof(sVideoCode) == 'undefined') ? sMatch : sYouTybeTemplate.replace('%%videoId%%', sVideoCode);
3133				});		
3134
3135				args.content = sContent;
3136			}
3137
3138		};
3139		if (window.tinyMCE) tinyMCE.init(options);
3140	}
3141
3142	if (!window.tinyMCE)
3143	{
3144		$.cachedScript('/engine/lib/external/tiny_mce_3.5.11/tiny_mce.js').done(function(e)
3145		{
3146			tinymce.baseURL = document.location.protocol + '//' + document.location.host + '/engine/lib/external/tiny_mce_3.5.11/';
3147			tinymce.baseURI = new tinymce.util.URI(tinymce.baseURL);
3148
3149			var oLoader = tinymce.ScriptLoader.load;
3150			tinymce.ScriptLoader.add = tinymce.ScriptLoader.load = function(url, callback, scope)
3151			{
3152				oLoader(url + '?' + REV, callback, scope);
3153			};
3154
3155			InitMCE();
3156		});
3157	
3158	} else
3159	{
3160		InitMCE();
3161	}
3162}
3163
3164
3165function tryCommentForm(topicId, afterFunc)
3166{
3167	var params = {cmt_target_id: topicId, reply: ''};
3168	$.ajax({
3169		type: 'POST',
3170		url: aRouter.blog + 'ajaxcancomment/',
3171		data: params
3172	}).done(function(result)
3173	{
3174		if (!result)
3175		{
3176			msgErrorBox.alert('Ошибка', 'Попробуйте повторить это позже.');
3177		}
3178		
3179		if (result.bStateError)
3180		{
3181			msgErrorBox.alert(result.sMsgTitle, result.sMsg);
3182			if (typeof(afterFunc) == 'function') afterFunc(false);
3183		} else
3184		{
3185			if (typeof(afterFunc) == 'function') afterFunc(true);
3186		}
3187	});	
3188}
3189
3190// Глобальный менеджер просмотров с батчингом
3191window.TopicViewManager = window.TopicViewManager || (function() {
3192	var pendingViews = new Set(); // Уникальные ID топиков
3193	var batchTimer = null;
3194	var BATCH_DELAY = 500; // 500мс задержка для сбора запросов
3195	var MAX_BATCH_SIZE = 30; // Максимум топиков в одном запросе
3196	
3197	function addToBatch(topicId) {
3198		if (!topicId || topicId <= 0) return;
3199		
3200		pendingViews.add(parseInt(topicId));
3201		
3202		// Если достигли максимального размера - отправляем немедленно
3203		if (pendingViews.size >= MAX_BATCH_SIZE) {
3204			sendBatch();
3205			return;
3206		}
3207		
3208		// Иначе ждем еще запросы
3209		clearTimeout(batchTimer);
3210		batchTimer = setTimeout(sendBatch, BATCH_DELAY);
3211	}
3212	
3213	function sendBatch() {
3214		if (pendingViews.size === 0) return;
3215		
3216		var topicIds = Array.from(pendingViews);
3217		pendingViews.clear();
3218		clearTimeout(batchTimer);
3219
3220		$.ajax({
3221			type: 'POST',
3222			url: '/include/ajax/topicView.php',
3223			data: {
3224				topic_ids: topicIds,
3225				statistics_type: getStatisticsType(),
3226				security_ls_key: LIVESTREET_SECURITY_KEY // Используем встроенный токен
3227			},
3228			cache: false,
3229			timeout: 3000
3230		});
3231	}
3232	
3233	// Принудительная отправка при уходе со страницы
3234	$(window).on('beforeunload', function() {
3235		if (pendingViews.size > 0) {
3236			sendBatch();
3237		}
3238	});
3239	
3240	return {
3241		registerView: addToBatch,
3242		flushBatch: sendBatch
3243	};
3244})();
3245
3246// Функция определения типа статистики на основе data-атрибутов
3247function getStatisticsType(element) {
3248// Если передан элемент, ищем ближайший контейнер с data-statistics-context
3249	if (element) {
3250		var $container = $(element).closest('[data-statistics-context]');
3251		if ($container.length) {
3252			return $container.data('statistics-context');
3253		}
3254	}
3255
3256// Проверяем контейнеры с data-statistics-context на странице
3257	var $contextContainer = $('[data-statistics-context]').first();
3258	if ($contextContainer.length) {
3259		return $contextContainer.data('statistics-context');
3260	}
3261
3262// По умолчанию общие
3263	return 'general';
3264}
3265
3266// Простая функция для регистрации просмотра
3267function registerTopicView(topicId) {
3268	window.TopicViewManager.registerView(topicId);
3269}
3270
3271// Функция для регистрации клика по топику
3272function registerTopicClick(topicId, statisticsType) {
3273	if (!topicId || topicId <= 0) return;
3274
3275	if (!statisticsType) {
3276		statisticsType = getStatisticsType();
3277	}
3278
3279	$.ajax({
3280		type: 'POST',
3281		url: '/include/ajax/topicClick.php',
3282		data: {
3283			topic_id: parseInt(topicId),
3284			statistics_type: statisticsType,
3285			security_ls_key: LIVESTREET_SECURITY_KEY
3286		},
3287		cache: false,
3288		timeout: 3000
3289	});
3290}
3291
3292$(document).ready(function($)
3293{
3294	$.cachedScript('/plugins/mobile/templates/skin/default/actions/ActionMobile/js/blogs.reads.js?' + REV).done(function(e)
3295	{
3296		$('[tid]', $('#content')).each(function(index, node)
3297		{
3298			const postcardText = $(node).find('.content');
3299			if (postcardText.length)
3300			{
3301				if (!postcardText.find('[title="Читать дальше"]').length)
3302				{
3303					TopicReadManager.attach(postcardText.get(0));
3304				}
3305			}
3306		});
3307	});
3308
3309	$('img[src="/templates/skin/smart-lab-x3/images/profile/premium.svg"]').on('click', function()
3310	{
3311		open('/finansoviy-slovar/smartlab-premium');
3312	});
3313
3314	if (typeof(MutationObserver) != 'undefined')
3315	{
3316		var sContainer = '#wrapper';
3317		var aLoadContainers = ['IFRAME', 'IMG'];
3318		var aResizeContainers = ['DIV'];
3319		
3320		var recalcBanners = function()
3321		{
3322			var nConiatnerHeight = $(sContainer).height();
3323			$('.sticky_block > div').each(function(i,e)
3324			{
3325				if ($(this).height() > 0) // sized
3326				{
3327					$(this).hide();
3328					if ($(sContainer).height() == nConiatnerHeight)
3329					{
3330						$(this).show();
3331						$(this).stick_in_parent({parent: sContainer, spacer: '.sticky_block'});
3332					} else
3333					{
3334						$(this).show();
3335						$(this).trigger('sticky_kit:detach');
3336					}
3337				}
3338			});
3339			$(document.body).trigger('sticky_kit:recalc');
3340		};
3341
3342		var bannerObserver = new MutationObserver(function(mutations)
3343		{
3344			var bRecalcBanners = false;
3345			for (var i = 0, j = mutations.length; i<j; i++)
3346			{
3347				if (mutations[i].type == 'childList')
3348				{
3349					if (mutations[i].addedNodes.length)
3350					{
3351						for (var k = 0, l = mutations[i].addedNodes.length; k<l; k++)
3352						{
3353							if (aLoadContainers.indexOf(mutations[i].addedNodes[k].nodeName) != -1)
3354							{
3355								mutations[i].addedNodes[k].addEventListener('load', recalcBanners, false);
3356							}
3357
3358							if (aResizeContainers.indexOf(mutations[i].addedNodes[k].nodeName) != -1)
3359							{
3360								if (mutations[i].addedNodes[k].style.height && (mutations[i].addedNodes[k].style.height != 'auto')) bRecalcBanners = true;
3361								if (mutations[i].addedNodes[k].style.width && (mutations[i].addedNodes[k].style.width != 'auto')) bRecalcBanners = true;
3362							}
3363						}
3364					}
3365
3366					if (mutations[i].removedNodes.length)
3367					{
3368						for (var k = 0, l = mutations[i].addedNodes.length; k<l; k++)
3369						{
3370							if (aLoadContainers.indexOf(mutations[i].addedNodes[k].nodeName) != -1)
3371							{
3372								mutations[i].addedNodes[k].removeEventListener('load', recalcBanners, false);
3373							}
3374
3375							if (aResizeContainers.indexOf(mutations[i].addedNodes[k].nodeName) != -1)
3376							{
3377								bRecalcBanners = true;
3378							}
3379						}	
3380					}
3381				}
3382			}
3383
3384			if (bRecalcBanners) recalcBanners();
3385		});
3386
3387		$('.sticky_block').not('#listalka').wrapInner('<div/>');
3388		$('.sticky_block > div').each(function(i,e)
3389		{
3390			bannerObserver.observe(this, {childList: true, subtree: true});
3391
3392		});
3393
3394		$(window).on('resize', recalcBanners);
3395
3396	} else
3397	{
3398		$('.sticky_block').not('#listalka').wrapInner('<div/>');
3399		$('.sticky_block > div').stick_in_parent({parent: '#wrapper', spacer: '.sticky_block', recalc_every: 1});
3400	}
3401
3402
3403	$(document).on('scroll', function(event)
3404	{
3405		if (event.target.scrollingElement && event.target.scrollingElement.scrollLeft > 5)
3406		{
3407			$('#listalka').hide();
3408		} else {
3409			$('#listalka').show();
3410		}
3411	});
3412
3413
3414	const nCodes = $('pre, code', '.content');
3415	if (nCodes.length)
3416	{
3417		$.cachedScript('/engine/lib/external/highlight.js/highlight.min.js').done(function()
3418		{
3419			if (typeof(hljs) == 'object')
3420			{
3421				nCodes.each(function(i)
3422				{
3423					hljs.highlightBlock(this);
3424				});
3425			}
3426		});
3427	};
3428	
3429
3430	$('span.scrollUp').on('click', function(e)
3431	{
3432		$.scrollTo('body');
3433	});
3434
3435	$('span.scrollDown').click(function(){
3436
3437		if ($('#googlebanner').length)
3438		{
3439			var o = $('#googlebanner').offset();
3440			$.scrollTo(o.top - document.documentElement.clientHeight + $('#googlebanner').height() + 10);
3441
3442		} else if ($('#comment-children-0').length)
3443		{
3444			var o = $('#comment-children-0').offset();
3445			$.scrollTo(o.top - document.documentElement.clientHeight + $('#comment-children-0').height() + 10);
3446
3447		} else
3448		{
3449			$.scrollTo('#footer');
3450		}
3451	});	
3452
3453	// кастыль для виджетов твиттера
3454	if ($('.twitter-tweet').length)
3455	{
3456		var rx = new RegExp('^' +  DIR_WEB_ROOT.replace(/\//g, '\\/').replace(/\./g, '\\.') + '\\/r\\.php\\?u=([^\\&]+)', 'i');
3457		var rx2 = new RegExp('^\\/r\\.php\\?u=([^\\&]+)', 'i');
3458		$('a', '.twitter-tweet').each(function(i, el)
3459		{
3460			if (el.hasAttribute('href'))
3461			{
3462				if (m = ($(el).attr('href').match(rx) || $(el).attr('href').match(rx2))) $(el).attr('href', decodeURIComponent(m[1]));
3463			}
3464		});
3465		if (!$('#twitter-wjs').length) $.getScript('//platform.twitter.com/widgets.js');
3466	}
3467
3468	// кастыль для виджетов tiktok
3469	if ($('.tiktok-embed').length)
3470	{
3471		var bNeeded = false;
3472		$('.tiktok-embed').each(function(i, el)
3473		{
3474			if (!$(el).find('section,iframe').length)
3475			{
3476				var s = $('<section></section>');
3477				$('*', $(el)).appendTo(s);
3478				$(el).append(s);
3479				bNeeded = true;
3480			}
3481		});
3482		if (bNeeded) $.getScript('//www.tiktok.com/embed.js');
3483	}
3484
3485	setInterval(function()
3486	{
3487		if ($('.blinked').hasClass('hidden'))
3488		{
3489			$('.blinked').removeClass('hidden');
3490		} else
3491		{
3492			$('.blinked').addClass('hidden');
3493		}
3494
3495	}, 500);
3496
3497
3498	try
3499	{
3500		new Tooltips({
3501			attach: '.image_true, img.validated',
3502			maxWidth: 300
3503		});
3504	} catch (e){}
3505
3506
3507	var bAdblock = true;
3508	$('<div class="adsbygoogle" id="ad-detector"></div>').appendTo('body');
3509	if ($('#ad-detector').length)
3510	{
3511		if ($('#ad-detector').is(':visible')) bAdblock = false;
3512		$('#ad-detector').remove();
3513	}
3514
3515	if (bAdblock)
3516	{
3517		var node = $('<div></div>').addClass('user_rek');
3518		node.append('У вас стоит AdBlock, поэтому некоторые функции сайта могут работать неправильно!');
3519		node.append($('<br />'));
3520		node.append('(AdBlock может блокировать некоторые рабочие скрипты на сайте, принимая их за рекламу)');
3521		node.append($('<br />'));
3522		node.append('Добавьте смартлаб в исключения в адблоке.');
3523		node.prependTo('body');
3524	}
3525
3526
3527	if (document.cookie.indexOf('nomobile=') != -1)
3528	{
3529		$('body').prepend($('<div class="user_mobile"><i></i><a href="?mobile=1">Мобильная версия</a></div>'));
3530	}
3531
3532
3533	if ($('#admin_new_bug').length)
3534	{
3535		$('#admin_new_bug').on('click', function()
3536		{
3537			$.ajax({
3538				type: 'POST',
3539				url: aRouter.abuse + 'bug_clean_ajax/',
3540				data: {iBugId: $(this).attr('bug-id')}
3541			}).done(function(result)
3542			{
3543				if (!result)
3544				{
3545					msgErrorBox.alert('Ошибка', 'Попробуйте повторить это позже.');
3546				}
3547				
3548				if (result.bStateError)
3549				{
3550					msgErrorBox.alert(result.sMsgTitle, result.sMsg);
3551					if ('iNewBug' in result)
3552					{
3553						$('#admin_new_bug').attr('bug-id', result.iNewBug);
3554						$('.user_warned a').first().attr('href', aRouter['trading'] + 'smartlab-bugs/goto_comment_' + result.iNewComment + '/#comment' + result.iNewComment);
3555					}
3556				
3557				} else
3558				{
3559					document.location.reload();
3560				}
3561			});	
3562		});
3563	}
3564
3565	if ($('#admin_new_spam').length)
3566	{
3567		$('#admin_new_spam').on('click', function()
3568		{
3569			$.ajax({
3570				type: 'POST',
3571				url: aRouter.abuse + 'spam_clean_ajax/',
3572				data: {iAbuseId: $(this).attr('abuse-id')}
3573			}).done(function(result)
3574			{
3575				if (!result)
3576				{
3577					msgErrorBox.alert('Ошибка', 'Попробуйте повторить это позже.');
3578				}
3579				
3580				if (result.bStateError)
3581				{
3582					msgErrorBox.alert(result.sMsgTitle, result.sMsg);
3583					if ('iNewAbuse' in result)
3584					{
3585						$('#admin_new_spam').attr('abuse-id', result.iNewAbuse);
3586
3587						setTimeout(function()
3588						{
3589							document.location.reload();
3590
3591						}, 1000);
3592					}
3593				
3594				} else
3595				{
3596					document.location.reload();
3597				}
3598			});	
3599
3600		});
3601	}
3602
3603// Добавляем обработчик кликов на ссылки топиков для статистики
3604	$(document).on('click', '.topic h2.title a', function (e) {
3605		var $topicCard = $(this).closest('.topic[tid]');
3606		if ($topicCard.length) {
3607			var topicId = $topicCard.attr('tid');
3608			var statisticsType = getStatisticsType(this);
3609			registerTopicClick(topicId, statisticsType);
3610		}
3611	});
3612
3613	if ($('#content').on('click', function (e) {
3614		if ((e.target.nodeName === 'A') && ($.trim($(e.target).text()) == 'Читать дальше'))
3615		{
3616			if (e.shiftKey || e.ctrlKey) return;
3617			var sHash = $(e.target).attr('hash');
3618			if (sHash)
3619			{
3620				e.preventDefault();
3621				var link = $(e.target);
3622				var topicId = link.closest('.topic').attr('tid');
3623				var content = link.closest('.content');
3624
3625				link.before('<span class="topic_more_loading">Загрузка...</span>');
3626				link.remove();
3627
3628				ajaxTopicMore(topicId, sHash, content, function()
3629				{
3630					if (TopicReadManager) TopicReadManager.attach(content.get(0));
3631					content.each(function(i, el)
3632					{
3633						$(el).find('a.imgpreview:has(img)').attr('data-fancybox', 'gallery_topic_' + topicId);
3634					});
3635
3636					window.allVideos = $('#content .topic .content iframe, #content .topic .content object');
3637					$(window).trigger('resize');
3638				});
3639			}
3640
3641		} else if ((e.target.nodeName === 'SPAN') && (($.trim($(e.target).text()) == 'комментировать') || ($.trim($(e.target).text()) == 'ответить')))
3642		{
3643			if (e.shiftKey || e.ctrlKey) return;
3644			if (!window.DIR_STATIC_SKIN) return; // гости
3645			e.preventDefault();			
3646
3647			var aTopic = $(e.target).closest('.topic');
3648
3649			// more предварительно загружаем
3650			var aMore = aTopic.find('.content').find('a[hash]');
3651			if (aMore.length)
3652			{
3653				var sHash = aMore.attr('hash');
3654				if (sHash)
3655				{
3656					var topicId = aTopic.attr('tid');
3657					var content = aTopic.find('.content');
3658
3659					aMore.before('<span class="topic_more_loading">
3659Загрузка...</span>');
3660					aMore.remove();
3661
3662					ajaxTopicMore(topicId, sHash, content, function()
3663					{
3664						if (TopicReadManager) TopicReadManager.attach(content.get(0));
3665						tryCommentForm(topicId, function(success)
3666						{
3667							if (success)
3668							{
3669								addCommentForm(content, topicId);
3670								$('body').scrollTo($('#form_comment'));
3671							}
3672						});
3673						
3674					});
3675				}
3676			} else
3677			{
3678				// у вопросов нет .content, херачим за шарокнопками
3679				var after = aTopic.find('.content');
3680				if (after.length == 0) after = aTopic.find('.action'); // after = aTopic.find('.topshare');
3681
3682				tryCommentForm(aTopic.attr('tid'), function(success)
3683				{
3684					if (success)
3685					{
3686						addCommentForm(after, aTopic.attr('tid'));
3687					}
3688				});
3689			}
3690		} else if (((e.target.nodeName === 'A') || (e.target.nodeName === 'B')) && ($.inArray($.trim($(e.target).text()), ['S', 'Y', 'Z']) >= 0))
3691		{
3692			e.preventDefault();
3693			var link = (e.target.nodeName === 'B') ? e.target.parentNode : e.target;
3694			var url = link.href.toString();
3695
3696			$.ajax({
3697				type: 'POST',
3698				url:  url + '&ajax=1',
3699				data: {}
3700			}).done(function(result)
3701			{
3702				if (!result)
3703				{
3704					msgErrorBox.alert('Ошибка', 'Попробуйте повторить это позже.');
3705				} else
3706				{
3707					if (result.bStateError)
3708					{
3709						msgErrorBox.alert(result.sMsgTitle, result.sMsg);
3710					} else
3711					{
3712						// переключалка ссылок (ебучий глюк)
3713						switch ($.trim($(e.target).text()))
3714						{
3715							case 'S':
3716							{
3717								if (e.target.nodeName === 'B')
3718								{
3719									// был включен
3720									url = url.replace('/signals_default/', '/signals/');
3721									$(e.target.parentNode).empty().attr('href', url).text('S');
3722								} else
3723								{
3724									url = url.replace('/signals/', '/signals_default/');
3725									$(e.target).empty().attr('href', url).append('<b>S</b>');
3726								}
3727								break;
3728							}
3729
3730							case 'Z':
3731							{
3732								if (e.target.nodeName === 'B')
3733								{
3734									// был включен
3735									url = url.replace('/index_default/', '/index_show/');
3736									$(e.target.parentNode).empty().attr('href', url).text('Z');
3737								} else
3738								{
3739									url = url.replace('/index_show/', '/index_default/');
3740									$(e.target).empty().attr('href', url).append('<b>Z</b>');
3741									$(e.target).closest('.action').find('A > B').each(function(i, el)
3742									{
3743										if ($.trim($(el).text()) == 'Y')
3744										{
3745											var link = el.parentNode;
3746											$(link).empty().append('Y').attr('href', link.href.toString().replace('/index_default/', '/index_hide/'));
3747										}
3748									});
3749								}
3750								break;
3751							}
3752
3753							case 'Y':
3754							{
3755								if (e.target.nodeName === 'B')
3756								{
3757									// был включен
3758									url = url.replace('/index_default/', '/index_hide/');
3759									$(e.target.parentNode).empty().attr('href', url).text('Y');
3760								} else
3761								{
3762									url = url.replace('/index_hide/', '/index_default/');
3763									$(e.target).empty().attr('href', url).append('<b>Y</b>');
3764
3765									$(e.target).closest('.action').find('A > B').each(function(i, el)
3766									{
3767										if ($.trim($(el).text()) == 'Z')
3768										{
3769											var link = el.parentNode;
3770											$(link).empty().append('Z').attr('href', link.href.toString().replace('/index_default/', '/index_show/'));
3771										}
3772									});									
3773								}								
3774								break;
3775							}
3776
3777						}
3778
3779
3780						msgNoticeBox.alert(result.sMsgTitle, result.sMsg);
3781					}
3782				}
3783			});			
3784		}
3785	}));
3786
3787	// убираем конфирмы
3788	$('.topic').find('.action').find('a').each(function(i, el)
3789	{
3790		if ($.inArray($.trim($(el).text()), ['S', 'Y', 'Z']) >= 0)
3791		{
3792			$(el).removeAttr('onclick');
3793		}
3794	});
3795
3796// Отдельный обработчик для кнопки D (WatchLater)
3797$(document).on('click', '.watchlater-control-btn', function(e) {
3798	e.preventDefault();
3799	e.stopPropagation();
3800
3801	var topicId = $(this).data('topic-id') || $(this).closest('.topic').attr('tid');
3802
3803	if (!topicId) {
3804		msgErrorBox.alert('Ошибка', 'Не удалось определить ID топика');
3805		return;
3806	}
3807
3808	// Проверяем доступность модуля WatchLater
3809	if (typeof window.WatchlaterControl === 'undefined') {
3810		// Пытаемся загрузить модуль
3811		$.cachedScript('/templates/skin/smart-lab-x3/js/watchlater-control.js').done(function() {
3812			if (typeof window.WatchlaterControl !== 'undefined') {
3813				window.WatchlaterControl.openDialog(topicId);
3814			} else {
3815				msgErrorBox.alert('Ошибка', 'Модуль WatchLater не удалось загрузить');
3816			}
3817		}).fail(function() {
3818			msgErrorBox.alert('Ошибка', 'Не удалось загрузить модуль WatchLater');
3819		});
3820	} else {
3821		window.WatchlaterControl.openDialog(topicId);
3822	}
3823});
3824
3825
3826	if ($('#content .topic[tid]').length)
3827	{
3828		var aTids = $('#content .topic[tid]').map(function(i,el)
3829		{
3830			return parseInt($(el).attr('tid'));
3831		});
3832
3833
3834		var vf = 'func' + Math.floor(Math.random() * 10000);
3835		window[vf] = function(tid, count)
3836		{
3837			var vt = $('.topic[tid="' + tid + '"] li.views-total');
3838			if (!vt.length) vt = $('.topic[tid="' + tid + '"] .views-total-topic');
3839
3840			if (vt.length)
3841			{
3842				if (typeof(count) == 'string') count = parseInt(count);
3843				if (typeof(count) != 'number') return;
3844
3845				var cv = count;
3846				if (cv > 1000)
3847				{
3848					cv /= 100;
3849					cv = (Math.floor(cv) / 10) + 'К';
3850				};
3851
3852				// Создаем HTML комментарий со старым счетчиком (виден только в исходном коде)
3853				var oldCounterComment = document.createComment('CGI счетчик топика ' + tid + ': ' + count + ' просмотров (' + cv + ') ');
3854				vt[0].appendChild(oldCounterComment);
3855			}
3856		};
3857
3858		$.getScript('/cgi-bin/gcn.fcgi?list=' + ($.makeArray(aTids)).join(',') + '&func=' + vf).done(function()
3859		{
3860			delete window[vf];
3861		});
3862
3863
3864		var aTopicsVals = {};
3865		var aTopicsSends = [];
3866
3867		function topicFill()
3868		{
3869			aTopicsVals = {};
3870			$('div.topic').each(function(index, node)
3871			{
3872				var topic = $(node);
3873
3874				if (aTopicsSends.indexOf(topic.attr('tid')) == -1)
3875				{
3876					var acd = topic.offset();
3877					acd.bottom = acd.top + topic.height();
3878					acd.right = acd.left + topic.width();
3879					aTopicsVals[topic.attr('tid')] = acd;
3880				}
3881			});
3882		};
3883
3884
3885		function topicCheck(event)
3886		{
3887			var aVisible = [];
3888			var body = $('html').get(0);
3889			var scrollYTop = body.scrollTop;
3890			var scrollYBottom = scrollYTop + body.clientHeight;
3891
3892			for (var i in aTopicsVals)
3893			{
3894				if (((aTopicsVals[i].top >= scrollYTop) && (aTopicsVals[i].top <= scrollYBottom)) || ((aTopicsVals[i].top <= scrollYTop) && (aTopicsVals[i].bottom >= scrollYTop))) aVisible.push(i);
3895			}
3896
3897			var aTopics2Send = [];
3898			$.each(aVisible, function(index, tid)
3899			{
3900				if (aTopicsSends.indexOf(tid) == -1) aTopics2Send.push(tid);
3901			});
3902
3903			if (aTopics2Send.length)
3904			{
3905				// Наш старый метод - будет работать месяц еше
3906				new Image().src = '/cgi-bin/scn.fcgi?list=' + aTopics2Send.join(',') + '&r='+Math.random();
3907				
3908				// Регистрация просмотров через батчинг менеджер
3909				$.each(aTopics2Send, function(index, tid) {
3910					registerTopicView(tid);
3911				});
3912				
3913				aTopicsSends = aTopicsSends.concat(aTopics2Send);
3914				$.each(aTopics2Send, function(i,tid)
3915				{
3916					delete aTopicsVals[tid];
3917				});
3918			}
3919		};
3920
3921
3922		window.allVideos = $('#content .topic .content iframe, #content .topic .content object');
3923		var fluidEl = $('#content');
3924		 
3925		window.allVideos.each(function()
3926		{
3927			$(this).data('aspectRatio', this.height / this.width).removeAttr('height').removeAttr('width');
3928		});
3929
3930		function videosCheck()
3931		{
3932			var newWidth = fluidEl.width();
3933			window.allVideos.each(function()
3934			{
3935				var el = $(this);
3936				el.width(newWidth).height(newWidth * el.data('aspectRatio'));  
3937			});
3938		}
3939
3940		$(window).on('resize', function(e)
3941		{
3942			videosCheck();
3943			topicFill();
3944			topicCheck();
3945
3946		}).on('scroll', function(e)
3947		{
3948			topicCheck();
3949
3950		}).trigger('resize');
3951	}
3952
3953	if ($('#search').length) $('#search').autocomplete({
3954
3955		serviceUrl: DIR_WEB_ROOT+'/include/ajax/tagAutocompleter.php',
3956		type: 'POST',
3957		dataType: 'json',
3958		paramName: 'value',
3959		params: {'json': 1},
3960		preventBadQueries: false,
3961		zIndex: 99999,
3962
3963		transformResult: function(response)
3964		{
3965			return { suggestions: response['results'] };
3966		}
3967	});	
3968
3969	if ($('#topic_tags').length) $('#topic_tags').autocomplete({
3970
3971		serviceUrl: DIR_WEB_ROOT+'/include/ajax/tagAutocompleter.php',
3972		type: 'POST',
3973		dataType: 'json',
3974		paramName: 'value',
3975		params: {'json': 1},
3976		preventBadQueries: false,
3977		zIndex: 99999,
3978		delimiter: ',',
3979
3980		transformResult: function(response)
3981		{
3982			return { suggestions: response['results'] };
3983		},
3984
3985		onSelect: function (suggestion)
3986		{
3987			if ($(this).val()) $(this).val($(this).val() + ',');
3988		}		
3989	});
3990
3991	if ($('#topic_tags_forum').length)
3992	{
3993		$(document).ready(function($)
3994		{
3995			$('.forum_tags_ct').on('click', ' > div', function()
3996			{
3997				$(this).remove();
3998			});
3999		});
4000
4001		$('#topic_tags_forum').autocomplete({
4002			serviceUrl: '/forum/ajax_forum_tags/',
4003			type: 'POST',
4004			dataType: 'json',
4005			paramName: 'value',
4006			params: {'json': 1, 'forums' : 1, 'all' : 1},
4007			preventBadQueries: false,
4008			zIndex: 99999,
4009			transformResult: function(response)
4010			{
4011				return { suggestions: response };
4012			},
4013
4014			onSelect: function (suggestion)
4015			{
4016				var n = $('<div/>').attr('title', 'Нажмите, чтобы убрать');
4017				$('<input/>').attr({
4018					type:'hidden',
4019					name:'topic_tags_forum[]',
4020					value: suggestion.data
4021				}).appendTo(n);
4022				$('<label></label>').text(suggestion.value).appendTo(n);
4023				$('.forum_tags_ct').append(n);
4024				$(this).val('');
4025			}
4026		});
4027	}
4028
4029
4030	if ($('#profile_city').length) $('#profile_city').autocomplete({
4031		serviceUrl: DIR_WEB_ROOT + '/include/ajax/cityAutocompleter.php',
4032		type: 'POST',
4033		dataType: 'json',
4034		paramName: 'value',
4035		params: {'json': 1},
4036		autoSelectFirst: true,
4037		preventBadQueries: true,
4038		zIndex: 99999,
4039		transformResult: function(response)
4040		{
4041			return { suggestions: response['results'] };
4042		}
4043	});
4044
4045	if ($('#profile_country').length) $('#profile_country').autocomplete({
4046		serviceUrl: DIR_WEB_ROOT+'/include/ajax/countryAutocompleter.php',
4047		type: 'POST',
4048		dataType: 'json',
4049		paramName: 'value',
4050		params: {'json': 1},
4051		preventBadQueries: false,
4052		zIndex: 99999,
4053		transformResult: function(response)
4054		{
4055			return { suggestions: response['results'] };
4056		}
4057	});
4058
4059	$('.goto-comment-child a').on('click', function()
4060	{
4061		return lsCmtTree.goToChildComment(this);
4062	});
4063
4064	$('#new-comments').on('click', function()
4065	{
4066		if (typeof(lsCmtTree) !== 'undefined') lsCmtTree.goNextComment();
4067	});
4068
4069	$('#search').on('blur', function()
4070	{
4071		if (!this.val()) this.val('Поиск');
4072	});
4073
4074	$('#search').on('click', function()
4075	{
4076		if (this.val() == 'Поиск') this.val('');
4077	});
4078
4079	// вся лютая хуйня ниже борется с тем, что DOM модифицируется и элементы уезжают вниз
4080	// пока мы вкрутим эту залупу, если не попрет - перепишем на mutation observer
4081	var iTimer = 0;
4082	var adtDesignFunction = null;
4083	Object.defineProperty(window, 'adt_design',
4084	{
4085		set: function(value)
4086		{
4087			adtDesignFunction = value;
4088		},
4089
4090		get: function()
4091		{
4092			if (iTimer) clearTimeout(iTimer);
4093			iTimer = setTimeout(function()
4094			{
4095				iTimer = 0;
4096
4097				var node = $('#listalka');
4098				var bHas = node.hasClass('sticky');
4099				if (bHas) node.removeClass('sticky');
4100				node.data('offset', node.offset());
4101				//if (bHas) node.addClass('sticky');
4102
4103			}, 10);
4104			return adtDesignFunction;
4105		}
4106	});
4107});
4108$(document).ready(function($)
4109{
4110	$('body').on('click', '.blog_calendar', function()
4111	{
4112		if ($('.blog_dates').length)
4113		{
4114			$('.blog_dates').toggleClass('show');
4115		}
4116	});
4117
4118	$('.input-daterange').datepicker({
4119
4120		'toDisplay': 'dd.mm.yy',
4121		'toValue' : 'yyyy-mm-dd'
4122
4123	}).on('hide', function(e) {e.preventDefault();});
4124
4125	$('#my_blog_interval_form').on('submit', function(e)
4126	{
4127		e.preventDefault();
4128
4129		var path = $('#my_blog_interval_form').attr('action');
4130			path += ($('#date_from').val()) ? $('#date_from').datepicker('getFormattedDate', 'yyyy-mm-dd') : '-';
4131			path += '/';
4132
4133		if ($('#date_to').val())
4134		{
4135			path+= $('#date_to').datepicker('getFormattedDate', 'yyyy-mm-dd');
4136			path += '/';
4137		}
4138
4139		location.replace(path);
4140		return false;
4141	});
4142
4143	try
4144	{
4145		new Tooltips({
4146			attach: '.place-btn',
4147			maxWidth: 300
4148		});
4149	} catch (e) {}
4150});
4151
4152
4153$(document).ready(function($)
4154{
4155
4156	// уменьшение картинок в пределы окна
4157	$('[data-type="article"]').each(function(i, el)
4158	{
4159		var aId = $(el).data('id');
4160		$(el).find('a.imgpreview:has(img)').attr('data-fancybox', 'gallery_article_' + aId);
4161	});
4162
4163	$('[data-type="comment"]').each(function(i, el)
4164	{
4165		var cId = $(el).data('id');
4166		$(el).find('a.imgpreview:has(img)').attr('data-fancybox', 'gallery_comment_' + cId);
4167	});	
4168
4169
4170	$('.topic').each(function(i, el)
4171	{
4172		var tId = $(el).attr('tid');
4173		$(el).find('a.imgpreview:has(img)').attr('data-fancybox', 'gallery_topic_' + tId);
4174	});
4175
4176	$('.comment').each(function(i, el)
4177	{
4178		var cId = $(el).attr('cid');
4179		$(el).find('a.imgpreview:has(img)').attr('data-fancybox', 'gallery_comment_' + cId);
4180	});	
4181
4182	try
4183	{
4184		Fancybox.bind('[data-fancybox]', {
4185			infinite: false
4186		});
4187	} catch (e) { console.log('Fancybox not found'); }
4188
4189});
4190$(document).ready(function($)
4191{
4192	$('body').on('click', '.chat_more__btn', function(e)
4193	{
4194		e.preventDefault();
4195
4196		var nBtn = $(this);
4197		if (nBtn.next('.chat_more__overlay').length)
4198		{
4199			nBtn.find('~ .chat_more__overlay').show();
4200			nBtn.find('~ .chat_more__list').fadeIn('fast');
4201			nBtn.addClass('menu_active');
4202
4203			return;
4204		}
4205		
4206		var sTargetType = null;
4207		var iTargetId = null;
4208
4209		if (nBtn.parents('.topic[tid]').length)
4210		{
4211			sTargetType = 'topic';
4212			iTargetId = nBtn.parents('.topic[tid]').attr('tid');
4213		
4214		} else if (nBtn.parents('.comment[cid]').length)
4215		{
4216			sTargetType = 'comment';
4217			iTargetId = nBtn.parents('.comment[cid]').attr('cid');
4218		}
4219
4220		if (iTargetId !== null)
4221		{
4222			var data = {target_id: iTargetId}; 
4223			if ((sTargetType == 'comment') && ((typeof(lsCmtTree) !== 'undefined') && ('IsChat' in lsCmtTree))) data['chat'] = 1;
4224
4225			$.ajax({
4226
4227				url: aRouter['topic'] + 'ajax_' + sTargetType + '_menu/',
4228				type: 'POST',
4229				data: data
4230			}).done(function(result)
4231			{
4232				if (!result.bStateError)
4233				{
4234					nBtn.data('loaded', true);
4235					nBtn.after($(result.sHtml));
4236					nBtn.find('~ .chat_more__overlay').show();
4237					nBtn.find('~ .chat_more__list').fadeIn('fast');
4238					nBtn.addClass('menu_active');
4239				} else
4240				{
4241					msgErrorBox.alert(result.sMsgTitle, result.sMsg);
4242				}
4243			});
4244		}
4245	}).on('click', '.chat_more__item a.blacklist', function(e)
4246	{
4247		var userId = $(this).attr('user');
4248		var data = {idUser: userId, action: 'ban'};
4249		var url = '/blacklist/ajax/';
4250		
4251		$.ajax({
4252
4253			url: url,
4254			type: 'POST',
4255			data: data
4256		}).done(function(result)
4257		{
4258			if (!result)
4259			{
4260				msgErrorBox.alert('Внимание!', 'Неизвестная ошибка');
4261				return;
4262			}
4263
4264			if (result.bStateError)
4265			{
4266				return msgErrorBox.alert(result.sMsgTitle, result.sMsg);
4267			} else
4268			{
4269				$('<style></style>').text('.bluid_' + userId + ' { display: none !important; }').appendTo('head');
4270				if (result.sMsg) msgNoticeBox.alert(result.sMsgTitle, result.sMsg);
4271			}
4272		});
4273		
4274	}).on('click', '.chat_more__item a, .chat_more__overlay', function(e)
4275	{
4276		var nBtn = $(this).parents('.chat_more__wrapper').find('.chat_more__btn');
4277		nBtn.find('~ .chat_more__list').fadeOut('fast', function()
4278		{
4279			if (nBtn.data('loaded'))
4280			{
4281				$(this).remove();
4282				nBtn.find('~ .chat_more__overlay').remove();
4283				nBtn.removeClass('menu_active');
4284				nBtn.removeData('loaded');					
4285			} else
4286			{
4287				nBtn.removeClass('menu_active');
4288				nBtn.find('~ .chat_more__list').fadeOut('fast');
4289				nBtn.find('~ .chat_more__overlay').hide();
4290			}
4291		});
4292	});
4293});
4294$(document).ready(function($)
4295{
4296	$('#content .text > blockquote').each(function()
4297	{
4298		$(this).has('blockquote').addClass('bq_many');
4299		$(this).has('blockquote').children('blockquote').hide();
4300	});
4301
4302	$('#content .text blockquote.bq_many').click(function()
4303	{
4304		$(this).children('blockquote').toggle();
4305		$(this).children('blockquote').toggleClass('bq_many_collapsed');
4306	});
4307
4308});
4309
4310
4311$(document).ready(function($)
4312{
4313	var banner = $('#allnews_banner');
4314	if (banner.length) $(banner.parents('div')[2]).prepend(banner);
4315
4316	$('#all_date').datepicker({clearBtn: true, format:'dd.mm.yyyy'}).on('hide', function(e)
4317	{
4318		e.preventDefault();
4319
4320	}).on('changeDate', function(e)
4321	{
4322		if (('date' in e) && (e.format(0, 'yyyy-mm-dd')))
4323		{
4324			if (!/^\d{1,2}\.\d{1,2}\.\d{4}$/.test($.trim($(e.target).val()))) return;
4325
4326			location.replace($(this).attr('route') + 'date/' + e.format(0, 'yyyy-mm-dd') + '/');
4327		} else
4328		{
4329			location.replace($(this).attr('route'));
4330		}
4331	});
4332
4333	$('.refres_btn').on('click', function(e)
4334	{
4335		var button = $(this);
4336		button.toggleClass('enabled');
4337
4338		var data = {};
4339
4340		if (typeof(CURRENT_USER_ID) != 'undefined')
4341		{
4342			data[button.attr('field')] = button.hasClass('enabled') ? 1 : 0;
4343		} else
4344		{
4345			// Гость
4346			if (localStorage) localStorage.setItem(button.attr('field'), button.hasClass('enabled') ? 1 : 0);
4347			return button.trigger('update');
4348		}
4349
4350		$.ajax({
4351
4352			url: '/settings/some_settings_ajax/',
4353			type: 'POST',
4354			data: data
4355
4356		}).done(function(result)
4357		{
4358			if (result.bStateError)
4359			{
4360				msgErrorBox.alert(result.sMsgTitle, result.sMsg);
4361				return;
4362			} else
4363			{
4364				if ((button.attr('field') in result) && parseInt(result[button.attr('field')]))
4365				{
4366					button.addClass('enabled');
4367				} else
4368				{
4369					button.removeClass('enabled');
4370				}
4371				button.trigger('update');
4372			}
4373		});
4374
4375	}).on('update', function(e)
4376	{
4377		var button = $(this);
4378
4379		if ((typeof(CURRENT_USER_ID) == 'undefined') && localStorage)
4380		{
4381			if (parseInt(localStorage.getItem(button.attr('field'))))
4382			{
4383				button.addClass('enabled');
4384			} else
4385			{
4386				button.removeClass('enabled');
4387			}
4388		}
4389
4390		if (button.data('timer'))
4391		{
4392			clearTimeout(button.data('timer'));
4393			button.removeData('timer');
4394		}
4395
4396		if (button.hasClass('enabled'))
4397		{
4398			button.data('timer', setTimeout(function()
4399			{
4400				document.location.reload(true);
4401
4402			}, 60000));
4403		}
4404
4405	}).trigger('update');
4406
4407
4408	$('#disclosure-filters').on('click', 'span', function()
4409	{
4410		$(this).toggleClass('selected');
4411		
4412		var e = '';
4413		$(this).parents('.disclosureFilters').find('>.selected[act_code]').each(function(i,n)
4414		{
4415			if (e !='') e+='&';
4416			e+= encodeURIComponent('act_code[]') + '=' + encodeURIComponent($(n).attr('act_code'));
4417		});
4418
4419		var h = document.location.href.toString().replace(/\/page\d+/, '').replace(/\?.*/, '');
4420		if (e) h += '?' + e;
4421
4422		location.replace(h);
4423	});
4424
4425	$('#allblog-filters').on('click', 'span', function()
4426	{
4427		$(this).toggleClass('selected');
4428		
4429		var e = '';
4430		$(this).parents('.disclosureFilters').find('>.selected[extra_id]').each(function(i,n)
4431		{
4432			if (e !='') e+='&';
4433			e+= encodeURIComponent('extra[]') + '=' + encodeURIComponent($(n).attr('extra_id'));
4434		});
4435
4436		var h = document.location.href.toString().replace(/\/page\d+/, '').replace(/\?.*/, '');
4437		if (e) h += '?' + e;
4438
4439		location.replace(h);
4440	});
4441
4442
4443	function parseUrlParams()
4444	{
4445		var aParams = {};
4446		$.each(document.location.search.substr(1).split('&'), function(i, v)
4447		{
4448			if (!v) return;
4449			var p = v.split('=');
4450
4451			var key = decodeURIComponent(p[0]);
4452			key = key.replace('[','').replace(']', '');
4453			if (key in aParams)
4454			{
4455				if (!Array.isArray(aParams[key])) aParams[key] = [aParams[key]];
4456				aParams[key].push((p.length > 1) ? decodeURIComponent(p[1]) : null);
4457			} else
4458			{
4459				aParams[key] = (p.length > 1) ? decodeURIComponent(p[1]) : null;
4460			}
4461		});
4462		return aParams;
4463	}
4464
4465	function serializeUrlParams(aParams)
4466	{
4467		var sSearch = '';
4468		for (var key in aParams)
4469		{
4470			if (!Array.isArray(aParams[key]))
4471			{
4472				if (sSearch !='') sSearch+='&';				
4473				sSearch += encodeURIComponent(key) + '=' + encodeURIComponent(aParams[key]);
4474
4475			} else
4476			{
4477				for (var ii = 0, j = aParams[key].length; ii < j; ii++)
4478				{
4479					if (sSearch !='') sSearch+='&';
4480					sSearch += encodeURIComponent(key + '[]') + '=' + encodeURIComponent(aParams[key][ii]);
4481				}
4482			}
4483		}
4484
4485		return sSearch ? '?' + sSearch : '';
4486	}
4487
4488	var aParams = parseUrlParams();
4489
4490	$('#allpremium-filters').on('click', 'span', function()
4491	{
4492		$(this).toggleClass('selected');
4493		
4494		aParams['tag'] = [];
4495		$(this).closest('.disclosureFilters').find('>.selected[tag]').each(function(i,n)
4496		{
4497			aParams['tag'].push($(n).attr('tag'));
4498		});
4499
4500		aParams['ticker'] = [];
4501		$(this).closest('.disclosureFilters').find('>.selected[ticker]').each(function(i,n)
4502		{
4503			aParams['ticker'].push($(n).attr('ticker'));
4504		});
4505
4506		aParams['author'] = [];
4507		$(this).closest('.disclosureFilters').find('>.selected[author]').each(function(i,n)
4508		{
4509			aParams['author'].push($(n).attr('author'));
4510		});
4511
4512		aParams['feature'] = [];
4513		$(this).closest('.disclosureFilters').find('>.selected[feature]').each(function(i,n)
4514		{
4515			aParams['feature'].push($(n).attr('feature'));
4516		});
4517
4518		var h = document.location.href.toString().replace(/\/page\d+/, '').replace(/\?.*/, '');
4519		var sSearch = serializeUrlParams(aParams);
4520		if (sSearch) h += sSearch;
4521
4522		location.replace(h);
4523	});
4524
4525	$('#allpremium-tickers').on('click', 'span', function()
4526	{
4527		$(this).toggleClass('selected');
4528
4529		if (!/\/allpremium\//.test(document.location.pathname)) aParams = {};
4530		
4531		aParams['ticker'] = [];
4532		$(this).closest('#allpremium-tickers').find('>.selected[ticker]').each(function(i,n)
4533		{
4534			aParams['ticker'].push($(n).attr('ticker'));
4535		});
4536
4537		var h = '/allpremium/';
4538		if (/\/allpremium\//.test(document.location.pathname)) h = document.location.href.toString().replace(/\/page\d+/, '').replace(/\?.*/, '');
4539
4540		var sSearch = serializeUrlParams(aParams);
4541		if (sSearch) h += sSearch;
4542
4543		location.replace(h);
4544	});
4545
4546	if (/\/allpremium\//.test(document.location.pathname))
4547	{
4548		if ('ticker' in aParams)
4549		{
4550			var aTickers = Array.isArray(aParams['ticker']) ? aParams['ticker'] : [aParams['ticker']];
4551			$.each(aTickers, function(i,v)
4552			{
4553				$('#allpremium-tickers').find('[ticker="' + v + '"]').addClass('selected');
4554
4555			});
4556		}
4557	}
4558
4559	$('#allpremium-search[name="company"]').autocomplete({
4560		serviceUrl: '/forum/ajaxsearchticker/',
4561		type: 'POST',
4562		dataType: 'json',
4563		paramName: 'value',
4564		params: {'reports': 1},
4565		preventBadQueries: false,
4566		transformResult: function(response)
4567		{
4568			return { suggestions: response['results'] };
4569		},
4570		onSelect: function (suggestion)
4571		{
4572			if (!('ticker' in aParams)) aParams['ticker'] = [];
4573			if (!Array.isArray(aParams['ticker'])) aParams['ticker'] = [aParams['ticker']];
4574			
4575			aParams['ticker'].push(suggestion.company_url);
4576
4577			var h = document.location.href.toString().replace(/\/page\d+/, '').replace(/\?.*/, '');
4578			var sSearch = serializeUrlParams(aParams);
4579			if (sSearch) h += sSearch;
4580
4581			location.replace(h);
4582		}
4583	});
4584
4585
4586	$('#allpremium-search[name="author"]').autocomplete({
4587		serviceUrl: '/summoner/nick_autocomplete2/',
4588		type: 'GET',
4589		dataType: 'json',
4590		paramName: 'q',
4591		preventBadQueries: false,
4592		transformResult: function(response)
4593		{
4594			return { suggestions: response['results'] };
4595		},
4596		onSelect: function (suggestion)
4597		{
4598			if (!('author' in aParams)) aParams['author'] = [];
4599			if (!Array.isArray(aParams['author'])) aParams['author'] = [aParams['author']];
4600			
4601			if (aParams['author'].indexOf(suggestion.login) == -1) aParams['author'].push(suggestion.login);
4602
4603			var h = document.location.href.toString().replace(/\/page\d+/, '').replace(/\?.*/, '');
4604			var sSearch = serializeUrlParams(aParams);
4605			if (sSearch) h += sSearch;
4606
4607			location.replace(h);
4608		}
4609	});
4610});
4611var ls = ls || {};
4612ls.plugin = ls.plugin || {};
4613
4614ls.plugin.autoopenid =( function ($) {
4615
4616	var that=this;
4617
4618	this.goServiceLogin = function(service)
4619	{
4620		var sBackUrl = window.location.href;
4621
4622		$.each(document.cookie.split(';'), function(i, el)
4623		{
4624			var aCookie = $.trim(el).split('=');
4625			if (aCookie[0] == 'openidreferal')
4626			{
4627				sBackUrl = decodeURIComponent(aCookie[1]);
4628				return false;
4629			}
4630		});
4631
4632		var data = { service: service, referal: sBackUrl};
4633
4634		$.ajax({
4635
4636			url: DIR_WEB_ROOT + '/login/autoopenid/login-oauth',
4637			type: 'POST',
4638			data: data
4639
4640		}).done(function(result)
4641		{
4642			try
4643			{
4644				if (!result.bStateError)
4645				{
4646					window.location.href=result.sUrl;
4647
4648				} else
4649				{
4650					msgErrorBox.alert(result.sMsgTitle, result.sMsg);
4651				}
4652
4653			} catch (e) {
4654
4655				msgErrorBox.alert(null, 'Вход через '+service+' временно не работает.');
4656			}
4657		});
4658	};
4659
4660	this.removeService = function(type,id)
4661	{
4662		var data = { type: type, id: id };
4663 		
4664		$.ajax({
4665
4666			url: DIR_WEB_ROOT + '/login/autoopenid/service-remove',
4667			type: 'POST',
4668			data: data
4669
4670		}).done(function(result)
4671		{
4672			try
4673			{
4674				if (!result.bStateError)
4675				{
4676					$('#autoopenid-service-connect-item-'+result.id).remove();
4677
4678				} else
4679				{
4680					msgErrorBox.alert(result.sMsgTitle, result.sMsg);
4681				}
4682
4683			} catch (e) {
4684
4685				msgErrorBox.alert(null, 'Вход через '+type+' временно не работает.');
4686			}
4687		});
4688	};
4689
4690	this.showFormData = function() {
4691		$('#aoid-form-mail').hide();
4692		$('#aoid-form-data').show();
4693		$('#aoid-toggle-data').addClass('active');
4694		$('#aoid-toggle-mail').removeClass('active');
4695	};
4696
4697	this.showFormMail = function() {
4698		$('#aoid-form-mail').show();
4699		$('#aoid-form-data').hide();
4700		$('#aoid-toggle-data').removeClass('active');
4701		$('#aoid-toggle-mail').addClass('active');
4702	};
4703
4704	this.toggleFieldMail = function() {
4705		$('#aoid-field-mail').toggle();
4706	};
4707
4708	$(function()
4709	{
4710		$(document).on('click', '.js-autoopenid-auth', function (e)
4711		{
4712			const sService = $(this).data('service');
4713			that.goServiceLogin(sService);
4714			return false;
4715		});
4716		
4717		$(document).on('click', '.js-autoopenid-remove', function (e)
4718		{
4719			that.removeService($(this).data('serviceType'),$(this).attr('data-service-id'));
4720			return false;
4721		});
4722	}.bind(this));
4723
4724	return this;
4725
4726}).call(ls.plugin.autoopenid || {},jQuery);
4727$(document).ready(function($)
4728{
4729	function hideProfileDropdown()
4730	{
4731		$('body').off('click', hideProfileDropdown);
4732		$('.profile .drop-menu-main').removeClass('dropped');
4733		$('.profile .drop-menu-main-sub').removeClass('showing');
4734	}
4735
4736	$('.profile .drop-menu-main').on('click', function(e)
4737	{
4738		var bShowing = $('.profile .drop-menu-main-sub').hasClass('showing');
4739
4740		$('.profile .drop-menu-main').toggleClass('dropped');
4741		$('.profile .drop-menu-main-sub').toggleClass('showing');
4742
4743		if (!bShowing)
4744		{
4745			setTimeout(function()
4746			{
4747				// чтобы клик прошел в другие хендлеры, но не попал сразу
4748				$('body').on('click', hideProfileDropdown);
4749
4750			}, 1);
4751		} else
4752		{
4753			$('body').off('click', hideProfileDropdown);
4754		}
4755	});
4756
4757
4758	function setGlobalCounter(iCounter)
4759	{
4760		$('#notifies_link').find('.notify_round').text(iCounter);
4761		if (iCounter)
4762		{
4763			$('#notifies_link').removeClass('empty');
4764		} else
4765		{
4766			$('#notifies_link').addClass('empty');
4767		}
4768	};
4769
4770
4771	function clearTabCounter(sTab)
4772	{
4773		var d = $.Deferred();
4774
4775		$.ajax({
4776			url: '/profile/ajaxnotifiesclear/',
4777			type: 'POST',
4778			data: { tabs: [sTab]}
4779		}).done(function(response)
4780		{
4781			if (!response.bStateError)
4782			{
4783				d.resolve(response.iTotalCount);
4784			} else
4785			{
4786				d.reject(response.sMsgTitle, response.sMsg);
4787			}
4788		});
4789
4790		return d;
4791	};	
4792
4793
4794	try
4795	{
4796		var globalCounter = 0;
4797		new Tooltips({
4798
4799			popover: true,
4800			openTrigger: 'click',
4801			closeTrigger: 'click',
4802			addClass : 'notifiesPopover',
4803			theme: 'smart-lab-notifies',
4804			maxWidth: '100%',
4805			attach: '#notifies_link',
4806			posMod: { y: "under", x: 'right'},
4807			hasPointer: false,
4808
4809			setContent: async function(target, e)
4810			{
4811				return new Promise(function(resolve, reject)
4812				{
4813					$.ajax({
4814
4815						type: 'GET',
4816						url: '/profile/ajaxnotifies/',
4817						data: {tab: $(target).attr('tab') ? $(target).attr('tab') : 'events'}
4818					
4819					}).then(function(result)
4820					{
4821						if (result.bStateError)
4822						{
4823							msgErrorBox.alert(result.sMsgTitle, result.sMsg);
4824							reject();
4825						} else
4826						{
4827							globalCounter = result.iTotalCount;
4828							resolve(result.sHtml);
4829						}
4830
4831					}, function()
4832					{
4833						reject();
4834						msgErrorBox.alert('Ошибка', 'Неизвестная ошибка!');
4835					});
4836				});
4837			},
4838
4839			onOpen: function(target, e)
4840			{
4841				const self = this;
4842				const container = $(this.container);
4843
4844				try
4845				{
4846					new SimpleBar(this.container);
4847				} catch (e)
4848				{
4849					this.container.style.ovetflowY = 'auto';
4850				}
4851
4852				const nTab = container.find('.notify_tab.notify_tab__active');
4853				if (nTab.length && nTab.find('.notify_count > span').text() != '0')
4854				{
4855					const sTab = nTab.attr('tab');
4856
4857					clearTabCounter(sTab).then(function(iCounter)
4858					{
4859						globalCounter = iCounter;
4860					});
4861				}
4862
4863				container.on('click', '.notify_tab', function()
4864				{
4865					var nTab = $(this);
4866					var sTab = nTab.attr('tab');
4867
4868					var nTabs = container.find('.notify_tabs');
4869					if (nTabs.length)
4870					{
4871						var nActiveTab = nTabs.find('.notify_tab.notify_tab__active');
4872						if (nActiveTab.attr('tab') === nTab.attr('tab')) return;
4873
4874						nActiveTab.removeClass('notify_tab__active').addClass('empty');
4875						setGlobalCounter(globalCounter);
4876
4877						nTab.addClass('notify_tab__active');
4878						container.find('.notify_content').hide();
4879						container.find('.notify_content[id="' + sTab + '"]').show();
4880
4881						clearTabCounter(sTab).then(function(iCounter)
4882						{
4883							globalCounter = iCounter;
4884						});
4885					}
4886				}).on('click', '.reply_section', function()
4887				{
4888					var sLink = $(this).attr('link');
4889					if (sLink)
4890					{
4891						self.close();
4892						document.location.href = sLink;
4893					}
4894				}).on('click', 'a', function()
4895				{
4896					self.close();
4897				});
4898			},
4899
4900			onClose: function()
4901			{
4902				const container = $(this.container);
4903				const nTab = container.find('.notify_tab.notify_tab__active');
4904				if (nTab.length)
4905				{
4906					clearTabCounter(nTab.attr('tab')).then(function(iCounter)
4907					{
4908						globalCounter = iCounter;
4909						setGlobalCounter(iCounter);
4910					});
4911				}
4912				container.off('click');
4913			}
4914
4915		});
4916
4917	} catch (e) {}
4918
4919});
4920function switchTheme(sTheme)
4921{
4922	$('head').find('link[rel="stylesheet"]').filter(function($i)
4923	{
4924		return ($(this).attr('href').match(/^\/templates\/skin\/smart-lab-x3\/themes\//i) !== null);
4925	
4926	}).remove();
4927
4928	if (sTheme != 'black') $('<link/>').attr({'rel':'stylesheet', 'type' : 'text/css', 'href' : '/templates/skin/smart-lab-x3/themes/' + sTheme + '.css'}).appendTo($('head'));
4929}
4930
4931
4932if (typeof(CURRENT_USER_ID) == 'undefined')
4933{
4934	var sTheme = 'black';
4935	if ((typeof(localStorage) !== 'undefined') && (localStorage.getItem('sCurrentTheme') !== null)) sTheme = (['black', 'fullblack', 'white'].indexOf(localStorage.getItem('sCurrentTheme')) != -1) ? localStorage.getItem('sCurrentTheme') : 'black';
4936	switchTheme(sTheme);
4937}
4938
4939$(document).ready(function($)
4940{
4941	$(document).on('click', '.toggle_fz', function(event)
4942	{
4943		event.preventDefault();
4944		var bActive = !$('body').hasClass('large_font') ? 1 : 0;
4945
4946		if (typeof(CURRENT_USER_ID) != 'undefined')
4947		{
4948			var data = {bPostsLargeFont: bActive};
4949			$.ajax({
4950
4951				url: '/settings/some_settings_ajax/',
4952				type: 'POST',
4953				data: data
4954
4955			}).done(function(result)
4956			{
4957				if (result.bStateError)
4958				{
4959					msgErrorBox.alert(result.sMsgTitle, result.sMsg);
4960					return;
4961				} else
4962				{
4963					if (('bPostsLargeFont' in result) && parseInt(result['bPostsLargeFont']))
4964					{
4965						$('body').addClass('large_font');
4966					} else
4967					{
4968						$('body').removeClass('large_font');
4969					}
4970				}
4971			});
4972
4973		} else
4974		{
4975			// Гость
4976			if (typeof(localStorage) != 'undefined') localStorage.setItem('bPostsLargeFont', bActive);
4977			if (bActive)
4978			{
4979				$('body').addClass('large_font');
4980			} else
4981			{
4982				$('body').removeClass('large_font');
4983			}
4984		}
4985		return false;
4986	});
4987
4988	if (typeof(CURRENT_USER_ID) == 'undefined')
4989	{
4990		var bActive = true;
4991		if ((typeof(localStorage) !== 'undefined') && (localStorage.getItem('bPostsLargeFont') !== null)) bActive = parseInt(localStorage.getItem('bPostsLargeFont')) ? true : false;
4992
4993		if (bActive)
4994		{
4995			$('body').addClass('large_font');
4996		} else
4997		{
4998			$('body').removeClass('large_font');
4999		}
5000	}
5001
5002	$(document).on('click', '.theme_switch_btn a', function(e)
5003	{
5004		e.preventDefault();
5005
5006		var sTheme = $(this).attr('theme');
5007		if (typeof(CURRENT_USER_ID) != 'undefined')
5008		{
5009			document.location.href = '/settings/theme/' + sTheme + '/';
5010
5011		} else
5012		{
5013			// Гость
5014			if (typeof(localStorage) != 'undefined') localStorage.setItem('sCurrentTheme', sTheme);
5015			switchTheme(sTheme);
5016		}
5017		return false;
5018	});		
5019});
5020
5021
5022$(document).ready(function($)
5023{
5024	$('#plus100link').on('click', function(e)
5025	{
5026		var sLogin = $(e.target).attr('login');
5027		$.ajax({
5028			type: 'POST',
5029			url: '/profile/ajaxplus100/',
5030			data: {'sLogin': sLogin}
5031		}).done(function(result)
5032		{
5033			if (!result) msgErrorBox.alert('Ошибка', 'Попробуйте повторить это позже.');
5034			if (!result.bStateError)
5035			{
5036				$('#rating_span').text(result.sNewRating);
5037				msgNoticeBox.alert(result.sMsgTitle, result.sMsg);
5038			} else
5039			{
5040				msgErrorBox.alert(result.sMsgTitle, result.sMsg);
5041			}
5042		});
5043	});
5044
5045	$('#allowPostNowlink').on('click', function(e)
5046	{
5047		var sLogin = $(e.target).attr('login');
5048		$.ajax({
5049			type: 'POST',
5050			url: '/profile/ajaxallownewbie/',
5051			data: {'sLogin': sLogin}
5052		}).done(function(result)
5053		{
5054			if (!result) msgErrorBox.alert('Ошибка', 'Попробуйте повторить это позже.');
5055			if (!result.bStateError)
5056			{
5057				msgNoticeBox.alert(result.sMsgTitle, result.sMsg);
5058			} else
5059			{
5060				msgErrorBox.alert(result.sMsgTitle, result.sMsg);
5061			}
5062		});
5063	});
5064
5065	try
5066	{
5067		new Tooltips({
5068			attach: '.detail_status .item, .user_status a, .reputation_item',
5069			maxWidth: 300
5070		});
5071	} catch (e) {}
5072
5073
5074});	
5075
5076function popunderLoadSettings()
5077{
5078	return $.ajax({
5079		type: 'GET',
5080		url: '/config/b_places/place_3.json',
5081		dataType: 'json',
5082		cache: false
5083	});
5084}
5085
5086function popunderSelectBanner(banners)
5087{
5088	if (!Array.isArray(banners)) return null;
5089
5090	var available = [];
5091	banners.forEach(function(bannerInfo)
5092	{
5093		if (!bannerInfo || !bannerInfo['cookie'] || !bannerInfo['img'] || !bannerInfo['url']) return;
5094
5095		var frequency = parseInt(bannerInfo['frequency'], 10);
5096		if (!isFinite(frequency) || frequency <= 0) return;
5097		if (document.cookie.indexOf(bannerInfo['cookie'] + '=') !== -1) return;
5098
5099		available.push({
5100			info: bannerInfo,
5101			frequency: frequency
5102		});
5103	});
5104
5105	var size = 0;
5106	available.forEach(function(banner)
5107	{
5108		size += banner.frequency;
5109	});
5110
5111	var rand = Math.random() * size;
5112	for (var i = 0, j = available.length; i < j; i++)
5113	{
5114		rand -= available[i].frequency;
5115		if (rand <= 0) return available[i].info;
5116	}
5117
5118	return null;
5119}
5120
5121function popunderDialog(bannerInfo)
5122{
5123	var bChoosed = false;
5124	var image = document.createElement('img');
5125	image.className = 'popunder-popup__image';
5126	image.src = bannerInfo['img'];
5127	image.alt = bannerInfo['title'] || '';
5128
5129	var dialog = new ModalDialog({
5130		title: null,
5131		content: image,
5132		class: 'popunder-popup',
5133		onOpen: function()
5134		{
5135			$('.custom-pop-up__inner', $(this.dialog)).on('click', function()
5136			{
5137				bChoosed = true;
5138				this.close();
5139			}.bind(this));
5140		},
5141		onClose: function()
5142		{
5143			$('.custom-pop-up__inner', $(this.dialog)).off('click');
5144
5145			document.cookie = bannerInfo['cookie'] + '=1; path=/; max-age=2678400'; // на месяц
5146
5147			if (bChoosed)
5148			{
5149				if (bannerInfo['track'] && typeof(window.fz) === 'function') window.fz('track', bannerInfo['track']);
5150				document.location.href = bannerInfo['url'];
5151			}
5152		}
5153	});
5154
5155	dialog.open();
5156}
5157
5158function popunderNeedCheck()
5159{
5160	var d = $.Deferred();
5161
5162	popunderLoadSettings().then(function(banners)
5163	{
5164		var bannerInfo = null;
5165		try
5166		{
5167			bannerInfo = popunderSelectBanner(banners);
5168		} catch (e) {}
5169
5170		if (bannerInfo === null)
5171		{
5172			d.resolve(false);
5173			return;
5174		}
5175
5176		popunderDialog(bannerInfo);
5177		d.resolve(true);
5178	}, function()
5179	{
5180		d.resolve(false);
5181	});
5182
5183	return d;
5184}
5185
5186function promoGoOAuthLogin(service)
5187{
5188	var d = $.Deferred();
5189
5190	var data = { service: service, referal: window.location.href};
5191
5192	$.ajax({
5193
5194		url: DIR_WEB_ROOT + '/login/autoopenid/login-oauth',
5195		type: 'POST',
5196		data: data
5197
5198	}).then(function(result)
5199	{
5200		if (!result)
5201		{
5202			msgErrorBox.alert(null, 'Вход через '+service+' временно не работает.');
5203			return d.reject();
5204		}
5205
5206		if (!result.bStateError)
5207		{
5208			d.resolve();
5209			window.location.href=result.sUrl;
5210
5211		} else
5212		{
5213			msgErrorBox.alert(result.sMsgTitle, result.sMsg);
5214			d.reject();
5215		}
5216
5217	}, function()
5218	{
5219		msgErrorBox.alert(null, 'Вход через '+service+' временно не работает.');
5220		d.reject();
5221	});
5222	return d;
5223}
5224
5225function promoRegDialog()
5226{
5227	var d = $.Deferred();
5228
5229	var bChoosed = false;
5230	var dialog = new ModalDialog({
5231
5232		class: 'promo-reg-popup',
5233		content: '\
5234		<div class="reg-modal__logo">\
5235			<svg xmlns="http://www.w3.org/2000/svg" width="210" height="45" viewBox="0 0 210 45" fill="none">\
5236				<path d="M9.89355 31.103C8.05664 31.103 6.43994 30.9258 5.04346 30.5713C3.65771 30.2168 2.36865 29.7764 1.17627 29.25V23.5459H1.72412C2.92725 24.5664 4.25391 25.3506 5.7041 25.8984C7.1543 26.4463 8.56152 26.7202 9.92578 26.7202C10.2695 26.7202 10.7207 26.6826 11.2793 26.6074C11.8486 26.5322 12.3052 26.4141 12.6489 26.2529C13.0679 26.0703 13.4224 25.8179 13.7124 25.4956C14.0024 25.1626 14.1475 24.7275 14.1475 24.1904C14.1475 23.5889 13.9111 23.1001 13.4385 22.7241C12.9658 22.3481 12.4019 22.0742 11.7466 21.9023C10.9302 21.6875 10.0547 21.4834 9.12012 21.29C8.19629 21.0967 7.33154 20.8604 6.52588 20.5811C4.66748 19.9258 3.33545 19.0449 2.52979 17.9385C1.72412 16.832 1.32129 15.4463 1.32129 13.7812C1.32129 11.5361 2.27197 9.7207 4.17334 8.33496C6.07471 6.93848 8.44873 6.24023 11.2954 6.24023C12.7241 6.24023 14.1421 6.38525 15.5493 6.67529C16.9673 6.96533 18.2349 7.35742 19.3521 7.85156V13.3301H18.8203C17.9287 12.5674 16.8384 11.9229 15.5493 11.3965C14.271 10.8701 12.9551 10.6069 11.6016 10.6069C11.0752 10.6069 10.6025 10.6445 10.1836 10.7197C9.76465 10.7949 9.32422 10.9399 8.8623 11.1548C8.48633 11.3267 8.15869 11.5845 7.87939 11.9282C7.61084 12.2612 7.47656 12.6372 7.47656 13.0562C7.47656 13.6685 7.69141 14.1572 8.12109 14.5225C8.56152 14.877 9.40479 15.1992 10.6509 15.4893C11.4565 15.6719 12.23 15.8491 12.9712 16.021C13.7231 16.1929 14.5234 16.4292 15.3721 16.73C17.0371 17.3315 18.2725 18.1426 19.0781 19.1631C19.8945 20.1729 20.3027 21.5103 20.3027 23.1753C20.3027 25.5601 19.3628 27.4775 17.4829 28.9277C15.6138 30.3779 13.084 31.103 9.89355 31.103ZM47.9048 30.668H41.9106V14.7642L37.5439 25.0283H33.4351L29.0684 14.7642V30.668H23.3965V6.67529H30.3413L35.6587 18.5186L40.96 6.67529H47.9048V30.668ZM50.3057 30.668L58.4106 6.67529H64.9849L73.0898 30.668H66.8862L65.3877 25.7695H57.8467L56.3481 30.668H50.3057ZM64.0664 21.4189L61.6172 13.5073L59.168 21.4189H64.0664ZM97.6626 30.668H90.3149L83.6279 21.8701H81.4688V30.668H75.4746V6.67529H85.1265C86.4585 6.67529 87.6187 6.76123 88.6069 6.93311C89.5952 7.09424 90.5083 7.43799 91.3462 7.96436C92.2056 8.51221 92.8877 9.21045 93.3926 10.0591C93.8975 10.897 94.1499 11.9658 94.1499 13.2656C94.1499 15.1025 93.7363 16.5957 92.9092 17.7451C92.082 18.8838 90.9756 19.7915 89.5898 20.4683L97.6626 30.668ZM87.9624 14.0229C87.9624 13.4214 87.8442 12.9058 87.6079 12.4761C87.3823 12.0356 87.001 11.6973 86.4639 11.4609C86.0879 11.2998 85.6689 11.1978 85.207 11.1548C84.7451 11.1118 84.1704 11.0903 83.4829 11.0903H81.4688V17.5518H83.1929C84.0308 17.5518 84.7397 17.5034 85.3198 17.4067C85.9106 17.2993 86.4102 17.0791 86.8184 16.7461C87.2051 16.4453 87.4897 16.0854 87.6724 15.6665C87.8657 15.2476 87.9624 14.6997 87.9624 14.0229ZM104.06 30.668V11.2515H96.9697V6.67529H117.176V11.2515H110.086V30.668H104.06ZM129.631 22.3213H118.948V17.8418H129.631V22.3213ZM149.918 30.668H133.901V6.67529H139.928V26.0918H149.918V30.668ZM150.208 30.668L158.313 6.67529H164.887L172.992 30.668H166.789L165.29 25.7695H157.749L156.25 30.668H150.208ZM163.969 21.4189L161.52 13.5073L159.07 21.4189H163.969ZM194.568 23.3203C194.568 24.5127 194.342 25.5601 193.891 26.4624C193.44 27.3647 192.833 28.1113 192.07 28.7021C191.168 29.4111 190.174 29.916 189.089 30.2168C188.015 30.5176 186.646 30.668 184.98 30.668H175.377V6.67529H183.853C185.614 6.67529 186.946 6.74512 187.849 6.88477C188.762 7.01367 189.616 7.29297 190.411 7.72266C191.27 8.18457 191.909 8.80225 192.328 9.57568C192.758 10.3491 192.973 11.2407 192.973 12.2505C192.973 13.4214 192.677 14.4634 192.086 15.3765C191.506 16.2896 190.701 16.9609 189.669 17.3906V17.5195C191.152 17.8311 192.339 18.4702 193.23 19.437C194.122 20.3931 194.568 21.6875 194.568 23.3203ZM186.85 13.459C186.85 13.0723 186.748 12.6748 186.543 12.2666C186.35 11.8584 186.044 11.563 185.625 11.3804C185.228 11.2085 184.755 11.1172 184.207 11.1064C183.67 11.085 182.864 11.0742 181.79 11.0742H181.371V16.1499H182.128C183.16 16.
52361499 183.879 16.1392 184.288 16.1177C184.707 16.0962 185.136 15.9834 185.577 15.7793C186.06 15.5537 186.393 15.2422 186.576 14.8447C186.758 14.4473 186.85 13.9854 186.85 13.459ZM188.364 23.2075C188.364 22.4663 188.214 21.8862 187.913 21.4673C187.612 21.0483 187.161 20.7314 186.56 20.5166C186.194 20.377 185.689 20.3018 185.045 20.291C184.411 20.2695 183.557 20.2588 182.483 20.2588H181.371V26.269H181.693C183.262 26.269 184.347 26.2583 184.948 26.2368C185.55 26.2153 186.162 26.0703 186.785 25.8018C187.333 25.5654 187.73 25.2217 187.978 24.7705C188.235 24.3086 188.364 23.7876 188.364 23.2075Z" fill="#404040"/>\
5237				<path d="M53.1787 42.668H51.3623V37.8486L50.0391 40.959H48.7939L47.4707 37.8486V42.668H45.752V35.3975H47.8564L49.4678 38.9863L51.0742 35.3975H53.1787V42.668ZM59.4678 40.8271C59.4678 41.1071 59.4124 41.3659 59.3018 41.6035C59.1911 41.8379 59.0462 42.0299 58.8672 42.1797C58.6458 42.3587 58.4163 42.4857 58.1787 42.5605C57.9443 42.6322 57.627 42.668 57.2266 42.668H54.5898V37.1846H56.2939V39.0352H57.2314C57.6253 39.0352 57.9427 39.0628 58.1836 39.1182C58.4277 39.1735 58.6589 39.2826 58.877 39.4453C59.069 39.5885 59.2155 39.7822 59.3164 40.0264C59.4173 40.2705 59.4678 40.5374 59.4678 40.8271ZM57.5879 41.3008C57.6432 41.2292 57.6807 41.1559 57.7002 41.0811C57.7197 41.0029 57.7295 40.9232 57.7295 40.8418C57.7295 40.6074 57.6595 40.4333 57.5195 40.3193C57.3796 40.2054 57.1777 40.1484 56.9141 40.1484H56.2939V41.5596H56.9141C57.0898 41.5596 57.2331 41.5352 57.3438 41.4863C57.4544 41.4342 57.5358 41.3724 57.5879 41.3008ZM61.7334 42.668H60.0244V37.1846H61.7334V42.668ZM71.5771 44.0254H70.0586V42.6484H66.8848V44.0254H65.3662V41.4375H65.7617C66.0091 40.9232 66.2061 40.2949 66.3525 39.5527C66.5023 38.8105 66.5771 38.0212 66.5771 37.1846H71.0352V41.4375H71.5771V44.0254ZM69.3359 41.4375V38.3906H68.1299C68.0745 38.9993 67.9801 39.5641 67.8467 40.085C67.7165 40.6025 67.5586 41.0534 67.373 41.4375H69.3359ZM75.2588 42.8145C74.2236 42.8145 73.4294 42.5671 72.876 42.0723C72.3258 41.5775 72.0508 40.8727 72.0508 39.958C72.0508 39.0628 72.3079 38.3483 72.8223 37.8145C73.3366 37.2806 74.056 37.0137 74.9805 37.0137C75.8203 37.0137 76.4518 37.2399 76.875 37.6924C77.2982 38.1449 77.5098 38.7926 77.5098 39.6357V40.251H73.7646C73.7809 40.5049 73.8346 40.7181 73.9258 40.8906C74.0169 41.0599 74.1374 41.195 74.2871 41.2959C74.4336 41.3968 74.6045 41.4701 74.7998 41.5156C74.9951 41.5579 75.2083 41.5791 75.4395 41.5791C75.638 41.5791 75.8333 41.5579 76.0254 41.5156C76.2174 41.4701 76.3932 41.4115 76.5527 41.3398C76.6927 41.278 76.8213 41.2113 76.9385 41.1396C77.0589 41.068 77.1566 41.0046 77.2314 40.9492H77.4121V42.3604C77.2721 42.4157 77.1436 42.4678 77.0264 42.5166C76.9124 42.5622 76.7546 42.6094 76.5527 42.6582C76.3672 42.707 76.1751 42.7445 75.9766 42.7705C75.7812 42.7998 75.542 42.8145 75.2588 42.8145ZM75.8252 39.2207C75.8154 38.8594 75.7308 38.5843 75.5713 38.3955C75.415 38.2067 75.1742 38.1123 74.8486 38.1123C74.5166 38.1123 74.2562 38.2116 74.0674 38.4102C73.8818 38.6087 73.7793 38.8789 73.7598 39.2207H75.8252ZM83.6182 42.668H81.9092V38.3906H80.5664C80.5566 38.625 80.5485 38.8138 80.542 38.957C80.5387 39.1003 80.5339 39.2614 80.5273 39.4404C80.5046 39.9645 80.4606 40.3926 80.3955 40.7246C80.3304 41.0534 80.2474 41.3236 80.1465 41.5352C80.0488 41.7467 79.9479 41.9128 79.8438 42.0332C79.7428 42.1504 79.6322 42.2611 79.5117 42.3652C79.3978 42.4629 79.2367 42.5443 79.0283 42.6094C78.82 42.6712 78.6296 42.7021 78.457 42.7021C78.3105 42.7021 78.1641 42.6956 78.0176 42.6826C77.8743 42.6729 77.7881 42.668 77.7588 42.668V41.2812H77.8076C77.8206 41.2812 77.8418 41.2829 77.8711 41.2861C77.9036 41.2894 77.9346 41.291 77.9639 41.291C78.042 41.291 78.1234 41.2829 78.208 41.2666C78.2926 41.2471 78.3626 41.2096 78.418 41.1543C78.6426 40.9264 78.7858 40.6221 78.8477 40.2412C78.9128 39.8604 78.9567 39.4339 78.9795 38.9619C78.9925 38.7048 79.0055 38.4183 79.0186 38.1025C79.0316 37.7835 79.0413 37.4775 79.0479 37.1846H83.6182V42.668ZM87.9541 41.2373V40.0947C87.6644 40.124 87.43 40.1501 87.251 40.1729C87.0719 40.1924 86.8962 40.2331 86.7236 40.2949C86.5739 40.347 86.4567 40.4268 86.3721 40.5342C86.2907 40.6383 86.25 40.7783 86.25 40.9541C86.25 41.2113 86.3184 41.3887 86.4551 41.4863C86.5951 41.5807 86.8001 41.6279 87.0703 41.6279C87.2201 41.6279 87.373 41.5938 87.5293 41.5254C87.6855 41.457 87.8271 41.361 87.9541 41.2373ZM87.9541 42.0869C87.8369 42.1846 87.7311 42.2725 87.6367 42.3506C87.5456 42.4287 87.4219 42.5068 87.2656 42.585C87.1126 42.6598 86.9629 42.7168 86.8164 42.7559C86.6732 42.7949 86.4714 42.8145 86.2109 42.8145C85.7259 42.8145 85.3223 42.6517 85 42.3262C84.681 42.0007 84.5215 41.5905 84.5215 41.0957C84.5215 40.6888 84.6029 40.36 84.7656 40.1094C84.9284 39.8587 85.1628 39.6602 85.4688 39.5137C85.778 39.3639 86.1475 39.2598 86.5771 39.2012C87.0068 39.1426 87.4691 39.097 87.9639 39.0645V39.0352C87.9639 38.7324 87.8516 38.5241 87.627 38.4102C87.4056 38.293 87.0719 38.2344 86.626 38.2344C86.4242 38.2344 86.1882 38.2718 85.918 38.3467C85.6478 38.4183 85.3841 38.5111 85.127 38.625H84.9805V37.3018C85.1497 37.2529 85.4232 37.196 85.8008 37.1309C86.1784 37.0625 86.5592 37.0283 86.9434 37.0283C87.8874 37.0283 88.5742 37.1862 89.0039 37.502C89.4368 37.8145 89.6533 38.293 89.6533 38.9375V42.668H87.9541V42.0869ZM93.7256 42.8145C92.6904 42.8145 91.8962 42.5671 91.3428 42.0723C90.7926 41.5775 90.5176 40.8727 90.5176 39.958C90.5176 39.0628 90.7747 38.3483 91.2891 37.8145C91.8034 37.2806 92.5228 37.
52370137 93.4473 37.0137C94.2871 37.0137 94.9186 37.2399 95.3418 37.6924C95.765 38.1449 95.9766 38.7926 95.9766 39.6357V40.251H92.2314C92.2477 40.5049 92.3014 40.7181 92.3926 40.8906C92.4837 41.0599 92.6042 41.195 92.7539 41.2959C92.9004 41.3968 93.0713 41.4701 93.2666 41.5156C93.4619 41.5579 93.6751 41.5791 93.9062 41.5791C94.1048 41.5791 94.3001 41.5579 94.4922 41.5156C94.6842 41.4701 94.86 41.4115 95.0195 41.3398C95.1595 41.278 95.2881 41.2113 95.4053 41.1396C95.5257 41.068 95.6234 41.0046 95.6982 40.9492H95.8789V42.3604C95.7389 42.4157 95.6104 42.4678 95.4932 42.5166C95.3792 42.5622 95.2214 42.6094 95.0195 42.6582C94.834 42.707 94.6419 42.7445 94.4434 42.7705C94.248 42.7998 94.0088 42.8145 93.7256 42.8145ZM94.292 39.2207C94.2822 38.8594 94.1976 38.5843 94.0381 38.3955C93.8818 38.2067 93.641 38.1123 93.3154 38.1123C92.9834 38.1123 92.723 38.2116 92.5342 38.4102C92.3486 38.6087 92.2461 38.8789 92.2266 39.2207H94.292ZM103.115 42.668H101.436V39.2256L100.322 41.5107H99.5996L98.4863 39.2256V42.668H96.8555V37.1846H98.7158L99.9854 39.7236L101.255 37.1846H103.115V42.668ZM112.954 44.0254H111.436V42.6484H108.262V44.0254H106.743V41.4375H107.139C107.386 40.9232 107.583 40.2949 107.729 39.5527C107.879 38.8105 107.954 38.0212 107.954 37.1846H112.412V41.4375H112.954V44.0254ZM110.713 41.4375V38.3906H109.507C109.451 38.9993 109.357 39.5641 109.224 40.085C109.093 40.6025 108.936 41.0534 108.75 41.4375H110.713ZM116.636 42.8145C115.601 42.8145 114.806 42.5671 114.253 42.0723C113.703 41.5775 113.428 40.8727 113.428 39.958C113.428 39.0628 113.685 38.3483 114.199 37.8145C114.714 37.2806 115.433 37.0137 116.357 37.0137C117.197 37.0137 117.829 37.2399 118.252 37.6924C118.675 38.1449 118.887 38.7926 118.887 39.6357V40.251H115.142C115.158 40.5049 115.212 40.7181 115.303 40.8906C115.394 41.0599 115.514 41.195 115.664 41.2959C115.811 41.3968 115.981 41.4701 116.177 41.5156C116.372 41.5579 116.585 41.5791 116.816 41.5791C117.015 41.5791 117.21 41.5579 117.402 41.5156C117.594 41.4701 117.77 41.4115 117.93 41.3398C118.07 41.278 118.198 41.2113 118.315 41.1396C118.436 41.068 118.534 41.0046 118.608 40.9492H118.789V42.3604C118.649 42.4157 118.521 42.4678 118.403 42.5166C118.289 42.5622 118.132 42.6094 117.93 42.6582C117.744 42.707 117.552 42.7445 117.354 42.7705C117.158 42.7998 116.919 42.8145 116.636 42.8145ZM117.202 39.2207C117.192 38.8594 117.108 38.5843 116.948 38.3955C116.792 38.2067 116.551 38.1123 116.226 38.1123C115.894 38.1123 115.633 38.2116 115.444 38.4102C115.259 38.6087 115.156 38.8789 115.137 39.2207H117.202ZM124.951 42.668H123.242V40.3193H121.475V42.668H119.766V37.1846H121.475V39.084H123.242V37.1846H124.951V42.668ZM131.196 40.8271C131.196 41.1071 131.141 41.3659 131.03 41.6035C130.92 41.8379 130.775 42.0299 130.596 42.1797C130.374 42.3587 130.145 42.4857 129.907 42.5605C129.673 42.6322 129.355 42.668 128.955 42.668H126.26V37.1846H127.964V39.0352H128.96C129.354 39.0352 129.671 39.0628 129.912 39.1182C130.156 39.1735 130.387 39.2826 130.605 39.4453C130.798 39.5885 130.944 39.7822 131.045 40.0264C131.146 40.2705 131.196 40.5374 131.196 40.8271ZM129.316 41.3008C129.372 41.2292 129.409 41.1559 129.429 41.0811C129.448 41.0029 129.458 40.9232 129.458 40.8418C129.458 40.6074 129.388 40.4333 129.248 40.3193C129.108 40.2054 128.906 40.1484 128.643 40.1484H127.964V41.5596H128.643C128.818 41.5596 128.962 41.5352 129.072 41.4863C129.183 41.4342 129.264 41.3724 129.316 41.3008ZM136.294 38.3857H133.721V42.668H132.012V37.1846H136.294V38.3857ZM142.212 42.668H140.532V39.3379L138.433 42.668H137.002V37.1846H138.682V40.1631L140.605 37.1846H142.212V42.668ZM151.641 42.668H149.932V40.3193H148.164V42.668H146.455V37.1846H148.164V39.084H149.932V37.1846H151.641V42.668ZM155.972 41.2373V40.0947C155.682 40.124 155.448 40.1501 155.269 40.1729C155.09 40.1924 154.914 40.2331 154.741 40.2949C154.591 40.347 154.474 40.4268 154.39 40.5342C154.308 40.6383 154.268 40.7783 154.268 40.9541C154.268 41.2113 154.336 41.3887 154.473 41.4863C154.613 41.5807 154.818 41.6279 155.088 41.6279C155.238 41.6279 155.391 41.5938 155.547 41.5254C155.703 41.457 155.845 41.361 155.972 41.2373ZM155.972 42.0869C155.854 42.1846 155.749 42.2725 155.654 42.3506C155.563 42.4287 155.439 42.5068 155.283 42.585C155.13 42.6598 154.98 42.7168 154.834 42.7559C154.691 42.7949 154.489 42.8145 154.229 42.8145C153.743 42.8145 153.34 42.6517 153.018 42.3262C152.699 42.0007 152.539 41.5905 152.539 41.0957C152.539 40.6888 152.62 40.36 152.783 40.1094C152.946 39.8587 153.18 39.6602 153.486 39.5137C153.796 39.3639 154.165 39.2598 154.595 39.2012C155.024 39.1426 155.487 39.097 155.981 39.0645V39.0352C155.981 38.7324 155.869 38.5241 155.645 38.4102C155.423 38.293 155.09 38.2344 154.644 38.2344C154.442 38.2344 154.206 38.2718 153.936 38.3467C153.665 38.4183 153.402 38.5111 153.145 38.625H152.998V37.3018C153.167 37.2529 153.441 37.196 153.818 37.1309C154.196 37.0625 154.577 37.0283 154.961 37.0283C155.905 37.0283 156.592 37.1862 157.021 37.502C157.454 37.8145 157.671 38.293 157.671 38.9375V42.668H155.972V42.0869ZM166.562 38.0537C166.771 38.2653 166.935 38.5273 167.056 38.8398C167.176 39.1491 167.236 39.5348 167.236 39.9971C167.236 40.8532 166.981 41.5417 166.47 42.0625C165.962 42.5801 165.275 42.8389 164.409 42.8389C163.459 42.8389 162.752 42.5312 162.29 41.916C161.828 41.3008 161.597 40.3796 161.597 39.1523C161.597 38.918 161.608 38.6803 161.631 38.4395C161.654 38.1953 161.706 37.9007 161.787 37.5557C161.855 37.2692 161.953 36.9844 162.08 36.7012C162.21 36.4147 162.365 36.1803 162.544 35.998C162.746 35.7897 163.021 35.6107 163.369 35.4609C163.717 35.3079 164.206 35.2005 164.834 35.1387C165.13 35.1094 
5237165.482 35.085 165.889 35.0654C166.296 35.0459 166.619 35.0329 166.86 35.0264V36.3105C166.655 36.3203 166.466 36.3301 166.294 36.3398C166.125 36.3464 165.929 36.3577 165.708 36.374C165.571 36.3838 165.392 36.4001 165.171 36.4229C164.95 36.4424 164.761 36.4668 164.604 36.4961C164.416 36.5352 164.24 36.5954 164.077 36.6768C163.918 36.7581 163.786 36.8656 163.682 36.999C163.604 37.0999 163.538 37.235 163.486 37.4043C163.438 37.5703 163.402 37.7754 163.379 38.0195C163.62 37.847 163.874 37.7087 164.141 37.6045C164.408 37.5003 164.696 37.4482 165.005 37.4482C165.311 37.4482 165.597 37.4987 165.864 37.5996C166.131 37.7005 166.364 37.8519 166.562 38.0537ZM165.132 41.3057C165.236 41.1787 165.319 41.0241 165.381 40.8418C165.446 40.6562 165.479 40.3942 165.479 40.0557C165.479 39.6618 165.378 39.346 165.176 39.1084C164.974 38.8675 164.707 38.7471 164.375 38.7471C164.222 38.7471 164.061 38.7666 163.892 38.8057C163.722 38.8447 163.545 38.9163 163.359 39.0205C163.359 39.0531 163.358 39.1003 163.354 39.1621C163.354 39.2207 163.354 39.2744 163.354 39.3232C163.354 39.7952 163.369 40.1533 163.398 40.3975C163.428 40.6416 163.493 40.8678 163.594 41.0762C163.678 41.252 163.792 41.3854 163.936 41.4766C164.079 41.5677 164.245 41.6133 164.434 41.6133C164.541 41.6133 164.66 41.5889 164.79 41.54C164.924 41.4912 165.037 41.4131 165.132 41.3057ZM173.354 42.668H171.675V39.3379L169.575 42.668H168.145V37.1846H169.824V40.1631L171.748 37.1846H173.354V42.668ZM180.044 39.8506C180.044 40.7262 179.821 41.4326 179.375 41.9697C178.932 42.5068 178.385 42.7754 177.734 42.7754C177.461 42.7754 177.223 42.7445 177.021 42.6826C176.82 42.6208 176.605 42.5247 176.377 42.3945V44.6797H174.668V37.1846H176.377V37.7559C176.628 37.541 176.883 37.3669 177.144 37.2334C177.404 37.0999 177.705 37.0332 178.047 37.0332C178.682 37.0332 179.173 37.2855 179.521 37.79C179.87 38.2946 180.044 38.9814 180.044 39.8506ZM178.296 39.8848C178.296 39.3509 178.213 38.9635 178.047 38.7227C177.884 38.4818 177.629 38.3613 177.28 38.3613C177.127 38.3613 176.974 38.3857 176.821 38.4346C176.672 38.4834 176.523 38.5566 176.377 38.6543V41.4131C176.468 41.4521 176.567 41.4798 176.675 41.4961C176.785 41.5124 176.916 41.5205 177.065 41.5205C177.482 41.5205 177.791 41.3854 177.993 41.1152C178.195 40.8418 178.296 40.4316 178.296 39.8848ZM189.141 42.668H187.217L186.006 40.5146H185.591V42.668H183.892V40.5146H183.477L182.241 42.668H180.361L181.978 39.8994C181.906 39.8506 181.842 39.779 181.787 39.6846C181.735 39.5869 181.68 39.46 181.621 39.3037C181.54 39.0824 181.447 38.9212 181.343 38.8203C181.239 38.7194 181.107 38.6689 180.947 38.6689H180.581V37.1846C180.64 37.1846 180.734 37.1829 180.864 37.1797C180.994 37.1764 181.128 37.1748 181.265 37.1748C181.632 37.1748 181.94 37.2432 182.188 37.3799C182.435 37.5133 182.635 37.7542 182.788 38.1025C182.821 38.1774 182.861 38.2783 182.91 38.4053C182.962 38.529 183.009 38.6413 183.052 38.7422C183.175 39.0156 183.285 39.1963 183.379 39.2842C183.477 39.3721 183.647 39.416 183.892 39.416V37.1846H185.591V39.416C185.835 39.4128 186.004 39.3704 186.099 39.2891C186.193 39.2044 186.304 39.0221 186.431 38.7422C186.463 38.6641 186.506 38.5599 186.558 38.4297C186.613 38.2962 186.659 38.1872 186.694 38.1025C186.847 37.7575 187.049 37.5166 187.3 37.3799C187.55 37.2432 187.856 37.1748 188.218 37.1748C188.341 37.1748 188.473 37.1764 188.613 37.1797C188.757 37.1829 188.853 37.1846 188.901 37.1846V38.6494H188.535C188.389 38.6494 188.262 38.6934 188.154 38.7812C188.05 38.8691 187.956 39.0173 187.871 39.2256C187.819 39.3656 187.765 39.4909 187.71 39.6016C187.658 39.7122 187.59 39.8018 187.505 39.8701L189.141 42.668ZM192.632 42.8145C191.597 42.8145 190.802 42.5671 190.249 42.0723C189.699 41.5775 189.424 40.8727 189.424 39.958C189.424 39.0628 189.681 38.3483 190.195 37.8145C190.71 37.2806 191.429 37.0137 192.354 37.0137C193.193 37.0137 193.825 37.2399 194.248 37.6924C194.671 38.1449 194.883 38.7926 194.883 39.6357V40.251H191.138C191.154 40.5049 191.208 40.7181 191.299 40.8906C191.39 41.0599 191.51 41.195 191.66 41.2959C191.807 41.3968 191.978 41.4701 192.173 41.5156C192.368 41.5579 192.581 41.5791 192.812 41.5791C193.011 41.5791 193.206 41.5579 193.398 41.5156C193.59 41.4701 193.766 41.4115 193.926 41.3398C194.066 41.278 194.194 41.2113 194.312 41.1396C194.432 41.068 194.53 41.0046 194.604 40.9492H194.785V42.3604C194.645 42.4157 194.517 42.4678 194.399 42.5166C194.285 42.5622 194.128 42.6094 193.926 42.6582C193.74 42.707 193.548 42.7445 193.35 42.7705C193.154 42.7998 192.915 42.8145 192.632 42.8145ZM193.198 39.2207C193.188 38.8594 193.104 38.5843 192.944 38.3955C192.788 38.2067 192.547 38.1123 192.222 38.1123C191.89 38.1123 191.629 38.2116 191.44 38.4102C191.255 38.6087 191.152 38.8789 191.133 39.2207H193.198Z" fill="#404040"/>\
5238				<circle cx="205" cy="12" r="5" fill="#F9A101"/>\
5239			</svg>\
5240		</div>\
5241		<div class="reg-modal__title-container">\
5242			<h3 class="reg-modal__title-text">Присоединяйся</h3>\
5243			<span class="reg-modal__title-subtitle">чтобы увеличить доходы на бирже</span>\
5244		</div>\
5245		<button class="blue-btn reg-modal__button" onclick="window.fz(\'track\', \'promo reg modal button main click\')">Стать частью сообщества</button>\
5246		<div class="reg-modal__app-container">\
5247			<span class="reg-modal__app-text">Скачай приложение ♥️</span>\
5248			<div class="reg-modal__app-images">\
5249				<a href="https://apps.rustore.ru/app/ru.smartlab" target="_blank" title="Cкачать c RuStore" onclick="window.fz(\'track\', \'promo reg modal button app rustore click\')">\
5250					<img src="/plugins/mobile/templates/skin/default/actions/ActionMobile/images/icons/footer/rs.png?' + REV + '" alt="ru-store" class="reg-modal__app-image">\
5251				</a>\
5252				<a href="https://apps.apple.com/ru/app/smartlab/id1602002316" target="_blank" title="Cкачать c AppStore" onclick="window.fz(\'track\', \'promo reg modal button app appstore click\')">\
5253					<img src="/plugins/mobile/templates/skin/default/actions/ActionMobile/images/icons/footer/as-small.png?' + REV + '" alt="app-store" class="reg-modal__app-image">\
5254				</a>\
5255			</div>\
5256		</div>',
5257		onOpen: function(params)
5258		{
5259			$('.reg-modal__button', $(this.dialog)).on('click', function()
5260			{
5261				bChoosed = true;
5262				this.close();
5263
5264			}.bind(this));
5265		},
5266
5267		onClose: function()
5268		{
5269			$('.reg-modal__button', $(this.dialog)).off('click');
5270			bChoosed ? d.resolve() : d.reject();
5271		},
5272	});
5273
5274	dialog.open();
5275	return d;
5276}
5277
5278function promoAuthDialog()
5279{
5280	var d = $.Deferred();
5281
5282	var aPath = document.location.pathname.split('/').filter(function(e,i,a)
5283	{
5284		return e !== '';
5285	});
5286
5287	var bMobile = (aPath.shift() == 'mobile');
5288
5289	var bChoosed = false;
5290	var dialog = new ModalDialog({
5291
5292		class: 'promo-auth-popup',
5293		content: '\
5294		<div class="auth-modal__logo">\
5295			<svg xmlns="http://www.w3.org/2000/svg" width="210" height="45" viewBox="0 0 210 45" fill="none">\
5296				<path d="M9.89355 31.103C8.05664 31.103 6.43994 30.9258 5.04346 30.5713C3.65771 30.2168 2.36865 29.7764 1.17627 29.25V23.5459H1.72412C2.92725 24.5664 4.25391 25.3506 5.7041 25.8984C7.1543 26.4463 8.56152 26.7202 9.92578 26.7202C10.2695 26.7202 10.7207 26.6826 11.2793 26.6074C11.8486 26.5322 12.3052 26.4141 12.6489 26.2529C13.0679 26.0703 13.4224 25.8179 13.7124 25.4956C14.0024 25.1626 14.1475 24.7275 14.1475 24.1904C14.1475 23.5889 13.9111 23.1001 13.4385 22.7241C12.9658 22.3481 12.4019 22.0742 11.7466 21.9023C10.9302 21.6875 10.0547 21.4834 9.12012 21.29C8.19629 21.0967 7.33154 20.8604 6.52588 20.5811C4.66748 19.9258 3.33545 19.0449 2.52979 17.9385C1.72412 16.832 1.32129 15.4463 1.32129 13.7812C1.32129 11.5361 2.27197 9.7207 4.17334 8.33496C6.07471 6.93848 8.44873 6.24023 11.2954 6.24023C12.7241 6.24023 14.1421 6.38525 15.5493 6.67529C16.9673 6.96533 18.2349 7.35742 19.3521 7.85156V13.3301H18.8203C17.9287 12.5674 16.8384 11.9229 15.5493 11.3965C14.271 10.8701 12.9551 10.6069 11.6016 10.6069C11.0752 10.6069 10.6025 10.6445 10.1836 10.7197C9.76465 10.7949 9.32422 10.9399 8.8623 11.1548C8.48633 11.3267 8.15869 11.5845 7.87939 11.9282C7.61084 12.2612 7.47656 12.6372 7.47656 13.0562C7.47656 13.6685 7.69141 14.1572 8.12109 14.5225C8.56152 14.877 9.40479 15.1992 10.6509 15.4893C11.4565 15.6719 12.23 15.8491 12.9712 16.021C13.7231 16.1929 14.5234 16.4292 15.3721 16.73C17.0371 17.3315 18.2725 18.1426 19.0781 19.1631C19.8945 20.1729 20.3027 21.5103 20.3027 23.1753C20.3027 25.5601 19.3628 27.4775 17.4829 28.9277C15.6138 30.3779 13.084 31.103 9.89355 31.103ZM47.9048 30.668H41.9106V14.7642L37.5439 25.0283H33.4351L29.0684 14.7642V30.668H23.3965V6.67529H30.3413L35.6587 18.5186L40.96 6.67529H47.9048V30.668ZM50.3057 30.668L58.4106 6.67529H64.9849L73.0898 30.668H66.8862L65.3877 25.7695H57.8467L56.3481 30.668H50.3057ZM64.0664 21.4189L61.6172 13.5073L59.168 21.4189H64.0664ZM97.6626 30.668H90.3149L83.6279 21.8701H81.4688V30.668H75.4746V6.67529H85.1265C86.4585 6.67529 87.6187 6.76123 88.6069 6.93311C89.5952 7.09424 90.5083 7.43799 91.3462 7.96436C92.2056 8.51221 92.8877 9.21045 93.3926 10.0591C93.8975 10.897 94.1499 11.9658 94.1499 13.2656C94.1499 15.1025 93.7363 16.5957 92.9092 17.7451C92.082 18.8838 90.9756 19.7915 89.5898 20.4683L97.6626 30.668ZM87.9624 14.0229C87.9624 13.4214 87.8442 12.9058 87.6079 12.4761C87.3823 12.0356 87.001 11.6973 86.4639 11.4609C86.0879 11.2998 85.6689 11.1978 85.207 11.1548C84.7451 11.1118 84.1704 11.0903 83.4829 11.0903H81.4688V17.5518H83.1929C84.0308 17.5518 84.7397 17.5034 85.3198 17.4067C85.9106 17.2993 86.4102 17.0791 86.8184 16.7461C87.2051 16.4453 87.4897 16.0854 87.6724 15.6665C87.8657 15.2476 87.9624 14.6997 87.9624 14.0229ZM104.06 30.668V11.2515H96.9697V6.67529H117.176V11.2515H110.086V30.668H104.06ZM129.631 22.3213H118.948V17.8418H129.631V22.3213ZM149.918 30.668H133.901V6.67529H139.928V26.0918H149.918V30.668ZM150.208 30.668L158.313 6.67529H164.887L172.992 30.668H166.789L165.29 25.7695H157.749L156.25 30.668H150.208ZM163.969 21.4189L161.52 13.5073L159.07 21.4189H163.969ZM194.568 23.3203C194.568 24.5127 194.342 25.5601 193.891 26.4624C193.44 27.3647 192.833 28.1113 192.07 28.7021C191.168 29.4111 190.174 29.916 189.089 30.2168C188.015 30.5176 186.646 30.668 184.98 30.668H175.377V6.67529H183.853C185.614 6.67529 186.946 6.74512 187.849 6.88477C188.762 7.01367 189.616 7.29297 190.411 7.72266C191.27 8.18457 191.909 8.80225 192.328 9.57568C192.758 10.3491 192.973 11.2407 192.973 12.2505C192.973 13.4214 192.677 14.4634 192.086 15.3765C191.506 16.2896 190.701 16.9609 189.669 17.3906V17.5195C191.152 17.8311 192.339 18.4702 193.23 19.437C194.122 20.3931 194.568 21.6875 194.568 23.3203ZM186.85 13.459C186.85 13.0723 186.748 12.6748 186.543 12.2666C186.35 11.8584 186.044 11.563 185.625 11.3804C185.228 11.2085 184.755 11.1172 184.207 11.1064C183.67 11.085 182.864 11.0742 181.79 11.0742H181.371V16.1499H182.128C183.16 16.
52961499 183.879 16.1392 184.288 16.1177C184.707 16.0962 185.136 15.9834 185.577 15.7793C186.06 15.5537 186.393 15.2422 186.576 14.8447C186.758 14.4473 186.85 13.9854 186.85 13.459ZM188.364 23.2075C188.364 22.4663 188.214 21.8862 187.913 21.4673C187.612 21.0483 187.161 20.7314 186.56 20.5166C186.194 20.377 185.689 20.3018 185.045 20.291C184.411 20.2695 183.557 20.2588 182.483 20.2588H181.371V26.269H181.693C183.262 26.269 184.347 26.2583 184.948 26.2368C185.55 26.2153 186.162 26.0703 186.785 25.8018C187.333 25.5654 187.73 25.2217 187.978 24.7705C188.235 24.3086 188.364 23.7876 188.364 23.2075Z" fill="#404040"/>\
5297				<path d="M53.1787 42.668H51.3623V37.8486L50.0391 40.959H48.7939L47.4707 37.8486V42.668H45.752V35.3975H47.8564L49.4678 38.9863L51.0742 35.3975H53.1787V42.668ZM59.4678 40.8271C59.4678 41.1071 59.4124 41.3659 59.3018 41.6035C59.1911 41.8379 59.0462 42.0299 58.8672 42.1797C58.6458 42.3587 58.4163 42.4857 58.1787 42.5605C57.9443 42.6322 57.627 42.668 57.2266 42.668H54.5898V37.1846H56.2939V39.0352H57.2314C57.6253 39.0352 57.9427 39.0628 58.1836 39.1182C58.4277 39.1735 58.6589 39.2826 58.877 39.4453C59.069 39.5885 59.2155 39.7822 59.3164 40.0264C59.4173 40.2705 59.4678 40.5374 59.4678 40.8271ZM57.5879 41.3008C57.6432 41.2292 57.6807 41.1559 57.7002 41.0811C57.7197 41.0029 57.7295 40.9232 57.7295 40.8418C57.7295 40.6074 57.6595 40.4333 57.5195 40.3193C57.3796 40.2054 57.1777 40.1484 56.9141 40.1484H56.2939V41.5596H56.9141C57.0898 41.5596 57.2331 41.5352 57.3438 41.4863C57.4544 41.4342 57.5358 41.3724 57.5879 41.3008ZM61.7334 42.668H60.0244V37.1846H61.7334V42.668ZM71.5771 44.0254H70.0586V42.6484H66.8848V44.0254H65.3662V41.4375H65.7617C66.0091 40.9232 66.2061 40.2949 66.3525 39.5527C66.5023 38.8105 66.5771 38.0212 66.5771 37.1846H71.0352V41.4375H71.5771V44.0254ZM69.3359 41.4375V38.3906H68.1299C68.0745 38.9993 67.9801 39.5641 67.8467 40.085C67.7165 40.6025 67.5586 41.0534 67.373 41.4375H69.3359ZM75.2588 42.8145C74.2236 42.8145 73.4294 42.5671 72.876 42.0723C72.3258 41.5775 72.0508 40.8727 72.0508 39.958C72.0508 39.0628 72.3079 38.3483 72.8223 37.8145C73.3366 37.2806 74.056 37.0137 74.9805 37.0137C75.8203 37.0137 76.4518 37.2399 76.875 37.6924C77.2982 38.1449 77.5098 38.7926 77.5098 39.6357V40.251H73.7646C73.7809 40.5049 73.8346 40.7181 73.9258 40.8906C74.0169 41.0599 74.1374 41.195 74.2871 41.2959C74.4336 41.3968 74.6045 41.4701 74.7998 41.5156C74.9951 41.5579 75.2083 41.5791 75.4395 41.5791C75.638 41.5791 75.8333 41.5579 76.0254 41.5156C76.2174 41.4701 76.3932 41.4115 76.5527 41.3398C76.6927 41.278 76.8213 41.2113 76.9385 41.1396C77.0589 41.068 77.1566 41.0046 77.2314 40.9492H77.4121V42.3604C77.2721 42.4157 77.1436 42.4678 77.0264 42.5166C76.9124 42.5622 76.7546 42.6094 76.5527 42.6582C76.3672 42.707 76.1751 42.7445 75.9766 42.7705C75.7812 42.7998 75.542 42.8145 75.2588 42.8145ZM75.8252 39.2207C75.8154 38.8594 75.7308 38.5843 75.5713 38.3955C75.415 38.2067 75.1742 38.1123 74.8486 38.1123C74.5166 38.1123 74.2562 38.2116 74.0674 38.4102C73.8818 38.6087 73.7793 38.8789 73.7598 39.2207H75.8252ZM83.6182 42.668H81.9092V38.3906H80.5664C80.5566 38.625 80.5485 38.8138 80.542 38.957C80.5387 39.1003 80.5339 39.2614 80.5273 39.4404C80.5046 39.9645 80.4606 40.3926 80.3955 40.7246C80.3304 41.0534 80.2474 41.3236 80.1465 41.5352C80.0488 41.7467 79.9479 41.9128 79.8438 42.0332C79.7428 42.1504 79.6322 42.2611 79.5117 42.3652C79.3978 42.4629 79.2367 42.5443 79.0283 42.6094C78.82 42.6712 78.6296 42.7021 78.457 42.7021C78.3105 42.7021 78.1641 42.6956 78.0176 42.6826C77.8743 42.6729 77.7881 42.668 77.7588 42.668V41.2812H77.8076C77.8206 41.2812 77.8418 41.2829 77.8711 41.2861C77.9036 41.2894 77.9346 41.291 77.9639 41.291C78.042 41.291 78.1234 41.2829 78.208 41.2666C78.2926 41.2471 78.3626 41.2096 78.418 41.1543C78.6426 40.9264 78.7858 40.6221 78.8477 40.2412C78.9128 39.8604 78.9567 39.4339 78.9795 38.9619C78.9925 38.7048 79.0055 38.4183 79.0186 38.1025C79.0316 37.7835 79.0413 37.4775 79.0479 37.1846H83.6182V42.668ZM87.9541 41.2373V40.0947C87.6644 40.124 87.43 40.1501 87.251 40.1729C87.0719 40.1924 86.8962 40.2331 86.7236 40.2949C86.5739 40.347 86.4567 40.4268 86.3721 40.5342C86.2907 40.6383 86.25 40.7783 86.25 40.9541C86.25 41.2113 86.3184 41.3887 86.4551 41.4863C86.5951 41.5807 86.8001 41.6279 87.0703 41.6279C87.2201 41.6279 87.373 41.5938 87.5293 41.5254C87.6855 41.457 87.8271 41.361 87.9541 41.2373ZM87.9541 42.0869C87.8369 42.1846 87.7311 42.2725 87.6367 42.3506C87.5456 42.4287 87.4219 42.5068 87.2656 42.585C87.1126 42.6598 86.9629 42.7168 86.8164 42.7559C86.6732 42.7949 86.4714 42.8145 86.2109 42.8145C85.7259 42.8145 85.3223 42.6517 85 42.3262C84.681 42.0007 84.5215 41.5905 84.5215 41.0957C84.5215 40.6888 84.6029 40.36 84.7656 40.1094C84.9284 39.8587 85.1628 39.6602 85.4688 39.5137C85.778 39.3639 86.1475 39.2598 86.5771 39.2012C87.0068 39.1426 87.4691 39.097 87.9639 39.0645V39.0352C87.9639 38.7324 87.8516 38.5241 87.627 38.4102C87.4056 38.293 87.0719 38.2344 86.626 38.2344C86.4242 38.2344 86.1882 38.2718 85.918 38.3467C85.6478 38.4183 85.3841 38.5111 85.127 38.625H84.9805V37.3018C85.1497 37.2529 85.4232 37.196 85.8008 37.1309C86.1784 37.0625 86.5592 37.0283 86.9434 37.0283C87.8874 37.0283 88.5742 37.1862 89.0039 37.502C89.4368 37.8145 89.6533 38.293 89.6533 38.9375V42.668H87.9541V42.0869ZM93.7256 42.8145C92.6904 42.8145 91.8962 42.5671 91.3428 42.0723C90.7926 41.5775 90.5176 40.8727 90.5176 39.958C90.5176 39.0628 90.7747 38.3483 91.2891 37.8145C91.8034 37.2806 92.5228 37.
52970137 93.4473 37.0137C94.2871 37.0137 94.9186 37.2399 95.3418 37.6924C95.765 38.1449 95.9766 38.7926 95.9766 39.6357V40.251H92.2314C92.2477 40.5049 92.3014 40.7181 92.3926 40.8906C92.4837 41.0599 92.6042 41.195 92.7539 41.2959C92.9004 41.3968 93.0713 41.4701 93.2666 41.5156C93.4619 41.5579 93.6751 41.5791 93.9062 41.5791C94.1048 41.5791 94.3001 41.5579 94.4922 41.5156C94.6842 41.4701 94.86 41.4115 95.0195 41.3398C95.1595 41.278 95.2881 41.2113 95.4053 41.1396C95.5257 41.068 95.6234 41.0046 95.6982 40.9492H95.8789V42.3604C95.7389 42.4157 95.6104 42.4678 95.4932 42.5166C95.3792 42.5622 95.2214 42.6094 95.0195 42.6582C94.834 42.707 94.6419 42.7445 94.4434 42.7705C94.248 42.7998 94.0088 42.8145 93.7256 42.8145ZM94.292 39.2207C94.2822 38.8594 94.1976 38.5843 94.0381 38.3955C93.8818 38.2067 93.641 38.1123 93.3154 38.1123C92.9834 38.1123 92.723 38.2116 92.5342 38.4102C92.3486 38.6087 92.2461 38.8789 92.2266 39.2207H94.292ZM103.115 42.668H101.436V39.2256L100.322 41.5107H99.5996L98.4863 39.2256V42.668H96.8555V37.1846H98.7158L99.9854 39.7236L101.255 37.1846H103.115V42.668ZM112.954 44.0254H111.436V42.6484H108.262V44.0254H106.743V41.4375H107.139C107.386 40.9232 107.583 40.2949 107.729 39.5527C107.879 38.8105 107.954 38.0212 107.954 37.1846H112.412V41.4375H112.954V44.0254ZM110.713 41.4375V38.3906H109.507C109.451 38.9993 109.357 39.5641 109.224 40.085C109.093 40.6025 108.936 41.0534 108.75 41.4375H110.713ZM116.636 42.8145C115.601 42.8145 114.806 42.5671 114.253 42.0723C113.703 41.5775 113.428 40.8727 113.428 39.958C113.428 39.0628 113.685 38.3483 114.199 37.8145C114.714 37.2806 115.433 37.0137 116.357 37.0137C117.197 37.0137 117.829 37.2399 118.252 37.6924C118.675 38.1449 118.887 38.7926 118.887 39.6357V40.251H115.142C115.158 40.5049 115.212 40.7181 115.303 40.8906C115.394 41.0599 115.514 41.195 115.664 41.2959C115.811 41.3968 115.981 41.4701 116.177 41.5156C116.372 41.5579 116.585 41.5791 116.816 41.5791C117.015 41.5791 117.21 41.5579 117.402 41.5156C117.594 41.4701 117.77 41.4115 117.93 41.3398C118.07 41.278 118.198 41.2113 118.315 41.1396C118.436 41.068 118.534 41.0046 118.608 40.9492H118.789V42.3604C118.649 42.4157 118.521 42.4678 118.403 42.5166C118.289 42.5622 118.132 42.6094 117.93 42.6582C117.744 42.707 117.552 42.7445 117.354 42.7705C117.158 42.7998 116.919 42.8145 116.636 42.8145ZM117.202 39.2207C117.192 38.8594 117.108 38.5843 116.948 38.3955C116.792 38.2067 116.551 38.1123 116.226 38.1123C115.894 38.1123 115.633 38.2116 115.444 38.4102C115.259 38.6087 115.156 38.8789 115.137 39.2207H117.202ZM124.951 42.668H123.242V40.3193H121.475V42.668H119.766V37.1846H121.475V39.084H123.242V37.1846H124.951V42.668ZM131.196 40.8271C131.196 41.1071 131.141 41.3659 131.03 41.6035C130.92 41.8379 130.775 42.0299 130.596 42.1797C130.374 42.3587 130.145 42.4857 129.907 42.5605C129.673 42.6322 129.355 42.668 128.955 42.668H126.26V37.1846H127.964V39.0352H128.96C129.354 39.0352 129.671 39.0628 129.912 39.1182C130.156 39.1735 130.387 39.2826 130.605 39.4453C130.798 39.5885 130.944 39.7822 131.045 40.0264C131.146 40.2705 131.196 40.5374 131.196 40.8271ZM129.316 41.3008C129.372 41.2292 129.409 41.1559 129.429 41.0811C129.448 41.0029 129.458 40.9232 129.458 40.8418C129.458 40.6074 129.388 40.4333 129.248 40.3193C129.108 40.2054 128.906 40.1484 128.643 40.1484H127.964V41.5596H128.643C128.818 41.5596 128.962 41.5352 129.072 41.4863C129.183 41.4342 129.264 41.3724 129.316 41.3008ZM136.294 38.3857H133.721V42.668H132.012V37.1846H136.294V38.3857ZM142.212 42.668H140.532V39.3379L138.433 42.668H137.002V37.1846H138.682V40.1631L140.605 37.1846H142.212V42.668ZM151.641 42.668H149.932V40.3193H148.164V42.668H146.455V37.1846H148.164V39.084H149.932V37.1846H151.641V42.668ZM155.972 41.2373V40.0947C155.682 40.124 155.448 40.1501 155.269 40.1729C155.09 40.1924 154.914 40.2331 154.741 40.2949C154.591 40.347 154.474 40.4268 154.39 40.5342C154.308 40.6383 154.268 40.7783 154.268 40.9541C154.268 41.2113 154.336 41.3887 154.473 41.4863C154.613 41.5807 154.818 41.6279 155.088 41.6279C155.238 41.6279 155.391 41.5938 155.547 41.5254C155.703 41.457 155.845 41.361 155.972 41.2373ZM155.972 42.0869C155.854 42.1846 155.749 42.2725 155.654 42.3506C155.563 42.4287 155.439 42.5068 155.283 42.585C155.13 42.6598 154.98 42.7168 154.834 42.7559C154.691 42.7949 154.489 42.8145 154.229 42.8145C153.743 42.8145 153.34 42.6517 153.018 42.3262C152.699 42.0007 152.539 41.5905 152.539 41.0957C152.539 40.6888 152.62 40.36 152.783 40.1094C152.946 39.8587 153.18 39.6602 153.486 39.5137C153.796 39.3639 154.165 39.2598 154.595 39.2012C155.024 39.1426 155.487 39.097 155.981 39.0645V39.0352C155.981 38.7324 155.869 38.5241 155.645 38.4102C155.423 38.293 155.09 38.2344 154.644 38.2344C154.442 38.2344 154.206 38.2718 153.936 38.3467C153.665 38.4183 153.402 38.5111 153.145 38.625H152.998V37.3018C153.167 37.2529 153.441 37.196 153.818 37.1309C154.196 37.0625 154.577 37.0283 154.961 37.0283C155.905 37.0283 156.592 37.1862 157.021 37.502C157.454 37.8145 157.671 38.293 157.671 38.9375V42.668H155.972V42.0869ZM166.562 38.0537C166.771 38.2653 166.935 38.5273 167.056 38.8398C167.176 39.1491 167.236 39.5348 167.236 39.9971C167.236 40.8532 166.981 41.5417 166.47 42.0625C165.962 42.5801 165.275 42.8389 164.409 42.8389C163.459 42.8389 162.752 42.5312 162.29 41.916C161.828 41.3008 161.597 40.3796 161.597 39.1523C161.597 38.918 161.608 38.6803 161.631 38.4395C161.654 38.1953 161.706 37.9007 161.787 37.5557C161.855 37.2692 161.953 36.9844 162.08 36.7012C162.21 36.4147 162.365 36.1803 162.544 35.998C162.746 35.7897 163.021 35.6107 163.369 35.4609C163.717 35.3079 164.206 35.2005 164.834 35.1387C165.13 35.1094 
5297165.482 35.085 165.889 35.0654C166.296 35.0459 166.619 35.0329 166.86 35.0264V36.3105C166.655 36.3203 166.466 36.3301 166.294 36.3398C166.125 36.3464 165.929 36.3577 165.708 36.374C165.571 36.3838 165.392 36.4001 165.171 36.4229C164.95 36.4424 164.761 36.4668 164.604 36.4961C164.416 36.5352 164.24 36.5954 164.077 36.6768C163.918 36.7581 163.786 36.8656 163.682 36.999C163.604 37.0999 163.538 37.235 163.486 37.4043C163.438 37.5703 163.402 37.7754 163.379 38.0195C163.62 37.847 163.874 37.7087 164.141 37.6045C164.408 37.5003 164.696 37.4482 165.005 37.4482C165.311 37.4482 165.597 37.4987 165.864 37.5996C166.131 37.7005 166.364 37.8519 166.562 38.0537ZM165.132 41.3057C165.236 41.1787 165.319 41.0241 165.381 40.8418C165.446 40.6562 165.479 40.3942 165.479 40.0557C165.479 39.6618 165.378 39.346 165.176 39.1084C164.974 38.8675 164.707 38.7471 164.375 38.7471C164.222 38.7471 164.061 38.7666 163.892 38.8057C163.722 38.8447 163.545 38.9163 163.359 39.0205C163.359 39.0531 163.358 39.1003 163.354 39.1621C163.354 39.2207 163.354 39.2744 163.354 39.3232C163.354 39.7952 163.369 40.1533 163.398 40.3975C163.428 40.6416 163.493 40.8678 163.594 41.0762C163.678 41.252 163.792 41.3854 163.936 41.4766C164.079 41.5677 164.245 41.6133 164.434 41.6133C164.541 41.6133 164.66 41.5889 164.79 41.54C164.924 41.4912 165.037 41.4131 165.132 41.3057ZM173.354 42.668H171.675V39.3379L169.575 42.668H168.145V37.1846H169.824V40.1631L171.748 37.1846H173.354V42.668ZM180.044 39.8506C180.044 40.7262 179.821 41.4326 179.375 41.9697C178.932 42.5068 178.385 42.7754 177.734 42.7754C177.461 42.7754 177.223 42.7445 177.021 42.6826C176.82 42.6208 176.605 42.5247 176.377 42.3945V44.6797H174.668V37.1846H176.377V37.7559C176.628 37.541 176.883 37.3669 177.144 37.2334C177.404 37.0999 177.705 37.0332 178.047 37.0332C178.682 37.0332 179.173 37.2855 179.521 37.79C179.87 38.2946 180.044 38.9814 180.044 39.8506ZM178.296 39.8848C178.296 39.3509 178.213 38.9635 178.047 38.7227C177.884 38.4818 177.629 38.3613 177.28 38.3613C177.127 38.3613 176.974 38.3857 176.821 38.4346C176.672 38.4834 176.523 38.5566 176.377 38.6543V41.4131C176.468 41.4521 176.567 41.4798 176.675 41.4961C176.785 41.5124 176.916 41.5205 177.065 41.5205C177.482 41.5205 177.791 41.3854 177.993 41.1152C178.195 40.8418 178.296 40.4316 178.296 39.8848ZM189.141 42.668H187.217L186.006 40.5146H185.591V42.668H183.892V40.5146H183.477L182.241 42.668H180.361L181.978 39.8994C181.906 39.8506 181.842 39.779 181.787 39.6846C181.735 39.5869 181.68 39.46 181.621 39.3037C181.54 39.0824 181.447 38.9212 181.343 38.8203C181.239 38.7194 181.107 38.6689 180.947 38.6689H180.581V37.1846C180.64 37.1846 180.734 37.1829 180.864 37.1797C180.994 37.1764 181.128 37.1748 181.265 37.1748C181.632 37.1748 181.94 37.2432 182.188 37.3799C182.435 37.5133 182.635 37.7542 182.788 38.1025C182.821 38.1774 182.861 38.2783 182.91 38.4053C182.962 38.529 183.009 38.6413 183.052 38.7422C183.175 39.0156 183.285 39.1963 183.379 39.2842C183.477 39.3721 183.647 39.416 183.892 39.416V37.1846H185.591V39.416C185.835 39.4128 186.004 39.3704 186.099 39.2891C186.193 39.2044 186.304 39.0221 186.431 38.7422C186.463 38.6641 186.506 38.5599 186.558 38.4297C186.613 38.2962 186.659 38.1872 186.694 38.1025C186.847 37.7575 187.049 37.5166 187.3 37.3799C187.55 37.2432 187.856 37.1748 188.218 37.1748C188.341 37.1748 188.473 37.1764 188.613 37.1797C188.757 37.1829 188.853 37.1846 188.901 37.1846V38.6494H188.535C188.389 38.6494 188.262 38.6934 188.154 38.7812C188.05 38.8691 187.956 39.0173 187.871 39.2256C187.819 39.3656 187.765 39.4909 187.71 39.6016C187.658 39.7122 187.59 39.8018 187.505 39.8701L189.141 42.668ZM192.632 42.8145C191.597 42.8145 190.802 42.5671 190.249 42.0723C189.699 41.5775 189.424 40.8727 189.424 39.958C189.424 39.0628 189.681 38.3483 190.195 37.8145C190.71 37.2806 191.429 37.0137 192.354 37.0137C193.193 37.0137 193.825 37.2399 194.248 37.6924C194.671 38.1449 194.883 38.7926 194.883 39.6357V40.251H191.138C191.154 40.5049 191.208 40.7181 191.299 40.8906C191.39 41.0599 191.51 41.195 191.66 41.2959C191.807 41.3968 191.978 41.4701 192.173 41.5156C192.368 41.5579 192.581 41.5791 192.812 41.5791C193.011 41.5791 193.206 41.5579 193.398 41.5156C193.59 41.4701 193.766 41.4115 193.926 41.3398C194.066 41.278 194.194 41.2113 194.312 41.1396C194.432 41.068 194.53 41.0046 194.604 40.9492H194.785V42.3604C194.645 42.4157 194.517 42.4678 194.399 42.5166C194.285 42.5622 194.128 42.6094 193.926 42.6582C193.74 42.707 193.548 42.7445 193.35 42.7705C193.154 42.7998 192.915 42.8145 192.632 42.8145ZM193.198 39.2207C193.188 38.8594 193.104 38.5843 192.944 38.3955C192.788 38.2067 192.547 38.1123 192.222 38.1123C191.89 38.1123 191.629 38.2116 191.44 38.4102C191.255 38.6087 191.152 38.8789 191.133 39.2207H193.198Z" fill="#404040"/>\
5298				<circle cx="205" cy="12" r="5" fill="#F9A101"/>\
5299			</svg>\
5300		</div>\
5301		<div class="auth-modal__title-container">\
5302			<h3 class="auth-modal__title-text">Регистрация</h3>\
5303		</div>\
5304		<div class="auth-modal__social-login-container">\
5305			<a class="social-login__btn social-login__btn--yandex auth-modal__social-login-btn" data-service="yandex" onclick="window.fz(\'track\', \'promo auth modal button yandex click\')">\
5306				<svg width="28" height="28">\
5307					<use xlink:href="/plugins/mobile/templates/skin/default/actions/ActionMobile/images/icons/login/sprite.svg?' + REV + '#yandex"></use>\
5308				</svg>\
5309			</a>\
5310			<a class="social-login__btn social-login__btn--vk auth-modal__social-login-btn" data-service="vkontakte" onclick="window.fz(\'track\', \'promo auth modal button vk click\')">\
5311				<svg width="26" height="14">\
5312					<use xlink:href="/plugins/mobile/templates/skin/default/actions/ActionMobile/images/icons/login/sprite.svg?' + REV + '#vk"></use>\
5313				</svg>\
5314				ВК\
5315			</a>\
5316			<div class="auth-modal__separator">\
5317				<div class="auth-modal__separator-line"></div>\
5318				или\
5319				<div class="auth-modal__separator-line"></div>\
5320			</div>\
5321			<a class="auth-modal__reg-link" target="_blank" href="' + (bMobile ? '/mobile' : '') + '/registration/" onclick="window.fz(\'track\', \'promo auth modal link registration click\')">Заполнить форму</a>\
5322			<div class="auth-modal__auth-link-container">\
5323				<span class="auth-modal__auth-link-text">Уже есть аккаунт?</span>\
5324				<a class="auth-modal__auth-link-link" target="_blank" href="' + (bMobile ? '/mobile' : '') + '/login/" onclick="window.fz(\'track\', \'promo auth modal link auth click\')">Войти</a>\
5325			</div>\
5326		</div>',
5327		onOpen: function(params)
5328		{
5329			$('.auth-modal__social-login-container', $(this.dialog)).on('click', 'a[data-service]', function()
5330			{
5331				const sService = $(this).data('service');
5332				promoGoOAuthLogin.call(null, sService);
5333			});
5334
5335			$(this.dialog).on('click', 'a', function()
5336			{
5337				bChoosed = true;
5338				this.close();
5339			
5340			}.bind(this));
5341		},
5342
5343		onClose: function()
5344		{
5345			$('.auth-modal__social-login-container', $(this.dialog)).off('click');
5346			bChoosed ? d.resolve() : d.reject();
5347		}
5348	});
5349
5350	dialog.open();
5351	return d;
5352}
5353
5354function promoShowDialogs()
5355{
5356	var d = $.Deferred();
5357	promoRegDialog().then(function()
5358	{
5359		promoAuthDialog().then(function()
5360		{
5361			// ну врде куда-то ткнули
5362			d.resolve();
5363		}, function()
5364		{
5365			// просто закрыли диалог
5366			d.reject();
5367		});
5368	}, function()
5369	{
5370		// просто закрыли диалог
5371		d.reject();
5372	});
5373	return d;
5374}
5375
5376function promoNeedCheck()
5377{
5378	var d = $.Deferred();
5379
5380	const lastCloseKey = 'promo.reg.lastClose';
5381	const lastCloseTimeout = 1000*60*5;
5382
5383	if (typeof(CURRENT_USER_ID) !== 'undefined') return d.resolve(); // авторизованные
5384	if ($('.login__form, .register-page__form, #login_dialog').length) return d.resolve(); // формы регистрации\авторизации
5385	if (typeof(localStorage) == 'undefined') return d.resolve(); // нет локального хранилища
5386	
5387	var sClosedDt = localStorage.getItem(lastCloseKey);
5388	if ((sClosedDt == null) || ((new Date()).getTime() - sClosedDt > lastCloseTimeout))
5389	{
5390		promoShowDialogs().then(function()
5391		{
5392			localStorage.removeItem(lastCloseKey);
5393			d.resolve();
5394
5395		}, function()
5396		{
5397			// просто закрыли диалог
5398			localStorage.setItem(lastCloseKey, (new Date()).getTime());
5399			d.reject();
5400		});
5401	} else
5402	{
5403		d.reject();
5404	}
5405	return d;
5406}
5407
5408if (!window.smartlabPromoInitialized)
5409{
5410	window.smartlabPromoInitialized = true;
5411	$(document).ready(function()
5412	{
5413		popunderNeedCheck().then(function(bPopunderShown)
5414		{
5415			if (bPopunderShown || typeof(CURRENT_USER_ID) !== 'undefined') return;
5416
5417			const promoCheckTimeout = 30000;
5418			const fStarter = function()
5419			{
5420				promoNeedCheck().then(function()
5421				{
5422					// do nothing loop
5423				}, function()
5424				{
5425					// перезапуск через 30 секунд
5426					setTimeout(fStarter, promoCheckTimeout);
5427				});
5428			};
5429			setTimeout(fStarter, promoCheckTimeout);
5430		});
5431	});
5432}
5433
5434$(document).ready(function($)
5435{
5436	// панель слева - забаненые
5437	var addEmployeeBtn = $('#add_company_employee').first();
5438	if (addEmployeeBtn.length && addEmployeeBtn.attr('company-id'))
5439	{
5440		var sWindowContent = '<div class="employeeBox">\
5441								<div>\
5442									<span>Введите имя:</span><br/>\
5443									<div>\
5444										<input type="text"/>\
5445									</div>\
5446								</div><br/>\
5447								<span>Список сотрудников:</span>\
5448								<ul>\
5449									<li>Загружаю...</li>\
5450								</ul>\
5451						</div>';
5452
5453		var employeeDialogParam = {
5454
5455			id: 'employeeDialog',
5456			title: 'Список сотрудников компании',
5457			content: sWindowContent,
5458			companyId: addEmployeeBtn.attr('company-id'),
5459			width: 450,
5460
5461			onOpen: function()
5462			{
5463				var self = this;
5464				this.options.loadEmployeeList.call(this);
5465				
5466				var list = $(this.dialog).find('ul');
5467				$(this.dialog).on('click', '.removeFromEmployee', function()
5468				{
5469					$(this).parents('li').remove();
5470					if (!list.find('li').length) list.append('<li id="0">Нет сотрудников.</li>');
5471				});
5472
5473				$(this.dialog).find('input:text').autocomplete({
5474					serviceUrl: '/summoner/nick_autocomplete2/',
5475					type: 'GET',
5476					dataType: 'json',
5477					paramName: 'q',
5478					preventBadQueries: false,
5479					zIndex: 99999,
5480					transformResult: function(response)
5481					{
5482						return { suggestions: response.results };
5483					},
5484					onSelect: function (suggestion)
5485					{
5486						if (!list.find('li#' + suggestion.id).length)
5487						{
5488							var a = $('<a/>').attr('href', suggestion.url).text(suggestion.value);
5489							var li = $('<li/>').attr('id', suggestion.id);
5490							li.append(a);
5491							li.append($('<span class="removeFromEmployee" title="Удалить из сотрудников">&ndash;</span>'));
5492							list.append(li);
5493							$(this).val('');
5494
5495							if (list.find('li#0').length) list.find('li#0').remove(); // убираем "нет сотрудников"
5496
5497							var iScroll = list[0].scrollHeight - list[0].clientHeight;
5498							list[0].scrollTop = iScroll ? iScroll : 0;
5499						}
5500					}
5501				});
5502			},
5503
5504			loadEmployeeList: function()
5505			{
5506				var self = this;
5507				$.ajax({
5508
5509					url: '/panel/ajaxemployeelist',
5510					type: 'GET',
5511					data: {id: this.options.companyId}
5512
5513				}).done(function(result)
5514				{
5515					if (!result) return msgErrorBox.alert('Внимание!', 'Неизвестная ошибка');
5516					if (result.bStateError) return msgErrorBox.alert(result.sMsgTitle, result.sMsg);
5517
5518					var list = $(self.dialog).find('ul');
5519					list.empty();
5520					if (('employee' in result) && result.employee.length)
5521					{
5522						$.each(result.employee, function(i,v)
5523						{
5524							var li = $('<li/>');
5525							li.attr('id', v['id']);
5526							var a = $('<a/>').attr('href', v['url']).text(v['name']);
5527							li.append(a);
5528
5529							li.append($('<span class="removeFromEmployee" title="Удалить из сотрудников">&ndash;</span>'));
5530							list.append(li);
5531						});
5532
5533					} else
5534					{
5535						list.append('<li id="0">Нет сотрудников.</li>');
5536					}
5537				});
5538			},
5539
5540			saveEmployeeList: function()
5541			{
5542				var self = this;
5543
5544				var aEmployee = [];
5545				$(this.dialog).find('ul').find('li').each(function(i, n)
5546				{
5547					aEmployee.push(this.id);
5548				});
5549
5550				if (aEmployee.indexOf(0) !== -1) aEmployee = aEmployee.splice(aEmployee.indexOf(0), 1);
5551
5552				$.ajax({
5553
5554					url: '/panel/ajaxemployeelist',
5555					type: 'POST',
5556					data: {id: self.options.companyId, employee: aEmployee}
5557
5558				}).done(function(result)
5559				{
5560					if (!result) return msgErrorBox.alert('Внимание!', 'Неизвестная ошибка');
5561
5562					if (result.bStateError)
5563					{
5564						msgErrorBox.alert(result.sMsgTitle, result.sMsg);
5565					} else
5566					{
5567						if (result.sMsg) msgNoticeBox.alert(result.sMsgTitle, result.sMsg);
5568					}
5569				});
5570			},
5571
5572			onConfirm: function()
5573			{
5574				this.options.saveEmployeeList.call(this);
5575				this.close();
5576			},
5577
5578			onClose: function()
5579			{
5580				$(this.dialog).off('click');
5581			}
5582		};
5583
5584		addEmployeeBtn.on('click', function()
5585		{
5586			var box = new ConfirmDialog(employeeDialogParam);
5587			box.open();
5588		});
5589	}
5590
5591});
5592$(document).ready(function($)
5593{
5594
5595	$('body').on('click', '#subscribe-sidebar-company', function(e)
5596	{
5597		var nBtn = $(this);
5598		var sCompany = $(this).attr('company');
5599		var bSubscribed = parseInt($(this).attr('subscribed')) ? true : false;
vendor: 8,543 bytes, lines 5600-5650
5600
5601		if (!bSubscribed) window.fz('track', 'subscribe company-blog-join');
5602
5603		$.ajax({
5604			type: 'POST',
5605			url: '/plugins/company/include/ajax/toggleCompanySubscribe.php',
5606			data: {company:sCompany, subscribe: !bSubscribed}
5607		}).done(function(result)
5608		{
5609			if (!result) return;
5610			if (!result.bStateError)
5611			{
5612				// обновим кеш
5613				nBtn.attr('subscribed', result.bState ? 1 : 0);
5614				if (result.bState)
5615				{
5616					nBtn.text('Вы подписаны');
5617
5618					sFriendsTooltipHtml = result.sMsg + '<br />Посмотреть список вашей подписки вы можете в <a href="/profile/' + CURRENT_USER_LOGIN + '/">своем профиле</a>';
5619					nBtn.trigger('subscribed');
5620
5621				} else
5622				{
5623					nBtn.text('Подписаться на блог');
5624				}
5625
5626				msgNoticeBox.alert(result.sMsgTitle, result.sMsg);
5627			} else
5628			{
5629				msgErrorBox.alert(result.sMsgTitle, result.sMsg);
5630			}
5631		});
5632	});
5633});
5634var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(c,f,g){c instanceof String&&(c=String(c));for(var h=c.length,d=0;d<h;d++){var l=c[d];if(f.call(g,l,d,c))return{i:d,v:l}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.ISOLATE_POLYFILLS=!1;$jscomp.FORCE_POLYFILL_PROMISE=!1;$jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION=!1;
5635$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(c,f,g){if(c==Array.prototype||c==Object.prototype)return c;c[f]=g.value;return c};$jscomp.getGlobal=function(c){c=["object"==typeof globalThis&&globalThis,c,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var f=0;f<c.length;++f){var g=c[f];if(g&&g.Math==Math)return g}throw Error("Cannot find global object");};$jscomp.global=$jscomp.getGlobal(this);
5636$jscomp.IS_SYMBOL_NATIVE="function"===typeof Symbol&&"symbol"===typeof Symbol("x");$jscomp.TRUST_ES6_POLYFILLS=!$jscomp.ISOLATE_POLYFILLS||$jscomp.IS_SYMBOL_NATIVE;$jscomp.polyfills={};$jscomp.propertyToPolyfillSymbol={};$jscomp.POLYFILL_PREFIX="$jscp$";var $jscomp$lookupPolyfilledValue=function(c,f){var g=$jscomp.propertyToPolyfillSymbol[f];if(null==g)return c[f];g=c[g];return void 0!==g?g:c[f]};
5637$jscomp.polyfill=function(c,f,g,h){f&&($jscomp.ISOLATE_POLYFILLS?$jscomp.polyfillIsolated(c,f,g,h):$jscomp.polyfillUnisolated(c,f,g,h))};$jscomp.polyfillUnisolated=function(c,f,g,h){g=$jscomp.global;c=c.split(".");for(h=0;h<c.length-1;h++){var d=c[h];if(!(d in g))return;g=g[d]}c=c[c.length-1];h=g[c];f=f(h);f!=h&&null!=f&&$jscomp.defineProperty(g,c,{configurable:!0,writable:!0,value:f})};
5638$jscomp.polyfillIsolated=function(c,f,g,h){var d=c.split(".");c=1===d.length;h=d[0];h=!c&&h in $jscomp.polyfills?$jscomp.polyfills:$jscomp.global;for(var l=0;l<d.length-1;l++){var b=d[l];if(!(b in h))return;h=h[b]}d=d[d.length-1];g=$jscomp.IS_SYMBOL_NATIVE&&"es6"===g?h[d]:null;f=f(g);null!=f&&(c?$jscomp.defineProperty($jscomp.polyfills,d,{configurable:!0,writable:!0,value:f}):f!==g&&(void 0===$jscomp.propertyToPolyfillSymbol[d]&&(g=1E9*Math.random()>>>0,$jscomp.propertyToPolyfillSymbol[d]=$jscomp.IS_SYMBOL_NATIVE?
5639$jscomp.global.Symbol(d):$jscomp.POLYFILL_PREFIX+g+"$"+d),$jscomp.defineProperty(h,$jscomp.propertyToPolyfillSymbol[d],{configurable:!0,writable:!0,value:f})))};$jscomp.polyfill("Array.prototype.find",function(c){return c?c:function(f,g){return $jscomp.findInternal(this,f,g).v}},"es6","es3");$jscomp.arrayIteratorImpl=function(c){var f=0;return function(){return f<c.length?{done:!1,value:c[f++]}:{done:!0}}};$jscomp.arrayIterator=function(c){return{next:$jscomp.arrayIteratorImpl(c)}};
5640$jscomp.makeIterator=function(c){var f="undefined"!=typeof Symbol&&Symbol.iterator&&c[Symbol.iterator];return f?f.call(c):$jscomp.arrayIterator(c)};
5641$jscomp.polyfill("Promise",function(c){function f(){this.batch_=null}function g(b){return b instanceof d?b:new d(function(a,e){a(b)})}if(c&&(!($jscomp.FORCE_POLYFILL_PROMISE||$jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION&&"undefined"===typeof $jscomp.global.PromiseRejectionEvent)||!$jscomp.global.Promise||-1===$jscomp.global.Promise.toString().indexOf("[native code]")))return c;f.prototype.asyncExecute=function(b){if(null==this.batch_){this.batch_=[];var a=this;this.asyncExecuteFunction(function(){a.executeBatch_()})}this.batch_.push(b)};
5642var h=$jscomp.global.setTimeout;f.prototype.asyncExecuteFunction=function(b){h(b,0)};f.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var b=this.batch_;this.batch_=[];for(var a=0;a<b.length;++a){var e=b[a];b[a]=null;try{e()}catch(k){this.asyncThrow_(k)}}}this.batch_=null};f.prototype.asyncThrow_=function(b){this.asyncExecuteFunction(function(){throw b;})};var d=function(b){this.state_=0;this.result_=void 0;this.onSettledCallbacks_=[];this.isRejectionHandled_=!1;var a=this.createResolveAndReject_();
5643try{b(a.resolve,a.reject)}catch(e){a.reject(e)}};d.prototype.createResolveAndReject_=function(){function b(k){return function(n){e||(e=!0,k.call(a,n))}}var a=this,e=!1;return{resolve:b(this.resolveTo_),reject:b(this.reject_)}};d.prototype.resolveTo_=function(b){if(b===this)this.reject_(new TypeError("A Promise cannot resolve to itself"));else if(b instanceof d)this.settleSameAsPromise_(b);else{a:switch(typeof b){case "object":var a=null!=b;break a;case "function":a=!0;break a;default:a=!1}a?this.resolveToNonPromiseObj_(b):
5644this.fulfill_(b)}};d.prototype.resolveToNonPromiseObj_=function(b){var a=void 0;try{a=b.then}catch(e){this.reject_(e);return}"function"==typeof a?this.settleSameAsThenable_(a,b):this.fulfill_(b)};d.prototype.reject_=function(b){this.settle_(2,b)};d.prototype.fulfill_=function(b){this.settle_(1,b)};d.prototype.settle_=function(b,a){if(0!=this.state_)throw Error("Cannot settle("+b+", "+a+"): Promise already settled in state"+this.state_);this.state_=b;this.result_=a;2===this.state_&&this.scheduleUnhandledRejectionCheck_();
5645this.executeOnSettledCallbacks_()};d.prototype.scheduleUnhandledRejectionCheck_=function(){var b=this;h(function(){if(b.notifyUnhandledRejection_()){var a=$jscomp.global.console;"undefined"!==typeof a&&a.error(b.result_)}},1)};d.prototype.notifyUnhandledRejection_=function(){if(this.isRejectionHandled_)return!1;var b=$jscomp.global.CustomEvent,a=$jscomp.global.Event,e=$jscomp.global.dispatchEvent;if("undefined"===typeof e)return!0;"function"===typeof b?b=new b("unhandledrejection",{cancelable:!0}):
5646"function"===typeof a?b=new a("unhandledrejection",{cancelable:!0}):(b=$jscomp.global.document.createEvent("CustomEvent"),b.initCustomEvent("unhandledrejection",!1,!0,b));b.promise=this;b.reason=this.result_;return e(b)};d.prototype.executeOnSettledCallbacks_=function(){if(null!=this.onSettledCallbacks_){for(var b=0;b<this.onSettledCallbacks_.length;++b)l.asyncExecute(this.onSettledCallbacks_[b]);this.onSettledCallbacks_=null}};var l=new f;d.prototype.settleSameAsPromise_=function(b){var a=this.createResolveAndReject_();
5647b.callWhenSettled_(a.resolve,a.reject)};d.prototype.settleSameAsThenable_=function(b,a){var e=this.createResolveAndReject_();try{b.call(a,e.resolve,e.reject)}catch(k){e.reject(k)}};d.prototype.then=function(b,a){function e(q,r){return"function"==typeof q?function(t){try{k(q(t))}catch(u){n(u)}}:r}var k,n,p=new d(function(q,r){k=q;n=r});this.callWhenSettled_(e(b,k),e(a,n));return p};d.prototype.catch=function(b){return this.then(void 0,b)};d.prototype.callWhenSettled_=function(b,a){function e(){switch(k.state_){case 1:b(k.result_);
5648break;case 2:a(k.result_);break;default:throw Error("Unexpected state: "+k.state_);}}var k=this;null==this.onSettledCallbacks_?l.asyncExecute(e):this.onSettledCallbacks_.push(e);this.isRejectionHandled_=!0};d.resolve=g;d.reject=function(b){return new d(function(a,e){e(b)})};d.race=function(b){return new d(function(a,e){for(var k=$jscomp.makeIterator(b),n=k.next();!n.done;n=k.next())g(n.value).callWhenSettled_(a,e)})};d.all=function(b){var a=$jscomp.makeIterator(b),e=a.next();return e.done?g([]):new d(function(k,
5649n){function p(t){return function(u){q[t]=u;r--;0==r&&k(q)}}var q=[],r=0;do q.push(void 0),r++,g(e.value).callWhenSettled_(p(q.length-1),n),e=a.next();while(!e.done)})};return d},"es6","es3");
5650(function(c){c(document).ready(function(){var f={},g=RegExp("^/books/([^\\/]+)/$","i"),h=RegExp("^/books/book_view/(\\d+)/?$","i"),d="book_add_to_wishlist book_remove_from_wishlist wishlist_of autocomplete book_add book_edit book_delete book_view book_list book_
5650search reviewed_by genre_add genre_edit genre_up genre_down genre_delete genre_list publisher_add publisher_edit publisher_up publisher_down publisher_delete publisher_list top list".split(" ");try{new Tooltips({popover:!0,attach:c('a[href^="/books/"]').filter(function(l){return null!==
5651c(this).attr("href").match(h)?!0:(l=c(this).attr("href").match(g))&&-1==d.indexOf(l[1])?!0:!1}).toArray(),setContent:function(l){var b=null,a=null;if(m=c(l).attr("href").match(h))b=m[1];if(m=c(l).attr("href").match(g))a=m[1];a=null!=b?"id:"+b:"u:"+a;l=c("<div></div>");b=l.append;a=f[a];var e=c('<div class="book_popup">\t<div class="book_thumbnail">\t\t<a href="#" title="Посмотреть страницу книги">\t\t\t<img src="/plugins/books/templates/skin/default/img/nocover.png" />\t\t</a>\t</div>\t<div class="book_info">\t\t<div><a class="book_title" href="#" title="Посмотреть страницу книги">Длинное длинное название книги на несколько строк и в одну не влезает</a></div>\t\t<div><span class="book_subtitle">Дополнительный заголовок если есть, возможно заголовок оригинальный на забугорном языке</span></div>\t\t<div class="book_authors"><a href="#">Автор книги</a>, <a href="#">Автор книги 2</a></div>\t\t<div class="book_rating">\t\t\t<div style="width: 10%"></div>\t\t</div>\t</div>\t<div class="profile_panel">\t\t<div>\t\t\t<a href="#">Купить</a>\t\t\t<a href="#">Скачать</a>\t\t\t<a href="#">Хочу прочитать потом</a>\t\t\t<a href="#">Я ее читал</a>\t\t</div>\t</div></div>');
5652e.find(".book_thumbnail img").attr("src",a.thumbnail?a.thumbnail:DIR_WEB_ROOT+"/plugins/books/templates/skin/default/img/nocover.png");e.find(".book_thumbnail a").attr("href",a.profile);e.find(".book_title").attr("href",a.profile).text(a.title);"title_second"in a?e.find(".book_subtitle").text(a.title_second):e.find(".book_subtitle").parent("div").remove();if("authors"in a){var k=e.find(".book_authors").empty(),n=!1;for(p in a.authors)n&&k.append(c(document.createTextNode(", "))),n=c("<a></a>").attr("href",
5653a.authors[p]).text(p),k.append(n),n=!0}else e.find(".book_authors").remove();e.find(".book_rating > div").css("width",Math.round(20*parseFloat(a.rating))+"%");e.find(".book_rating").attr("title","Рейтинг: "+Math.round(100*parseFloat(a.rating))/100+", Проголосовало: "+a.votes);var p=e.find(".profile_panel > div");p.empty();"buy_url"in a&&p.append(c('<a href="'+a.buy_url+'" target="_blank">Купить</a>'));"buy_in_english_url"in a&&p.append(c('<a href="'+a.buy_in_english_url+'" target="_blank">Buy</a>'));
5654"download_url"in a&&p.append(c('<a href="'+a.download_url+'" target="_blank">Скачать</a>'));"reviewed"in a||("wishlisted"in a?p.append(c('<a href="/books/book_remove_from_wishlist/'+a.id+"/?security_ls_key="+LIVESTREET_SECURITY_KEY+'" target="_blank">Не буду читать</a>')):p.append(c('<a href="'+("guest_mode"in a?"/login":"/books/book_add_to_wishlist/"+a.id)+"/?security_ls_key="+LIVESTREET_SECURITY_KEY+'" target="_blank">Хочу прочитать потом</a>')),p.append(c('<a href="'+("guest_mode"in a?"/login":
5655"/review/add/for/"+a.id)+'/" target="_blank">Я ее читал</a>')));0<e.scrollHeight&&(e.css("height",e.height()+e.scrollHeight+"px"),p.css("bottom","0"));return b.call(l,e).html()},beforeOpen:function(l,b){var a=null,e=null;if(m=c(l).attr("href").match(h))a=m[1];if(m=c(l).attr("href").match(g))e=m[1];return new Promise(function(k,n){var p=null!=a?"id:"+a:"u:"+e;p in f?k(!0):(n={},null!=e&&(n.url=e),null!=a&&(n.id=a),c.ajax({type:"POST",url:"/books/ajaxprofile/",data:n}).done(function(q){q&&!q.bStateError&&
5656(f[p]=q.aProfile,k(!0))}))})}})}catch(l){}})})(jQuery);
5657
5658/**
5659 * Cursor Functions
5660 *
5661 * Used for setting and getting text cursor position within an input
5662 * and textarea field. Also used to get and set selection range.
5663 * 
5664 * @author Branden Cash
5665 * @email [email protected]
5666 */
5667 
5668(function( $ ){
5669  jQuery.fn.getCursorPosition = function(){
5670    if(this.lengh == 0) return -1;
5671    return $(this).getSelectionStart();
5672  }
5673  
5674  jQuery.fn.setCursorPosition = function(position){
5675    if(this.lengh == 0) return this;
5676    return $(this).setSelection(position, position);
5677  }
5678  
5679  jQuery.fn.getSelection = function(){
5680    if(this.lengh == 0) return -1;
5681    var s = $(this).getSelectionStart();
5682    var e = $(this).getSelectionEnd();
5683    return this[0].value.substring(s,e);
5684  }
5685  
5686  jQuery.fn.getSelectionStart = function(){
5687    if(this.lengh == 0) return -1;
5688    input = this[0];
5689    
5690    var pos = input.value.length;
5691    
5692    if (input.createTextRange) {
5693      var r = document.selection.createRange().duplicate();
5694      r.moveEnd('character', input.value.length);
5695      if (r.text == '') 
5696        pos = input.value.length;
5697      pos = input.value.lastIndexOf(r.text);
5698    } else if(typeof(input.selectionStart)!="undefined")
5699      pos = input.selectionStart;
5700    
5701    return pos;
5702  }
5703  
5704  jQuery.fn.getSelectionEnd = function(){
5705    if(this.lengh == 0) return -1;
5706    input = this[0];
5707    
5708    var pos = input.value.length;
5709    
5710    if (input.createTextRange) {
5711      var r = document.selection.createRange().duplicate();
5712      r.moveStart('character', -input.value.length);
5713      if (r.text == '') 
5714        pos = input.value.length;
5715      pos = input.value.lastIndexOf(r.text);
5716    } else if(typeof(input.selectionEnd)!="undefined")
5717      pos = input.selectionEnd;
5718    
5719    return pos;
5720  }
5721  
5722  jQuery.fn.setSelection = function(selectionStart, selectionEnd) {
5723    if(this.lengh == 0) return this;
5724    input = this[0];
5725    
5726    if (input.createTextRange) {
5727      var range = input.createTextRange();
5728      range.collapse(true);
5729      range.moveEnd('character', selectionEnd);
5730      range.moveStart('character', selectionStart);
5731      range.select();
5732    } else if (input.setSelectionRange) {
5733      input.focus();
5734      input.setSelectionRange(selectionStart, selectionEnd);
5735    }
5736    
5737    return this;
5738  }
5739})( jQuery );
5740(function($) {
5741
5742	$.fn.smart_console = function(options)
5743	{
5744		var self = this;
5745
5746		var input = this.find('input');
5747		var help = $('<div class="help"></div>').appendTo(this);
5748		var combo = $('<div class="console_combo"></div>').insertAfter(this);
5749
5750		options = options || {};
5751		var settings = {
5752
5753			combo_timeout : 100,
5754			commands : {},
5755			aliases : {},
5756			autocomplete_url : {
5757
5758				'login' : '/summoner/nick_autocomplete/$query$/',
5759				'company' : '/company/autocomplete/$query$/',
5760				'forum' : '/console/ajaxCompany/?value=$query$',
5761				'symbol': '/g/autocomplete/$query$/',
5762				'tag' : '/include/ajax/tagAutocompleterConsole.php?q=$query$',
5763				'wiki' : '/include/ajax/dictionaryAutocompleterConsole.php?q=$query$',
5764				'book' : '/books/autocomplete/$query$/'
5765			}
5766		};
5767
5768		var autocomplete = {
5769
5770			box: null,
5771			search_empty : '',
5772			mode : '',
5773			cache: {login: {}, company:{}, forum:{}, symbol:{}, tag:{}, wiki:{}, book:{}}
5774		};
5775
5776		if (options) $.extend(settings, options);
5777
5778		/* -------------------- Autocompleter begin -------------------*/
5779
5780		var bDollarPrepend = false; // говнохак для https://app.clickup.com/t/2dz43qx
5781
5782		function autocomplete_from()
5783		{
5784			var command = input.val();
5785			var from_spaces = 0;
5786			var m = command.match(/^(\s*)?(.*)/);
5787			if (m !== null)
5788			{
5789				command = m[2];
5790				from_spaces = (typeof(m[1]) == 'undefined') ? 0 : m[1].length;
5791			}
5792
5793			var params = command.split(' ');
5794
5795			// $GAZP hack
5796			if (command[0] == '$')
5797			{
5798				params[0] = params[0].substr(1);
5799				params.unshift('$');
5800			}
5801
5802			var cmd_txt = params[0];
5803			var cmd = $.trim(cmd_txt.toUpperCase());
5804			if (cmd in settings.aliases) cmd = settings.aliases[cmd];
5805
5806			// очередное гавнецо для https://app.clickup.com/t/2dz43qx
5807			// проверим есть ли такие команды или намеки на них (тут начинается адское гавно дублированное...)
5808			bDollarPrepend = false;
5809			if (!(cmd in settings.commands))
5810			{
5811				var found = false;
5812				var rx = new RegExp('^' + cmd.replace('\\', '\\\\'),'i');
5813				for (var i in settings.commands)
5814				{
5815					var variants = ('variants' in settings.commands[i]) ? settings.commands[i]['variants'] : [settings.commands[i]];
5816					$.each(variants, function(ii,v)
5817					{
5818						var u = ('command' in v) ? v['command'] : (('syntax' in v) ? v['syntax'] : i);
5819						if (('command' in v) && rx.test(v['command']))
5820						{
5821							found = true;
5822							return false;
5823
5824						} else if (rx.test(i) && (!('params' in v)))
5825						{
5826							found = true;
5827							return false;
5828
5829						} else if (rx.test(v['title']))
5830						{
5831							found = true;
5832							return false;
5833
5834						} else if ('keywords' in v)
5835						{
5836							var aw = v['keywords'].split(',');
5837							$.each(aw, function(iii,w)
5838							{
5839								if (rx.test(w))
5840								{
5841									found = true;
5842									return false;
5843								}
5844							});
5845						}
5846					});
5847
5848					if (found) break;
5849				}
5850
5851				if (!found)
5852				{
5853					cmd = '$';
5854					from_spaces = -1;
5855					bDollarPrepend = true;
5856				}
5857			}
5858
5859			if (cmd in settings.commands)
5860			{
5861				params.shift();
5862				function autocomplete_try(cmd, info)
5863				{
5864					autocomplete.mode = '';
5865					if ('ac' in info)
5866					{
5867						var param_test = $.trim(params.join(' '));
5868						var param_val = info.ac.exec(param_test);
5869
5870						if (param_val !== null)
5871						{
5872							if ((info.ac.toString().indexOf('@') !== -1) && (info.ac.toString().indexOf('[^@') === -1))
5873							{
5874								// login
5875								autocomplete.mode = 'login';
5876								return command.indexOf('@') + 1;
5877
5878							} else if (info.act == 'forum$')
5879							{
5880								// forum
5881								autocomplete.mode = 'forum';
5882								return cmd.length; // strlen corp (without space // for $GAZP)
5883							
5884							} else if ('act' in info)
5885							{
5886								autocomplete.mode = info.act;
5887								return cmd.length + 1 + param_val['index'] + param_val[0].search(param_val[1]);
5888							}
5889						}
5890					}
5891					return -1;
5892				}
5893
5894				var res = false;
5895				if ('variants' in settings.commands[cmd])
5896				{
5897					try
5898					{
5899						$.each(settings.commands[cmd]['variants'], function(i, v)
5900						{
5901							res = autocomplete_try(cmd, v);
5902							if (res !== -1)
5903							{
5904								res += from_spaces;
5905								//console.log(res + ' ' + autocomplete.mode);
5906								throw true;
5907							}
5908						});
5909
5910					} catch (e) {}
5911				} else
5912				{
5913					res = autocomplete_try(cmd, settings.commands[cmd]);
5914					if (res !== -1) res += from_spaces;
5915				}
5916				return (input.getCursorPosition() >= res) ? res : -1;
5917			}
5918			return -1;
5919		}
5920						
5921		function autocomplete_close()
5922		{
5923			if (autocomplete.search_ajax != null)
5924			{
5925				autocomplete.search_ajax.abort();
5926				autocomplete.search_ajax = null;
5927			}
5928
5929			autocomplete.box.hide();
5930		}
5931
5932		function autocomplete_fill()
5933		{
5934			if (autocomplete.search_ajax != null)
5935			{
5936				autocomplete.search_ajax.abort();
5937				autocomplete.search_ajax = null;
5938			}
5939
5940			var word = $.trim(input.val().substr(autocomplete_from()));
5941			if (word !== '')
5942			{
5943				function autocomplete_fill_results(data)
5944				{
5945					if (data !== null)
5946					{
5947						autocomplete.search_empty = '';
5948						autocomplete.cache[autocomplete.mode][word] = data;
5949						autocomplete.box.trigger({type:'reset', message: {items: data, mode: autocomplete.mode}});
5950					} else
5951					{
5952						if (!autocomplete.search_empty) autocomplete.search_empty = word;
5953						autocomplete_close();
5954					}
5955				}
5956
5957				if (autocomplete.search_empty && (autocomplete.search_empty.length <= word.length) && (word.indexOf(autocomplete.search_empty) == 0))
5958				{
5959					autocomplete_close();
5960				} else
5961				{
5962					if (word in autocomplete.cache[autocomplete.mode])
5963					{
5964						autocomplete_fill_results(autocomplete.cache[autocomplete.mode][word]);
5965					} else
5966					{
5967						autocomplete.search_ajax = $.getJSON(settings.autocomplete_url[autocomplete.mode].replace('$query$',  encodeURIComponent(word)), function(res)
5968						{
5969							var data = ((('results' in res) && res.results.length) ? res.results : null);
5970							autocomplete.cache[autocomplete.mode][word] = data;
5971							autocomplete_fill_results(data);
5972						});
5973					}
5974					return true;
5975				}
5976			} else
5977			{
5978				autocomplete_close();
5979			}
5980			return false;
5981		}
5982
5983		function autocomplete_open()
5984		{
5985			var from = autocomplete_from();
5986			if (from !== -1)
5987			{
5988				var word = $.trim(input.val().substr(from));
5989				// не искать дальше, если на предыдущий запрос ничего не нашлось. Не всегда работает с финсловарями, т.к. там поиск от 3х символов
5990				if (autocomplete.search_empty && (autocomplete.search_empty.length > 3) && (autocomplete.search_empty.length <= word.length) && (word.indexOf(autocomplete.search_empty) == 0)) return false;
5991				if (word in autocomplete.cache[autocomplete.mode])
5992				{
5993					var ct = 0;
5994					var founded = false;
5995					$.each(autocomplete.cache[autocomplete.mode][word], function(i,v)
5996					{
5997						ct++;
5998						if (v.l === word) founded = true;
5999					});
6000
6001					if (founded && (ct == 1))
6002					{
6003						if (autocomplete.box.css('display') != 'none') autocomplete_close();
6004						return false;
6005					}
6006				}
6007
6008				if (autocomplete.box.css('display') == 'none')
6009				{
6010					autocomplete.search_empty = '';
6011					var offset = input.offset();
6012					autocomplete.box.css('top', offset.top + input.outerHeight() + 'px');
6013					autocomplete.box.css('left', offset.left + (from * 13) + 'px');
6014					autocomplete.box.trigger({type:'reset', message: {items:[]}});
6015					autocomplete.box.show();
6016				}
6017
6018				return autocomplete_fill();
6019			} else
6020			{
6021				if (autocomplete.box.css('display') != 'none') autocomplete_close();
6022			}
6023
6024			return false;
6025		}
6026
6027		function autocomplete_done(unique)
6028		{
6029			var from = autocomplete_from();
6030			if (from != -1)
6031			{
6032				var word = $.trim(input.val().substr(from));
6033				var res = autocomplete.cache[autocomplete.mode][word];
6034				try
6035				{
6036					$.each(res, function(i,v)
6037					{
6038						if (v.l == unique)
6039						{
6040							var t = '';
6041							if (bDollarPrepend) // говняшка для https://app.clickup.com/t/2dz43qx
6042							{
6043								t = input.val().substr(0, from - 1) + '$' + unique;
6044							} else
6045							{
6046								t = input.val().substr(0, from) + unique;
6047							}
6048							input.val(t);
6049							input.setCursorPosition(t.length);
6050							throw true;
6051						}
6052					});
6053	
6054				} catch (e){}
6055			}
6056			autocomplete_close();
6057		}
6058
6059
6060		/* -------------------- Autocompleter end -------------------*/
6061
6062
6063		function tooltip_help(value)
6064		{
6065			if (help.length)
6066			{
6067				help.text(value);
6068				if (value.length)
6069				{
6070					help.show();
6071				} else
6072				{
6073					help.hide();
6074				}
6075			}
6076		}
6077
6078
6079		function need_auth(command)
6080		{
6081			return ((!('login' in settings)) && ('auth_required' in command) && (command.auth_required === true));
6082		}
6083
6084		function help_func(command)
6085		{
6086			if (!command.length)
6087			{
6088				var data = [];
6089				var needed = ['FIND ', 'FIND @', 'BLOG @', '$', 'G', 'FIND B ', 'FIND F ', 'TAG '];
6090				$.each(needed, function(i, command)
6091				{
6092					for (var cmd in settings.commands)
6093					{
6094						if (cmd == command)
6095						{
6096							var v = settings.commands[cmd];
6097							var t = ('start_title' in v) ? v['start_title'] : v['title'];
6098							data.push({l: cmd, t: t, s: ('syntax' in v) ? v['syntax'] : cmd, a: need_auth(settings.commands[cmd]), oc:cmd});
6099
6100						} else
6101						{
6102							var variants = ('variants' in settings.commands[cmd]) ? settings.commands[cmd]['variants'] : [settings.commands[cmd]];
6103							$.each(variants, function(i, v)
6104							{
6105								var u = ('command' in v) ? v['command'] : (('syntax' in v) ? v['syntax'] : i);
6106								if (u == command)
6107								{
6108									var t = ('start_title' in v) ? v['start_title'] : v['title'];
6109									data.push({l: u, t: t, s: ('syntax' in v) ? v['syntax'] : cmd, a: need_auth(v), oc:cmd});
6110									return false;
6111								}
6112							});
6113						}
6114					}
6115				});
6116				
6117				combo.trigger({type:'reset', message: {items: data, mode: 'help_reverse'}});
6118				return true;
6119			}
6120
6121			var params = command.replace(/^\s+/, '').split(' ');
6122			var cmd = params.shift().toUpperCase();
6123			if (cmd in settings.aliases) cmd = settings.aliases[cmd];
6124
6125			if (cmd in settings.commands)
6126			{
6127				var data = [];
6128				var variants = ('variants' in settings.commands[cmd]) ? settings.commands[cmd]['variants'] : [settings.commands[cmd]];
6129				$.each(variants, function(i, v)
6130				{
6131					if (!(('hidden' in v) && v['hidden']))
6132					{
6133						var u = ('command' in v) ? v['command'] : (('syntax' in v) ? v['syntax'] : cmd);
6134						data.push({l: u, t: v['title'], s: ('syntax' in v) ? v['syntax'] : cmd, a: need_auth(v), oc: cmd});
6135						if ((u == command.toUpperCase()) && ('tooltip' in v)) tooltip_help(v['tooltip']);
6136					}
6137				});
6138				combo.trigger({type:'reset', message: {items: data, mode: 'help_reverse'}});
6139				return true;
6140
6141			} else if (cmd == 'HELP')
6142			{
6143				var data = [];
6144				for (var i in settings.commands)
6145				{
6146					if (('hidden' in settings.commands[i]) && (settings.commands[i]['hidden'])) continue;
6147					var item = {l: i, t: settings.commands[i]['title'], c: 'Подробнее о команде ' + i, a: need_auth(settings.commands[i])};
6148					data.push(item);
6149				}
6150				data.push({l: 'HELP', t: 'Выводит это сообщение', c: 'Это вся доступная помощь \'(', a: false});
6151				combo.trigger({type:'reset', message: {items: data, mode: 'help'}});
6152
6153				return true;
6154
6155			} else if (cmd)
6156			{
6157				var data = [];
6158				var rx = new RegExp('^' + cmd.replace('\\', '\\\\'),'i');
6159				for (var i in settings.commands)
6160				{
6161					var variants = ('variants' in settings.commands[i]) ? settings.commands[i]['variants'] : [settings.commands[i]];
6162					$.each(variants, function(ii,v)
6163					{
6164						var u = ('command' in v) ? v['command'] : (('syntax' in v) ? v['syntax'] : i);
6165						if (('command' in v) && rx.test(v['command']))
6166						{
6167							data.push({l: u, t: v['title'], s: ('syntax' in v) ? v['syntax'] : i, a: need_auth(v), oc: i});
6168
6169						} else if (rx.test(i) && (!('params' in v)))
6170						{
6171							data.push({l: u, t: v['title'], s: ('syntax' in v) ? v['syntax'] : i, a: need_auth(v), oc: i});
6172
6173						} else if (rx.test(v['title']))
6174						{
6175							data.push({l: u, t: v['title'], s: ('syntax' in v) ? v['syntax'] : i, a: need_auth(v), oc: i});
6176						} else if ('keywords' in v)
6177						{
6178							var aw = v['keywords'].split(',');
6179							$.each(aw, function(iii,w)
6180							{
6181								if (rx.test(w))
6182								{
6183									data.push({l: u, t: v['title'], s: ('syntax' in v) ? v['syntax'] : i, a: need_auth(v), oc: i});
6184									return false;
6185								}
6186							});
6187						}
6188					});
6189				}
6190
6191				if (data.length)
6192				{
6193					combo.trigger({type:'reset', message: {items: data, mode: 'help_reverse'}});
6194					return true;
6195				}
6196
6197			}
6198			return false;
6199		};
6200
6201
6202		function need_help(value, prepend)
6203		{
6204			var arglen = arguments.length; 
6205			//value = $.trim(value);
6206
6207			if ('combo_timer' in settings)
6208			{
6209				clearTimeout(settings.combo_timer);
6210				delete settings.combo_timer;
6211			}
6212
6213			settings.combo_timer = setTimeout(function()
6214			{
6215				var show = help_func(value);
6216				if (!show)
6217				{
6218					if (combo.css('display') != 'none') combo.slideToggle('fast');
6219				} else
6220				{
6221					if (arglen > 1) combo.prepend(prepend);
6222					combo.css('max-height') < combo.height() ? combo.css('overflow-y', 'scroll') : combo.css('overflow-y', 'auto');
6223					if (combo.css('display') == 'none') combo.slideToggle('fast');
6224				}
6225
6226			}, settings.combo_timeout);
6227		};
6228
6229
6230		function redirect(url, new_tab)
6231		{
6232			new_tab = true;
6233		//	if (url[0] == '/') url = 'http://smart-lab.ru' + url;
6234
6235			if (new_tab)
6236			{
6237				window.open(url,'_blank');
6238			} else
6239			{
6240				document.location = url;
6241			}
6242		}
6243
6244
6245		function command_func(command)
6246		{
6247			var params = $.trim(command).split(' ');
6248
6249			// $GAZP hack
6250			if (command[0] == '$')
6251			{
6252				params[0] = params[0].substr(1);
6253				params.unshift('$');
6254			}
6255
6256			var cmd = params.shift().toUpperCase();
6257			if (cmd in settings.aliases) cmd = settings.aliases[cmd];
6258			if (cmd in settings.commands)
6259			{
6260				var ERR_OK = 0;
6261				var ERR_SYNTAX = 1;
6262				var ERR_UNKNOWN = 2;
6263				var ERR_AUTH = 3;
6264
6265				var err_msg = {};
6266				err_msg[ERR_SYNTAX] = 'Ошибка синтаксиса.';
6267				err_msg[ERR_UNKNOWN] = 'Неизвестная команда.';
6268				err_msg[ERR_AUTH] = 'Необходима авторизация.';
6269
6270				function notifyStat(sCommand)
6271				{
6272					$.ajax({
6273						type: 'POST',
6274						url: '/console/ajaxCommand',
6275						data: {'command': sCommand, 'line': command}
6276					}).done(function(result)
6277					{
6278						// do nothing loop... 
6279					});
6280				}
6281
6282				function execute(info, sCommand)
6283				{
6284					function execute_simple()
6285					{
6286						if ('redirect_url' in info)
6287						{
6288							if (need_auth(info)) return ERR_AUTH;
6289							redirect(info['redirect_url']);
6290							return ERR_OK;
6291
6292						} else if ('url' in info)
6293						{
6294							if (need_auth(info)) return ERR_AUTH;
6295
6296							var u = info['url'];
6297							if (u.indexOf('$login') !== -1) u = u.replace('$login', encodeURIComponent(settings.login));
6298							redirect(u);
6299							return ERR_OK;
6300
6301						} else if ('func' in info)
6302						{
6303							if (need_auth(info)) return ERR_AUTH;
6304							var func = (info['func'] in window) ? window[info['func']] : info['func'];
6305							if (typeof(func)) func.call(window, settings.login);
6306							return ERR_OK;
6307						}
6308						return ERR_SYNTAX;
6309					}
6310
6311
6312					if (params.length == 0)
6313					{
6314						if (!('params' in info)) return execute_simple();
6315
6316					} else
6317					{
6318						if ('params' in info)
6319						{
6320							var param_val = info.params.exec(params.join(' '));
6321							if (param_val !== null)
6322							{
6323								if ('url' in info)
6324								{
6325									if (need_auth(info)) return ERR_AUTH;
6326
6327									var u = info['url'];
6328									for (var i = 1; i < param_val.length; i++)
6329									{
6330										u = u.replace('$'+i, encodeURIComponent(param_val[i]));
6331									}
6332									if (u.indexOf('$login') !== -1) u = u.replace('$login', encodeURIComponent(settings.login));
6333									redirect(u);
6334									return ERR_OK;
6335
6336								} else if ('func' in info)
6337								{
6338									if (need_auth(info)) return ERR_AUTH;
6339									var func = (info['func'] in window) ? window[info['func']] : info['func'];
6340									if (typeof(func)) func.apply(window, param_val.slice(1));
6341									return ERR_OK;
6342								}
6343							}
6344
6345						} else
6346						{
6347							var cmp = ('command' in info) ? info['command'] : (('syntax' in info) ? info['syntax'] : '');
6348							if (cmp == command.toUpperCase()) return execute_simple();
6349						}
6350					}
6351					return ERR_SYNTAX;
6352				}
6353
6354				var res = ERR_UNKNOWN;
6355				if ('variants' in settings.commands[cmd])
6356				{
6357					try
6358					{
6359						$.each(settings.commands[cmd]['variants'], function(i, v)
6360						{
6361							res = execute(v, cmd);
6362							if ((res === ERR_OK) || (res === ERR_AUTH)) throw true;
6363						});
6364
6365					} catch (e) {}
6366				} else
6367				{
6368					res = execute(settings.commands[cmd], cmd);
6369				}
6370
6371				if (res !== ERR_OK)
6372				{
6373					need_help(cmd, $('<div class="console_error">' + err_msg[res] + '</div>'));
6374					return false;
6375				} else
6376				{
6377					notifyStat(cmd);
6378					return true;
6379				}
6380
6381			} else if ((cmd === 'HELP') || (cmd === ''))
6382			{
6383				document.location = '/page/help/';
6384				return true;
6385			} else
6386			{
6387				// Неизвестная команда
6388				document.location = '/search/topics/?q=' + encodeURIComponent(command);
6389				return true;
6390			}
6391			return false;
6392		};
6393
6394
6395		input.on('keydown', function(e)
6396		{
6397			switch (e.which)
6398			{
6399				case 27:
6400				{
6401					if (autocomplete.box.css('display') != 'none')
6402					{
6403						autocomplete_close();
6404						e.preventDefault();
6405
6406					} else if (combo.css('display') != 'none') combo.slideToggle('fast');
6407					break;
6408				}
6409
6410				case 13:
6411				{
6412					if ((autocomplete.box.css('display') == 'none') && (combo.css('display') == 'none'))
6413					{
6414						e.preventDefault();
6415
6416						if ('combo_timer' in settings)
6417						{
6418							clearTimeout(settings.combo_timer);
6419							delete settings.combo_timer;
6420						}
6421
6422						if (command_func($(this).val().replace(/^\s+/, ''))) $(this).val('');
6423						break;
6424
6425					} 
6426
6427					// тут идет проверка на открытый попап
6428				}
6429				case 38:
6430				case 40:
6431				{
6432					if (autocomplete.box.css('display') != 'none')
6433					{
6434						e.preventDefault();
6435						autocomplete.box.trigger(jQuery.Event('keypress', {keyCode: e.which}));
6436
6437					} else if (combo.css('display') != 'none')
6438					{
6439						e.preventDefault();
6440						combo.trigger(jQuery.Event('keypress', {keyCode: e.which}));
6441					}
6442					break;
6443				}
6444
6445				default:
6446				{
6447					if (settings.key_timer)
6448					{
6449						clearTimeout(settings.key_timer);
6450						delete settings.key_timer;
6451					}
6452
6453					if ('combo_timer' in settings)
6454					{
6455						clearTimeout(settings.combo_timer);
6456						delete settings.combo_timer;
6457					}
6458
6459					settings.key_timer = setTimeout(function(e)
6460					{
6461						if (!autocomplete_open())
6462						{
6463							need_help(input.val());
6464
6465						} else
6466						{
6467							if (combo.css('display') != 'none') combo.hide();
6468						}
6469
6470					}, 1);
6471					break;
6472				}
6473			}
6474
6475		}).on('change', function(e)
6476		{
6477			need_help($(this).val());
6478
6479		}).on('command', function(e)
6480		{
6481			if ('fromPopup' in e)
6482			{
6483				if (e.fromPopup == autocomplete.box)
6484				{
6485					if (autocomplete.box.css('display') != 'none') autocomplete_done(e.message);
6486
6487				} else if (e.fromPopup == combo)
6488				{
6489					if (combo.css('display') != 'none')
6490					{
6491						var cmd = e.message; //$.trim(); - you should not do this
6492						var command = $(this).val().replace(/^\s+/, '');
6493
6494						var command_cmd = command.split(' ').shift().toUpperCase();
6495						if (command_cmd[0] == '$') command_cmd = '$';
6496
6497						if (command_cmd in settings.aliases)
6498						{
6499							command = settings.aliases[command_cmd] + command.substr(command_cmd.length);
6500							command_cmd = settings.aliases[command_cmd].toUpperCase();
6501						}
6502
6503
6504						if (command.substr(0, cmd.length).toUpperCase() == cmd.toUpperCase())
6505						{
6506							if (command_cmd in settings.commands)
6507							{
6508								if (command.length > cmd.length)
6509								{
6510									if (command_func($(this).val())) $(this).val('');
6511								} else
6512								{
6513									var variants = ('variants' in settings.commands[command_cmd]) ? settings.commands[command_cmd]['variants'] : [settings.commands[command_cmd]];
6514									var input = $(this);
6515									var bExec = false;
6516
6517									$.each(variants, function(i,v)
6518									{
6519										bExec = false;
6520										if (!('params' in v))
6521										{
6522											if ('command' in v)
6523											{
6524												if (v['command'].toUpperCase() == command.toUpperCase()) bExec = true;
6525
6526											} else if ('syntax' in v)
6527											{
6528												if (v['syntax'].toUpperCase() == command.toUpperCase()) bExec = true;
6529
6530											} else if (command_cmd == cmd) bExec = true;
6531										}
6532
6533										if (bExec)
6534										{
6535											if (command_func(input.val())) input.val('');
6536											return false;
6537										}
6538									});
6539
6540									if (!bExec)
6541									{
6542										$(this).val(cmd);
6543										need_help($(this).val());
6544									}
6545								}
6546
6547							} else
6548							{
6549								$(this).val(cmd);
6550								need_help($(this).val());
6551							}
6552						} else
6553						{
6554							$(this).val(cmd);
6555							need_help($(this).val());
6556						}
6557					}
6558				}
6559			}
6560
6561		}).on('blur', function(e)
6562		{
6563			if (autocomplete.box.css('display') != 'none')
6564			{
6565				if (!autocomplete.box.attr('mouse_pressed')) autocomplete_close();
6566			}
6567
6568			if (combo.css('display') != 'none')
6569			{
6570				if (!combo.attr('mouse_pressed')) combo.slideToggle('fast');
6571			}
6572			tooltip_help('');
6573
6574		}).on('focus', function(e)
6575		{
6576			if (!$.trim($(this).val()))
6577			{
6578				tooltip_help('Напишите, что вы ищете или воспользуйтесь подсказками внизу');
6579				need_help('', '');
6580			} else
6581			{
6582				need_help($(this).val());
6583			}
6584		});
6585
6586		combo.on('click', 'span.helplink, span.authlink', function(e)
6587		{
6588			if ($(this).hasClass('helplink'))
6589			{
6590				input.val($(this).text()).focus();
6591				need_help($(this).text());
6592
6593			} else if ($(this).hasClass('authlink'))
6594			{
6595				if ('login_url' in settings) document.location = settings.login_url;
6596			}
6597		});
6598
6599		combo.smart_console_dropdown({ parent: input, filler: function(mode, item)
6600		{
6601			switch (mode)
6602			{
6603				case 'help':
6604				{
6605					return $('<div><span class="helplink" title="' + item.c + '">' + item.l + '</span> &mdash; <span>' + item.t + '</span>' + (item.a ? ' [<span class="authlink">Необходима авторизация</span>]' : '') + '</div>');
6606				}
6607
6608				case 'help_reverse':
6609				{
6610
6611					var link = ('oc' in item) ? item.s.replace(item['oc'], '<span class="helplink"' + (('c' in item) ? ' title="' + item.c + '"': '') + '>
6611' + item['oc'] + '</span>') : '<span class="helplink"' + (('c' in item) ? ' title="' + item.c + '"': '') + '>' + item.s + '</span>';
6612					return $('<div><span>' + item.t + '</span> ' + link + (item.a ? ' [<span class="authlink">Необходима авторизация</span>]' : '') + '</div>');
6613				}
6614
6615				default:
6616				{
6617					return null;
6618				}
6619			}
6620
6621		}});
6622
6623		if (autocomplete.box === null)
6624		{
6625			autocomplete.box = $('<div class="console_acc_menu"></div>').hide();
6626			autocomplete.box.insertAfter(input);
6627			autocomplete.box.smart_console_dropdown({ parent: input, filler: function(mode, item) 
6628			{
6629				switch (mode)
6630				{
6631					case 'book':
6632					{
6633						return $('<div class="dbi"><div class="dbdd"><div>' + item.t + '</div><div>' + item.c + '</div></div></div>');
6634					}
6635					case 'wiki':
6636					case 'tag':
6637					{
6638						return $('<div class="dbi"><div class="dbst"><div>' + item.t + '</div></div></div>');
6639					}
6640					case 'symbol':
6641					{
6642						return $('<div class="dbi"><div class="dbsb"><div>' + item.l + '</div><div>' + item.t + '</div></div></div>');
6643					}
6644					default:
6645					{
6646						return $('<div class="dbi"><div class="dbid"><img src="' + item.i + '" /></div><div class="dbdd"><div>' + item.t + '</div><div>' + item.c + '</div></div></div>');
6647					}
6648				}
6649
6650			}});
6651		}
6652
6653		return self;
6654	};
6655
6656})(jQuery);
6657
6658(function($) {
6659
6660
6661	$.fn.smart_console_dropdown = function(options)
6662	{
6663		var self = this;
6664
6665		options = options || {};
6666		var settings = {
6667		
6668			filler: null,
6669			parent : null
6670		};
6671
6672		if (options) $.extend(settings, options);
6673
6674		this.on('mousedown', '> div', function(e)
6675		{
6676			$('> div', self).removeClass('hilited');
6677			$(this).addClass('hilited');
6678
6679			self.attr('mouse_pressed', true);
6680
6681		}).on('mouseup', '> div', function(e)
6682		{
6683			if (self.attr('mouse_pressed'))
6684			{
6685				self.removeAttr('mouse_pressed');
6686				settings.parent.trigger({type: 'command', fromPopup: self, message: $(this).attr('unique')});
6687				settings.parent.focus();
6688			}
6689
6690		}).on('reset', function(e)
6691		{
6692			e.preventDefault();
6693
6694			var selected = $('.hilited', self).attr('unique');
6695			self.empty();
6696			self.attr('mode', e.message.mode);
6697
6698			$.each(e.message.items, function(i,v)
6699			{
6700				var d = settings.filler(e.message.mode, v);
6701				d.attr('unique', v.l);
6702				self.append(d);
6703			});
6704
6705			if (typeof(selected) != 'undefined') self.find('[unique="' + selected + '"]').first().addClass('hilited');
6706			if (!self.find('.hilited').length) self.find('> div').first().addClass('hilited');
6707
6708		}).on('keypress', function(e)
6709		{
6710			switch (e.keyCode)
6711			{
6712				case 38: //up
6713				{
6714					var i = self.find('.hilited');
6715					self.find('> div').removeClass('hilited');
6716					((i.prev().length) ? i.prev() : self.find('> div:last')).addClass('hilited');
6717					break;
6718				}
6719
6720				case 40: // down
6721				{
6722					var i = self.find('.hilited');
6723					self.find('> div').removeClass('hilited');
6724					((i.next().length) ? i.next() : self.find('> div:first')).addClass('hilited');
6725					break;
6726				}
6727
6728				case 13: // enter
6729				{
6730					var selected = self.find('.hilited');
6731					settings.parent.trigger({type: 'command', fromPopup: self, message: selected.length ? selected.attr('unique') : null});
6732					settings.parent.focus();
6733					break;
6734				}
6735			}
6736
6737			// visible item ?
6738			if (self.find('.hilited').length)
6739			{
6740				var i = self.find('.hilited').get(0);
6741				var s = self.get(0);
6742
6743				var ifrom = i.offsetTop;
6744				var from = s.scrollTop;
6745				var to = s.scrollTop + s.clientHeight;
6746
6747				if (from - ifrom > 0) s.scrollTop -= from - ifrom;
6748				if (to - (ifrom + i.clientHeight) < 0) s.scrollTop -= to - (ifrom + i.clientHeight);
6749			}
6750		});
6751	};
6752	
6753})(jQuery);	
6754	var console_commands = {
6755		'FIND': {title: 'Поиск', variants:
6756				[
6757					{title: 'Поиск по финсловарю', start_title: 'По словарю', command: 'FIND F ', syntax: 'FIND F искомое', params: /^F\s(.*)$/i, ac: /^F\s([^@]+)$/i, act:'wiki', url: '/search/results/?q=$1&in=articles', tooltip: 'Введите слово'},
6758					{title: 'Поиск книг', start_title: 'Книгу', command: 'FIND B ', syntax: 'FIND B искомое', params: /^B\s(.*)$/i, ac: /^B\s([^@]+)$/i, act: 'book', url: '/books/book_search?q=$1', tooltip: 'Введите название книги', keywords:'искать книгу,найти книгу'},
6759					{title: 'Поиск людей', start_title: 'Людей', command: 'FIND @', syntax: 'FIND @login', params: /^\@([0-9a-z\_\-]+)$/i, ac: /^\@(.*)$/i, url: '/search/results/?q=$1&in=users', tooltip: 'Введите логин или имя', keywords:'искать человека,найти человека'},
6760					{title: 'Поиск по блогам', start_title: 'Текст в блогах', command: 'FIND ', syntax: 'FIND искомое', params: /^(.*)$/, url: '/search/results/?q=$1&in=topics', tooltip: 'Введите текст', keywords: 'искать текст,найти текст'}, // ac: /^([^@]+)$/i, act: 'tag',
6761					{title: 'Поиск записей трейдера в блогах', command: 'FIND ', syntax: 'FIND искомое@login', params: /^(.*)$/, ac: /(.+)\@(.*)$/i, url: '/search/results/?q=$1&in=topics'}
6762				]
6763			},
6764		'BLOG': {title: 'Блог', variants:
6765				[
6766					{title: 'Ваш блог', url: '/my/$login/blog/', auth_required : true, keywords: 'мой блог'},
6767					{title: 'Блог Романа Андреева', syntax: 'BLOG @RomanAndreev', redirect_url: '/my/RomanAndreev/blog/', keywords: 'Роман Андреев'},
6768					{title: 'Блог пользователя', start_title: 'Блоги людей', command: 'BLOG @', syntax: 'BLOG @login', params: /^\@([0-9a-z\_\-]+)$/i, ac: /^\@(.*)/i, url: '/my/$1/blog/', tooltip: 'Введите логин или имя'}
6769				]
6770			},
6771		'TAG' : {title: 'Записи по тегу', start_title: 'Теги', command: 'TAG ', syntax: 'TAG тег', params: /^(.*)$/, ac: /^(.*)/i, act: 'tag', url: '/tag/$1/', tooltip: 'Введите тег'},
6772		'MSG':{title: 'Личная переписка', auth_required : true, variants:
6773				[
6774					{title: 'Личное сообщение', command: 'MSG @', syntax: 'MSG @login', params: /^\@([0-9a-z\_\-]+)$/i, ac: /^\@(.*)$/i, func: 'mailto_func', auth_required : true, keywords: 'личное сообщение,написать сообщение,сообщение написать', tooltip: 'Введите имя кому'}
6775				]
6776			},
6777
6778		'ALL':  {title: 'Все блоги подряд', command: 'ALL', syntax: 'ALL или BLOGS', redirect_url: '/allblog/', keywords: 'лента всех постов'},
6779		'ECO':  {title: 'Календарь всех событий', redirect_url: '/calendar/', keywords: 'календарь'},
6780		'WIKI': {title: 'Финансовый словарь', variants:
6781				[
6782					{title: 'Финансовый словарь', redirect_url: '/finansoviy-slovar/', keywords:'словарь'},
6783					{title: 'Написать статью в словарь', syntax: 'WIKI ADD', redirect_url: '/finansoviy-slovar/add/', auth_required : true, keywords: 'написать статью в словарь'},
6784					{title: 'Поиск в финсловаре', command: 'WIKI ', syntax: 'WIKI искомое', params: /^(.*)$/, ac: /^(.*)/i, act: 'wiki', url: '/finansoviy-slovar/$1'}
6785				]
6786			},
6787		'G':	{title: 'Графики онлайн', variants:
6788				[
6789					{title: 'Графики любых инструментов', start_title: 'График', redirect_url: '/g/', keywords: 'график'},
6790					{title: 'Графики онлайн', command: 'G ', syntax: 'G ticker timeframe', params: /^([0-9a-z]+)(?:\s(\d+|H|D|W|M))?$/i, ac: /^([A-Z]+)/i, act: 'symbol', url: '/g/$1/$2/', tooltip: 'Введите тикер инструмента'}
6791				]
6792			},
6793
6794		'Q': {title: 'Котировки', variants:
6795				[
6796					{title: 'Котировки акций на МосБирже', redirect_url: '/q/shares/', keywords: 'акции котировки,котировки акций,курс акций'},
6797					{title: 'Перейти на форум акции', command: 'Q ', syntax: 'Q ticker-акции', params: /^(.*)$/, ac: /^(.*)/i, act: 'forum', url: '/forum/company_go/$1/'} // params: /^([0-9a-z]+)$/i,
6798				]
6799			},
6800
6801		'OIL': {title: 'Нефть: график, запасы, новости', redirect_url: '/oil/', keywords: 'нефть'},
6802		'B': {title: 'Каталог книг', redirect_url: '/books/', keywords: 'книги'},
6803		'TOP' : {title: 'Лучше посты смартлаба', redirect_url: '/top/', keywords: 'лучшие посты,рейтинг постов'},
6804		'SGNL': {title: 'Лента торговых сигналов', redirect_url: '/blog/tradesignals/', keywords: 'лента сигналов,сигналы,торговые сигналы'},
6805		'TAGS': {title: 'Список всех тегов', redirect_url: '/tags/', keywords: 'теги все'},
6806		'CORP': {title:'Корпоративные блоги', variants:
6807				[
6808					{title: 'Корпоративные блоги', redirect_url: '/company/', keywords: 'брокеры блоги,корпоративные блоги'},
6809					{title: 'Создать корпоративный блог', syntax:'CORP ADD', redirect_url: '/company/add/', keywords: 'корпоративный блог создать,создать корп блог'},
6810					{title: 'Корпоративный блог компании', command: 'CORP ', syntax:'CORP название', params: /^(.*)$/, ac: /^(.*)$/i, act: 'company', url: '/company/$1/'}
6811				]
6812			},
6813
6814		'$' : {title: 'Форум компании', start_title: 'Акции компаний', command: '$', syntax: '$название или тикер', params: /^(.*)$/, ac: /^(.*)/i, act: 'forum$', url: '/forum/company_go/$1/', tooltip: 'Введите название компании', keywords: 'искать компанию,найти акцию компании'}, // hardcoded
6815		
6816		'FAV' : {title:'Избранное', variants:
6817				[
6818					{title: 'Ваши избранные посты', url: '/profile/$login/favourites/', auth_required : true, keywords:'избранное мое,мое избранное'},
6819					{title: 'Избранное пользователя', command: 'FAV @', syntax: 'FAV @login', params: /^\@([0-9a-z\_\-]+)$/i, ac: /^\@(.*)$/i, url: '/profile/$1/favourites/', tooltip: 'введите имя чтобы посмотреть избранное', keywords:'избранное человека'}
6820				]
6821			},
6822
6823		'FRND': {title:'Френдлента', variants:
6824				[
6825					{title: 'Ваша лента друзей', url: '/friends/$login/', auth_required : true, keywords: 'лента друзей,френдлента'},
6826					{title: 'Френдлента пользователя', command: 'FRND @', syntax: 'FRND @login', params: /^\@([0-9a-z\_\-]+)$/i, ac: /^\@(.*)$/i, url: '/friends/$1/'}
6827				]
6828			},
6829
6830		'LINKS':{title:'Ссылки', variants:
6831				[
6832					{title: 'Ваши сохраненные ссылки', url: '/my/$login/tree/links/', auth_required : true, keywords: 'избранные ссылки,мои ссылки'},
6833					{title: 'Ссылки пользователя', command: 'LINKS @', syntax: 'LINKS @login', params: /^\@([0-9a-z\_\-]+)$/i, ac: /^\@(.*)$/i, url: '/my/$1/tree/l
6833inks/'}
6834				]
6835			},
6836
6837		'CMT':  {title:'Комментарии', variants:
6838				[
6839					{title: 'Ваши комментарии', url: '/my/$login/comment/', auth_required : true, keywords: 'комментарии мои,мои комментарии'},
6840					{title: 'Комментарии пользователя', command: 'CMT @', syntax: 'CMT @login', params: /^\@([0-9a-z\_\-]+)$/i, ac: /^\@(.*)$/i, url: '/my/$1/comment/'}
6841				]
6842			},
6843
6844
6845		'TV':  {title: 'Лента всех видео', redirect_url: '/smartlab-tv/', keywords: 'видео на смартлабе'},
6846		'POST':{title: 'Написать пост в свой блог', redirect_url: '/topic/add/', auth_required : true, keywords: 'написать пост,пост написать'},
6847		'ACC': {title: 'Статистика вашего счета', redirect_url: '/my-trading-account/', auth_required : true, keywords: 'мой счет,статистика счета'},
6848		'MAIL':{title: 'Личная переписка', auth_required : true, variants:
6849				[
6850					{title: 'Личная переписка', command: 'MAIL', syntax: 'MAIL или PM', redirect_url: '/talk/', auth_required : true},
6851					{title: 'Написать письмо', command: 'MAIL TO @', syntax: 'MAIL TO @login', params: /^TO\s\@([0-9a-z\_\-]+)$/i, ac: /^TO\s\@(.*)$/i, func: 'mailto_func', auth_required : true}
6852				]
6853			},
6854
6855		'CCI':{title: 'Индексы доверия смартлаба', redirect_url: '/consumer-confidence-russia/'},
6856		'CHAT':{title: 'Секретный клуб', redirect_url: '/chat/', hidden : true},
6857		'CAT': {title: 'Каталог финансовых услуг', redirect_url: '/page/catalog/'},
6858		'ADV': {title: 'Размещение рекламы', redirect_url: 'https://mediakit.smart-lab.ru/'},
6859		'MAIN':{title: 'Перекидывает на главную', redirect_url: '/'},
6860		'FINAM':{title: 'Сайт Финам', redirect_url: 'http://www.finam.ru/'},
6861		'MAP':{title: 'Тепловая карта рынка, форума и блогов', redirect_url: '/q/map/', keywords: 'акции карта рынка,карта рынка'},
6862		'FLOW':{title: 'Все блоги одним потоком', redirect_url: '/flow/', keywords: 'поток постов всех блогов'},
6863		'FXPF':{title: 'Графики-онлайн на Forexpf', redirect_url: 'http://www.forexpf.ru/chart/'},
6864		'NEWS':{title: 'Новости по российским акциям', variants:
6865			[
6866				{title: 'Все новости', redirect_url: '/news/', keywords: 'лента новостей,новости'},
6867				{title: 'Новости по Сбербанку', syntax:'NEWS $SBER', redirect_url: '/forum/news/SBER/'},
6868				{title: 'Новости по любой компании', syntax:'NEWS $TICKER', params: /^\$([0-9a-z\_\-]+)$/i, ac: /^\$(.*)$/i, act: 'forum', url: '/forum/$1/attached/'}
6869			]
6870		},
6871		'OFFTOP':{title: 'Оффтоп', variants:
6872			[
6873				{title: 'Посмотреть раздел ОФФТОП', redirect_url: '/blog/offtop/', keywords: 'оффтоп раздел'},
6874				{title: 'Написать пост не по теме смартлаба', syntax:'OFFTOP ADD', redirect_url: '/topic/add/?blog_id=4107', keywords:'написать в оффтоп,оффтоп написать', auth_required : true}
6875			]
6876		},
6877		'EVENTS':{title: 'Календарь тусовок', redirect_url: '/calendar/index/party/'},
6878		'SWITCH':{title: 'Переключить цветовую схему сайта', auth_required : true, variants:
6879				[
6880					{title: 'Стандартная тема', syntax: 'SWITCH BLACK', redirect_url: '/settings/theme/black', auth_required : true},
6881					{title: 'Белая тема', syntax: 'SWITCH WHITE', redirect_url: '/settings/theme/white', auth_required : true, keywords:'сделать смартлаб белым'},
6882					{title: 'Полностью черная тема', syntax: 'SWITCH FULLBLACK', redirect_url: '/settings/theme/fullblack', auth_required : true, keywords: 'сделать смартлаб полностью черным'},
6883					{title: 'Оригинальная тема', syntax: 'SWITCH ORIGINAL', redirect_url: '/settings/theme/original', auth_required : true, keywords: 'сделать смартлаб в старой теме'}
6884				]
6885			},
6886		'LINK' : {title: 'Переход по спец-ссылке', command: 'LINK ', syntax: 'LINK name', params: /^(.*)$/, url: '/console/link/$1/'},
6887		'EXIT':{title: 'Разлогиниться', redirect_url: '/login/exit/', auth_required : true},
6888
6889
6890		'STOCKS': {title: 'Форум по акциям', redirect_url: '/forum/', keywords: 'акции форум,форум акций'},
6891		'BONDS': {title: 'Форум по облигациям', redirect_url: '/bonds/', keywords: 'форум облигаций'},
6892		'FX': {title: 'Форум по Forex', redirect_url: '/forex/', keywords: 'форекс,форум forex'},
6893		'BANKS': {title: 'Форум по банкам', redirect_url: '/banki/', keywords: 'форум банков'},
6894		'OPT': {title: 'Форум по опционам', redirect_url: '/options/', keywords: 'опционы форум'},
6895		'ALGO': {title: 'Форум по торговым роботам', redirect_url: '/algotrading/', keywords: 'алготрейдинг форум,торговые роботы форум'},
6896		'BROK': {title: 'Рейтинг брокеров и отзывы', redirect_url: '/brokers-rating/', keywords: 'брокеры,выбрать брокера,рейтинг брокеров'},
6897
6898		'ECOS': {title: 'Календарь событий по акциям', redirect_url: '/calendar/stocks/', keywords: 'акции календарь,календарь акций'},
6899		'FA': {title: 'Фундаментальный анализ акций', redirect_url: '/q/shares_fundamental/', keywords: 'акции фунд.анализ,мультипликаторы компаний,фундаментальный анализ акций'},
6900		'QBO': {title: 'Котировки облигаций', redirect_url: '/q/ofz/', keywords: 'бонды котировки,котировки ОФЗ,облигации ОФЗ,ОФЗ'},
6901		'BROKG': {title: 'Рейтинг глобальных брокеров', redirect_url: '/brokers-rating/global/', keywords: 'брокеры Глобальные'},
6902		'BROKR': {title: 'Рейтинг российских брокеров', redirect_url: '/brokers-rating/russia/', keywords: 'брокеры Россия'},
6903		'BROKF': {title: 'Рейтинг форекс брокеров', redirect_url: '/brokers-rating/forex/', keywords: 'брокеры Forex'},
6904		'ASK': {title: 'Задать вопрос на смартлабе', redirect_url: '/vopros/add/', keywords: 'вопрос задать,задать вопрос', auth_required : true},
6905		'ANSWER': {title: 'Лента всех вопросов', redirect_url: '/vopros/', keywords: 'вопросы лента,лента вопросов,ответы на вопросы'},
6906		'W': {title: 'Ваши портфели (portfolio)', auth_required : true,  variants:[
6907			{title: 'Ваш портфели (portfolio)', command: 'W', redirect_url: '/q/portfolio', keywords: 'портфолио,мое портфолио,портфель,списки акций мои,portfolio', auth_required : true},
6908			{title: 'Создать портфель', command: 'W ADD', syntax: 'W ADD', func: 'new_portfolio_func', keywords: 'создать портфель,создать портфолио', auth_required : true},
6909		]},
6910		'DIV': {title: 'Таблица дивидендов и даты отсечек', redirect_url: '/dividends/', keywords: 'дивиденды,закрытие реестров дивиденды,календарь дивидендов,реестр дивидендов'},
6911		'DIVR': {title: 'Информация о поступивших дивидендах', redirect_url: '/forum/Поступление%20дивидендов/', keywords: 'дивиденды поступление,поступление дивидендов'},
6912
6913		'REG': {title: 'Календарь отсечек по акциям', redirect_url: '/calendar/index/stocks_otsechka', keywords: 'закрытие реестров календарь'},
6914		'PICS': {title: 'Лента всех картинок', redirect_url: '/pics/', keywords: 'картинки,лента картинок'},
6915		'BR': {title: 'Книжные рецензии', variants:[
6916
6917			{title: 'Лента книжных рецензий', syntax: 'BR', redirect_url: '/blog/reviews/', keywords: 'книги рецензии,рецензии книг'},
6918			{title: 'Написать отзыв к книге', syntax: 'BR ADD', redirect_url: '/review/a
6918dd/', keywords: 'написать рецензию на книгу,рецензия написать', auth_required : true}
6919		]},
6920		
6921		'TOPB': {title: '100 лучших книг', redirect_url: '/books/top/', keywords: 'книги топ-100,рейтинг книг'},
6922		'CMTS': {title: 'Лента всех комментариев', redirect_url: '/comments/', keywords: 'комментарии все,лента комментариев'},
6923		'CMTME': {title: 'Комментарии к вашим постам', redirect_url: '/my/$login/comment-to-me/', auth_required : true, keywords: 'комментарии к моим постам'},
6924		'QW': {title: 'Котировки мировых индексов и Forex', redirect_url: '/q/world-quotes/', keywords: 'котировки мировые,курсы валют'},
6925		'QBC': {title: 'Котировки корпоративных облигаций', redirect_url: '/q/bonds/', keywords: 'котировки облигаций корп,облигации корпоративные'},
6926		'QBS': {title: 'Котировки облигаций субъектов РФ', redirect_url: '/q/subfed/', keywords: 'котировки облигаций субфед,облигации субъектов'},
6927		'QR': {title: 'Котировки валютного рынка Мосбиржи', redirect_url: '/q/currencies/', keywords: 'котировки рубля,курсы рубля'},
6928		'QF': {title: 'Котировки срочного рынка Мосбиржи', redirect_url: '/q/futures/', keywords: 'котировки фьючерсов'},
6929		'FORUMS': {title: 'Все записи форумов подряд', redirect_url: '/forums/', keywords: 'лента форумов,форумы лента'},
6930		'READS': {title: 'Самые полезные статьи (выбор редактора)', redirect_url: '/tradingreads/', keywords: 'лучшие статьи за все время,нетленка,трейдинг лучшие статьи'},
6931		'PEOPLE': {title: 'Все пользователи смартлаба', redirect_url: '/people/', keywords: 'люди,рейтинг блогеров,трейдеры все'},
6932		'MOB': {title: 'Переключиться на мобильную версию', redirect_url: '/mobile/', keywords: 'мобильная версия'},
6933		'BL': {title: 'Ваш черный список', redirect_url: '/blacklist/', keywords: 'мой черный список,черный список,чс', auth_required : true},
6934		'FORUMMY': {title: 'Ваши сообщения на форумах', redirect_url: '/my/$login/comment-forum/', keywords: 'мои сообщения на форуме', auth_required : true},
6935		'BOOKSDONE': {title: 'Книги, которые вы прочли и оценили', redirect_url: '/books/reviewed_by/$login/', keywords: 'мои прочитанные книги', auth_required : true},
6936		'REPORTS': {title: 'Таблица последних отчетов по МСФО', redirect_url: '/q/shares_fundamental3?&type=MSFO', keywords: 'мсфо'},
6937		'SETPROFILE': {title: 'Настройки вашего профиля', redirect_url: '/settings/profile/', keywords: 'настройки профиля', auth_required : true},
6938		'SETTINGS': {title: 'Настройки ваших уведомлений', redirect_url: '/settings/notifications/', keywords: 'настройки уведомлений', auth_required : true},
6939		'QBI': {title: 'Индексы российских облигаций', redirect_url: '/q/index_bonds/', keywords: 'облигации индексы'},
6940		'ECOB': {title: 'Календарь событий по облигациям', redirect_url: '/calendar/bonds/', keywords: 'облигации календарь'},
6941
6942		'POLL': {title: 'Опросы', variants:[
6943
6944			{title: 'Создайте опрос', syntax:'POLL ADD', redirect_url: '/question/add/', keywords: 'опрос создать', auth_required : true}
6945
6946		]},
6947
6948		'REPLY': {title: 'Ответы на мои комментарии', redirect_url: '/my/$login/reply-to-me/', keywords: 'ответы на мои комментарии', auth_required : true},
6949		'FREPLY': {title: 'Ответы мне на форуме', redirect_url: '/my/$login/reply-to-me-forum/', keywords: 'ответы мне на форуме', auth_required : true},
6950		'RULES': {title: 'Правила смартлаба', redirect_url: '/blog/mytrading/5161.php', keywords: 'правила смартлаба'},
6951		'FORUMERS': {title: 'Рейтинг участников форума', redirect_url: '/people/all/order_by_stocks/desc/', keywords: 'рейтинг форумчан'},
6952		'READERS': {title: 'Рейтинг читателей книг', redirect_url: '/people/all/order_by_books/desc/', keywords: 'рейтинг читателей'},
6953		'RAS': {title: 'Таблица последних отчетов по РСБУ', redirect_url: '/q/shares_fundamental3?&type=RSBU', keywords: 'рсбу'},
6954		'SOFT': {title: 'Форум софта для трейдинга', redirect_url: '/trading-software/', keywords: 'торговый софт'},
6955
6956		
6957
6958		
6959
6960		
6961
6962		
6963
6964	};
6965
6966	var console_aliases = {'1': 'POST', '2': 'BLOG', '3': 'CMT', '4' : 'LINKS', '5' : 'FAV', '6' : 'ACC', '7' : 'FRND', 'BLOGS':'ALL', 'PM' : 'MAIL', '/' : 'MAIN', 'PPL' : 'PEOPLE'};
6967	window['mailto_func'] = function(login)
6968	{
6969		window.open('/talk/add/?talk_users=' + encodeURIComponent(login), '_blank');
6970	};
6971
6972
6973	window['new_portfolio_func'] = function(login)
6974	{
6975		$.cachedScript('/plugins/trade/templates/skin/default/actions/ActionQ/js/portfolio.js').done(function( script, textStatus )
6976		{
6977			var od = $;
6978			$ = jQuery;
6979			AddPortfolioEvent('Создание нового списка', 'add_list').then(function(sMsgTitle, sMsg, iListId, sListTitle)
6980			{
6981				msgNoticeBox.alert(sMsgTitle, sMsg);
6982				if (typeof(CURRENT_USER_LOGIN) != 'undefined')
6983				{
6984					setTimeout(function(e)
6985					{
6986						document.location.href = '/q/portfolio/' + encodeURIComponent(CURRENT_USER_LOGIN) + '/' + iListId + '/';
6987					}, 1000);
6988				}
6989
6990			}, function(sMsgTitle, sMsg)
6991			{
6992				msgErrorBox.alert(sMsgTitle, sMsg);
6993
6994			}).always(function()
6995			{
6996				$ = od;
6997			});
6998		});
6999	};
7000(function($)
7001{
7002	var bReady = false;
7003
7004	function abuseDialog(targetId, targetType)
7005	{
7006		if (!(bReady && (typeof(CURRENT_USER_ID) !== 'undefined'))) return;
7007
7008		var aAbuse = {
7009
7010			'topic' : 'топик',
7011			'comment' : 'комментарий',
7012			'profile' : 'профиль'
7013		};
7014
7015		const d = new ConfirmDialog({
7016
7017			class: 'abuse-popup',
7018			title: 'Пожаловаться на ' + (targetType in aAbuse ? aAbuse[targetType] : ' жизнь'),
7019			content: '\
7020				<fieldset class="abuse_title">\
7021					<legend>Текст жалобы (до 60 символов):</legend>\
7022					<textarea id="abuse_text" class="custom-input" maxlength="64"></textarea>\
7023				</fieldset>',
7024			confirmText: 'Отправить жалобу',
7025			onConfirm: function()
7026			{
7027				const self = this;
7028				const data = {targetId: targetId, targetType: targetType};
7029				const at = $('textarea#abuse_text', $(this.dialog));
7030				if (at.length) data['text'] = at.val();
7031
7032				if (!$.trim(at.val())) return msgErrorBox.alert('Ошибка', 'Необходимо указать текст жалобы');
7033
7034				this.confirmBtn.disabled = true;
7035
7036				$.ajax({
7037					type: 'POST',
7038					url: '/abuse/abuse_ajax/',
7039					data: data
7040				}).done(function(result)
7041				{
7042					if (!result)
7043					{
7044						msgErrorBox.alert('Внимание!', 'Неизвестная ошибка');
7045						self.confirmBtn.disabled = false;
7046						return;
7047					}
7048
7049					if (result.bStateError)
7050					{
7051						msgErrorBox.alert(result.sMsgTitle, result.sMsg);
7052						self.confirmBtn.disabled = false;
7053					} else
7054					{
7055						msgNoticeBox.alert(result.sMsgTitle, result.sMsg);
7056						self.close();
7057					}
7058				});
7059			}
7060		});
7061		d.open();
7062	}
7063
7064	$(document).ready(function()
7065	{
7066		bReady = true;
7067	});
7068
7069	window['abuse'] = abuseDialog;	
7070	
7071})(jQuery);
7072

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.