PageSourceSearch

https://netru.net/hm/js/hm.min.js?v=364

js netru.net collected 2026-10-07 20:35:34 UTC 779,528 bytes, 16,316 lines download raw bytes

1(function(window, undefined) {
2  var hm = window.hm = window.hm || {};
3  hm.dict = hm.dict || {};
4  hm.core = hm.core || {};
5  hm.compilationInfo = {"time":1480668315E3, "config":{"project":"default", "parts":{"base":[{"name":"core", "version":"master", "enabled":true}, {"name":"core-ui", "version":"master", "enabled":true}], "projects":[{"name":"default", "version":"master", "enabled":true}], "modules":[{"name":"calendar", "version":"master", "enabled":false}, {"name":"graph", "version":"master", "enabled":false}, {"name":"grid", "version":"master", "enabled":false}, {"name":"es", "version":"master", "enabled":true}, 
6  {"name":"messenger", "version":"master", "enabled":true}, {"name":"trainingModules", "version":"master", "enabled":true}, {"name":"mainPageWidgets", "version":"master", "enabled":true}]}}};
7  (function() {
8    var NFE = hm.NFE = {}, isStrictMode = false, expr = /\/\*\s*NFE_FIX\s*\*\/\s+function\s+([\w\d]+)\s*\(([^\)]*)\)\s\{/g, replace = "function($2) { var $1 = arguments.callee;\n";
9    try {
10      var test = arguments.callee;
11    } catch (e) {
12      isStrictMode = true;
13    }
14    if (isStrictMode) {
15      NFE.fix = function(code) {
16        return'"use strict";\n' + code;
17      };
18    } else {
19      NFE.fix = function(code) {
20        return code.replace(expr, replace);
21      };
22    }
23  })();
24  var Handlebars = function() {
25    var __module3__ = function() {
26      var __exports__;
27      function SafeString(string) {
28        this.string = string;
29      }
30      SafeString.prototype.toString = function() {
31        return "" + this.string;
32      };
33      __exports__ = SafeString;
34      return __exports__;
35    }();
36    var __module2__ = function(__dependency1__) {
37      var __exports__ = {};
38      var SafeString = __dependency1__;
39      var escape = {"&":"&amp;", "<":"&lt;", ">":"&gt;", '"':"&quot;", "'":"&#x27;", "`":"&#x60;"};
40      var badChars = /[&<>"'`]/g;
41      var possible = /[&<>"'`]/;
42      function escapeChar(chr) {
43        return escape[chr] || "&amp;";
44      }
45      function extend(obj, value) {
46        for (var key in value) {
47          if (Object.prototype.hasOwnProperty.call(value, key)) {
48            obj[key] = value[key];
49          }
50        }
51      }
52      __exports__.extend = extend;
53      var toString = Object.prototype.toString;
54      __exports__.toString = toString;
55      var isFunction = function(value) {
56        return typeof value === "function";
57      };
58      if (isFunction(/x/)) {
59        isFunction = function(value) {
60          return typeof value === "function" && toString.call(value) === "[object Function]";
61        };
62      }
63      var isFunction;
64      __exports__.isFunction = isFunction;
65      var isArray = Array.isArray || function(value) {
66        return value && typeof value === "object" ? toString.call(value) === "[object Array]" : false;
67      };
68      __exports__.isArray = isArray;
69      function escapeExpression(string) {
70        if (string instanceof SafeString) {
71          return string.toString();
72        } else {
73          if (!string && string !== 0) {
74            return "";
75          }
76        }
77        string = "" + string;
78        if (!possible.test(string)) {
79          return string;
80        }
81        return string.replace(badChars, escapeChar);
82      }
83      __exports__.escapeExpression = escapeExpression;
84      function isEmpty(value) {
85        if (!value && value !== 0) {
86          return true;
87        } else {
88          if (isArray(value) && value.length === 0) {
89            return true;
90          } else {
91            return false;
92          }
93        }
94      }
95      __exports__.isEmpty = isEmpty;
96      return __exports__;
97    }(__module3__);
98    var __module4__ = function() {
99      var __exports__;
100      var errorProps = ["description", "fileName", "lineNumber", "message", "name", "number", "stack"];
101      function Exception(message, node) {
102        var line;
103        if (node && node.firstLine) {
104          line = node.firstLine;
105          message += " - " + line + ":" + node.firstColumn;
106        }
107        var tmp = Error.prototype.constructor.call(this, message);
108        for (var idx = 0;idx < errorProps.length;idx++) {
109          this[errorProps[idx]] = tmp[errorProps[idx]];
110        }
111        if (line) {
112          this.lineNumber = line;
113          this.column = node.firstColumn;
114        }
115      }
116      Exception.prototype = new Error;
117      __exports__ = Exception;
118      return __exports__;
119    }();
120    var __module1__ = function(__dependency1__, __dependency2__) {
121      var __exports__ = {};
122      var Utils = __dependency1__;
123      var Exception = __dependency2__;
124      var VERSION = "1.3.0";
125      __exports__.VERSION = VERSION;
126      var COMPILER_REVISION = 4;
127      __exports__.COMPILER_REVISION = COMPILER_REVISION;
128      var REVISION_CHANGES = {1:"<= 1.0.rc.2", 2:"== 1.0.0-rc.3", 3:"== 1.0.0-rc.4", 4
128:">= 1.0.0"};
129      __exports__.REVISION_CHANGES = REVISION_CHANGES;
130      var isArray = Utils.isArray, isFunction = Utils.isFunction, toString = Utils.toString, objectType = "[object Object]";
131      function HandlebarsEnvironment(helpers, partials) {
132        this.helpers = helpers || {};
133        this.partials = partials || {};
134        registerDefaultHelpers(this);
135      }
136      __exports__.HandlebarsEnvironment = HandlebarsEnvironment;
137      HandlebarsEnvironment.prototype = {constructor:HandlebarsEnvironment, logger:logger, log:log, registerHelper:function(name, fn, inverse) {
138        if (toString.call(name) === objectType) {
139          if (inverse || fn) {
140            throw new Exception("Arg not supported with multiple helpers");
141          }
142          Utils.extend(this.helpers, name);
143        } else {
144          if (inverse) {
145            fn.not = inverse;
146          }
147          this.helpers[name] = fn;
148        }
149      }, registerPartial:function(name, str) {
150        if (toString.call(name) === objectType) {
151          Utils.extend(this.partials, name);
152        } else {
153          this.partials[name] = str;
154        }
155      }};
156      function registerDefaultHelpers(instance) {
157        instance.registerHelper("helperMissing", function(arg) {
158          if (arguments.length === 2) {
159            return undefined;
160          } else {
161            throw new Exception("Missing helper: '" + arg + "'");
162          }
163        });
164        instance.registerHelper("blockHelperMissing", function(context, options) {
165          var inverse = options.inverse || function() {
166          }, fn = options.fn;
167          if (isFunction(context)) {
168            context = context.call(this);
169          }
170          if (context === true) {
171            return fn(this);
172          } else {
173            if (context === false || context == null) {
174              return inverse(this);
175            } else {
176              if (isArray(context)) {
177                if (context.length > 0) {
178                  return instance.helpers.each(context, options);
179                } else {
180                  return inverse(this);
181                }
182              } else {
183                return fn(context);
184              }
185            }
186          }
187        });
188        instance.registerHelper("each", function(context, options) {
189          var fn = options.fn, inverse = options.inverse;
190          var i = 0, ret = "", data;
191          if (isFunction(context)) {
192            context = context.call(this);
193          }
194          if (options.data) {
195            data = createFrame(options.data);
196          }
197          if (context && typeof context === "object") {
198            if (isArray(context)) {
199              for (var j = context.length;i < j;i++) {
200                if (data) {
201                  data.index = i;
202                  data.first = i === 0;
203                  data.last = i === context.length - 1;
204                }
205                ret = ret + fn(context[i], {data:data});
206              }
207            } else {
208              for (var key in context) {
209                if (context.hasOwnProperty(key)) {
210                  if (data) {
211                    data.key = key;
212                    data.index = i;
213                    data.first = i === 0;
214                  }
215                  ret = ret + fn(context[key], {data:data});
216                  i++;
217                }
218              }
219            }
220          }
221          if (i === 0) {
222            ret = inverse(this);
223          }
224          return ret;
225        });
226        instance.registerHelper("if", function(conditional, options) {
227          if (isFunction(conditional)) {
228            conditional = conditional.call(this);
229          }
230          if (!options.hash.includeZero && !conditional || Utils.isEmpty(conditional)) {
231            return options.inverse(this);
232          } else {
233            return options.fn(this);
234          }
235        });
236        instance.registerHelper("unless", function(conditional, options) {
237          return instance.helpers["if"].call(this, conditional, {fn:options.inverse, inverse:options.fn, hash:options.hash});
238        });
239        instance.registerHelper("with", function(context, options) {
240          if (isFunction(context)) {
241            context = context.call(this);
242          }
243          if (!Utils.isEmpty(context)) {
244            return options.fn(context);
245          }
246        });
247        instance.registerHelper("log", function(context, options) {
248          var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1;
249          instance.log(level, context);
250        });
251      }
252      var logger = {methodMap:{0:"debug", 1:"info", 2:"warn", 3:"error"}, DEBUG:0, INFO:1, WARN:2, ERROR:3, level:3, log:function(level, obj) {
253        if (logger.level <= level) {
254          var method = logger.methodMap[level];
255          if (typeof console !== "undefined" && console[method]) {
256            console[method].call(console, obj);
257          }
258        }
259      }};
260      __exports__.logger = logger;
261      function log(level, obj) {
262        logger.log(level, obj);
263      }
264      __exports__.log = log;
265      var createFrame = function(object) {
266        var obj = {};
267        Utils.extend(obj, object);
268        return obj;
269      };
270      __exports__.createFrame = createFrame;
271      return __exports__;
272    }(__module2__, __module4__);
273    var __module5__ = function(__dependency1__, __dependency2__, __dependency3__) {
274      var __exports__ = {};
275      var Utils = __dependency1__;
276      var Exception = __dependency2__;
277      var COMPILER_REVISION = __dependency3__.COMPILER_REVISION;
278      var REVISION_CHANGES = __dependency3__.REVISION_CHANGES;
279      function checkRevision(compilerInfo) {
280        var compilerRevision = compilerInfo && compilerInfo[0] || 1, currentRevision = COMPILER_REVISION;
281        if (compilerRevision !== currentRevision) {
282          if (compilerRevision < currentRevision) {
283            var runtimeVersions = REVISION_CHANGES[currentRevision], compilerVersions = REVISION_CHANGES[compilerRevision];
284            throw new Exception("Template was precompiled with an older version of Handlebars than the current runtime. " + "Please update your precompiler to a newer version (" + runtimeVersions + ") or downgrade your runtime to an older version (" + compilerVersions + ").");
285          } else {
286            throw new Exception("Template was precompiled with a newer version of Handlebars than the current runtime. " + "Please update your runtime to a newer version (" + compilerInfo[1] + ").");
287          }
288        }
289      }
290      __exports__.checkRevision = checkRevision;
291      function template(templateSpec, env) {
292        if (!env) {
293          throw new Exception("No environment passed to template");
294        }
295        var invokePartialWrapper = function(partial, name, context, helpers, partials, data) {
296          var result = env.VM.invokePartial.apply(this, arguments);
297          if (result != null) {
298            return result;
299          }
300          if (env.compile) {
301            var options = {helpers:helpers, partials:partials, data:data};
302            partials[name] = env.compile(partial, {data:data !== undefined}, env);
303            return partials[name](context, options);
304          } else {
305            throw new Exception("The partial " + name + " could not be compiled when running in runtime-only mode");
306          }
307        };
308        var container = {escapeExpression:Utils.escapeExpression, invokePartial:invokePartialWrapper, programs:[], program:function(i, fn, data) {
309          var programWrapper = this.programs[i];
310          if (data) {
311            programWrapper = program(i, fn, data);
312          } else {
313            if (!programWrapper) {
314              programWrapper = this.programs[i] = program(i, fn);
315            }
316          }
317          return programWrapper;
318        }, merge:function(param, common) {
319          var ret = param || common;
320          if (param && (common && param !== common)) {
321            ret = {};
322            Utils.extend(ret, common);
323            Utils.extend(ret, param);
324          }
325          return ret;
326        }, programWithDepth:env.VM.programWithDepth, noop:env.VM.noop, compilerInfo:null};
327        return function(context, options) {
328          options = options || {};
329          var namespace = options.partial ? options : env, helpers, partials;
330          if (!options.partial) {
331            helpers = options.helpers;
332            partials = options.partials;
333          }
334          var result = templateSpec.call(container, namespace, context, helpers, partials, options.data);
335          if (!options.partial) {
336            env.VM.checkRevision(container.compilerInfo);
337          }
338          return result;
339        };
340      }
341      __exports__.template = template;
342      function programWithDepth(i, fn, data) {
343        var args = Array.prototype.slice.call(arguments, 3);
344        var prog = function(context, options) {
345          options = options || {};
346          return fn.apply(this, [context, options.data || data].concat(args));
347        };
348        prog.program = i;
349        prog.depth = args.length;
350        return prog;
351      }
352      __exports__.programWithDepth = programWithDepth;
353      function program(i, fn, data) {
354        var prog = function(context, options) {
355          options = options || {};
356          return fn(context, options.data || data);
357        };
358        prog.program = i;
359        prog.depth = 0;
360        return prog;
361      }
362      __exports__.program = program;
363      function invokePartial(partial, name, context, helpers, partials, data) {
364        var options = {partial:true, helpers:helpers, partials:partials, data:data};
365        if (partial === undefined) {
366          throw new Exception("The partial " + name + " could not be found");
367        } else {
368          if (partial instanceof Function) {
369            return partial(context, options);
370          }
371        }
372      }
373      __exports__.invokePartial = invokePartial;
374      function noop() {
375        return "";
376      }
377      __exports__.noop = noop;
378      return __exports__;
379    }(__module2__, __module4__, __module1__);
380    var __module0__ = function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__) {
381      var __exports__;
382      var base = __dependency1__;
383      var SafeString = __dependency2__;
384      var Exception = __dependency3__;
385      var Utils = __dependency4__;
386      var runtime = __dependency5__;
387      var create = function() {
388        var hb = new base.HandlebarsEnvironment;
389        Utils.extend(hb, base);
390        hb.SafeString = SafeString;
391        hb.Exception = Exception;
392        hb.Utils = Utils;
393        hb.VM = runtime;
394        hb.template = function(spec) {
395          return runtime.template(spec, hb);
396        };
397        return hb;
398      };
399      var Handlebars = create();
400      Handlebars.create = create;
401      __exports__ = Handlebars;
402      return __exports__;
403    }(__module1__, __module3__, __module4__, __module2__, __module5__);
404    return __module0__;
405  }();
406  window.Handlebars = Handlebars;
407  var HM = window.HM = {build:hm.build, serverInitTime:hm.serverInitTime || new Date - 0, clientInitTime:hm.clientInitTime || new Date - 0, global:window, isDebug:hm.isDebug, hmRoot:hm.basePath, theme:"default", emptyFn:function() {
408  }, jQuery:jQuery, $document:function() {
409    return this._redirectMethodCall({method:"$document", Class:hm.core.DOM, args:arguments});
410  }, $window:function() {
411    return this._redirectMethodCall({method:"$window", Class:hm.core.DOM, args:arguments});
412  }, $html:function() {
413    return this._redirectMethodCall({method:"$html", Class:hm.core.DOM, args:arguments});
414  }, $body:function() {
415    return this._redirectMethodCall({method:"$body", Class:hm.core.DOM, args:arguments});
416  }, $head:function() {
417    return this._redirectMethodCall({method:"$head", Class:hm.core.DOM, args:arguments});
418  }, define:function() {
419    return this._redirectMethodCall({method:"define", Class:hm.core.ClassManager, args:arguments});
420  }, override:function() {
421    return this._redirectMethodCall({method:"override", Class:hm.core.ClassManager, args:arguments});
422  }, create:function() {
423    return this._redirectMethodCall({method:"create", Class:hm.core.ClassManager, args:arguments});
424  }, require:function() {
425    return this._redirectMethodCall({method:"require", Class:hm.core.ClassManager, args:arguments});
426  }, getService:function() {
427    return this._redirectMethodCall({method:"getService", Class:hm.core.BaseService, classMethod:"get", args:arguments});
428  }, _redirectMethodCall:function(cfg) {
429    var method = cfg.method, Class = cfg.Class, classMethod = cfg.classMethod || method, args = cfg.args;
430    this[method] = Class[classMethod].bind(Class);
431    return this[method].apply(Class, args);
432  }, _modulesState:{hm:{js:true, css:false}}, moduleExists:function(moduleName) {
433    var modules = hm.compilationInfo.config.parts.modules;
434    for (var i = 0, ln = modules.length;i < ln;i++) {
435      var module = modules[i];
436      if (module.name === moduleName) {
437        return module.enabled;
438      }
439    }
440    return false;
441  }, moduleLoaded:function(moduleCode) {
442    var state = this._modulesState[moduleCode];
443    if (state && (state.js && state.css)) {
444      return true;
445    }
446    return false;
447  }, requireModule:function(moduleCode, callBack) {
448    var linkId = "hm-module-link-" + (new Date - 0);
449    function afterLoadCallBack() {
450      setTimeout(callBack, 0);
451    }
452    if (this.moduleLoaded(moduleCode)) {
453      afterLoadCallBack();
454      return;
455    }
456    if (!this._modulesState.hasOwnProperty(moduleCode)) {
457      this._modulesState[moduleCode] = {js:this.isDebug ? true : false, css:false};
458    }
459    var me = this, state = this._modulesState[moduleCode];
460    function checkState() {
461      if (me.moduleLoaded(moduleCode)) {
462        afterLoadCallBack();
463      }
464    }
465    function needLoadJs() {
466      return state.js === false;
467    }
468    function needLoadCss() {
469      return state.css === false;
470    }
471    function jsLoaded() {
472      state.js = true;
473      checkState();
474    }
475    function cssLoaded() {
476      state.css = true;
477      checkState();
478    }
479    if (needLoadJs()) {
480      var scriptUrl = this.hmRoot + "/data/js/" + moduleCode + ".min.js?v=" + this.build;
481      yepnope.injectJs(scriptUrl, jsLoaded);
482    } else {
483      jsLoaded();
484    }
485    if (needLoadCss()) {
486      var styleUrl, $link = $(document.createElement("link"));
487      $link.prop("id", linkId);
488      if (this.isDebug) {
489        styleUrl = "/unmanaged/dev_tools.php?tool=sass&runtime=1&module=" + moduleCode + "&v=" + this.build;
490      } else {
491        styleUrl = this.hmRoot + "/data/css/" + moduleCode + "/" 
491+ this.theme + "/screen.css?v=" + this.build;
492      }
493      $link.prop("type", "text/css").prop("href", styleUrl).prop("rel", "stylesheet");
494      $link.on("load", cssLoaded);
495      $link.insertBefore("#theme-css-file");
496    } else {
497      cssLoaded();
498    }
499  }, _:function(name) {
500    var translate = hm.dict.translate;
501    if (!translate) {
502      return name;
503    }
504    this._ = function(name) {
505      var result = translate[name];
506      return typeof result === "string" ? result : name;
507    };
508    return this._(name);
509  }, init:function() {
510    hm.core.Console.info(hm.core.Info.getSimpleInfo());
511    if (!hm.appClass) {
512      return;
513    }
514    this.app = HM.create(hm.appClass);
515  }, isObject:function() {
516    return this._redirectMethodCall({method:"isObject", Class:hm.core.Object, args:arguments});
517  }, namespace:function(namespace) {
518    var ns = namespace.split("."), child = this.global;
519    for (var j = 0, ln = ns.length;j < ln;j++) {
520      var nsPart = ns[j];
521      child = child[nsPart] = child[nsPart] || {};
522    }
523  }, singleton:function(Constructor) {
524    var instance = null;
525    Constructor.getInstance = function() {
526      if (instance === null) {
527        instance = new Constructor;
528      }
529      return instance;
530    };
531  }, each:function() {
532    return this._redirectMethodCall({method:"each", Class:hm.core.Object, args:arguments});
533  }};
534  (function() {
535    var self;
536    hm.core.Object = {isObject:function(obj) {
537      return typeof obj === "object" && obj !== null;
538    }, getProperty:function(name, obj, delimeter) {
539      if (name === "") {
540        return obj;
541      }
542      var nameParts = name.split(delimeter || ".");
543      for (var i = 0;i < nameParts.length;i++) {
544        var namePart = nameParts[i];
545        if (!obj.hasOwnProperty(namePart)) {
546          return null;
547        }
548        obj = obj[namePart];
549      }
550      return obj;
551    }, clone:function(obj) {
552      var result = null;
553      if (obj instanceof Array) {
554        result = [];
555      } else {
556        result = {};
557      }
558      for (var i in obj) {
559        if (!obj.hasOwnProperty(i)) {
560          continue;
561        }
562        var value = obj[i];
563        if (value instanceof Array || this.isObject(value)) {
564          result[i] = this.clone(value);
565        } else {
566          result[i] = value;
567        }
568      }
569      return result;
570    }, _extend:function(target, source) {
571      for (var i in source) {
572        if (!source.hasOwnProperty(i)) {
573          continue;
574        }
575        target[i] = source[i];
576      }
577    }, extend:function(target) {
578      for (var i = 1, ln = arguments.length;i < ln;i++) {
579        this._extend(target, arguments[i]);
580      }
581      return target;
582    }, each:function(obj, callBack, scope) {
583      var i, ln, key;
584      if (hm.core.Array.isArrayLikely(obj)) {
585        return hm.core.Array.forEach(obj, callBack, scope);
586      }
587      if (Object.getOwnPropertyNames) {
588        var keys = Object.getOwnPropertyNames(obj);
589        for (i = 0, ln = keys.length;i < ln;i++) {
590          key = keys[i];
591          callBack.call(scope, obj[key], key, obj);
592        }
593        return;
594      }
595      for (key in obj) {
596        if (!obj.hasOwnProperty(i)) {
597          continue;
598        }
599        callBack.call(scope, obj[key], key, obj);
600      }
601    }};
602    self = hm.core.Object;
603  })();
604  (function() {
605    var self;
606    hm.core.Array = {isArrayLikely:function(obj) {
607      return obj.length !== undefined;
608    }};
609    var ArrayPrototype = Array.prototype, forEachFn = ArrayPrototype.forEach, indexOf = ArrayPrototype.indexOf;
610    if (!forEachFn) {
611      forEachFn = function forEach(callback, thisArg) {
612        var T, k, hasOwnProp = Object.prototype.hasOwnProperty;
613        if (this == null) {
614          throw new TypeError("this is null or not defined");
615        }
616        var O = Object(this);
617        var len = O.length >>> 0;
618        if ({}.toString.call(callback) !== "[object Function]") {
619          throw new TypeError(callback + " is not a function");
620        }
621        if (thisArg) {
622          T = thisArg;
623        }
624        k = 0;
625        while (k < len) {
626          var kValue;
627          if (hasOwnProp.call(O, k)) {
628            kValue = O[k];
629            callback.call(T, kValue, k, O);
630          }
631          k++;
632        }
633      };
634    }
635    hm.core.Array.forEach = function(obj, callBack, scope) {
636      return forEachFn.call(obj, callBack, scope);
637    };
638    if (!indexOf) {
639      indexOf = function(searchElement, fromIndex) {
640        var k;
641        if (this == null) {
642          throw new TypeError('"this" is null or not defined');
643        }
644        var O = Object(this);
645        var len = O.length >>> 0;
646        if (len === 0) {
647          return-1;
648        }
649        var n = +fromIndex || 0;
650        if (Math.abs(n) === Infinity) {
651          n = 0;
652        }
653        if (n >= len) {
654          return-1;
655        }
656        k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
657        while (k < len) {
658          var kValue;
659          if (k in O && O[k] === searchElement) {
660            return k;
661          }
662          k++;
663        }
664        return-1;
665      };
666    }
667    hm.core.Array.indexOf = function(array, searchElement, fromIndex) {
668      return indexOf.call(array, searchElement, fromIndex);
669    };
670    self = hm.core.Array;
671  })();
672  (function() {
673    var self;
674    ({_classXtypes:{}, _classDefined:{}, loadCachedFile:function(fileName) {
675      var result = $.ajax({async:false, url:fileName + (fileName.indexOf("?") === -1 ? "?" : "&") + "v=" + HM.build, global:false});
676      return result.responseText;
677    }, injectScript:function(fileName) {
678      var classTxt = this.loadCachedFile(fileName);
679      if (classTxt) {
680        classTxt = hm.NFE.fix(classTxt);
681        (new Function('"use strict";\n' + classTxt + "\n// //@ sourceURL=" + fileName))();
682      }
683    }, injectScripts:function() {
684      for (var i = 0, ln = arguments.length;i < ln;i++) {
685        this.injectScript(arguments[i]);
686      }
687    }, extendedFrom:function(cls) {
688      if (this === cls) {
689        return true;
690      }
691      if (!this.hasOwnProperty("$parentСlass")) {
692        return false;
693      }
694      if (this.$parentСlass === cls) {
695        return true;
696      }
697      if (this.$parentСlass.hasOwnProperty("extendedFrom")) {
698        return this.$parentСlass.extendedFrom(cls);
699      }
700      return false;
701    }, define:function(className, classConfig) {
702      if (!classConfig) {
703        classConfig = {};
704      }
705      var simpleClsName = className.replace(/\./g, "_"), HmObject = hm.core.Object, NewClass, ParentClass;
706      if (classConfig.hasOwnProperty("constructor")) {
707        NewClass = classConfig.constructor;
708        delete classConfig.constructor;
709      } else {
710        NewClass = function() {
711          var constructor = arguments.callee;
712          return this.callParent(constructor, arguments);
713        };
714      }
715      ParentClass = this.require(classConfig.extend || "hm.core.Class");
716      delete classConfig.extend;
717      var NewClassPrototypeConstructor = function() {
718      }, parentPrototype = ParentClass.prototype, newPrototype;
719      NewClassPrototypeConstructor.prototype = parentPrototype;
720      NewClass.prototype = newPrototype = new NewClassPrototypeConstructor;
721      newPrototype.constructor = NewClass;
722      newPrototype.self = NewClass;
723      newPrototype.$className = className;
724      NewClass.$parentСlass = ParentClass;
725      NewClass.extendedFrom = this.extendedFrom;
726      if (classConfig.hasOwnProperty("statics")) {
727        HmObject.extend(NewClass, classConfig.statics);
728        delete classConfig.statics;
729      }
730      if (parentPrototype.hasOwnProperty("config")) {
731        newPrototype.config = HmObject.extend({}, parentPrototype.config);
732      } else {
733        newPrototype.config = {};
734      }
735      if (classConfig.hasOwnProperty("config")) {
736        HmObject.extend(newPrototype.config, classConfig.config);
737        delete classConfig.config;
738      }
739      var classAlias = classConfig.alias;
740      delete classConfig.alias;
741      var classRequires = classConfig.requires;
742      delete classConfig.requires;
743      for (var i in classConfig) {
744        if (!classConfig.hasOwnProperty(i)) {
745          continue;
746        }
747        newPrototype[i] = classConfig[i];
748        if (!(classConfig[i] instanceof Function)) {
749          continue;
750        }
751        newPrototype[i].$owner = NewClass;
752        newPrototype[i].$name = i;
753        newPrototype[i].displayName = className + "." + i + "()";
754      }
755      NewClass.$owner = NewClass;
756      NewClass.$name = "constructor";
757      NewClass.displayName = className;
758      if (classConfig.singleton) {
759        NewClass = new NewClass;
760      }
761      this.classAlias(className, NewClass);
762      if (classAlias) {
763        this.classAlias(classAlias, NewClass);
764      }
765      if (!classRequires) {
766        return;
767      }
768      var $requiredClasses = NewClass.$requiredClasses = [], classDefined = this._classDefined;
769      for (var i = 0, ln = classRequires.length;i < ln;i++) {
770        var requiredClass = classRequires[i];
771        if (!classDefined[requiredClass]) {
772          this.require(requiredClass);
773        }
774        $requiredClasses.push(classDefined[requiredClass]);
775      }
776    }, override:function(className, prototype) {
777      var constructor = this.require(className), classPrototype;
778      if (constructor.singleton) {
779        classPrototype = constructor;
780      } else {
781        classPrototype = constructor.prototype;
782      }
783      for (var i in prototype) {
784        if (!prototype.hasOwnProperty(i)) {
785          continue;
786        }
787        if (!classPrototype.hasOwnProperty(i)) {
788          classPrototype[i] = prototype[i];
789          if (!(prototype[i] instanceof Function)) {
790            continue;
791          }
792          classPrototype[i].$owner = constructor;
793          classPrototype[i].$name = i;
794          classPrototype[i].displayName = className + "." + i + "()";
795          continue;
796        }
797        if (!(prototype[i] instanceof Function)) {
798          classPrototype[i] = prototype[i];
799        } else {
800          var overridedMethod = classPrototype[i];
801          classPrototype[i] = prototype[i];
802          classPrototype[i].$owner = constructor;
803          classPrototype[i].$name = i;
804          classPrototype[i].$overridedMethod = overridedMethod;
805          classPrototype[i].displayName = className + "." + i + "()";
806        }
807      }
808    }, classAlias:function(className, classFunction) {
809      var ns = className.split("."), child = HM.global;
810      for (var j = 0, ln = ns.length - 1;j < ln;j++) {
811        var nsPart = ns[j];
812        child[nsPart] = child[nsPart] || {};
813        child = child[nsPart];
814      }
815      child[ns[j]] = classFunction;
816      this._classDefined[className] = classFunction;
817    }, create:function(className, cfg) {
818      var cls;
819      if (typeof className !== "function") {
820        cls = this.require(className);
821      } else {
822        cls = className;
823      }
824      return new cls(cfg);
825    }, requires:function() {
826      for (var i in arguments) {
827        if (!arguments.hasOwnProperty(i)) {
828          continue;
829        }
830        this.require(arguments[i]);
831      }
832    }, require:function(className) {
833      if (!this._classDefined.hasOwnProperty(className)) {
834        throw new Error(className + " не найден");
835      }
836      return this._classDefined[className];
837    }, createFactory:function(cfgPropertyName, classMap) {
838      return function(cfg) {
839        if (typeof cfg === "string") {
840          var type = cfg;
841          cfg = {};
842          cfg[cfgPropertyName] = type;
843        }
844        var classCode, className;
845        if (!cfg.hasOwnProperty(cfgPropertyName)) {
846          if (!classMap.hasOwnProperty("default")) {
847            throw new Error("Для фабрики необходимо указать тип");
848          }
849          classCode = "default";
850        } else {
851          classCode = cfg[cfgPropertyName];
852        }
853        if (classMap.hasOwnProperty(classCode)) {
854          className = classMap[classCode];
855        } else {
856          className = classCode;
857        }
858        return HM.create(className, cfg);
859      };
860    }, init:function() {
861      this.classAlias("hm.core.ClassManager", this);
862      delete this.init;
863    }}).init();
864    self = hm.core.ClassManager;
865  })();
866  (function() {
867    var self;
868    hm.core.ClassManager.classAlias("hm.core.Class", function(cfg) {
869      this.__initConfig(cfg);
870      return this.__construct();
871    });
872    hm.core.Class.prototype.callOverriden = function(method, args) {
873      var overridenMethod = method.$overridedMethod;
874      if (!overridenMethod) {
875        throw new Error("Не найден перезаписанный метод");
876      }
877      return overridenMethod.apply(this, args || []);
878    };
879    hm.core.Class.prototype.callParent = function(method, args) {
880      if (typeof method !== "function") {
881        args = method;
882        method = args.callee;
883        try {
884          console.warn("Вызов callParent с одним аргументом устарел!", method.$owner.prototype.$className + "." + method.$name);
885        } catch (e) {
886        }
887      }
888      var parentMethod = method.$owner.$parentСlass.prototype[method.$name];
889      if (parentMethod && parentMethod instanceof Function) {
890        return parentMethod.apply(this, args || []);
891      }
892    };
893    hm.core.Class.prototype.__construct = HM.emptyFn;
894    hm.core.Class.prototype.__destruct = function() {
895      if (this._needToDestroy) {
896        var needToDestroy = this._needToDestroy;
897        while (needToDestroy.length != 0) {
898          if (needToDestroy[0].destroy) {
899            needToDestroy[0].destroy();
900          }
901          needToDestroy.splice(0, 1);
902        }
903      }
904      var i;
905      if (this.hasOwnProperty("config")) {
906        var config = this.config;
907        for (i in config) {
908          if (config.hasOwnProperty(i)) {
909            delete config[i];
910          }
911        }
912      }
913      for (i in this) {
914        if (this.hasOwnProperty(i)) {
915          delete this[i];
916        }
917      }
918      this.destructed = true;
919    };
920    hm.core.Class.prototype.destroy = function() {
921      this.__destruct();
922    };
923    hm.core.Class.prototype.needToDestroy = function(obj) {
924      if (obj.destroy) {
925        if (!this._needToDestroy) {
926          this._needToDestroy = [];
927        }
928        this._needToDestroy.push(obj);
929      } else {
930        console.warn("Не найден метод destroy.", obj);
931      }
932    };
933    hm.core.Class.prototype.__initConfig = function(userCfg) {
934      userCfg = userCfg || {};
935      var config = this.config = hm.core.Object.extend({}, this.config);
936      for (var i in userCfg) {
937        if (!userCfg.hasOwnProperty(i)) {
938          continue;
939        }
940        if (!config.hasOwnProperty(i)) {
941          throw new Error("Параметр " + i + " не определен в конфиге класса " + this.$className);
942        }
943        config[i] = userCfg[i];
944      }
945    };
946    self = hm.core.Class;
947  })();
948  (function() {
949    var self;
950    HM.define("hm.core.Console", {singleton:true, __construct:function() {
951      var console = window.console || {}, emptyFn = HM.emptyFn, functionNames = "assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","), ln = functionNames.length, functionName, me = this;
952      this._browserConsoleAllowed = HM.isDebug;
953      for (var i = 0;i < ln;i++) {
954        functionName = functionNames[i];
955        try {
956          this[functionName] = (console[functionName] || emptyFn).bind(console);
957        } catch (e) {
958          this[functionName] = emptyFn.bind(console);
959        }
960        (function(functionName) {
961          console[functionName] = function() {
962            if (!me._browserConsoleAllowed) {
963              return;
964            }
965            return me[functionName].apply(me, arguments);
966          };
967        })(functionName);
968      }
969    }, enableBrowserConsole:function() {
970      this._browserConsoleAllowed = true;
971    }});
972    self = hm.core.Console;
973  })();
974  (function() {
975    var self;
976    HM.define("hm.core.ObservableClass", {config:{listeners:null}, constructor:function(cfg) {
977      var constructor = arguments.callee;
978      this.__events = {};
979      if (cfg && (cfg.listeners && typeof cfg.listeners === "object")) {
980        this.__initListeners(cfg.listeners);
981      }
982      return this.callParent(constructor, arguments);
983    }, __destruct:function() {
984      var __destruct = arguments.callee;
985      this.fireEvent("destroy", this);
986      this.clearEvents();
987      this.callParent(__destruct, arguments);
988    }, __initListeners:function(listeners) {
989      var listener, scope = listeners.scope || this;
990      for (var i in listeners) {
991        if (!listeners.hasOwnProperty(i)) {
992          continue;
993        }
994        if (i === "scope") {
995          continue;
996        }
997        listener = listeners[i];
998        if (typeof listener === "function") {
999          this.on(i, listener, scope);
1000        } else {
1001          if (typeof listener === "string") {
1002            this.on(i, eval("(" + listener + ")"), scope);
1003          } else {
1004            if (HM.isObject(listener) && typeof listener.fn === "function") {
1005              this.on(i, listener.fn, listener.scope || scope, listener.data);
1006            }
1007          }
1008        }
1009      }
1010    }, fireEvent:function(eventName) {
1011      var events = this.__events, eventListeners, event;
1012      if (!events) {
1013        return null;
1014      }
1015      eventListeners = events[eventName];
1016      if (!eventListeners) {
1017        return null;
1018      }
1019      event = HM.create("hm.core.Event", {target:this, name:eventName, listeners:eventListeners.slice(), args:[].slice.call(arguments, 1)});
1020      var result = event.fire();
1021      for (var i = eventListeners.length - 1;i >= 0;i--) {
1022        if (eventListeners[i].isOne) {
1023          eventListeners.splice(i, 1);
1024        }
1025      }
1026      return result;
1027    }, on:function(eventName, fn, scope, cfg, isOne) {
1028      var events = this.__events;
1029      scope = scope || this;
1030      if (!events[eventName]) {
1031        events[eventName] = [];
1032      }
1033      events[eventName].push({fn:fn, scope:scope, cfg:cfg, isOne:isOne});
1034      return this;
1035    }, one:function(eventName, fn, scope, cfg) {
1036      return this.on(eventName, fn, scope, cfg, true);
1037    }, un:function(eventName, fn, scope) {
1038      var events = this.__events;
1039      if (!events[eventName]) {
1040        return this;
1041      }
1042      var eventListeners = events[eventName], listener;
1043      scope = scope || this;
1044      for (var i = eventListeners.length - 1;i >= 0;i--) {
1045        listener = eventListeners[i];
1046        if (listener.fn === fn && listener.scope === scope) {
1047          eventListeners.splice(i, 1);
1048        }
1049      }
1050      return this;
1051    }, hasListeners:function() {
1052      return!!Object.getOwnPropertyNames(this.__events).length;
1053    }, clearEvents:function() {
1054      this.__events = {};
1055    }});
1056    self = hm.core.ObservableClass;
1057  })();
1058  (function() {
1059    var self;
1060    var $document = null, $window = null, $body = null, $head = null, $html = null;
1061    var maxZIndex = 1E4, $cropTagsCont = $(document.createElement("div"));
1062    HM.define("hm.core.DOM", {statics:{$document:function() {
1063      if ($document === null) {
1064        $document = $(document);
1065      }
1066      return $document;
1067    }, $html:function() {
1068      if ($html === null) {
1069        $html = $(document.documentElement);
1070      }
1071      return $html;
1072    }, $window:function() {
1073      if ($window === null) {
1074        $window = $(window);
1075      }
1076      return $window;
1077    }, $body:function() {
1078      if ($body === null) {
1079        if (!document.body) {
1080          return null;
1081        }
1082        $body = $(document.body);
1083      }
1084      return $body;
1085    }, $head:function() {
1086      if ($head === null) {
1087        if (!document.head) {
1088          return null;
1089        }
1090        $head = $(document.head);
1091      }
1092      return $head;
1093    }, cropTags:function(html) {
1094      return $cropTagsCont.html(html).text();
1095    }, injectJs:function(url) {
1096      var $script = $(document.createElement("script"));
1097      $script.attr("src", url);
1098      this.$head().append($script);
1099    }, isNode:function(el) {
1100      if (!hm.core.Object.isObject(el)) {
1101        return false;
1102      }
1103      return!!el.nodeType;
1104    }, getComputedStyle:function(el) {
1105      if (window.getComputedStyle) {
1106        this.getComputedStyle = function(el) {
1107          return window.getComputedStyle(el, null);
1108        };
1109      } else {
1110        this.getComputedStyle = function(el) {
1111          return el.currentStyle;
1112        };
1113      }
1114      return this.getComputedStyle(el);
1115    }, getScrollBarWidth:function() {
1116      var $outer = $(document.createElement("div")), $inner = $(document.createElement("div"));
1117      $outer.css({visibility:"hidden", width:"100px", position:"absolute", left:0, top:0, overflowY:"scroll"});
1118      $outer.append($inner);
1119      this.$body().append($outer);
1120      var result = $outer.width() - $inner.width();
1121      $outer.remove();
1122      this.getScrollBarWidth = function() {
1123        return result;
1124      };
1125      return result;
1126    }}});
1127    self = hm.core.DOM;
1128  })();
1129  (function() {
1130    var self;
1131    HM.define("hm.core.PopupManager", {statics:{popupElements:[], show:function(el, callback, context, hideOtherIfExists) {
1132      if (!hm.core.Object.isObject(el)) {
1133        throw new Error("el должен быть объектом");
1134      }
1135      if (!hm.core.DOM.isNode(el)) {
1136        var elDefaults = {hideOther:false, scope:null, onClose:null};
1137        el = hm.core.Object.extend(elDefaults, el);
1138        hideOtherIfExists = el.hideOther;
1139        context = el.scope;
1140        callback = el.onClose;
1141        el = el.el;
1142      }
1143      if (hideOtherIfExists) {
1144        this.hideAll();
1145      }
1146      var $el = $(el);
1147      $el.on("click", this._onElClick);
1148      this.popupElements.push({$el:$el, el:el, fn:typeof callback === "function" ? callback : HM.emptyFn, context:context || el});
1149      HM.$body().append($el);
1150      $el.css({zIndex:hm.core.ZIndexManager.getMaxZIndex() + 1, position:"absolute", visibility:"visible"});
1151    }, hide:function(el) {
1152      var popupElements = this.popupElements;
1153      for (var i = popupElements.length - 1;i >= 0;i--) {
1154        var popupElement = popupElements[i];
1155        if (popupElement.el !== el) {
1156          continue;
1157        }
1158        var $el = popupElement.$el;
1159        $el.off("click", this._onElClick);
1160        $el.detach();
1161        $el.css({zIndex:"auto"});
1162        popupElements.splice(i, 1);
1163        popupElement.fn.call(popupElement.context);
1164        return;
1165      }
1166      $(el).off("click", this._onElClick);
1167    }, hideAll:function() {
1168      var popupElements = this.popupElements;
1169      while (popupElements.length) {
1170        this.hide(popupElements[0].el);
1171      }
1172    }, _onElClick:function(e) {
1173      e.stopPropagation();
1174    }, _onBodyClick:function(e) {
1175      this.hideAll();
1176    }}});
1177    HM.$document().on("click", hm.core.PopupManager._onBodyClick.bind(hm.core.PopupManager));
1178    self = hm.core.PopupManager;
1179  })();
1180  (function() {
1181    var self;
1182    (function() {
1183      HM.define("hm.core.HardwareDetect", {__construct:function() {
1184        this._check();
1185        self.pluginDetect.INIT();
1186      }, adobeFlashPlayerVersion:function() {
1187        var playerVersion = HM.create("hm.core.env.Version", {version:[0, 0, 0]});
1188        if (navigator.plugins && navigator.mimeTypes.length) {
1189          var x = navigator.plugins["Shockwave Flash"];
1190          if (x && x.description) {
1191            playerVersion = HM.create("hm.core.env.Version", {version:x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split(".")});
1192          }
1193        } else {
1194          if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0) {
1195            var axo = 1;
1196            var counter = 3;
1197            while (axo) {
1198              try {
1199                counter++;
1200                axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + counter);
1201                playerVersion = new deconcept.PlayerVersion([counter, 0, 0]);
1202              } catch (e) {
1203                axo = null;
1204              }
1205            }
1206          } else {
1207            try {
1208              var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
1209            } catch (e) {
1210              try {
1211                var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
1212                playerVersion = HM.create("hm.core.env.Version", {version:[6, 0, 21]});
1213                axo.AllowScriptAccess = "always";
1214              } catch (e) {
1215                if (playerVersion.major == 6) {
1216                  return playerVersion;
1217                }
1218              }
1219              try {
1220                axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
1221              } catch (e) {
1222              }
1223            }
1224            if (axo != null) {
1225              playerVersion = HM.create("hm.core.env.Version", {version:axo.GetVariable("$version").split(" ")[1].split(",")});
1226            }
1227          }
1228        }
1229        return playerVersion;
1230      }, _cache:{}, _checkBrowser:function(name, version, msxmlVersion) {
1231        if (!this._cache.require.browser[name]) {
1232          return false;
1233        }
1234        if (name == "explorer") {
1235          return version.compare(this._cache.require.browser.explorer) >= 0 && msxmlVersion.compare(this._cache.require.msxml) >= 0;
1236        }
1237        return version.compare(this._cache.require.browser[name]) >= 0;
1238      }, _check:function() {
1239        var cache = this._cache;
1240        if (!cache.require) {
1241          cache.require = {browser:{explorer:HM.create("hm.core.env.Version", {version:[7, 0]}), opera:HM.create("hm.core.env.Version", {version:[9, 0, 0]}), safari:HM.create("hm.core.env.Version", {version:[2, 0, 0]}), firefox:HM.create("hm.core.env.Version", {version:[10, 0]}), camino:HM.create("hm.core.env.Version", {version:[1, 0, 0]}), seamonkey:HM.create("hm.core.env.Version", {version:[1, 0, 0]}), mozilla:HM.create("hm.core.env.Version", {version:[10, 0]}), chrome:HM.create("hm.core.env.Version", 
1242          {version:[10, 0, 0]})}, fp:HM.create("hm.core.env.Version", {version:[9, 0, 0]}), msxml:HM.create("hm.core.env.Version", {version:[3, 0, 0]})};
1243        }
1244        if (!cache.available) {
1245          cache.available = {fp:this.adobeFlashPlayerVersion(), msxml:hm.core.env.MsXml.detect()};
1246          cache.available.browser = hm.core.env.Browser.detect();
1247        }
1248        if (typeof cache.passed == "undefined") {
1249          cache.browserPassed = this._checkBrowser(cache.available.browser.name, cache.available.browser.version, cache.available.msxml);
1250          cache.passed = cache.browserPassed && cache.available.fp.compare(cache.require.fp) >= 0;
1251          cache.iePassed = cache.passed && hm.core.env.Browser.isIE();
1252        }
1253      }, ieFeedback:false, check:function() {
1254        this._check();
1255        this.ieFeedback = false;
1256        return this._cache.passed;
1257      }, courseCheck:function() {
1258        this._check();
1259        this.ieFeedback = true;
1260        return this._cache.iePassed;
1261      }, getSystemInfo:function() {
1262        var cache = this._cache;
1263        if (!cache.require.browser[cache.available.browser.name]) {
1264          return false;
1265        }
1266        var pluginDetect = hm.core.HardwareDetect.pluginDetect, plugins = pluginDetect.Plugins;
1267        plugins.java.getVersion();
1268        plugins.silverlight.getVersion();
1269        plugins.adobereader.getVersion();
1270        var result = {browser:{name:cache.available.browser.appName, value:cache.available.browser.version.toString() || ""}, flash:{value:cache.available.fp.toString() || ""}, os:{value:hm.core.env.OS.detect()}, screen:{value:screen.width + "x" + screen.height}
1270, cookie:{value:document.cookie ? 1 : 0}, js:{value:1}, java:{value:(plugins.java.version || "").replace(/,/g, ".") || ""}, silverlight:{value:(plugins.silverlight.version || "").replace(/,/g, ".") || ""}, acrobat_reader:{value:(plugins.adobereader.version || 
1271        "").replace(/,/g, ".") || ""}};
1272        if (hm.core.env.Browser.isIE()) {
1273          result.msxml = {value:cache.available.msxml.toString() || ""};
1274        }
1275        return result;
1276      }, getSystemInfoForTable:function(systemInfo) {
1277        if (!systemInfo) {
1278          return;
1279        }
1280        var result = [], cache = this._cache;
1281        if (!cache.require.browser[systemInfo.browser.name.toLowerCase()]) {
1282          return false;
1283        }
1284        var require = ["browser", "flash", "cookie", "js", "msxml"];
1285        var browserInfo = systemInfo.browser, browserName = browserInfo.name, browserCode = browserInfo.name.toLowerCase(), browserVersion = HM.create("hm.core.env.Version", {version:browserInfo.value.split(".")}), isIE = hm.core.env.Browser.isIE(), msxmlVersion, browserPassed;
1286        if (isIE && (systemInfo.msxml && systemInfo.msxml.value)) {
1287          msxmlVersion = HM.create("hm.core.env.Version", {version:systemInfo.msxml.value.split(".")});
1288        }
1289        browserPassed = this._checkBrowser(browserCode, browserVersion, msxmlVersion);
1290        result.push.apply(result, [{passed:browserPassed, version:browserVersion, require:cache.require.browser[browserCode].toString(), appName:browserName}, {passed:systemInfo.cookie.value, version:systemInfo.cookie.value ? HM._("включены") : HM._("выключены"), require:HM._("включены"), appName:HM._("Cookie")}, {passed:true, version:systemInfo.js.value ? HM._("включен") : 
1291        HM._("выключен"), require:HM._("включен"), appName:HM._("JavaScript")}, {version:systemInfo.os.value || "", appName:HM._("Операционная система")}, {version:systemInfo.screen.value || "", appName:HM._("Разрешение экрана")}]);
1292        var flashInfo = systemInfo.flash, flashVersion = HM.create("hm.core.env.Version", {version:flashInfo.value ? flashInfo.value.split(".") : [0, 0, 0]}), flashPassed = flashVersion.compare(cache.require.fp) >= 0, passed = browserPassed && flashPassed, iePassed = passed && isIE;
1293        result.push({version:flashPassed ? flashVersion.toString() : "", appName:"Adobe Flash Player", notRequired:true});
1294        result.push.apply(result, [{passed:systemInfo.acrobat_reader.value, version:systemInfo.acrobat_reader.value || "", appName:HM._("Adobe Acrobat Reader"), notRequired:true}, {passed:systemInfo.silverlight.value, version:systemInfo.silverlight.value || "", appName:HM._("Microsoft Silverlight"), notRequired:true}, {passed:systemInfo.java.value, version:systemInfo.java.value || "", appName:HM._("Java"), notRequired:true}]);
1295        if (isIE) {
1296          result.push({passed:msxmlVersion.compare(cache.require.msxml) >= 0, version:msxmlVersion.toString(), require:cache.require.msxml.toString(), appName:"MSXML"});
1297        }
1298        return{passed:this.ieFeedback && iePassed || !this.ieFeedback && passed, info:result, isIE:isIE};
1299      }, testTableCell:function(data) {
1300        var passed = data.passed || !data.hasOwnProperty("passed"), require = data.require ? data.require : "", needTestComment = data.hasOwnProperty("passed"), notRequired = data.notRequired;
1301        return['<tr class="' + (passed ? "passed" : "failed") + (notRequired ? " hm-infoblock-hwdetect-item-not-required" : "") + '">', '<td class="app-name">' + data.appName + (notRequired ? " *" : "") + "</td>", '<td class="app-version">' + (data.version == "0.0.0" ? '<span class="failed">' + HM._("не установлен") + "</span>" : data.version) + "</td>", '   <td class="app-require">' + require + "</td>", "</tr>"].join("");
1302      }, messageBox:function(message, level) {
1303        var $message = $("<div></div>"), $cont = $("<div></div>");
1304        $message.text(message || "");
1305        $.ui.errorbox.clear($message);
1306        $message.errorbox({level:level || "notice"});
1307        $cont.append($message);
1308        return $cont.html();
1309      }, _renderTable:function(result, isAdmin) {
1310        var feedback = "";
1311        if (!result) {
1312          return this.messageBox(HM._(isAdmin ? "В последней активной сессии пользователя нет информации по его системе" : "Ваш браузер не поддерживается"), 
1313          "error");
1314        }
1315        feedback = '<div class="EUDetectionCheck">';
1316        if (!isAdmin) {
1317          if (result.passed) {
1318            feedback += this.messageBox(HM._("Ваша система содержит все необходимые компоненты"), "success");
1319          } else {
1320            feedback += this.messageBox(HM._("Ваша система не содержит всех необходимых компонент для корректного отображения содержимого"), 
1321            "error");
1322          }
1323        }
1324        feedback += '<br /><table cellpadding="3" cellspacing="0">';
1325        feedback += '<tr><th class="app-name">' + HM._("Параметр") + '</th><th class="app-version">' + HM._("Фактическое значение (версия)") + '</th><th class="app-require">' + HM._("Требуемое значение (версия)") + "</th></tr>";
1326        var resultInfo = result.info;
1327        for (var i = 0;i < resultInfo.length;i++) {
1328          feedback += this.testTableCell(resultInfo[i]);
1329        }
1330        feedback += "</table>";
1331        feedback += '<br /><div class="comment"><b>' + HM._("Примечание") + ":</b> " + HM._('Компоненты, отмеченные "*", не явÐ
1331»ÑÑŽÑ‚ся обязательными для корректной работы веб-интерфейса системы, но могут понадобиться при отображении учебных модулей сторонних производителей.') + 
1332        "</div>";
1333        feedback += "</div>";
1334        return feedback;
1335      }, renderTableBySystemInfo:function(systemInfo, isAdmin) {
1336        return this._renderTable(this.getSystemInfoForTable(systemInfo), isAdmin);
1337      }, checkWithFeedback:function(passed) {
1338        return this.renderTableBySystemInfo(this.getSystemInfo());
1339      }});
1340      var instance = null;
1341      hm.core.HardwareDetect.get = function() {
1342        if (!instance) {
1343          instance = HM.create("hm.core.HardwareDetect");
1344        }
1345        return instance;
1346      };
1347    })();
1348    (function() {
1349      hm.core.HardwareDetect.pluginDetect = {version:"0.8.1", name:"PluginDetect", openTag:"<", isDefined:function(b) {
1350        return typeof b != "undefined";
1351      }, isArray:function(b) {
1352        return/array/i.test(Object.prototype.toString.call(b));
1353      }, isFunc:function(b) {
1354        return typeof b == "function";
1355      }, isString:function(b) {
1356        return typeof b == "string";
1357      }, isNum:function(b) {
1358        return typeof b == "number";
1359      }, isStrNum:function(b) {
1360        return typeof b == "string" && /\d/.test(b);
1361      }, getNumRegx:/[\d][\d\.\_,\-]*/, splitNumRegx:/[\.\_,\-]/g, getNum:function(b, c) {
1362        var d = this, a = d.isStrNum(b) ? (d.isDefined(c) ? new RegExp(c) : d.getNumRegx).exec(b) : null;
1363        return a ? a[0] : null;
1364      }, compareNums:function(h, f, d) {
1365        var e = this, c, b, a, g = parseInt;
1366        if (e.isStrNum(h) && e.isStrNum(f)) {
1367          if (e.isDefined(d) && d.compareNums) {
1368            return d.compareNums(h, f);
1369          }
1370          c = h.split(e.splitNumRegx);
1371          b = f.split(e.splitNumRegx);
1372          for (a = 0;a < Math.min(c.length, b.length);a++) {
1373            if (g(c[a], 10) > g(b[a], 10)) {
1374              return 1;
1375            }
1376            if (g(c[a], 10) < g(b[a], 10)) {
1377              return-1;
1378            }
1379          }
1380        }
1381        return 0;
1382      }, formatNum:function(b, c) {
1383        var d = this, a, e;
1384        if (!d.isStrNum(b)) {
1385          return null;
1386        }
1387        if (!d.isNum(c)) {
1388          c = 4;
1389        }
1390        c--;
1391        e = b.replace(/\s/g, "").split(d.splitNumRegx).concat(["0", "0", "0", "0"]);
1392        for (a = 0;a < 4;a++) {
1393          if (/^(0+)(.+)$/.test(e[a])) {
1394            e[a] = RegExp.$2;
1395          }
1396          if (a > c || !/\d/.test(e[a])) {
1397            e[a] = "0";
1398          }
1399        }
1400        return e.slice(0, 4).join(",");
1401      }, getPROP:function(d, b, a) {
1402        var c;
1403        try {
1404          if (d) {
1405            a = d[b];
1406          }
1407        } catch (c) {
1408        }
1409        return a;
1410      }, findNavPlugin:function(l, e, c) {
1411        var j = this, h = new RegExp(l, "i"), d = !j.isDefined(e) || e ? /\d/ : 0, k = c ? new RegExp(c, "i") : 0, a = navigator.plugins, g = "", f, b, m;
1412        for (f = 0;f < a.length;f++) {
1413          m = a[f].description || g;
1414          b = a[f].name || g;
1415          if (h.test(m) && (!d || d.test(RegExp.leftContext + RegExp.rightContext)) || h.test(b) && (!d || d.test(RegExp.leftContext + RegExp.rightContext))) {
1416            if (!k || !(k.test(m) || k.test(b))) {
1417              return a[f];
1418            }
1419          }
1420        }
1421        return null;
1422      }, getMimeEnabledPlugin:function(k, m, c) {
1423        var e = this, f, b = new RegExp(m, "i"), h = "", g = c ? new RegExp(c, "i") : 0, a, l, d, j = e.isString(k) ? [k] : k;
1424        for (d = 0;d < j.length;d++) {
1425          if ((f = e.hasMimeType(j[d])) && (f = f.enabledPlugin)) {
1426            l = f.description || h;
1427            a = f.name || h;
1428            if (b.test(l) || b.test(a)) {
1429              if (!g || !(g.test(l) || g.test(a))) {
1430                return f;
1431              }
1432            }
1433          }
1434        }
1435        return 0;
1436      }, getVersionDelimiter:",", findPlugin:function(d) {
1437        var c = this, b, d, a = {status:-3, plugin:0};
1438        if (!c.isString(d)) {
1439          return a;
1440        }
1441        if (d.length == 1) {
1442          c.getVersionDelimiter = d;
1443          return a;
1444        }
1445        d = d.toLowerCase().replace(/\s/g, "");
1446        b = c.Plugins[d];
1447        if (!b || !b.getVersion) {
1448          return a;
1449        }
1450        a.plugin = b;
1451        a.status = 1;
1452        return a;
1453      }, getPluginFileVersion:function(f, b) {
1454        var h = this, e, d, g, a, c = -1;
1455        if (h.OS >
1455 2 || (!f || (!f.version || !(e = h.getNum(f.version))))) {
1456          return b;
1457        }
1458        if (!b) {
1459          return e;
1460        }
1461        e = h.formatNum(e);
1462        b = h.formatNum(b);
1463        d = b.split(h.splitNumRegx);
1464        g = e.split(h.splitNumRegx);
1465        for (a = 0;a < d.length;a++) {
1466          if (c > -1 && (a > c && d[a] != "0")) {
1467            return b;
1468          }
1469          if (g[a] != d[a]) {
1470            if (c == -1) {
1471              c = a;
1472            }
1473            if (d[a] != "0") {
1474              return b;
1475            }
1476          }
1477        }
1478        return e;
1479      }, AXO:window.ActiveXObject, getAXO:function(a) {
1480        var d = null, c, b = this;
1481        try {
1482          d = new b.AXO(a);
1483        } catch (c) {
1484        }
1485        return d;
1486      }, INIT:function() {
1487        this.init.library(this);
1488      }, init:{$:1, hasRun:0, objProperties:function(d, e, b) {
1489        var a, c = {};
1490        if (e && b) {
1491          if (e[b[0]] === 1 && (!d.isArray(e) && (!d.isFunc(e) && (!d.isString(e) && !d.isNum(e))))) {
1492            for (a = 0;a < b.length;a = a + 2) {
1493              e[b[a]] = b[a + 1];
1494              c[b[a]] = 1;
1495            }
1496          }
1497          for (a in e) {
1498            if (!c[a] && (e[a] && e[a][b[0]] === 1)) {
1499              this.objProperties(d, e[a], b);
1500            }
1501          }
1502        }
1503      }, publicMethods:function(c, f) {
1504        var g = this, b = g.$, a, d;
1505        if (c && f) {
1506          for (a in c) {
1507            try {
1508              if (b.isFunc(c[a])) {
1509                f[a] = c[a](f);
1510              }
1511            } catch (d) {
1512            }
1513          }
1514        }
1515      }, plugin:function(a, c) {
1516        var d = this, b = d.$;
1517        if (a) {
1518          d.objProperties(b, a, ["$", b, "$$", a]);
1519          if (!b.isDefined(a.getVersionDone)) {
1520            a.installed = null;
1521            a.version = null;
1522            a.version0 = null;
1523            a.getVersionDone = null;
1524            a.pluginName = c;
1525          }
1526        }
1527      }, detectIE:function() {
1528        var init = this, $ = init.$, doc = document, e, x, userAgent = navigator.userAgent || "", progid, progid1, progid2;
1529        $.isIE = eval("/*@cc_on!@*/!1");
1530        $.verIE = $.isIE ? /MSIE\s*(\d+\.?\d*)/i.test(userAgent) ? parseFloat(RegExp.$1, 10) : 7 : null;
1531        $.verIEfull = null;
1532        $.docModeIE = null;
1533        if ($.isIE) {
1534          var verFullFloat, obj = doc.createElement("div");
1535          try {
1536            obj.style.behavior = "url(#default#clientcaps)";
1537            $.verIEfull = obj.getComponentVersion("{89820200-ECBD-11CF-8B85-00AA005B4383}", "componentid").replace(/,/g, ".");
1538          } catch (e) {
1539          }
1540          verFullFloat = parseFloat($.verIEfull || "0", 10);
1541          $.docModeIE = doc.documentMode || ((/back/i.test(doc.compatMode || "") ? 5 : verFullFloat) || $.verIE);
1542          $.verIE = verFullFloat || $.docModeIE;
1543        }
1544        $.ActiveXEnabled = !1;
1545        $.ActiveXFilteringEnabled = !1;
1546        if ($.isIE) {
1547          try {
1548            $.ActiveXFilteringEnabled = window.external.msActiveXFilteringEnabled();
1549          } catch (e) {
1550          }
1551          progid1 = ["Msxml2.XMLHTTP", "Msxml2.DOMDocument", "Microsoft.XMLDOM", "TDCCtl.TDCCtl", "Shell.UIHelper", "HtmlDlgSafeHelper.HtmlDlgSafeHelper", "Scripting.Dictionary"];
1552          progid2 = ["WMPlayer.OCX", "ShockwaveFlash.ShockwaveFlash", "AgControl.AgControl"];
1553          progid = progid1.concat(progid2);
1554          for (x = 0;x < progid.length;x++) {
1555            if ($.getAXO(progid[x])) {
1556              $.ActiveXEnabled = !0;
1557              if (!$.dbug) {
1558                break;
1559              }
1560            }
1561          }
1562          if ($.ActiveXEnabled && $.ActiveXFilteringEnabled) {
1563            for (x = 0;x < progid2.length;x++) {
1564              if ($.getAXO(progid2[x])) {
1565                $.ActiveXFilteringEnabled = !1;
1566                break;
1567              }
1568            }
1569          }
1570        }
1571      }, detectNonIE:function() {
1572        var e = this, c = this.$, d = navigator, b = c.isIE ? "" : d.userAgent || "", f = d.vendor || "", a = d.product || "";
1573        c.isGecko = /Gecko/i.test(a) && /Gecko\s*\/\s*\d/i.test(b);
1574        c.verGecko = c.isGecko ? c.formatNum(/rv\s*\:\s*([\.\,\d]+)/i.test(b) ? RegExp.$1 : "0.9") : null;
1575        c.isChrome = /(Chrome|CriOS)\s*\/\s*(\d[\d\.]*)/i.test(b);
1576        c.verChrome = c.isChrome ? c.formatNum(RegExp.$2) : null;
1577        c.isSafari = !c.isChrome && ((/Apple/i.test(f) || !f) && /Safari\s*\/\s*(\d[\d\.]*)/i.test(b));
1578        c.verSafari = c.isSafari && /Version\s*\/\s*(\d[\d\.]*)/i.test(b) ? c.formatNum(RegExp.$1) : null;
1579        c.isOpera = /Opera\s*[\/]?\s*(\d+\.?\d*)/i.test(b);
1580        c.verOpera = c.isOpera && (/Version\s*\/\s*(\d+\.?\d*)/i.test(b) || 1) ? parseFloat(RegExp.$1, 10) : null;
1581      }, detectPlatform:function() {
1582        var e = this, d = e.$, b, a = navigator.platform || "";
1583        d.OS = 100;
1584        if (a) {
1585          var c = ["Win", 1, "Mac", 2, "Linux", 3, "FreeBSD", 4, "iPhone", 21.1, "iPod", 21.2, "iPad", 21.3, "Win.*CE", 22.1, "Win.*Mobile", 22.2, "Pocket\\s*PC", 22.3, "", 100];
1586          for (b = c.length - 2;b >= 0;b = b - 2) {
1587            if (c[b] && (new RegExp(c[b], "i")).test(a)) {
1588              d.OS = c[b + 1];
1589              break;
1590            }
1591          }
1592        }
1593      }, library:function(c) {
1594        var e = this, d = document, b, a;
1595        c.init.objProperties(c, c, ["$", c]);
1596        for (a in c.Plugins) {
1597          c.init.plugin(c.Plugins[a], a);
1598        }
1599        e.publicMethods(c.PUBLIC, c);
1600        c.win.init();
1601        c.head = d.getElementsByTagName("head")[0] || (d.getElementsByTagName("body")[0] || (d.body || null));
1602        e.detectPlatform();
1603        e.detectIE();
1604        e.detectNonIE();
1605        c.init.hasRun = 1;
1606      }}, handler:function(c, b, a) {
1607        return function() {
1608          c(b, a);
1609        };
1610      }, fPush:function(b, a) {
1611        var c = this;
1612        if (c.isArray(a) && (c.isFunc(b) || c.isArray(b) && (b.length > 0 && c.isFunc(b[0])))) {
1613          a.push(b);
1614        }
1615      }, callArray:function(b) {
1616        var c = this, a, d;
1617        if (c.isArray(b)) {
1618          d = [].concat(b);
1619          for (a = 0;a < d.length;a++) {
1620            c.call(d[a]);
1621            b.splice(0, 1);
1622          }
1623        }
1624      }, call:function(c) {
1625        var b = this, a = b.isArray(c) ? c.length : -1;
1626        if (a > 0 && b.isFunc(c[0])) {
1627          c[0](b, a > 1 ? c[1] : 0, a > 2 ? c[2] : 0, a > 3 ? c[3] : 0);
1628        } else {
1629          if (b.isFunc(c)) {
1630            c(b);
1631          }
1632        }
1633      }, PUBLIC:{isMinVersion:function(a) {
1634        return function(h, g, d, c) {
1635          var e = a.findPlugin(h), f, b = -1;
1636          if (e.status < 0) {
1637            return e.status;
1638          }
1639          f = e.plugin;
1640          g = a.formatNum(a.isNum(g) ? g.toString() : a.isStrNum(g) ? a.getNum(g) : "0");
1641          if (f.getVersionDone != 1) {
1642            f.getVersion(g, d, c);
1643            if (f.getVersionDone === null) {
1644              f.getVersionDone = 1;
1645            }
1646          }
1647          if (f.installed !== null) {
1648            b = f.installed <= 0.5 ? f.installed : f.installed == 0.7 ? 1 : f.version === null ? 0 : a.compareNums(f.version, g, f) >= 0 ? 1 : -0.1;
1649          }
1650          return b;
1651        };
1652      }, getVersion:function(a) {
1653        return function(g, d, c) {
1654          var e = a.findPlugin(g), f, b;
1655          if (e.status < 0) {
1656            return null;
1657          }
1658          f = e.plugin;
1659          if (f.getVersionDone != 1) {
1660            f.getVersion(null, d, c);
1661            if (f.getVersionDone === null) {
1662              f.getVersionDone = 1;
1663            }
1664          }
1665          b = f.version || f.version0;
1666          b = b ? b.replace(a.splitNumRegx, a.getVersionDelimiter) : b;
1667          return b;
1668        };
1669      }, getInfo:function(a) {
1670        return function(g, d, c) {
1671          var b = {}, e = a.findPlugin(g), f;
1672          if (e.status < 0) {
1673            return b;
1674          }
1675          f = e.plugin;
1676          if (f.getInfo) {
1677            if (f.getVersionDone === null) {
1678              a.getVersion ? a.getVersion(g, d, c) : a.isMinVersion(g, "0", d, c);
1679            }
1680            b = f.getInfo();
1681          }
1682          return b;
1683        };
1684      }, onDetectionDone:function(a) {
1685        return function(h, g, c, b) {
1686          var d = a.findPlugin(h), j, e;
1687          if (d.status == -3) {
1688            return-1;
1689          }
1690          e = d.plugin;
1691          if (!a.isArray(e.funcs)) {
1692            e.funcs = [];
1693          }
1694          if (e.getVersionDone != 1) {
1695            j = a.getVersion ? a.getVersion(h, c, b) : a.isMinVersion(h, "0", c, b);
1696          }
1697          if (e.installed != -0.5 && e.installed != 0.5) {
1698            a.call(g);
1699            return 1;
1700          }
1701          if (e.NOTF) {
1702            a.fPush(g, e.funcs);
1703            return 0;
1704          }
1705          return 1;
1706        };
1707      }, onWindowLoaded:function(a) {
1708        return function(b) {
1709          if (a.win.loaded) {
1710            a.call(b);
1711          } else {
1712            a.fPush(b, a.win.funcs);
1713          }
1714        };
1715      }, hasMimeType:function(a) {
1716        return function(c) {
1717          if (!a.isIE && (c && (navigator && navigator.mimeTypes))) {
1718            var f, e, b, d = a.isArray(c) ? c : a.isString(c) ? [c] : [];
1719            for (b = 0;b < d.length;b++) {
1720              if (a.isString(d[b]) && /[^\s]/.test(d[b])) {
1721                f = navigator.mimeTypes[d[b]];
1722                e = f ? f.enabledPlugin : 0;
1723                if (e && (e.name || e.description)) {
1724                  return f;
1725                }
1726              }
1727            }
1728          }
1729          return null;
1730        };
1731      }, z:0}, codebase:{$:1, isDisabled:function() {
1732        var a = this, b = a.$;
1733        return b.ActiveXEnabled && (b.isIE && b.verIE >= 7) ? 0 : 1;
1734      }, checkGarbage:function(d) {
1735        var b = this, c = b.$, a;
1736        if (c.isIE && (d && c.getPROP(d.firstChild, "object"))) {
1737          a = c.getPROP(d.firstChild, "readyState");
1738          if (c.isNum(a) && a != 4) {
1739            b.garbage = 1;
1740            return 1;
1741          }
1742        }
1743        return 0;
1744      }, emptyGarbage:function() {
1745        var a = this, b = a.$, c;
1746        if (b.isIE && a.garbage) {
1747          try {
1748            window.CollectGarbage();
1749          } catch (c) {
1750          }
1751          a.garbage = 0;
1752        }
1753      }, init:function(d) {
1754        if (!d.init) {
1755          var b = this, c = b.$, a;
1756          d.init = 1;
1757          d.min = 0;
1758          d.max = 0;
1759          d.hasRun = 0;
1760          d.version = null;
1761          d.L = 0;
1762          d.altHTML = "";
1763          d.span = document.createElement("span");
1764          d.tagA = '<object width="1" height="1" style="display:none;
1764" codebase="#version=';
1765          d.tagB = '" ' + (/clsid\s*:/i.test(d.$$.classID) ? 'classid="' : 'type="') + d.$$.classID + '">' + d.ParamTags + d.altHTML + c.openTag + "/object>";
1766          for (a = 0;a < d.Lower.length;a++) {
1767            d.Lower[a] = c.formatNum(d.Lower[a]);
1768            d.Upper[a] = c.formatNum(d.Upper[a]);
1769          }
1770        }
1771      }, isActiveXObject:function(i, b) {
1772        var f = this, g = f.$, a = 0, h, d = i.$$, c = i.span;
1773        if (i.min && g.compareNums(b, i.min) <= 0) {
1774          return 1;
1775        }
1776        if (i.max && g.compareNums(b, i.max) >= 0) {
1777          return 0;
1778        }
1779        if (d.BIfuncs && d.BIfuncs.length) {
1780          g.callArray(d.BIfuncs);
1781        }
1782        c.innerHTML = i.tagA + b + i.tagB;
1783        if (g.getPROP(c.firstChild, "object")) {
1784          a = 1;
1785        }
1786        f.checkGarbage(c);
1787        c.innerHTML = "";
1788        if (a) {
1789          i.min = b;
1790        } else {
1791          i.max = b;
1792        }
1793        return a;
1794      }, convert_:function(f, a, b, e) {
1795        var d = f.convert[a], c = f.$;
1796        return d ? c.isFunc(d) ? c.formatNum(d(b.split(c.splitNumRegx), e).join(",")) : b : d;
1797      }, convert:function(h, c, g) {
1798        var e = this, f = h.$, b, a, d;
1799        c = f.formatNum(c);
1800        a = {v:c, x:-1};
1801        if (c) {
1802          for (b = 0;b < h.Lower.length;b++) {
1803            d = e.convert_(h, b, h.Lower[b]);
1804            if (d && (f.compareNums(c, g ? d : h.Lower[b]) >= 0 && (!b || f.compareNums(c, g ? e.convert_(h, b, h.Upper[b]) : h.Upper[b]) < 0))) {
1805              a.v = e.convert_(h, b, c, g);
1806              a.x = b;
1807              break;
1808            }
1809          }
1810        }
1811        return a;
1812      }, isMin:function(g, f) {
1813        var d = this, e = g.$, c, b, a = 0;
1814        d.init(g);
1815        if (!e.isStrNum(f) || d.isDisabled()) {
1816          return a;
1817        }
1818        if (!g.L) {
1819          g.L = {};
1820          for (c = 0;c < g.Lower.length;c++) {
1821            if (d.isActiveXObject(g, g.Lower[c])) {
1822              g.L = d.convert(g, g.Lower[c]);
1823              break;
1824            }
1825          }
1826        }
1827        if (g.L.v) {
1828          b = d.convert(g, f, 1);
1829          if (b.x >= 0) {
1830            a = (g.L.x == b.x ? d.isActiveXObject(g, b.v) : e.compareNums(f, g.L.v) <= 0) ? 1 : -1;
1831          }
1832        }
1833        return a;
1834      }, search:function(g) {
1835        var k = this, h = k.$, i = g.$$, b = 0, c;
1836        k.init(g);
1837        c = g.hasRun || k.isDisabled() ? 1 : 0;
1838        g.hasRun = 1;
1839        if (c) {
1840          return g.version;
1841        }
1842        var o, n, m, j = function(q, t) {
1843          var r = [].concat(f), s;
1844          r[q] = t;
1845          s = k.isActiveXObject(g, r.join(","));
1846          if (s) {
1847            b = 1;
1848            f[q] = t;
1849          } else {
1850            p[q] = t;
1851          }
1852          return s;
1853        }, d = g.DIGITMAX, e, a, l = 9999999, f = [0, 0, 0, 0], p = [0, 0, 0, 0];
1854        for (o = 0;o < p.length;o++) {
1855          f[o] = g.DIGITMIN[o] || 0;
1856          e = f.join(",");
1857          a = f.slice(0, o).concat([l, l, l, l]).slice(0, f.length).join(",");
1858          for (m = 0;m < d.length;m++) {
1859            if (h.isArray(d[m])) {
1860              d[m].push(0);
1861              if (d[m][o] > p[o] && (h.compareNums(a, g.Lower[m]) >= 0 && h.compareNums(e, g.Upper[m]) < 0)) {
1862                p[o] = d[m][o];
1863              }
1864            }
1865          }
1866          for (n = 0;n < 20;n++) {
1867            if (p[o] - f[o] <= 16) {
1868              for (m = p[o];m >= f[o] + (o ? 1 : 0);m--) {
1869                if (j(o, m)) {
1870                  break;
1871                }
1872              }
1873              break;
1874            }
1875            j(o, Math.round((p[o] + f[o]) / 2));
1876          }
1877          if (!b) {
1878            break;
1879          }
1880          p[o] = f[o];
1881        }
1882        if (b) {
1883          g.version = k.convert(g, f.join(",")).v;
1884        }
1885        return g.version;
1886      }}, win:{$:1, loaded:false, hasRun:0, init:function() {
1887        var b = this, a = b.$;
1888        if (!b.hasRun) {
1889          b.hasRun = 1;
1890          b.addEvent("load", a.handler(b.runFuncs, a));
1891          b.addEvent("unload", a.handler(b.cleanup, a));
1892        }
1893      }, addEvent:function(c, b) {
1894        var e = this, d = e.$, a = window;
1895        if (d.isFunc(b)) {
1896          if (a.addEventListener) {
1897            a.addEventListener(c, b, false);
1898          } else {
1899            if (a.attachEvent) {
1900              a.attachEvent("on" + c, b);
1901            } else {
1902              a["on" + c] = e.concatFn(b, a["on" + c]);
1903            }
1904          }
1905        }
1906      }, concatFn:function(d, c) {
1907        return function() {
1908          d();
1909          if (typeof c == "function") {
1910            c();
1911          }
1912        };
1913      }, funcs0:[], funcs:[], cleanup:function(b) {
1914        for (var a in b) {
1915          b[a] = 0;
1916        }
1917        b = 0;
1918      }, runFuncs:function(a) {
1919        a.win.loaded = true;
1920        a.callArray(a.win.funcs0);
1921        a.callArray(a.win.funcs);
1922        if (a.DOM) {
1923          a.DOM.onDoneEmptyDiv();
1924        }
1925      }, z:0}, DOM:{$:1, isEnabled:{$:1, objectTag:function() {
1926        var a = this.$;
1927        return a.isIE ? a.ActiveXEnabled : 1;
1928      }, objectProperty:function() {
1929        var a = this.$;
1930        return a.isIE && a.verIE >= 7 ? 1 : 0;
1931      }}, div:null, divID:"plugindetect", divWidth:50, pluginSize:1, altHTML:"&nbsp;&nbsp;&nbsp;&nbsp;", emptyNode:function(c) {
1932        var b = this, d = b.$, a, f;
1933        if (c && c.childNodes) {
1934          for (a = c.childNodes.length - 1;a >= 0;a--) {
1935            if (d.isIE) {
1936              b.setStyle(c.childNodes[a], ["display", "none"]);
1937            }
1938            c.removeChild(c.childNodes[a]);
1939          }
1940        }
1941      }, LASTfuncs:[], onDoneEmptyDiv:function() {
1942        var f = this, g = f.$, b, d, c, a, h;
1943        if (!g.win.loaded || (g.win.funcs0.length || g.win.funcs.length)) {
1944          return;
1945        }
1946        for (b in g.Plugins) {
1947          d = g.Plugins[b];
1948          if (d) {
1949            if (d.OTF == 3 || d.funcs && d.funcs.length) {
1950              return;
1951            }
1952          }
1953        }
1954        g.callArray(f.LASTfuncs);
1955        if (f.div && f.div.childNodes) {
1956          for (b = f.div.childNodes.length - 1;b >= 0;b--) {
1957            c = f.div.childNodes[b];
1958            f.emptyNode(c);
1959          }
1960          try {
1961            f.div.innerHTML = "";
1962          } catch (h) {
1963          }
1964        }
1965        if (!f.div) {
1966          a = document.getElementById(f.divID);
1967          if (a) {
1968            f.div = a;
1969          }
1970        }
1971        if (f.div && f.div.parentNode) {
1972          try {
1973            f.div.parentNode.removeChild(f.div);
1974          } catch (h) {
1975          }
1976          f.div = null;
1977        }
1978      }, width:function() {
1979        var g = this, e = g.DOM, f = e.$, d = g.span, b, c, a = -1;
1980        b = d && f.isNum(d.scrollWidth) ? d.scrollWidth : a;
1981        c = d && f.isNum(d.offsetWidth) ? d.offsetWidth : a;
1982        return c > 0 ? c : b > 0 ? b : Math.max(c, b);
1983      }, obj:function(b) {
1984        var g = this, d = g.DOM, c = g.span, f, a = c && c.firstChild ? c.firstChild : null;
1985        try {
1986          if (a && b) {
1987            d.div.focus();
1988          }
1989        } catch (f) {
1990        }
1991        return a;
1992      }, rs:function() {
1993        var b = this, a = b.DOM.$;
1994        return a.isIE ? a.getPROP(b.obj(), "readyState") : b.undefined;
1995      }, getTagStatus:function(a, m, r, p, d, g) {
1996        var f = /clsid\s*\:/i, o = r && f.test(r.outerHTML || "") ? r : p && f.test(p.outerHTML || "") ? p : 0, h = r && !f.test(r.outerHTML || "") ? r : p && !f.test(p.outerHTML || "") ? p : 0, l = a && f.test(a.outerHTML || "") ? o : h;
1997        if (!a || (!a.span || (!m || (!m.span || (!l || !l.span))))) {
1998          return-2;
1999        }
2000        var s = this, c = s.$, q, k = a.width(), j = l.width(), n = m.width(), b = a.readyState(), t = l.readyState();
2001        if (k < 0 || (j < 0 || n <= s.pluginSize)) {
2002          return 0;
2003        }
2004        if (s.isEnabled.objectProperty()) {
2005          var i = c.getPROP(a.obj(), "object");
2006          if (i) {
2007            return 1.5;
2008          }
2009          if (g && (!a.pi && (c.isDefined(i) && (c.isIE && (a.tagName == l.tagName && a.time <= l.time))))) {
2010            if (k === j && (b === 0 && t !== 0)) {
2011              a.pi = 1;
2012            }
2013          }
2014        }
2015        if (j < n) {
2016          return a.pi ? -0.1 : 0;
2017        }
2018        if (k >= n) {
2019          if (!a.winLoaded && c.win.loaded) {
2020            return a.pi ? -0.5 : -1;
2021          }
2022          if (c.isNum(d)) {
2023            if (!c.isNum(a.count2)) {
2024              a.count2 = d;
2025            }
2026            if (d - a.count2 > 0) {
2027              return a.pi ? -0.5 : -1;
2028            }
2029          }
2030        }
2031        try {
2032          if (k == s.pluginSize && (!c.isIE || b === 4)) {
2033            if (!a.winLoaded && c.win.loaded) {
2034              return 1;
2035            }
2036            if (a.winLoaded && c.isNum(d)) {
2037              if (!c.isNum(a.count)) {
2038                a.count = d;
2039              }
2040              if (d - a.count >= 5) {
2041                return 1;
2042              }
2043            }
2044          }
2045        } catch (q) {
2046        }
2047        return a.pi ? -0.1 : 0;
2048      }, setStyle:function(b, h) {
2049        var c = this, d = c.$, g = b.style, a, f;
2050        if (g && h) {
2051          for (a = 0;a < h.length;a = a + 2) {
2052            try {
2053              g[h[a]] = h[a + 1];
2054            } catch (f) {
2055            }
2056          }
2057        }
2058      }, insertDivInBody:function(a, h) {
2059        var j = this, d = j.$, g, b = "pd33993399", c = null, i = h ? window.top.document : window.document, f = i.getElementsByTagName("body")[0] || i.body;
2060        if (!f) {
2061          try {
2062            i.write('<div id="' + b + '">.' + d.openTag + "/div>");
2063            c = i.getElementById(b);
2064          } catch (g) {
2065          }
2066        }
2067        f = i.getElementsByTagName("body")[0] || i.body;
2068        if (f) {
2069          f.insertBefore(a, f.firstChild);
2070          if (c) {
2071            f.removeChild(c);
2072          }
2073        }
2074      }, insert:function(f, b, g, a, l, k) {
2075        var q = this, i = q.$, m, n = document, s, r, p = n.createElement("span"), o, h, c = ["outlineStyle", "none", "borderStyle", "none", "padding", "0px", "margin", "0px", "visibility", "visible"], j = "outline-style:none;border-style:none;padding:0px;margin:0px;visibility:" + (k ? "hidden;" : "visible;") + "display:inline;";
2076        if (!i.isDefined(a)) {
2077          a = "";
2078        }
2079        if (i.isString(f) && /[^\s]/.test(f)) {
2080          f = f.toLowerCase().replace(/\s/g, "");
2081          s = i.openTag + f + ' width="' + q.pluginSize + '" height="' + q.pluginSize + '" ';
2082          s += 'style="' + j + '" ';
2083          for (o = 0;o < b.length;o = o + 2) {
2084            if (/[^\s]/.test(b[o + 1])) {
2085              s += b[o] + '="' + b[o + 1] + '" ';
2086            }
2087          }
2088          s += ">";
2089          for (o = 0;o < g.length;o = o + 2) {
2090            if (/[^\s]/.test(g[o + 1])) {
2091              s += i.openTag + 'param name="' + g[o] + '" value="' + g[o + 1] + '" />';
2092            }
2093          }
2094          s += a + i.openTag + "/" + f + ">";
2095        } else {
2096          f = "";
2097          s = a;
2098        }
2099        if (!q.div) {
2100          h = n.getElementById(q.divID);
2101          if (h) {
2102            q.div = h;
2103          } else {
2104            q.div = n.createElement("div");
2105            q.div.id = q.divID;
2106          }
2107          q.setStyle(q.div, c.concat(["width", q.divWidth + "px", "height", q.pluginSize + 3 + "px", "fontSize", q.pluginSize + 3 + "px", "lineHeight", q.pluginSize + 3 + "px", "verticalAlign", "baseline", "display", "block"]));
2108          if (!h) {
2109            q.setStyle(q.div, ["position", "absolute", "right", "0px", "top", "0px"]);
2110            q.insertDivInBody(q.div);
2111          }
2112        }
2113        r = {span:null, winLoaded:i.win.loaded, tagName:f, outerHTML:s, DOM:q, time:(new Date).getTime(), width:q.width, obj:q.obj, readyState:q.rs};
2114        if (q.div && q.div.parentNode) {
2115          q.setStyle(p, c.concat(["fontSize", q.pluginSize + 3 + "px", "lineHeight", q.pluginSize + 3 + "px", "verticalAlign", "baseline", "display", "inline"]));
2116          q.div.appendChild(p);
2117          try {
2118            p.innerHTML = s;
2119          } catch (m) {
2120          }
2121          r.span = p;
2122          r.winLoaded = i.win.loaded;
2123        }
2124        return r;
2125      }}, file:{$:1, any:"fileStorageAny999", valid:"fileStorageValid999", save:function(d, f, c) {
2126        var b = this, e = b.$, a;
2127        if (d && e.isDefined(c)) {
2128          if (!d[b.any]) {
2129            d[b.any] = [];
2130          }
2131          if (!d[b.valid]) {
2132            d[b.valid] = [];
2133          }
2134          d[b.any].push(c);
2135          a = b.split(f, c);
2136          if (a) {
2137            d[b.valid].push(a);
2138          }
2139        }
2140      }, getValidLength:function(a) {
2141        return a && a[this.valid] ? a[this.valid].length : 0;
2142      }, getAnyLength:function(a) {
2143        return a && a[this.any] ? a[this.any].length : 0;
2144      }, getValid:function(c, a) {
2145        var b = this;
2146        return c && c[b.valid] ? b.get(c[b.valid], a) : null;
2147      }, getAny:function(c, a) {
2148        var b = this;
2149        return c && c[b.any] ? b.get(c[b.any], a) : null;
2150      }, get:function(d, a) {
2151        var c = d.length - 1, b = this.$.isNum(a) ? a : c;
2152        return b < 0 || b > c ? null : d[b];
2153      }, split:function(g, c) {
2154        var b = this, e = b.$, f = null, a, d;
2155        g = g ? g.replace(".", "\\.") : "";
2156        d = new RegExp("^(.*[^\\/])(" + g + "\\s*)$");
2157        if (e.isString(c) && d.test(c)) {
2158          a = RegExp.$1.split("/");
2159          f = {name:a[a.length - 1], ext:RegExp.$2, full:c};
2160          a[a.length - 1] = "";
2161          f.path = a.join("/");
2162        }
2163        return f;
2164      }, z:0}, Plugins:{quicktime:{$:1, mimeType:["video/quicktime", "application/x-quicktimeplayer", "image/x-macpaint", "image/x-quicktime"], progID:"QuickTimeCheckObject.QuickTimeCheck.1", progID0:"QuickTime.QuickTime", classID:"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B", codebase:{$:1, isMin:function(a) {
2165        return this.$.codebase.isMin(this, a);
2166      }, search:function() {
2167        return this.$.codebase.search(this);
2168      }, ParamTags:'<param name="src" value="" /><param name="controller" value="false" />', DIGITMAX:[[12, 11, 11], [7, 60], [7, 11, 11], 0, [7, 11, 11]], DIGITMIN:[5, 0, 0, 0], Upper:["999", "7,60", "7,50", "7,6", "7,5"], Lower:["7,60", "7,50", "7,6", "7,5", "0"], convert:[1, function(b, a) {
2169        return a ? [b[0], b[1] + b[2], b[3], "0"] : [b[0], b[1].charAt(0), b[1].charAt(1), b[2]];
2170      }, 1, 0, 1]}, setPluginStatus:function(d, a, f) {
2171        var e = this, c = e.$, b = e.installed;
2172        e.installed = a ? 1 : f ? f > 0 ? 0.7 : -0.1 : d ? 0 : -1;
2173        if (a) {
2174          e.version = c.formatNum(a, 3);
2175        }
2176        e.getVersionDone = e.installed == 0.7 || e.installed == -0.1 ? 0 : 1;
2177        c.codebase.emptyGarbage();
2178      }, getVersion:function(c) {
2179        var h = this, d = h.$, a = null, g = null, b, f;
2180        if (!d.isIE) {
2181          if (d.hasMimeType(h.mimeType)) {
2182            g = d.OS != 3 ? d.findNavPlugin("QuickTime.*Plug-?in", 0) : null;
2183            if (g && g.name) {
2184              a = d.getNum(g.name);
2185            }
2186          }
2187        } else {
2188          if (d.isStrNum(c)) {
2189            b = c.split(d.splitNumRegx);
2190            if (b.length > 3 && parseInt(b[3], 10) > 0) {
2191              b[3] = "9999";
2192            }
2193            c = b.join(",");
2194          }
2195          b = h.codebase.isMin(c);
2196          if (b) {
2197            h.setPluginStatus(0, 0, b);
2198            return;
2199          }
2200          if (!a || d.dbug) {
2201            a = h.codebase.search();
2202          }
2203          if (!a || d.dbug) {
2204            g = d.getAXO(h.progID);
2205            b = d.getPROP(g, "QuickTimeVersion");
2206            if (b && b.toString) {
2207              a = b.toString(16);
2208              a = parseInt(a.charAt(0) || "0", 16) + "." + parseInt(a.charAt(1) || "0", 16) + "." + parseInt(a.charAt(2) || "0", 16);
2209            }
2210          }
2211        }
2212        h.setPluginStatus(g, a);
2213      }}, java:{$:1, mimeType:["application/x-java-applet", "application/x-java-vm", "application/x-java-bean"], mimeType_dummy:"application/dummymimejavaapplet", classID:"clsid:8AD9C840-044E-11D1-B3E9-00805F499D93", classID_dummy:"clsid:8AD9C840-044E-11D1-B3E9-BA9876543210", navigator:{$:1, a:function() {
2214        var b, a = !0;
2215        try {
2216          a = window.navigator.javaEnabled();
2217        } catch (b) {
2218        }
2219        return a;
2220      }(), javaEnabled:function() {
2221        return this.a;
2222      }, mimeObj:0, pluginObj:0}, OTF:null, info:{$:1, Plugin2Status:0, setPlugin2Status:function(a) {
2223        if (this.$.isNum(a)) {
2224          this.Plugin2Status = a;
2225        }
2226      }, getPlugin2Status:function() {
2227        var c = this, d = c.$, b = c.$$, i = b.navigator, f, g, k, h, j, a;
2228        if (c.Plugin2Status === 0) {
2229          if (d.isIE && (d.OS == 1 && /Sun|Oracle/i.test(c.getVendor()))) {
2230            f = c.isMinJre4Plugin2();
2231            if (f > 0) {
2232              c.setPlugin2Status(1);
2233            } else {
2234              if (f < 0) {
2235                c.setPlugin2Status(-1);
2236              }
2237            }
2238          } else {
2239            if (!d.isIE && i.pluginObj) {
2240              k = /Next.*Generation.*Java.*Plug-?in|Java.*Plug-?in\s*2\s/i;
2241              h = /Classic.*Java.*Plug-in/i;
2242              j = i.pluginObj.description || "";
2243              a = i.pluginObj.name || "";
2244              if (k.test(j) || k.test(a)) {
2245                c.setPlugin2Status(1);
2246              } else {
2247                if (h.test(j) || h.test(a)) {
2248                  c.setPlugin2Status(-1);
2249                }
2250              }
2251            }
2252          }
2253        }
2254        return c.Plugin2Status;
2255      }, isMinJre4Plugin2:function(a) {
2256        var f = this, e = f.$, c = f.$$, d = "", g = c.applet.codebase, b = c.applet.getResult()[0];
2257        if (e.OS == 1) {
2258          d = "1,6,0,10";
2259        } else {
2260          if (e.OS == 2) {
2261            d = "1,6,0,12";
2262          } else {
2263            if (e.OS == 3) {
2264              d = "1,6,0,10";
2265            } else {
2266              d = "1,6,0,10";
2267            }
2268          }
2269        }
2270        if (!a) {
2271          a = (b && !c.applet.isRange(b) ? b : 0) || (c.version || (g.min && d ? g.isMin(d) > 0 ? d : "0,0,0,0" : 0));
2272        }
2273        a = e.formatNum(e.getNum(a));
2274        return a ? e.compareNums(a, d) >= 0 ? 1 : -1 : 0;
2275      }, BrowserForbidsPlugin2:function() {
2276        var a = this.$;
2277        if (a.OS >= 20) {
2278          return 0;
2279        }
2280        if (a.isIE && a.verIE < 6 || (a.isGecko && a.compareNums(a.verGecko, "1,9,0,0") < 0 || a.isOpera && (a.verOpera && a.verOpera < 10.5))) {
2281          return 1;
2282        }
2283        return 0;
2284      }, BrowserRequiresPlugin2:function() {
2285        var a = this.$;
2286        if (a.OS >= 20) {
2287          return 0;
2288        }
2289        if (a.isGecko && a.compareNums(a.verGecko, "1,9,2,0") >= 0 || (a.isChrome || a.OS == 1 && (a.verOpera && a.verOpera >= 10.6))) {
2290          return 1;
2291        }
2292        return 0;
2293      }, VENDORS:["Sun Microsystems Inc.", "Apple Computer, Inc.", "Oracle Corporation"], OracleMin:"1,7,0,0", OracleOrSun:function(a) {
2294        var c = this, b = c.$;
2295        return c.VENDORS[b.compareNums(b.formatNum(a), c.OracleMin) < 0 ? 0 : 2];
2296      }, OracleOrApple:function(a) {
2297        var c = this, b = c.$;
2298        return c.VENDORS[b.compareNums(b.formatNum(a), c.OracleMin) < 0 ? 1 : 2];
2299      }, getVendor:function() {
2300        var d = this, c = d.$, b = d.$$, f = b.vendor || (b.applet.getResult()[1] || ""), e = b.applet.codebase, a;
2301        if (!f) {
2302          a = b.DTK.version || (e.version || (e.min ? e.isMin(d.OracleMin) > 0 ? d.OracleMin : "0,0,0,0" : 0));
2303          if (a) {
2304            f = d.OracleOrSun(a);
2305          } else {
2306            if (b.version) {
2307              if (c.OS == 2) {
2308                f = d.OracleOrApple(b.version);
2309              } else {
2310                if (!c.isIE && c.OS == 1 || c.OS == 3) {
2311                  f = d.OracleOrSun(b.version);
2312                }
2313              }
2314            }
2315          }
2316        }
2317        return f;
2318      }, isPlugin2InstalledEnabled:function() {
2319        var b = this, d = b.$, a = b.$$, i = -1, f = a.installed, g = b.getPlugin2Status(), h = b.BrowserRequiresPlugin2(), e = b.BrowserForbidsPlugin2(), c = b.isMinJre4Plugin2();
2320        if (f !== null && f >= -0.1) {
2321          if (g >= 3) {
2322            i = 1;
2323          } else {
2324            if (g <= -3) {
2325            } else {
2326              if (g == 2) {
2327                i = 1;
2328              } else {
2329                if (g == -2) {
2330                } else {
2331                  if (h && (g >= 0 && c > 0)) {
2332                    i = 1;
2333                  } else {
2334                    if (e && (g <= 0 && c < 0)) {
2335                    } else {
2336                      if (h) {
2337                        i = 1;
2338                      } else {
2339                        if (e) {
2340                        } else {
2341                          if (g > 0) {
2342                            i = 1;
2343                          } else {
2344                            if (g < 0) {
2345                            } else {
2346                              if (c < 0) {
2347                              } else {
2348                                i = 0;
2349                              }
2350                            }
2351                          }
2352                        }
2353                      }
2354                    }
2355                  }
2356                }
2357              }
2358            }
2359          }
2360        }
2361        return i;
2362      }}, getInfo:function() {
2363        var b = this, d = b.$, a = b.applet, h, j = b.installed, g = b.DTK.query(), f = a.results, k = {All_versions:[], DeployTK_versions:[].concat(d.isArray(g.VERSIONS) ? g.VERSIONS : []), DeploymentToolkitPlugin:g.status == 0 || !g.HTML ? null : g.HTML.obj(), vendor:b.info.getVendor(), isPlugin2:b.info.isPlugin2InstalledEnabled(), OTF:b.OTF < 3 ? 0 : b.OTF == 3 ? 1 : 2, PLUGIN:null, name:"", description:""};
2364        k.All_versions = [].concat(k.DeployTK_versions.length ? k.DeployTK_versions : d.isString(b.version) ? [b.version] : []);
2365        var c = k.All_versions;
2366        for (h = 0;h < c.length;h++) {
2367          c[h] = d.formatNum(d.getNum(c[h]));
2368        }
2369        for (h = 0;h < f.length;h++) {
2370          if (f[h][0] && (a.HTML[h] && a.HTML[h].obj())) {
2371            k.PLUGIN = a.HTML[h].obj();
2372            break;
2373          }
2374        }
2375        var e = [null, null, null, null];
2376        for (h = 0;h < f.length;h++) {
2377          if (f[h][0]) {
2378            e[h] = 1;
2379          } else {
2380            if (f[h][0] !== null) {
2381              if (b.NOTF) {
2382                b.NOTF.isAppletActive(h);
2383              }
2384              if (a.active[h] > 0) {
2385                e[h] = 0;
2386              } else {
2387                if (a.allowed[h] >= 1 && (b.OTF != 3 && (a.isDisabled.single(h) || (j == -0.2 || (j == -1 || (a.active[h] < 0 || h == 3 && (!d.isIE || /Microsoft/i.test(k.vendor)))))))) {
2388                  e[h] = -1;
2389                }
2390              }
2391            } else {
2392              if (h == 3 && f[0][0]) {
2393                e[h] = 0;
2394              } else {
2395                if (a.isDisabled.single(h)) {
2396                  e[h] = -1;
2397                }
2398              }
2399            }
2400          }
2401        }
2402        k.objectTag = e[1];
2403        k.appletTag = e[2];
2404        k.objectTagActiveX = e[3];
2405        var i = 0;
2406        if (!d.isIE) {
2407          if (b.navMime.query().pluginObj) {
2408            i = b.navMime.pluginObj;
2409          } else {
2410            if (b.navigator.pluginObj) {
2411              i = b.navigator.pluginObj;
2412            }
2413          }
2414          if (i) {
2415            k.name = i.name || "";
2416            k.description = i.description || "";
2417          }
2418        }
2419        return k;
2420      }, getVerifyTagsDefault:function() {
2421        return[1, this.applet.isDisabled.VerifyTagsDefault_1() ? 0 : 1, 1];
2422      }, getVersion:function(j, g, i) {
2423        var b = this, d = b.$, e, a = b.applet, h = b.verify, k = b.navigator, f = null, l = null, c = null;
2424        if (b.getVersionDone === null) {
2425          b.OTF = 0;
2426          k.mimeObj = d.hasMimeType(b.mimeType);
2427          if (k.mimeObj) {
2428            k.pluginObj = k.mimeObj.enabledPlugin;
2429          }
2430          if (h) {
2431            h.begin();
2432          }
2433        }
2434        a.setVerifyTagsArray(i);
2435        d.file.save(b, ".jar", g);
2436        if (b.getVersionDone === 0) {
2437          if (a.should_Insert_Query_Any()) {
2438            e = a.insert_Query_Any(j);
2439            b.setPluginStatus(e[0], e[1], f, j);
2440          }
2441          return;
2442        }
2443        if ((!f || d.dbug) && b.DTK.query().version) {
2444          f = b.DTK.version;
2445        }
2446        if ((!f || d.dbug) && b.navMime.query().version) {
2447          f = b.navMime.version;
2448        }
2449        if ((!f || d.dbug) && b.navPlugin.query().version) {
2450          f = b.navPlugin.version;
2451        }
2452        if (b.nonAppletDetectionOk(f)) {
2453          c = f;
2454        }
2455        if (!c || (d.dbug || (a.VerifyTagsHas(2.2) || a.VerifyTagsHas(2.5)))) {
2456          e = b.lang.System.getProperty();
2457          if (e[0]) {
2458            f = e[0];
2459            c = e[0];
2460            l = e[1];
2461          }
2462        }
2463        b.setPluginStatus(c, l, f, j);
2464        if (a.should_Insert_Query_Any()) {
2465          e = a.insert_Query_Any(j);
2466          if (e[0]) {
2467            c = e[0];
2468            l = e[1];
2469          }
2470        }
2471        b.setPluginStatus(c, l, f, j);
2472      }, nonAppletDetectionOk:function(b) {
2473        var d = this, e = d.$, a = d.navigator, c = 1;
2474        if (!b || (!a.javaEnabled() && !d.lang.System.getPropertyHas(b) || (!e.isIE && (!a.mimeObj && !d.lang.System.getPropertyHas(b)) || e.isIE && !e.ActiveXEnabled))) {
2475          c = 0;
2476        } else {
2477          if (e.OS >= 20) {
2478          } else {
2479            if (d.info && (d.info.getPlugin2Status() < 0 && d.info.BrowserRequiresPlugin2())) {
2480              c = 0;
2481            }
2482          }
2483        }
2484        return c;
2485      }, setPluginStatus:function(d, i, g, h) {
2486        var b = this, e = b.$, f, c = 0, a = b.applet;
2487        g = g || b.version0;
2488        if (b.OTF > 0) {
2489          d = d || b.lang.System.getProperty()[0];
2490        }
2491        f = a.isRange(d);
2492        if (f) {
2493          if (a.setRange(f, h) == d) {
2494            c = f;
2495          }
2496          d = 0;
2497        }
2498        if (b.OTF < 3) {
2499          b.installed = c ? c > 0 ? 0.7 : -0.1 : d ? 1 : g ? -0.2 : -1;
2500        }
2501        if (b.OTF == 2 && (b.NOTF && (!b.applet.getResult()[0] && !b.lang.System.getProperty()[0]))) {
2502          b.installed = g ? -0.2 : -1;
2503        }
2504        if (b.OTF == 3 && (b.installed != -0.5 && b.installed != 0.5)) {
2505          b.installed = b.NOTF.isJavaActive(1) == 1 || b.lang.System.getProperty()[0] ? 0.5 : -0.5;
2506        }
2507        if (b.OTF == 4 && (b.installed == -0.5 || b.installed == 0.5)) {
2508          if (d) {
2509            b.installed = 1;
2510          } else {
2511            if (c) {
2512              b.installed = c > 0 ? 0.7 : -0.1;
2513            } else {
2514              if (b.NOTF.isJavaActive(1) == 1) {
2515                if (g) {
2516                  b.installed = 1;
2517                  d = g;
2518                } else {
2519                  b.installed = 0;
2520                }
2521              } else {
2522                if (g) {
2523                  b.installed = -0.2;
2524                } else {
2525                  b.installed = -1;
2526                }
2527              }
2528            }
2529          }
2530        }
2531        if (g) {
2532          b.version0 = e.formatNum(e.getNum(g));
2533        }
2534        if (d && !c) {
2535          b.version = e.formatNum(e.getNum(d));
2536        }
2537        if (i && e.isString(i)) {
2538          b.vendor = i;
2539        }
2540        if (!b.vendor) {
2541          b.vendor = "";
2542        }
2543        if (b.verify && b.verify.isEnabled()) {
2544          b.getVersionDone = 0;
2545        } else {
2546          if (b.getVersionDone != 1) {
2547            if (b.OTF < 2) {
2548              b.getVersionDone = 0;
2549            } else {
2550              b.getVersionDone = b.applet.can_Insert_Query_Any() ? 0 : 1;
2551            }
2552          }
2553        }
2554        e.codebase.emptyGarbage();
2555      }, DTK:{$:1, hasRun:0, status:null, VERSIONS:[], version:"", HTML:null, Plugin2Status:null, classID:["clsid:CAFEEFAC-DEC7-0000-0001-ABCDEFFEDCBA", "clsid:CAFEEFAC-DEC7-0000-0000-ABCDEFFEDCBA"], mimeType:["application/java-deployment-toolkit", "application/npruntime-scriptable-plugin;DeploymentToolkit"], isDisabled:function() {
2556        var a = this, b = a.$;
2557        if (!b.DOM.isEnabled.objectTag() || (b.isIE && b.verIE < 6 || (b.isGecko && b.compareNums(b.verGecko, b.formatNum("1.6")) <= 0 || (b.isSafari && (b.OS == 1 && (!b.verSafari || b.compareNums(b.verSafari, "5,1,0,0") < 0)) || b.isChrome)))) {
2558          return 1;
2559        }
2560        return 0;
2561      }, query:function() {
2562        var l = this, h = l.$, f = l.$$, k, m, i, a = h.DOM.altHTML, g = {}, b, d = null, j = null, c = l.hasRun || l.isDisabled();
2563        l.hasRun = 1;
2564        if (c) {
2565          return l;
2566        }
2567        l.status = 0;
2568        if (h.isIE) {
2569          for (m = 0;m < l.classID.length;m++) {
2570            l.HTML = h.DOM.insert("object", ["classid", l.classID[m]], [], a);
2571            d = l.HTML.obj();
2572            if (h.getPROP(d, "jvms")) {
2573              break;
2574            }
2575          }
2576        } else {
2577          i = h.hasMimeType(l.mimeType);
2578          if (i && i.type) {
2579            l.HTML = h.DOM.insert("object", ["type", i.type], [], a);
2580            d = l.HTML.obj();
2581          }
2582        }
2583        if (d) {
2584          try {
2585            if (Math.abs(f.info.getPlugin2Status()) < 2) {
2586              l.Plugin2Status = d.isPlugin2();
2587            }
2588          } catch (k) {
2589          }
2590          if (l.Plugin2Status !== null) {
2591            if (l.Plugin2Status) {
2592              f.info.setPlugin2Status(2);
2593            } else {
2594              if (h.isIE || f.info.getPlugin2Status() <= 0) {
2595                f.info.setPlugin2Status(-2);
2596              }
2597            }
2598          }
2599          try {
2600            b = h.getPROP(d, "jvms");
2601            if (b) {
2602              j = b.getLength();
2603              if (h.isNum(j)) {
2604                l.status = j > 0 ? 1 : -1;
2605                for (m = 0;m < j;m++) {
2606                  i = h.getNum(b.get(j - 1 - m).version);
2607                  if (i) {
2608                    l.VERSIONS.push(i);
2609                    g["a" + h.formatNum(i)] = 1;
2610                  }
2611                }
2612              }
2613            }
2614          } catch (k) {
2615          }
2616        }
2617        i = 0;
2618        for (m in g) {
2619          i++;
2620        }
2621        if (i && i !== l.VERSIONS.length) {
2622          l.VERSIONS = [];
2623        }
2624        if (l.VERSIONS.length) {
2625          l.version = h.formatNum(l.VERSIONS[0]);
2626        }
2627        return l;
2628      }}, navMime:{$:1, hasRun:0, mimetype:"", version:"", length:0, mimeObj:0, pluginObj:0, isDisabled:function() {
2629        var b = this, d = b.$, c = b.$$, a = c.navigator;
2630        if (d.isIE || (!a.mimeObj || !a.pluginObj)) {
2631          return 1;
2632        }
2633        return 0;
2634      }, query:function() {
2635        var i = this, f = i.$, a = i.$$, b = i.hasRun || i.isDisabled();
2636        i.hasRun = 1;
2637        if (b) {
2638          return i;
2639        }
2640        var n = /^\s*application\/x-java-applet;jpi-version\s*=\s*(\d.*)$/i, g, l, j, d = "", h = "a", o, m, k = {}, c = f.formatNum("0");
2641        for (l = 0;l < navigator.mimeTypes.length;l++) {
2642          o = navigator.mimeTypes[l];
2643          m = o ? o.enabledPlugin : 0;
2644          g = o && n.test(o.type || d) ? f.formatNum(f.getNum(RegExp.$1)) : 0;
2645          if (g && (m && (m.description || m.name))) {
2646            if (!k[h + g]) {
2647              i.length++;
2648            }
2649            k[h + g] = o.type;
2650            if (f.compareNums(g, c) > 0) {
2651              c = g;
2652            }
2653          }
2654        }
2655        g = k[h + c];
2656        if (g) {
2657          o = f.hasMimeType(g);
2658          i.mimeObj = o;
2659          i.pluginObj = o ? o.enabledPlugin : 0;
2660          i.mimetype = g;
2661          i.version = c;
2662        }
2663        return i;
2664      }}, navPlugin:{$:1, hasRun:0, version:"", isDisabled:function() {
2665        var d = this, c = d.$, b = d.$$, a = b.navigator;
2666        if (c.isIE || (!a.mimeObj || !a.pluginObj)) {
2667          return 1;
2668        }
2669        return 0;
2670      }, query:function() {
2671        var m = this, e = m.$, c = m.$$, h = c.navigator, j, l, k, g, d, a, i, f = 0, b = m.hasRun || m.isDisabled();
2672        m.hasRun = 1;
2673        if (b) {
2674          return m;
2675        }
2676        a = h.pluginObj.name || "";
2677        i = h.pluginObj.description || "";
2678        if (!f || e.dbug) {
2679          g = /Java.*TM.*Platform[^\d]*(\d+)(?:[\.,_](\d*))?(?:\s*[Update]+\s*(\d*))?/i;
2680          if ((g.test(a) || g.test(i)) && parseInt(RegExp.$1, 10) >= 5) {
2681            f = "1," + RegExp.$1 + "," + (RegExp.$2 ? RegExp.$2 : "0") + "," + (RegExp.$3 ? RegExp.$3 : "0");
2682          }
2683        }
2684        if (!f || e.dbug) {
2685          g = /Java[^\d]*Plug-in/i;
2686          l = g.test(i) ? e.formatNum(e.getNum(i)) : 0;
2687          k = g.test(a) ? e.formatNum(e.getNum(a)) : 0;
2688          if (l && (e.compareNums(l, e.formatNum("1,3")) < 0 || e.compareNums(l, e.formatNum("2")) >= 0)) {
2689            l = 0;
2690          }
2691          if (k && (e.compareNums(k, e.formatNum("1,3")) < 0 || e.compareNums(k, e.formatNum("2")) >= 0)) {
2692            k = 0;
2693          }
2694          d = l && k ? e.compareNums(l, k) > 0 ? l : k : l || k;
2695          if (d) {
2696            f = d;
2697          }
2698        }
2699        if (!f && (e.isSafari && e.OS == 2)) {
2700          j = e.findNavPlugin("Java.*\\d.*Plug-in.*Cocoa", 0);
2701          if (j) {
2702            l = e.getNum(j.description);
2703            if (l) {
2704              f = l;
2705            }
2706          }
2707        }
2708        if (f) {
2709          m.version = e.formatNum(f);
2710        }
2711        return m;
2712      }}, lang:{$:1, System:{$:1, hasRun:0, result:[null, null], isDisabled:function() {
2713        var b = this, c = b.$, a = b.$$;
2714        if (!window.java || c.isIE) {
2715          return 1;
2716        }
2717        if (c.OS == 2 && (c.verOpera && (c.verOpera < 9.2 && c.verOpera >= 9))) {
2718          return 1;
2719        }
2720        return 0;
2721      }, getPropertyHas:function(a) {
2722        var b = this, d = b.$, c = b.getProperty()[0];
2723        return a && (c && d.compareNums(d.formatNum(a), d.formatNum(c)) === 0) ? 1 : 0;
2724      }, getProperty:function() {
2725        var f = this, g = f.$, d = f.$$, h, a = "java_qqq990", c, i = "window.java.lang.System.getProperty", b = f.hasRun || f.isDisabled();
2726        f.hasRun = 1;
2727        if (!b) {
2728          g[a] = 0;
2729          try {
2730            c = document.createElement("script");
2731            c.type = "text/javascript";
2732            c.appendChild(document.createTextNode("(function(){var e;try{" + g.name + "." + a + "=[" + i + "('java.version')+''," + i + "('java.vendor')+'']}catch(e){}})();"));
2733            g.head.insertBefore(c, g.head.firstChild);
2734            g.head.removeChild(c);
2735          } catch (h) {
2736          }
2737          if (g.isArray(g[a])) {
2738            f.result = [].concat(g[a]);
2739          }
2740        }
2741        return f.result;
2742      }}}, applet:{$:1, codebase:{$:1, isMin:function(a) {
2743        return this.$.codebase.isMin(this, a);
2744      }, search:function() {
2745        return this.$.codebase.search(this);
2746      }, ParamTags:'<param name="code" value="A19999.class" /><param name="codebase_lookup" value="false" />', DIGITMAX:[[16, 64], [6, 0, 512], 0, [1, 5, 2, 256], 0, [1, 4, 1, 1], [1, 4, 0, 64], [1, 3, 2, 32]], DIGITMIN:[1, 0, 0, 0], Upper:["999", "10", "5,0,20", "1,5,0,20", "1,4,1,20", "1,4,1,2", "1,4,1", "1,4"], Lower:["10", "5,0,20", "1,5,0,20", "1,4,1,20", "1,4,1,2", "1,4,1", "1,4", "0"], convert:[function(b, a) {
2747        return a ? [parseInt(b[0], 10) > 1 ? "99" : parseInt(b[1], 10) + 3 + "", b[3], "0", "0"] : ["1", parseInt(b[0], 10) - 3 + "", "0", b[1]];
2748      }, function(b, a) {
2749        return a ? [b[1], b[2], b[3] + "0", "0"] : ["1", b[0], b[1], b[2].substring(0, b[2].length - 1 || 1)];
2750      }, 0, function(b, a) {
2751        return a ? [b[0], b[1], b[2], b[3] + "0"] : [b[0], b[1], b[2], b[3].substring(0, b[3].length - 1 || 1)];
2752      }, 0, 1, function(b, a) {
2753        return a ? [b[0], b[1], b[2], b[3] + "0"] : [b[0], b[1], b[2], b[3].substring(0, b[3].length - 1 || 1)];
2754      }, 1]}, results:[[null, null], [null, null], [null, null], [null, null]], getResult:function() {
2755        var b = this, d = b.results, a, c = [];
2756        for (a = d.length - 1;a >= 0;a--) {
2757          c = d[a];
2758          if (c[0]) {
2759            break;
2760          }
2761        }
2762        c = [].concat(c);
2763        return c;
2764      }, DummySpanTagHTML:0, HTML:[0, 0, 0, 0], active:[0, 0, 0, 0], DummyObjTagHTML:0, DummyObjTagHTML2:0, allowed:[1, 1, 1, 1], VerifyTagsHas:function(c) {
2765        var d = this, b;
2766        for (b = 0;b < d.allowed.length;b++) {
2767          if (d.allowed[b] === c) {
2768            return 1;
2769          }
2770        }
2771        return 0;
2772      }, saveAsVerifyTagsArray:function(c) {
2773        var b = this, d = b.$, a;
2774        if (d.isArray(c)) {
2775          for (a = 1;a < b.allowed.length;a++) {
2776            if (c.length > a - 1 && d.isNum(c[a - 1])) {
2777              if (c[a - 1] < 0) {
2778                c[a - 1] = 0;
2779              }
2780              if (c[a - 1] > 3) {
2781                c[a - 1] = 3;
2782              }
2783              b.allowed[a] = c[a - 1];
2784            }
2785          }
2786          b.allowed[0] = b.allowed[3];
2787        }
2788      }, setVerifyTagsArray:function(d) {
2789        var b = this, c = b.$, a = b.$$;
2790        if (a.getVersionDone === null) {
2791          b.saveAsVerifyTagsArray(a.getVerifyTagsDefault());
2792        }
2793        if (c.dbug || a.verify && a.verify.isEnabled()) {
2794          b.saveAsVerifyTagsArray([3, 3, 3]);
2795        } else {
2796          if (d) {
2797            b.saveAsVerifyTagsArray(d);
2798          }
2799        }
2800      }, isDisabled:{$:1, single:function(d) {
2801        var a = this, c = a.$, b = a.$$;
2802        if (d == 0) {
2803          return c.codebase.isDisabled();
2804        }
2805        if (d == 3 && !c.isIE || a.all()) {
2806          return 1;
2807        }
2808        if (d == 1 || d == 3) {
2809          return!c.DOM.isEnabled.objectTag();
2810        }
2811        if (d == 2) {
2812          return a.AppletTag();
2813        }
2814      }, aA_:null, all:function() {
2815        var c = this, e = c.$, d = c.$$, b = d.navigator, a = 0;
2816        if (c.aA_ === null) {
2817          if (e.OS >= 20) {
2818            a = 0;
2819          } else {
2820            if (e.verOpera && (e.verOpera < 11 && (!b.javaEnabled() && !d.lang.System.getProperty()[0]))) {
2821              a = 1;
2822            } else {
2823              if (e.verGecko && e.compareNums(e.verGecko, e.formatNum
2823("2")) < 0 && (!b.mimeObj && !d.lang.System.getProperty()[0])) {
2824                a = 1;
2825              } else {
2826                if (c.AppletTag() && !e.DOM.isEnabled.objectTag()) {
2827                  a = 1;
2828                }
2829              }
2830            }
2831          }
2832          c.aA_ = a;
2833        }
2834        return c.aA_;
2835      }, AppletTag:function() {
2836        var b = this, d = b.$, c = b.$$, a = c.navigator;
2837        return d.isIE ? !a.javaEnabled() : 0;
2838      }, VerifyTagsDefault_1:function() {
2839        var a = this.$;
2840        if (a.OS >= 20) {
2841          return 1;
2842        }
2843        if (a.isIE && (a.verIE < 9 || !a.ActiveXEnabled) || (a.verGecko && a.compareNums(a.verGecko, a.formatNum("2")) < 0 || (a.isSafari && (!a.verSafari || a.compareNums(a.verSafari, a.formatNum("4")) < 0) || a.verOpera && a.verOpera < 10))) {
2844          return 0;
2845        }
2846        return 1;
2847      }, z:0}, can_Insert_Query:function(d) {
2848        var b = this, c = b.results[0][0], a = b.getResult()[0];
2849        if (b.HTML[d] || (d == 0 && (c !== null && !b.isRange(c)) || d == 0 && (a && !b.isRange(a)))) {
2850          return 0;
2851        }
2852        return!b.isDisabled.single(d);
2853      }, can_Insert_Query_Any:function() {
2854        var b = this, a;
2855        for (a = 0;a < b.results.length;a++) {
2856          if (b.can_Insert_Query(a)) {
2857            return 1;
2858          }
2859        }
2860        return 0;
2861      }, should_Insert_Query:function(e) {
2862        var c = this, f = c.allowed, d = c.$, b = c.$$, a = c.getResult()[0];
2863        a = a && (e > 0 || !c.isRange(a));
2864        if (!c.can_Insert_Query(e) || f[e] === 0) {
2865          return 0;
2866        }
2867        if (f[e] == 3 || (f[e] == 2.8 && !a || (f[e] == 2.5 && !b.lang.System.getProperty()[0] || f[e] == 2.2 && (!b.lang.System.getProperty()[0] && !a)))) {
2868          return 1;
2869        }
2870        if (!b.nonAppletDetectionOk(b.version0)) {
2871          if (f[e] == 2 || f[e] == 1 && !a) {
2872            return 1;
2873          }
2874        }
2875        return 0;
2876      }, should_Insert_Query_Any:function() {
2877        var b = this, a;
2878        for (a = 0;a < b.allowed.length;a++) {
2879          if (b.should_Insert_Query(a)) {
2880            return 1;
2881          }
2882        }
2883        return 0;
2884      }, query:function(f) {
2885        var j, a = this, i = a.$, d = a.$$, k = null, l = null, b = a.results, c, h, g = a.HTML[f];
2886        if (!g || (!g.obj() || (b[f][0] || (d.bridgeDisabled || i.dbug && d.OTF < 3)))) {
2887          return;
2888        }
2889        c = g.obj(true);
2890        h = g.readyState();
2891        if (!i.isIE || h === 4) {
2892          try {
2893            k = i.getNum(c.getVersion() + "");
2894            l = c.getVendor() + "";
2895            c.statusbar(i.win.loaded ? " " : " ");
2896          } catch (j) {
2897          }
2898          if (k && i.isStrNum(k)) {
2899            b[f] = [k, l];
2900            a.active[f] = 2;
2901            if (Math.abs(d.info.getPlugin2Status()) < 3) {
2902              try {
2903                if (c.Packages.A.isPlugin2()) {
2904                  d.info.setPlugin2Status(3);
2905                }
2906              } catch (j) {
2907              }
2908              if (Math.abs(d.info.getPlugin2Status()) < 3) {
2909                d.info.setPlugin2Status(-3);
2910              }
2911            }
2912          }
2913        }
2914      }, isRange:function(a) {
2915        return/^[<>]/.test(a || "") ? a.charAt(0) == ">" ? 1 : -1 : 0;
2916      }, setRange:function(b, a) {
2917        return(b ? b > 0 ? ">" : "<" : "") + (this.$.isString(a) ? a : "");
2918      }, insert_Query_Any:function(n) {
2919        var e = this, c = e.$, k = e.$$, l = e.results, m = e.HTML, g = c.DOM.altHTML, r = "A.class", o, b = c.file.getValid(k);
2920        if (e.should_Insert_Query(0)) {
2921          if (k.OTF < 2) {
2922            k.OTF = 2;
2923          }
2924          l[0] = [0, 0];
2925          o = n ? e.codebase.isMin(n) : e.codebase.search();
2926          if (o) {
2927            l[0][0] = n ? e.setRange(o, n) : o;
2928          }
2929          e.active[0] = o ? 1.5 : -1;
2930        }
2931        if (!b) {
2932          return e.getResult();
2933        }
2934        var f = b.name + b.ext, q = b.path;
2935        var i = ["archive", f, "code", r], j = ["mayscript", "true"], p = ["
2935scriptable", "true", "codebase_lookup", "false"].concat(j), a = k.navigator, d = !c.isIE && (a.mimeObj && a.mimeObj.type) ? a.mimeObj.type : k.mimeType[0];
2936        if (!e.DummySpanTagHTML) {
2937          e.DummySpanTagHTML = c.DOM.insert("", [], [], g);
2938        }
2939        if (e.should_Insert_Query(1)) {
2940          if (k.OTF < 2) {
2941            k.OTF = 2;
2942          }
2943          m[1] = c.isIE ? c.DOM.insert("object", ["type", d], ["codebase", q].concat(i).concat(p), g, k) : c.DOM.insert("object", ["type", d], ["codebase", q].concat(i).concat(p), g, k);
2944          l[1] = [0, 0];
2945          e.query(1);
2946        }
2947        if (e.should_Insert_Query(2)) {
2948          if (k.OTF < 2) {
2949            k.OTF = 2;
2950          }
2951          m[2] = c.isIE ? c.DOM.insert("applet", ["alt", g].concat(j).concat(i), ["codebase", q].concat(p), g, k) : c.DOM.insert("applet", ["codebase", q, "alt", g].concat(j).concat(i), [].concat(p), g, k);
2952          l[2] = [0, 0];
2953          e.query(2);
2954        }
2955        if (e.should_Insert_Query(3)) {
2956          if (k.OTF < 2) {
2957            k.OTF = 2;
2958          }
2959          m[3] = c.isIE ? c.DOM.insert("object", ["classid", k.classID], ["codebase", q].concat(i).concat(p), g, k) : c.DOM.insert();
2960          l[3] = [0, 0];
2961          e.query(3);
2962        }
2963        if (c.DOM.isEnabled.objectTag()) {
2964          if (!e.DummyObjTagHTML && (m[1] || m[2])) {
2965            e.DummyObjTagHTML = c.DOM.insert("object", ["type", k.mimeType_dummy], [], g);
2966          }
2967          if (!e.DummyObjTagHTML2 && m[3]) {
2968            e.DummyObjTagHTML2 = c.DOM.insert("object", ["classid", k.classID_dummy], [], g);
2969          }
2970        }
2971        var h = k.NOTF;
2972        if (k.OTF < 3 && h.shouldContinueQuery()) {
2973          k.OTF = 3;
2974          h.onIntervalQuery = c.handler(h.$$onIntervalQuery, h);
2975          if (!c.win.loaded) {
2976            c.win.funcs0.push([h.winOnLoadQuery, h]);
2977          }
2978          setTimeout(h.onIntervalQuery, h.intervalLength);
2979        }
2980        return e.getResult();
2981      }}, NOTF:{$:1, count:0, countMax:25, intervalLength:250, shouldContinueQuery:function() {
2982        var f = this, e = f.$, c = f.$$, b = c.applet, a, d = 0;
2983        if (e.win.loaded && f.count > f.countMax) {
2984          return 0;
2985        }
2986        for (a = 0;a < b.results.length;a++) {
2987          if (b.HTML[a]) {
2988            if (!e.win.loaded && (f.count > f.countMax && e.codebase.checkGarbage(b.HTML[a].span))) {
2989              d = 1;
2990              b.HTML[a].DELETE = 1;
2991            }
2992            if (!d && (!b.results[a][0] && ((b.allowed[a] >= 2 || b.allowed[a] == 1 && !b.getResult()[0]) && f.isAppletActive(a) >= 0))) {
2993              return 1;
2994            }
2995          }
2996        }
2997        return 0;
2998      }, isJavaActive:function(d) {
2999        var f = this, c = f.$$, a, b, e = -9;
3000        for (a = 0;a < c.applet.HTML.length;a++) {
3001          b = f.isAppletActive(a, d);
3002          if (b > e) {
3003            e = b;
3004          }
3005        }
3006        return e;
3007      }, isAppletActive:function(e, g) {
3008        var h = this, f = h.$, b = h.$$, l = b.navigator, a = b.applet, i = a.HTML[e], d = a.active, k, c = 0, j, m = d[e];
3009        if (g || (m >= 1.5 || (!i || !i.span))) {
3010          return m;
3011        }
3012        j = f.DOM.getTagStatus(i, a.DummySpanTagHTML, a.DummyObjTagHTML, a.DummyObjTagHTML2, h.count);
3013        for (k = 0;k < d.length;k++) {
3014          if (d[k] > 0) {
3015            c = 1;
3016          }
3017        }
3018        if (j != 1) {
3019          m = j;
3020        } else {
3021          if (f.isIE || (b.version0 && (l.javaEnabled() && (l.mimeObj && (i.tagName == "object" || c))) || b.lang.System.getProperty()[0])) {
3022            m = 1;
3023          } else {
3024            m = 0;
3025          }
3026        }
3027        d[e] = m;
3028        return m;
3029      }, winOnLoadQuery:function(c, d) {
3030        var b = d.$$, a;
3031        if (b.OTF == 3) {
3032          a = d.queryAllApplets();
3033          d.queryCompleted(a);
3034        }
3035      }, $$onIntervalQuery:function(d) {
3036        var c = d.$, b = d.$$, a;
3037        if (b.OTF == 3) {
3038          a = d.queryAllApplets();
3039          if (!d.shouldContinueQuery()) {
3040            d.queryCompleted(a);
3041          }
3042        }
3043        d.count++;
3044        if (b.OTF == 3) {
3045          setTimeout(d.onIntervalQuery, d.intervalLength);
3046        }
3047      }, queryAllApplets:function() {
3048        var f = this, e = f.$, d = f.$$, c = d.applet, b, a;
3049        for (b = 0;b < c.results.length;b++) {
3050          c.query(b);
3051        }
3052        a = c.getResult();
3053        return a;
3054      }, queryCompleted:function(c) {
3055        var g = this, f = g.$, e = g.$$, d = e.applet, b;
3056        if (e.OTF >= 4) {
3057          return;
3058        }
3059        e.OTF = 4;
3060        var a = g.isJavaActive();
3061        for (b = 0;b < d.HTML.length;b++) {
3062          if (d.HTML[b] && d.HTML[b].DELETE) {
3063            f.DOM.emptyNode(d.HTML[b].span);
3064            d.HTML[b].span = null;
3065          }
3066        }
3067        e.setPluginStatus(c[0], c[1], 0);
3068        if (e.funcs) {
3069          f.callArray(e.funcs);
3070        }
3071        if (f.DOM) {
3072          f.DOM.onDoneEmptyDiv();
3073        }
3074      }}, zz:0}, flash:{$:1, mimeType:"application/x-shockwave-flash", progID:"ShockwaveFlash.ShockwaveFlash", classID:"clsid:D27CDB6E-AE6D-11CF-96B8-444553540000", getVersion:function() {
3075        var b = function(i) {
3076          if (!i) {
3077            return null;
3078          }
3079          var e = /[\d][\d\,\.\s]*[rRdD]{0,1}[\d\,]*/.exec(i);
3080          return e ? e[0].replace(/[rRdD\.]/g, ",").replace(/\s/g, "") : null;
3081        };
3082        var j = this, g = j.$, k, h, l = null, c = null, a = null, f, m, d;
3083        if (!g.isIE) {
3084          m = g.hasMimeType(j.mimeType);
3085          if (m && g.DOM.isEnabled.objectTag()) {
3086            f = g.DOM.insert("object", ["type", j.mimeType], [], "", j).obj();
3087            try {
3088              l = g.getNum(f.GetVariable("$version"));
3089            } catch (k) {
3090            }
3091          }
3092          if (!l) {
3093            d = m ? m.enabledPlugin : null;
3094            if (d && d.description) {
3095              l = b(d.description);
3096            }
3097            if (l) {
3098              l = g.getPluginFileVersion(d, l);
3099            }
3100          }
3101        } else {
3102          for (h = 15;h > 2;h--) {
3103            c = g.getAXO(j.progID + "." + h);
3104            if (c) {
3105              a = h.toString();
3106              break;
3107            }
3108          }
3109          if (!c) {
3110            c = g.getAXO(j.progID);
3111          }
3112          if (a == "6") {
3113            try {
3114              c.AllowScriptAccess = "always";
3115            } catch (k) {
3116              return "6,0,21,0";
3117            }
3118          }
3119          try {
3120            l = b(c.GetVariable("$version"));
3121          } catch (k) {
3122          }
3123          if (!l && a) {
3124            l = a;
3125          }
3126        }
3127        j.installed = l ? 1 : -1;
3128        j.version = g.formatNum(l);
3129        return true;
3130      }}, windowsmediaplayer:{$:1, mimeType:["application/x-mplayer2", "application/asx", "application/x-ms-wmp"], navPluginObj:null, progID:"WMPlayer.OCX", classID:"clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6", INSTALLED:{dfault:null, inputMime:{}}, getVersion:function(i, g) {
3131        var c = this, f = c.$, l, e = null, h = null, j = c.mimeType, k = "Totem|VLC", b, d, a;
3132        c.installed = -1;
3133        if (f.isString(g)) {
3134          g = g.replace(/\s/g, "");
3135          if (g) {
3136            j = g;
3137          }
3138        } else {
3139          g = null;
3140        }
3141        if (g) {
3142          d = c.INSTALLED.inputMime[g];
3143          if (f.isDefined(d)) {
3144            c.installed = d;
3145            return;
3146          }
3147        } else {
3148          d = c.INSTALLED.dfault;
3149          if (d !== null) {
3150            c.installed = d;
3151            return;
3152          }
3153        }
3154        if (!f.isIE) {
3155          if (f.OS < 20 && f.OS >= 3) {
3156            c.installed = -1;
3157            return;
3158          }
3159          a = {wmp:"Windows\\s*Media\\s*Player.*Plug-?in|Flip4Mac.*Windows\\s*Media.*Plug-?in", wmpFirefox:"Windows\\s*Media\\s*Player.*Firefox.*Plug-?in", avoidPlayers:"Totem|VLC|RealPlayer"};
3160          if (c.getVersionDone === null) {
3161            c.getVersionDone = 0;
3162            e = f.getMimeEnabledPlugin(c.mimeType, a.wmp, a.avoidPlayers);
3163            if (!g) {
3164              l = e;
3165            }
3166            if (!e && f.hasMimeType(c.mimeType)) {
3167              e = f.findNavPlugin(a.wmp, 0, a.avoidPlayers);
3168            }
3169            if (e) {
3170              c.navPluginObj = e;
3171              b = f.isGecko && f.compareNums(f.verGecko, f.formatNum
3171("1.8")) < 0;
3172              b = b || f.isOpera && f.verOpera < 10;
3173              b = b || f.isChrome;
3174              if (f.DOM.isEnabled.objectTag() && (!b && f.getMimeEnabledPlugin(c.mimeType[2], a.wmpFirefox, a.avoidPlayers))) {
3175                h = f.getPROP(f.DOM.insert("object", ["type", c.mimeType[2], "data", ""], ["src", ""], "", c).obj(), "versionInfo") || h;
3176              }
3177            }
3178          } else {
3179            h = c.version;
3180          }
3181          if (!f.isDefined(l)) {
3182            l = f.getMimeEnabledPlugin(j, a.wmp, a.avoidPlayers);
3183          }
3184          c.installed = l && h ? 1 : l ? 0 : c.navPluginObj ? -0.2 : -1;
3185        } else {
3186          e = f.getAXO(c.progID);
3187          h = f.getPROP(e, "versionInfo") || h;
3188          c.installed = e && h ? 1 : e ? 0 : -1;
3189        }
3190        if (!c.version) {
3191          c.version = f.formatNum(h);
3192        }
3193        if (g) {
3194          c.INSTALLED.inputMime[g] = c.installed;
3195        } else {
3196          c.INSTALLED.dfault = c.installed;
3197        }
3198      }}, silverlight:{$:1, mimeType:"application/x-silverlight", progID:"AgControl.AgControl", digits:[20, 20, 9, 12, 31], getVersion:function() {
3199        var e = this, c = e.$, k = document, i = null, b = null, f = null, h = true, a = [1, 0, 1, 1, 1], r = [1, 0, 1, 1, 1], j = function(d) {
3200          return(d < 10 ? "0" : "") + d.toString();
3201        }, n = function(s, d, u, v, t) {
3202          return s + "." + d + "." + u + j(v) + j(t) + ".0";
3203        }, o = function(s, d, t) {
3204          return q(s, d == 0 ? t : r[0], d == 1 ? t : r[1], d == 2 ? t : r[2], d == 3 ? t : r[3], d == 4 ? t : r[4]);
3205        }, q = function(v, t, s, x, w, u) {
3206          var u;
3207          try {
3208            return v.IsVersionSupported(n(t, s, x, w, u));
3209          } catch (u) {
3210          }
3211          return false;
3212        };
3213        if (!c.isIE) {
3214          var g;
3215          if (c.hasMimeType(e.mimeType)) {
3216            g = c.isGecko && c.compareNums(c.verGecko, c.formatNum("1.6")) <= 0;
3217            if (c.isGecko && g) {
3218              h = false;
3219            }
3220            f = c.findNavPlugin("Silverlight.*Plug-?in", 0);
3221            if (f && f.description) {
3222              i = c.formatNum(f.description);
3223            }
3224            if (i) {
3225              r = i.split(c.splitNumRegx);
3226              if (parseInt(r[2], 10) >= 30226 && parseInt(r[0], 10) < 2) {
3227                r[0] = "2";
3228              }
3229              i = r.join(",");
3230            }
3231          }
3232          e.installed = f && (h && i) ? 1 : f && h ? 0 : f ? -0.2 : -1;
3233        } else {
3234          b = c.getAXO(e.progID);
3235          var m, l, p;
3236          if (b && q(b, a[0], a[1], a[2], a[3], a[4])) {
3237            for (m = 0;m < e.digits.length;m++) {
3238              p = r[m];
3239              for (l = p + (m == 0 ? 0 : 1);l <= e.digits[m];l++) {
3240                if (o(b, m, l)) {
3241                  h = true;
3242                  r[m] = l;
3243                } else {
3244                  break;
3245                }
3246              }
3247              if (!h) {
3248                break;
3249              }
3250            }
3251            if (h) {
3252              i = n(r[0], r[1], r[2], r[3], r[4]);
3253            }
3254          }
3255          e.installed = b && (h && i) ? 1 : b && h ? 0 : b ? -0.2 : -1;
3256        }
3257        e.version = c.formatNum(i);
3258      }}, adobereader:{$:1, setPluginStatus:function() {
3259        var d = this, b = d.$, a = d.navPlugin.detected, e = d.navPlugin.version, g = d.axo.detected, c = d.axo.version, i = d.doc.detected, h = d.doc.version, f = e || (c || (h || null));
3260        d.installed = f ? 1 : a > 0 || (g > 0 || i > 0) ? 0 : i == -0.5 ? -0.15 : b.isIE && (!b.ActiveXEnabled || b.ActiveXFilteringEnabled) ? -1.5 : -1;
3261        d.version = b.formatNum(f);
3262      }, getVersion:function(c, e) {
3263        var a = this, d = a.$, b = 0;
3264        if ((!b || d.dbug) && a.navPlugin.query().detected > 0) {
3265          b = 1;
3266        }
3267        if ((!b || d.dbug) && a.axo.query().detected > 0) {
3268          b = 1;
3269        }
3270        if ((!b || d.dbug) && (a.doc.query().detected > 0 || a.doc.detected == -0.5)) {
3271          b = 1;
3272        }
3273        a.setPluginStatus();
3274      }, navPlugin:{$:1, detected:0, version:null, mimeType:"application/pdf", isDisabled:function() {
3275        var c = this, b = c.$, a = c.$$;
3276        return b.isIE || (c.detected || !b.hasMimeType(c.mimeType)) ? 1 : 0;
3277      }, attempt3:function() {
3278        var c = this, b = c.$, a = null;
3279        if (b.OS == 1) {
3280          if (b.hasMimeType("application/vnd.adobe.pdfxml")) {
3281            a = "9";
3282          } else {
3283            if (b.hasMimeType("application/vnd.adobe.x-mars")) {
3284              a = "8";
3285            } else {
3286              if (b.hasMimeType("application/vnd.adobe.xfdf")) {
3287                a = "6";
3288              }
3289            }
3290          }
3291        }
3292        return a;
3293      }, query:function() {
3294        var d = this, c = d.$, a = d.$$, f, e, b = null;
3295        if (d.isDisabled()) {
3296          return d;
3297        }
3298        f = "Adobe.*PDF.*Plug-?in|Adobe.*Acrobat.*Plug-?in|Adobe.*Reader.*Plug-?in";
3299        e = c.findNavPlugin(f, 0);
3300        d.detected = e ? 1 : -1;
3301        if (e) {
3302          b = c.getNum(e.description) || c.getNum(e.name);
3303          b = c.getPluginFileVersion(e, b);
3304          if (!b) {
3305            b = d.attempt3();
3306          }
3307        }
3308        if (b) {
3309          d.version = b;
3310        }
3311        return d;
3312      }}, pluginQuery:function(j) {
3313        var f = this, d = f.$, b = "", h = null, g, a, i, c;
3314        try {
3315          if (j) {
3316            b = j.GetVersions();
3317          }
3318        } catch (g) {
3319        }
3320        if (b && d.isString(b)) {
3321          a = /=\s*([\d\.]+)/g;
3322          for (i = 0;i < 30;i++) {
3323            if (a.test(b)) {
3324              c = d.formatNum(RegExp.$1);
3325              if (!h || d.compareNums(c > h) > 0) {
3326                h = c;
3327              }
3328            } else {
3329              break;
3330            }
3331          }
3332        }
3333        return h;
3334      }, axo:{$:1, detected:0, version:null, progID:["AcroPDF.PDF", "AcroPDF.PDF.1", "PDF.PdfCtrl", "PDF.PdfCtrl.5", "PDF.PdfCtrl.1"], isDisabled:function() {
3335        var b = this, c = b.$, a = b.$$;
3336        return c.isIE && !b.detected ? 0 : 1;
3337      }, query:function() {
3338        var d = this, e = d.$, b = d.$$, f = 0, c = null, a;
3339        if (d.isDisabled()) {
3340          return d;
3341        }
3342        for (a = 0;a < d.progID.length;a++) {
3343          f = e.getAXO(d.progID[a]);
3344          if (f) {
3345            d.detected = 1;
3346            c = b.pluginQuery(f);
3347            if (!e.dbug && c) {
3348              break;
3349            }
3350          }
3351        }
3352        d.version = c ? c : null;
3353        if (d.detected === 0) {
3354          d.detected = -1;
3355        }
3356        return d;
3357      }}, doc:{$:1, detected:0, version:null, classID:"clsid:CA8A9780-280D-11CF-A24D-444553540000", classID_dummy:"clsid:CA8A9780-280D-11CF-A24D-BA9876543210", DummySpanTagHTML:0, HTML:0, DummyObjTagHTML1:0, DummyObjTagHTML2:0, isDisabled:function() {
3358        var c = this, b = c.$, a = 0;
3359        if (c.detected) {
3360          a = 1;
3361        } else {
3362          if (b.dbug) {
3363          } else {
3364            if (!b.isIE || !b.DOM.isEnabled.objectTag()) {
3365              a = 1;
3366            }
3367          }
3368        }
3369        return a;
3370      }, query:function() {
3371        var i = this, d = i.$, f = i.$$, h = null, a = d.DOM.altHTML, g = null, c = 1, e = 1, b;
3372        if (i.isDisabled()) {
3373          return i;
3374        }
3375        if (!i.DummySpanTagHTML) {
3376          i.DummySpanTagHTML = d.DOM.insert("", [], [], a, f, e);
3377        }
3378        if (!i.HTML) {
3379          i.HTML = d.DOM.insert("object", ["classid", i.classID], [], a, f, e);
3380        }
3381        if (!i.DummyObjTagHTML2) {
3382          i.DummyObjTagHTML2 = d.DOM.insert("object", ["classid", i.classID_dummy], [], a, f, e);
3383        }
3384        b = d.DOM.getTagStatus(i.HTML, i.DummySpanTagHTML, i.DummyObjTagHTML1, i.DummyObjTagHTML2, g, c);
3385        h = f.pluginQuery(i.HTML.obj());
3386        i.detected = b > 0 || h ? 1 : b == -0.1 || b == -0.5 ? -0.5 : -1;
3387        i.version = h ? h : null;
3388        return i;
3389      }}}, realplayer:{$:1, mimeType:["audio/x-pn-realaudio-plugin"], progID:["rmocx.RealPlayer G2 Control", "rmocx.RealPlayer G2 Control.1", "RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)", "RealVideo.RealVideo(tm) ActiveX Control (32-bit)", "RealPlayer"], classID:"clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA", INSTALLED:{}, q1:[[11, 0, 0], [999], [663], [663], [663], [660], [468], [468], [468], [468], [468], [468], [431], [431], [431], [372], [180], [180], [172], [172], [167], [114], [0]], q3:[[6, 
3390      0], [12, 99], [12, 69], [12, 69], [12, 69], [12, 69], [12, 69], [12, 69], [12, 69], [12, 69], [12, 69], [12, 69], [12, 46], [12, 46], [12, 46], [11, 3006], [11, 2806], [11, 2806], [11, 2804], [11, 2804], [11, 2799], [11, 2749], [11, 2700]], compare:function(g, f) {
3391        var e, d = g.length, i = f.length, c, h;
3392        for (e = 0;e < Math.max(d, i);e++) {
3393          c = e < d ? g[e] : 0;
3394          h = e < i ? f[e] : 0;
3395          if (c > h) {
3396            return 1;
3397          }
3398          if (c < h) {
3399            return-1;
3400          }
3401        }
3402        return 0;
3403      }, convertNum:function(a, f, e) {
3404        var g = this, c = g.$, d, b, h, i = null;
3405        if (!a || !(d = c.formatNum(a))) {
3406          return i;
3407        }
3408        d = d.split(c.splitNumRegx);
3409        for (h = 0;h < d.length;h++) {
3410          d[h] = parseInt(d[h], 10);
3411        }
3412        if (g.compare(d.slice(0, Math.min(f[0].length, d.length)), f[0]) != 0) {
3413          return i;
3414        }
3415        b = d.length > f[0].length ? d.slice(f[0].length) : [];
3416        if (g.compare(b, f[1]) > 0 || g.compare(b, f[f.length - 1]) < 0) {
3417          return i;
3418        }
3419        for (h = f.length - 1;h >= 1;h--) {
3420          if (h == 1) {
3421            break;
3422          }
3423          if (g.compare(f[h], b) == 0 && g.compare(f[h], f[h - 1]) == 0) {
3424            break;
3425          }
3426          if (g.compare(b, f[h]) >= 0 && g.compare(b, f[h - 1]) < 0) {
3427            break;
3428          }
3429        }
3430        return e[0].join(".") + "." + e[h].join(".");
3431      }, getVersion:function(m, n) {
3432        var j = this, k = null, c = 0, g = 0, d = j.$, q, i, s, a = j.mimeType[0];
3433        if (d.isString(n)) {
3434          n = n.replace(/\s/g, "");
3435          if (n) {
3436            a = n;
3437          }
3438        } else {
3439          n = null;
3440        }
3441        if (d.isDefined(j.INSTALLED[a])) {
3442          j.installed = j.INSTALLED[a];
3443          return;
3444        }
3445        if (!d.isIE) {
3446          var l = "RealPlayer.*Plug-?in", h = d.hasMimeType(j.mimeType), o = d.findNavPlugin(l, 0);
3447          if (h && o) {
3448            c = 1;
3449            if (n) {
3450              if (d.getMimeEnabledPlugin(n, l)) {
3451                g = 1;
3452              } else {
3453                g = 0;
3454              }
3455            } else {
3456              g = 1;
3457            }
3458          }
3459          if (j.getVersionDone !== 0) {
3460            j.getVersionDone = 0;
3461            if (h) {
3462              var p = 1, b = null, r = null;
3463              s = d.hasMimeType("application/vnd.rn-realplayer-javascript");
3464              if (s) {
3465                b = d.formatNum(d.getNum(s.enabledPlugin.description));
3466              }
3467              if (d.OS == 1 && b) {
3468                var f = b.split(d.splitNumRegx);
3469                r = true;
3470                if (j.compare(f, [6, 0, 12, 200]) < 0) {
3471                  r = false;
3472                } else {
3473                  if (j.compare(f, [6, 0, 12, 1739]) <= 0 && j.compare(f, [6, 0, 12, 857]) >= 0) {
3474                    r = false;
3475                  }
3476                }
3477              }
3478              if (r === false) {
3479                p = 0;
3480              }
3481              if (d.OS <= 2) {
3482                if (d.isGecko && d.compareNums(d.verGecko, d.formatNum("1,8")) < 0) {
3483                  p = 0;
3484                }
3485                if (d.isChrome) {
3486                  p = 0;
3487                }
3488                if (d.isOpera && d.verOpera < 10) {
3489                  p = 0;
3490                }
3491              } else {
3492                p = 0;
3493              }
3494              if (p && d.DOM.isEnabled.objectTag()) {
3495                s = d.DOM.insert("object", ["type", j.mimeType[0]], ["src", "", "autostart", "false", "imagestatus", "false", "controls", "stopbutton"], "", j).obj();
3496                try {
3497                  k = d.getNum(s.GetVersionInfo());
3498                } catch (q) {
3499                }
3500                d.DOM.setStyle(s, ["display", "none"]);
3501              }
3502              if (!k && (b && r === false)) {
3503                s = j.convertNum(b, j.q3, j.q1);
3504                k = s ? s : b;
3505              }
3506            }
3507          } else {
3508            k = j.version;
3509          }
3510          j.installed = c && (g && k) ? 1 : c && g ? 0 : c ? -0.2 : -1;
3511        } else {
3512          s = null;
3513          for (i = 0;i < j.progID.length;i++) {
3514            s = d.getAXO(j.progID[i]);
3515            if (s) {
3516              try {
3517                k = d.getNum(s.GetVersionInfo());
3518                break;
3519              } catch (q) {
3520              }
3521            }
3522          }
3523          j.installed = k ? 1 : -1;
3524        }
3525        if (!j.version) {
3526          j.version = d.formatNum(k);
3527        }
3528        j.INSTALLED[a] = j.installed;
3529      }}, zz:0}};
3530    })();
3531    self = hm.core.HardwareDetect;
3532  })();
3533  (function() {
3534    var self;
3535    (function() {
3536      var dateFormat = {}, dateParse = Date.parse;
3537      dateFormat.parsers = [function(date) {
3538        var found = date.match(/^(\d{4})-(\d{2})-(\d{2})(?:[\sT](\d{1,2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?)?$/);
3539        if (found !== null) {
3540          return new Date(found[1], found[2] - 1, found[3], found[4] || 0, found[5] || 0, found[6] || 0, found[7] || 0);
3541        }
3542        return null;
3543      }, function(date) {
3544        var found = date.match(/^(\d{4})\/(\d{2})\/(\d{2})(?: (\d{1,2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?)?$/);
3545        if (found !== null) {
3546          return new Date(found[1], found[2] - 1, found[3], found[4] || 0, found[5] || 0, found[6] || 0, found[7] || 0);
3547        }
3548        return null;
3549      }, function(date) {
3550        var found = date.match(/^(\d{2})\.(\d{2})\.(\d{4})(?: (\d{1,2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?)?$/);
3551        if (found !== null) {
3552          return new Date(found[3], found[2] - 1, found[1], found[4] || 0, found[5] || 0, found[6] || 0, found[7] || 0);
3553        }
3554        return null;
3555      }, function(date) {
3556        var found = date.match(/^(\d{1,2}):(\d{2})(?::(\d{2}))? (\d{2})\.(\d{2})\.(\d{4})$/);
3557        if (found !== null) {
3558          return new Date(found[6], found[5] - 1, found[4], found[1], found[2], found[3] || 0);
3559        }
3560        return null;
3561      }];
3562      var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g, timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g, timezoneClip = /[^-+\dA-Z]/g, pad = function(val, len) {
3563        val = String(val);
3564        len = len || 2;
3565        while (val.length < len) {
3566          val = "0" + val;
3567        }
3568        return val;
3569      };
3570      HM.define("hm.core.Date", {});
3571      hm.core.Date.getServerTime = function(dt) {
3572        return new Date(dt - HM.clientInitTime + HM.serverInitTime);
3573      };
3574      hm.core.Date.parse = function(date) {
3575        if (date instanceof Date) {
3576          return date;
3577        }
3578        if (typeof date === "number") {
3579          return new Date(date * 1E3);
3580        }
3581        if (date instanceof String) {
3582          date = date.toString();
3583        }
3584        if (typeof date !== "string") {
3585          return NaN;
3586        }
3587        var parsers = dateFormat.parsers, dtTest = null;
3588        for (var i = 0, ln = parsers.length;i < ln;i++) {
3589          dtTest = parsers[i](date);
3590          if (dtTest !== null) {
3591            break;
3592          }
3593        }
3594        if (!dtTest) {
3595          return new Date(dateParse.call(Date, date));
3596        }
3597        return dtTest || NaN;
3598      };
3599      hm.core.Date.format = function(date, mask, utc) {
3600        var dF = dateFormat;
3601        if (arguments.length == 1 && (date instanceof String && !/\d/.test(date))) {
3602          mask = date;
3603          date = undefined;
3604        }
3605        date = date ? new Date(date) : new Date;
3606        if (isNaN(date)) {
3607          return "Invalid Date";
3608        }
3609        mask = String(dF.masks[mask] || (mask || dF.masks["default"]));
3610        if (mask.slice(0, 4) == "UTC:") {
3611          mask = mask.slice(4);
3612          utc = true;
3613        }
3614        var _ = utc ? "getUTC" : "get", d = date[_ + "Date"](), D = date[_ + "Day"](), m = date[_ + "Month"](), y = date[_ + "FullYear"](), H = date[_ + "Hours"](), M = date[_ + "Minutes"](), s = date[_ + "Seconds"](), L = date[_ + "Milliseconds"](), o = utc ? 0 : date.getTimezoneOffset(), flags = {d:d, dd:pad(d), ddd:dF.i18n.dayNames[D], dddd:dF.i18n.dayNames[D + 7], m:m + 1, mm:pad(m + 1), mmm:dF.i18n.monthNames[m], mmmm:dF.i18n.monthNames[m + 12], yy:String(y).slice(2), yyyy:y, h:H % 12 || 12, 
3615        hh:pad(H % 12 || 12), H:H, HH:pad(H), M:M, MM:pad(M), s:s, ss:pad(s), l:pad(L, 3), L:pad(L > 99 ? Math.round(L / 10) : L), t:H < 12 ? "a" : "p", tt:H < 12 ? "am" : "pm", T:H < 12 ? "A" : "P", TT:H < 12 ? "AM" : "PM", Z:utc ? "UTC" : (dateFormat.toString.call(date).match(timezone) || [""]).pop().replace(timezoneClip, ""), o:(o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4), S:["th", "st", "nd", "rd"][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10]};
3616        return mask.replace(token, function($0) {
3617          return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1);
3618        });
3619      };
3620      hm.core.Date.getToday = function() {
3621        var today = new Date;
3622        today.setHours(0, 0, 0, 0);
3623        return today;
3624      };
3625      hm.core.Date.getTomorrow = function() {
3626        var tomorrow = this.getToday();
3627        tomorrow.setDate(tomorrow.getDate() + 1);
3628        return tomorrow;
3629      };
3630      hm.core.Date.addMonth = function(date, monthOffset) {
3631        var newDate = new Date(date.getTime());
3632        newDate.setMonth(newDate.getMonth() + monthOffset);
3633        if (newDate.getDate() < date.getDate()) {
3634          newDate.setDate(0);
3635        }
3636        return newDate;
3637      };
3638      dateFormat.masks = {"default":"yyyy-mm-dd HH:MM:ss.l", shortDate:"m/d/yy", mediumDate:"mmm d, yyyy", longDate:"mmmm d, yyyy", fullDate:"dddd, mmmm d, yyyy", shortTime:"h:MM TT", mediumTime:"h:MM:ss TT", longTime:"h:MM:ss TT Z", isoDate:"yyyy-mm-dd", isoTime:"HH:MM:ss", isoDateTime:"yyyy-mm-dd'T'HH:MM:ss", isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"};
3639      dateFormat.i18n = {dayNames:[HM._("Вс"), HM._("Пн"), HM._("Вт"), HM._("Ср"), HM._("Чт"), HM._("Пт"), HM._("Сб"), HM._("Воскресенье"), HM._("Понедельник"), HM._("Вторник"), HM._("Среда"), HM._("Четверг"), HM._("Пятница"), 
3640      HM._("Суббота")], monthNames:[HM._("Янв"), HM._("Фев"), HM._("Мар"), HM._("Апр"), HM._("Май"), HM._("Июн"), HM._("Июл"), HM._("Авг"), HM._("Сен"), HM._("Окт"), HM._("Ноя"), HM._("Дек"), HM._("Январь"), HM._("Февраль"), 
3641      HM._("Март"), HM._("Апрель"), HM._("Май"), HM._("Июнь"), HM._("Июль"), HM._("Август"), HM._("Сентябрь"), HM._("Октябрь"), HM._("Ноябрь"), HM._("Декабрь")]};
3642      hm.core.Date.getMonthNames = function() {
3643        var rusMonthNames = dateFormat.i18n.monthNames.slice(12, 24), result = [];
3644        for (var i = 0, ln = rusMonthNames.length;i < ln;i++) {
3645          result.push(HM._(rusMonthNames[i]));
3646        }
3647        return result;
3648      };
3649      if (!Date.now) {
3650        hm.core.Date.now = function() {
3651          return(new Date).getTime();
3652        };
3653      } else {
3654        hm.core.Date.now = Date.now.bind(Date);
3655      }
3656    })();
3657    self = hm.core.Date;
3658  })();
3659  (function() {
3660    var self;
3661    function Url(cfg) {
3662      if (!cfg.module) {
3663        throw Error("Для url не указан модуль");
3664      }
3665      if (!cfg.controller) {
3666        cfg.controller = "index";
3667      }
3668      if (!cfg.action) {
3669        cfg.action = "index";
3670      }
3671      var module = cfg.module, controller = cfg.controller, action = cfg.action, app = cfg.app;
3672      var url = "", additionalParams = "";
3673      for (var i in cfg) {
3674        if (!cfg.hasOwnProperty(i) || (i == "app" || (i == "module" || (i == "controller" || i == "action")))) {
3675          continue;
3676        }
3677        additionalParams += "/" + encodeURI(i) + "/" + encodeURI(cfg[i]);
3678      }
3679      if (app) {
3680        url += "/" + app;
3681      }
3682      if (controller === "index" && (action === "index" && (module && additionalParams === ""))) {
3683        url += "/" + encodeURI(module);
3684      } else {
3685        url += "/" + encodeURI(module) + "/" + encodeURI(controller) + "/" + encodeURI(action);
3686      }
3687      url += additionalParams;
3688      return url;
3689    }
3690    Url.getSearchParams = function(url) {
3691      var urlInfo = hm.core.Url.getInfo(url), result = {};
3692      if (urlInfo.search === undefined) {
3693        return result;
3694      }
3695      var params = decodeURIComponent(urlInfo.search.substr(1)).split("&");
3696      for (var i = 0, ln = params.length;i < ln;i++) {
3697        var param = params[i].split("=");
3698        result[param[0]] = param[1];
3699      }
3700      return result;
3701    };
3702    Url.getInfo = function(url) {
3703      if (this._urlInfo === undefined) {
3704        this._urlInfo = [];
3705      }
3706      if (this._urlInfo[url] !== undefined) {
3707        return this._urlInfo[url];
3708      }
3709      if (this._urlInfoRegexp === undefined) {
3710        this._urlInfoRegexp = new RegExp(["^(https?:)//", "(([^:/?#]*)(?::([0-9]+))?)", "(/[^?#]*)", "(\\?[^#]*|)?", "(#.*|)?$"].join(""));
3711        this._urlInfoRegexpSimple = new RegExp(["(/[^?#]*)", "(\\?[^#]*|)?", "(#.*|)?$"].join(""));
3712      }
3713      var result;
3714      if (url[0] === "/") {
3715        result = url.match(this._urlInfoRegexpSimple);
3716        result = [url, location.protocol, location.host, location.hostname, location.port, result[1], result[2], result[3]];
3717      } else {
3718        result = url.match(this._urlInfoRegexp);
3719      }
3720      result = {url:result[0], protocol:result[1], host:result[2], hostname:result[3], port:result[4], pathname:result[5], search:result[6], hash:result[7]};
3721      this._urlInfo[url] = result;
3722      return result;
3723    };
3724    Url.getInstance = function() {
3725      return Url;
3726    };
3727    Url.url = Url;
3728    hm.core.ClassManager.classAlias("hm.core.Url", Url);
3729    self = hm.core.Url;
3730  })();
3731  (function() {
3732    var self;
3733    HM.define("hm.core.BaseService", {});
3734    (function() {
3735      var serviceList = {}, services = {};
3736      hm.core.BaseService.get = function(serviceName) {
3737        if (!serviceList.hasOwnProperty(serviceName)) {
3738          serviceList[serviceName] = "hm.module." + serviceName.toLowerCase() + ".service." + serviceName + "Service";
3739        }
3740        if (!services.hasOwnProperty(serviceName)) {
3741          services[serviceName] = HM.create(serviceList[serviceName]);
3742        }
3743        return services[serviceName];
3744      };
3745      hm.core.BaseService.registerServices = function(services) {
3746        for (var serviceCode in services) {
3747          if (!services.hasOwnProperty(serviceCode)) {
3748            continue;
3749          }
3750          serviceList[serviceCode] = services[serviceCode];
3751        }
3752      };
3753    })();
3754    self = hm.core.BaseService;
3755  })();
3756  (function() {
3757    var self;
3758    HM.define("hm.core.Application", {extend:"hm.core.ObservableClass", CORE_DISABLE_AJAX_SPINNER:false, CORE_DISABLE_DEBUG_PANEL:false, CORE_DISABLE_NEW_GRID:false, ES_DISABLE_EVENT_TOOLBAR:false, __construct:function() {
3759      var __construct = arguments.callee;
3760      this.callParent(__construct, arguments);
3761      this._registerServices();
3762      this._initNow();
3763      $(this._initOnReady.bind(this));
3764    }, _registerServices:function() {
3765      hm.core.BaseService.registerServices({CourseLesson:"hm.module.course.service.lesson.LessonService", CourseMaterialService:"hm.module.course.service.material.MaterialService"});
3766    }, _initNow:function() {
3767      this._initAjaxSpinner();
3768    }, _initOnReady:function() {
3769      this._initDebugPanel();
3770      this._initEventToolbar();
3771      this.fireEvent("ready", this);
3772    }, _initAjaxSpinner:function() {
3773      if (this.CORE_DISABLE_AJAX_SPINNER) {
3774        return;
3775      }
3776      hm.module.base.ui.ajax.AjaxSpinner.getInstance();
3777    }, _initDebugPanel:function() {
3778      if (this.CORE_DISABLE_DEBUG_PANEL) {
3779        return;
3780      }
3781      if (!hm.debugAllowed) {
3782        return;
3783      }
3784      HM.$document().on("keydown", function(e) {
3785        if (!(e.altKey && (e.ctrlKey && (e.shiftKey && e.keyCode === 68)))) {
3786          return;
3787        }
3788        HM.require("hm.module.develop.ui.panel.DevPanel").getInstance().show();
3789      });
3790    }, _initEventToolbar:function() {
3791      if (this.ES_DISABLE_EVENT_TOOLBAR) {
3792        return;
3793      }
3794      if (!HM.moduleExists("es")) {
3795        return;
3796      }
3797      if (HM.getService("User").isGuest()) {
3798        return;
3799      }
3800      HM.create("hm.module.es.ui.event.toolbar.EventToolbar");
3801    }});
3802    self = hm.core.Application;
3803  })();
3804  (function() {
3805    var self;
3806    HM.define("hm.core.Cookie", {statics:{get:function(name) {
3807      var matches = document.cookie.match(new RegExp("(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, "\\$1") + "=([^;]*)"));
3808      return matches ? decodeURIComponent(matches[1]) : undefined;
3809    }, set:function(name, value, options) {
3810      options = options || {};
3811      if (!options.hasOwnProperty("path")) {
3812        options.path = "/";
3813      }
3814      var expires = options.expires;
3815      if (typeof expires == "number" && expires) {
3816        var d = new Date;
3817        d.setTime(d.getTime() + expires * 1E3);
3818        expires = options.expires = d;
3819      }
3820      if (expires && expires.toUTCString) {
3821        options.expires = expires.toUTCString();
3822      }
3823      value = encodeURIComponent(value);
3824      var updatedCookie = name + "=" + value;
3825      for (var propName in options) {
3826        updatedCookie += "; " + propName;
3827        var propValue = options[propName];
3828        if (propValue !== true) {
3829          updatedCookie += "=" + propValue;
3830        }
3831      }
3832      document.cookie = updatedCookie;
3833    }, "delete":function(name) {
3834      this.set(name, "", {expires:-1});
3835    }}});
3836    self = hm.core.Cookie;
3837  })();
3838  (function() {
3839    var self;
3840    HM.define("hm.core.Event", {config:{target:null, name:"", listeners:{}, args:[]}, __construct:function() {
3841      var __construct = arguments.callee;
3842      this.callParent(__construct, arguments);
3843      this._prevented = false;
3844    }, fire:function() {
3845      var listeners = this.config.listeners, args = this.config.args, lastIndex = args.length;
3846      args.unshift(this);
3847      for (var i = 0, len = listeners.length;i < len;i++) {
3848        var listener = listeners[i];
3849        args[lastIndex + 1] = listener.cfg;
3850        listener.fn.apply(listener.scope, args);
3851      }
3852      return this;
3853    }, preventDefault:function() {
3854      this._prevented = true;
3855    }, isPrevented:function() {
3856      return this._prevented;
3857    }, getTarget:function() {
3858      return this.config.target;
3859    }});
3860    self = hm.core.Event;
3861  })();
3862  (function() {
3863    var self;
3864    HM.define("hm.core.Info", {statics:{getSimpleInfo:function() {
3865      var compilationInfo = hm.compilationInfo, buildConfig = compilationInfo.config, info = ["============= Фронтэнд ============", "    Проект: " + buildConfig.project, "    Версия: " + HM.build, "    Дата:   " + hm.core.Date.format(compilationInfo.time, "yyyy-mm-dd HH:MM:ss"), "==================================="];
3866      return info.join("\n");
3867    }, getBuildInfo:function() {
3868      var parts = hm.compilationInfo.config.parts, partNames = ["base", "modules", "projects"], result = [];
3869      for (var i = 0;i < partNames.length;i++) {
3870        var part = parts[partNames[i]];
3871        result.push("============= " + partNames[i] + " =============");
3872        for (var j = 0;j < part.length;j++) {
3873          var module = part[j];
3874          if (!module.enabled) {
3875            continue;
3876          }
3877          result.push(module.name + ": " + module.version);
3878        }
3879      }
3880      return result.join("\n");
3881    }}});
3882    self = hm.core.Info;
3883  })();
3884  (function() {
3885    var self;
3886    HM.define("hm.core.Collection", {extend:"hm.core.ObservableClass", config:{data:null}, __construct:function() {
3887      this.models = [];
3888      if (this.config.data) {
3889        var data = this.config.data;
3890        for (var i = 0, ln = data.length;i < ln;i++) {
3891          this.add(data[i]);
3892        }
3893      }
3894    }, add:function(data) {
3895      this.models.push(HM.create("hm.core.data.Model", {data:data}));
3896    }, length:function() {
3897      return this.models.length;
3898    }, find:function(fieldName, value) {
3899      var models = this.models, ln = models.length;
3900      for (var i = 0;i < ln;i++) {
3901        if (models[i].get(fieldName) === value) {
3902          return models[i];
3903        }
3904      }
3905      return null;
3906    }});
3907    self = hm.core.Collection;
3908  })();
3909  (function() {
3910    var self;
3911    var filters = {};
3912    HM.define("hm.core.data.filter.AbstractFilter", {extend:"hm.core.ObservableClass", config:{type:"", field:"", clean:false}, statics:{register:function(constructor) {
3913      filters[constructor.prototype.config.type] = constructor;
3914    }, factory:function(cfg) {
3915      var type = cfg.type;
3916      if (!filters.hasOwnProperty(type)) {
3917        throw new Error("Фильтр с типом " + type + " не зарегистрирован");
3918      }
3919      return new filters[type](cfg);
3920    }}, _filter:function(data) {
3921      return true;
3922    }, filter:function(data) {
3923      if (this.config.clean) {
3924        return true;
3925      }
3926      if (this.config.field) {
3927        if (data instanceof hm.core.data.Model) {
3928          data = data.get(this.config.field);
3929        } else {
3930          data = data[this.config.field];
3931        }
3932      }
3933      return this._filter(data);
3934    }, clear:function() {
3935      this.config.clean = true;
3936      this.fireEvent("change", this);
3937    }});
3938    self = hm.core.data.filter.AbstractFilter;
3939  })();
3940  (function() {
3941    var self;
3942    HM.define("hm.core.data.filter.CallbackFilter", {extend:"hm.core.data.filter.AbstractFilter", config:{type:"callback", fn:function(data) {
3943      return true;
3944    }}, _filter:function(data) {
3945      return this.config.fn(data);
3946    }});
3947    hm.core.data.filter.AbstractFilter.register(hm.core.data.filter.CallbackFilter);
3948    self = hm.core.data.filter.CallbackFilter;
3949  })();
3950  (function() {
3951    var self;
3952    HM.define("hm.core.data.filter.EqualFilter", {extend:"hm.core.data.filter.AbstractFilter", config:{type:"equal", value:""}, _filter:function(data) {
3953      return data == this.config.value;
3954    }, setValue:function(value) {
3955      if (!this.config.clean && value === this.config.value) {
3956        return;
3957      }
3958      this.config.clean = false;
3959      this.config.value = value;
3960      this.fireEvent("change", this, value);
3961    }});
3962    hm.core.data.filter.AbstractFilter.register(hm.core.data.filter.EqualFilter);
3963    self = hm.core.data.filter.EqualFilter;
3964  })();
3965  (function() {
3966    var self;
3967    HM.define("hm.core.data.filter.LikeFilter", {extend:"hm.core.data.filter.AbstractFilter", config:{type:"like", value:""}, _filter:function(data) {
3968      if (typeof data !== "string") {
3969        data = data + "";
3970      }
3971      var value = this.config.value;
3972      if (!value) {
3973        return true;
3974      }
3975      return data.toLowerCase().search(value.toLowerCase()) !== -1;
3976    }, setValue:function(value) {
3977      if (!this.config.clean && value === this.config.value) {
3978        return;
3979      }
3980      this.config.clean = false;
3981      this.config.value = value;
3982      this.fireEvent("change", this, value);
3983    }});
3984    hm.core.data.filter.AbstractFilter.register(hm.core.data.filter.LikeFilter);
3985    self = hm.core.data.filter.LikeFilter;
3986  })();
3987  (function() {
3988    var self;
3989    HM.define("hm.core.data.filter.MultiFilter", {extend:"hm.core.data.filter.AbstractFilter", config:{type:"multi", filters:null}, __construct:function() {
3990      var __construct = arguments.callee;
3991      this.callParent(__construct, arguments);
3992      var filters = this.config.filters, newFilters = [];
3993      for (var i = 0, ln = filters.length;i < ln;i++) {
3994        var filter = filters[i];
3995        if (!(filter instanceof hm.core.data.filter.AbstractFilter)) {
3996          filter = hm.core.data.filter.AbstractFilter.factory(filter);
3997        }
3998        newFilters.push(filter);
3999      }
4000      this._filters = newFilters;
4001    }, filter:function(data) {
4002      var filters = this._filters;
4003      for (var i = 0, ln = filters.length;i < ln;i++) {
4004        if (!filters[i].filter(data)) {
4005          return false;
4006        }
4007      }
4008      return true;
4009    }});
4010    hm.core.data.filter.AbstractFilter.register(hm.core.data.filter.MultiFilter);
4011    self = hm.core.data.filter.MultiFilter;
4012  })();
4013  (function() {
4014    var self;
4015    HM.define("hm.core.String", {statics:{printf:function(string, obj) {
4016      var useArguments = false;
4017      var _arguments = Array.prototype.slice.call(arguments, 1);
4018      var i = -1;
4019      if (typeof _arguments[0] == "string") {
4020        useArguments = true;
4021      }
4022      if (obj instanceof Array || useArguments) {
4023        return string.replace(/\%s/g, function(a, b) {
4024          i++;
4025          if (useArguments) {
4026            if (typeof _arguments[i] == "string") {
4027              return _arguments[i];
4028            } else {
4029              throw new Error("Arguments element is an invalid type");
4030            }
4031          }
4032          return obj[i];
4033        });
4034      } else {
4035        return string.replace(/{([^{}]*)}/g, function(a, b) {
4036          var r = obj[b];
4037          return typeof r === "string" || typeof r === "number" ? r : a;
4038        });
4039      }
4040    }, dayString:function(digit) {
4041      var lastFigure = digit % 10;
4042      if (digit > 11 && digit < 15) {
4043        return HM._("дней");
4044      } else {
4045        if (lastFigure == 1) {
4046          return HM._("день");
4047        }
4048        if (lastFigure > 1 && lastFigure < 5 || lastFigure > 0 && lastFigure < 1) {
4049          return HM._("дня");
4050        }
4051        if (lastFigure == 0 || lastFigure >= 5) {
4052          return HM._("дней");
4053        }
4054      }
4055    }}});
4056    self = hm.core.String;
4057  })();
4058  (function() {
4059    var self;
4060    HM.define("hm.core.ZIndexManager", {singleton:true, getMaxZIndexOfTheChildren:function(el) {
4061      var children = el.children, ln = children.length, hmDOM = hm.core.DOM, result = 0, child, style, position, testIndex;
4062      for (var i = 0;i < ln;i++) {
4063        child = children[i];
4064        style = hmDOM.getComputedStyle(child);
4065        if (style.display === "none") {
4066          continue;
4067        }
4068        if (style.visibility === "hidden") {
4069          continue;
4070        }
4071        position = style.position;
4072        if (position === "absolute" || position === "fixed") {
4073          testIndex = style.zIndex;
4074          if (testIndex !== "auto") {
4075            testIndex = testIndex - 0;
4076            if (result < testIndex) {
4077              result = testIndex;
4078            }
4079            continue;
4080          }
4081        }
4082        if (style.hasOwnProperty) {
4083          if (style.hasOwnProperty("opacity")) {
4084            if (style.opacity < 1) {
4085              continue;
4086            }
4087          }
4088        }
4089        try {
4090          testIndex = this.getMaxZIndexOfTheChildren(child);
4091        } catch (e) {
4092          testIndex = 1E4;
4093        }
4094        if (result < testIndex) {
4095          result = testIndex;
4096        }
4097      }
4098      return result;
4099    }, getMaxZIndex:function() {
4100      try {
4101        return this.getMaxZIndexOfTheChildren(document.body);
4102      } catch (e) {
4103        return 1E4;
4104      }
4105    }});
4106    self = hm.core.ZIndexManager;
4107  })();
4108  (function() {
4109    var self;
4110    HM.define("hm.core.data.reader.AbstractReader", {config:{dataProperty:"data", totalProperty:"total", successProperty:"success", messageProperty:"message", type:"json"}, read:function(data) {
4111    }});
4112    hm.core.data.reader.AbstractReader.factory = hm.core.ClassManager.createFactory("type", {json:"hm.core.data.reader.JsonReader", simple_json:"hm.core.data.reader.SimpleJsonReader"});
4113    self = hm.core.data.reader.AbstractReader;
4114  })();
4115  (function() {
4116    var self;
4117    HM.define("hm.core.data.proxy.AbstractProxy", {extend:"hm.core.ObservableClass", requires:["hm.core.data.reader.AbstractReader"], config:{reader:"json", model:"hm.core.data.Model", async:true, type:"xhr", data:null}, __construct:function() {
4118      var __construct = arguments.callee;
4119      this.callParent(__construct, arguments);
4120      var reader = this.config.reader;
4121      if (typeof reader === "string") {
4122        reader = {type:reader};
4123      } else {
4124        reader = reader || {type:"json"};
4125      }
4126      this._reader = hm.core.data.reader.AbstractReader.factory(reader);
4127    }, filter:function(filter) {
4128    }, createItems:function(data) {
4129      var items = [], modelClass = this.config.model;
4130      if (!data || !data.length) {
4131        return items;
4132      }
4133      for (var i = 0;i < data.length;i++) {
4134        var item;
4135        if (data[i] instanceof eval(modelClass)) {
4136          item = data[i];
4137        } else {
4138          item = HM.create(modelClass, {data:data[i]});
4139        }
4140        items.push(item);
4141      }
4142      return items;
4143    }, read:function(offset, limit, params) {
4144    }, readMore:function(offset, limit, params) {
4145    }});
4146    hm.core.data.proxy.AbstractProxy.factory = hm.core.ClassManager.createFactory("type", {xhr:"hm.core.data.proxy.XhrProxy", memory:"hm.core.data.proxy.MemoryProxy"});
4147    self = hm.core.data.proxy.AbstractProxy;
4148  })();
4149  (function() {
4150    var self;
4151    HM.define("hm.core.data.proxy.MemoryProxy", {extend:"hm.core.data.proxy.AbstractProxy", config:{}, setData:function(data) {
4152      this.config.data = data;
4153      if (this._lastReadingParams) {
4154      }
4155    }, read:function(offset, limit, params, method) {
4156      var data = this.config.data;
4157      if (offset !== null && limit !== null) {
4158        data = data.splice(offset, limit);
4159      }
4160      if (this.config.async) {
4161        setTimeout(this._onTimeout.bind(this, data, method), 0);
4162      } else {
4163        this._onTimeout(data, method);
4164      }
4165      this._lastReadingParams = arguments;
4166    }, _onTimeout:function(data, method) {
4167      data = this._reader.read(data);
4168      data.items = this.createItems(data.items);
4169      data.total = data.length;
4170      this.fireEvent("data_loaded", data, method);
4171    }});
4172    self = hm.core.data.proxy.MemoryProxy;
4173  })();
4174  (function() {
4175    var self;
4176    HM.define("hm.core.data.proxy.XhrProxy", {extend:"hm.core.data.proxy.AbstractProxy", config:{url:"", method:"get", cache:false, async:true, params:null, offsetProperty:"offset", limitProperty:"limit"}, __construct:function() {
4177      var __construct = arguments.callee;
4178      this.callParent(__construct, arguments);
4179    }, read:function(offset, limit, additionalParams, returnData) {
4180      var params = this.config.params || {};
4181      additionalParams = additionalParams || {};
4182      params = $.extend({}, params, additionalParams);
4183      if (offset !== null && limit !== null) {
4184        params[this.config.offsetProperty] = offset;
4185        params[this.config.limitProperty] = limit;
4186      }
4187      $.ajax({url:this.config.url, type:this.config.method, data:params, cache:this.config.cache, async:this.config.async, success:this._onXhrRequestSuccess.bind(this, returnData)});
4188    }, _onXhrRequestSuccess:function(returnData, data, textStatus, jqXHR) {
4189      var readData = this._reader.read(data);
4190      readData.items = this.createItems(readData.items);
4191      this.fireEvent("data_loaded", readData, returnData);
4192    }});
4193    self = hm.core.data.proxy.XhrProxy;
4194  })();
4195  (function() {
4196    var self;
4197    HM.define("hm.core.data.reader.JsonReader", {extend:"hm.core.data.reader.AbstractReader", read:function(data) {
4198      var Obj = hm.core.Object;
4199      return{items:Obj.getProperty(this.config.dataProperty, data), total:Obj.getProperty(this.config.totalProperty, data), success:Obj.getProperty(this.config.successProperty, data), message:Obj.getProperty(this.config.messageProperty, data), source:data};
4200    }});
4201    self = hm.core.data.reader.JsonReader;
4202  })();
4203  (function() {
4204    var self;
4205    HM.define("hm.core.data.reader.SimpleJsonReader", {extend:"hm.core.data.reader.AbstractReader", read:function(data) {
4206      return{items:data, total:data.length, success:true, message:"ok", source:data};
4207    }});
4208    self = hm.core.data.reader.SimpleJsonReader;
4209  })();
4210  (function() {
4211    var self;
4212    HM.define("hm.core.env.Browser", {statics:{isIE:function(majorVersion) {
4213      return this.is("explorer", majorVersion);
4214    }, isChrome:function(majorVersion) {
4215      return this.is("chrome", majorVersion);
4216    }, isOpera:function(majorVersion) {
4217      return this.is("opera", majorVersion);
4218    }, isSafari:function(majorVersion) {
4219      return this.is("safari", majorVersion);
4220    }, isFirefox:function(majorVersion) {
4221      return this.is("firefox", majorVersion);
4222    }, isWebKit:function() {
4223      return this.isChrome() || (this.isSafari() || (this.isOpera() || this.is("webkit")));
4224    }, is:function(name, majorVersion) {
4225      var info = this.detect(), result = info.name === name;
4226      if (!result || majorVersion === undefined) {
4227        return result;
4228      }
4229      return info.version.major == majorVersion;
4230    }, detect:function() {
4231      var browser = this._searchString(this._dataBrowser) || "EU_UNKNOWN_BROWSER", ver = this._searchVersion(navigator.userAgent) || this._searchVersion(navigator.appVersion);
4232      if (!ver) {
4233        ver = HM.create("hm.core.env.Version", {version:[0, 0, 0]});
4234      }
4235      var result = {name:browser.toLowerCase(), appName:browser, version:ver};
4236      this.detect = function() {
4237        return result;
4238      };
4239      return result;
4240    }, _searchString:function(data) {
4241      for (var i = 0;i < data.length;i++) {
4242        var dataItem = data[i], dataString = dataItem.string, dataProp = dataItem.prop;
4243        this.versionSearchString = dataItem.versionSearch || dataItem.identity;
4244        if (dataString) {
4245          if (dataString.indexOf(dataItem.subString) != -1) {
4246            return dataItem.identity;
4247          }
4248        } else {
4249          if (dataProp) {
4250            return dataItem.identity;
4251          }
4252        }
4253      }
4254    }, _searchVersion:function(dataString) {
4255      var index = dataString.indexOf(this.versionSearchString);
4256      if (index == -1) {
4257        return HM.create("hm.core.env.Version", {version:[0, 0, 0]});
4258      }
4259      return HM.create("hm.core.env.Version", {version:dataString.substring(index + this.versionSearchString.length + 1).split(".")});
4260    }, _dataBrowser:[{string:navigator.vendor, subString:"Apple", identity:"Safari"}, {string:navigator.userAgent, subString:"Chrome", identity:"Chrome"}, {prop:window.opera, identity:"Opera"}, {string:navigator.vendor, subString:"Konqueror", identity:"Konqueror"}, {string:navigator.userAgent, subString:"Firefox", identity:"Firefox"}, {string:navigator.userAgent, subString:"SeaMonkey", identity:"SeaMonkey"}, {string:navigator.vendor, subString:"Camino", identity:"Camino"}, {string:navigator.userAgent, 
4261    subString:"Netscape", identity:"Netscape"}, {string:navigator.userAgent, subString:"MSIE", identity:"Explorer", versionSearch:"MSIE"}, {string:navigator.userAgent, subString:"Trident", identity:"Explorer", versionSearch:"rv"}, {string:navigator.userAgent, subString:"Gecko", identity:"Mozilla", versionSearch:"rv"}, {string:navigator.userAgent, subString:"AppleWebKit", identity:"Webkit", versionSearch:"AppleWebKit"}]}});
4262    self = hm.core.env.Browser;
4263  })();
4264  (function() {
4265    var self;
4266    HM.define("hm.core.env.MsXml", {statics:{_progIDs:[{ID:"Msxml2.DOMDocument.6.0", version:[6, 0, 0]}, {ID:"Msxml2.DOMDocument.3.0", version:[3, 0, 0]}, {ID:"Msxml2.DOMDocument.4.0", version:[4, 0, 0]}, {ID:"Msxml2.DOMDocument.5.0", version:[5, 0, 0]}], detect:function() {
4267      var progIDs = this._progIDs, version = [0, 0, 0];
4268      for (var i = 0;i < progIDs.length;++i) {
4269        var progID = progIDs[i];
4270        try {
4271          new ActiveXObject(progID.ID);
4272          version = progID.version;
4273          break;
4274        } catch (e) {
4275        }
4276      }
4277      var result = HM.create("hm.core.env.Version", {version:version});
4278      this.detect = function() {
4279        return result;
4280      };
4281      return result;
4282    }}});
4283    self = hm.core.env.MsXml;
4284  })();
4285  (function() {
4286    var self;
4287    HM.define("hm.core.env.OS", {statics:{_osPatterns:{"Windows 2000":/Windows NT 5\.0/, "Windows XP":/Windows NT 5\.1/, "Windows Server 2003":/Windows NT 5\.2/, "Windows Vista":/Windows NT 6\.0/, "Windows 7":/Windows NT 6\.1/, "Windows 8":/Windows NT 6\.2/, "Windows 8.1":/Windows NT 6\.3/, "Windows":/Windows/}, detect:function() {
4288      var userAgent = navigator.userAgent, result = "Unknown", patterns = this._osPatterns;
4289      for (var osName in patterns) {
4290        if (!patterns.hasOwnProperty(osName)) {
4291          continue;
4292        }
4293        var pattern = patterns[osName];
4294        if (pattern.test(userAgent)) {
4295          result = osName;
4296          break;
4297        }
4298      }
4299      this.detect = function() {
4300        return result;
4301      };
4302      return result;
4303    }}});
4304    self = hm.core.env.OS;
4305  })();
4306  (function() {
4307    var self;
4308    HM.define("hm.core.env.Version", {config:{version:null}, major:-1, minor:-1, rev:-1, __construct:function() {
4309      var versionArray = this.config.version;
4310      this.major = versionArray[0] != null ? parseInt(versionArray[0], 10) : 0;
4311      this.minor = versionArray[1] != null ? parseInt(versionArray[1], 10) : 0;
4312      this.rev = versionArray[2] != null ? parseInt(versionArray[2], 10) : 0;
4313    }, compare:function(flashVersion) {
4314      if (this.major < flashVersion.major) {
4315        return-1;
4316      }
4317      if (this.major > flashVersion.major) {
4318        return 1;
4319      }
4320      if (this.minor < flashVersion.minor) {
4321        return-1;
4322      }
4323      if (this.minor > flashVersion.minor) {
4324        return 1;
4325      }
4326      if (this.rev < flashVersion.rev) {
4327        return-1;
4328      }
4329      if (this.rev > flashVersion.rev) {
4330        return 1;
4331      }
4332      return 0;
4333    }, toString:function() {
4334      return[this.major, this.minor, this.rev].join(".");
4335    }});
4336    self = hm.core.env.Version;
4337  })();
4338  (function() {
4339    var self;
4340    HM.define("hm.core.jQuery", {singleton:true, __construct:function() {
4341      var jQueryFn = jQuery.fn, methods = ["andSelf", "die", "error", "live", "load", "size", "toggle", "unload"], comments = {andSelf:"Используйте .addBack().", live:'Используйте $(d
4341ocument).on("eventName", "selector", "handler").', error:'Используйте .on("error", handler).', load:'Используйте .on("load", handler)', 
4342      unload:'Используйте .on("unload", handler)'};
4343      this._initAddBack(jQueryFn);
4344      if (!HM.isDebug) {
4345        return;
4346      }
4347      this._initCurCSS();
4348      for (var i = 0, ln = methods.length;i < ln;i++) {
4349        var methodName = methods[i], method = jQueryFn[methodName];
4350        if (!method) {
4351          continue;
4352        }
4353        (function(methodName, method) {
4354          var message = "Метод jQuery." + methodName + "() устарел!";
4355          if (comments.hasOwnProperty(methodName)) {
4356            message += " " + comments[methodName];
4357          }
4358          jQueryFn[methodName] = function() {
4359            console.warn(message);
4360            return method.apply(this, arguments);
4361          };
4362        })(methodName, method);
4363      }
4364    }, _initAddBack:function(jQueryFn) {
4365      if (jQueryFn.hasOwnProperty("addBack")) {
4366        return;
4367      }
4368      jQueryFn.addBack = jQueryFn.andSelf;
4369    }
4369, _initCurCSS:function() {
4370      jQuery.curCSS = function() {
4371        console.warn("Вызов устаревшего метода jQuery.curCSS(). Используйте jQuery.css()");
4372        return jQuery.css.apply(this, arguments);
4373      };
4374    }, _errorStack:function() {
4375      var e = new Error;
4376    }, uiVersionIsGreaterThan:function(major, minor) {
4377      var version = $.ui.version.split(".");
4378      return major == version[0] && version[1] >= minor || version[0] > major;
4379    }});
4380    self = hm.core.jQuery;
4381  })();
4382  (function() {
4383    var self;
4384    HM.define("hm.core.template.Template", {statics:{_templates:{}, _clear:function(tpl) {
4385      var tplLines = tpl.split("\n");
4386      for (var i = 0;i < tplLines.length;i++) {
4387        tplLines[i] = tplLines[i].trim();
4388      }
4389      return tplLines.join("");
4390    }, _compile:function(fileName) {
4391      var templates = this._templates, tpl = templates[fileName];
4392      if (typeof tpl === "string") {
4393        tpl = templates[fileName] = Handlebars.compile(tpl);
4394      }
4395      return tpl;
4396    }, register:function(fileName, tpl) {
4397      if (typeof tpl === "function") {
4398        tpl = Handlebars.template(tpl);
4399      }
4400      this._templates[fileName] = tpl;
4401    }, registered:function(fileName) {
4402      return this._templates.hasOwnProperty(fileName);
4403    }, get:function(fileName) {
4404      if (!this.registered(fileName)) {
4405        throw new Error('Шаблон "' + fileName + '" не найден');
4406      }
4407      return this._compile(fileName);
4408    }, render:function(tplCode, viewData) {
4409      var tpl = this.get(tplCode + ".hbs");
4410      return tpl(viewData, {data:{tpl:tplCode}});
4411    }, resolveTemplateName:function(parentTplPath, path) {
4412      var currentPlace = parentTplPath.split("/"), parentTplName = currentPlace.pop(), pathParts = path.split("/");
4413      for (var i = 0, ln = pathParts.length;i < ln;i++) {
4414        var pathPart = pathParts[i];
4415        switch(pathPart) {
4416          case ".":
4417            currentPlace.push(parentTplName);
4418            break;
4419          case "..":
4420            currentPlace.pop();
4421            break;
4422          default:
4423            currentPlace.push(pathPart);
4424        }
4425      }
4426      return currentPlace.join("/");
4427    }}});
4428    self = hm.core.template.Template;
4429  })();
4430  (function(Template) {
4431    var registerTemplate = Template.register.bind(Template);
4432    registerTemplate("hm/core/ui/autocomplete/Autocomplete.hbs", function(Handlebars, depth0, helpers, partials, data) {
4433      this.compilerInfo = [4, ">= 1.0.0"];
4434      helpers = this.merge(helpers, Handlebars.helpers);
4435      data = data || {};
4436      var buffer = "", stack1, functionType = "function", escapeExpression = this.escapeExpression, self = this;
4437      function program1(depth0, data) {
4438        var buffer = "", stack1;
4439        buffer += escapeExpression((stack1 = data == null || data === false ? data : data.key, typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '="' + escapeExpression(typeof depth0 === functionType ? depth0.apply(depth0) : depth0) + '"';
4440        return buffer;
4441      }
4442      buffer += '<div class="hm-autocomplete"><input type="text" placeholder="' + escapeExpression((stack1 = (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.placeholder), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '" value="' + escapeExpression((stack1 = (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.value), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '" ';
4443      stack1 = helpers.each.call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.inputAttr), {hash:{}, inverse:self.noop, fn:self.program(1, program1, data), data:data});
4444      if (stack1 || stack1 === 0) {
4445        buffer += stack1;
4446      }
4447      buffer += " /></div>";
4448      return buffer;
4449    });
4450    registerTemplate("hm/core/ui/autocomplete/search/Search.hbs", function(Handlebars, depth0, helpers, partials, data) {
4451      this.compilerInfo = [4, ">= 1.0.0"];
4452      helpers = this.merge(helpers, Handlebars.helpers);
4453      data = data || {};
4454      var buffer = "", stack1, functionType = "function", escapeExpression = this.escapeExpression;
4455      buffer += '<div class="hm-autocomplete hm-autocomplete-search"><input type="text" placeholder="' + escapeExpression((stack1 = (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.placeholder), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '" value="' + escapeExpression((stack1 = (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.value), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + 
4456      '" /><div class="hm-autocomplete-button"></div></div>';
4457      return buffer;
4458    });
4459    registerTemplate("hm/core/ui/badges/SubjectBadges.hbs", function(Handlebars, depth0, helpers, partials, data) {
4460      this.compilerInfo = [4, ">= 1.0.0"];
4461      helpers = this.merge(helpers, Handlebars.helpers);
4462      data = data || {};
4463      var buffer = "", stack1, functionType = "function", escapeExpression = this.escapeExpression, self = this, helperMissing = helpers.helperMissing;
4464      function program1(depth0, data) {
4465        var buffer = "", stack1, helper, options;
4466        buffer += '<div class="hm-subject-badges-icons">';
4467        stack1 = helpers.each.call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.data), {hash:{}, inverse:self.noop, fn:self.program(2, program2, data), data:data});
4468        if (stack1 || stack1 === 0) {
4469          buffer += stack1;
4470        }
4471        buffer += '<a class="hm-subject-badges-next" href="#next"></a></div><a class="hm-subject-badges-add" href="#add">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Добавить&nbsp;в Портфолио", options) : helperMissing.call(depth0, "_", "Добавить&nbsp;в Портфолио", 
4472        options))) + '</a><div class="hm-subject-badges-actions"></div>';
4473        return buffer;
4474      }
4475      function program2(depth0, data) {
4476        var buffer = "", stack1;
4477        buffer += '<img src="' + escapeExpression((stack1 = depth0 && depth0.icon, typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '" alt="' + escapeExpression((stack1 = depth0 && depth0.name, typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '" title="' + escapeExpression((stack1 = depth0 && depth0.name, typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '" />';
4478        return buffer;
4479      }
4480      function program4(depth0, data) {
4481        return'<div class="hm-subject-badges-empty"></div>';
4482      }
4483      buffer += '<div class="hm-subject-badges">';
4484      stack1 = helpers["if"].call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.data), {hash:{}, inverse:self.program(4, program4, data), fn:self.program(1, program1, data), data:data});
4485      if (stack1 || stack1 === 0) {
4486        buffer += stack1;
4487      }
4488      buffer += "</div>";
4489      return buffer;
4490    });
4491    registerTemplate("hm/core/ui/badges/rating/Infoblock.hbs", function(Handlebars, depth0, helpers, partials, data) {
4492      this.compilerInfo = [4, ">= 1.0.0"];
4493      helpers = this.merge(helpers, Handlebars.helpers);
4494      data = data || {};
4495      var buffer = "", helper, options, helperMissing = helpers.helperMissing, escapeExpression = this.escapeExpression;
4496      buffer += '<div class="hm-badges-rating"><div class="hm-badges-rating-users-container"></div><div class="hm-badges-rating-load hm-badges-rating-user">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Загрузить еще", options) : helperMissing.call(depth0, "_", "Загрузить еще", options))) + "</div></div>";
4497      return buffer;
4498    });
4499    registerTemplate("hm/core/ui/badges/rating/InfoblockItem.hbs", function(Handlebars, depth0, helpers, partials, data) {
4500      this.compilerInfo = [4, ">= 1.0.0"];
4501      helpers = this.merge(helpers, Handlebars.helpers);
4502      data = data || {};
4503      var buffer = "", stack1, functionType = "function", escapeExpression = this.escapeExpression, self = this;
4504      function program1(depth0, data) {
4505        var buffer = "", stack1;
4506        buffer += '<td><div class="hm-badges-rating-user-badge" title="' + escapeExpression((stack1 = depth0 && depth0.subject_name, typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '" data-badge-id="' + escapeExpression((stack1 = depth0 && depth0.badge_id, typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '"><img src="' + escapeExpression((stack1 = depth0 && depth0.icon, typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '" alt="' + escapeExpression((stack1 = 
4507        depth0 && depth0.name, typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '" /><span>' + escapeExpression((stack1 = depth0 && depth0.name, typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + "</span></div></td>";
4508        return buffer;
4509      }
4510      buffer += '<div class="hm-badges-rating-user"><div class="hm-badges-rating-user-photo"><img src="' + escapeExpression((stack1 = (stack1 = (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.data), stack1 == null || stack1 === false ? stack1 : stack1.photo), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '" /><div class="hm-badges-rating-user-rate">' + escapeExpression((stack1 = (stack1 = (stack1 = depth0 && depth0.config, stack1 == null || 
4511      stack1 === false ? stack1 : stack1.data), stack1 == null || stack1 === false ? stack1 : stack1.badges_count), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '</div></div><div class="hm-badges-rating-user-name"><a href="' + escapeExpression((stack1 = (stack1 = (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.data), stack1 == null || stack1 === false ? stack1 : stack1.url), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + 
4512      '">' + escapeExpression((stack1 = (stack1 = (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.data), stack1 == null || stack1 === false ? stack1 : stack1.name), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '</a></div><div class="hm-badges-rating-user-badges"><table><tr>';
4513      stack1 = helpers.each.call(depth0, (stack1 = (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.data), stack1 == null || stack1 === false ? stack1 : stack1.badges), {hash:{}, inverse:self.noop, fn:self.program(1, program1, data), data:data});
4514      if (stack1 || stack1 === 0) {
4515        buffer += stack1;
4516      }
4517      buffer += '</tr></table><div class="hm-badges-rating-scroll-right"></div><div class="hm-badges-rating-scroll-left"></div></div></div>';
4518      return buffer;
4519    });
4520    registerTemplate("hm/core/ui/calendar/DateRangeSwitcher.hbs", function(Handlebars, depth0, helpers, partials, data) {
4521      this.compilerInfo = [4, ">= 1.0.0"];
4522      helpers = this.merge(helpers, Handlebars.helpers);
4523      data = data || {};
4524      var buffer = "", stack1, helper, options, helperMissing = helpers.helperMissing, escapeExpression = this.escapeExpression, functionType = "function", self = this;
4525      function program1(depth0, data) {
4526        var buffer = "", stack1, helper, options;
4527        buffer += '<span class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "from", options) : helperMissing.call(depth0, "ns", "from", options))) + '">' + escapeExpression((helper = helpers.getFrom || depth0 && depth0.getFrom, options = {hash:{}, data:data}, helper ? helper.call(depth0, (stack1 = (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.from), stack1 == null || stack1 === 
4528        false ? stack1 : stack1.mask), options) : helperMissing.call(depth0, "getFrom", (stack1 = (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.from), stack1 == null || stack1 === false ? stack1 : stack1.mask), options))) + "</span>";
4529        return buffer;
4530      }
4531      function program3(depth0, data) {
4532        var buffer = "", stack1, helper, options;
4533        buffer += ' - <span class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "to", options) : helperMissing.call(depth0, "ns", "to", options))) + '">' + escapeExpression((helper = helpers.getTo || depth0 && depth0.getTo, options = {hash:{}, data:data}, helper ? helper.call(depth0, (stack1 = (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.to), stack1 == null || stack1 === false ? 
4534        stack1 : stack1.mask), options) : helperMissing.call(depth0, "getTo", (stack1 = (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.to), stack1 == null || stack1 === false ? stack1 : stack1.mask), options))) + "</span>";
4535        return buffer;
4536      }
4537      buffer += '<div class="';
4538      if (helper = helpers.ns) {
4539        stack1 = helper.call(depth0, {hash:{}, data:data});
4540      } else {
4541        helper = depth0 && depth0.ns;
4542        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
4543      }
4544      buffer += escapeExpression(stack1) + '"><div class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "switch", options) : helperMissing.call(depth0, "ns", "switch", options))) + '"><a class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "prev", options) : helperMissing.call(depth0, "ns", "prev", options))) + '" href="#prev"></a><a class="' + 
4545      escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "next", options) : helperMissing.call(depth0, "ns", "next", options))) + '" href="#next"></a></div><div class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "info", options) : helperMissing.call(depth0, "ns", "info", options))) + '"><div class="' + escapeExpression((helper = helpers.ns || depth0 && 
4546      depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "name", options) : helperMissing.call(depth0, "ns", "name", options))) + '">';
4547      if (helper = helpers.getRangeName) {
4548        stack1 = helper.call(depth0, {hash:{}, data:data});
4549      } else {
4550        helper = depth0 && depth0.getRangeName;
4551        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
4552      }
4553      buffer += escapeExpression(stack1) + '</div><div class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "range", options) : helperMissing.call(depth0, "ns", "range", options))) + '">';
4554      stack1 = helpers["if"].call(depth0, (stack1 = (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.from), stack1 == null || stack1 === false ? stack1 : stack1.visible), {hash:{}, inverse:self.noop, fn:self.program(1, program1, data), data:data});
4555      if (stack1 || stack1 === 0) {
4556        buffer += stack1;
4557      }
4558      stack1 = helpers["if"].call(depth0, (stack1 = (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.to), stack1 == null || stack1 === false ? stack1 : stack1.visible), {hash:{}, inverse:self.noop, fn:self.program(3, program3, data), data:data});
4559      if (stack1 || stack1 === 0) {
4560        buffer += stack1;
4561      }
4562      buffer += "</div></div></div>";
4563      return buffer;
4564    });
4565    registerTemplate("hm/core/ui/container/layout/TabLayout.button.hbs", function(Handlebars, depth0, helpers, partials, data) {
4566      this.compilerInfo = [4, ">= 1.0.0"];
4567      helpers = this.merge(helpers, Handlebars.helpers);
4568      data = data || {};
4569      var buffer = "", stack1, helper, functionType = "function", escapeExpression = this.escapeExpression;
4570      buffer += '<div class="hm-layout-tab-button">';
4571      if (helper = helpers.title) {
4572        stack1 = helper.call(depth0, {hash:{}, data:data});
4573      } else {
4574        helper = depth0 && depth0.title;
4575        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
4576      }
4577      buffer += escapeExpression(stack1) + '<span class="hm-layout-tab-button-close"></span></div>';
4578      return buffer;
4579    });
4580    registerTemplate("hm/core/ui/container/layout/TabLayout.hbs", function(Handlebars, depth0, helpers, partials, data) {
4581      this.compilerInfo = [4, ">= 1.0.0"];
4582      helpers = this.merge(helpers, Handlebars.helpers);
4583      data = data || {};
4584      return'<div class="hm-layout-tab"><div class="hm-layout-tab-header"></div><div class="hm-layout-tab-container"></div></div>';
4585    });
4586    registerTemplate("hm/core/ui/contextmenu/ContextMenu.hbs", function(Handlebars, depth0, helpers, partials, data) {
4587      this.compilerInfo = [4, ">= 1.0.0"];
4588      helpers = this.merge(helpers, Handlebars.helpers);
4589      data = data || {};
4590      return'<ul class="hm-context-menu"></ul>';
4591    });
4592    registerTemplate("hm/core/ui/contextmenu/ContextMenuItem.hbs", function(Handlebars, depth0, helpers, partials, data) {
4593      this.compilerInfo = [4, ">= 1.0.0"];
4594      helpers = this.merge(helpers, Handlebars.helpers);
4595      data = data || {};
4596      var buffer = "", stack1, helper, functionType = "function", escapeExpression = this.escapeExpression;
4597      buffer += "<li>";
4598      if (helper = helpers.getTitle) {
4599        stack1 = helper.call(depth0, {hash:{}, data:data});
4600      } else {
4601        helper = depth0 && depth0.getTitle;
4602        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
4603      }
4604      buffer += escapeExpression(stack1) + "</li>";
4605      return buffer;
4606    });
4607    registerTemplate("hm/core/ui/form/element/AbstractElement.hbs", function(Handlebars, depth0, helpers, partials, data) {
4608      this.compilerInfo = [4, ">= 1.0.0"];
4609      helpers = this.merge(helpers, Handlebars.helpers);
4610      data = data || {};
4611      var buffer = "", stack1, helper, functionType = "function", escapeExpression = this.escapeExpression;
4612      buffer += '<div class="hm-form-element"><div class="hm-form-element-label">';
4613      if (helper = helpers.getLabel) {
4614        stack1 = helper.call(depth0, {hash:{}, data:data});
4615      } else {
4616        helper = depth0 && depth0.getLabel;
4617        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
4618      }
4619      buffer += escapeExpression(stack1) + '</div><div class="hm-form-element-container"></div><div class="hm-clear"></div></div>';
4620      return buffer;
4621    });
4622    registerTemplate("hm/core/ui/form/element/select/AbstractSelect.hbs", function(Handlebars, depth0, helpers, partials, data) {
4623      this.compilerInfo = [4, ">= 1.0.0"];
4624      helpers = this.merge(helpers, Handlebars.helpers);
4625      data = data || {};
4626      var buffer = "", stack1, self = this, functionType = "function", escapeExpression = this.escapeExpression;
4627      function program1(depth0, data) {
4628        return "hm-form-select-button_inline";
4629      }
4630      buffer += '<div class="hm-form-select-button ';
4631      stack1 = helpers["if"].call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.inline), {hash:{}, inverse:self.noop, fn:self.program(1, program1, data), data:data});
4632      if (stack1 || stack1 === 0) {
4633        buffer += stack1;
4634      }
4635      buffer += '"><div class="hm-form-select-button-trigger">▼</div><div class="hm-form-select-button-title">' + escapeExpression((stack1 = (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.title), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + "</div></div>";
4636      return buffer;
4637    });
4638    registerTemplate("hm/core/ui/form/element/select/list/AbstractSelectList.hbs", function(Handlebars, depth0, helpers, partials, data) {
4639      this.compilerInfo = [4, ">= 1.0.0"];
4640      helpers = this.merge(helpers, Handlebars.helpers);
4641      data = data || {};
4642      var buffer = "", stack1, self = this;
4643      function program1(depth0, data) {
4644        return'<div class="hm-form-select-list-filter-wrapper"><div class="hm-form-select-list-filter"><div><input type="text"></div></div></div>';
4645      }
4646      buffer += '<div class="hm-pm-list hm-form-select-list hm-form-select-list-withFilter">';
4647      stack1 = helpers["if"].call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.showFilter), {hash:{}, inverse:self.noop, fn:self.program(1, program1, data), data:data});
4648      if (stack1 || stack1 === 0) {
4649        buffer += stack1;
4650      }
4651      buffer += '<div class="hm-form-select-list-container-wrapper"><div class="hm-form-select-list-container"></div></div></div>';
4652      return buffer;
4653    });
4654    registerTemplate("hm/core/ui/form/element/select/list/item/DateSelectItem.hbs", function(Handlebars, depth0, helpers, partials, data) {
4655      this.compilerInfo = [4, ">= 1.0.0"];
4656      helpers = this.merge(helpers, Handlebars.helpers);
4657      data = data || {};
4658      var buffer = "", stack1, functionType = "function", escapeExpression = this.escapeExpression;
4659      buffer += '<div class="hm-form-select-list-item hm-pm-list-dateSelect-item"><span class="hm-form-select-list-dateSelect-item-input" data-name="' + escapeExpression((stack1 = (stack1 = (stack1 = depth0 && depth0.inputs, stack1 == null || stack1 === false ? stack1 : stack1.from), stack1 == null || stack1 === false ? stack1 : stack1.name), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '"><span class="hm-form-select-list-dateSelect-item-input-caption">' + escapeExpression((stack1 = 
4660      (stack1 = (stack1 = depth0 && depth0.inputs, stack1 == null || stack1 === false ? stack1 : stack1.from), stack1 == null || stack1 === false ? stack1 : stack1.caption), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '</span><input type="text" name="' + escapeExpression((stack1 = (stack1 = (stack1 = depth0 && depth0.inputs, stack1 == null || stack1 === false ? stack1 : stack1.from), stack1 == null || stack1 === false ? stack1 : stack1.name), typeof stack1 === functionType ? 
4661      stack1.apply(depth0) : stack1)) + '" readonly="readonly"><image src="/images/application/calendar/calendar.gif"></span><span class="hm-form-select-list-dateSelect-item-dash">—</span><span class="hm-form-select-list-dateSelect-item-input" data-name="' + escapeExpression((stack1 = (stack1 = (stack1 = depth0 && depth0.inputs, stack1 == null || stack1 === false ? stack1 : stack1.to), stack1 == null || stack1 === false ? stack1 : stack1.name), typeof stack1 === functionType ? stack1.apply(depth0) : 
4662      stack1)) + '"><span class="hm-form-select-list-dateSelect-item-input-caption">' + escapeExpression((stack1 = (stack1 = (stack1 = depth0 && depth0.inputs, stack1 == null || stack1 === false ? stack1 : stack1.to), stack1 == null || stack1 === false ? stack1 : stack1.caption), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '</span><input type="text" name="' + escapeExpression((stack1 = (stack1 = (stack1 = depth0 && depth0.inputs, stack1 == null || stack1 === false ? stack1 : 
4663      stack1.to), stack1 == null || stack1 === false ? stack1 : stack1.name), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '" readonly="readonly"><image src="/images/application/calendar/calendar.gif"></span></div>';
4664      return buffer;
4665    });
4666    registerTemplate("hm/core/ui/form/element/select/list/item/MultiSelectItem.hbs", function(Handlebars, depth0, helpers, partials, data) {
4667      this.compilerInfo = [4, ">= 1.0.0"];
4668      helpers = this.merge(helpers, Handlebars.helpers);
4669      data = data || {};
4670      var buffer = "", stack1, helper, self = this, functionType = "function", escapeExpression = this.escapeExpression;
4671      function program1(depth0, data) {
4672        return "hm-form-select-list-item-withCheckbox-checked";
4673      }
4674      buffer += '<div class="hm-form-select-list-item hm-form-select-list-item-withCheckbox ';
4675      stack1 = helpers["if"].call(depth0, depth0 && depth0.checked, {hash:{}, inverse:self.noop, fn:self.program(1, program1, data), data:data});
4676      if (stack1 || stack1 === 0) {
4677        buffer += stack1;
4678      }
4679      buffer += '" data-id="';
4680      if (helper = helpers.recordId) {
4681        stack1 = helper.call(depth0, {hash:{}, data:data});
4682      } else {
4683        helper = depth0 && depth0.recordId;
4684        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
4685      }
4686      buffer += escapeExpression(stack1) + '"><span class="hm-form-select-list-item-checkbox"></span><a href="#">';
4687      if (helper = helpers.title) {
4688        stack1 = helper.call(depth0, {hash:{}, data:data});
4689      } else {
4690        helper = depth0 && depth0.title;
4691        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
4692      }
4693      buffer += escapeExpression(stack1) + "</a></div>";
4694      return buffer;
4695    });
4696    registerTemplate("hm/core/ui/form/element/select/list/item/SimpleSelectItem.hbs", function(Handlebars, depth0, helpers, partials, data) {
4697      this.compilerInfo = [4, ">= 1.0.0"];
4698      helpers = this.merge(helpers, Handlebars.helpers);
4699      data = data || {};
4700      var buffer = "", stack1, helper, functionType = "function", escapeExpression = this.escapeExpression, self = this;
4701      function program1(depth0, data) {
4702        var stack1, helper;
4703        if (helper = helpers.title) {
4704          stack1 = helper.call(depth0, {hash:{}, data:data});
4705        } else {
4706          helper = depth0 && depth0.title;
4707          stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
4708        }
4709        return escapeExpression(stack1);
4710      }
4711      function program3(depth0, data) {
4712        var stack1, helper;
4713        if (helper = helpers.title) {
4714          stack1 = helper.call(depth0, {hash:{}, data:data});
4715        } else {
4716          helper = depth0 && depth0.title;
4717          stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
4718        }
4719        if (stack1 || stack1 === 0) {
4720          return stack1;
4721        } else {
4722          return "";
4723        }
4724      }
4725      buffer += '<div class="hm-form-select-list-item" data-id="';
4726      if (helper = helpers.recordId) {
4727        stack1 = helper.call(depth0, {hash:{}, data:data});
4728      } else {
4729        helper = depth0 && depth0.recordId;
4730        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
4731      }
4732      buffer += escapeExpression(stack1) + '"><a href="#">';
4733      stack1 = helpers["if"].call(depth0, depth0 && depth0.needEscape, {hash:{}, inverse:self.program(3, program3, data), fn:self.program(1, program1, data), data:data});
4734      if (stack1 || stack1 === 0) {
4735        buffer += stack1;
4736      }
4737      buffer += "</a></div>";
4738      return buffer;
4739    });
4740    registerTemplate("hm/core/ui/form/helper/imageMap/ImageMapAnswer.hbs", function(Handlebars, depth0, helpers, partials, data) {
4741      this.compilerInfo = [4, ">= 1.0.0"];
4742      helpers = this.merge(helpers, Handlebars.helpers);
4743      data = data || {};
4744      var stack1, helperMissing = helpers.helperMissing, escapeExpression = this.escapeExpression, functionType = "function", self = this;
4745      function program1(depth0, data) {
4746        var buffer = "", stack1, helper, options;
4747        buffer += '<tr class="';
4748        if (helper = helpers.ns) {
4749          stack1 = helper.call(depth0, {hash:{}, data:data});
4750        } else {
4751          helper = depth0 && depth0.ns;
4752          stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
4753        }
4754        buffer += escapeExpression(stack1) + '"><td class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "isRight", options) : helperMissing.call(depth0, "ns", "isRight", options))) + '">';
4755        stack1 = helpers["if"].call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.editMode), {hash:{}, inverse:self.noop, fn:self.program(2, program2, data), data:data});
4756        if (stack1 || stack1 === 0) {
4757          buffer += stack1;
4758        }
4759        buffer += '<input type="checkbox"></td><td class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "caption", options) : helperMissing.call(depth0, "ns", "caption", options))) + '"><input type="text">';
4760        stack1 = helpers["if"].call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.editMode), {hash:{}, inverse:self.noop, fn:self.program(4, program4, data), data:data});
4761        if (stack1 || stack1 === 0) {
4762          buffer += stack1;
4763        }
4764        buffer += "</td>";
4765        stack1 = helpers["if"].call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.editMode), {hash:{}, inverse:self.noop, fn:self.program(6, program6, data), data:data});
4766        if (stack1 || stack1 === 0) {
4767          buffer += stack1;
4768        }
4769        buffer += "</tr>";
4770        return buffer;
4771      }
4772      function program2(depth0, data) {
4773        return'<input type="hidden" name="is_correct" value="0">';
4774      }
4775      function program4(depth0, data) {
4776        return'<input type="hidden">';
4777      }
4778      function program6(depth0, data) {
4779        var buffer = "", helper, options;
4780        buffer += '<td class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "actions", options) : helperMissing.call(depth0, "ns", "actions", options))) + '"><a href="#" class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "action", options) : helperMissing.call(depth0, "ns", "action", options))) + " " + escapeExpression((helper = helpers.ns || 
4781        depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "action_delete", options) : helperMissing.call(depth0, "ns", "action_delete", options))) + '"><img src="/images/icons/delete.gif"></a></td>';
4782        return buffer;
4783      }
4784      function program8(depth0, data) {
4785        var buffer = "", helper, options;
4786        buffer += '<div><div class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "isRight", options) : helperMissing.call(depth0, "ns", "isRight", options))) + '" style="height: 0; visibility: hidden;"><input type="checkbox"></div></div>';
4787        return buffer;
4788      }
4789      stack1 = helpers["if"].call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.visible), {hash:{}, inverse:self.program(8, program8, data), fn:self.program(1, program1, data), data:data});
4790      if (stack1 || stack1 === 0) {
4791        return stack1;
4792      } else {
4793        return "";
4794      }
4795    });
4796    registerTemplate("hm/core/ui/form/helper/imageMap/ImageMapEditor.hbs", function(Handlebars, depth0, helpers, partials, data) {
4797      this.compilerInfo = [4, ">= 1.0.0"];
4798      helpers = this.merge(helpers, Handlebars.helpers);
4799      data = data || {};
4800      var buffer = "", stack1, helper, options, functionType = "function", escapeExpression = this.escapeExpression, helperMissing = helpers.helperMissing, self = this;
4801      function program1(depth0, data) {
4802        var buffer = "", stack1, helper;
4803        if (helper = helpers.ns) {
4804          stack1 = helper.call(depth0, {hash:{}, data:data});
4805        } else {
4806          helper = depth0 && depth0.ns;
4807          stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
4808        }
4809        buffer += escapeExpression(stack1) + "_readOnly";
4810        return buffer;
4811      }
4812      function program3(depth0, data) {
4813        var buffer = "", stack1, helper, options;
4814        buffer += '<table class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "answerList", options) : helperMissing.call(depth0, "ns", "answerList", options))) + '"><col style="';
4815        stack1 = helpers["if"].call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.editMode), {hash:{}, inverse:self.program(6, program6, data), fn:self.program(4, program4, data), data:data});
4816        if (stack1 || stack1 === 0) {
4817          buffer += stack1;
4818        }
4819        buffer += '"><col style="width: auto;">';
4820        stack1 = helpers["if"].call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.editMode), {hash:{}, inverse:self.noop, fn:self.program(8, program8, data), data:data});
4821        if (stack1 || stack1 === 0) {
4822          buffer += stack1;
4823        }
4824        stack1 = helpers["if"].call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.editMode), {hash:{}, inverse:self.noop, fn:self.program(10, program10, data), data:data});
4825        if (stack1 || stack1 === 0) {
4826          buffer += stack1;
4827        }
4828        buffer += '<tbody class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "answerList-body", options) : helperMissing.call(depth0, "ns", "answerList-body", options))) + '"></tbody></table>';
4829        return buffer;
4830      }
4831      function program4(depth0, data) {
4832        return "width: 100px;";
4833      }
4834      function program6(depth0, data) {
4835        return "width: 65px;";
4836      }
4837      function program8(depth0, data) {
4838        return'<col style="width: 100px;">';
4839      }
4840      function program10(depth0, data) {
4841        var buffer = "", stack1, helper, options;
4842        buffer += '<thead><tr class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "answer", options) : helperMissing.call(depth0, "ns", "answer", options))) + '"><th class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "isTrue", options) : helperMissing.call(depth0, "ns", "isTrue", options))) + '">' + escapeExpression((helper = helpers._ || 
4843        depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Правильный вариант", options) : helperMissing.call(depth0, "_", "Правильный вариант", options))) + '</th><th class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, 
4844        "caption", options) : helperMissing.call(depth0, "ns", "caption", options))) + '">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Вариант ответа", options) : helperMissing.call(depth0, "_", "Вариант ответа", options))) + "</th>";
4845        stack1 = helpers["if"].call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.editMode), {hash:{}, inverse:self.noop, fn:self.program(11, program11, data), data:data});
4846        if (stack1 || stack1 === 0) {
4847          buffer += stack1;
4848        }
4849        buffer += "</tr></thead>";
4850        return buffer;
4851      }
4852      function program11(depth0, data) {
4853        return "<th></th>";
4854      }
4855      function program13(depth0, data) {
4856        var buffer = "", helper, options;
4857        buffer += '<div class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "answerList-body", options) : helperMissing.call(depth0, "ns", "answerList-body", options))) + '"></div>';
4858        return buffer;
4859      }
4860      buffer += '<div class="';
4861      if (helper = helpers.ns) {
4862        stack1 = helper.call(depth0, {hash:{}, data:data});
4863      } else {
4864        helper = depth0 && depth0.ns;
4865        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
4866      }
4867      buffer += escapeExpression(stack1) + " ";
4868      stack1 = helpers.unless.call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.editMode), {hash:{}, inverse:self.noop, fn:self.program(1, program1, data), data:data});
4869      if (stack1 || stack1 === 0) {
4870        buffer += stack1;
4871      }
4872      buffer += '"><div class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "content", options) : helperMissing.call(depth0, "ns", "content", options))) + '" style="display: none"><div class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "image", options) : helperMissing.call(depth0, "ns", "image", options))) + '"></div>';
4873      stack1 = helpers["if"].call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.showVariants), {hash:{}, inverse:self.program(13, program13, data), fn:self.program(3, program3, data), data:data});
4874      if (stack1 || stack1 === 0) {
4875        buffer += stack1;
4876      }
4877      buffer += '</div><input type="file" name="image_map_input"></div>';
4878      return buffer;
4879    });
4880    registerTemplate("hm/core/ui/graph/amcharts/Chart.hbs", function(Handlebars, depth0, helpers, partials, data) {
4881      this.compilerInfo = [4, ">= 1.0.0"];
4882      helpers = this.merge(helpers, Handlebars.helpers);
4883      data = data || {};
4884      var buffer = "", stack1, helper, options, functionType = "function", escapeExpression = this.escapeExpression, helperMissing = helpers.helperMissing;
4885      buffer += '<div id="';
4886      if (helper = helpers.chartContainerId) {
4887        stack1 = helper.call(depth0, {hash:{}, data:data});
4888      } else {
4889        helper = depth0 && depth0.chartContainerId;
4890        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
4891      }
4892      buffer += escapeExpression(stack1) + '"><p>' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Загрузка Flash Player...", options) : helperMissing.call(depth0, "_", "Загрузка Flash Player...", options))) + "</p></div>";
4893      return buffer;
4894    });
4895    registerTemplate("hm/core/ui/imageMapEditor/ImageMapEditor.hbs", function(Handlebars, depth0, helpers, partials, data) {
4896      this.compilerInfo = [4, ">= 1.0.0"];
4897      helpers = this.merge(helpers, Handlebars.helpers);
4898      data = data || {};
4899      var buffer = "", stack1, helper, options, functionType = "function", escapeExpression = this.escapeExpression, self = this, helperMissing = helpers.helperMissing;
4900      function program1(depth0, data) {
4901        var buffer = "", stack1, helper;
4902        if (helper = helpers.ns) {
4903          stack1 = helper.call(depth0, {hash:{}, data:data});
4904        } else {
4905          helper = depth0 && depth0.ns;
4906          stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
4907        }
4908        buffer += escapeExpression(stack1) + "_readOnly";
4909        return buffer;
4910      }
4911      buffer += '<div class="';
4912      if (helper = helpers.ns) {
4913        stack1 = helper.call(depth0, {hash:{}, data:data});
4914      } else {
4915        helper = depth0 && depth0.ns;
4916        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
4917      }
4918      buffer += escapeExpression(stack1) + " ";
4919      stack1 = helpers["if"].call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.readOnly), {hash:{}, inverse:self.noop, fn:self.program(1, program1, data), data:data});
4920      if (stack1 || stack1 === 0) {
4921        buffer += stack1;
4922      }
4923      buffer += '"><div class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "toolbar", options) : helperMissing.call(depth0, "ns", "toolbar", options))) + '"><button class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "button-create", options) : helperMissing.call(depth0, "ns", "button-create", options))) + '" data-type="circle">' + escapeExpression((helper = 
4924      helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Круг", options) : helperMissing.call(depth0, "_", "Круг", options))) + '</button><button class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "button-create", options) : helperMissing.call(depth0, "ns", "button-create", options))) + '" data-type="ellipse">' + escapeExpression((helper = 
4925      helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Эллипс", options) : helperMissing.call(depth0, "_", "Эллипс", options))) + '</button><button class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "button-create", options) : helperMissing.call(depth0, "ns", "button-create", options))) + '" data-type="square">' + 
4926      escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Квадрат", options) : helperMissing.call(depth0, "_", "Квадрат", options))) + '</button><button class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "button-create", options) : helperMissing.call(depth0, "ns", "button-create", 
4927      options))) + '" data-type="rect">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Прямоугольник", options) : helperMissing.call(depth0, "_", "Прямоугольник", options))) + '</button><button class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, 
4928      helper ? helper.call(depth0, "button-create", options) : helperMissing.call(depth0, "ns", "button-create", options))) + '" data-type="polygon">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Многоугольник", options) : helperMissing.call(depth0, "_", "Многоугольник", options))) + '</button></div><div class="' + 
4929      escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "help", options) : helperMissing.call(depth0, "ns", "help", options))) + '"></div><div class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "imageContainer", options) : helperMissing.call(depth0, "ns", "imageContainer", options))) + '"><image src=""></image></div></div>';
4930      return buffer;
4931    });
4932    registerTemplate("hm/core/ui/progressbar/Progressbar.hbs", function(Handlebars, depth0, helpers, partials, data) {
4933      this.compilerInfo = [4, ">= 1.0.0"];
4934      helpers = this.merge(helpers, Handlebars.helpers);
4935      data = data || {};
4936      return'<div class="hm-progressbar-wrap"><div class="ui-progressbar"><div class="gradient-me"></div></div></div>';
4937    });
4938    registerTemplate("hm/core/ui/search/SphinxSearch.hbs", function(Handlebars, depth0, helpers, partials, data) {
4939      this.compilerInfo = [4, ">= 1.0.0"];
4940      helpers = this.merge(helpers, Handlebars.helpers);
4941      data = data || {};
4942      var buffer = "", helper, options, helperMissing = helpers.helperMissing, escapeExpression = this.escapeExpression;
4943      buffer += '<div class="hm-sphinx-search"><input name="all" value="" /><input type="submit" value="' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Найти", options) : helperMissing.call(depth0, "_", "Найти", options))) + '" /><div class="hm-search-result"></div></div>';
4944      return buffer;
4945    });
4946    registerTemplate("hm/core/ui/select/Option.hbs", function(Handlebars, depth0, helpers, partials, data) {
4947      this.compilerInfo = [4, ">= 1.0.0"];
4948      helpers = this.merge(helpers, Handlebars.helpers);
4949      data = data || {};
4950      var buffer = "", stack1, functionType = "function", escapeExpression = this.escapeExpression;
4951      buffer += '<li class="hm-select-option" title="' + escapeExpression((stack1 = (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.text), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '"><span>' + escapeExpression((stack1 = (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.text), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + "</span></li>";
4952      return buffer;
4953    });
4954    registerTemplate("hm/core/ui/select/OptionsContainer.hbs", function(Handlebars, depth0, helpers, partials, data) {
4955      this.compilerInfo = [4, ">= 1.0.0"];
4956      helpers = this.merge(helpers, Handlebars.helpers);
4957      data = data || {};
4958      return'<div class="hm-select-options"><div class="hm-select-options-wrap"><ul></ul></div></div>';
4959    });
4960    registerTemplate("hm/core/ui/select/Select.hbs", function(Handlebars, depth0, helpers, partials, data) {
4961      this.compilerInfo = [4, ">= 1.0.0"];
4962      helpers = this.merge(helpers, Handlebars.helpers);
4963      data = data || {};
4964      return'<div class="hm-select"><div class="hm-select-selected"><span></span></div></div>';
4965    });
4966    registerTemplate("hm/core/ui/select/SelectNative.hbs", function(Handlebars, depth0, helpers, partials, data) {
4967      this.compilerInfo = [4, ">= 1.0.0"];
4968      helpers = this.merge(helpers, Handlebars.helpers);
4969      data = data || {};
4970      var buffer = "", stack1, helper, functionType = "function", escapeExpression = this.escapeExpression, self = this;
4971      function program1(depth0, data) {
4972        var buffer = "", stack1, helper;
4973        buffer += '<option value="' + escapeExpression((stack1 = data == null || data === false ? data : data.key, typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '" ';
4974        stack1 = helpers["if"].call(depth0, depth0 && depth0.selected, {hash:{}, inverse:self.noop, fn:self.program(2, program2, data), data:data});
4975        if (stack1 || stack1 === 0) {
4976          buffer += stack1;
4977        }
4978        buffer += ">";
4979        if (helper = helpers.text) {
4980          stack1 = helper.call(depth0, {hash:{}, data:data});
4981        } else {
4982          helper = depth0 && depth0.text;
4983          stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
4984        }
4985        buffer += escapeExpression(stack1) + "</option>";
4986        return buffer;
4987      }
4988      function program2(depth0, data) {
4989        return'selected="selected"';
4990      }
4991      buffer += '<select name="';
4992      if (helper = helpers.name) {
4993        stack1 = helper.call(depth0, {hash:{}, data:data});
4994      } else {
4995        helper = depth0 && depth0.name;
4996        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
4997      }
4998      buffer += escapeExpression(stack1) + '">';
4999      stack1 = helpers.each.call(depth0, depth0 && depth0.options, {hash:{}, inverse:self.noop, fn:self.program(1, program1, data), data:data});
5000      if (stack1 || stack1 === 0) {
5001        buffer += stack1;
5002      }
5003      buffer += "</select>";
5004      return buffer;
5005    });
5006    registerTemplate("hm/core/ui/select/custom/HeadSwitcher.hbs", function(Handlebars, depth0, helpers, partials, data) {
5007      this.compilerInfo = [4, ">= 1.0.0"];
5008      helpers = this.merge(helpers, Handlebars.helpers);
5009      data = data || {};
5010      return'<div class="hm-select hm-select-headSwitcher"></div>';
5011    });
5012    registerTemplate("hm/core/ui/storeList/List.hbs", function(Handlebars, depth0, helpers, partials, data) {
5013      this.compilerInfo = [4, ">= 1.0.0"];
5014      helpers = this.merge(helpers, Handlebars.helpers);
5015      data = data || {};
5016      var buffer = "", stack1, helper, options, functionType = "function", escapeExpression = this.escapeExpression, helperMissing = helpers.helperMissing;
5017      buffer += '<div class="';
5018      if (helper = helpers.ns) {
5019        stack1 = helper.call(depth0, {hash:{}, data:data});
5020      } else {
5021        helper = depth0 && depth0.ns;
5022        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5023      }
5024      buffer += escapeExpression(stack1) + '"><div class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "items-container", options) : helperMissing.call(depth0, "ns", "items-container", options))) + '"></div></div>';
5025      return buffer;
5026    });
5027    registerTemplate("hm/core/ui/storeList/ListItem.hbs", function(Handlebars, depth0, helpers, partials, data) {
5028      this.compilerInfo = [4, ">= 1.0.0"];
5029      helpers = this.merge(helpers, Handlebars.helpers);
5030      data = data || {};
5031      var buffer = "", stack1, helper, functionType = "function", escapeExpression = this.escapeExpression;
5032      buffer += '<div class="';
5033      if (helper = helpers.ns) {
5034        stack1 = helper.call(depth0, {hash:{}, data:data});
5035      } else {
5036        helper = depth0 && depth0.ns;
5037        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5038      }
5039      buffer += escapeExpression(stack1) + '"></div>';
5040      return buffer;
5041    });
5042    registerTemplate("hm/core/ui/tooltip/Tooltip.hbs", function(Handlebars, depth0, helpers, partials, data) {
5043      this.compilerInfo = [4, ">= 1.0.0"];
5044      helpers = this.merge(helpers, Handlebars.helpers);
5045      data = data || {};
5046      return'<div class="hm-tooltip"><div class="hm-tooltip-shadow"><div class="hm-tooltip-shadow-arrow"></div></div><div class="hm-tooltip-content"></div><div class="hm-tooltip-arrow"></div></div>';
5047    });
5048    registerTemplate("hm/core/ui/tree/DragManager.hbs", function(Handlebars, depth0, helpers, partials, data) {
5049      this.compilerInfo = [4, ">= 1.0.0"];
5050      helpers = this.merge(helpers, Handlebars.helpers);
5051      data = data || {};
5052      return'<li class="hm-tree-draggable-helper"></li>';
5053    });
5054    registerTemplate("hm/core/ui/tree/Tree.hbs", function(Handlebars, depth0, helpers, partials, data) {
5055      this.compilerInfo = [4, ">= 1.0.0"];
5056      helpers = this.merge(helpers, Handlebars.helpers);
5057      data = data || {};
5058      return'<div class="hm-tree"></div>';
5059    });
5060    registerTemplate("hm/core/ui/tree/node/Node.hbs", function(Handlebars, depth0, helpers, partials, data) {
5061      this.compilerInfo = [4, ">= 1.0.0"];
5062      helpers = this.merge(helpers, Handlebars.helpers);
5063      data = data || {};
5064      var buffer = "", stack1, helper, functionType = "function", escapeExpression = this.escapeExpression;
5065      buffer += '<li class="hm-tree-node"><span class="hm-tree-node-item"><span class="hm-tree-node-connector"></span><span class="hm-tree-node-icon ';
5066      if (helper = helpers.getIconClass) {
5067        stack1 = helper.call(depth0, {hash:{}, data:data});
5068      } else {
5069        helper = depth0 && depth0.getIconClass;
5070        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5071      }
5072      buffer += escapeExpression(stack1) + '"></span><span class="hm-tree-node-title">';
5073      if (helper = helpers.getTitle) {
5074        stack1 = helper.call(depth0, {hash:{}, data:data});
5075      } else {
5076        helper = depth0 && depth0.getTitle;
5077        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5078      }
5079      buffer += escapeExpression(stack1) + '</span></span><ul class="hm-tree-node-children"></ul></li>';
5080      return buffer;
5081    });
5082    registerTemplate("hm/core/ui/tree/node/Root.hbs", function(Handlebars, depth0, helpers, partials, data) {
5083      this.compilerInfo = [4, ">= 1.0.0"];
5084      helpers = this.merge(helpers, Handlebars.helpers);
5085      data = data || {};
5086      return'<ul class="hm-tree-root hm-tree-node-children"></ul>';
5087    });
5088    registerTemplate("hm/core/ui/window/card/Card.hbs", function(Handlebars, depth0, helpers, partials, data) {
5089      this.compilerInfo = [4, ">= 1.0.0"];
5090      helpers = this.merge(helpers, Handlebars.helpers);
5091      data = data || {};
5092      var buffer = "", helper, options, helperMissing = helpers.helperMissing, escapeExpression = this.escapeExpression;
5093      buffer += '<div class="hm-dialog-card">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Загрузка", options) : helperMissing.call(depth0, "_", "Загрузка", options))) + "...</div>";
5094      return buffer;
5095    });
5096    registerTemplate("hm/core/ui/window/dialog/Dialog.loading.hbs", function(Handlebars, depth0, helpers, partials, data) {
5097      this.compilerInfo = [4, ">= 1.0.0"];
5098      helpers = this.merge(helpers, Handlebars.helpers);
5099      data = data || {};
5100      var buffer = "", helper, options, helperMissing = helpers.helperMissing, escapeExpression = this.escapeExpression;
5101      buffer += '<div class="hm-dialog-loading">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Подождите, идет загрузка", options) : helperMissing.call(depth0, "_", "Подождите, идет загрузка", options))) + "...</div>";
5102      return buffer;
5103    });
5104    registerTemplate("hm/module/es/ui/event/list/EventList.hbs", function(Handlebars, depth0, helpers, partials, data) {
5105      this.compilerInfo = [4, ">= 1.0.0"];
5106      helpers = this.merge(helpers, Handlebars.helpers);
5107      data = data || {};
5108      var buffer = "", stack1, helper, options, helperMissing = helpers.helperMissing, escapeExpression = this.escapeExpression, self = this;
5109      function program1(depth0, data) {
5110        var buffer = "", stack1, helper, options;
5111        buffer += '<div class="hm-es-event-list-header">';
5112        stack1 = helpers.unless.call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.fullMode), {hash:{}, inverse:self.noop, fn:self.program(2, program2, data), data:data});
5113        if (stack1 || stack1 === 0) {
5114          buffer += stack1;
5115        }
5116        buffer += '<h2 class="hm-es-event-list-title">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Сообщения", options) : helperMissing.call(depth0, "_", "Сообщения", options))) + "</h2></div>";
5117        return buffer;
5118      }
5119      function program2(depth0, data) {
5120        var buffer = "", helper, options;
5121        buffer += '<a href="#" class="hm-es-event-list-url">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Просмотреть всё", options) : helperMissing.call(depth0, "_", "Просмотреть всё", options))) + "</a>";
5122        return buffer;
5123      }
5124      buffer += '<div class="hm-es-event-list">';
5125      stack1 = helpers["if"].call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.showHeader), {hash:{}, inverse:self.noop, fn:self.program(1, program1, data), data:data});
5126      if (stack1 || stack1 === 0) {
5127        buffer += stack1;
5128      }
5129      buffer += '<div class="hm-es-event-list-body"></div><div class="hm-es-event-list-body-empty">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Список активностей пуст", options) : helperMissing.call(depth0, "_", "Список активностей пуст", 
5130      options))) + "</div></div>";
5131      return buffer;
5132    });
5133    registerTemplate("hm/module/es/ui/event/list/group/DefaultEventGroup.hbs", function(Handlebars, depth0, helpers, partials, data) {
5134      this.compilerInfo = [4, ">= 1.0.0"];
5135      helpers = this.merge(helpers, Handlebars.helpers);
5136      data = data || {};
5137      var buffer = "", stack1, helper, options, functionType = "function", escapeExpression = this.escapeExpression, self = this, blockHelperMissing = helpers.blockHelperMissing;
5138      function program1(depth0, data) {
5139        return'<span class="hm-es-event-list-group-icon-more"></span>';
5140      }
5141      buffer += '<div class="hm-es-event-list-group"><h3><span class="hm-es-event-list-group-type">';
5142      if (helper = helpers.getTypeTitle) {
5143        stack1 = helper.call(depth0, {hash:{}, data:data});
5144      } else {
5145        helper = depth0 && depth0.getTypeTitle;
5146        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5147      }
5148      buffer += escapeExpression(stack1) + '</span><span class="hm-es-event-list-group-title">' + escapeExpression((stack1 = (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.groupTitle), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + "</span>";
5149      options = {hash:{}, inverse:self.noop, fn:self.program(1, program1, data), data:data};
5150      if (helper = helpers.needShowMoreIcon) {
5151        stack1 = helper.call(depth0, options);
5152      } else {
5153        helper = depth0 && depth0.needShowMoreIcon;
5154        stack1 = typeof helper === functionType ? helper.call(depth0, options) : helper;
5155      }
5156      if (!helpers.needShowMoreIcon) {
5157        stack1 = blockHelperMissing.call(depth0, stack1, {hash:{}, inverse:self.noop, fn:self.program(1, program1, data), data:data});
5158      }
5159      if (stack1 || stack1 === 0) {
5160        buffer += stack1;
5161      }
5162      buffer += '<span class="hm-es-event-list-group-name">';
5163      if (helper = helpers.getGroupName) {
5164        stack1 = helper.call(depth0, {hash:{}, data:data});
5165      } else {
5166        helper = depth0 && depth0.getGroupName;
5167        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5168      }
5169      buffer += escapeExpression(stack1) + '</span><div class="hm-clear"></div></h3><div class="hm-es-event-list-group-events"></div></div>';
5170      return buffer;
5171    });
5172    registerTemplate("hm/module/es/ui/event/list/group/message/MessageEventGroup.hbs", function(Handlebars, depth0, helpers, partials, data) {
5173      this.compilerInfo = [4, ">= 1.0.0"];
5174      helpers = this.merge(helpers, Handlebars.helpers);
5175      data = data || {};
5176      var buffer = "", stack1, helper, options, functionType = "function", escapeExpression = this.escapeExpression, helperMissing = helpers.helperMissing;
5177      buffer += '<div class="hm-es-event-list-group hm-es-event-list-group-messages hm-es-event-list-group-with-avatar"><h3><div class="hm-es-event-list-group-avatar-wrapper"><div class="hm-es-event-list-group-avatar"></div></div><a class="hm-es-event-list-group-name" target="_blank" href="';
5178      if (helper = helpers.getAuthorUrl) {
5179        stack1 = helper.call(depth0, {hash:{}, data:data});
5180      } else {
5181        helper = depth0 && depth0.getAuthorUrl;
5182        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5183      }
5184      buffer += escapeExpression(stack1) + '">';
5185      if (helper = helpers.getAuthorName) {
5186        stack1 = helper.call(depth0, {hash:{}, data:data});
5187      } else {
5188        helper = depth0 && depth0.getAuthorName;
5189        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5190      }
5191      buffer += escapeExpression(stack1) + '</a><span class="hm-es-event-list-group-action"> ' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Вам написал(а)", options) : helperMissing.call(depth0, "_", "Вам написал(а)", options))) + '</span><div class="hm-clear"></div></h3><div class="hm-es-event-list-group-events"></div></div>';
5192      return buffer;
5193    });
5194    registerTemplate("hm/module/es/ui/event/list/group/notification/DefaultNotificationEventGroup.hbs", function(Handlebars, depth0, helpers, partials, data) {
5195      this.compilerInfo = [4, ">= 1.0.0"];
5196      helpers = this.merge(helpers, Handlebars.helpers);
5197      data = data || {};
5198      var buffer = "", stack1, helper, options, helperMissing = helpers.helperMissing, escapeExpression = this.escapeExpression, functionType = "function";
5199      buffer += '<div class="hm-es-event-list-group"><h3><span class="hm-es-event-list-group-title">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Курс", options) : helperMissing.call(depth0, "_", "Курс", options))) + '</span><span class="hm-es-event-list-group-icon-more"></span><span class="hm-es-event-list-group-name">';
5200      if (helper = helpers.getCourseName) {
5201        stack1 = helper.call(depth0, {hash:{}, data:data});
5202      } else {
5203        helper = depth0 && depth0.getCourseName;
5204        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5205      }
5206      buffer += escapeExpression(stack1) + '</span><div class="hm-clear"></div></h3><div class="hm-es-event-list-group-events"></div></div>';
5207      return buffer;
5208    });
5209    registerTemplate("hm/module/es/ui/event/list/item/EventAbstract.hbs", function(Handlebars, depth0, helpers, partials, data) {
5210      this.compilerInfo = [4, ">= 1.0.0"];
5211      helpers = this.merge(helpers, Handlebars.helpers);
5212      data = data || {};
5213      var buffer = "", stack1, helper, options, functionType = "function", escapeExpression = this.escapeExpression, helperMissing = helpers.helperMissing;
5214      buffer += '<div class="hm-es-event-list-item hm-es-event-list-item-forum" title="' + escapeExpression((stack1 = (stack1 = depth0 && depth0.description, stack1 == null || stack1 === false ? stack1 : stack1.title), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '"><div class="hm-es-event-list-item-avatar-wrapper"><div class="hm-es-event-list-item-avatar"></div></div><div class="hm-es-event-list-item-datetime"><div class="hm-es-event-list-item-date">' + escapeExpression((helper = 
5215      helpers.datetime || depth0 && depth0.datetime, options = {hash:{}, data:data}, helper ? helper.call(depth0, depth0 && depth0.creationDate, "dd mmm", options) : helperMissing.call(depth0, "datetime", depth0 && depth0.creationDate, "dd mmm", options))) + "</div>" + escapeExpression((helper = helpers.datetime || depth0 && depth0.datetime, options = {hash:{}, data:data}, helper ? helper.call(depth0, depth0 && depth0.creationDate, "HH:MM", options) : helperMissing.call(depth0, "datetime", depth0 && 
5216      depth0.creationDate, "HH:MM", options))) + '</div><span class="hm-es-event-list-item-author">' + escapeExpression((stack1 = (stack1 = depth0 && depth0.description, stack1 == null || stack1 === false ? stack1 : stack1.user_name), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + "</span> " + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "написал", options) : helperMissing.call(depth0, 
5217      "_", "написал", options))) + '<div class="hm-es-event-list-item-desc" title="' + escapeExpression((helper = helpers.cropText || depth0 && depth0.cropText, options = {hash:{}, data:data}, helper ? helper.call(depth0, (stack1 = depth0 && depth0.description, stack1 == null || stack1 === false ? stack1 : stack1.text), options) : helperMissing.call(depth0, "cropText", (stack1 = depth0 && depth0.description, stack1 == null || stack1 === false ? stack1 : stack1.text), 
5218      options))) + '">' + escapeExpression((helper = helpers.cropText || depth0 && depth0.cropText, options = {hash:{}, data:data}, helper ? helper.call(depth0, (stack1 = depth0 && depth0.description, stack1 == null || stack1 === false ? stack1 : stack1.text), 100, options) : helperMissing.call(depth0, "cropText", (stack1 = depth0 && depth0.description, stack1 == null || stack1 === false ? stack1 : stack1.text), 100, options))) + '</div><div class="hm-clear"></div></div>';
5219      return buffer;
5220    });
5221    registerTemplate("hm/module/es/ui/event/list/item/blog/BlogAddMessage.hbs", function(Handlebars, depth0, helpers, partials, data) {
5222      this.compilerInfo = [4, ">= 1.0.0"];
5223      helpers = this.merge(helpers, Handlebars.helpers);
5224      data = data || {};
5225      var buffer = "", stack1, helper, options, helperMissing = helpers.helperMissing, escapeExpression = this.escapeExpression, functionType = "function";
5226      buffer += '<div class="hm-es-event-list-item"><div class="hm-es-event-list-item-avatar-wrapper"><div class="hm-es-event-list-item-avatar"></div></div><div class="hm-es-event-list-item-datetime"><div class="hm-es-event-list-item-date">' + escapeExpression((helper = helpers.datetime || depth0 && depth0.datetime, options = {hash:{}, data:data}, helper ? helper.call(depth0, depth0 && depth0.creationDate, "dd mmm", options) : helperMissing.call(depth0, "datetime", depth0 && depth0.creationDate, 
5227      "dd mmm", options))) + "</div>" + escapeExpression((helper = helpers.datetime || depth0 && depth0.datetime, options = {hash:{}, data:data}, helper ? helper.call(depth0, depth0 && depth0.creationDate, "HH:MM", options) : helperMissing.call(depth0, "datetime", depth0 && depth0.creationDate, "HH:MM", options))) + '</div><div><span class="hm-es-event-list-item-author">' + escapeExpression((stack1 = (stack1 = depth0 && depth0.description, stack1 == null || stack1 === false ? stack1 : stack1.user_name), 
5228      typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + "</span> " + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "добавил(а) запись", options) : helperMissing.call(depth0, "_", "добавил(а) запись", options))) + ' "' + escapeExpression((stack1 = (stack1 = depth0 && depth0.description, 
5229      stack1 == null || stack1 === false ? stack1 : stack1.title), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '"</div><div class="hm-es-event-list-item-desc">' + escapeExpression((helper = helpers.cropText || depth0 && depth0.cropText, options = {hash:{}, data:data}, helper ? helper.call(depth0, (stack1 = depth0 && depth0.description, stack1 == null || stack1 === false ? stack1 : stack1.body), 100, options) : helperMissing.call(depth0, "cropText", (stack1 = depth0 && depth0.description, 
5230      stack1 == null || stack1 === false ? stack1 : stack1.body), 100, options))) + "</div></div>";
5231      return buffer;
5232    });
5233    registerTemplate("hm/module/es/ui/event/list/item/course/CourseAddMaterial.hbs", function(Handlebars, depth0, helpers, partials, data) {
5234      this.compilerInfo = [4, ">= 1.0.0"];
5235      helpers = this.merge(helpers, Handlebars.helpers);
5236      data = data || {};
5237      var buffer = "", stack1, helper, options, helperMissing = helpers.helperMissing, escapeExpression = this.escapeExpression, functionType = "function", self = this;
5238      function program1(depth0, data) {
5239        var buffer = "", helper, options;
5240        buffer += '<div class="hm-es-event-list-item-portfolio-add"><a href="#add">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Добавить в портфолио", options) : helperMissing.call(depth0, "_", "Добавить в портфолио", options))) + "</a></div>";
5241        return buffer;
5242      }
5243      buffer += '<div class="hm-es-event-list-item hm-es-event-list-item-forum" title="';
5244      if (helper = helpers.getTitle) {
5245        stack1 = helper.call(depth0, {hash:{}, data:data});
5246      } else {
5247        helper = depth0 && depth0.getTitle;
5248        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5249      }
5250      buffer += escapeExpression(stack1) + '"><div class="hm-es-event-list-item-avatar-wrapper"><div class="hm-es-event-list-item-avatar"></div></div><div class="hm-es-event-list-item-datetime"><div class="hm-es-event-list-item-date">' + escapeExpression((helper = helpers.datetime || depth0 && depth0.datetime, options = {hash:{}, data:data}, helper ? helper.call(depth0, depth0 && depth0.creationDate, "dd mmm", options) : helperMissing.call(depth0, "datetime", depth0 && depth0.creationDate, "dd mmm", 
5251      options))) + "</div>" + escapeExpression((helper = helpers.datetime || depth0 && depth0.datetime, options = {hash:{}, data:data}, helper ? helper.call(depth0, depth0 && depth0.creationDate, "HH:MM", options) : helperMissing.call(depth0, "datetime", depth0 && depth0.creationDate, "HH:MM", options))) + "</div>";
5252      stack1 = helpers["if"].call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.showPortfolioAction), {hash:{}, inverse:self.noop, fn:self.program(1, program1, data), data:data});
5253      if (stack1 || stack1 === 0) {
5254        buffer += stack1;
5255      }
5256      buffer += '<span class="hm-es-event-list-item-author">';
5257      if (helper = helpers.getAuthor) {
5258        stack1 = helper.call(depth0, {hash:{}, data:data});
5259      } else {
5260        helper = depth0 && depth0.getAuthor;
5261        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5262      }
5263      buffer += escapeExpression(stack1) + "</span> " + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "добавил(а) новый материал", options) : helperMissing.call(depth0, "_", "добавил(а) новый материал", options))) + 
5264      " <q>" + escapeExpression((stack1 = (stack1 = depth0 && depth0.description, stack1 == null || stack1 === false ? stack1 : stack1.title), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '</q><div class="hm-clear"></div></div>';
5265      return buffer;
5266    });
5267    registerTemplate("hm/module/es/ui/event/list/item/course/CourseAttachLesson.hbs", function(Handlebars, depth0, helpers, partials, data) {
5268      this.compilerInfo = [4, ">= 1.0.0"];
5269      helpers = this.merge(helpers, Handlebars.helpers);
5270      data = data || {};
5271      var buffer = "", stack1, helper, options, helperMissing = helpers.helperMissing, escapeExpression = this.escapeExpression, functionType = "function", self = this;
5272      function program1(depth0, data) {
5273        var buffer = "", helper, options;
5274        buffer += '<div class="hm-es-event-list-item-portfolio-add"><a href="#add">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Добавить в портфолио", options) : helperMissing.call(depth0, "_", "Добавить в портфолио", options))) + "</a></div>";
5275        return buffer;
5276      }
5277      buffer += '<div class="hm-es-event-list-item hm-es-event-list-item-forum" title="';
5278      if (helper = helpers.getTitle) {
5279        stack1 = helper.call(depth0, {hash:{}, data:data});
5280      } else {
5281        helper = depth0 && depth0.getTitle;
5282        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5283      }
5284      buffer += escapeExpression(stack1) + '"><div class="hm-es-event-list-item-datetime"><div class="hm-es-event-list-item-date">' + escapeExpression((helper = helpers.datetime || depth0 && depth0.datetime, options = {hash:{}, data:data}, helper ? helper.call(depth0, depth0 && depth0.creationDate, "dd mmm", options) : helperMissing.call(depth0, "datetime", depth0 && depth0.creationDate, "dd mmm", options))) + "</div>" + escapeExpression((helper = helpers.datetime || depth0 && depth0.datetime, options = 
5285      {hash:{}, data:data}, helper ? helper.call(depth0, depth0 && depth0.creationDate, "HH:MM", options) : helperMissing.call(depth0, "datetime", depth0 && depth0.creationDate, "HH:MM", options))) + "</div>";
5286      stack1 = helpers["if"].call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.showPortfolioAction), {hash:{}, inverse:self.noop, fn:self.program(1, program1, data), data:data});
5287      if (stack1 || stack1 === 0) {
5288        buffer += stack1;
5289      }
5290      buffer += escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Вам назначено новое занятие", options) : helperMissing.call(depth0, "_", "Вам назначено новое занятие", options))) + " <q>" + 
5291      escapeExpression((stack1 = (stack1 = depth0 && depth0.description, stack1 == null || stack1 === false ? stack1 : stack1.title), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '</q><div class="hm-clear"></div></div>';
5292      return buffer;
5293    });
5294    registerTemplate("hm/module/es/ui/event/list/item/course/CourseScoreTriggered.hbs", function(Handlebars, depth0, helpers, partials, data) {
5295      this.compilerInfo = [4, ">= 1.0.0"];
5296      helpers = this.merge(helpers, Handlebars.helpers);
5297      data = data || {};
5298      var buffer = "", stack1, helper, options, helperMissing = helpers.helperMissing, escapeExpression = this.escapeExpression, functionType = "function", self = this;
5299      function program1(depth0, data) {
5300        var buffer = "", helper, options;
5301        buffer += '<div class="hm-es-event-list-item-portfolio-add"><a href="#add">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Добавить в портфолио", options) : helperMissing.call(depth0, "_", "Добавить в портфолио", options))) + "</a></div>";
5302        return buffer;
5303      }
5304      buffer += '<div class="hm-es-event-list-item hm-es-event-list-item-forum" title="' + escapeExpression((stack1 = (stack1 = depth0 && depth0.description, stack1 == null || stack1 === false ? stack1 : stack1.title), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '"><div class="hm-es-event-list-item-datetime"><div class="hm-es-event-list-item-date">' + escapeExpression((helper = helpers.datetime || depth0 && depth0.datetime, options = {hash:{}, data:data}, helper ? helper.call(depth0, 
5305      depth0 && depth0.creationDate, "dd mmm", options) : helperMissing.call(depth0, "datetime", depth0 && depth0.creationDate, "dd mmm", options))) + "</div>" + escapeExpression((helper = helpers.datetime || depth0 && depth0.datetime, options = {hash:{}, data:data}, helper ? helper.call(depth0, depth0 && depth0.creationDate, "HH:MM", options) : helperMissing.call(depth0, "datetime", depth0 && depth0.creationDate, "HH:MM", options))) + "</div>";
5306      stack1 = helpers["if"].call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.showPortfolioAction), {hash:{}, inverse:self.noop, fn:self.program(1, program1, data), data:data});
5307      if (stack1 || stack1 === 0) {
5308        buffer += stack1;
5309      }
5310      buffer += escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Вам выставлена итоговая оценка", options) : helperMissing.call(depth0, "_", "Вам выставлена итоговая оценка", 
5311      options))) + " &laquo;" + escapeExpression((stack1 = (stack1 = depth0 && depth0.description, stack1 == null || stack1 === false ? stack1 : stack1.mark), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + "&raquo; " + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "за курс", options) : helperMissing.call(depth0, "_", "за курс", options))) + " &laquo;" + 
5312      escapeExpression((stack1 = (stack1 = depth0 && depth0.description, stack1 == null || stack1 === false ? stack1 : stack1.course_name), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '&raquo;<div class="hm-clear"></div></div>';
5313      return buffer;
5314    });
5315    registerTemplate("hm/module/es/ui/event/list/item/course/CourseTaskAction.hbs", function(Handlebars, depth0, helpers, partials, data) {
5316      this.compilerInfo = [4, ">= 1.0.0"];
5317      helpers = this.merge(helpers, Handlebars.helpers);
5318      data = data || {};
5319      var buffer = "", stack1, helper, options, helperMissing = helpers.helperMissing, escapeExpression = this.escapeExpression, self = this, functionType = "function";
5320      function program1(depth0, data) {
5321        var buffer = "", helper, options;
5322        buffer += '<div class="hm-es-event-list-item-portfolio-add"><a href="#add">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Добавить в портфолио", options) : helperMissing.call(depth0, "_", "Добавить в портфолио", options))) + "</a></div>";
5323        return buffer;
5324      }
5325      buffer += '<div class="hm-es-event-list-item hm-es-event-list-item-forum"><div class="hm-es-event-list-item-avatar-wrapper"><div class="hm-es-event-list-item-avatar"></div></div><div class="hm-es-event-list-item-datetime"><div class="hm-es-event-list-item-date">' + escapeExpression((helper = helpers.datetime || depth0 && depth0.datetime, options = {hash:{}, data:data}, helper ? helper.call(depth0, depth0 && depth0.creationDate, "dd mmm", options) : helperMissing.call(depth0, "datetime", depth0 && 
5326      depth0.creationDate, "dd mmm", options))) + "</div>" + escapeExpression((helper = helpers.datetime || depth0 && depth0.datetime, options = {hash:{}, data:data}, helper ? helper.call(depth0, depth0 && depth0.creationDate, "HH:MM", options) : helperMissing.call(depth0, "datetime", depth0 && depth0.creationDate, "HH:MM", options))) + "</div>";
5327      stack1 = helpers["if"].call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.showPortfolioAction), {hash:{}, inverse:self.noop, fn:self.program(1, program1, data), data:data});
5328      if (stack1 || stack1 === 0) {
5329        buffer += stack1;
5330      }
5331      buffer += '<span class="hm-es-event-list-item-author">' + escapeExpression((stack1 = (stack1 = depth0 && depth0.description, stack1 == null || stack1 === false ? stack1 : stack1.user_name), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + "</span> " + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "выполнил(-а) новое действие в задании", 
5332      options) : helperMissing.call(depth0, "_", "выполнил(-а) новое действие в задании", options))) + " <q>" + escapeExpression((stack1 = (stack1 = depth0 && depth0.description, stack1 == null || stack1 === false ? stack1 : stack1.lesson_name), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '</q><div class="hm-es-event-list-item-desc">';
5333      stack1 = (stack1 = (stack1 = depth0 && depth0.description, stack1 == null || stack1 === false ? stack1 : stack1.message), typeof stack1 === functionType ? stack1.apply(depth0) : stack1);
5334      if (stack1 || stack1 === 0) {
5335        buffer += stack1;
5336      }
5337      buffer += '</div><div class="hm-clear"></div></div>';
5338      return buffer;
5339    });
5340    registerTemplate("hm/module/es/ui/event/list/item/course/CourseTaskComplete.hbs", function(Handlebars, depth0, helpers, partials, data) {
5341      this.compilerInfo = [4, ">= 1.0.0"];
5342      helpers = this.merge(helpers, Handlebars.helpers);
5343      data = data || {};
5344      var buffer = "", stack1, helper, options, helperMissing = helpers.helperMissing, escapeExpression = this.escapeExpression, self = this, functionType = "function";
5345      function program1(depth0, data) {
5346        var buffer = "", helper, options;
5347        buffer += '<div class="hm-es-event-list-item-portfolio-add"><a href="#add">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Добавить в портфолио", options) : helperMissing.call(depth0, "_", "Добавить в портфолио", options))) + "</a></div>";
5348        return buffer;
5349      }
5350      buffer += '<div class="hm-es-event-list-item hm-es-event-list-item-forum"><div class="hm-es-event-list-item-avatar-wrapper"><div class="hm-es-event-list-item-avatar"></div></div><div class="hm-es-event-list-item-datetime"><div class="hm-es-event-list-item-date">' + escapeExpression((helper = helpers.datetime || depth0 && depth0.datetime, options = {hash:{}, data:data}, helper ? helper.call(depth0, depth0 && depth0.creationDate, "dd mmm", options) : helperMissing.call(depth0, "datetime", depth0 && 
5351      depth0.creationDate, "dd mmm", options))) + "</div>" + escapeExpression((helper = helpers.datetime || depth0 && depth0.datetime, options = {hash:{}, data:data}, helper ? helper.call(depth0, depth0 && depth0.creationDate, "HH:MM", options) : helperMissing.call(depth0, "datetime", depth0 && depth0.creationDate, "HH:MM", options))) + "</div>";
5352      stack1 = helpers["if"].call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.showPortfolioAction), {hash:{}, inverse:self.noop, fn:self.program(1, program1, data), data:data});
5353      if (stack1 || stack1 === 0) {
5354        buffer += stack1;
5355      }
5356      buffer += '<span class="hm-es-event-list-item-author">' + escapeExpression((stack1 = (stack1 = depth0 && depth0.description, stack1 == null || stack1 === false ? stack1 : stack1.user_name), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + "</span> " + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "выполнил(а) задание", options) : 
5357      helperMissing.call(depth0, "_", "выполнил(а) задание", options))) + " <q>" + escapeExpression((stack1 = (stack1 = depth0 && depth0.description, stack1 == null || stack1 === false ? stack1 : stack1.lesson_name), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '</q><div class="hm-es-event-list-item-desc">';
5358      stack1 = (stack1 = (stack1 = depth0 && depth0.description, stack1 == null || stack1 === false ? stack1 : stack1.message), typeof stack1 === functionType ? stack1.apply(depth0) : stack1);
5359      if (stack1 || stack1 === 0) {
5360        buffer += stack1;
5361      }
5362      buffer += '</div><div class="hm-clear"></div></div>';
5363      return buffer;
5364    });
5365    registerTemplate("hm/module/es/ui/event/list/item/course/CourseTaskScoreTriggered.hbs", function(Handlebars, depth0, helpers, partials, data) {
5366      this.compilerInfo = [4, ">= 1.0.0"];
5367      helpers = this.merge(helpers, Handlebars.helpers);
5368      data = data || {};
5369      var buffer = "", stack1, helper, options, helperMissing = helpers.helperMissing, escapeExpression = this.escapeExpression, functionType = "function", self = this;
5370      function program1(depth0, data) {
5371        var buffer = "", helper, options;
5372        buffer += '<div class="hm-es-event-list-item-portfolio-add"><a href="#add">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Добавить в портфолио", options) : helperMissing.call(depth0, "_", "Добавить в портфолио", options))) + "</a></div>";
5373        return buffer;
5374      }
5375      buffer += '<div class="hm-es-event-list-item hm-es-event-list-item-forum" title="';
5376      if (helper = helpers.getTitle) {
5377        stack1 = helper.call(depth0, {hash:{}, data:data});
5378      } else {
5379        helper = depth0 && depth0.getTitle;
5380        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5381      }
5382      buffer += escapeExpression(stack1) + '"><div class="hm-es-event-list-item-datetime"><div class="hm-es-event-list-item-date">' + escapeExpression((helper = helpers.datetime || depth0 && depth0.datetime, options = {hash:{}, data:data}, helper ? helper.call(depth0, depth0 && depth0.creationDate, "dd mmm", options) : helperMissing.call(depth0, "datetime", depth0 && depth0.creationDate, "dd mmm", options))) + "</div>" + escapeExpression((helper = helpers.datetime || depth0 && depth0.datetime, options = 
5383      {hash:{}, data:data}, helper ? helper.call(depth0, depth0 && depth0.creationDate, "HH:MM", options) : helperMissing.call(depth0, "datetime", depth0 && depth0.creationDate, "HH:MM", options))) + "</div>";
5384      stack1 = helpers["if"].call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.showPortfolioAction), {hash:{}, inverse:self.noop, fn:self.program(1, program1, data), data:data});
5385      if (stack1 || stack1 === 0) {
5386        buffer += stack1;
5387      }
5388      buffer += escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "В занятии", options) : helperMissing.call(depth0, "_", "В занятии", options))) + " <q>" + escapeExpression((stack1 = (stack1 = depth0 && depth0.description, stack1 == null || stack1 === false ? stack1 : stack1.lesson_title), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + 
5389      "</q> " + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Вам была поставлена оценка", options) : helperMissing.call(depth0, "_", "Вам была поставлена оценка", options))) + '<div class="hm-clear"></div></div>';
5390      return buffer;
5391    });
5392    registerTemplate("hm/module/es/ui/event/list/item/forum/ForumAddMessage.hbs", function(Handlebars, depth0, helpers, partials, data) {
5393      this.compilerInfo = [4, ">= 1.0.0"];
5394      helpers = this.merge(helpers, Handlebars.helpers);
5395      data = data || {};
5396      var buffer = "", stack1, helper, options, helperMissing = helpers.helperMissing, escapeExpression = this.escapeExpression, functionType = "function";
5397      buffer += '<div class="hm-es-event-list-item"><div class="hm-es-event-list-item-avatar-wrapper"><div class="hm-es-event-list-item-avatar"></div></div><div class="hm-es-event-list-item-datetime"><div class="hm-es-event-list-item-date">' + escapeExpression((helper = helpers.datetime || depth0 && depth0.datetime, options = {hash:{}, data:data}, helper ? helper.call(depth0, depth0 && depth0.creationDate, "dd mmm", options) : helperMissing.call(depth0, "datetime", depth0 && depth0.creationDate, 
5398      "dd mmm", options))) + "</div>" + escapeExpression((helper = helpers.datetime || depth0 && depth0.datetime, options = {hash:{}, data:data}, helper ? helper.call(depth0, depth0 && depth0.creationDate, "HH:MM", options) : helperMissing.call(depth0, "datetime", depth0 && depth0.creationDate, "HH:MM", options))) + '</div><div><span class="hm-es-event-list-item-author">' + escapeExpression((stack1 = (stack1 = depth0 && depth0.description, stack1 == null || stack1 === false ? stack1 : stack1.user_name), 
5399      typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + "</span> " + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "добавил(а) сообщение", options) : helperMissing.call(depth0, "_", "добавил(а) сообщение", options))) + ' "' + escapeExpression((stack1 = 
5400      (stack1 = depth0 && depth0.description, stack1 == null || stack1 === false ? stack1 : stack1.title), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '"</div><div class="hm-es-event-list-item-desc">' + escapeExpression((helper = helpers.cropText || depth0 && depth0.cropText, options = {hash:{}, data:data}, helper ? helper.call(depth0, (stack1 = depth0 && depth0.description, stack1 == null || stack1 === false ? stack1 : stack1.text), 100, options) : helperMissing.call(depth0, 
5401      "cropText", (stack1 = depth0 && depth0.description, stack1 == null || stack1 === false ? stack1 : stack1.text), 100, options))) + "</div></div>";
5402      return buffer;
5403    });
5404    registerTemplate("hm/module/es/ui/event/list/item/personalMessage/PersonalMessage.hbs", function(Handlebars, depth0, helpers, partials, data) {
5405      this.compilerInfo = [4, ">= 1.0.0"];
5406      helpers = this.merge(helpers, Handlebars.helpers);
5407      data = data || {};
5408      var buffer = "", stack1, helper, options, helperMissing = helpers.helperMissing, escapeExpression = this.escapeExpression, self = this;
5409      function program1(depth0, data) {
5410        var buffer = "", helper, options;
5411        buffer += '<div class="hm-es-event-list-item-portfolio-add"><a href="#add">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Добавить в портфолио", options) : helperMissing.call(depth0, "_", "Добавить в портфолио", options))) + "</a></div>";
5412        return buffer;
5413      }
5414      buffer += '<div class="hm-es-event-list-item hm-es-event-list-item-message" title="' + escapeExpression((helper = helpers.cropText || depth0 && depth0.cropText, options = {hash:{}, data:data}, helper ? helper.call(depth0, (stack1 = depth0 && depth0.description, stack1 == null || stack1 === false ? stack1 : stack1.message), options) : helperMissing.call(depth0, "cropText", (stack1 = depth0 && depth0.description, stack1 == null || stack1 === false ? stack1 : stack1.message), options))) + '"><div class="hm-es-event-list-item-datetime"><div class="hm-es-event-list-item-date">' + 
5415      escapeExpression((helper = helpers.datetime || depth0 && depth0.datetime, options = {hash:{}, data:data}, helper ? helper.call(depth0, depth0 && depth0.creationDate, "dd mmm", options) : helperMissing.call(depth0, "datetime", depth0 && depth0.creationDate, "dd mmm", options))) + "</div>" + escapeExpression((helper = helpers.datetime || depth0 && depth0.datetime, options = {hash:{}, data:data}, helper ? helper.call(depth0, depth0 && depth0.creationDate, "HH:MM", options) : helperMissing.call(depth0, 
5416      "datetime", depth0 && depth0.creationDate, "HH:MM", options))) + "</div>";
5417      stack1 = helpers["if"].call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.showPortfolioAction), {hash:{}, inverse:self.noop, fn:self.program(1, program1, data), data:data});
5418      if (stack1 || stack1 === 0) {
5419        buffer += stack1;
5420      }
5421      buffer += '<div class="hm-es-event-list-item-desc">' + escapeExpression((helper = helpers.cropText || depth0 && depth0.cropText, options = {hash:{}, data:data}, helper ? helper.call(depth0, (stack1 = depth0 && depth0.description, stack1 == null || stack1 === false ? stack1 : stack1.message), 100, options) : helperMissing.call(depth0, "cropText", (stack1 = depth0 && depth0.description, stack1 == null || stack1 === false ? stack1 : stack1.message), 100, options))) + '</div><div class="hm-clear"></div></div>';
5422      return buffer;
5423    });
5424    registerTemplate("hm/module/es/ui/event/list/item/wiki/WikiPage.hbs", function(Handlebars, depth0, helpers, partials, data) {
5425      this.compilerInfo = [4, ">= 1.0.0"];
5426      helpers = this.merge(helpers, Handlebars.helpers);
5427      data = data || {};
5428      var buffer = "", stack1, helper, options, helperMissing = helpers.helperMissing, escapeExpression = this.escapeExpression, functionType = "function";
5429      buffer += '<div class="hm-es-event-list-item hm-es-event-list-item-wiki"><div class="hm-es-event-list-item-avatar-wrapper"><div class="hm-es-event-list-item-avatar"></div></div><div class="hm-es-event-list-item-datetime"><div class="hm-es-event-list-item-date">' + escapeExpression((helper = helpers.datetime || depth0 && depth0.datetime, options = {hash:{}, data:data}, helper ? helper.call(depth0, depth0 && depth0.creationDate, "dd mmm", options) : helperMissing.call(depth0, "datetime", depth0 && 
5430      depth0.creationDate, "dd mmm", options))) + "</div>" + escapeExpression((helper = helpers.datetime || depth0 && depth0.datetime, options = {hash:{}, data:data}, helper ? helper.call(depth0, depth0 && depth0.creationDate, "HH:MM", options) : helperMissing.call(depth0, "datetime", depth0 && depth0.creationDate, "HH:MM", options))) + '</div><span class="hm-es-event-list-item-author">';
5431      if (helper = helpers.getAuthor) {
5432        stack1 = helper.call(depth0, {hash:{}, data:data});
5433      } else {
5434        helper = depth0 && depth0.getAuthor;
5435        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5436      }
5437      buffer += escapeExpression(stack1) + "</span> ";
5438      if (helper = helpers.actionTitle) {
5439        stack1 = helper.call(depth0, {hash:{}, data:data});
5440      } else {
5441        helper = depth0 && depth0.actionTitle;
5442        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5443      }
5444      buffer += escapeExpression(stack1) + " " + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "страницу", options) : helperMissing.call(depth0, "_", "страницу", options))) + " <q>" + escapeExpression((stack1 = (stack1 = depth0 && depth0.description, stack1 == null || stack1 === false ? stack1 : stack1.title), typeof stack1 === functionType ? stack1.apply(depth0) : 
5445      stack1)) + '</q><div class="hm-clear"></div></div>';
5446      return buffer;
5447    });
5448    registerTemplate("hm/module/es/ui/event/panel/EventListPanel.hbs", function(Handlebars, depth0, helpers, partials, data) {
5449      this.compilerInfo = [4, ">= 1.0.0"];
5450      helpers = this.merge(helpers, Handlebars.helpers);
5451      data = data || {};
5452      var buffer = "", helper, options, helperMissing = helpers.helperMissing, escapeExpression = this.escapeExpression;
5453      buffer += '<div class="hm-es-event-panel"><div class="hm-es-event-list-container"></div><div class="hm-es-event-panel-trigger">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Просмотреть предыдущие", options) : helperMissing.call(depth0, "_", "Просмотреть предыдущие", 
5454      options))) + "</div></div>";
5455      return buffer;
5456    });
5457    registerTemplate("hm/module/es/ui/event/toolbar/EventToolbar.hbs", function(Handlebars, depth0, helpers, partials, data) {
5458      this.compilerInfo = [4, ">= 1.0.0"];
5459      helpers = this.merge(helpers, Handlebars.helpers);
5460      data = data || {};
5461      return'<div class="hm-es-event-toolbar"></div>';
5462    });
5463    registerTemplate("hm/module/es/ui/event/toolbar/button/EventToolbarButton.hbs", function(Handlebars, depth0, helpers, partials, data) {
5464      this.compilerInfo = [4, ">= 1.0.0"];
5465      helpers = this.merge(helpers, Handlebars.helpers);
5466      data = data || {};
5467      var buffer = "", stack1, functionType = "function", escapeExpression = this.escapeExpression;
5468      buffer += '<div class="hm-es-event-toolbar-button"><span class="hm-es-event-toolbar-button-caption">' + escapeExpression((stack1 = (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.caption), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '</span><span class="hm-es-event-toolbar-button-icon-tab"><span class="hm-es-event-toolbar-button-icon">' + escapeExpression((stack1 = (stack1 = depth0 && depth0.config, stack1 == null || stack1 === 
5469      false ? stack1 : stack1.count), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + "</span></span></div>";
5470      return buffer;
5471    });
5472    registerTemplate("hm/module/messenger/ui/Messenger.hbs", function(Handlebars, depth0, helpers, partials, data) {
5473      this.compilerInfo = [4, ">= 1.0.0"];
5474      helpers = this.merge(helpers, Handlebars.helpers);
5475      data = data || {};
5476      var buffer = "", stack1, helper, options, functionType = "function", escapeExpression = this.escapeExpression, helperMissing = helpers.helperMissing;
5477      buffer += '<div class="';
5478      if (helper = helpers.ns) {
5479        stack1 = helper.call(depth0, {hash:{}, data:data});
5480      } else {
5481        helper = depth0 && depth0.ns;
5482        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5483      }
5484      buffer += escapeExpression(stack1) + '"><div class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "messages-list-wrap", options) : helperMissing.call(depth0, "ns", "messages-list-wrap", options))) + '"><table class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "messages-placeholder", options) : helperMissing.call(depth0, "ns", "messages-placeholder", 
5485      options))) + '"><tr><td><ul><li>' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Для просмотра переписки и отправки сообщений выберите контакт справа.", 
5486      options) : helperMissing.call(depth0, "_", "Для просмотра переписки и отправки сообщений выберите контакт справа.", options))) + "</li><li>" + escapeExpression((helper = helpers._ || depth0 && depth0._, 
5487      options = {hash:{}, data:data}, helper ? helper.call(depth0, "Для начала новой переписки выполните поиск пользователей в поле «Кому».", options) : helperMissing.call(depth0, "_", "Для начала новой переписки выполните поиск пользователей в поле «Кому».", 
5488      options))) + "</li><li>" + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Для поиска введите любое сочетание букв из фамилии, имени и отчества.", 
5489      options) : helperMissing.call(depth0, "_", "Для поиска введите любое сочетание букв из фамилии, имени и отчества.", options))) + "</li><li>" + escapeExpression((helper = helpers._ || depth0 && depth0._, options = 
5490      {hash:{}, data:data}, helper ? helper.call(depth0, "Можно отправлять сообщения сразу нескольким пользователям.", options) : helperMissing.call(depth0, "_", "Можно отправлять сообщения сразу нескольким пользователям.", 
5491      options))) + "</li><li>" + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Для быстрого добавления пользователей в поле «Кому» нажмите на имеющиеся контакты справа, зажав Ctrl.", 
5492      options) : helperMissing.call(depth0, "_", "Для быстрого добавления пользователей в поле «Кому» нажмите на имеющиеся контакты справа, зажав Ctrl.", 
5493      options))) + '</li></ul></td></tr></table></div><div class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "contacts-list-wrap", options) : helperMissing.call(depth0, "ns", "contacts-list-wrap", options))) + '"></div><div class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "input-wrap", options) : helperMissing.call(depth0, "ns", "input-wrap", 
5494      options))) + '"></div></div>';
5495      return buffer;
5496    });
5497    registerTemplate("hm/module/messenger/ui/contact/Contact.hbs", function(Handlebars, depth0, helpers, partials, data) {
5498      this.compilerInfo = [4, ">= 1.0.0"];
5499      helpers = this.merge(helpers, Handlebars.helpers);
5500      data = data || {};
5501      var buffer = "", stack1, helper, options, functionType = "function", escapeExpression = this.escapeExpression, helperMissing = helpers.helperMissing, self = this;
5502      function program1(depth0, data) {
5503        var buffer = "", stack1, helper;
5504        buffer += "/";
5505        if (helper = helpers.getIcon) {
5506          stack1 = helper.call(depth0, {hash:{}, data:data});
5507        } else {
5508          helper = depth0 && depth0.getIcon;
5509          stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5510        }
5511        buffer += escapeExpression(stack1);
5512        return buffer;
5513      }
5514      function program3(depth0, data) {
5515        return "/images/content-modules/nophoto.gif";
5516      }
5517      buffer += '<div class="';
5518      if (helper = helpers.ns) {
5519        stack1 = helper.call(depth0, {hash:{}, data:data});
5520      } else {
5521        helper = depth0 && depth0.ns;
5522        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5523      }
5524      buffer += escapeExpression(stack1) + '"><table><tr><td><div class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "icon", options) : helperMissing.call(depth0, "ns", "icon", options))) + '" style="background-image: url(\'';
5525      stack1 = helpers["if"].call(depth0, depth0 && depth0.getIcon, {hash:{}, inverse:self.program(3, program3, data), fn:self.program(1, program1, data), data:data});
5526      if (stack1 || stack1 === 0) {
5527        buffer += stack1;
5528      }
5529      buffer += '\');"></div></td><td><div class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "name", options) : helperMissing.call(depth0, "ns", "name", options))) + '">';
5530      if (helper = helpers.getName) {
5531        stack1 = helper.call(depth0, {hash:{}, data:data});
5532      } else {
5533        helper = depth0 && depth0.getName;
5534        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5535      }
5536      buffer += escapeExpression(stack1) + '&nbsp;<span class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "new-count", options) : helperMissing.call(depth0, "ns", "new-count", options))) + '">0</span></div></td></tr></table></div>';
5537      return buffer;
5538    });
5539    registerTemplate("hm/module/messenger/ui/contact/ContactsList.hbs", function(Handlebars, depth0, helpers, partials, data) {
5540      this.compilerInfo = [4, ">= 1.0.0"];
5541      helpers = this.merge(helpers, Handlebars.helpers);
5542      data = data || {};
5543      var buffer = "", stack1, helper, options, functionType = "function", escapeExpression = this.escapeExpression, helperMissing = helpers.helperMissing;
5544      buffer += '<div class="';
5545      if (helper = helpers.ns) {
5546        stack1 = helper.call(depth0, {hash:{}, data:data});
5547      } else {
5548        helper = depth0 && depth0.ns;
5549        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5550      }
5551      buffer += escapeExpression(stack1) + '"><div class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "items-container", options) : helperMissing.call(depth0, "ns", "items-container", options))) + '"></div></div>';
5552      return buffer;
5553    });
5554    registerTemplate("hm/module/messenger/ui/input/Input.hbs", function(Handlebars, depth0, helpers, partials, data) {
5555      this.compilerInfo = [4, ">= 1.0.0"];
5556      helpers = this.merge(helpers, Handlebars.helpers);
5557      data = data || {};
5558      var buffer = "", stack1, helper, functionType = "function", escapeExpression = this.escapeExpression;
5559      buffer += '<div class="';
5560      if (helper = helpers.ns) {
5561        stack1 = helper.call(depth0, {hash:{}, data:data});
5562      } else {
5563        helper = depth0 && depth0.ns;
5564        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5565      }
5566      buffer += escapeExpression(stack1) + '"></div>';
5567      return buffer;
5568    });
5569    registerTemplate("hm/module/messenger/ui/message/Message.hbs", function(Handlebars, depth0, helpers, partials, data) {
5570      this.compilerInfo = [4, ">= 1.0.0"];
5571      helpers = this.merge(helpers, Handlebars.helpers);
5572      data = data || {};
5573      var buffer = "", stack1, helper, options, functionType = "function", escapeExpression = this.escapeExpression, helperMissing = helpers.helperMissing;
5574      buffer += '<div class="';
5575      if (helper = helpers.ns) {
5576        stack1 = helper.call(depth0, {hash:{}, data:data});
5577      } else {
5578        helper = depth0 && depth0.ns;
5579        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5580      }
5581      buffer += escapeExpression(stack1) + " ";
5582      if (helper = helpers.isMyClass) {
5583        stack1 = helper.call(depth0, {hash:{}, data:data});
5584      } else {
5585        helper = depth0 && depth0.isMyClass;
5586        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5587      }
5588      buffer += escapeExpression(stack1) + " ";
5589      if (helper = helpers.isNewClass) {
5590        stack1 = helper.call(depth0, {hash:{}, data:data});
5591      } else {
5592        helper = depth0 && depth0.isNewClass;
5593        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5594      }
5595      buffer += escapeExpression(stack1) + '"><div class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "date", options) : helperMissing.call(depth0, "ns", "date", options))) + '">' + escapeExpression((helper = helpers.getDate || depth0 && depth0.getDate, options = {hash:{}, data:data}, helper ? helper.call(depth0, "dd.mm.yyyy HH:MM:ss", options) : helperMissing.call(depth0, "getDate", "dd.mm.yyyy HH:MM:ss", options))) + 
5596      '</div><div class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "delimiter", options) : helperMissing.call(depth0, "ns", "delimiter", options))) + '">,&nbsp;</div><div class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "author", options) : helperMissing.call(depth0, "ns", "author", options))) + '">';
5597      if (helper = helpers.getAuthorName) {
5598        stack1 = helper.call(depth0, {hash:{}, data:data});
5599      } else {
5600        helper = depth0 && depth0.getAuthorName;
5601        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5602      }
5603      buffer += escapeExpression(stack1) + '</div><div class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "message", options) : helperMissing.call(depth0, "ns", "message", options))) + '">';
5604      if (helper = helpers.getMessage) {
5605        stack1 = helper.call(depth0, {hash:{}, data:data});
5606      } else {
5607        helper = depth0 && depth0.getMessage;
5608        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5609      }
5610      if (stack1 || stack1 === 0) {
5611        buffer += stack1;
5612      }
5613      buffer += '<div class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "indicator", options) : helperMissing.call(depth0, "ns", "indicator", options))) + '"></div></div></div>';
5614      return buffer;
5615    });
5616    registerTemplate("hm/module/messenger/ui/message/MessagesList.hbs", function(Handlebars, depth0, helpers, partials, data) {
5617      this.compilerInfo = [4, ">= 1.0.0"];
5618      helpers = this.merge(helpers, Handlebars.helpers);
5619      data = data || {};
5620      var buffer = "", stack1, helper, options, functionType = "function", escapeExpression = this.escapeExpression, helperMissing = helpers.helperMissing;
5621      buffer += '<div class="';
5622      if (helper = helpers.ns) {
5623        stack1 = helper.call(depth0, {hash:{}, data:data});
5624      } else {
5625        helper = depth0 && depth0.ns;
5626        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5627      }
5628      buffer += escapeExpression(stack1) + '"><div class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "items-container", options) : helperMissing.call(depth0, "ns", "items-container", options))) + '"></div></div>';
5629      return buffer;
5630    });
5631    registerTemplate("hm/core/ui/trainingModulesConstructor/Constructor.hbs", function(Handlebars, depth0, helpers, partials, data) {
5632      this.compilerInfo = [4, ">= 1.0.0"];
5633      helpers = this.merge(helpers, Handlebars.helpers);
5634      data = data || {};
5635      return'<div><div class="hm-constructor-tree" style="width: 49%; float: left;"></div><div class="hm-constructor-search" style="width: 49%; float: right;"></div></div>';
5636    });
5637    registerTemplate("hm/core/ui/trainingModulesConstructor/ResourceItem.hbs", function(Handlebars, depth0, helpers, partials, data) {
5638      this.compilerInfo = [4, ">= 1.0.0"];
5639      helpers = this.merge(helpers, Handlebars.helpers);
5640      data = data || {};
5641      var buffer = "", stack1, helper, options, functionType = "function", escapeExpression = this.escapeExpression, helperMissing = helpers.helperMissing;
5642      buffer += '<div class="hm-search-resource-item"><a class="material-icon-small ';
5643      if (helper = helpers.getIconClass) {
5644        stack1 = helper.call(depth0, {hash:{}, data:data});
5645      } else {
5646        helper = depth0 && depth0.getIconClass;
5647        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5648      }
5649      buffer += escapeExpression(stack1) + '" title="' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Открыть карточку", options) : helperMissing.call(depth0, "_", "Открыть карточку", options))) + '" href="#"></a><a class="hm-search-resource-item-title" title="' + escapeExpression((helper = 
5650      helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Открыть в новом окне", options) : helperMissing.call(depth0, "_", "Открыть в новом окне", options))) + '"  href="';
5651      if (helper = helpers.getViewUrl) {
5652        stack1 = helper.call(depth0, {hash:{}, data:data});
5653      } else {
5654        helper = depth0 && depth0.getViewUrl;
5655        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5656      }
5657      buffer += escapeExpression(stack1) + '">';
5658      if (helper = helpers.getTitle) {
5659        stack1 = helper.call(depth0, {hash:{}, data:data});
5660      } else {
5661        helper = depth0 && depth0.getTitle;
5662        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5663      }
5664      buffer += escapeExpression(stack1) + "</a></div>";
5665      return buffer;
5666    });
5667    registerTemplate("hm/core/ui/trainingModulesConstructor/ResourcesSearch.hbs", function(Handlebars, depth0, helpers, partials, data) {
5668      this.compilerInfo = [4, ">= 1.0.0"];
5669      helpers = this.merge(helpers, Handlebars.helpers);
5670      data = data || {};
5671      var buffer = "", stack1, helper, options, functionType = "function", escapeExpression = this.escapeExpression, self = this, helperMissing = helpers.helperMissing;
5672      function program1(depth0, data) {
5673        return'<div class="hm-sphinx-search-run-indexer"><a href="#">Запустить индексацию данных</a></div>';
5674      }
5675      function program3(depth0, data) {
5676        var stack1;
5677        stack1 = helpers.unless.call(depth0, depth0 && depth0.hidden, {hash:{}, inverse:self.noop, fn:self.program(4, program4, data), data:data});
5678        if (stack1 || stack1 === 0) {
5679          return stack1;
5680        } else {
5681          return "";
5682        }
5683      }
5684      function program4(depth0, data) {
5685        var buffer = "", stack1, helper;
5686        buffer += '<tr><td class="hm-sphinx-search-label">';
5687        if (helper = helpers.label) {
5688          stack1 = helper.call(depth0, {hash:{}, data:data});
5689        } else {
5690          helper = depth0 && depth0.label;
5691          stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5692        }
5693        buffer += escapeExpression(stack1) + ": </td>";
5694        stack1 = helpers["if"].call(depth0, depth0 && depth0.options, {hash:{}, inverse:self.program(8, program8, data), fn:self.program(5, program5, data), data:data});
5695        if (stack1 || stack1 === 0) {
5696          buffer += stack1;
5697        }
5698        buffer += "</tr>";
5699        return buffer;
5700      }
5701      function program5(depth0, data) {
5702        var buffer = "", stack1;
5703        buffer += '<td><select name="' + escapeExpression((stack1 = data == null || data === false ? data : data.key, typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '"><option value=""></option>';
5704        stack1 = helpers.each.call(depth0, depth0 && depth0.options, {hash:{}, inverse:self.noop, fn:self.program(6, program6, data), data:data});
5705        if (stack1 || stack1 === 0) {
5706          buffer += stack1;
5707        }
5708        buffer += "</select></td>";
5709        return buffer;
5710      }
5711      function program6(depth0, data) {
5712        var buffer = "", stack1;
5713        buffer += '<option value="' + escapeExpression((stack1 = data == null || data === false ? data : data.key, typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '">' + escapeExpression(typeof depth0 === functionType ? depth0.apply(depth0) : depth0) + "</option>";
5714        return buffer;
5715      }
5716      function program8(depth0, data) {
5717        var buffer = "", stack1;
5718        buffer += '<td><input name="' + escapeExpression((stack1 = data == null || data === false ? data : data.key, typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '" value="" /></td>';
5719        return buffer;
5720      }
5721      buffer += '<div class="hm-sphinx-search-trainingModulesConstructor"><form><div class="hm-sphinx-search-form"><div><div class="hm-sphinx-search-title">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Поиск ресурсов", options) : helperMissing.call(depth0, "_", "Поиск ресурсов", options))) + 
5722      "</div>";
5723      stack1 = helpers["if"].call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.indexerUrl), {hash:{}, inverse:self.noop, fn:self.program(1, program1, data), data:data});
5724      if (stack1 || stack1 === 0) {
5725        buffer += stack1;
5726      }
5727      buffer += '</div><table><tbody><tr><td class="hm-sphinx-search-label">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Поиск по всем данным", options) : helperMissing.call(depth0, "_", "Поиск по всем данным", options))) + ': </td><td><input name="all" value="" /></td></tr><tr><td colspan="2" class="hm-sphinx-search-toggle-extended"><a class="hm-switcher" href="#">' + 
5728      escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Расширенный поиск", options) : helperMissing.call(depth0, "_", "Расширенный поиск", options))) + '</a></td></tr></tbody><tbody class="hm-sphinx-search-extended">';
5729      stack1 = helpers.each.call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.items), {hash:{}, inverse:self.noop, fn:self.program(3, program3, data), data:data});
5730      if (stack1 || stack1 === 0) {
5731        buffer += stack1;
5732      }
5733      buffer += '</tbody><tbody><tr><td></td><td><input type="submit" value="' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Найти", options) : helperMissing.call(depth0, "_", "Найти", options))) + '" /><input class="ui-button hm-sphinx-search-all" type="reset" value="' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? 
5734      helper.call(depth0, "Показать все", options) : helperMissing.call(depth0, "_", "Показать все", options))) + '" /></td></tr></tbody></table></div></form><div class="hm-search-result"></div></div>';
5735      return buffer;
5736    });
5737    registerTemplate("hm/core/ui/trainingModulesConstructor/Tree.hbs", function(Handlebars, depth0, helpers, partials, data) {
5738      this.compilerInfo = [4, ">= 1.0.0"];
5739      helpers = this.merge(helpers, Handlebars.helpers);
5740      data = data || {};
5741      var buffer = "", stack1, helper, options, functionType = "function", escapeExpression = this.escapeExpression, helperMissing = helpers.helperMissing;
5742      buffer += '<div class="hm-tree hm-tree-trainingModulesConstructor"><div class="hm-tree-title">' + escapeExpression((stack1 = (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.title), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '</div><div class="hm-tree-container"></div><div class="hm-tree-footer"><a href="#" class="hm-tree-add-section">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, 
5743      helper ? helper.call(depth0, "Создать раздел", options) : helperMissing.call(depth0, "_", "Создать раздел", options))) + '</a><div class="hm-tree-legend"><span class="hm-tree-legend-notFound"><span></span> ' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Ресурс удалён", 
5744      options) : helperMissing.call(depth0, "_", "Ресурс удалён", options))) + '</span><span class="hm-tree-legend-inDevelop"><span></span> ' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "В разработке", options) : helperMissing.call(depth0, "_", "В разработке", 
5745      options))) + "</span></div></div></div>";
5746      return buffer;
5747    });
5748    registerTemplate("hm/core/ui/trainingModulesConstructor/node/ResourceNode.hbs", function(Handlebars, depth0, helpers, partials, data) {
5749      this.compilerInfo = [4, ">= 1.0.0"];
5750      helpers = this.merge(helpers, Handlebars.helpers);
5751      data = data || {};
5752      var buffer = "", stack1, helper, functionType = "function", escapeExpression = this.escapeExpression;
5753      buffer += '<li class="hm-tree-node"><span class="hm-tree-node-item"><span class="hm-tree-node-connector"></span><span class="hm-tree-node-icon ';
5754      if (helper = helpers.getIconClass) {
5755        stack1 = helper.call(depth0, {hash:{}, data:data});
5756      } else {
5757        helper = depth0 && depth0.getIconClass;
5758        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5759      }
5760      buffer += escapeExpression(stack1) + '"></span><span class="hm-tree-node-status"></span><span class="hm-tree-node-title">';
5761      if (helper = helpers.getTitle) {
5762        stack1 = helper.call(depth0, {hash:{}, data:data});
5763      } else {
5764        helper = depth0 && depth0.getTitle;
5765        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5766      }
5767      buffer += escapeExpression(stack1) + '</span></span><ul class="hm-tree-node-children"></ul></li>';
5768      return buffer;
5769    });
5770    registerTemplate("hm/core/ui/trainingModulesViewer/Bookmarks.hbs", function(Handlebars, depth0, helpers, partials, data) {
5771      this.compilerInfo = [4, ">= 1.0.0"];
5772      helpers = this.merge(helpers, Handlebars.helpers);
5773      data = data || {};
5774      var buffer = "", stack1, helper, functionType = "function", escapeExpression = this.escapeExpression;
5775      buffer += '<div class="hm-tree ';
5776      if (helper = helpers.ns) {
5777        stack1 = helper.call(depth0, {hash:{}, data:data});
5778      } else {
5779        helper = depth0 && depth0.ns;
5780        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5781      }
5782      buffer += escapeExpression(stack1) + '"></div>';
5783      return buffer;
5784    });
5785    registerTemplate("hm/core/ui/trainingModulesViewer/BookmarksList.hbs", function(Handlebars, depth0, helpers, partials, data) {
5786      this.compilerInfo = [4, ">= 1.0.0"];
5787      helpers = this.merge(helpers, Handlebars.helpers);
5788      data = data || {};
5789      return'<ul class="hm-lesson-bookmarks-list"></ul>';
5790    });
5791    registerTemplate("hm/core/ui/trainingModulesViewer/BookmarksListItem.hbs", function(Handlebars, depth0, helpers, partials, data) {
5792      this.compilerInfo = [4, ">= 1.0.0"];
5793      helpers = this.merge(helpers, Handlebars.helpers);
5794      data = data || {};
5795      var buffer = "", stack1, helper, functionType = "function", escapeExpression = this.escapeExpression;
5796      buffer += '<li><a href="';
5797      if (helper = helpers.getUrl) {
5798        stack1 = helper.call(depth0, {hash:{}, data:data});
5799      } else {
5800        helper = depth0 && depth0.getUrl;
5801        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5802      }
5803      buffer += escapeExpression(stack1) + '"><span class="hm-lesson-bookmarks-icon"></span>' + escapeExpression((stack1 = (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.title), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + "</a></li>";
5804      return buffer;
5805    });
5806    registerTemplate("hm/core/ui/trainingModulesViewer/ContentSearch.hbs", function(Handlebars, depth0, helpers, partials, data) {
5807      this.compilerInfo = [4, ">= 1.0.0"];
5808      helpers = this.merge(helpers, Handlebars.helpers);
5809      data = data || {};
5810      var buffer = "", helper, options, helperMissing = helpers.helperMissing, escapeExpression = this.escapeExpression;
5811      buffer += '<div class="hm-content-search"><input type="text" /><input type="button" value="' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Найти", options) : helperMissing.call(depth0, "_", "Найти", options))) + '" /></div>';
5812      return buffer;
5813    });
5814    registerTemplate("hm/core/ui/trainingModulesViewer/ExtraNavigation.hbs", function(Handlebars, depth0, helpers, partials, data) {
5815      this.compilerInfo = [4, ">= 1.0.0"];
5816      helpers = this.merge(helpers, Handlebars.helpers);
5817      data = data || {};
5818      var buffer = "", stack1, functionType = "function", escapeExpression = this.escapeExpression, self = this;
5819      function program1(depth0, data) {
5820        var buffer = "", stack1, helper;
5821        buffer += '<a class="hm-extra-nav-icon hm-extra-nav-button-custom ';
5822        if (helper = helpers["class"]) {
5823          stack1 = helper.call(depth0, {hash:{}, data:data});
5824        } else {
5825          helper = depth0 && depth0["class"];
5826          stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5827        }
5828        buffer += escapeExpression(stack1) + " ";
5829        stack1 = helpers["if"].call(depth0, depth0 && depth0.openInViewer, {hash:{}, inverse:self.noop, fn:self.program(2, program2, data), data:data});
5830        if (stack1 || stack1 === 0) {
5831          buffer += stack1;
5832        }
5833        buffer += '" href="';
5834        if (helper = helpers.url) {
5835          stack1 = helper.call(depth0, {hash:{}, data:data});
5836        } else {
5837          helper = depth0 && depth0.url;
5838          stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5839        }
5840        buffer += escapeExpression(stack1) + '" title="';
5841        if (helper = helpers.title) {
5842          stack1 = helper.call(depth0, {hash:{}, data:data});
5843        } else {
5844          helper = depth0 && depth0.title;
5845          stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5846        }
5847        buffer += escapeExpression(stack1) + '" ';
5848        stack1 = helpers.each.call(depth0, depth0 && depth0.attributes, {hash:{}, inverse:self.noop, fn:self.program(4, program4, data), data:data});
5849        if (stack1 || stack1 === 0) {
5850          buffer += stack1;
5851        }
5852        buffer += "></a>";
5853        return buffer;
5854      }
5855      function program2(depth0, data) {
5856        return "hm-extra-nav-open-in-viewer";
5857      }
5858      function program4(depth0, data) {
5859        var buffer = "", stack1;
5860        buffer += escapeExpression((stack1 = data == null || data === false ? data : data.key, typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '="' + escapeExpression(typeof depth0 === functionType ? depth0.apply(depth0) : depth0) + '"';
5861        return buffer;
5862      }
5863      function program6(depth0, data) {
5864        return'<a class="hm-extra-nav-icon hm-extra-nav-button-bookmark" href="#bookmark"></a>';
5865      }
5866      buffer += '<div class="hm-extra-navigation"><div class="hm-extra-navigation-cell hm-extra-navigation-left"><a class="hm-extra-nav-icon hm-extra-nav-button-prev" href="#prev"></a><span class="hm-extra-nav-counter"></span><a class="hm-extra-nav-icon hm-extra-nav-button-next" href="#next"></a></div><div class="hm-extra-navigation-cell hm-extra-navigation-right"><div class="hm-content-search-wrap"></div>';
5867      stack1 = helpers.each.call(depth0, depth0 && depth0.getCustomButtons, {hash:{}, inverse:self.noop, fn:self.program(1, program1, data), data:data});
5868      if (stack1 || stack1 === 0) {
5869        buffer += stack1;
5870      }
5871      stack1 = helpers["if"].call(depth0, depth0 && depth0.getBookmarking, {hash:{}, inverse:self.noop, fn:self.program(6, program6, data), data:data});
5872      if (stack1 || stack1 === 0) {
5873        buffer += stack1;
5874      }
5875      buffer += "</div></div>";
5876      return buffer;
5877    });
5878    registerTemplate("hm/core/ui/trainingModulesViewer/Viewer.hbs", function(Handlebars, depth0, helpers, partials, data) {
5879      this.compilerInfo = [4, ">= 1.0.0"];
5880      helpers = this.merge(helpers, Handlebars.helpers);
5881      data = data || {};
5882      var buffer = "", stack1, helper, options, helperMissing = helpers.helperMissing, escapeExpression = this.escapeExpression, functionType = "function", self = this;
5883      function program1(depth0, data) {
5884        var buffer = "", helper, options;
5885        buffer += '<span class="hm-tmw-navigation-button">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Оглавление", options) : helperMissing.call(depth0, "_", "Оглавление", options))) + "</span>";
5886        return buffer;
5887      }
5888      function program3(depth0, data) {
5889        var buffer = "", helper, options;
5890        buffer += '<a class="hm-tmw-content-edit" href="#" target="_blank" title="' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Редактировать", options) : helperMissing.call(depth0, "_", "Редактировать", options))) + '"></a>';
5891        return buffer;
5892      }
5893      buffer += '<table class="';
5894      if (helper = helpers.ns) {
5895        stack1 = helper.call(depth0, {hash:{}, data:data});
5896      } else {
5897        helper = depth0 && depth0.ns;
5898        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5899      }
5900      buffer += escapeExpression(stack1) + '"><tr class="hm-tmw-row hm-tmw-row-header"><td><div class="hm-tmw-header">';
5901      stack1 = helpers["if"].call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.treeData), {hash:{}, inverse:self.noop, fn:self.program(1, program1, data), data:data});
5902      if (stack1 || stack1 === 0) {
5903        buffer += stack1;
5904      }
5905      buffer += '<span class="hm-tmw-content-title-wrap"><span class="hm-tmw-content-title"></span>';
5906      stack1 = helpers["if"].call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.showEditButton), {hash:{}, inverse:self.noop, fn:self.program(3, program3, data), data:data});
5907      if (stack1 || stack1 === 0) {
5908        buffer += stack1;
5909      }
5910      buffer += '</span></div></td></tr><tr class="hm-tmw-row hm-tmw-row-content"><td><div class="hm-tmw-content"><iframe frameBorder="0"></iframe><div class="hm-tmw-overlay"></div><div class="hm-tmw-loading">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Загрузка", options) : helperMissing.call(depth0, "_", "Загрузка", options))) + '...</div><div class="hm-tmw-tree"></div></div></td></tr><tr class="hm-tmw-row hm-tmw-row-footer"><td><div class="hm-tmw-footer"></div></td></tr></table>';
5911      return buffer;
5912    });
5913    registerTemplate("hm/core/ui/trainingModulesViewer/node/Node.hbs", function(Handlebars, depth0, helpers, partials, data) {
5914      this.compilerInfo = [4, ">= 1.0.0"];
5915      helpers = this.merge(helpers, Handlebars.helpers);
5916      data = data || {};
5917      var buffer = "", stack1, helper, functionType = "function", escapeExpression = this.escapeExpression;
5918      buffer += '<li class="hm-tree-node"><span class="hm-tree-node-item"><span class="hm-tree-node-connector"></span><span class="hm-tree-node-icon ';
5919      if (helper = helpers.getIconClass) {
5920        stack1 = helper.call(depth0, {hash:{}, data:data});
5921      } else {
5922        helper = depth0 && depth0.getIconClass;
5923        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5924      }
5925      buffer += escapeExpression(stack1) + '"></span><span class="hm-tree-node-title">';
5926      if (helper = helpers.getTitle) {
5927        stack1 = helper.call(depth0, {hash:{}, data:data});
5928      } else {
5929        helper = depth0 && depth0.getTitle;
5930        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5931      }
5932      buffer += escapeExpression(stack1) + '</span><span class="hm-tree-node-viewed"></span></span><ul class="hm-tree-node-children"></ul></li>';
5933      return buffer;
5934    });
5935    registerTemplate("hm/core/ui/webinarViewer/TeacherViewer.hbs", function(Handlebars, depth0, helpers, partials, data) {
5936      this.compilerInfo = [4, ">= 1.0.0"];
5937      helpers = this.merge(helpers, Handlebars.helpers);
5938      data = data || {};
5939      var buffer = "", stack1, helper, options, functionType = "function", escapeExpression = this.escapeExpression, helperMissing = helpers.helperMissing, self = this;
5940      function program1(depth0, data) {
5941        var stack1;
5942        return escapeExpression((stack1 = (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.title), typeof stack1 === functionType ? stack1.apply(depth0) : stack1));
5943      }
5944      function program3(depth0, data) {
5945        var helper, options;
5946        return escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Материалы", options) : helperMissing.call(depth0, "_", "Материалы", options)));
5947      }
5948      buffer += '<table class="';
5949      if (helper = helpers.ns) {
5950        stack1 = helper.call(depth0, {hash:{}, data:data});
5951      } else {
5952        helper = depth0 && depth0.ns;
5953        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5954      }
5955      buffer += escapeExpression(stack1) + " " + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "teacher", options) : helperMissing.call(depth0, "ns", "teacher", options))) + '"><tr class="hm-tmw-row hm-tmw-row-header"><td><div class="hm-tmw-header"><span class="hm-tmw-navigation-button">';
5956      stack1 = helpers["if"].call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.title), {hash:{}, inverse:self.program(3, program3, data), fn:self.program(1, program1, data), data:data});
5957      if (stack1 || stack1 === 0) {
5958        buffer += stack1;
5959      }
5960      buffer += '</span><span class="hm-tmw-content-title-wrap"></span></div></td></tr><tr class="hm-tmw-row hm-tmw-row-content"><td><div class="hm-tmw-content"><iframe frameBorder="0"></iframe><div class="hm-tmw-overlay"></div><div class="hm-tmw-loading">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Загрузка", options) : helperMissing.call(depth0, "_", "Загрузка", 
5961      options))) + '...</div><div class="hm-tmw-tree"></div></div></td></tr><tr class="hm-tmw-row hm-tmw-row-footer"><td><div class="hm-tmw-footer"></div></td></tr></table>';
5962      return buffer;
5963    });
5964    registerTemplate("hm/core/ui/webinarViewer/file/File.hbs", function(Handlebars, depth0, helpers, partials, data) {
5965      this.compilerInfo = [4, ">= 1.0.0"];
5966      helpers = this.merge(helpers, Handlebars.helpers);
5967      data = data || {};
5968      var buffer = "", stack1, helper, options, functionType = "function", escapeExpression = this.escapeExpression, helperMissing = helpers.helperMissing;
5969      buffer += '<div class="';
5970      if (helper = helpers.ns) {
5971        stack1 = helper.call(depth0, {hash:{}, data:data});
5972      } else {
5973        helper = depth0 && depth0.ns;
5974        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
5975      }
5976      buffer += escapeExpression(stack1) + " " + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "drop-area", options) : helperMissing.call(depth0, "ns", "drop-area", options))) + '"><div class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "content-wrap", options) : helperMissing.call(depth0, "ns", "content-wrap", options))) + '"><table><tr><td><div class="' + 
5977      escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "link-input-tip", options) : helperMissing.call(depth0, "ns", "link-input-tip", options))) + '"><span>Введите ссылку</span> и нажмите Enter;</div><div class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, 
5978      "link-input-wrap", options) : helperMissing.call(depth0, "ns", "link-input-wrap", options))) + '"><input class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "link-input", options) : helperMissing.call(depth0, "ns", "link-input", options))) + '" name="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "link-input", options) : helperMissing.call(depth0, 
5979      "ns", "link-input", options))) + '" type="text" value="" /><span class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "link-input-enter", options) : helperMissing.call(depth0, "ns", "link-input-enter", options))) + '"></span></div></td><td style="width: 100%;"><div class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "file-input-tip", 
5980      options) : helperMissing.call(depth0, "ns", "file-input-tip", options))) + '"><label class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "file-input-label", options) : helperMissing.call(depth0, "ns", "file-input-label", options))) + '" for="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "file-input", options) : helperMissing.call(depth0, 
5981      "ns", "file-input", options))) + '">Выберите файл</label> или перетащите сюда.<input id="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "file-input", options) : helperMissing.call(depth0, "ns", "file-input", options))) + '" class="' + escapeExpression((helper = helpers.ns || 
5982      depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "file-input", options) : helperMissing.call(depth0, "ns", "file-input", options))) + '" type="file" name="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "file-input", options) : helperMissing.call(depth0, "ns", "file-input", options))) + '" /></div></td></tr></table></div></div>';
5983      return buffer;
5984    });
5985    registerTemplate("hm/module/mainPageWidgets/Row.hbs", function(Handlebars, depth0, helpers, partials, data) {
5986      this.compilerInfo = [4, ">= 1.0.0"];
5987      helpers = this.merge(helpers, Handlebars.helpers);
5988      data = data || {};
5989      return'<div class="hm-widgets-row"><div class="hm-widgets-row-content"></div><div class="hm-clear-left"></div></div>';
5990    });
5991    registerTemplate("hm/module/mainPageWidgets/button/CreateWidgetButton.hbs", function(Handlebars, depth0, helpers, partials, data) {
5992      this.compilerInfo = [4, ">= 1.0.0"];
5993      helpers = this.merge(helpers, Handlebars.helpers);
5994      data = data || {};
5995      var buffer = "", stack1, helper, options, functionType = "function", escapeExpression = this.escapeExpression, self = this, helperMissing = helpers.helperMissing;
5996      function program1(depth0, data) {
5997        var buffer = "", stack1;
5998        buffer += '<optgroup label="' + escapeExpression((stack1 = depth0 && depth0.title, typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '">';
5999        stack1 = helpers.each.call(depth0, depth0 && depth0.widgets, {hash:{}, inverse:self.noop, fn:self.program(2, program2, data), data:data});
6000        if (stack1 || stack1 === 0) {
6001          buffer += stack1;
6002        }
6003        buffer += "</optgroup>";
6004        return buffer;
6005      }
6006      function program2(depth0, data) {
6007        var buffer = "", stack1;
6008        buffer += '<option value="' + escapeExpression((stack1 = depth0 && depth0.id, typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '">' + escapeExpression((stack1 = depth0 && depth0.title, typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + "</option>";
6009        return buffer;
6010      }
6011      buffer += '<div class="hm-widgets-row-createWidgetButton hm-widgets-widget"><div class="hm-widgets-widget-content"><div class="hm-widgets-row-createWidgetButton-widgetsSelect"><select>';
6012      stack1 = helpers.each.call(depth0, depth0 && depth0.groups, {hash:{}, inverse:self.noop, fn:self.program(1, program1, data), data:data});
6013      if (stack1 || stack1 === 0) {
6014        buffer += stack1;
6015      }
6016      buffer += '</select><button class="hm-widgets-row-createWidgetButton-widgetsSelect-submit">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Добавить", options) : helperMissing.call(depth0, "_", "Добавить", options))) + "</button></div></div></div>";
6017      return buffer;
6018    });
6019    registerTemplate("hm/module/mainPageWidgets/toolbar/RoleToolbar.hbs", function(Handlebars, depth0, helpers, partials, data) {
6020      this.compilerInfo = [4, ">= 1.0.0"];
6021      helpers = this.merge(helpers, Handlebars.helpers);
6022      data = data || {};
6023      var buffer = "", stack1, helper, options, helperMissing = helpers.helperMissing, escapeExpression = this.escapeExpression, functionType = "function", self = this;
6024      function program1(depth0, data) {
6025        var buffer = "", helper, options;
6026        buffer += '<button class="hm-widgets-roleToolbar-button hm-widgets-roleToolbar-button_reset"><span><span class="hm-widgets-roleToolbar-button-icon">&nbsp;</span><span class="hm-widgets-roleToolbar-button-caption">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Сбросить", options) : helperMissing.call(depth0, "_", "Сбросить", options))) + 
6027        "</span></span></button>";
6028        return buffer;
6029      }
6030      function program3(depth0, data) {
6031        var buffer = "", stack1, helper, options;
6032        buffer += escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Выберите роль", options) : helperMissing.call(depth0, "_", "Выберите роль", options))) + ":&nbsp;<select>";
6033        stack1 = helpers.each.call(depth0, depth0 && depth0.roles, {hash:{}, inverse:self.noop, fn:self.program(4, program4, data), data:data});
6034        if (stack1 || stack1 === 0) {
6035          buffer += stack1;
6036        }
6037        buffer += "</select>";
6038        return buffer;
6039      }
6040      function program4(depth0, data) {
6041        var buffer = "", stack1;
6042        buffer += '<option value="' + escapeExpression((stack1 = depth0 && depth0.role, typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '" ';
6043        stack1 = helpers["if"].call(depth0, depth0 && depth0.selected, {hash:{}, inverse:self.noop, fn:self.program(5, program5, data), data:data});
6044        if (stack1 || stack1 === 0) {
6045          buffer += stack1;
6046        }
6047        buffer += ">" + escapeExpression((stack1 = depth0 && depth0.title, typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + "</option>";
6048        return buffer;
6049      }
6050      function program5(depth0, data) {
6051        return "selected";
6052      }
6053      buffer += '<div class="hm-widgets-toolbar-roleToolbar"><button class="hm-widgets-roleToolbar-button hm-widgets-roleToolbar-button_confirm"><span><span class="hm-widgets-roleToolbar-button-icon">&nbsp;</span><span class="hm-widgets-roleToolbar-button-caption">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Сохранить", options) : helperMissing.call(depth0, "_", "Сохранить", 
6054      options))) + "</span></span></button>";
6055      stack1 = helpers.unless.call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.adminMode), {hash:{}, inverse:self.noop, fn:self.program(1, program1, data), data:data});
6056      if (stack1 || stack1 === 0) {
6057        buffer += stack1;
6058      }
6059      stack1 = helpers["if"].call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.adminMode), {hash:{}, inverse:self.noop, fn:self.program(3, program3, data), data:data});
6060      if (stack1 || stack1 === 0) {
6061        buffer += stack1;
6062      }
6063      buffer += '<div class="hm-clear"></div></div>';
6064      return buffer;
6065    });
6066    registerTemplate("hm/module/mainPageWidgets/toolbar/Toolbar.hbs", function(Handlebars, depth0, helpers, partials, data) {
6067      this.compilerInfo = [4, ">= 1.0.0"];
6068      helpers = this.merge(helpers, Handlebars.helpers);
6069      data = data || {};
6070      var buffer = "", helper, options, helperMissing = helpers.helperMissing, escapeExpression = this.escapeExpression;
6071      buffer += '<div class="hm-widgets-toolbar"><button class="hm-widgets-toolbar-editButton" title="' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Режим компоновки информационных блоков", options) : helperMissing.call(depth0, "_", "Режим компоновки информационных блоков", 
6072      options))) + '"><span></span></button></div>';
6073      return buffer;
6074    });
6075    registerTemplate("hm/module/mainPageWidgets/widget/Widget.hbs", function(Handlebars, depth0, helpers, partials, data) {
6076      this.compilerInfo = [4, ">= 1.0.0"];
6077      helpers = this.merge(helpers, Handlebars.helpers);
6078      data = data || {};
6079      return'<div class="hm-widgets-widget"><div class="hm-widgets-widget-content"></div></div>';
6080    });
6081    registerTemplate("hm/module/mainPageWidgets/widget/Widget.overlay.hbs", function(Handlebars, depth0, helpers, partials, data) {
6082      this.compilerInfo = [4, ">= 1.0.0"];
6083      helpers = this.merge(helpers, Handlebars.helpers);
6084      data = data || {};
6085      return'<div class="hm-widgets-widget-overlay" unselectable="on"><div class="hm-widgets-widget-button hm-widgets-widget-button-delete"></div><div class="hm-widgets-widget-splitter"></div></div>';
6086    });
6087    registerTemplate("hm/module/mainPageWidgets/widget/Widget.settings.hbs", function(Handlebars, depth0, helpers, partials, data) {
6088      this.compilerInfo = [4, ">= 1.0.0"];
6089      helpers = this.merge(helpers, Handlebars.helpers);
6090      data = data || {};
6091      var buffer = "", helper, options, helperMissing = helpers.helperMissing, escapeExpression = this.escapeExpression;
6092      buffer += '<div class="hm-widgets-widget-settings"><div>' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Стиль инфоблока", options) : helperMissing.call(depth0, "_", "Стиль инфоблока", options))) + ':<select name="style_id"><option value="0">' + escapeExpression((helper = helpers._ || 
6093      depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Обычный", options) : helperMissing.call(depth0, "_", "Обычный", options))) + "</option></select></div></div>";
6094      return buffer;
6095    });
6096    registerTemplate("hm/module/base/ui/ajax/AjaxSpinner.hbs", function(Handlebars, depth0, helpers, partials, data) {
6097      this.compilerInfo = [4, ">= 1.0.0"];
6098      helpers = this.merge(helpers, Handlebars.helpers);
6099      data = data || {};
6100      var buffer = "", helper, options, helperMissing = helpers.helperMissing, escapeExpression = this.escapeExpression;
6101      buffer += '<div class="ajax-spinner ajax-spinner-global" style="display: none;"><div class="ajax-spinner-wrapper">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "загрузка", options) : helperMissing.call(depth0, "_", "загрузка", options))) + "...</div></div>";
6102      return buffer;
6103    });
6104    registerTemplate("hm/module/base/ui/like/Like.hbs", function(Handlebars, depth0, helpers, partials, data) {
6105      this.compilerInfo = [4, ">= 1.0.0"];
6106      helpers = this.merge(helpers, Handlebars.helpers);
6107      data = data || {};
6108      var buffer = "", stack1, functionType = "function", escapeExpression = this.escapeExpression, self = this;
6109      function program1(depth0, data) {
6110        var buffer = "", stack1;
6111        buffer += '<a class="hm-like-button-dislike"><div class="hm-like-button-dislike-image"></div><span>' + escapeExpression((stack1 = (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.dislikeCount), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + "</span></a>";
6112        return buffer;
6113      }
6114      buffer += '<span class="hm-like-liked hm-like"><a class="hm-like-button-like"><div class="hm-like-button-like-image"></div><span class="hm-like-button-like-counter">' + escapeExpression((stack1 = (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.likeCount), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + "</span></a>";
6115      stack1 = helpers["if"].call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.showDislikeButton), {hash:{}, inverse:self.noop, fn:self.program(1, program1, data), data:data});
6116      if (stack1 || stack1 === 0) {
6117        buffer += stack1;
6118      }
6119      buffer += "</span>";
6120      return buffer;
6121    });
6122    registerTemplate("hm/module/course/ui/list/CourseDescriptionTabs.hbs", function(Handlebars, depth0, helpers, partials, data) {
6123      this.compilerInfo = [4, ">= 1.0.0"];
6124      helpers = this.merge(helpers, Handlebars.helpers);
6125      data = data || {};
6126      var buffer = "", stack1, helper, options, helperMissing = helpers.helperMissing, escapeExpression = this.escapeExpression, functionType = "function";
6127      buffer += '<div class="hm-subject-list-item-description"><ul><li style="display: ' + escapeExpression((helper = helpers.tabDisplay || depth0 && depth0.tabDisplay, options = {hash:{}, data:data}, helper ? helper.call(depth0, "lessons", options) : helperMissing.call(depth0, "tabDisplay", "lessons", options))) + ';"><a href="#';
6128      if (helper = helpers.tab_id) {
6129        stack1 = helper.call(depth0, {hash:{}, data:data});
6130      } else {
6131        helper = depth0 && depth0.tab_id;
6132        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
6133      }
6134      buffer += escapeExpression(stack1) + '-lessons">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Занятия", options) : helperMissing.call(depth0, "_", "Занятия", options))) + '</a></li><li style="display: ' + escapeExpression((helper = helpers.tabDisplay || depth0 && depth0.tabDisplay, options = {hash:{}, data:data}, helper ? helper.call(depth0, "progress", 
6135      options) : helperMissing.call(depth0, "tabDisplay", "progress", options))) + ';"><a href="#';
6136      if (helper = helpers.tab_id) {
6137        stack1 = helper.call(depth0, {hash:{}, data:data});
6138      } else {
6139        helper = depth0 && depth0.tab_id;
6140        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
6141      }
6142      buffer += escapeExpression(stack1) + '-progress">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Прогресс", options) : helperMissing.call(depth0, "_", "Прогресс", options))) + '</a></li><li style="display: ' + escapeExpression((helper = helpers.tabDisplay || depth0 && depth0.tabDisplay, options = {hash:{}, data:data}, helper ? helper.call(depth0, 
6143      "events", options) : helperMissing.call(depth0, "tabDisplay", "events", options))) + ';"><a href="#';
6144      if (helper = helpers.tab_id) {
6145        stack1 = helper.call(depth0, {hash:{}, data:data});
6146      } else {
6147        helper = depth0 && depth0.tab_id;
6148        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
6149      }
6150      buffer += escapeExpression(stack1) + '-events">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Оповещения", options) : helperMissing.call(depth0, "_", "Оповещения", options))) + "</a></li></ul>" + escapeExpression((helper = helpers.include || depth0 && depth0.include, options = {hash:{}, data:data}, helper ? helper.call(depth0, 
6151      "hm/module/course/ui/list/CourseDescriptionTabs.lessons", options) : helperMissing.call(depth0, "include", "hm/module/course/ui/list/CourseDescriptionTabs.lessons", options))) + '<div id="';
6152      if (helper = helpers.tab_id) {
6153        stack1 = helper.call(depth0, {hash:{}, data:data});
6154      } else {
6155        helper = depth0 && depth0.tab_id;
6156        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
6157      }
6158      buffer += escapeExpression(stack1) + '-progress" class="hm-subject-list-item-description-progress"></div><div id="';
6159      if (helper = helpers.tab_id) {
6160        stack1 = helper.call(depth0, {hash:{}, data:data});
6161      } else {
6162        helper = depth0 && depth0.tab_id;
6163        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
6164      }
6165      buffer += escapeExpression(stack1) + '-events" class="hm-subject-list-item-description-events"></div></div>';
6166      return buffer;
6167    });
6168    registerTemplate("hm/module/course/ui/list/CourseDescriptionTabs.lessons.hbs", function(Handlebars, depth0, helpers, partials, data) {
6169      this.compilerInfo = [4, ">= 1.0.0"];
6170      helpers = this.merge(helpers, Handlebars.helpers);
6171      data = data || {};
6172      var buffer = "", stack1, helper, functionType = "function", escapeExpression = this.escapeExpression, self = this, helperMissing = helpers.helperMissing;
6173      function program1(depth0, data) {
6174        var buffer = "", stack1;
6175        buffer += "<ul>";
6176        stack1 = helpers.each.call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.lessons), {hash:{}, inverse:self.noop, fn:self.program(2, program2, data), data:data});
6177        if (stack1 || stack1 === 0) {
6178          buffer += stack1;
6179        }
6180        buffer += "</ul>";
6181        return buffer;
6182      }
6183      function program2(depth0, data) {
6184        var buffer = "", stack1;
6185        buffer += '<li class="hm-subject-list-item-description-lesson ';
6186        stack1 = helpers["if"].call(depth0, depth0 && depth0.isFree, {hash:{}, inverse:self.noop, fn:self.program(3, program3, data), data:data});
6187        if (stack1 || stack1 === 0) {
6188          buffer += stack1;
6189        }
6190        buffer += " ";
6191        stack1 = helpers["if"].call(depth0, depth0 && depth0.isExpired, {hash:{}, inverse:self.noop, fn:self.program(5, program5, data), data:data});
6192        if (stack1 || stack1 === 0) {
6193          buffer += stack1;
6194        }
6195        buffer += '">';
6196        stack1 = helpers.unless.call(depth0, depth0 && depth0.isTeacher, {hash:{}, inverse:self.noop, fn:self.program(7, program7, data), data:data});
6197        if (stack1 || stack1 === 0) {
6198          buffer += stack1;
6199        }
6200        buffer += '<div class="hm-subject-list-item-description-lesson-title" title="' + escapeExpression((stack1 = depth0 && depth0.title, typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '"><a href="' + escapeExpression((stack1 = depth0 && depth0.url, typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '">' + escapeExpression((stack1 = depth0 && depth0.title, typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + "</a></div></li>";
6201        return buffer;
6202      }
6203      function program3(depth0, data) {
6204        return "hm-subject-list-item-description-lesson-free";
6205      }
6206      function program5(depth0, data) {
6207        return "hm-subject-list-item-description-lesson-expired";
6208      }
6209      function program7(depth0, data) {
6210        var buffer = "", stack1;
6211        buffer += '<div class="hm-subject-list-item-description-lesson-date">';
6212        stack1 = helpers["if"].call(depth0, depth0 && depth0.isFree, {hash:{}, inverse:self.noop, fn:self.program(8, program8, data), data:data});
6213        if (stack1 || stack1 === 0) {
6214          buffer += stack1;
6215        }
6216        stack1 = helpers.unless.call(depth0, depth0 && depth0.isFree, {hash:{}, inverse:self.noop, fn:self.program(10, program10, data), data:data});
6217        if (stack1 || stack1 === 0) {
6218          buffer += stack1;
6219        }
6220        buffer += "</div>";
6221        return buffer;
6222      }
6223      function program8(depth0, data) {
6224        return "∞";
6225      }
6226      function program10(depth0, data) {
6227        var stack1;
6228        return escapeExpression((stack1 = depth0 && depth0.end, typeof stack1 === functionType ? stack1.apply(depth0) : stack1));
6229      }
6230      function program12(depth0, data) {
6231        var buffer = "", helper, options;
6232        buffer += '<div class="hm-subject-list-item-description-panel-empty"><div>' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Занятий нет", options) : helperMissing.call(depth0, "_", "Занятий нет", options))) + "</div></div>";
6233        return buffer;
6234      }
6235      buffer += '<div id="';
6236      if (helper = helpers.tab_id) {
6237        stack1 = helper.call(depth0, {hash:{}, data:data});
6238      } else {
6239        helper = depth0 && depth0.tab_id;
6240        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
6241      }
6242      buffer += escapeExpression(stack1) + '-lessons" class="hm-subject-list-item-description-lessons">';
6243      stack1 = helpers["if"].call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.lessons), {hash:{}, inverse:self.noop, fn:self.program(1, program1, data), data:data});
6244      if (stack1 || stack1 === 0) {
6245        buffer += stack1;
6246      }
6247      stack1 = helpers.unless.call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.lessons), {hash:{}, inverse:self.noop, fn:self.program(12, program12, data), data:data});
6248      if (stack1 || stack1 === 0) {
6249        buffer += stack1;
6250      }
6251      buffer += "</div>";
6252      return buffer;
6253    });
6254    registerTemplate("hm/module/course/ui/list/CourseDescriptionTabs.progress.hbs", function(Handlebars, depth0, helpers, partials, data) {
6255      this.compilerInfo = [4, ">= 1.0.0"];
6256      helpers = this.merge(helpers, Handlebars.helpers);
6257      data = data || {};
6258      var buffer = "", stack1, helper, options, helperMissing = helpers.helperMissing, escapeExpression = this.escapeExpression, functionType = "function";
6259      buffer += '<div class="hm-subject-list-item-description-progress-chart"><div class="hm-subject-list-item-description-progress-bar hm-subject-list-item-description-progress-bar-best"><div class="hm-subject-list-item-description-progress-bar-caption">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "лучший результат", options) : helperMissing.call(depth0, 
6260      "_", "лучший результат", options))) + '</div><div class="hm-subject-list-item-description-progress-bar-rect"><div class="hm-subject-list-item-description-progress-bar-rect-value" style="' + escapeExpression((stack1 = (stack1 = depth0 && depth0.styles, stack1 == null || stack1 === false ? stack1 : stack1.best), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '"></div></div></div><div class="hm-subject-list-item-description-progress-bar hm-subject-list-item-description-progress-bar-my"><div class="hm-subject-list-item-description-progress-bar-caption">' + 
6261      escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "ваш результат", options) : helperMissing.call(depth0, "_", "ваш результат", options))) + '</div><div class="hm-subject-list-item-description-progress-bar-rect"><div class="hm-subject-list-item-description-progress-bar-rect-value" style="' + escapeExpression((stack1 = 
6262      (stack1 = depth0 && depth0.styles, stack1 == null || stack1 === false ? stack1 : stack1.my), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '"></div></div></div><div class="hm-subject-list-item-description-progress-bar hm-subject-list-item-description-progress-bar-axis"><div class="hm-subject-list-item-description-progress-bar-rect"></div></div><div class="hm-subject-list-item-description-progress-bar hm-subject-list-item-description-progress-bar-3"><div class="hm-subject-list-item-description-progress-bar-rect"><div class="hm-subject-list-item-description-progress-bar-rect-value" style="' + 
6263      escapeExpression((stack1 = (stack1 = depth0 && depth0.styles, stack1 == null || stack1 === false ? stack1 : stack1[3]), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '"></div></div></div></div>';
6264      return buffer;
6265    });
6266    registerTemplate("hm/module/course/ui/marksheet/ScrollBar.hbs", function(Handlebars, depth0, helpers, partials, data) {
6267      this.compilerInfo = [4, ">= 1.0.0"];
6268      helpers = this.merge(helpers, Handlebars.helpers);
6269      data = data || {};
6270      var buffer = "", stack1, helper, options, functionType = "function", escapeExpression = this.escapeExpression, helperMissing = helpers.helperMissing;
6271      buffer += '<div class="';
6272      if (helper = helpers.ns) {
6273        stack1 = helper.call(depth0, {hash:{}, data:data});
6274      } else {
6275        helper = depth0 && depth0.ns;
6276        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
6277      }
6278      buffer += escapeExpression(stack1) + '" unselectable="on"><div class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "scroller", options) : helperMissing.call(depth0, "ns", "scroller", options))) + '"></div></div>';
6279      return buffer;
6280    });
6281    registerTemplate("hm/module/develop/ui/panel/DevPanel.hbs", function(Handlebars, depth0, helpers, partials, data) {
6282      this.compilerInfo = [4, ">= 1.0.0"];
6283      helpers = this.merge(helpers, Handlebars.helpers);
6284      data = data || {};
6285      var buffer = "", stack1, helper, options, self = this, functionType = "function", blockHelperMissing = helpers.blockHelperMissing;
6286      function program1(depth0, data) {
6287        return " hm-dev-button-debug-switcher-enabled";
6288      }
6289      buffer += '<div class="hm-dev-panel"><div class="hm-dev-panel-header">Панель разработчика</div><div class="hm-dev-panel-body"><div class="hm-dev-button-debug-switcher';
6290      options = {hash:{}, inverse:self.noop, fn:self.program(1, program1, data), data:data};
6291      if (helper = helpers.debugEnabled) {
6292        stack1 = helper.call(depth0, options);
6293      } else {
6294        helper = depth0 && depth0.debugEnabled;
6295        stack1 = typeof helper === functionType ? helper.call(depth0, options) : helper;
6296      }
6297      if (!helpers.debugEnabled) {
6298        stack1 = blockHelperMissing.call(depth0, stack1, {hash:{}, inverse:self.noop, fn:self.program(1, program1, data), data:data});
6299      }
6300      if (stack1 || stack1 === 0) {
6301        buffer += stack1;
6302      }
6303      buffer += '">Режим отладки фронтэнда</div></div></div>';
6304      return buffer;
6305    });
6306    registerTemplate("hm/module/quest/ui/samplingOfQuestionsEditor/ClusterEditor.hbs", function(Handlebars, depth0, helpers, partials, data) {
6307      this.compilerInfo = [4, ">= 1.0.0"];
6308      helpers = this.merge(helpers, Handlebars.helpers);
6309      data = data || {};
6310      var buffer = "", stack1, helper, options, self = this, helperMissing = helpers.helperMissing, functionType = "function", escapeExpression = this.escapeExpression;
6311      function program1(depth0, data, depth1) {
6312        var buffer = "", stack1, helper, options;
6313        buffer += '<tr class="';
6314        stack1 = (helper = helpers.if_even || depth0 && depth0.if_even, options = {hash:{}, inverse:self.program(4, program4, data), fn:self.program(2, program2, data), data:data}, helper ? helper.call(depth0, data == null || data === false ? data : data.index, options) : helperMissing.call(depth0, "if_even", data == null || data === false ? data : data.index, options));
6315        if (stack1 || stack1 === 0) {
6316          buffer += stack1;
6317        }
6318        buffer += '"><td class="checkboxes"><input type="checkbox" name="' + escapeExpression((stack1 = depth1 && depth1.getFormNamePrefix, typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + "[questions][" + escapeExpression((stack1 = depth0 && depth0.id, typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + ']" value="1" data-id="' + escapeExpression((stack1 = depth0 && depth0.id, typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '" class="' + escapeExpression((helper = 
6319        helpers.ns || depth1 && depth1.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "question", depth1, options) : helperMissing.call(depth0, "ns", "question", depth1, options))) + '"></td><td>' + escapeExpression((stack1 = depth0 && depth0.title, typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + "</td><td>" + escapeExpression((stack1 = depth0 && depth0.category, typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + "</td></tr>";
6320        return buffer;
6321      }
6322      function program2(depth0, data) {
6323        return "odd";
6324      }
6325      function program4(depth0, data) {
6326        return "even";
6327      }
6328      buffer += '<tbody class="';
6329      if (helper = helpers.ns) {
6330        stack1 = helper.call(depth0, {hash:{}, data:data});
6331      } else {
6332        helper = depth0 && depth0.ns;
6333        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
6334      }
6335      buffer += escapeExpression(stack1) + '"><tr class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "header", options) : helperMissing.call(depth0, "ns", "header", options))) + ' filters_tr"><td colspan="4" class="filters_td first-cell last-cell"><span class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "info", options) : helperMissing.call(depth0, 
6336      "ns", "info", options))) + '">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Включено:", options) : helperMissing.call(depth0, "_", "Включено:", options))) + '<span class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "info-count", options) : helperMissing.call(depth0, 
6337      "ns", "info-count", options))) + '">0</span><span class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "info-count-description", options) : helperMissing.call(depth0, "ns", "info-count-description", options))) + '" title="' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Количество обязательных вопросов / Количество случайно выбранных вопросов", 
6338      options) : helperMissing.call(depth0, "_", "Количество обязательных вопросов / Количество случайно выбранных вопросов", options))) + '">(0/0)</span>' + escapeExpression((helper = 
6339      helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "из", options) : helperMissing.call(depth0, "_", "из", options))) + '<span class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "info-fullCount", options) : helperMissing.call(depth0, "ns", "info-fullCount", options))) + '">';
6340      if (helper = helpers.getQuestionsCount) {
6341        stack1 = helper.call(depth0, {hash:{}, data:data});
6342      } else {
6343        helper = depth0 && depth0.getQuestionsCount;
6344        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
6345      }
6346      buffer += escapeExpression(stack1) + '</span></span><span class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "title", options) : helperMissing.call(depth0, "ns", "title", options))) + '">' + escapeExpression((stack1 = (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.title), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '</span><input type="number" min="0" max="';
6347      if (helper = helpers.getQuestionsCount) {
6348        stack1 = helper.call(depth0, {hash:{}, data:data});
6349      } else {
6350        helper = depth0 && depth0.getQuestionsCount;
6351        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
6352      }
6353      buffer += escapeExpression(stack1) + '" name="';
6354      if (helper = helpers.getFormNamePrefix) {
6355        stack1 = helper.call(depth0, {hash:{}, data:data});
6356      } else {
6357        helper = depth0 && depth0.getFormNamePrefix;
6358        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
6359      }
6360      if (stack1 || stack1 === 0) {
6361        buffer += stack1;
6362      }
6363      buffer += '[count]" value="0" class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "count", options) : helperMissing.call(depth0, "ns", "count", options))) + '"></td></tr></tbody><tbody class="';
6364      if (helper = helpers.ns) {
6365        stack1 = helper.call(depth0, {hash:{}, data:data});
6366      } else {
6367        helper = depth0 && depth0.ns;
6368        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
6369      }
6370      buffer += escapeExpression(stack1) + '"><tr class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "body", options) : helperMissing.call(depth0, "ns", "body", options))) + '"><td colspan="4" class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "questions", options) : helperMissing.call(depth0, "ns", "questions", options))) + ' first-cell last-cell"><div class="' + 
6371      escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "questions-wrapper", options) : helperMissing.call(depth0, "ns", "questions-wrapper", options))) + '"><table>' + escapeExpression((helper = helpers.include || depth0 && depth0.include, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Editor.colgroup", options) : helperMissing.call(depth0, "include", "Editor.colgroup", options)));
6372      stack1 = helpers.each.call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.questions), {hash:{}, inverse:self.noop, fn:self.programWithDepth(1, program1, data, depth0), data:data});
6373      if (stack1 || stack1 === 0) {
6374        buffer += stack1;
6375      }
6376      buffer += "</table></div></td></tr></tbody>";
6377      return buffer;
6378    });
6379    registerTemplate("hm/module/quest/ui/samplingOfQuestionsEditor/Editor.colgroup.hbs", function(Handlebars, depth0, helpers, partials, data) {
6380      this.compilerInfo = [4, ">= 1.0.0"];
6381      helpers = this.merge(helpers, Handlebars.helpers);
6382      data = data || {};
6383      return'<colgroup><col style="width: 50px;"><col style="width: auto"><col style="width: 200px;"></colgroup>';
6384    });
6385    registerTemplate("hm/module/quest/ui/samplingOfQuestionsEditor/Editor.hbs", function(Handlebars, depth0, helpers, partials, data) {
6386      this.compilerInfo = [4, ">= 1.0.0"];
6387      helpers = this.merge(helpers, Handlebars.helpers);
6388      data = data || {};
6389      var buffer = "", stack1, helper, options, helperMissing = helpers.helperMissing, escapeExpression = this.escapeExpression, functionType = "function", self = this;
6390      function program1(depth0, data, depth1) {
6391        var buffer = "", stack1, helper, options;
6392        buffer += '<div class="' + escapeExpression((helper = helpers.ns || depth1 && depth1.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "category", depth1, options) : helperMissing.call(depth0, "ns", "category", depth1, options))) + '"><label>' + escapeExpression((stack1 = depth0 && depth0.title, typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + '<br><input type="number" min="0" name="' + escapeExpression((stack1 = depth1 && depth1.getFormNamePrefix, typeof stack1 === 
6393        functionType ? stack1.apply(depth0) : stack1)) + "[category][" + escapeExpression((stack1 = depth0 && depth0.id, typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + ']" value="0"></label></div>';
6394        return buffer;
6395      }
6396      buffer += '<div class="';
6397      if (helper = helpers.ns) {
6398        stack1 = helper.call(depth0, {hash:{}, data:data});
6399      } else {
6400        helper = depth0 && depth0.ns;
6401        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
6402      }
6403      buffer += escapeExpression(stack1) + '"><fieldset><legend>' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Количество вопросов по категориям", options) : helperMissing.call(depth0, "_", "Количество вопросов по категориям", 
6404      options))) + '</legend><div class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "categoryLimitSwitcher-wrapper", options) : helperMissing.call(depth0, "ns", "categoryLimitSwitcher-wrapper", options))) + '"><label><input type="checkbox" class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "categoryLimitSwitcher", options) : helperMissing.call(depth0, 
6405      "ns", "categoryLimitSwitcher", options))) + '">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Задать определённое количество вопросов из каждой категории", 
6406      options) : helperMissing.call(depth0, "_", "Задать определённое количество вопросов из каждой категории", options))) + '</label></div><div class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, 
6407      data:data}, helper ? helper.call(depth0, "categories", options) : helperMissing.call(depth0, "ns", "categories", options))) + '">';
6408      stack1 = helpers.each.call(depth0, (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.categories), {hash:{}, inverse:self.noop, fn:self.programWithDepth(1, program1, data, depth0), data:data});
6409      if (stack1 || stack1 === 0) {
6410        buffer += stack1;
6411      }
6412      buffer += '<div class="hm-clear-left"></div></div></fieldset><div class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "content", options) : helperMissing.call(depth0, "ns", "content", options))) + ' els-grid"><table class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "clusters", options) : helperMissing.call(depth0, "ns", "clusters", 
6413      options))) + '">' + escapeExpression((helper = helpers.include || depth0 && depth0.include, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Editor.colgroup", options) : helperMissing.call(depth0, "include", "Editor.colgroup", options))) + '<col style="width: ' + escapeExpression((stack1 = depth0 && depth0.getScrollBarWidth, typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + 'px;"><thead><tr><th class="first-cell"></th><th>' + escapeExpression((helper = helpers._ || 
6414      depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Краткий текст вопроса", options) : helperMissing.call(depth0, "_", "Краткий текст вопроса", options))) + "</th><th>" + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, 
6415      "Сложность", options) : helperMissing.call(depth0, "_", "Сложность", options))) + '</th><th class="last-cell"></th></tr></thead><tfoot class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "footer", options) : helperMissing.call(depth0, "ns", "footer", options))) + '"><tr class="filters_tr"><td colspan="4" class="bottom-grid first-cell last-cell"><span  class="' + 
6416      escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "total", options) : helperMissing.call(depth0, "ns", "total", options))) + '">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Всего", options) : helperMissing.call(depth0, "_", "Всего", options))) + ' <span class="' + escapeExpression((helper = 
6417      helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "total-count", options) : helperMissing.call(depth0, "ns", "total-count", options))) + '">0</span> ' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "вопросов", options) : helperMissing.call(depth0, "_", "вопросов", options))) + '</span><button class="' + 
6418      escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "save", options) : helperMissing.call(depth0, "ns", "save", options))) + '">' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Сохранить", options) : helperMissing.call(depth0, "_", "Сохранить", options))) + 
6419      '</button><button class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "back", options) : helperMissing.call(depth0, "ns", "back", options))) + '">' + escapeExpression((stack1 = (stack1 = (stack1 = depth0 && depth0.config, stack1 == null || stack1 === false ? stack1 : stack1.callBackUrl), stack1 == null || stack1 === false ? stack1 : stack1.title), typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + 
6420      "</button></td></tr></tfoot></table></div></div>";
6421      return buffer;
6422    });
6423    registerTemplate("hm/module/user/ui/role/switcher/RoleSwitcher.hbs", function(Handlebars, depth0, helpers, partials, data) {
6424      this.compilerInfo = [4, ">= 1.0.0"];
6425      helpers = this.merge(helpers, Handlebars.helpers);
6426      data = data || {};
6427      var buffer = "", stack1, helper, options, functionType = "function", escapeExpression = this.escapeExpression, helperMissing = helpers.helperMissing;
6428      buffer += '<span class="';
6429      if (helper = helpers.ns) {
6430        stack1 = helper.call(depth0, {hash:{}, data:data});
6431      } else {
6432        helper = depth0 && depth0.ns;
6433        stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{}, data:data}) : helper;
6434      }
6435      buffer += escapeExpression(stack1) + '"><span class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "left", options) : helperMissing.call(depth0, "ns", "left", options))) + '"></span><span class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "center", options) : helperMissing.call(depth0, "ns", "center", options))) + '" unselectable="on"></span><span class="' + 
6436      escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "right", options) : helperMissing.call(depth0, "ns", "right", options))) + '"><span class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "trigger", options) : helperMissing.call(depth0, "ns", "trigger", options))) + '"></span></span></span>';
6437      return buffer;
6438    });
6439    registerTemplate("hm/module/user/ui/role/switcher/item/EndUserItem.hbs", function(Handlebars, depth0, helpers, partials, data) {
6440      this.compilerInfo = [4, ">= 1.0.0"];
6441      helpers = this.merge(helpers, Handlebars.helpers);
6442      data = data || {};
6443      var buffer = "", helper, options, helperMissing = helpers.helperMissing, escapeExpression = this.escapeExpression;
6444      buffer += '<div class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "menu-item_enduser-separator", options) : helperMissing.call(depth0, "ns", "menu-item_enduser-separator", options))) + '"></div>' + escapeExpression((helper = helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "Выключить режим управления", 
6445      options) : helperMissing.call(depth0, "_", "Выключить режим управления", options))) + '<div class="' + escapeExpression((helper = helpers.ns || depth0 && depth0.ns, options = {hash:{}, data:data}, helper ? helper.call(depth0, "menu-item_enduser-bottomtext", options) : helperMissing.call(depth0, "ns", "menu-item_enduser-bottomtext", options))) + '">(' + escapeExpression((helper = 
6446      helpers._ || depth0 && depth0._, options = {hash:{}, data:data}, helper ? helper.call(depth0, "войти как обычный пользователь", options) : helperMissing.call(depth0, "_", "войти как обычный пользователь", options))) + ")</div>";
6447      return buffer;
6448    });
6449  })(hm.core.template.Template);
6450  (function() {
6451    var self;
6452    var N = 0, components = {};
6453    HM.define("hm.core.ui.Component", {extend:"hm.core.ObservableClass", requires:["hm.core.template.Template"], config:{renderTo:"", replaceRenderTo:false, elTag:"div", el:null, tpl:false, tplByClass:false, hidden:false, autoRender:true, className:"", classNameSpace:""}, statics:{getComponent:function(componentId) {
6454      if (hm.core.Object.isObject(componentId)) {
6455        if (!hm.core.DOM.isNode(componentId)) {
6456          componentId = $(componentId);
6457        }
6458        componentId = componentId.attr("hm-id");
6459      }
6460      if (!components.hasOwnProperty(componentId)) {
6461        return false;
6462      }
6463      return components[componentId];
6464    }}, __construct:function() {
6465      this._componentId = ++N;
6466      components[N] = this;
6467      this._rendered = false;
6468      var config = this.config;
6469      if (config.autoRender) {
6470        this.render();
6471      }
6472      return this;
6473    }, render:function() {
6474      if (this._rendered) {
6475        return;
6476      }
6477      this._rendered = true;
6478      this._init();
6479      this._initEvents();
6480      if (this.config.renderTo) {
6481        if (document.body) {
6482          this._renderTo();
6483        } else {
6484          $(this._renderTo.bind(this));
6485        }
6486      }
6487    }, __destruct:function() {
6488      var __destruct = arguments.callee;
6489      delete components[this._componentId];
6490      if (this._$el) {
6491        this._$el.remove();
6492      }
6493      if (this._ns) {
6494        this._ns.destroy();
6495      }
6496      this.callParent(__destruct, arguments);
6497    }, _renderTo:function() {
6498      var config = this.config, renderTo = config.renderTo, $renderTo;
6499      if (renderTo instanceof jQuery) {
6500        $renderTo = renderTo;
6501      } else {
6502        $renderTo = $(renderTo);
6503      }
6504      if (config.replaceRenderTo) {
6505        $renderTo.replaceWith(this._$el);
6506      } else {
6507        $renderTo.append(this._$el);
6508      }
6509      this._$elRenderTo = $renderTo;
6510      this._fireInsertedToDomEvent();
6511    }, _fireInsertedToDomEvent:function() {
6512      this.fireEvent("inserted_to_target", this, this._$elRenderTo);
6513    }, _init:function() {
6514      var config = this.config, className = config.className, classNameSpace = config.classNameSpace;
6515      if (classNameSpace) {
6516        this._ns = HM.create("hm.core.ui.ClassNameSpace", {ns:classNameSpace, scope:this});
6517      }
6518      this._render();
6519      var $el = this._$el;
6520      if (this._ns) {
6521        this._ns.setEl($el);
6522      }
6523      if (className) {
6524        $el.addClass(className);
6525      }
6526      if (config.hidden) {
6527        $el.hide();
6528      }
6529    }, _initEvents:function() {
6530    }, _renderTemplate:function(tplCode, viewData) {
6531      var returnString = false;
6532      if (typeof tplCode === "object" && arguments.length === 1) {
6533        returnString = tplCode.returnString;
6534        viewData = tplCode.viewData;
6535        tplCode = tplCode.tpl;
6536      }
6537      viewData = viewData || this;
6538      var string = hm.core.template.Template.render(tplCode, viewData);
6539      if (returnString) {
6540        return string;
6541      }
6542      return $(string);
6543    }, _render:function() {
6544      var config = this.config, elCfg = config.el, $el;
6545      if (elCfg !== null) {
6546        if (typeof elCfg === "string") {
6547          $el = $(elCfg);
6548        } else {
6549          if (elCfg instanceof jQuery) {
6550            $el = elCfg;
6551          } else {
6552            if (elCfg instanceof Array) {
6553              $el = $(elCfg.join(""));
6554            } else {
6555              if (hm.core.DOM.isNode(elCfg)) {
6556                $el = $(elCfg);
6557              } else {
6558                throw new Error("Передан некорректный параметр el при создании компонента");
6559              }
6560            }
6561          }
6562        }
6563      } else {
6564        var tpl = this.getTemplateName();
6565        if (!tpl) {
6566          $el = $(document.createElement(config.elTag));
6567        } else {
6568          $el = this._renderTemplate(tpl);
6569        }
6570      }
6571      $el.attr("hm-id", this._componentId);
6572      this._$el = $el;
6573    }, getTemplateName:function() {
6574      if (!this.hasTemplate()) {
6575        return false;
6576      }
6577      var config = this.config;
6578      if (config.tplByClass) {
6579        return this.getTemplateNameByClass(".");
6580      }
6581      return config.tpl;
6582    }, getTemplateNameByClass:function(path) {
6583      var currentPlace = this.$className.split("."), className = currentPlace.pop(), pathParts = path.split("/");
6584      for (var i = 0, ln = pathParts.length;i < ln;i++) {
6585        var pathPart = pathParts[i];
6586        switch(pathPart) {
6587          case ".":
6588            currentPlace.push(className);
6589            break;
6590          case "..":
6591            currentPlace.pop();
6592            break;
6593          default:
6594            currentPlace.push(pathPart);
6595        }
6596      }
6597      return currentPlace.join("/");
6598    }, getNs:function() {
6599      return this._ns;
6600    }, _beforeShow:function() {
6601      var event = this.fireEvent("beforeShow", this);
6602      if (event && event.isPrevented()) {
6603        return false;
6604      }
6605      return true;
6606    }, _beforeHide:function() {
6607      var event = this.fireEvent("beforeHide", this);
6608      if (event && event.isPrevented()) {
6609        return false;
6610      }
6611      return true;
6612    }, getEl:function() {
6613      return this._$el;
6614    }, findEl:function(queryString) {
6615      return this._$el.find(queryString);
6616    }, hasTemplate:function() {
6617      return this.config.tplByClass || !!this.config.tpl;
6618    }, elOn:function(event, selector, fn, scope) {
6619      var $el = this._$el;
6620      if (!scope) {
6621        scope = this;
6622      }
6623      fn = fn.bind(scope);
6624      if (selector) {
6625        $el.on(event, selector, fn);
6626      } else {
6627        $el.on(event, fn);
6628      }
6629    }, show:function() {
6630      if (!this._rendered) {
6631        this.render();
6632      }
6633      if (!this._beforeShow()) {
6634        return;
6635      }
6636      this._$el.show();
6637      this.fireEvent("show", this);
6638      return true;
6639    }, getHeight:function() {
6640      return this._$el.height();
6641    }, setHeight:function(height) {
6642      return this._$el.height(height);
6643    }, getWidth:function() {
6644      return this._$el.width();
6645    }, setWidth:function(width) {
6646      return this._$el.width(width);
6647    }, getOuterWidth:function(includeMargin) {
6648      return this._$el.outerWidth(!!includeMargin);
6649    }, getOuterHeight:function(includeMargin) {
6650      return this._$el.outerHeight(!!includeMargin);
6651    }, hide:function() {
6652      if (!this._beforeHide()) {
6653        return false;
6654      }
6655      this._$el.hide();
6656      this.fireEvent("hide", this);
6657      return true;
6658    }, toggle:function() {
6659      if (this.isVisible()) {
6660        this.hide();
6661      } else {
6662        this.show();
6663      }
6664    }, isVisible:function() {
6665      return this._$el.is(":visible");
6666    }, detach:function() {
6667      this._$el.detach();
6668    }});
6669    self = hm.core.ui.Component;
6670  })();
6671  (function() {
6672    var self;
6673    var counter = 0;
6674    HM.define("hm.core.data.Model", {extend:"hm.core.ui.Component", config:{autoRender:false, data:null, hasMany:null, hasOne:null}, __construct:function() {
6675      var __construct = arguments.callee;
6676      this._index = ++counter;
6677      this._data = this.config.data || {};
6678      var result = this.callParent(__construct, arguments);
6679      if (this.config.hasMany) {
6680        var hasMany = this.config.hasMany;
6681        if (!(hasMany instanceof Array)) {
6682          hasMany = [hasMany];
6683        }
6684        for (var i = 0, ln = hasMany.length;i < ln;i++) {
6685          var manyCfg = hasMany[i], propertyName = manyCfg.propertyName, proxy = {type:"memory", async:false, model:manyCfg.model || "hm.core.data.Model", reader:{type:"json", dataProperty:""}};
6686          this._data[propertyName] = HM.create("hm.core.data.Store", {proxy:proxy, data:this._data[propertyName]});
6687          this._data[propertyName].on("item_changed", this._onManyChanged, this, propertyName);
6688        }
6689      }
6690      if (this.config.hasOne) {
6691        var hasOne = this.config.hasOne;
6692        if (!(hasOne instanceof Array)) {
6693          hasOne = [hasOne];
6694        }
6695        for (var i = 0, ln = hasOne.length;i < ln;i++) {
6696          var oneCfg = hasOne[i], propertyName = oneCfg.propertyName, modelClass = oneCfg.model || "hm.core.data.Model";
6697          this._data[propertyName] = HM.create(modelClass, {data:this._data[propertyName]});
6698          this._data[propertyName].on("change", this._onOneChanged, this, propertyName);
6699        }
6700      }
6701      return result;
6702    }, get:function(name) {
6703      return this._data[name];
6704    }, set:function(name, value, silent) {
6705      var data = this._data;
6706      if (data[name] === value) {
6707        return;
6708      }
6709      data[name] = value;
6710      if (!silent) {
6711        this.fireEvent("change", name, value);
6712      }
6713    }, getData:function() {
6714      return $.extend({}, this._data);
6715    }, getIndex:function() {
6716      return this._index;
6717    }, _onManyChanged:function(e, store, item, name, value, propertyName) {
6718      this.fireEvent("change", this, propertyName, this._data[propertyName]);
6719    }, _onOneChanged:function(e, name, value, propertyName) {
6720      this.fireEvent("change", propertyName, this._data[propertyName]);
6721    }});
6722    self = hm.core.data.Model;
6723  })();
6724  (function() {
6725    var self;
6726    HM.define("hm.core.data.Store", {extend:"hm.core.ui.Component", requires:["hm.core.data.proxy.AbstractProxy"], config:{autoRender:false, data:null, autoLoad:true, pageSize:20, pagination:true, proxy:null, offset:0}, __construct:function() {
6727      var __construct = arguments.callee;
6728      var result = this.callParent(__construct, arguments);
6729      this._items = [];
6730      this._itemsIndex = {};
6731      this._offset = this.config.offset;
6732      this._filters = [];
6733      this._initProxy();
6734      if (this.config.autoLoad) {
6735        this.load();
6736      }
6737      return result;
6738    }, _initProxy:function() {
6739      if (this._proxy === undefined) {
6740        var configProxy = this.config.proxy;
6741        if (configProxy instanceof hm.core.data.proxy.AbstractProxy) {
6742          this._proxy = configProxy;
6743          this._proxy.on("data_loaded", this._onProxyDataLoaded, this);
6744        } else {
6745          var proxy = hm.core.Object.clone(configProxy);
6746          if (typeof proxy === "string") {
6747            proxy = {type:proxy};
6748          } else {
6749            if (!proxy || !proxy.type) {
6750              proxy = {type:"memory"};
6751            }
6752          }
6753          proxy.data = this.config.data;
6754          proxy.listeners = {data_loaded:this._onProxyDataLoaded, scope:this};
6755          this._proxy = hm.core.data.proxy.AbstractProxy.factory(proxy);
6756        }
6757      } else {
6758        this._proxy.on("data_loaded", this._onProxyDataLoaded, this);
6759      }
6760    }, _readProxy:function(params, method) {
6761      method = method || "load";
6762      if (this.config.pagination) {
6763        this._proxy.read(this.getOffset(), this.config.pageSize, params, method);
6764      } else {
6765        this._proxy.read(null, null, params, method);
6766      }
6767    }, addFilter:function(filter) {
6768      var me = this;
6769      filter.on("change", function() {
6770        me.filter();
6771      });
6772      this._filters.push(filter);
6773    }, refresh:function() {
6774      this.filter();
6775    }, filter:function(filters) {
6776      if (arguments.length === 0) {
6777        if (this._lastSingleFilters) {
6778          filters = this._lastSingleFilters;
6779        } else {
6780          filters = [];
6781        }
6782      } else {
6783        if (filters === null) {
6784          delete this._lastSingleFilters;
6785        } else {
6786          this._lastSingleFilters = filters;
6787        }
6788      }
6789      if (!(filters instanceof Array)) {
6790        filters = [filters];
6791      }
6792      var allFilters = [];
6793      allFilters.push.apply(allFilters, this._filters);
6794      allFilters.push.apply(allFilters, filters);
6795      var multiFilter = HM.create("hm.core.data.filter.MultiFilter", {filters:allFilters});
6796      var items = this._items || [], result = [];
6797      for (var i = 0, ln = items.length;i < ln;i++) {
6798        if (multiFilter.filter(items[i])) {
6799          result.push(items[i]);
6800        }
6801      }
6802      this._dataFiltered(result);
6803    }, _load:function(data, method) {
6804      var items = data.items || [], resultArray = [], resultIndex = {};
6805      if (method === "more") {
6806        resultIndex = this._itemsIndex;
6807        resultArray.push.apply(resultArray, this._items);
6808      }
6809      resultArray.push.apply(resultArray, items);
6810      for (var i = 0, ln = items.length;i < ln;i++) {
6811        var item = items[i];
6812        this._itemLoaded(item);
6813        resultIndex[item.getIndex()] = item;
6814      }
6815      this._items = resultArray;
6816      this._itemsIndex = resultIndex;
6817      this._count = data.total;
6818      this._dataLoaded(items, method);
6819    }, _itemLoaded:function(item) {
6820      item.on("change", this._onItemChange, this);
6821    }, _dataLoaded:function(items, method) {
6822      this.fireEvent("data_loaded", this, items, method);
6823    }, _dataFiltered:function(items) {
6824      this.fireEvent("data_filtered", this, items);
6825    }, _onProxyDataLoaded:function(e, data, method) {
6826      this._load(data, method);
6827    }, _onItemChange:function(e, name, value) {
6828      var item = e.getTarget();
6829      this.fireEvent("item_changed", this, item, name, value);
6830    }, load:function(params) {
6831      this._readProxy(params);
6832    }, loadMore:function(params) {
6833      this._readProxy(params, "more");
6834    }, getOffset:function() {
6835      return this._offset;
6836    }, getCount:function() {
6837      return this._count;
6838    }, getItemsCount:function() {
6839      return this._items.length;
6840    }, getItem:function(i) {
6841      return this._items[i];
6842    }, getItems:function() {
6843      return this._items;
6844    }, getProxy:function() {
6845      return this._proxy;
6846    }, setProxy:function(proxy) {
6847      this._proxy.un("data_loaded", this._onProxyDataLoaded, this);
6848      this._proxy = proxy;
6849      this._proxy.on("data_loaded", this._onProxyDataLoaded, this);
6850    }, getRecordById:function(id) {
6851      if (!this._itemsIndex.hasOwnProperty(id)) {
6852        return false;
6853      }
6854      return this._itemsIndex[id];
6855    }, findByKey:function(name, value) {
6856      var items = this._items, ln = items.length, result = [];
6857      for (var i = 0;i < ln;i++) {
6858        var item = items[i];
6859        if (item.get(name) == value) {
6860          result.push(item);
6861        }
6862      }
6863      return result;
6864    }});
6865    self = hm.core.data.Store;
6866  })();
6867  (function() {
6868    var self;
6869    HM.define("hm.core.ui.Container", {extend:"hm.core.ui.Component", config:{layout:"vbox", target:""}, _init:function() {
6870      var _init = arguments.callee;
6871      this.callParent(_init, arguments);
6872      this._items = [];
6873      this._layout = hm.core.ui.layout.AbstractLayout.factory(this.config.layout, {target:this._getItemsTarget(), component:this});
6874    }, _initEvents:function() {
6875      var _initEvents = arguments.callee;
6876      this.callParent(_initEvents, arguments);
6877    }, _getItemsTarget:function() {
6878      var target = this.config.target;
6879      if (!target) {
6880        return this._$el;
6881      } else {
6882        return this._$el.find(target);
6883      }
6884    }, addItem:function(item) {
6885      this._layout.add(item);
6886      this._items.push(item);
6887      item.on("destroy", this._onItemDestroy, this);
6888    }, addItems:function(items) {
6889      for (var i = 0, ln = items.length;i < ln;i++) {
6890        this.addItem(items[i]);
6891      }
6892    }, removeItem:function(item, destroyItem) {
6893      this._layout.remove(item);
6894      var items = this._items;
6895      for (var i = items.length - 1;i >= 0;i--) {
6896        if (items[i] === item) {
6897          items.splice(i, 1);
6898        }
6899      }
6900      if (destroyItem) {
6901        item.destroy();
6902      }
6903    }, removeItems:function(items, destroyItems) {
6904      for (var i = 0, ln = items.length;i < ln;i++) {
6905        this.removeItem(items[i], destroyItems);
6906      }
6907    }, getItemsCount:function() {
6908      return this._items.length;
6909    }, _onItemDestroy:function(e, item) {
6910      this.removeItem(item);
6911    }});
6912    self = hm.core.ui.Container;
6913  })();
6914  (function() {
6915    var self;
6916    HM.define("hm.core.template.helper.AbstractHelper", {config:{}, name:"", help:function(text) {
6917      return text;
6918    }, __construct:function() {
6919      var __construct = arguments.callee;
6920      this.callParent(__construct, arguments);
6921      var me = this;
6922      Handlebars.registerHelper(this.name, function() {
6923        var args = Array.prototype.slice.call(arguments);
6924        args.push(this);
6925        return me.help.apply(me, args);
6926      });
6927    }});
6928    self = hm.core.template.helper.AbstractHelper;
6929  })();
6930  (function() {
6931    var self;
6932    HM.define("hm.core.template.helper.IncludeHelper", {extend:"hm.core.template.helper.AbstractHelper", singleton:true, name:"include", help:function(tplCode, obj, view) {
6933      var Template = hm.core.template.Template;
6934      if (!Template.registered(tplCode + ".hbs") && obj.data.tpl) {
6935        tplCode = Template.resolveTemplateName(obj.data.tpl, tplCode);
6936      }
6937      return new Handlebars.SafeString(Template.render(tplCode, view));
6938    }});
6939    self = hm.core.template.helper.IncludeHelper;
6940  })();
6941  (function() {
6942    var self;
6943    HM.define("hm.core.template.helper.NameSpaceHelper", {extend:"hm.core.template.helper.AbstractHelper", singleton:true, name:"ns", _isComponent:function(obj) {
6944      if (!HM.isObject(obj)) {
6945        return;
6946      }
6947      return obj instanceof hm.core.ui.Component;
6948    }, CLASS_NOT_FOUND:"hm-nsNotFound", help:function() {
6949      var args = Array.prototype.slice.call(arguments, 0), constArgs = args.splice(-2, 2), view = constArgs[1], classNamePart = "", classNameModifier = "", argLn = args.length;
6950      if (argLn > 0 && this._isComponent(args[argLn - 1])) {
6951        view = args.splice(-1, 1)[0];
6952        argLn--;
6953      }
6954      switch(argLn) {
6955        case 2:
6956          classNamePart = args[0];
6957          classNameModifier = args[1];
6958          break;
6959        case 1:
6960          classNamePart = args[0];
6961          break;
6962      }
6963      var CLASS_NOT_FOUND = this.CLASS_NOT_FOUND;
6964      if (!this._isComponent(view)) {
6965        return CLASS_NOT_FOUND;
6966      }
6967      var ns = view.getNs();
6968      if (!ns) {
6969        return CLASS_NOT_FOUND;
6970      }
6971      return ns.getClass(classNamePart, classNameModifier);
6972    }});
6973    self = hm.core.template.helper.NameSpaceHelper;
6974  })();
6975  (function() {
6976    var self;
6977    HM.define("hm.core.template.helper.date.DateTimeHelper", {extend:"hm.core.template.helper.AbstractHelper", singleton:true, name:"datetime", help:function(dt, pattern) {
6978      dt = hm.core.Date.parse(dt);
6979      return hm.core.Date.format(dt, pattern || "dd.mm.yyyy HH:MM:ss");
6980    }});
6981    self = hm.core.template.helper.date.DateTimeHelper;
6982  })();
6983  (function() {
6984    var self;
6985    HM.define("hm.core.template.helper.iteration.IfEvenHelper", {extend:"hm.core.template.helper.AbstractHelper", singleton:true, name:"if_even", help:function(conditional, options) {
6986      if (conditional % 2 == 0) {
6987        return options.fn(this);
6988      } else {
6989        return options.inverse(this);
6990      }
6991    }});
6992    self = hm.core.template.helper.iteration.IfEvenHelper;
6993  })();
6994  (function() {
6995    var self;
6996    HM.define("hm.core.template.helper.text.CropText", {extend:"hm.core.template.helper.AbstractHelper", singleton:true, name:"cropText", help:function(text, length) {
6997      if (typeof length === "object") {
6998        return hm.core.DOM.cropTags(text);
6999      }
7000      var text = hm.core.DOM.cropTags(text);
7001      if (text.length <= length) {
7002        return text;
7003      }
7004      return text.slice(0, length) + "...";
7005    }});
7006    self = hm.core.template.helper.text.CropText;
7007  })();
7008  (function() {
7009    var self;
7010    HM.define("hm.core.template.helper.translate.TranslateHelper", {extend:"hm.core.template.helper.AbstractHelper", singleton:true, name:"_", help:function(text) {
7011      return HM._(text);
7012    }});
7013    self = hm.core.template.helper.translate.TranslateHelper;
7014  })();
7015  (function() {
7016    var self;
7017    HM.define("hm.core.ui.ClassNameSpace", {config:{ns:"", scope:null, $el:null}, __construct:function() {
7018      var me = this, config = me.config;
7019      me._ns = config.ns;
7020      me._scope = config.scope || me;
7021      me.setEl(config.$el);
7022      var result = me.getClass.bind(me), proxy = ["setEl", "getClass", "find", "on", "destroy"];
7023      for (var i = 0, ln = proxy.length;i < ln;i++) {
7024        var fnName = proxy[i];
7025        result[fnName] = me[fnName].bind(me);
7026      }
7027      result.ns = me;
7028      return result;
7029    }, setEl:function($el) {
7030      this._$el = $el;
7031    }, getClass:function(nsPart, modifier) {
7032      var className = this._ns + (nsPart ? "-" + nsPart : "");
7033      if (modifier) {
7034        className += "_" + modifier;
7035      }
7036      return className;
7037    }, find:function(nsPart, modifier) {
7038      return this._$el.find("." + this.getClass(nsPart, modifier));
7039    }, on:function(eventName, nsPart, callBack, scope) {
7040      var className = this.getClass(nsPart), $el = this._$el;
7041      callBack = callBack.bind(scope || this._scope);
7042      this._$el.on(eventName, "." + className, callBack);
7043    }});
7044    self = hm.core.ui.ClassNameSpace;
7045  })();
7046  (function() {
7047    var self;
7048    var layouts = {};
7049    HM.define("hm.core.ui.layout.AbstractLayout", {config:{component:null, target:null}, statics:{register:function(type, className) {
7050      layouts[type] = className;
7051    }, factory:function(type, config) {
7052      return HM.create(layouts[type], config);
7053    }}, __construct:function() {
7054      var __construct = arguments.callee;
7055      this.callParent(__construct, arguments);
7056      var config = this.config;
7057      this._compoent = config.component;
7058      this._$target = config.target;
7059      this._itemsCount = 0;
7060    }, add:function(item) {
7061      this._itemsCount++;
7062    }, remove:function(item) {
7063      this._itemsCount--;
7064      item.getEl().detach();
7065    }});
7066    self = hm.core.ui.layout.AbstractLayout;
7067  })();
7068  (function() {
7069    var self;
7070    HM.define("hm.core.ui.layout.VboxLayout", {extend:"hm.core.ui.layout.AbstractLayout", config:{}, add:function(item) {
7071      var add = arguments.callee;
7072      this.callParent(add, arguments);
7073      this._$target.append(item.getEl());
7074    }, remove:function(item) {
7075      var remove = arguments.callee;
7076      this.callParent(remove, arguments);
7077    }});
7078    hm.core.ui.layout.AbstractLayout.register("vbox", "hm.core.ui.layout.VboxLayout");
7079    self = hm.core.ui.layout.VboxLayout;
7080  })();
7081  (function() {
7082    var self;
7083    HM.define("hm.core.ui.List", {extend:"hm.core.ui.Component", config:{minWidth:"30px", displayField:"name", valueField:"id", collection:null, getCls:null}, _init:function() {
7084      var _init = arguments.callee;
7085      this.callParent(_init, arguments);
7086      this.renderList();
7087    }, renderList:function() {
7088      if (!this.config.collection) {
7089        throw "Для hm.ui.List не указан объект типа hm.core.Collection";
7090      }
7091      var collection = this.config.collection, ln = collection.length();
7092      if (!ln) {
7093        return;
7094      }
7095      var df = document.createDocumentFragment();
7096      for (var i = 0;i < ln;i++) {
7097        var item = document.createElement("div"), model = collection.models[i];
7098        item.innerHTML = model.get(this.config.displayField);
7099        item.hmModel = model;
7100        item.className = "hm-list-item";
7101        if (this.config.getCls) {
7102          var itemClassName = this.config.getCls(model);
7103          if (itemClassName) {
7104            $(item).addClass(itemClassName);
7105          }
7106        }
7107        df.appendChild(item);
7108      }
7109      this.getEl().append(df);
7110      this.getEl().bind("click", this.onClick.bind(this));
7111    }, onClick:function(e) {
7112      var target = e.target;
7113      while (target && !$(target).hasClass("hm-list-item")) {
7114        target = $(target).parent()[0];
7115      }
7116      if (!target.hmModel) {
7117        return;
7118      }
7119      this.fireEvent("select", this, target.hmModel);
7120    }});
7121    self = hm.core.ui.List;
7122  })();
7123  (function() {
7124    var self;
7125    HM.define("hm.core.ui.autocomplete.Autocomplete", {extend:"hm.core.ui.Component", config:{tplByClass:true, inputAttr:{}, placeholder:null, value:null, autoBlur:true, multiple:false, uiClass:null, source:[], sourceUrl:null, sourceCache:true}, _init:function() {
7126      var _init = arguments.callee;
7127      this.callParent(_init, arguments);
7128      var $el = this.getEl();
7129      if ($el[0].nodeName.toLowerCase() == "input") {
7130        this._input = $el;
7131      } else {
7132        this._input = $el.find("input");
7133      }
7134      this._sourceCache = {};
7135      this._initAutocomplete();
7136    }, _initAutocomplete:function() {
7137      var config = this.config, input = this.getInput();
7138      input.autocomplete({source:config.source});
7139      input.autocomplete("widget").addClass("hm-autocomplete-ui");
7140      if (config.uiClass !== null) {
7141        input.autocomplete("widget").addClass(config.uiClass);
7142      }
7143      var me = this;
7144      if (config.multiple) {
7145        input.autocomplete("option", "source", function(request, response) {
7146          response($.ui.autocomplete.filter(config.source, me.extractLast(request.term)));
7147        });
7148        input.on("autocompletefocus", function(event, ui) {
7149          return false;
7150        });
7151        input.on("autocompleteselect", function(event, ui) {
7152          var terms = me.split(this.value);
7153          terms.pop();
7154          terms.push(ui.item.value);
7155          terms.push("");
7156          this.value = terms.join(", ");
7157          return false;
7158        });
7159      }
7160    }, split:function(val) {
7161      return val.split(/,\s*/);
7162    }, extractLast:function(term) {
7163      return this.split(term).pop();
7164    }, _initEvents:function() {
7165      var config = this.config, input = this.getInput();
7166      input.on("autocompleteselect", _.bind(this._onSelect, this));
7167      input.on("autocompletechange", _.bind(this._onChange, this));
7168      input.on("autocompleteopen", _.bind(this._onOpen, this));
7169      this._loadSourceFn = _.bind(this._loadSource, this);
7170      input.on("keypress", _.bind(this._onKeypress, this));
7171    }, getInput:function() {
7172      return this._input;
7173    }, getValue:function() {
7174      return this.getInput().val();
7175    }, reset:function() {
7176      this.getInput().val("");
7177      this.fireEvent("change", "");
7178      this._blur();
7179    }, setSource:function(src) {
7180      this.getInput().autocomplete("option", "source", src);
7181    }, _blur:function() {
7182      if (!this.config.autoBlur) {
7183        return;
7184      }
7185      var input = this.getInput();
7186      setTimeout(function() {
7187        input.trigger("blur");
7188      }, 0);
7189    }, _onKeypress:function(e) {
7190      if (e.which == 13) {
7191        e.preventDefault();
7192        this._blur();
7193      } else {
7194        if (this._timeout !== undefined) {
7195          clearTimeout(this._timeout);
7196        }
7197        this._timeout = setTimeout(this._loadSourceFn, 1E3);
7198      }
7199    }, _onOpen:function() {
7200      var $el = this.getEl(), input = this.getInput(), widget = input.autocomplete("widget");
7201      widget.css("width", $el.outerWidth());
7202      widget.position({of:$el, my:"left top", collision:"flip flip", at:"left bottom"});
7203    }, _onSelect:function(e) {
7204      this._blur();
7205    }, _onChange:function() {
7206      this.fireEvent("change", this.getInput().val());
7207    }, _loadSource:function() {
7208      var sourceUrl = this.config.sourceUrl;
7209      if (sourceUrl !== null) {
7210        var input = this.getInput(), inputValue = input.val();
7211        if (this.config.sourceCache) {
7212          if (this._sourceCache[inputValue] !== undefined) {
7213            this.setSource(this._sourceCache[inputValue]);
7214            input.autocomplete("search");
7215            return;
7216          }
7217        }
7218        $.ajax({type:"POST", url:sourceUrl, data:{autocomplete:input.val()}}).done(_.bind(this._onAjaxDone, this, inputValue));
7219      }
7220    }, _onAjaxDone:function(inputValue, data) {
7221      if (data.source !== undefined) {
7222        if (this.config.sourceCache) {
7223          this._sourceCache[inputValue] = data.source;
7224        }
7225        this.setSource(data.source);
7226        this.getInput().autocomplete("search");
7227      }
7228    }});
7229    self = hm.core.ui.autocomplete.Autocomplete;
7230  })();
7231  (function() {
7232    var self;
7233    HM.define("hm.core.ui.autocomplete.search.Search", {extend:"hm.core.ui.autocomplete.Autocomplete", config:{}, _init:function() {
7234      var _init = arguments.callee;
7235      this.callParent(_init, arguments);
7236      this._button = this.getEl().find(".hm-autocomplete-button");
7237    }, _initEvents:function() {
7238      var _initEvents = arguments.callee;
7239      this.callParent(_initEvents, arguments);
7240      var config = this.config, button = this._button, input = this._input;
7241      button.on("click", _.bind(this._onButtonClick, this));
7242      input.on("focus", _.bind(this._onFocus, this));
7243      input.on("blur", _.bind(this._onBlur, this));
7244    }, _onButtonClick:function() {
7245      var value = this.getValue(), button = this._button;
7246      if (value && button.hasClass("hm-autocomplete-button-reset")) {
7247        this.reset();
7248      } else {
7249        this._blur();
7250      }
7251    }, _onFocus:function(e) {
7252      var button = this._button;
7253      if (!e.isTrigger) {
7254        button.removeClass("hm-autocomplete-button-reset");
7255      }
7256    }, _onBlur:function(e) {
7257      var value = this.getValue(), button = this._button;
7258      if (!value) {
7259        button.removeClass("hm-autocomplete-button-reset");
7260      } else {
7261        button.addClass("hm-autocomplete-button-reset");
7262      }
7263    }});
7264    self = hm.core.ui.autocomplete.search.Search;
7265  })();
7266  (function() {
7267    var self;
7268    HM.define("hm.core.ui.badges.SubjectBadges", {extend:"hm.core.ui.Component", config:{tplByClass:true, data:null}, statics:{dialog:null}, _init:function() {
7269      var _init = arguments.callee;
7270      this.callParent(_init, arguments);
7271      this._badgesCards = [];
7272      var $el = this.getEl();
7273      this._$iconsContainer = $el.find(".hm-subject-badges-icons");
7274      this._$images = this._$iconsContainer.find("img");
7275      this._$currentImg = this._$images.eq(0).show();
7276      this._$add = $el.find(".hm-subject-badges-add");
7277      this._$actions = $el.find(".hm-subject-badges-actions");
7278    }, _initEvents:function() {
7279      var _initEvents = arguments.callee;
7280      this.callParent(_initEvents, arguments);
7281      this.elOn("click", ".hm-subject-badges-next", this._next);
7282      this.elOn("click", ".hm-subject-badges-add", this._addToPortfolio);
7283      this.elOn("click", "img", this._showBadgeCard);
7284    }, _initSlider:function() {
7285      if (this._sliderInited) {
7286        return;
7287      }
7288      var $images = this._$images;
7289      $images.css("display", "block");
7290      $images.wrap("<div></div>");
7291      var maxW = $images.map(function() {
7292        return $(this).width();
7293      }).get();
7294      maxW = Math.max.apply(Math, maxW);
7295      this._$iconsContainer.css("min-width", maxW);
7296      this._$iconsContainer.height($images.eq(0).height());
7297      $images.each(function() {
7298        $(this).css("margin-top", -$(this).height() / 2);
7299        $(this).css("margin-left", -$(this).width() / 2);
7300      });
7301      this._$images = $images.parent();
7302      this._$images.hide();
7303      this._$currentImg = this._$images.eq(0).show();
7304      this._sliderInited = true;
7305    }, getUrl:function() {
7306    }, getCurrentBadgeId:function() {
7307      var currentIndex = this._$currentImg.index();
7308      var badge_id = this.config.data[currentIndex]["badge_id"];
7309      return badge_id;
7310    }, showAction:function(text, color) {
7311      var me = this;
7312      if (this._actionResultShowTimer) {
7313        clearTimeout(this._actionResultShowTimer);
7314      }
7315      if (color) {
7316        text = '<span style="color: ' + color + '">
7316' + text + "</span>";
7317      }
7318      this._$actions.html(text).show();
7319      this._actionResultShowTimer = setTimeout(function() {
7320        me._$actions.fadeOut();
7321      }, 3E3);
7322    }, _showBadgeCard:function(e) {
7323      e.preventDefault();
7324      var currentBadgeId = this.getCurrentBadgeId();
7325      if (!this._badgesCards[currentBadgeId]) {
7326        var url = hm.core.Url.getInstance().url({module:"subject", controller:"badge", action:"view-badge", badge_id:currentBadgeId});
7327        this._badgesCards[currentBadgeId] = HM.create("hm.core.ui.window.card.Card", {url:url});
7328      }
7329      this._badgesCards[currentBadgeId].show();
7330    }, _next:function(e) {
7331      e.preventDefault();
7332      this._initSlider();
7333      var current = this._$currentImg;
7334      var next = current.next("div");
7335      if (next.length == 0) {
7336        next = this._$images.eq(0);
7337      }
7338      current.stop().animate({left:"-100%"}, 500, function() {
7339        $(this).hide();
7340      });
7341      next.css("left", "200%").show().stop().animate({left:"50%"}, 500, function() {
7342      });
7343      this._$iconsContainer.stop().animate({height:next.find("img").height()}, 250, function() {
7344      });
7345      this._$currentImg = next;
7346    }, _addToPortfolio:function(e) {
7347      e.preventDefault();
7348      this._$add.css("visibility", "hidden");
7349      this.showAction("Добавляем...");
7350      var me = this;
7351      $.ajax({url:hm.core.Url.getInstance().url({module:"user", controller:"ajax", action:"badge-to-portfolio", badge_id:this.getCurrentBadgeId()})}).done(function(data) {
7352        me._$add.css("visibility", "visible");
7353        me.showAction(data[0]);
7354      });
7355    }});
7356    self = hm.core.ui.badges.SubjectBadges;
7357  })();
7358  (function() {
7359    var self;
7360    HM.define("hm.core.ui.badges.rating.Infoblock", {extend:"hm.core.ui.Component", config:{tplByClass:true, badgesCount:null, loadCount:5}, _init:function() {
7361      var _init = arguments.callee;
7362      this.callParent(_init, arguments);
7363      var $el = this.getEl();
7364      this._loadButton = $el.find(".hm-badges-rating-load");
7365      this._itemsRenderTo = $el.find(".hm-badges-rating-users-container");
7366      this.loadUserBadges(this.config.loadCount);
7367    }, _initEvents:function() {
7368      var _initEvents = arguments.callee;
7369      this.callParent(_initEvents, arguments);
7370      this.elOn("click", ".hm-badges-rating-load", this._onLoadClick);
7371    }, loadUserBadges:function(count) {
7372      var badgesCount = this.config.badgesCount;
7373      if (badgesCount.length == 0) {
7374        return;
7375      }
7376      var loadBadgesCount = badgesCount.splice(0, count);
7377      var usersToLoad = _.map(loadBadgesCount, function(num) {
7378        return num.user_id;
7379      });
7380      var renderTo = this._itemsRenderTo;
7381      var me = this;
7382      $.ajax({type:"POST", url:hm.core.Url.getInstance().url({module:"user", controller:"ajax", action:"get-badges-rating-data"}), data:{usersToLoad:usersToLoad}}).done(function(data) {
7383        $.each(data, function(index) {
7384          var userData = this;
7385          userData["badges_count"] = loadBadgesCount[index]["badges_count"];
7386          HM.create("hm.core.ui.badges.rating.InfoblockItem", {renderTo:renderTo, data:userData});
7387          if (badgesCount.length != 0) {
7388            me._loadButton.css("visibility", "visible").show();
7389          } else {
7390            me._loadButton.hide();
7391          }
7392        });
7393      });
7394    }, _onLoadClick:function() {
7395      this._loadButton.css("visibility", "hidden");
7396      this.loadUserBadges(this.config.loadCount);
7397    }});
7398    self = hm.core.ui.badges.rating.Infoblock;
7399  })();
7400  (function() {
7401    var self;
7402    HM.define("hm.core.ui.badges.rating.InfoblockItem", {extend:"hm.core.ui.Component", config:{tplByClass:true, data:null}, _init:function() {
7403      var _init = arguments.callee;
7404      this.callParent(_init, arguments);
7405      this._badgesCards = [];
7406    }, __construct:function() {
7407      var __construct = arguments.callee;
7408      this.callParent(__construct, arguments);
7409      var badgesContainer = this.getEl().find(".hm-badges-rating-user-badges");
7410      var table = badgesContainer.find("table");
7411      if (badgesContainer.width() < table.width() + 10) {
7412        table.wrap('<div class="hm-badges-rating-user-scrollable"></div>');
7413        badgesContainer.find(".hm-badges-rating-scroll-right, .hm-badges-rating-scroll-left").show();
7414      }
7415      this._$scrollable = badgesContainer.find(".hm-badges-rating-user-scrollable");
7416    }, _initEvents:function() {
7417      var _initEvents = arguments.callee;
7418      this.callParent(_initEvents, arguments);
7419      this.elOn("click", ".hm-badges-rating-scroll-right", this._onClickRight);
7420      this.elOn("click", ".hm-badges-rating-scroll-left", this._onClickLeft);
7421      this.elOn("click", ".hm-badges-rating-user-name", this._onClickName);
7422      this.elOn("click", ".hm-badges-rating-user-badge", this._showBadgeCard);
7423    }, _showBadgeCard:function(e) {
7424      e.preventDefault();
7425      var badgeId = $(e.currentTarget).data("badge-id");
7426      if (!this._badgesCards[badgeId]) {
7427        var url = hm.core.Url.getInstance().url({module:"subject", controller:"badge", action:"view-badge", badge_id:badgeId});
7428        this._badgesCards[badgeId] = HM.create("hm.core.ui.window.card.Card", {url:url});
7429      }
7430      this._badgesCards[badgeId].show();
7431    }, _onClickRight:function(e) {
7432      this._$scrollable.animate({scrollLeft:"+=220"}, 300);
7433    }, _onClickLeft:function(e) {
7434      this._$scrollable.animate({scrollLeft:"-=220"}, 300);
7435    }, _onClickName:function(e) {
7436      e.preventDefault();
7437      if (!this._card) {
7438        this._card = HM.create("hm.core.ui.window.card.Card", {url:this.config.data.url});
7439      }
7440      this._card.show();
7441    }});
7442    self = hm.core.ui.badges.rating.InfoblockItem;
7443  })();
7444  (function() {
7445    var self;
7446    HM.define("hm.core.ui.calendar.DateRangeSwitcher", {extend:"hm.core.ui.Component", config:{tpl:"hm/core/ui/calendar/DateRangeSwitcher", from:{time:0, mask:"dd.mm.yyyy", editable:true, relative:true, visible:true}, to:{time:null, mask:"dd.mm.yyyy", editable:true, relative:true, visible:true}, step:null, rangeName:null, url:null, classNameSpace:"hm-calendar-dateRangeSwitcher"}, __construct:function() {
7447      var __construct = arguments.callee;
7448      var config = this.config, protoConfig = hm.core.ui.calendar.DateRangeSwitcher.prototype.config;
7449      config.from = $.extend({}, protoConfig.from, config.from);
7450      config.to = $.extend({}, protoConfig.to, config.to);
7451      this.callParent(__construct, arguments);
7452    }, _init:function() {
7453      var _init = arguments.callee;
7454      var config = this.config;
7455      this._setFrom(config.from.time);
7456      if (config.to.time !== null) {
7457        this._setTo(config.to.time);
7458      } else {
7459        this._setTo(config.from.time);
7460      }
7461      this._initStep(config.step);
7462      this.callParent(_init, arguments);
7463      var ns = this._ns;
7464      this._$rangeName = ns.find("name");
7465      this._$rangeFrom = ns.find("from");
7466      this._$rangeTo = ns.find("to");
7467      if (config.from.editable) {
7468        this._$rangeFrom.addClass(config.classNameSpace + "-from-editable");
7469      }
7470      if (config.to.editable) {
7471        this._$rangeTo.addClass(config.classNameSpace + "-to-editable");
7472      }
7473    }, _initEvents:function() {
7474      var _initEvents = arguments.callee;
7475      this.callParent(_initEvents, arguments);
7476      var ns = this._ns;
7477      ns.on("click", "prev", this._onClickPrev, this);
7478      ns.on("click", "next", this._onClickNext, this);
7479      ns.on("click", "from-editable", this._onClickFrom, this);
7480      ns.on("click", "to-editable", this._onClickTo, this);
7481      this._openUrlFn = _.bind(this._openUrl, this);
7482    }, _initStep:function(step) {
7483      if (step === null) {
7484        this._step = this.getRangeTime();
7485      } else {
7486        this._step = step;
7487      }
7488    }, _onClickFrom:function(e) {
7489      this._onDatePickerClose = this._onCloseFrom;
7490      this.showDatePicker(e.target, this.getFrom());
7491    }, _onClickTo:function(e) {
7492      this._onDatePickerClose = this._onCloseTo;
7493      this.showDatePicker(e.target, this.getTo());
7494    }, _onCloseFrom:function() {
7495      var dpDate = this.getDatePickerDate(), fromDate = this.getFrom();
7496      dpDate.setHours(fromDate.getHours());
7497      dpDate.setMinutes(fromDate.getMinutes());
7498      dpDate.setSeconds(fromDate.getSeconds());
7499      this.setFrom(dpDate);
7500    }, _onCloseTo:function() {
7501      var dpDate = this.getDatePickerDate(), toDate = this.getTo();
7502      dpDate.setHours(toDate.getHours());
7503      dpDate.setMinutes(toDate.getMinutes());
7504      dpDate.setSeconds(toDate.getSeconds());
7505      this.setTo(dpDate);
7506    }, _onDatePickerSelect:function() {
7507      this._onDatePickerClose();
7508    }, _onDatePickerClose:function() {
7509    }, _onClickPrev:function(e) {
7510      e.preventDefault();
7511      this._switchOnSteps(-1);
7512    }, _onClickNext:function(e) {
7513      e.preventDefault();
7514      this._switchOnSteps(1);
7515    }, _onChange:function() {
7516      var config = this.config;
7517      this._$rangeName.html(this.getRangeName());
7518      this._$rangeFrom.html(this.getFrom(config.from.mask));
7519      this._$rangeTo.html(this.getTo(config.to.mask));
7520      this.fireEvent("change", this);
7521      if (this._openUrlTimeout !== undefined) {
7522        clearTimeout(this._openUrlTimeout);
7523      }
7524      this._openUrlTimeout = setTimeout(this._openUrlFn, 1E3);
7525    }, _openUrl:function() {
7526      var url = this.config.url;
7527      if (url !== null) {
7528        var from = encodeURIComponent(this.getFrom("yyyy-mm-dd HH:MM:ss")), to = encodeURIComponent(this.getTo("yyyy-mm-dd HH:MM:ss"));
7529        url = url + "/from/" + from + "/to/" + to;
7530        window.location.href = url;
7531      }
7532    }, getDatePicker:function() {
7533      if (this._datePicker === undefined) {
7534        this._datePicker = $('<input class="' + this.config.classNameSpace + '-datePicker" type="text"/>
7534').datepicker({showAnim:"", onSelect:_.bind(this._onDatePickerSelect, this)});
7535        this._datePicker.appendTo("body");
7536      }
7537      return this._datePicker;
7538    }, getDatePickerDate:function() {
7539      return this.getDatePicker().datepicker("getDate");
7540    }, showDatePicker:function($el, date) {
7541      var datePicker = this.getDatePicker();
7542      datePicker.position({my:"left top", at:"left bottom", collision:"none flip", of:$el});
7543      datePicker.datepicker("setDate", date);
7544      datePicker.datepicker("show");
7545    }, getRangeName:function() {
7546      var rangeName = this.config.rangeName;
7547      if (rangeName !== null) {
7548        if (_.isFunction(this.config.rangeName)) {
7549          return rangeName(this.getFrom(), this.getTo());
7550        } else {
7551          return rangeName;
7552        }
7553      }
7554      return this.getFrom("mmmm");
7555    }, setRange:function(from, to) {
7556      this._setFrom(from);
7557      this._setTo(to);
7558      this._onChange();
7559    }, getRangeTime:function() {
7560      return Math.floor((this.getTo().getTime() - this.getFrom().getTime()) / 1E3);
7561    }, getFrom:function(mask) {
7562      if (mask !== undefined) {
7563        return hm.core.Date.format(this._from, mask, false);
7564      }
7565      return this._from;
7566    }, setFrom:function(date) {
7567      if (this.config.to.relative) {
7568        var rangeTime = this.getRangeTime();
7569        this._setTo(Math.floor(date.getTime() / 1E3) + rangeTime);
7570      }
7571      this._setFrom(date);
7572      this._onChange();
7573    }, getTo:function(mask) {
7574      if (mask !== undefined) {
7575        return hm.core.Date.format(this._to, mask, false);
7576      }
7577      return this._to;
7578    }, setTo:function(date) {
7579      if (this.config.from.relative) {
7580        var rangeTime = this.getRangeTime();
7581        this._setFrom(Math.floor(date.getTime() / 1E3) - rangeTime);
7582      }
7583      this._setTo(date);
7584      this._onChange();
7585    }, _switchOnSteps:function(stepsCount) {
7586      var offset = this._step * stepsCount, from = this.getFrom(), to = this.getTo();
7587      from.setSeconds(from.getSeconds() + offset);
7588      to.setSeconds(to.getSeconds() + offset);
7589      this.setRange(from, to);
7590    }, _setFrom:function(date) {
7591      this._from = hm.core.Date.parse(date);
7592    }, _setTo:function(date) {
7593      this._to = hm.core.Date.parse(date);
7594    }});
7595    self = hm.core.ui.calendar.DateRangeSwitcher;
7596  })();
7597  (function() {
7598    var self;
7599    HM.define("hm.core.ui.container.layout.AbstractLayout", {extend:"hm.core.ui.Component", addItems:function(items) {
7600    }});
7601    self = hm.core.ui.container.layout.AbstractLayout;
7602  })();
7603  (function() {
7604    var self;
7605    HM.define("hm.core.ui.container.layout.TabLayout", {extend:"hm.core.ui.container.layout.AbstractLayout", addItems:function(items) {
7606    }});
7607    self = hm.core.ui.container.layout.TabLayout;
7608  })();
7609  (function() {
7610    var self;
7611    HM.define("hm.core.ui.contextmenu.ContextMenu", {extend:"hm.core.ui.Component", config:{tpl:"hm/core/ui/contextmenu/ContextMenu", renderTo:"body", selector:null, items:[{title:"Test1"}, {title:"Test2"}]}, statics:{menus:[]}, __construct:function() {
7612      var __construct = arguments.callee;
7613      this.callParent(__construct, arguments);
7614      hm.core.ui.contextmenu.ContextMenu.menus.push(this);
7615    }, _init:function() {
7616      var _init = arguments.callee;
7617      this.callParent(_init, arguments);
7618      this._initItems();
7619    }, _initEvents:function() {
7620      var selector = this.config.selector;
7621      if (selector) {
7622        $(document).on("contextmenu click", selector, _.bind(this._onContextmenu, this, null));
7623      }
7624      $(document).on("click", _.bind(this.hide, this));
7625    }, _initItems:function() {
7626      if (!this._items) {
7627        this._items = [];
7628      }
7629      _.each(this.config.items, this._initItem, this);
7630    }, _initItem:function(value, key, list) {
7631      var contextMenuItem = HM.create("hm.core.ui.contextmenu.ContextMenuItem", {contextMenu:this, title:value.title, callback:value.callback, data:value.data, listeners:{scope:this, click:this._onItemClick}});
7632      this._items.push(contextMenuItem);
7633      this.getEl().append(contextMenuItem.getEl());
7634    }, _onItemClick:function(e, item) {
7635      this.fireEvent("itemClick", item);
7636    }, _onContextmenu:function(contextTarget, e) {
7637      if (e.type == "click" && !e.ctrlKey) {
7638        return;
7639      }
7640      e.stopPropagation();
7641      e.preventDefault();
7642      var menus = hm.core.ui.contextmenu.ContextMenu.menus;
7643      for (var i = 0, ln = menus.length;i < ln;i++) {
7644        var menu = menus[i];
7645        if (menu !== this) {
7646          menu.hide();
7647        }
7648      }
7649      if (contextTarget) {
7650        this._contextTarget = contextTarget;
7651      } else {
7652        this._contextTarget = $(e.currentTarget);
7653      }
7654      var $el = this.getEl();
7655      $el.css({top:e.pageY, left:e.pageX});
7656      setTimeout(_.bind(this.show, this), 0);
7657    }, getContextTarget:function() {
7658      return this._contextTarget;
7659    }, hide:function() {
7660      var hide = arguments.callee;
7661      this._contextTarget = null;
7662      this.callParent(hide, arguments);
7663    }, getItems:function() {
7664      return this._items;
7665    }, bindTo:function(el, contextTarget) {
7666      var $el;
7667      if (el instanceof jQuery) {
7668        $el = el;
7669      } else {
7670        if (hm.core.DOM.isNode(el)) {
7671          $el = $(el);
7672        } else {
7673          throw new Error("Передан некорректный параметр el");
7674        }
7675      }
7676      $el.on("contextmenu click", _.bind(this._onContextmenu, this, contextTarget));
7677    }});
7678    self = hm.core.ui.contextmenu.ContextMenu;
7679  })();
7680  (function() {
7681    var self;
7682    HM.define("hm.core.ui.contextmenu.ContextMenuItem", {extend:"hm.core.ui.Component", config:{tplByClass:true, contextMenu:null, title:"Title", data:null, callback:null}, _init:function() {
7683      var _init = arguments.callee;
7684      this.callParent(_init, arguments);
7685    }, _initEvents:function() {
7686      this.elOn("click", null, this._onClick);
7687    }, _onClick:function(e) {
7688      this.fireEvent("click", this);
7689      if (this.config.callback) {
7690        this.config.callback(this, this.getContextMenu().getContextTarget());
7691      }
7692    }, getData:function() {
7693      return this.config.data;
7694    }, getTitle:function() {
7695      return this.config.title;
7696    }, getContextMenu:function() {
7697      return this.config.contextMenu;
7698    }});
7699    self = hm.core.ui.contextmenu.ContextMenuItem;
7700  })();
7701  (function() {
7702    var self;
7703    HM.define("hm.core.ui.form.element.AbstractElement", {extend:"hm.core.ui.Component", config:{tpl:"hm/core/ui/form/element/AbstractElement", inputTpl:"", label:"", labelVisible:true, value:"", name:"", isMobileView:false, height:25, width:"auto"}, _init:function() {
7704      var _init = arguments.callee;
7705      this.callParent(_init, arguments);
7706      var config = this.config;
7707      if (config.inputTpl) {
7708        this._$elInput = this._renderTemplate(config.inputTpl);
7709        this.getEl().find(".hm-form-element-container").append(this._$elInput);
7710      }
7711      if (config.isMobileView) {
7712        this.getEl().addClass("hm-form-element-mobile");
7713      }
7714    }, getValue:function() {
7715      return this.value;
7716    }, getName:function() {
7717      return this.name;
7718    }, getLabel:function() {
7719      return this.label;
7720    }});
7721    self = hm.core.ui.form.element.AbstractElement;
7722  })();
7723  (function() {
7724    var self;
7725    HM.define("hm.core.ui.form.element.inline_editor.InlineEditor", {extend:"hm.core.ui.Component", config:{el:"", saveUrl:""}, _init:function() {
7726      var _init = arguments.callee;
7727      this.callParent(_init, arguments);
7728      var $el = this._$el;
7729      $el.addClass("hm-ui-InlineEditor");
7730      $el.attr("contenteditable", "true");
7731    }, _renderTo:function() {
7732      var _renderTo = arguments.callee;
7733      this.callParent(_renderTo, arguments);
7734      this.setText(this._$elRenderTo.text(), true);
7735      this._$elRenderTo.text("");
7736    }, _initEvents:function() {
7737      this.getEl().on("blur", this.onBlur.bind(this));
7738    }, setText:function(text, notSave) {
7739      this.getEl().text(text);
7740      if (text !== this.text && !notSave) {
7741        $.ajax({url:this.config.saveUrl, type:"post", success:this.onSaveSuccess.bind(this), error:this.onSaveFailure.bind(this), data:{text:text}});
7742      }
7743      this._text = text;
7744    }, onBlur:function() {
7745      this.setText(this.getEl().text());
7746    }, onSaveSuccess:function() {
7747    }, onSaveFailure:function() {
7748      elsHelpers.alert(HM._("Сообщение не удалось сохранить! Пожалуйста, повторите попытку позже."));
7749    }});
7750    self = hm.core.ui.form.element.inline_editor.InlineEditor;
7751  })();
7752  (function() {
7753    var self;
7754    HM.define("hm.core.ui.form.element.select.AbstractSelect", {extend:"hm.core.ui.Component", config:{tpl:"hm/core/ui/form/element/select/AbstractSelect", title:"Title", titleRenderer:null, name:"", value:null, titleFixed:false, maxMenuHeight:300, minMenuHeight:200, inline:false}, CLASS_OPENED:"hm-form-select-button-menuOpened", _init:function() {
7755      var _init = arguments.callee;
7756      this.callParent(_init, arguments);
7757      this._initInput();
7758      var $el = this.getEl();
7759      this._$elTitle = $el.find(".hm-form-select-button-title");
7760    }, _initEvents:function() {
7761      var _initEvents = arguments.callee;
7762      this.callParent(_initEvents, arguments);
7763      this.elOn("click", null, this._onTriggerClick);
7764    }, _initInput:function() {
7765      this._$elInput = this._createInput();
7766    }, _needCloseMenuAfterChange:function() {
7767      return true;
7768    }, _getInputName:function() {
7769      return this.config.name;
7770    }, _createInput:function(name) {
7771      var $input = $(document.createElement("input"));
7772      $input.attr("type", "hidden");
7773      $input.attr("name", name || this._getInputName());
7774      this.getEl().append($input);
7775      return $input;
7776    }, _createList:function() {
7777      throw new Error("В компоненте не реализован метод _createList(
7777)");
7778    }, _getList:function() {
7779      if (!this._list) {
7780        this._list = this._createList();
7781        this._list.on("change", this._onValueChange, this);
7782        this._list.on("hide", this._onMenuClosed, this);
7783      }
7784      return this._list;
7785    }, _closeMenu:function() {
7786      if (!this._menuOpened) {
7787        return false;
7788      }
7789      var list = this._getList(), $elList = list.getEl(), elList = $elList[0];
7790      hm.core.PopupManager.hide(elList);
7791      return true;
7792    }, setTitle:function(title, isHtml) {
7793      var config = this.config;
7794      if (config.titleFixed) {
7795        return;
7796      }
7797      if (isHtml) {
7798        this._$elTitle.html(title);
7799      } else {
7800        this._$elTitle.text(title);
7801      }
7802    }, getTitle:function(asHtml) {
7803      if (asHtml) {
7804        return this._$elTitle.html();
7805      }
7806      return this._$elTitle.text();
7807    }, getValue:function() {
7808      throw new Error("Не реализован метод getValue()");
7809    }, setValue:function() {
7810      throw new Error("Не реализован метод setValue()");
7811    }, _onTriggerClick:function(e) {
7812      e.stopPropagation();
7813      var list = this._getList(), $menu = list.getEl(), menu = $menu[0];
7814      if (this._closeMenu()) {
7815        return;
7816      }
7817      list.show();
7818      var $el = this.getEl();
7819      $el.addClass(this.CLASS_OPENED);
7820      var config = this.config, offset = $el.offset(), scrollTop = HM.$window().scrollTop(), $body = HM.$body(), bodyHeight = $body.height(), buttonHeight = $el.height(), availableTop = offset.top - scrollTop, availableBottom = bodyHeight - availableTop - buttonHeight, spaceHeight = 10, menuContentHeight = list.getContentHeight(), maxMenuHeight = config.maxMenuHeight, minMenuHeight = config.minMenuHeight;
7821      var menuPosition = "bottom", menuHeight = 0, menuStyle = {top:0, left:offset.left, minWidth:$el.width()};
7822      if (availableBottom < minMenuHeight && availableTop > availableBottom) {
7823        menuPosition = "top";
7824      }
7825      var availableHeight = menuPosition === "bottom" ? availableBottom : availableTop, menuHeight = menuContentHeight;
7826      if (menuContentHeight > availableHeight) {
7827        menuHeight = availableHeight - 10;
7828      }
7829      if (menuHeight > maxMenuHeight) {
7830        menuHeight = maxMenuHeight;
7831      }
7832      if (menuPosition === "bottom") {
7833        menuStyle.top = offset.top + buttonHeight + 2;
7834      } else {
7835        menuStyle.top = offset.top - menuHeight - 2;
7836      }
7837      $menu.css(menuStyle);
7838      list.setHeight(menuHeight);
7839      this._menuOpened = true;
7840    }, menuOpened:function() {
7841      return this._menuOpened;
7842    }, _onMenuClosed:function() {
7843      this._menuOpened = false;
7844      this._$el.removeClass(this.CLASS_OPENED);
7845    }, _onValueChange:function(e, value, list) {
7846      if (this._needCloseMenuAfterChange()) {
7847        this._closeMenu();
7848      }
7849      this.setValue(value);
7850      this.fireEvent("change", value, this);
7851    }});
7852    self = hm.core.ui.form.element.select.AbstractSelect;
7853  })();
7854  (function() {
7855    var self;
7856    HM.define("hm.core.ui.form.element.select.DateSelect", {extend:"hm.core.ui.form.element.select.AbstractSelect", config:{}, _init:function() {
7857      var _init = arguments.callee;
7858      var config = this.config;
7859      this.callParent(_init, arguments);
7860      if (config.value !== null) {
7861        this.setValue(config.value);
7862      }
7863    }, _initEvents:function() {
7864      var _initEvents = arguments.callee;
7865      this.callParent(_initEvents, arguments);
7866    }, _initInput:function() {
7867      this._$elFromInput = this._createInput("from");
7868      this._$elToInput = this._createInput("to");
7869    }, _createList:function() {
7870      return HM.create("hm.core.ui.form.element.select.list.DateSelectList", {value:this.getValue()});
7871    }, getValue:function() {
7872      return{from:this._$elFromInput.val(), to:this._$elToInput.val()};
7873    }, setValue:function(value) {
7874      var HmDate = hm.core.Date, from = HmDate.parse(value.from), viewFrom = HmDate.format(from, "dd.mm.yyyy"), valueFrom = HmDate.format(from, "yyyy-mm-dd"), to = HmDate.parse(value.to), viewTo = HmDate.format(to, "dd.mm.yyyy"), valueTo = HmDate.format(to, "yyyy-mm-dd");
7875      this._$elFromInput.val(valueFrom);
7876      this._$elToInput.val(valueTo);
7877      this.setTitle(viewFrom + "&nbsp;-&nbsp;" + viewTo, true);
7878    }});
7879    self = hm.core.ui.form.element.select.DateSelect;
7880  })();
7881  (function() {
7882    var self;
7883    HM.define("hm.core.ui.form.element.select.Select", {extend:"hm.core.ui.form.element.select.AbstractSelect", config:{store:null, data:null, titleField:"title", valueField:"id", showFilter:false, itemFormatter:null}, _init:function() {
7884      var _init = arguments.callee;
7885      var config = this.config, store = config.store;
7886      if (!(store instanceof hm.core.data.Store)) {
7887        store = HM.create("hm.core.data.Store", {proxy:{type:"memory", reader:"simple_json"}, data:this._getInitData(), pagination:false});
7888      }
7889      this._store = store;
7890      this._storeReady = false;
7891      this.callParent(_init, arguments);
7892      if (config.value !== null) {
7893        this.setValue(config.value);
7894      }
7895    }, _initEvents:function() {
7896      var _initEvents = arguments.callee;
7897      this.callParent(_initEvents, arguments);
7898      this._store.on("data_loaded", this._onDataLoaded, this);
7899    }, _createList:function() {
7900      var config = this.config;
7901      return HM.create("hm.core.ui.form.element.select.list.SelectList", {store:this._store, titleField:config.titleField, valueField:config.valueField, showFilter:config.showFilter, itemFormatter:config.itemFormatter});
7902    }, _getInitData:function() {
7903      return this.config.data;
7904    }, setValue:function(value) {
7905      this._$elInput.val(value);
7906      var config = this.config, store = this._store;
7907      var previousRecords = store.findByKey("checked", true);
7908      for (var i = 0;i < previousRecords.length;i++) {
7909        previousRecords[i].set("checked", false);
7910      }
7911      var records = store.findByKey(config.valueField, value);
7912      if (!records.length) {
7913        this.setTitle(this.config.title);
7914        return;
7915      }
7916      var record = records[0], title = record.get(config.titleField);
7917      if (config.titleRenderer instanceof Function) {
7918        this._$elTitle.html(config.titleRenderer(title, record, this));
7919      } else {
7920        this.setTitle(title);
7921      }
7922    }, getValue:function() {
7923      return this._$elInput.val();
7924    }, getStore:function() {
7925      return this._store;
7926    }, _onDataLoaded:function(e, store, items, method) {
7927      this._storeReady = true;
7928      this.setValue(this.getValue());
7929    }});
7930    self = hm.core.ui.form.element.select.Select;
7931  })();
7932  (function() {
7933    var self;
7934    HM.define("hm.core.ui.form.element.select.MultiSelect", {extend:"hm.core.ui.form.element.select.Select", config:{}, _init:function() {
7935      var _init = arguments.callee;
7936      this.callParent(_init, arguments);
7937      this._value = [];
7938      var initData = this._getInitData(), checkedValues = [];
7939      for (var i = 0, ln = initData.length;i < ln;i++) {
7940        if (initData[i]["checked"]) {
7941          checkedValues.push(initData[i]["id"]);
7942        }
7943      }
7944      this.setValue(checkedValues);
7945    }, _getInputName:function() {
7946      return this.config.name + "[]";
7947    }, _initInput:function() {
7948      this._inputs = {};
7949    }, _createList:function() {
7950      var config = this.config;
7951      return HM.create("hm.core.ui.form.element.select.list.MultiSelectList", {store:this._store, titleField:config.titleField, valueField:config.valueField, showFilter:config.showFilter});
7952    }, _needCloseMenuAfterChange:function() {
7953      return false;
7954    }, _destroyInputs:function() {
7955      var inputs = this._inputs;
7956      for (var i in inputs) {
7957        if (!inputs.hasOwnProperty(i)) {
7958          continue;
7959        }
7960        inputs[i].remove();
7961      }
7962      this._inputs = {};
7963    }, setValue:function(values) {
7964      this._destroyInputs();
7965      var config = this.config, store = this._store, inputs = this._inputs, title = [], records = [];
7966      this._value = values;
7967      for (var i = 0;i < values.length;i++) {
7968        var value = values[i], valueRecords = store.findByKey(config.valueField, value), valueRecord = valueRecords[0];
7969        if (!valueRecord) {
7970          continue;
7971        }
7972        records.push(valueRecord);
7973        title.push(valueRecord.get(config.titleField));
7974        if (!inputs.hasOwnProperty(value)) {
7975          inputs[value] = this._createInput();
7976        }
7977        inputs[value].val(value);
7978      }
7979      var elementsCount = "";
7980      if (title.length > 1) {
7981        elementsCount = "(" + title.length + ") ";
7982      }
7983      title = elementsCount + title.join(", ");
7984      if (config.titleRenderer instanceof Function) {
7985        this._$elTitle.html(config.titleRenderer(title, records, this));
7986      } else {
7987        this.setTitle(title);
7988      }
7989      this._needMenuRefreshOnClose = true;
7990    }, getValue:function() {
7991      return this._value;
7992    }, _onMenuClosed:function() {
7993      var _onMenuClosed = arguments.callee;
7994      this.callParent(_onMenuClosed, arguments);
7995      if (this._needMenuRefreshOnClose) {
7996        this._store.refresh();
7997      }
7998      this._needMenuRefreshOnClose = false;
7999    }});
8000    self = hm.core.ui.form.element.select.MultiSelect;
8001  })();
8002  (function() {
8003    var self;
8004    HM.define("hm.core.ui.form.element.select.list.AbstractSelectList", {extend:"hm.core.ui.Component", config:{tpl:"hm/core/ui/form/element/select/list/AbstractSelectList", showFilter:false}, _init:function() {
8005      var _init = arguments.callee;
8006      this.callParent(_init, arguments);
8007      this._$elFilterWrapper = this.getEl().find(".hm-form-select-list-filter");
8008      this._$elContWrapper = this.getEl().find(".hm-form-select-list-container-wrapper");
8009      this._$elCont = this._$elContWrapper.find(".hm-form-select-list-container");
8010      this._initList();
8011    }, _initEvents:function() {
8012      var _initEvents = arguments.callee;
8013      this.callParent(_initEvents, arguments);
8014      this._initMagicScroll(this._$elContWrapper);
8015    }, _initMagicScroll:function($scrollEl) {
8016      var wheelEventName;
8017      if ("WheelEvent" in window) {
8018        wheelEventName = "wheel";
8019      } else {
8020        if ("onmousewheel" in document) {
8021          wheelEventName = "mousewheel";
8022        } else {
8023          wheelEventName = "MozMousePixelScroll";
8024        }
8025      }
8026      $scrollEl.on(wheelEventName, this._onMouseWheel.bind(this, wheelEventName));
8027    }, _renderList:function() {
8028      throw new Error("Не реализован метод _renderList()");
8029    }, _initList:function() {
8030    }, _triggerChangeEvent:function() {
8031      this._clearChangeEvent();
8032      this._onChangeTimeoutTimer = setTimeout(this._onChangeTimeout.bind(this), 0);
8033    }, _clearChangeEvent:function() {
8034      if (!this._onChangeTimeoutTimer) {
8035        return;
8036      }
8037      clearTimeout(this._onChangeTimeoutTimer);
8038      delete this._onChangeTimeoutTimer;
8039    }, getFilterHeight:function() {
8040      return this._$elFilterWrapper.height();
8041    }, getContainerHeight:function() {
8042      return this._$elCont.height();
8043    }, getContentHeight:function() {
8044      return this.getContainerHeight() + this.getFilterHeight();
8045    }, setHeight:function(height) {
8046      var wrapperHeight = height - this.getFilterHeight(), contHeight = this.getContainerHeight();
8047      if (wrapperHeight < contHeight) {
8048        this._$elContWrapper.css({maxHeight:wrapperHeight, overflowY:"scroll", overflowX:"hidden"});
8049      } else {
8050        this._$elContWrapper.css({maxHeight:wrapperHeight, overflowY:"hidden", overflowX:"hidden"});
8051      }
8052    }, getValue:function() {
8053      throw new Error("Не реализован метод getValue()");
8054    }, setValue:function() {
8055      throw new Error("Не реализован метод setValue()");
8056    }, show:function() {
8057      hm.core.PopupManager.show({el:this._$el[0], onClose:this._onHidden, scope:this, hideOther:true});
8058    }, hide:function() {
8059      hm.core.PopupManager.hide(this._$el[0]);
8060    }, _onMouseWheel:function(eventType, e) {
8061      var event = e.originalEvent, deltaY = event.deltaY || (event.detail || event.wheelDelta);
8062      if (eventType === "mousewheel") {
8063        deltaY = -deltaY;
8064      }
8065      if (!deltaY) {
8066        return;
8067      }
8068      var $contWrapper = this._$elContWrapper, scrollTop = $contWrapper.scrollTop(), elHeight = $contWrapper.height(), contentHeight = this._$elCont.height();
8069      if (deltaY < 0 && scrollTop === 0) {
8070        e.preventDefault();
8071      }
8072      if (deltaY > 0 && scrollTop + elHeight >= contentHeight) {
8073        e.preventDefault();
8074      }
8075    }, _onChangeTimeout:function() {
8076      if (this._onChangeTimeoutTimer) {
8077        delete this._onChangeTimeoutTimer;
8078      }
8079      this.fireEvent("change", this.getValue(), this);
8080    }, _onHidden:function() {
8081      this.fireEvent("hide", this);
8082    }});
8083    self = hm.core.ui.form.element.select.list.AbstractSelectList;
8084  })();
8085  (function() {
8086    var self;
8087    HM.define("hm.core.ui.form.element.select.list.DateSelectList", {extend:"hm.core.ui.form.element.select.list.AbstractSelectList", config:{value:null}, _init:function() {
8088      var _init = arguments.callee;
8089      this.callParent(_init, arguments);
8090      this._$elInputFrom = this._$elCont.find('input[name="from"]');
8091      this._$elInputTo = this._$elCont.find('input[name="to"]');
8092      var config = this.config, value = config.value, HmDate = hm.core.Date, from = HmDate.parse(value.from), viewFrom = HmDate.format(from, "dd.mm.yyyy"), to = HmDate.parse(value.to), viewTo = HmDate.format(to, "dd.mm.yyyy");
8093      this._$elInputFrom.val(viewFrom);
8094      this._$elInputTo.val(viewTo);
8095    }, _initEvents:function() {
8096      var _initEvents = arguments.callee;
8097      this.callParent(_initEvents, arguments);
8098      this._$elInputFrom.on("change", this._onInputChange.bind(this));
8099      this._$elInputTo.on("change", this._onInputChange.bind(this));
8100      this.elOn("click", ".hm-form-select-list-dateSelect-item-input", this._onInputClick);
8101    }, _renderList:function() {
8102      this._$elCont.html(this._renderTemplate({tpl:"hm/core/ui/form/element/select/list/item/DateSelectItem", viewData:{inputs:{from:{caption:HM._("с"), name:"from"}, to:{caption:HM._("по"), name:"to"}}}, returnString:true}));
8103    }, _initList:function() {
8104      this._renderList();
8105    }, _getTooltip:function() {
8106      if (!this._tooltip) {
8107        this._tooltip = HM.create("hm.core.ui.form.element.select.list.tooltip.DateTooltip", {listeners:{select:this._onSelectDate, scope:this}});
8108      }
8109      return this._tooltip;
8110    }, getValue:function() {
8111      return{from:this._$elInputFrom.val(), to:this._$elInputTo.val()};
8112    }, setValue:function(value) {
8113      if (this._$elInputFrom.val() !== value.from) {
8114        this._$elInputFrom.val(value.from);
8115        this._modified = true;
8116      }
8117      if (this._$elInputTo.val() !== value.to) {
8118        this._$elInputTo.val(value.to);
8119        this._modified = true;
8120      }
8121    }, show:function() {
8122      var show = arguments.callee;
8123      this.callParent(show, arguments);
8124      this._modified = false;
8125    }, _onInputChange:function() {
8126      this._triggerChangeEvent();
8127    }, _getInput:function(name) {
8128      if (name === "from") {
8129        return this._$elInputFrom;
8130      }
8131      if (name === "to") {
8132        return this._$elInputTo;
8133      }
8134    }, _onInputClick:function(e) {
8135      e.preventDefault();
8136      var tooltip = this._getTooltip(), $itemEl = $(e.currentTarget), $img = $itemEl.find("img"), name = $itemEl.data("name"), position = $img.offset();
8137      var date = hm.core.Date.parse(this._getInput(name).val());
8138      tooltip.hide();
8139      tooltip.setDate(date);
8140      tooltip.showAt(position.left + $img.width() / 2, position.top + $img.height() + 5);
8141      this._tooltipName = name;
8142    }, _onHidden:function() {
8143      var _onHidden = arguments.callee;
8144      var tooltip = this._tooltip;
8145      if (tooltip) {
8146        tooltip.hide();
8147      }
8148      if (this._modified) {
8149        this._triggerChangeEvent();
8150      }
8151      this.callParent(_onHidden, arguments);
8152    }, _onSelectDate:function(e, date) {
8153      var value = this.getValue();
8154      value[this._tooltipName] = date;
8155      this.setValue(value);
8156      this._tooltip.hide();
8157    }});
8158    self = hm.core.ui.form.element.select.list.DateSelectList;
8159  })();
8160  (function() {
8161    var self;
8162    HM.define("hm.core.ui.form.element.select.list.SelectList", {extend:"hm.core.ui.form.element.select.list.AbstractSelectList", config:{store:null, titleField:"title", valueField:"id", itemFormatter:null}, _init:function() {
8163      var _init = arguments.callee;
8164      this._store = this.config.store;
8165      this.callParent(_init, arguments);
8166      this._$elFilter = this._$el.find(".hm-form-select-list-filter input");
8167      this._filterValue = "";
8168      if (this.config.showFilter) {
8169        this._filter = HM.create("hm.core.data.filter.LikeFilter", {field:this.config.titleField, value:this._filterValue});
8170        this._store.addFilter(this._filter);
8171      }
8172    }, _initEvents:function() {
8173      var _initEvents = arguments.callee;
8174      this.callParent(_initEvents, arguments);
8175      var store = this._store;
8176      store.on("data_filtered", this._onDataFiltered, this);
8177      store.on("item_changed", this._onRecordChange, this);
8178      this.elOn("click", ".hm-form-select-list-item", this._onClickItem);
8179      this._$elFilter.on("change keyup", this._onFilterChanged.bind(this));
8180      this._store.refresh();
8181    }, _initList:function() {
8182    }, _renderList:function(items) {
8183      var itemsCount = items.length, config = this.config, titleField = config.titleField, valueField = config.valueField, html = "", i, recordsIndex = {};
8184      for (i = 0;i < itemsCount;i++) {
8185        var record = items[i], recordId = record.getIndex();
8186        html += this._renderListItem(recordId, record.get(titleField), record);
8187        recordsIndex[recordId] = record;
8188      }
8189      this._recordsIndex = recordsIndex;
8190      this._$elCont.html(html);
8191    }, _renderListItem:function(recordId, titleField, record) {
8192      var itemFormatter = this.config.itemFormatter, needEscape = true;
8193      if (itemFormatter) {
8194        titleField = itemFormatter(record);
8195        needEscape = false;
8196      }
8197      return this._renderTemplate({tpl:"hm/core/ui/form/element/select/list/item/SimpleSelectItem", viewData:{recordId:recordId, title:titleField, needEscape:needEscape}, returnString:true});
8198    }, _reset:function(without) {
8199      var records = this._store.findByKey("checked", true), HmArray = hm.core.Array;
8200      if (!without) {
8201        without = [];
8202      }
8203      if (!(without instanceof Array)) {
8204        without = [without];
8205      }
8206      for (var i = 0, ln = records.length;i < ln;i++) {
8207        var record = records[i];
8208        if (HmArray.indexOf(without, record) !== -1) {
8209          continue;
8210        }
8211        record.set("checked", false);
8212      }
8213    }, setValue:function(value) {
8214      var record = this.getRecordByValue(value);
8215      if (!record) {
8216        return;
8217      }
8218      record.set("checked", true);
8219    }, getRecordByValue:function(value) {
8220      var record = this._store.findByKey(this.config.valueField, value);
8221      if (!record.length) {
8222        return false;
8223      }
8224      return record[0];
8225    }, getValue:function() {
8226      var records = this._store.findByKey("checked", true), valueFiled = this.config.valueField;
8227      if (!records.length) {
8228        return;
8229      }
8230      return records[0].get(valueFiled);
8231    }, setHeight:function(height) {
8232      var setHeight = arguments.callee;
8233      if (this._$elFilter.val()) {
8234        return;
8235      }
8236      return this.callParent(setHeight, arguments);
8237    }, _onDataFiltered:function(e, store, items, method) {
8238      this._renderList(items);
8239    }, _onClickItem:function(e) {
8240      e.preventDefault();
8241      var $itemEl = $(e.currentTarget), recordId = $itemEl.data("id"), record = this._store.getRecordById(recordId);
8242      record.set("checked", true);
8243    }, _onRecordChange:function(e, store, record, name, value) {
8244      if (name !== "checked") {
8245        return;
8246      }
8247      if (!value) {
8248        return;
8249      }
8250      this._reset(record);
8251      this._triggerChangeEvent();
8252    }, _onFilterChanged:function(e) {
8253      var value = this._$elFilter.val();
8254      if (value === this._filterValue) {
8255        return;
8256      }
8257      this._filterValue = value;
8258      this._filter.setValue(value);
8259      this._store.filter();
8260    }});
8261    self = hm.core.ui.form.element.select.list.SelectList;
8262  })();
8263  (function() {
8264    var self;
8265    HM.define("hm.core.ui.form.element.select.list.MultiSelectList", {extend:"hm.core.ui.form.element.select.list.SelectList", config:{}, __construct:function() {
8266      var __construct = arguments.callee;
8267      this.callParent(__construct, arguments);
8268    }, _init:function() {
8269      var _init = arguments.callee;
8270      this.callParent(_init, arguments);
8271    }, _initEvents:function() {
8272      var _initEvents = arguments.callee;
8273      this.callParent(_initEvents, arguments);
8274    }, _renderList:function(items) {
8275      var _renderList = arguments.callee;
8276      var checkedItems = this._store.findByKey("checked", true), newItems = [], checkedItemIds = {};
8277      for (var i = 0;i < checkedItems.length;i++) {
8278        var checkedItem = checkedItems[i];
8279        newItems.push(checkedItem);
8280        checkedItemIds[checkedItem.getIndex()] = checkedItem;
8281      }
8282      for (var i = 0;i < items.length;i++) {
8283        var item = items[i], itemId = item.getIndex();
8284        if (checkedItemIds.hasOwnProperty(itemId)) {
8285          delete checkedItemIds[itemId];
8286          continue;
8287        }
8288        newItems.push(item);
8289      }
8290      this._visibleFilteredItemIds = checkedItemIds;
8291      this.callParent(_renderList, [newItems]);
8292    }, _renderListItem:function(recordId, titleField, record) {
8293      return this._renderTemplate({tpl:"hm/core/ui/form/element/select/list/item/MultiSelectItem", viewData:{recordId:recordId, title:titleField, checked:record.get("checked")}, returnString:true});
8294    }, setValue:function(values) {
8295      for (var i = 0, ln = values.length;i < ln;i++) {
8296        var record = this.getRecordByValue(values[i]);
8297        if (!record) {
8298          continue;
8299        }
8300        record.set("checked", true);
8301      }
8302    }, getValue:function() {
8303      var records = this._store.findByKey("checked", true), values = [], valueFiled = this.config.valueField;
8304      for (var i = 0, ln = records.length;i < ln;i++) {
8305        values.push(records[i].get(valueFiled));
8306      }
8307      return values;
8308    }, CLASS_CHECKED:"hm-form-select-list-item-withCheckbox-checked", _onClickItem:function(e) {
8309      e.preventDefault();
8310      var $itemEl = $(e.currentTarget), recordId = $itemEl.data("id"), record = this._store.getRecordById(recordId), newValue = !record.get("checked");
8311      record.set("checked", newValue);
8312      if (!this._visibleFilteredItemIds || newValue) {
8313        return;
8314      }
8315      if (this._visibleFilteredItemIds.hasOwnProperty(recordId)) {
8316        delete this._visibleFilteredItemIds[recordId];
8317        $itemEl.remove();
8318      }
8319    }, _onRecordChange:function(e, store, record, name, value) {
8320      if (name !== "checked") {
8321        return;
8322      }
8323      var item = this._$elCont.find('> .hm-form-select-list-item[data-id="' + record.getIndex() + '"]');
8324      if (value) {
8325        item.addClass(this.CLASS_CHECKED);
8326      } else {
8327        item.removeClass(this.CLASS_CHECKED);
8328      }
8329      this.fireEvent("change", this.getValue(), this);
8330    }});
8331    self = hm.core.ui.form.element.select.list.MultiSelectList;
8332  })();
8333  (function() {
8334    var self;
8335    HM.define("hm.core.ui.form.helper.MultiSet", {extend:"hm.core.ui.Component", config:{el:null, isSingle:false}, _init:function() {
8336      var _init = arguments.callee;
8337      this.callParent(_init, arguments);
8338      this._addRow();
8339      if (this.config.isSingle) {
8340        var $rows = this._getAllRows();
8341        if ($rows.length == 1) {
8342          $rows.find('input[type="hidden"]').val(1);
8343          $rows.find('input[type="checkbox"]').attr("checked", "checked");
8344        }
8345      }
8346    }, _initEvents:function() {
8347      var _initEvents = arguments.callee;
8348      this.callParent(_initEvents, arguments);
8349      var $el = this.getEl();
8350      $el.on("keypress change", ".multiset-trigger", this._onItemKeyPress.bind(this));
8351      $el.on("click", '.multiset-row input[type="checkbox"][name*="is_correct"]', this._onItemCheck.bind(this));
8352      $el.on("click", ".multiset-row-delete", this._onItemDelete.bind(this));
8353    }, _getAllRows:function() {
8354      return this.getEl().find(".multiset-row");
8355    }, _addRow:function() {
8356      var $el = this.getEl(), tpl = $el.data("emptytpl"), $clone = $($el.data("emptytpl"));
8357      this._fixElements($clone);
8358      $clone.find('input[type="hidden"]').val(0);
8359      $clone.find('input[type="text"]').val("");
8360      $clone.find('input[type="checkbox"]').attr("checked", null);
8361      $el.append($clone);
8362      this.fireEvent("addRow", $clone);
8363    }, _fixElements:function($clone) {
8364      var $cells = $clone.find(".multiset-cell"), scripts = [];
8365      for (var i = 0, ln = $clone.length;i < ln;i++) {
8366        if ($clone[i].tagName === "SCRIPT") {
8367          scripts.push($clone[i]);
8368        }
8369      }
8370      for (var i = 0, ln = $cells.length;i < ln;i++) {
8371        var $cell = $cells.eq(i);
8372        if ($cell.hasClass("multiset-type-fcbkcomplete")) {
8373          this._fixElement_fcbkcomplete($cell, scripts);
8374        }
8375        if ($cell.hasClass("multiset-type-html5file")) {
8376          this._fixElement_html5file($cell, scripts);
8377        }
8378      }
8379    }, _fixElement_fcbkcomplete:function($cell, scripts) {
8380      var $select = $cell.find("select"), oldId = $select.attr("id"), id = oldId + "_" + (new Date - 0);
8381      $select.attr("id", id);
8382      var find = '$("#' + oldId + '")', replacement = '$("#' + id + '")';
8383      for (var i = 0, ln = scripts.length;i < ln;i++) {
8384        var scriptText = scripts[i].innerHTML;
8385        if (scriptText.indexOf(find) !== -1) {
8386          scripts[i].innerHTML = scriptText.replace('$("#' + oldId + '")', '$("#' + id + '")');
8387          return;
8388        }
8389      }
8390    }, _fixElement_html5file:function($cell, scripts) {
8391      var $file = $cell.find('input[type="file"]'), oldId = $file.attr("id"), id = oldId + "_" + (new Date - 0);
8392      $file.attr("id", id);
8393      var find = "#" + oldId, replacement = "#" + id;
8394      for (var i = 0, ln = scripts.length;i < ln;i++) {
8395        var scriptText = scripts[i].innerHTML;
8396        if (scriptText.indexOf(find) !== -1) {
8397          scripts[i].innerHTML = scriptText.replace('$("#' + oldId + '")', '$("#' + id + '")');
8398          return;
8399        }
8400      }
8401    }, _onItemCheck:function(e) {
8402      var $checkbox = $(e.currentTarget), $itemRow = $checkbox.closest(".multiset-row"), config = this.config, $el = this.getEl();
8403      if (config.isSingle) {
8404        var $rows = this._getAllRows(), $otherRows = $rows.not($itemRow[0]);
8405        $otherRows.find('input[type="checkbox"]').attr("checked", null);
8406        $otherRows.find('input[type="hidden"]').val(0);
8407        if (!$checkbox.attr("checked")) {
8408          $checkbox.attr("checked", "checked");
8409        }
8410      }
8411      $itemRow.find('input[type="hidden"]').val($checkbox.attr("checked") ? 1 : 0);
8412    }, _onItemDelete:function(e) {
8413      e.preventDefault();
8414      var $el = this.getEl(), $item = $(e.currentTarget);
8415      if ($el.find(".multiset-row").length > 1) {
8416        $item.closest(".multiset-row").remove();
8417      }
8418    }, _onItemKeyPress:function(e) {
8419      var $rows = this.getEl().find(".multiset-row"), emptyRows = [];
8420      for (var i = 0, ln = $rows.length;i < ln;i++) {
8421        var $row = $rows.eq(i);
8422        if (this._rowIsEmpty($row)) {
8423          emptyRows.unshift($row);
8424        }
8425      }
8426      var emptyLength = emptyRows.length;
8427      if (emptyLength === 0) {
8428        this._addRow();
8429      } else {
8430        if (emptyLength > 1) {
8431          for (var i = 0;i < emptyLength - 1;i++) {
8432            emptyRows[i].remove();
8433          }
8434        }
8435      }
8436    }, _rowIsEmpty:function($row) {
8437      var $all = $row.find(".multiset-trigger"), $empty = $all.filter(function() {
8438        var $input = $(this), emptyValue = $input.data("empty-value"), value = $input.val();
8439        if (value == emptyValue) {
8440          return true;
8441        }
8442        return!value;
8443      });
8444      return $empty.length === $all.length;
8445    }});
8446    self = hm.core.ui.form.helper.MultiSet;
8447  })();
8448  (function() {
8449    var self;
8450    HM.define("hm.core.ui.form.helper.imageMap.ImageMapAnswer", {extend:"hm.core.ui.Component", config:{tplByClass:true, map:null, data:null, editor:null, name:"answer", editMode:true, visible:true, classNameSpace:"hm-form-helper-imageMapEditor-answer"}, getIsCorrectName:function() {
8451      var config = this.config, data = config.data, editor = config.editor, fieldName = editor.getName().replace(/\[\]$/, ""), answerName = config.name;
8452      if (!config.editMode) {
8453        return "";
8454      }
8455      if (data && data.id) {
8456        return fieldName + "[" + data.id + "][is_correct]";
8457      } else {
8458        return fieldName + "[new][is_correct][]";
8459      }
8460    }, getVariantName:function() {
8461      var config = this.config, data = config.data, editor = config.editor, fieldName = editor.getName().replace(/\[\]$/, ""), answerName = config.name;
8462      if (!config.editMode) {
8463        return "";
8464      }
8465      if (data && data.id) {
8466        return fieldName + "[" + data.id + "][" + answerName + "]";
8467      } else {
8468        return fieldName + "[new][" + answerName + "][]";
8469      }
8470    }, getDataName:function() {
8471      var config = this.config, data = config.data, editor = config.editor, fieldName = editor.getName().replace(/\[\]$/, ""), answerName = config.name;
8472      if (!config.editMode) {
8473        return "";
8474      }
8475      if (data && data.id) {
8476        return fieldName + "[" + data.id + "][data]";
8477      } else {
8478        return fieldName + "[new][data][]";
8479      }
8480    }, _init:function() {
8481      var _init = arguments.callee;
8482      this.callParent(_init, arguments);
8483      var config = this.config, $el = this.getEl(), editor = config.editor, data = config.data, ns = this._ns, visible = config.visible;
8484      this._$elIsRight = ns.find('isRight input[type="checkbox"]');
8485      this._$elIsRightFakeInput = ns.find('isRight input[type="hidden"]');
8486      this._$elCaption = ns.find('caption input[type="text"]');
8487      this._$elData = ns.find('caption input[type="hidden"]');
8488      if (data) {
8489        this.setData(config.data);
8490      }
8491      if (visible) {
8492        this._$elCaption.attr("name", this.getVariantName());
8493      }
8494      if (config.editMode) {
8495        this._$elIsRightFakeInput.attr("name", this.getIsCorrectName());
8496        this._$elData.attr("name", this.getDataName());
8497        this._updateDataField();
8498      } else {
8499        if (visible) {
8500          this._$elCaption.attr("readonly", "readonly");
8501        }
8502        this._$elIsRight.val(config.data.id);
8503        this._$elIsRight.checkbox();
8504        this._$elIsRight.attr("name", editor.getName() + "[" + config.data.question_id + "][" + config.data.id + "]");
8505      }
8506    }, _initEvents:function() {
8507      var _initEvents = arguments.callee;
8508      this.callParent(_initEvents, arguments);
8509      this._$elIsRight.on("click", this._onSetAsRightAnswer.bind(this));
8510      var config = this.config, map = config.map;
8511      map.on("select", this._onSelectMap, this);
8512      map.on("unSelect", this._onUnSelectMap, this);
8513      map.on("destroy", this._onDestroyMap, this);
8514      map.on("drawEnd", this._onDrawEndMap, this);
8515      if (config.editMode) {
8516        this._ns.on("click", "action_delete", this._onClickDelete);
8517        this._ns.on("focus", 'caption input[type="text"]', this._onFocus);
8518        this._ns.on("blur", 'caption input[type="text"]', this._onBlur);
8519      }
8520    }, _updateDataField:function() {
8521      var map = this.config.map;
8522      this._$elData.val(JSON.stringify({mapData:map.getData(), type:map.getType()}));
8523    }, setData:function(data) {
8524      if (data.hasOwnProperty("is_correct")) {
8525        if (data.is_correct) {
8526          this._$elIsRight.attr("checked", "checked");
8527          this._$elIsRightFakeInput.val("1");
8528          this.getMap().select();
8529        } else {
8530          this._$elIsRight.attr("checked", null);
8531        }
8532      }
8533      if (data.hasOwnProperty("variant")) {
8534        this._$elCaption.val(data.variant);
8535      }
8536    }, getMap:function() {
8537      return this.config.map;
8538    }, getData:function() {
8539      return{is_correct:this._$elIsRight.attr("checked") === "checked", variant:this._$elCaption.val()};
8540    }, _onSetAsRightAnswer:function(e) {
8541      e.stopPropagation();
8542      var map = this.config.map;
8543      if (!map.selected()) {
8544        this.config.map.select();
8545      } else {
8546        this.config.map.unSelect();
8547      }
8548    }, _onSelectMap:function() {
8549      var me = this;
8550      setTimeout(function() {
8551        me._$elIsRight.attr("checked", "checked");
8552      }, 0);
8553      this._$elIsRightFakeInput.val("1");
8554    }, _onUnSelectMap:function(e, map) {
8555      var me = this;
8556      setTimeout(function() {
8557        me._$elIsRight.attr("checked", null);
8558      }, 0);
8559      this._$elIsRightFakeInput.val("0");
8560    }, _onDestroyMap:function() {
8561      this.destroy();
8562    }, _onDrawEndMap:function(e, map) {
8563      this._updateDataField();
8564    }, _onClickDelete:function(e) {
8565      e.preventDefault();
8566      this.config.map.destroy();
8567    }, _onFocus:function(e) {
8568      this.config.map.mark();
8569    }, _onBlur:function(e) {
8570      this.config.map.unMark();
8571    }});
8572    self = hm.core.ui.form.helper.imageMap.ImageMapAnswer;
8573  })();
8574  (function() {
8575    var self;
8576    (function() {
8577      var counter = 0;
8578      HM.define("hm.core.ui.form.helper.imageMap.ImageMapEditor", {extend:"hm.core.ui.Component", config:{tplByClass:true, editMode:true, name:"question", value:null, answerName:"answer", data:null, imageUrl:"", imageFileId:0, showVariants:true, classNameSpace:"hm-form-helper-imageMapEditor"}, _init:function() {
8579        var _init = arguments.callee;
8580        this.callParent(_init, arguments);
8581        this._id = ++counter;
8582        var $el = this.getEl(), config = this.config, me = this, ns = this._ns;
8583        this._$elImageMapeEditorContainer = ns.find("image");
8584        this._$elAnswersContainer = ns.find("answerList-body");
8585        this._$elImageFileIdInput = $(document).find('form input[name="file_id"]');
8586        var imageMapEditor = this._imageMapEditor = HM.create("hm.core.ui.imageMapEditor.ImageMapEditor", {readOnly:!this.config.editMode, renderTo:this._$elImageMapeEditorContainer, imageUrl:config.imageUrl, listeners:{scope:this, mapAdded:this._onMapAdded}});
8587        this._answers = [];
8588        var $fileInput = $el.find('input[type="file"]');
8589        if (config.editMode) {
8590          if (this._$elImageFileIdInput.val() != 0) {
8591            this.setFileId(this._$elImageFileIdInput.val());
8592            $fileInput.hide();
8593          } else {
8594            $fileInput.fileupload({url:"/file/upload/save", dataType:"json", autoUpload:true, limitMultiFileUploads:1, formData:function(form) {
8595              return "";
8596            }, add:function(e, data) {
8597              data.submit();
8598            }, done:function(data, xhr) {
8599              var file = xhr.result[0];
8600              me.setFileId(file.id);
8601            }});
8602          }
8603        } else {
8604          this.setFileId(config.imageFileId);
8605          $fileInput.hide();
8606        }
8607        var data = config.data, me = this;
8608        if (data) {
8609          setTimeout(function() {
8610            me.setData(data);
8611          }, 0);
8612        }
8613      }, setFileId:function(id) {
8614        this._$elImageFileIdInput.val(id);
8615        this._ns.find("content").show();
8616        this.getEl().find('input[type="file"]').hide();
8617        this._imageMapEditor.setImageUrl("/file/get/file/file_id/" + id);
8618      }, _initEvents:function() {
8619        var _initEvents = arguments.callee;
8620        this.callParent(_initEvents, arguments);
8621      }, createAnswer:function(map, answerData) {
8622        var config = this.config, editMode = config.editMode, className = "";
8623        if (!editMode) {
8624          className = this._answers.length % 2 === 1 ? "odd" : "even";
8625        }
8626        var config = this.config, answer = HM.create("hm.core.ui.form.helper.imageMap.ImageMapAnswer", {editor:this, map:map, data:answerData, name:config.answerName, renderTo:this._$elAnswersContainer, editMode:editMode, className:className, visible:config.showVariants, listeners:{scope:this, destroy:this._onAnswerDestroy}});
8627        if (!editMode && config.value !== null) {
8628          for (var i in config.value) {
8629            if (!config.value.hasOwnProperty(i)) {
8630              continue;
8631            }
8632            if (config.value[i] == answerData.id) {
8633              map.select();
8634              break;
8635            }
8636          }
8637        }
8638        this._answers.push(answer);
8639      }, getId:function() {
8640        return this._id;
8641      }, getData:function() {
8642        var answers = this._answers, result = [];
8643        for (var i = 0, ln = answers.length;i < ln;i++) {
8644          var answer = answers[i], map = answer.getMap();
8645          result.push({type:map.getType(), mapData:map.getData(), answerData:answer.getData()});
8646        }
8647        return result;
8648      }, setData:function(data) {
8649        var mapEditor = this._imageMapEditor, me = this;
8650        if (!mapEditor.canvasIsReady()) {
8651          mapEditor.one("canvasReady", function() {
8652            me.setData(data);
8653          });
8654          return;
8655        }
8656        for (var i = 0, ln = data.length;i < ln;i++) {
8657          var answerCfg = data[i], mapType = answerCfg.type, mapData = answerCfg.mapData, answerData = answerCfg.answerData;
8658          var map = mapEditor.createMap(mapType, mapData);
8659          this.createAnswer(map, answerData);
8660        }
8661      }, getName:function() {
8662        return this.config.name;
8663      }, _onMapAdded:function(e, map) {
8664        if (!map.waitOfDrawingEnd()) {
8665          return;
8666        }
8667        this.createAnswer(map);
8668      }, _onAnswerDestroy:function(e, answer) {
8669        var answers = this._answers;
8670        for (var i = 0, ln = answers.length;i < ln;i++) {
8671          if (answers[i] !== answer) {
8672            continue;
8673          }
8674          answers.splice(i, 1);
8675          break;
8676        }
8677      }});
8678    })();
8679    self = hm.core.ui.form.helper.imageMap.ImageMapEditor;
8680  })();
8681  (function() {
8682    var self;
8683    var bridgeInited = false, chartCount = 0;
8684    HM.define("hm.core.ui.graph.amcharts.Chart", {extend:"hm.core.ui.Component", config:{tplByClass:true, amChartsPath:"/js/lib/amcharts", infoBlockId:"", chartType:"amcolumn", dataUrl:"", settingUrl:"", height:300, width:"100%"}, _init:function() {
8685      var _init = arguments.callee;
8686      var config = this.config, me = this;
8687      this.export_url = hm.core.Url.getInstance().url({app:"", module:"infoblock", controller:config.infoBlockId, action:"get-data", format:"csv"});
8688      if (!bridgeInited) {
8689        this._initAmChartsBridge();
8690      }
8691      this.chartId = ++chartCount;
8692      this.infoblockId = config.infoBlockId === "" ? "hm-chart-" + this.chartId : config.infoBlockId;
8693      this.chartContainerId = this.infoblockId + "-chart-container";
8694      this.swfObjectId = this.infoblockId + "-chart";
8695      this.callParent(_init, arguments);
8696      yepnope({test:$.url, nope:"/js/lib/jquery/jquery.urldecoder.min.js", complete:function() {
8697        yepnope({test:window.SWFObject, nope:config.amChartsPath + "/swfobject.js", complete:function() {
8698          $(me._onDocReady.bind(me));
8699        }});
8700      }});
8701    }, _initEvents:function() {
8702      var _initEvents = arguments.callee;
8703      this.callParent(_initEvents, arguments);
8704    }, _onDocReady:function() {
8705      var config = this.config, swfUrl = config.amChartsPath + "/" + config.chartType + ".swf";
8706      var Chart = new SWFObject(swfUrl, this.swfObjectId, config.width, config.height, "8", "#FFFFFF");
8707      Chart.addVariable("chart_id", this.swfObjectId);
8708      Chart.addVariable("path", config.amChartsPath + "/");
8709      Chart.addVariable("settings_file", encodeURIComponent(config.settingUrl));
8710      Chart.addVariable("data_file", encodeURIComponent(config.dataUrl));
8711      Chart.addVariable("loading_settings", HM._("Загрузка"));
8712      Chart.addVariable("loading_data", HM._("Загрузка"));
8713      Chart.addParam("wmode", "opaque");
8714      Chart.write(this.chartContainerId);
8715      console.log(Chart);
8716      this._chart = Chart;
8717    }, _initAmChartsBridge:function() {
8718      window.data = new Array;
8719      window.amChartInited = function(chart_id) {
8720        chart = document.getElementById(chart_id);
8721        chart.getData();
8722      };
8723      window.amReturnData = function(chart_id, chart_data) {
8724        data[chart_id] = $.url.decode(chart_data);
8725        eval(chart_id.replace("-", "") + "Inited()");
8726      };
8727      bridgeInited = true;
8728    }});
8729    self = hm.core.ui.graph.amcharts.Chart;
8730  })();
8731  (function() {
8732    var self;
8733    HM.define("hm.core.ui.progressbar.Progressbar", {extend:"hm.core.ui.Component", config:{tpl:"hm/core/ui/progressbar/Progressbar", renderTo:"", value:30, maxValue:100, valueColor:"#5e7aa8", label:null, width:null, height:null, size:"normal"}, _init:function() {
8734      var _init = arguments.callee;
8735      this.callParent(_init, arguments);
8736      var $progressbar = this._getProgressbar(), config = this.config;
8737      if (config.size) {
8738        $progressbar.addClass("progressbar-" + config.size);
8739      }
8740      if (config.width) {
8741        $progressbar.width(config.width);
8742      }
8743      if (config.height) {
8744        $progressbar.height(config.height);
8745      }
8746      this._initMaxValue();
8747      this._initBarValue();
8748      if (config.label) {
8749        $progressbar.append('<div class="ui-progressbar-label">' + config.label + "</div>");
8750      }
8751    }, _initMaxValue:function() {
8752      this._maxValue = this.config.maxValue;
8753    }, _initBarValue:function() {
8754      var config = this.config;
8755      this.addBarValue(config.value, config.valueColor);
8756    }, addBarValue:function(value, color, offset, zIndex) {
8757      var $progressbar = this._getProgressbar(), config = this.config, $barValue = $('<div class="ui-progressbar-value"></div>');
8758      var css = {"width":this._getPercent(value) + "%", "background-color":color, "z-index":10};
8759      if (offset) {
8760        css["left"] = this._getPercent(offset) + "%";
8761      } else {
8762        $barValue.addClass("ui-corner-left");
8763      }
8764      if (zIndex) {
8765        css["z-index"] = zIndex;
8766      }
8767      if (config.width) {
8768        $barValue.width(config.width);
8769      }
8770      if (config.height) {
8771        $barValue.height(config.height);
8772        $barValue.css("margin-top", "-" + $barValue.css("height"));
8773        $progressbar.find(".gradient-me").height(config.height);
8774      }
8775      $barValue.css(css);
8776      $progressbar.append($barValue);
8777      return $barValue;
8778    }, _getProgressbar:function() {
8779      if (this._$progressbar === undefined) {
8780        this._$progressbar = this.getEl().find(".ui-progressbar");
8781      }
8782      return this._$progressbar;
8783    }, _getPercent:function(value) {
8784      return Math.round(value / this._maxValue * 100);
8785    }});
8786    self = hm.core.ui.progressbar.Progressbar;
8787  })();
8788  (function() {
8789    var self;
8790    HM.define("hm.core.ui.progressbar.cumulative.ProgressbarCumulative", {extend:"hm.core.ui.progressbar.Progressbar", config:{bestValueColor:"#51C54C", bestValue:null, altValue:null, bestAltValue:null, maxAltValue:null, targetValue:null}, _initMaxValue:function() {
8791      var config = this.config;
8792      this._maxValue = config.maxValue + config.maxAltValue;
8793    }, _initBarValue:function() {
8794      var _initBarValue = arguments.callee;
8795      this.callParent(_initBarValue, arguments);
8796      var config = this.config;
8797      this.addBarValue(config.bestValue, config.bestValueColor, null, 9);
8798      this.addBarValue(config.altValue, config.valueColor, config.maxValue);
8799      this.addBarValue(config.bestAltValue, config.bestValueColor, config.maxValue, 9);
8800      this._addTargetLine(config.targetValue);
8801      this._addAltLine(config.maxValue, HM._("Альтернативные"));
8802      this._addAltLine(0, HM._("Обязательные"), {lineColor:"transparent", hideValueLabel:true});
8803    }, _addTargetLine:function(value) {
8804      var $progressbar = this._getProgressbar();
8805      var $targetvalue = $('<div class="hm-progressbar-line hm-progressbar-simple-line">' + '<div class="hm-progressbar-value-label">' + value + "</div>" + '<div class="hm-progressbar-flag"></div>' + "</div>");
8806      $targetvalue.css("left", this._getPercent(value) + "%");
8807      $progressbar.append($targetvalue);
8808    }, _addAltLine:function(value, text, options) {
8809      var $progressbar = this._getProgressbar();
8810      var $targetvalue = $('<div class="hm-progressbar-line hm-progressbar-alt-line">' + '<div class="hm-progressbar-value-label">' + value + "</div>" + '<div class="hm-progressbar-text-label">' + text + "</div>" + "</div>");
8811      if (options) {
8812        if (options["lineColor"]) {
8813          $targetvalue.css("background-color", options["lineColor"]);
8814        }
8815        if (options["hideValueLabel"]) {
8816          $targetvalue.find(".hm-progressbar-value-label").hide();
8817        }
8818        if (options["hideTextLabel"]) {
8819          $targetvalue.find(".hm-progressbar-text-label").hide();
8820        }
8821      }
8822      $targetvalue.css("left", this._getPercent(value) + "%");
8823      $progressbar.append($targetvalue);
8824    }});
8825    self = hm.core.ui.progressbar.cumulative.ProgressbarCumulative;
8826  })();
8827  (function() {
8828    var self;
8829    HM.define("hm.core.ui.search.SphinxSearch", {extend:"hm.core.ui.Component", config:{tpl:"hm/core/ui/search/SphinxSearch", searchUrl:null, indexes:null, items:{all:{field:"*", value:""}}}, _init:function() {
8830      var _init = arguments.callee;
8831      this.callParent(_init, arguments);
8832      var config = this.config;
8833      if (config.indexes === null) {
8834        throw new Error("Необходимо указать как минимум один индекс.");
8835      }
8836      if (!_.isArray(config.indexes) && _.isString(config.indexes)) {
8837        var index = config.indexes;
8838        config.indexes = [index];
8839      }
8840    }, __construct:function() {
8841      var __construct = arguments.callee;
8842      this.callParent(__construct, arguments);
8843      this._$resultsContainer = this.getEl().find(".hm-search-result");
8844      this._initItems();
8845    }, _initEvents:function() {
8846      this.elOn("click", 'input[type="submit"], .submit', this._search, this);
8847      this.elOn("keypress", "input", this._search, this);
8848    }, _initItems:function() {
8849      _.each(this.config.items, this._initItem, this);
8850    }, _initItem:function(item, key, list) {
8851      if (item.rangeTo !== undefined && list[item.rangeTo] === undefined) {
8852        throw new Error('Для config.items."' + key + '" указан rangeTo, но данные для него не определены.');
8853      }
8854      if (item.rangeFrom !== undefined && list[item.rangeFrom] === undefined) {
8855        throw new Error('Для config.items."' + key + '" указан rangeFrom, но данные для него не определены.');
8856      }
8857      if (item.value !== undefined) {
8858        this.getEl().find('input[name="' + key + '"],' + 'select[name="' + key + '"]').val(item.value);
8859      }
8860    }, _updateItemsData:function() {
8861      var items = this.config.items;
8862      this.getEl().find("input[name], select[name]").each(function() {
8863        var $this = $(this), key = $this.attr("name"), val = $this.val();
8864        if ($this.hasClass("hasDatepicker") && val) {
8865          var date = hm.core.Date.parse(val);
8866          val = Math.round(date.getTime() / 1E3);
8867        }
8868        if (items[key]) {
8869          items[key].value = val;
8870        }
8871      });
8872      _.each(items, function(item, key, list) {
8873        var hasDefault = item.defaultValue !== undefined, hasValue = item.value !== undefined && $.trim(item.value) != "";
8874        if (hasDefault && !hasValue) {
8875          item.value = item.defaultValue;
8876        }
8877      });
8878    }, getResultsContainer:function() {
8879      return this._$resultsContainer;
8880    }, search:function() {
8881      this._updateItemsData();
8882      var items = this.config.items;
8883      var filterData = {}, filterRangeData = {}, queryData = [];
8884      _.each(items, function(item, key, list) {
8885        var isField = item.field !== undefined, isAttr = item.attr !== undefined, hasRangeFrom = item.rangeFrom !== undefined, hasRangeTo = item.rangeTo !== undefined, isRange = hasRangeFrom || hasRangeTo, hasValue = item.value !== undefined && $.trim(item.value) != "";
8886        if (!hasValue) {
8887          return;
8888        }
8889        if (isField) {
8890          queryData.push(item);
8891        }
8892        if (isAttr) {
8893          var attr = item.attr;
8894          if (isRange) {
8895            if (hasRangeTo) {
8896              var fromValue = item.value;
8897              var toValue = list[item.rangeTo].value;
8898              item.value = [fromValue, toValue];
8899              filterRangeData[attr] = {value:item.value, exclude:[]};
8900            }
8901          } else {
8902            if (filterData[attr] === undefined) {
8903              filterData[attr] = {value:[], exclude:[]};
8904            }
8905            filterData[attr].value.push(item.value);
8906          }
8907        }
8908      });
8909      $.ajax({type:"POST", url:this.config.searchUrl, data:{indexes:this.config.indexes, queryData:queryData, filterData:filterData, filterRangeData:filterRangeData}}).done(_.bind(this._onSearchDone, this));
8910    }, _search:function(e) {
8911      if (e.type == "keypress" && e.which != 13) {
8912        return;
8913      }
8914      e.preventDefault();
8915      this.search();
8916    }, _onSearchDone:function(data) {
8917      this._$resultsContainer.contents().remove();
8918      this._$resultsContainer.append(data);
8919    }});
8920    self = hm.core.ui.search.SphinxSearch;
8921  })();
8922  (function() {
8923    var self;
8924    HM.define("hm.core.ui.select.Option", {extend:"hm.core.ui.Component", config:{tplByClass:true, optionsContainer:null, clusterize:false, text:null, value:null, selected:false, addClass:""}, statics:{index:0}, _init:function() {
8925      var _init = arguments.callee;
8926      this.callParent(_init, arguments);
8927      var config = this.config, $el = this.getEl();
8928      if (config.addClass) {
8929        this.getEl().addClass(config.addClass);
8930      }
8931      this._selected = config.selected;
8932      this._updateView();
8933    }, _initEvents:function() {
8934    }, _onClick:function() {
8935      var event = this.fireEvent("click", this);
8936      if (!(event && event.isPrevented())) {
8937        this.userToggle();
8938      }
8939    }, getEl:function() {
8940      var config = this.config;
8941      if (config.clusterize && config.optionsContainer.isClusterized()) {
8942        this._$el = config.optionsContainer.getEl().find('.hm-select-option[hm-id="' + this._componentId + '"]');
8943      }
8944      return this._$el;
8945    }, getText:function() {
8946      return this.config.text;
8947    }, getValue:function() {
8948      return this.config.value;
8949    }, isSelected:function() {
8950      return this._selected;
8951    }, select:function(flag) {
8952      flag = flag ? true : false;
8953      if (this.isSelected() == flag) {
8954        return false;
8955      } else {
8956        this._selected = flag;
8957      }
8958      this._updateView();
8959      return true;
8960    }, userSelect:function(flag) {
8961      if (this.select(flag)) {
8962        this.fireEvent("change", this);
8963      }
8964    }, userToggle:function() {
8965      this.userSelect(!this.isSelected());
8966    }, _updateView:function() {
8967      this.getEl().toggleClass("hm-select-option-selected", this.isSelected());
8968    }});
8969    self = hm.core.ui.select.Option;
8970  })();
8971  (function() {
8972    var self;
8973    HM.define("hm.core.ui.select.OptionsContainer", {extend:"hm.core.ui.Component", config:{tplByClass:true, options:[], values:[], maxHeight:null, maxWidth:null, css:null, clusterize:false, autoHide:null, inside:null}, _init:function() {
8974      var _init = arguments.callee;
8975      this.callParent(_init, arguments);
8976      var config = this.config, $el = this.getEl();
8977      if (config.maxWidth !== null) {
8978        $el.css("max-width", config.maxWidth);
8979      }
8980      if (config.css !== null) {
8981        $el.css(config.css);
8982      }
8983      this._$optionsWrap = $el.find(".hm-select-options-wrap");
8984      this._$ul = this._$optionsWrap.find("ul");
8985      this._initOptions();
8986      if (config.clusterize) {
8987        this._clusterize = new Clusterize({scrollElem:this._$optionsWrap[0], contentElem:this._$ul[0]});
8988      }
8989    }, _initEvents:function() {
8990      this._onDocumentClickBind = _.bind(this._onDocumentClick, this);
8991      this._$ul.on("click", ".hm-select-option", _.bind(this._onOptionEvent, this));
8992    }, _initOptions:function() {
8993      this._options = [];
8994      _.each(this.config.options, this._initOption, this);
8995    }, _initOption:function(val, key) {
8996      var value = key;
8997      if (val["value"] !== undefined) {
8998        value = val["value"];
8999      }
9000      var text = val["text"], selected = $.inArray(value, this.config.values) != -1, addClass = val["addClass"];
9001      this.createOption(value, text, selected, addClass);
9002    }, _onOptionEvent:function(e) {
9003      var $target = $(e.currentTarget), option = hm.core.ui.Component.getComponent($target);
9004      if (e.type == "click") {
9005        option._onClick();
9006      }
9007    }, _onDocumentClick:function(e) {
9008      var $el = this.getEl();
9009      if ($el.find($(e.target)).length == 0) {
9010        this.hide();
9011      }
9012    }, isClusterized:function() {
9013      return!!this._clusterize;
9014    }, initScroll:function() {
9015      if (this._scrollInited) {
9016        return;
9017      }
9018      var $ul = this._$ul, maxHeight = this.config.maxHeight;
9019      if (maxHeight !== null && $ul.height() > maxHeight) {
9020        this._$optionsWrap.css({"overflow-y":"scroll", "height":maxHeight});
9021      }
9022      this._scrollInited = true;
9023    }, removeOption:function() {
9024    }, addOption:function(option) {
9025      this.needToDestroy(option);
9026      this._options.push(option);
9027    }, createOption:function(value, text, selected, addClass) {
9028      var option = HM.create("hm.core.ui.select.Option", {renderTo:this._$ul, optionsContainer:this, clusterize:this.config.clusterize, text:text, value:value, selected:selected, addClass:addClass});
9029      this.addOption(option);
9030      return option;
9031    }, getOptions:function() {
9032      return this._options;
9033    }, _beforeShow:function() {
9034      var _beforeShow = arguments.callee;
9035      return this.callParent(_beforeShow, arguments);
9036    }, show:function() {
9037      var show = arguments.callee;
9038      if (!this.config.inside) {
9039        var me = this;
9040        setTimeout(function() {
9041          hm.core.DOM.$document().on("click", me._onDocumentClickBind);
9042        }, 0);
9043      }
9044      var result = this.callParent(show, arguments);
9045      if (this.config.clusterize && result) {
9046        this._clusterize.refresh();
9047      }
9048      return result;
9049    }, hide:function(force) {
9050      var hide = arguments.callee;
9051      if (this.config.inside) {
9052        return false;
9053      }
9054      hm.core.DOM.$document().off("click", this._onDocumentClickBind);
9055      return this.callParent(hide, arguments);
9056    }});
9057    self = hm.core.ui.select.OptionsContainer;
9058  })();
9059  (function() {
9060    var self;
9061    HM.define("hm.core.ui.select.Select", {extend:"hm.core.ui.Component", config:{tplByClass:true, select:null, name:null, multiple:null, options:[], values:[], clusterize:false, maxWidth:null, optionsInside:null, optionsAutoHide:null, optionsMaxHeight:null, optionsMaxWidth:null, optionsCss:null, addClass:""}, _init:function() {
9062      var _init = arguments.callee;
9063      this.callParent(_init, arguments);
9064      var $el = this.getEl(), config = this.config;
9065      if (_.isArray(config.options)) {
9066        this._options = $.merge([], config.options);
9067      } else {
9068        this._options = $.extend({}, config.options);
9069      }
9070      this._values = $.merge([], config.values);
9071      this._$selectedContent = $el.find(".hm-select-selected span");
9072      this._initOptions();
9073      if (config.optionsInside) {
9074        $el.toggleClass("hm-select-options-inside", config.optionsInside);
9075      }
9076      if (config.multiple) {
9077        $el.toggleClass("hm-select-multiple", config.multiple);
9078      }
9079      $el.addClass(config.addClass);
9080      if (config.maxWidth !== null) {
9081        $el.css("max-width", config.maxWidth);
9082      }
9083      this._updateView();
9084    }, _initDefaults:function() {
9085      var config = this.config;
9086      if (config.multiple === null) {
9087        config.multiple = false;
9088      }
9089      if (config.optionsInside === null) {
9090        config.optionsInside = false;
9091      }
9092      if (config.optionsAutoHide === null) {
9093        config.optionsAutoHide = true;
9094      }
9095    }, _initOptions:function() {
9096      this._initNativeOptions();
9097      this._initDefaults();
9098      var config = this.config;
9099      this._optionsContainer = HM.create("hm.core.ui.select.OptionsContainer", {renderTo:config.optionsInside ? this.getEl() : "body", maxHeight:config.optionsMaxHeight, maxWidth:config.optionsMaxWidth, css:config.optionsCss, autoHide:config.optionsAutoHide, clusterize:config.clusterize, inside:config.optionsInside, options:this._options, values:this._values, listeners:{scope:this, show:this._onOptionsShow}});
9100      this.needToDestroy(this._optionsContainer);
9101      if (config.optionsInside) {
9102        this.getOptionsContainer().show();
9103      }
9104      var options = this.getOptions();
9105      for (var i = 0, ln = options.length;i < ln;i++) {
9106        options[i].on("change", this._onOptionChange, this);
9107        options[i].on("click", this._onOptionClick, this);
9108      }
9109    }, _initNativeOptions:function() {
9110      var config = this.config, $select = config.select;
9111      if (!($select instanceof jQuery)) {
9112        $select = $(config.select);
9113        if (!$select.length) {
9114          return;
9115        }
9116      }
9117      this._$select = $select;
9118      var nativeOptions = [], nativeSelectedValues = [];
9119      $select.find("option").each(function() {
9120        var $option = $(this), value = $option.attr("value"), text = $option.text();
9121        nativeOptions.push({value:value, text:text});
9122        if ($option.is(":selected")) {
9123          nativeSelectedValues.push(value);
9124        }
9125      });
9126      this._options = nativeOptions;
9127      this._values = nativeSelectedValues;
9128      if (config.multiple === null) {
9129        var multiple = $select.attr("multiple");
9130        config.multiple = multiple !== undefined && multiple !== false;
9131      }
9132      if (multiple) {
9133        if (config.optionsInside === null) {
9134          config.optionsInside = true;
9135        }
9136        if (config.optionsAutoHide === null) {
9137          config.optionsAutoHide = false;
9138        }
9139      }
9140      if (config.name === null) {
9141        var name = $select.attr("name");
9142        if (name !== undefined) {
9143          config.name = name;
9144        }
9145      }
9146      $select.hide();
9147      $select.after(this.getEl());
9148    }, _initEvents:function() {
9149      this.elOn("click", ".hm-select-selected", this._onSelectedClick);
9150    }, _onOptionsShow:function(event, optionsContainer) {
9151      this._updateOptionsContainer(optionsContainer);
9152    }, _updateOptionsContainer:function(optionsContainer) {
9153      if (optionsContainer.isVisible()) {
9154        optionsContainer.initScroll();
9155        optionsContainer.getEl().position({my:"left top", at:"left bottom", collision:"flip flip", of:this.getEl()});
9156      }
9157    }, _onSelectedClick:function() {
9158      this.getOptionsContainer().toggle();
9159    }, _onOptionClick:function(event, option) {
9160      var config = this.config;
9161      if (!config.multiple) {
9162        if (option.isSelected()) {
9163          event.preventDefault();
9164          option.userSelect(true);
9165        }
9166        var options = this.getOptions();
9167        for (var i = 0, ln = options.length;i < ln;i++) {
9168          if (options[i].isSelected() && options[i] != option) {
9169            options[i].select(false);
9170          }
9171        }
9172      }
9173    }, _onOptionChange:function(event, option) {
9174      var config = this.config;
9175      if (config.optionsAutoHide) {
9176        this.getOptionsContainer().hide();
9177      }
9178      this._updateView();
9179      var $select = this._$select;
9180      if ($select) {
9181        $select.val(this.getSelectedValues());
9182        $select.trigger("change");
9183      }
9184      this.fireEvent("change", this);
9185    }, hide:function() {
9186      var hide = arguments.callee;
9187      this.getOptionsContainer().hide();
9188      this.callParent(hide, arguments);
9189    }, getSelectedOptions:function() {
9190      var options = this.getOptions(), result = [];
9191      for (var i = 0, ln = options.length;i < ln;i++) {
9192        if (options[i].isSelected()) {
9193          result.push(options[i]);
9194        }
9195      }
9196      return result;
9197    }, getSelectedValues:function() {
9198      var options = this.getOptions(), result = [];
9199      for (var i = 0, ln = options.length;i < ln;i++) {
9200        if (options[i].isSelected()) {
9201          result.push(options[i].getValue());
9202        }
9203      }
9204      return result;
9205    }, getSelectedTexts:function() {
9206      var options = this.getOptions(), result = [];
9207      for (var i = 0, ln = options.length;i < ln;i++) {
9208        if (options[i].isSelected()) {
9209          result.push(options[i].getText());
9210        }
9211      }
9212      if (result.length == 0) {
9213        result.push("&nbsp;");
9214      }
9215      return result;
9216    }, getOptionsContainer:function() {
9217      return this._optionsContainer;
9218    }, getOptions:function() {
9219      return this.getOptionsContainer().getOptions();
9220    }, _updateView:function() {
9221      var selectedTexts = this.getSelectedTexts(), selectedTextsLn = selectedTexts.length;
9222      if (selectedTextsLn > 1) {
9223        this._$selectedContent.html(HM._("Выбрано элементов") + ": " + selectedTextsLn);
9224      } else {
9225        this._$selectedContent.html(this.getSelectedTexts().join("; "));
9226      }
9227      this._updateOptionsContainer(this.getOptionsContainer());
9228    }});
9229    self = hm.core.ui.select.Select;
9230  })();
9231  (function() {
9232    var self;
9233    HM.define("hm.core.ui.select.custom.HeadSwitcher", {extend:"hm.core.ui.select.Select", config:{redirectUrl:null, paramName:null, optionsInside:true, optionsAutoHide:false}, _init:function() {
9234      var _init = arguments.callee;
9235      this.callParent(_init, arguments);
9236      if (this.config.values.length == 0) {
9237        this._detectCurrentOption();
9238      }
9239      if (this.config.multiple) {
9240        this._switchPage = _.debounce(this._switchPage, 1E3);
9241      }
9242    }, _onOptionChange:function(event, option) {
9243      var _onOptionChange = arguments.callee;
9244      this.callParent(_onOptionChange, arguments);
9245      this._switchPage();
9246    }, _detectCurrentOption:function() {
9247      var config = this.config, paramName = config.paramName, options = this.getOptions(), currentUrl = window.location.href, currentUrlSimple = this._getSimpleUrl(currentUrl);
9248      if (paramName) {
9249      } else {
9250        for (var i = 0, ln = options.length;i < ln;i++) {
9251          var optionValue = this._getSimpleUrl(options[i].getValue());
9252          if (optionValue == currentUrlSimple) {
9253            options[i].select(true);
9254            return;
9255          }
9256        }
9257      }
9258      options[0].select(true);
9259    }, _getSimpleUrl:function(url) {
9260      var urlInfo = this._getUrlInfo(url), urlPathname = urlInfo[5], urlSearch = urlInfo[6], urlHash = urlInfo[7];
9261      return[urlPathname, urlSearch, urlHash].join("");
9262    }, _switchPage:function() {
9263      var config = this.config, paramName = config.paramName, selectedValues = this.get
9263SelectedValues();
9264      if (paramName) {
9265        var redirectUrl = config.redirectUrl !== null ? config.redirectUrl : window.location.href, redirectUrlInfo = this._getUrlInfo(redirectUrl), redirectUrlSearch = redirectUrlInfo[6], redirectUrlHash = redirectUrlInfo[7], redirectUrlCfg = this._getUrlCfg(redirectUrl), newUrlParts = [];
9266        redirectUrlCfg[paramName] = selectedValues.join(",");
9267        newUrlParts.push(hm.core.Url.getInstance().url(redirectUrlCfg));
9268        newUrlParts.push(redirectUrlSearch);
9269        newUrlParts.push(redirectUrlHash);
9270        window.location.href = newUrlParts.join("");
9271      } else {
9272        window.location.href = selectedValues[0];
9273      }
9274    }, _getUrlInfo:function(url) {
9275      if (this._urlInfo === undefined) {
9276        this._urlInfo = [];
9277      }
9278      if (this._urlInfo[url] !== undefined) {
9279        return this._urlInfo[url];
9280      }
9281      if (this._urlInfoRegexp === undefined) {
9282        this._urlInfoRegexp = new RegExp(["^(https?:)//", "(([^:/?#]*)(?::([0-9]+))?)", "(/[^?#]*)", "(\\?[^#]*|)?", "(#.*|)?$"].join(""));
9283        this._urlInfoRegexpSimple = new RegExp(["(/[^?#]*)", "(\\?[^#]*|)?", "(#.*|)?$"].join(""));
9284      }
9285      var result;
9286      if (url[0] === "/") {
9287        result = url.match(this._urlInfoRegexpSimple);
9288        result = [url, location.protocol, location.host, location.hostname, location.port, result[1], result[2], result[3]];
9289      } else {
9290        result = url.match(this._urlInfoRegexp);
9291      }
9292      this._urlInfo[url] = result;
9293      return result;
9294    }, _getUrlCfg:function(url) {
9295      var urlInfo = this._getUrlInfo(url), pathname = urlInfo[5], pathnameParts = pathname.replace(/^\/+|\/+$/g, "").split("/"), result = {};
9296      result.module = pathnameParts.shift();
9297      var controller = pathnameParts.shift();
9298      if (controller) {
9299        result.controller = controller;
9300      }
9301      var action = pathnameParts.shift();
9302      if (action) {
9303        result.action = action;
9304      }
9305      var key, value;
9306      while (pathnameParts.length != 0) {
9307        key = pathnameParts.shift();
9308        value = pathnameParts.shift();
9309        if (!value) {
9310          value = "";
9311        }
9312        result[key] = value;
9313      }
9314      return result;
9315    }});
9316    self = hm.core.ui.select.custom.HeadSwitcher;
9317  })();
9318  (function() {
9319    var self;
9320    HM.define("hm.core.ui.tooltip.Tooltip", {extend:"hm.core.ui.Component", config:{tpl:"hm/core/ui/tooltip/Tooltip", contentTpl:null, renderTo:"body", showDelay:0, followPointer:false, posX:null, posY:null, arrowDirection:"up", width:"auto", autoHide:true, backgroundColor:"#FFF"}, __destruct:function() {
9321      var __destruct = arguments.callee;
9322      if (this.destructed) {
9323        return;
9324      }
9325      if (this.config.autoHide) {
9326        var Tooltip = hm.core.ui.tooltip.Tooltip;
9327        if (Tooltip.currentTip === this) {
9328          Tooltip.currentTip = null;
9329        }
9330      }
9331      this.callParent(__destruct, arguments);
9332    }, _init:function() {
9333      var _init = arguments.callee;
9334      this.callParent(_init, arguments);
9335      var $el = this._$el, config = this.config;
9336      this._arrow = $el.find(".hm-tooltip-arrow");
9337      this._arrowShadow = $el.find(".hm-tooltip-shadow-arrow");
9338      this._resetArrowDirection();
9339      $el.css("width", config.width);
9340      this._contentConatiner = $el.find(".hm-tooltip-content");
9341      if (config.backgroundColor !== null) {
9342        $el.css("border-color", config.backgroundColor);
9343        this._contentConatiner.css("background-color", config.backgroundColor);
9344      }
9345    }, _initEvents:function() {
9346      this._showWithDelayEvent = this._showWithDelay.bind(this);
9347      this._updatePositionEvent = this._updatePosition.bind(this);
9348      if (this.config.autoHide) {
9349        this.elOn("mouseenter", null, this._onMouseEnter);
9350        this.elOn("mouseleave", null, this._onMouseLeave);
9351      }
9352      this.elOn("click", null, this._onTooltipClick);
9353    }, setContent:function(newData) {
9354      var $container = this._contentConatiner;
9355      $container.contents().detach();
9356      $container.append(newData);
9357      this.updateArrowPosition();
9358      return newData;
9359    }, updateArrowPosition:function() {
9360      var config = this.config;
9361      if (config.posX !== null && config.posY !== null) {
9362        this._setRealPosition(config.posX, config.posY);
9363      }
9364    }, empty:function() {
9365      this._contentConatiner.empty();
9366    }, renderContent:function(newData, tpl) {
9367      var template = tpl;
9368      if (!template) {
9369        template = this.config.contentTpl;
9370        if (template === null) {
9371          console.error("Не указан шаблон.");
9372        }
9373      }
9374      var $result = this._renderTemplate(template, newData);
9375      this.setContent($result);
9376      return $result;
9377    }, show:function(forceInstant) {
9378      var show = arguments.callee;
9379      var config = this.config;
9380      if (config.autoHide) {
9381        var TooltipClass = hm.core.ui.tooltip.Tooltip, currentTip = TooltipClass.currentTip;
9382        if (currentTip && currentTip !== this) {
9383          currentTip.hide();
9384        }
9385        TooltipClass.currentTip = this;
9386      }
9387      if (config.showDelay > 0 && forceInstant !== true) {
9388        HM.$document().on("mousemove", this._showWithDelayEvent);
9389        return;
9390      }
9391      if (this.isVisible()) {
9392        return true;
9393      }
9394      if (!this.callParent(show)) {
9395        return false;
9396      }
9397      var posX = config.posX, posY = config.posY, followPointer = config.followPointer;
9398      if (!followPointer && (posX !== null && posY !== null)) {
9399        this._setRealPosition(posX, posY);
9400      }
9401      if (followPointer) {
9402        HM.$document().on("mousemove", this._updatePositionEvent);
9403      }
9404    }, hide:function() {
9405      var hide = arguments.callee;
9406      if (this.showTimer) {
9407        clearTimeout(this.showTimer);
9408        delete this.showTimer;
9409      }
9410      if (this.config.autoHide) {
9411        if (hm.core.ui.tooltip.Tooltip.mouseOverTooltip === this) {
9412          delete hm.core.ui.tooltip.Tooltip.mouseOverTooltip;
9413        }
9414        if (hm.core.ui.tooltip.Tooltip.currentTip === this) {
9415          delete hm.core.ui.tooltip.Tooltip.currentTip;
9416        }
9417      }
9418      if (this.config.showDelay > 0) {
9419        HM.$document().off("mousemove", this._showWithDelayEvent);
9420      }
9421      if (this.config.followPointer) {
9422        HM.$document().off("mousemove", this._updatePositionEvent);
9423      }
9424      if (!this.isVisible()) {
9425        return true;
9426      }
9427      if (!this.callParent(hide, arguments)) {
9428        return false;
9429      }
9430      return true;
9431    }, showAt:function(x, y, forceInstant) {
9432      this.config.posX = x;
9433      this.config.posY = y;
9434      this.show(forceInstant);
9435    }, _showWithDelay:function(e) {
9436      var me = this;
9437      clearTimeout(this.showTimer);
9438      if (this.showTimer) {
9439        clearTimeout(this.showTimer);
9440      }
9441      this.showTimer = setTimeout(function() {
9442        if (me.config.followPointer) {
9443          me._setRealPosition(e.pageX, e.pageY);
9444        }
9445        HM.$document().off("mousemove", me._showWithDelayEvent);
9446        delete me.showTimer;
9447        me.show(true);
9448      }, this.config.showDelay);
9449    }, isVisible:function() {
9450      return this.getEl().is(":visible");
9451    }, _setArrowDirection:function(str) {
9452      var $el = this._$el;
9453      $el.removeClass("hm-tooltip-arrow-left hm-tooltip-arrow-right hm-tooltip-arrow-down hm-tooltip-arrow-up");
9454      switch(str) {
9455        case "left":
9456          $el.addClass("hm-tooltip-arrow-left");
9457          break;
9458        case "right":
9459          $el.addClass("hm-tooltip-arrow-right");
9460          break;
9461        case "down":
9462          $el.addClass("hm-tooltip-arrow-down");
9463          break;
9464        case "up":
9465        ;
9466        default:
9467          $el.addClass("hm-tooltip-arrow-up");
9468          break;
9469      }
9470      this._currentarrowDirection = str;
9471    }, _resetArrowDirection:function() {
9472      this._setArrowDirection(this.config.arrowDirection);
9473    }, _setRealPosition:function(x, y) {
9474      var $el = this._$el;
9475      var newPosX = x;
9476      var newPosY = y;
9477      var arrow = this._arrow, arrowShadow = this._arrowShadow, arrowDirection = this.config.arrowDirection;
9478      switch(arrowDirection) {
9479        case "down":
9480          newPosY -= $el.outerHeight() + 8;
9481          newPosX -= $el.width() / 2;
9482          if (this.config.followPointer) {
9483            newPosY -= 8;
9484          }
9485          break;
9486        case "left":
9487          break;
9488        case "right":
9489          break;
9490        case "up":
9491        ;
9492        default:
9493          newPosX -= $el.width() / 2;
9494          newPosY += 8;
9495          if (this.config.followPointer) {
9496            newPosY += 10;
9497          }
9498          break;
9499      }
9500      arrow.attr("style", "");
9501      arrowShadow.attr("style", "");
9502      if (newPosX < 0) {
9503        switch(this.config.arrowDirection) {
9504          case "down":
9505          ;
9506          case "up":
9507            arrow.css("margin-left", newPosX);
9508            arrowShadow.css("margin-left", newPosX - 10);
9509            break;
9510        }
9511        newPosX = 0;
9512      }
9513      $el.css({left:newPosX, top:newPosY});
9514    }, _updatePosition:function(e) {
9515      this._setRealPosition(e.pageX, e.pageY);
9516    }, _beforeHide:function() {
9517      var _beforeHide = arguments.callee;
9518      if (this._notHide) {
9519        return false;
9520      }
9521      return this.callParent(_beforeHide, arguments);
9522    }, _onMouseLeave:function() {
9523      if (!this.hide()) {
9524        return false;
9525      }
9526      if (hm.core.ui.tooltip.Tooltip.mouseOverTooltip === this) {
9527        hm.core.ui.tooltip.Tooltip.mouseOverTooltip = null;
9528      }
9529      return true;
9530    }, _onMouseEnter:function() {
9531      hm.core.ui.tooltip.Tooltip.mouseOverTooltip = this;
9532    }, _onTooltipClick:function(e) {
9533      e.stopPropagation();
9534    }});
9535    self = hm.core.ui.tooltip.Tooltip;
9536  })();
9537  (function() {
9538    var self;
9539    HM.define("hm.core.ui.form.element.select.list.tooltip.DateTooltip", {extend:"hm.core.ui.tooltip.Tooltip", config:{autoHide:false}, _init:function() {
9540      var _init = arguments.callee;
9541      this.callParent(_init, arguments);
9542      this._$el.addClass("hm-pm-tooltip-dateTooltip");
9543      var $elDp = this._$elDatePicker = $(document.createElement("div"));
9544      $elDp.datepicker({onSelect:this._onSelectDate.bind(this)});
9545      this.setContent($elDp);
9546    }, _initEvents:function() {
9547      var _initEvents = arguments.callee;
9548      this.callParent(_initEvents, arguments);
9549    }, setDate:function(date) {
9550      this._$elDatePicker.datepicker("setDate", date);
9551    }, _onSelectDate:function(date) {
9552      this.fireEvent("select", date);
9553    }});
9554    self = hm.core.ui.form.element.select.list.tooltip.DateTooltip;
9555  })();
9556  (function() {
9557    var self;
9558    HM.define("hm.core.ui.tree.DragManager", {extend:"hm.core.ui.Component", config:{tpl:"hm/core/ui/tree/DragManager"}, _init:function() {
9559      var _init = arguments.callee;
9560      this.callParent(_init, arguments);
9561    }, isDragging:function() {
9562      return!!this._draggableNode;
9563    }, getDropHelper:function() {
9564      return this.getEl();
9565    }, getArrowHelper:function() {
9566      if (!this._arrowHelper) {
9567        this._arrowHelper = $('<div class="hm-tree-draggable-arrow-helper"></div>');
9568      }
9569      return this._arrowHelper;
9570    }, setDraggableNode:function(node) {
9571      var dropHelper = this.getDropHelper();
9572      if (node instanceof hm.core.ui.tree.node.Node) {
9573        dropHelper.height(node.getEl().outerHeight() - 2);
9574      } else {
9575        dropHelper.css("height", "");
9576      }
9577      this._draggableNode = node;
9578    }, getDraggableNode:function() {
9579      return this._draggableNode;
9580    }, setDroppableNode:function(node) {
9581      this._droppableNode = node;
9582    }, getDroppableNode:function() {
9583      return this._droppableNode;
9584    }, setDropOptions:function(targetNode, position) {
9585      if (this._dropTarget == targetNode && this._dropPosition == position) {
9586        return;
9587      }
9588      this._dropTarget = targetNode;
9589      this._dropPosition = position;
9590    }, setFinalDropOptions:function(targetNode, position) {
9591      this._finalDropTarget = targetNode;
9592      this._finalDropPosition = position;
9593    }, getDropTarget:function() {
9594      return this._dropTarget;
9595    }, getDropPosition:function() {
9596      return this._dropPosition;
9597    }, getFinalDropTarget:function() {
9598      return this._finalDropTarget;
9599    }, getFinalDropPosition:function() {
9600      return this._finalDropPosition;
9601    }, draggableOverNode:function(node, afterLastNode) {
9602      if (node !== undefined) {
9603        this._draggableOverNode = node;
9604        var prevNode;
9605        if (afterLastNode) {
9606          prevNode = node;
9607        } else {
9608          prevNode = node.getPrevNode(true, false);
9609        }
9610        if (!prevNode) {
9611          this._prevLevels = [];
9612          return this._draggableOverNode;
9613        }
9614        var nodeLevel = node.getLevel(), prevNodeLevel = prevNode.getLevel(), deltaLevel = prevNodeLevel - nodeLevel, prevLevels = [];
9615        if (afterLastNode) {
9616          deltaLevel = 999;
9617        }
9618        if (deltaLevel >= 0) {
9619          prevLevels.push(prevNode);
9620          while (deltaLevel != 0) {
9621            var parent = prevNode.getParent();
9622            if (!parent || parent instanceof hm.core.ui.tree.node.Root) {
9623              break;
9624            }
9625            prevLevels.push(parent);
9626            prevNode = parent;
9627            deltaLevel--;
9628          }
9629        }
9630        prevLevels = prevLevels.reverse();
9631        var tempData = [];
9632        for (var i = 0, ln = prevLevels.length;i < ln;i++) {
9633          tempData.push(prevLevels[i].getTitle());
9634        }
9635        this._prevLevels = prevLevels;
9636      }
9637      return this._draggableOverNode;
9638    }, draggablePrevLevels:function() {
9639      return this._prevLevels;
9640    }, reset:function() {
9641      this._draggableOverNode = null;
9642      this._draggableNode = null;
9643      this._droppableNode = null;
9644      this._prevLevels = null;
9645      this._dropTarget = null;
9646      this._dropPosition = null;
9647      this.getDropHelper().detach();
9648      this.getArrowHelper().detach();
9649    }});
9650    self = hm.core.ui.tree.DragManager;
9651  })();
9652  (function() {
9653    var self;
9654    HM.define("hm.core.ui.tree.Tree", {extend:"hm.core.ui.Component", config:{tpl:"hm/core/ui/tree/Tree", title:null, data:null, persist:true, editable:true}, statics:{counter:0}, _init:function() {
9655      var _init = arguments.callee;
9656      this.callParent(_init, arguments);
9657      this._key = hm.core.ui.tree.node.Node.counter++;
9658      this._nodes = [];
9659      this._factoryCounter = 0;
9660      this._initTree();
9661    }, _initTree:function() {
9662      var treeData = this.config.data;
9663      var root = this._root = HM.create("hm.core.ui.tree.node.Root", {renderTo:this.getRootContainer(), childrenData:treeData, tree:this});
9664      this.needToDestroy(root);
9665      root.initChildren();
9666      root.expand(true);
9667      this.getPlainTree(true);
9668      this.getEl().droppable({tolerance:"pointer", out:_.bind(this._onTreeOut, this)});
9669      this._initCachedData();
9670    }, _initCachedData:function() {
9671      var nodes = this.getPlainTree(true), prevKey;
9672      for (var i = 0, ln = nodes.length;i < ln;i++) {
9673        var node = nodes[i], nodeKey = node.getKey();
9674        node.setCachedData({level:node.getLevel(), prevKey:prevKey});
9675        prevKey = nodeKey;
9676      }
9677    }, _onTreeOut:function(event, ui) {
9678    }, _beforeContextShow:function(e, contextMenu) {
9679      var node = contextMenu.getContextTarget();
9680      node.activate(true);
9681    }, _activate:function(event, node) {
9682      if (node.isActive()) {
9683        var activeNode = this.getActiveNode();
9684        if (activeNode && activeNode !== node) {
9685          activeNode.activate(false);
9686        }
9687        this.setActiveNode(node);
9688        this.fireEvent("nodeActive", node);
9689      }
9690    }, _expand:function(event, node) {
9691      this.savePersistData();
9692    }, _drop:function(event) {
9693      this.savePersistData();
9694    }, savePersistData:function() {
9695      if (this.config.persist) {
9696        var children = this.getPlainTree(true);
9697        var data = "";
9698        for (var i = 0, ln = children.length;i < ln;i++) {
9699          data += children[i].isExpanded() ? "1" : "0";
9700        }
9701        hm.core.Cookie.set("hm-tree-expand-" + this.getKey(), data, {expires:0});
9702      }
9703    }, getPersistData:function() {
9704      if (this._persistData === undefined) {
9705        var expandData = hm.core.Cookie.get("hm-tree-expand-" + this.getKey());
9706        if (expandData) {
9707          expandData = expandData.split("");
9708          for (var i = 0, ln = expandData.length;i < ln;i++) {
9709            expandData[i] = expandData[i] != "0";
9710          }
9711        }
9712        this._persistData = {expand:expandData};
9713      }
9714      return this._persistData;
9715    }, getKey:function() {
9716      return this._key;
9717    }, getRootContainer:function() {
9718      return this.getEl();
9719    }, nodeFactory:function(nodeData) {
9720      var newNode = this._nodeFactory(nodeData);
9721      var persistData = this.getPersistData();
9722      if (persistData.expand !== undefined) {
9723        newNode.expand(persistData.expand[this._factoryCounter]);
9724      } else {
9725        newNode.expand(newNode.config.expand);
9726      }
9727      this._factoryCounter++;
9728      newNode.initChildren();
9729      newNode.on("expand", this._expand, this);
9730      newNode.on("activate", this._activate, this);
9731      newNode.on("drop", this._drop, this);
9732      this.needToDestroy(newNode);
9733      this._nodes.push(newNode);
9734      return newNode;
9735    }, _nodeFactory:function(nodeData) {
9736      return HM.create(this._getFactoryNodeName(nodeData), this._getFactoryNodeConfig(nodeData));
9737    }, _getFactoryNodeName:function(nodeData) {
9738      return "hm.core.ui.tree.node.Node";
9739    }, _getFactoryNodeConfig:function(nodeData) {
9740      var isEditable = this.isEditable();
9741      var nodeConfig = {title:nodeData.title, childrenData:nodeData.children, tree:this, folder:nodeData.isFolder, iconClass:nodeData.iconClass, draggable:isEditable, droppable:isEditable, editable:isEditable};
9742      if (nodeData.expand) {
9743        nodeConfig.expand = true;
9744      }
9745      if (nodeData.data) {
9746        nodeConfig.data = nodeData.data;
9747      }
9748      return nodeConfig;
9749    }, getRoot:function() {
9750      return this._root;
9751    }, isEditable:function() {
9752      return this.config.editable;
9753    }, appendNodeTo:function(node, targetNode) {
9754      if (!targetNode) {
9755        targetNode = this.getRoot();
9756      }
9757      this.removeNodeFrom(node);
9758      node.setParent(targetNode);
9759      var targetChildren = targetNode.getChildren();
9760      targetChildren.push(node);
9761      targetNode.getChildrenContainer().append(node.getEl());
9762      targetNode.updateView();
9763    }, prependNodeTo:function(node, targetNode) {
9764      if (!targetNode) {
9765        targetNode = this.getRoot();
9766      }
9767      this.removeNodeFrom(node);
9768      node.setParent(targetNode);
9769      var targetChildren = targetNode.getChildren();
9770      targetChildren.unshift(node);
9771      targetNode.getChildrenContainer().prepend(node.getEl());
9772      targetNode.updateView();
9773    }, insertNodeBefore:function(node, targetNode) {
9774      this.removeNodeFrom(node);
9775      var targetParent = targetNode.getParent();
9776      node.setParent(targetParent);
9777      var targetParentChildren = targetParent.getChildren(), nodeIndex = targetNode.getIndex();
9778      if (nodeIndex === -1) {
9779        throw new Error("Ошибка при получении nodeIndex.");
9780      }
9781      if (nodeIndex === 0) {
9782        targetParentChildren.unshift(node);
9783      } else {
9784        targetParentChildren.splice(nodeIndex, 0, node);
9785      }
9786      targetNode.getEl().before(node.getEl());
9787    }, insertNodeAfter:function(node, targetNode) {
9788      this.removeNodeFrom(node);
9789      var targetParent = targetNode.getParent();
9790      node.setParent(targetParent);
9791      var targetParentChildren = targetParent.getChildren(), nodeIndex = targetNode.getIndex();
9792      if (nodeIndex === -1) {
9793        throw new Error("Ошибка при получении nodeIndex.");
9794      }
9795      if (nodeIndex === targetParentChildren.length - 1) {
9796        targetParentChildren.push(node);
9797      } else {
9798        targetParentChildren.splice(nodeIndex + 1, 0, node);
9799      }
9800      targetNode.getEl().after(node.getEl());
9801    }, removeNodeFrom:function(node, targetNode) {
9802      if (!targetNode) {
9803        targetNode = node.getParent();
9804        if (!targetNode) {
9805          return;
9806        }
9807      }
9808      var targetChildren = targetNode.getChildren(), nodeIndex = _.indexOf(targetChildren, node);
9809      if (nodeIndex != -1) {
9810        targetChildren.splice(nodeIndex, 1);
9811        node.getEl().detach();
9812        node.setParent(null);
9813      }
9814      targetNode.updateView();
9815    }, setActiveNode:function(node) {
9816      this._activeNode = node;
9817    }, getActiveNode:function() {
9818      return this._activeNode;
9819    }, getDragManager:function() {
9820      if (!this._dragManager) {
9821        this._dragManager = HM.create("hm.core.ui.tree.DragManager");
9822        this.needToDestroy(this._dragManager);
9823      }
9824      return this._dragManager;
9825    }, disableDrag:function(flag) {
9826      var nodes = this.getNodes();
9827      for (var i = 0, ln = nodes.length;i < ln;i++) {
9828        nodes[i].disableDrag(flag);
9829      }
9830    }, getAllChildren:function(startingNode, onlyVisible) {
9831      var result = [];
9832      if (!_.isBoolean(onlyVisible)) {
9833        onlyVisible = true;
9834      }
9835      if (!(startingNode instanceof hm.core.ui.tree.node.Node)) {
9836        startingNode = this.getRoot();
9837      }
9838      var nodeChildren = startingNode.getChildren();
9839      for (var i = 0, ln = nodeChildren.length;i < ln;i++) {
9840        result.push(nodeChildren[i]);
9841        if (nodeChildren[i].hasChildren()) {
9842          if (onlyVisible) {
9843            if (nodeChildren[i].isExpanded()) {
9844              result = result.concat(this.getAllChildren(nodeChildren[i], onlyVisible));
9845            }
9846          } else {
9847            result = result.concat(this.getAllChildren(nodeChildren[i], onlyVisible));
9848          }
9849        }
9850      }
9851      return result;
9852    }, getNodes:function() {
9853      return this._nodes;
9854    }, getNode:function(key) {
9855      if (this._nodesByKey === undefined) {
9856        this._nodesByKey = {};
9857      }
9858      if (this._nodesByKey[key] !== undefined) {
9859        return this._nodesByKey[key];
9860      }
9861      var nodes = this.getNodes();
9862      for (var i = 0, ln = nodes.length;i < ln;i++) {
9863        var node = nodes[i];
9864        this._nodesByKey[node.getKey()] = node;
9865      }
9866      return this._nodesByKey[key];
9867    }, getPlainTree:function(update) {
9868      if (this._plainTreeNodes === undefined || update) {
9869        this._plainTreeNodes = this.getAllChildren(this.getRoot(), false);
9870      }
9871      return this._plainTreeNodes;
9872    }, checkTreeChanges:function(instant) {
9873      var nodes = this.getPlainTree(true), nodeClass = hm.core.ui.tree.node.Node, prevKey;
9874      for (var i = 0, ln = nodes.length;i < ln;i++) {
9875        var node = nodes[i], nodeLevel = node.getLevel(), nodeKey = node.getKey(), cachedData = node.getCachedData(), currentState = node.getState();
9876        if (currentState != nodeClass.STATE_CREATED && currentState != nodeClass.STATE_DELET
9876ED) {
9877          if (cachedData.level != nodeLevel) {
9878            node.setState(nodeClass.STATE_CHANGED);
9879          }
9880          if (cachedData.prevKey != prevKey) {
9881            node.setState(nodeClass.STATE_CHANGED);
9882          }
9883        }
9884        node.setCachedData({level:nodeLevel, prevKey:prevKey});
9885        prevKey = nodeKey;
9886      }
9887      clearTimeout(this._saveTimer);
9888      this._saveTimer = setTimeout(_.bind(this._updateTreeNodes, this), instant ? 0 : 1500);
9889    }, _updateTreeNodes:function() {
9890      var nodes = this.getNodes();
9891      for (var i = 0, ln = nodes.length;i < ln;i++) {
9892        var node = nodes[i];
9893        node.setState(hm.core.ui.tree.node.Node.STATE_DEFAULT);
9894      }
9895    }});
9896    self = hm.core.ui.tree.Tree;
9897  })();
9898  (function() {
9899    var self;
9900    HM.define("hm.core.ui.tree.node.Node", {extend:"hm.core.ui.Component", config:{tpl:"hm/core/ui/tree/node/Node", title:"Unnamed", childrenData:[], parent:null, tree:null, folder:false, expand:false, iconClass:null, contextMenu:null, draggable:false, droppable:false, editable:false, data:{}}, statics:{counter:0, STATE_DEFAULT:"default", STATE_CHANGED:"changed", STATE_CREATED:"created", STATE_DELETED:"deleted"}, _init:function() {
9901      var _init = arguments.callee;
9902      this.callParent(_init, arguments);
9903      var tree = this.getTree();
9904      if (!tree) {
9905        throw new Error("Ошибка инициализации, необходимо указать tree.");
9906      }
9907      this._key = hm.core.ui.tree.node.Node.counter++;
9908      this._cachedData = {};
9909      this._itemData = $.extend({}, this.config.data);
9910      this._children = [];
9911      this._active = false;
9912      this._childrenInited = false;
9913      this._childrenRendered = false;
9914      this._expanded = this.config.expand;
9915      if (this.isFolder()) {
9916        this.getItemContainer().addClass("hm-tree-node-folder");
9917      }
9918      this._initContextMenu();
9919      this._initEditableTitle();
9920      this._initDnD();
9921      this.updateView();
9922    }, initChildren:function() {
9923      if (this._childrenInited) {
9924        return;
9925      }
9926      var childrenData = this.config.childrenData;
9927      if (!childrenData) {
9928        this._childrenInited = true;
9929        return;
9930      }
9931      var tree = this.getTree();
9932      for (var i = 0, ln = childrenData.length;i < ln;i++) {
9933        var newNode = tree.nodeFactory(childrenData[i]);
9934        this._children.push(newNode);
9935        newNode.setParent(this);
9936      }
9937      this._childrenInited = true;
9938      if (this.isExpanded()) {
9939        this.renderChildren();
9940      }
9941    }, renderChildren:function() {
9942      if (this._childrenRendered || !this._childrenInited) {
9943        return;
9944      }
9945      var children = this.getChildren(), ln = children.length;
9946      for (var i = 0;i < ln;i++) {
9947        this.appendNode(children[0]);
9948      }
9949      this._childrenRendered = true;
9950    }, hideChildren:function() {
9951      var children = this.getChildren(), ln = children.length;
9952      for (var i = 0;i < ln;i++) {
9953        children[i].hide();
9954      }
9955    }, showChildren:function() {
9956      var children = this.getChildren(), ln = children.length;
9957      for (var i = 0;i < ln;i++) {
9958        children[i].show();
9959      }
9960    }
9960, _initContextMenu:function() {
9961      var contextMenu = this.config.contextMenu;
9962      if (!contextMenu) {
9963        return;
9964      }
9965      contextMenu.bindTo(this.getItemContainer(), this);
9966    }, _initEditableTitle:function() {
9967      var title = this.getItemContainer().find(".hm-tree-node-title");
9968      var originalText;
9969      var me = this;
9970      var tree = this.getTree();
9971      title.on("focus", function() {
9972        originalText = title.text();
9973        tree.disableDrag(true);
9974        var range = document.createRange();
9975        range.selectNodeContents(title.get(0));
9976        var sel = window.getSelection();
9977        sel.removeAllRanges();
9978        sel.addRange(range);
9979      });
9980      title.on("blur", function() {
9981        title.attr("contenteditable", false);
9982        var text = title.text();
9983        text = $.trim(text);
9984        text = text.replace(/\s{1,}/g, " ");
9985        me.setTitle(text);
9986        tree.disableDrag(false);
9987        me._editing = false;
9988      });
9989      title.on("keypress", function(event) {
9990        if (event.keyCode == 13) {
9991          event.preventDefault();
9992          title.blur();
9993        }
9994      });
9995      title.on("keydown", function(event) {
9996        if (event.keyCode == 27) {
9997          event.preventDefault();
9998          me.setTitle(originalText);
9999          title.blur();
10000        }
10001      });
10002    }, _initDnD:function() {
10003      this._initDraggable();
10004      this._initDroppable();
10005    }, _initDraggable:function() {
10006      if (!this.config.draggable) {
10007        return;
10008      }
10009      this.getEl().draggable({helper:"clone", opacity:0.6, scroll:true, start:_.bind(this._onDraggableStart, this), stop:_.bind(this._onDraggableStop, this), drag:_.bind(this._onDraggableDrag, this), appendTo:this.getTree().getEl(), zIndex:1});
10010    }, _initDroppable:function() {
10011      if (!this.config.droppable) {
10012        return;
10013      }
10014      this.getItemContainer().droppable({tolerance:"pointer", drop:_.bind(this._onDroppableDrop, this), over:_.bind(this._onDroppableOver, this), out:_.bind(this._onDroppableOut, this)});
10015    }, _initEvents:function() {
10016      this.getItemContainer().on("click", _.bind(this._onClick, this));
10017    }, _beforeClick:function(e) {
10018      return true;
10019    }, _onClick:function(e) {
10020      if (!this._beforeClick(e)) {
10021        return;
10022      }
10023      if (this.isDragging() || this.isEditing()) {
10024        return;
10025      }
10026      if (this.hasChildren()) {
10027        this.userExpand();
10028      }
10029      this.activate(true);
10030    }, _onDraggableStart:function(event, ui) {
10031      this._dragging = true;
10032      var dragManager = this.getTree().getDragManager(), tree = this.getTree(), parent = this.getParent();
10033      clearTimeout(tree._saveTimer);
10034      dragManager.reset();
10035      tree.getRoot().getChildrenContainer().append(dragManager.getDropHelper());
10036      dragManager.setDraggableNode(this);
10037      if (!this.getNextNode()) {
10038        var prevNode = this.getPrevNode();
10039        dragManager.draggableOverNode(this);
10040        dragManager.setDropOptions(prevNode, "after");
10041        this._dndPrevLevel = undefined;
10042        this._updateDropHelper(ui);
10043      }
10044      tree.removeNodeFrom(this);
10045      parent.updateView();
10046    }, _onDraggableStop:function(event, ui) {
10047      var dragManager = this.getTree().getDragManager();
10048      dragManager.getDropHelper().detach();
10049      var dropTarget = dragManager.getFinalDropTarget(), dropPosition = dragManager.getFinalDropPosition(), draggableNode = this;
10050      if (dropTarget) {
10051        switch(dropPosition) {
10052          case "before":
10053            dropTarget.addNodeBefore(draggableNode);
10054            break;
10055          case "after":
10056            dropTarget.addNodeAfter(draggableNode);
10057            break;
10058          case "inside":
10059            dropTarget.prependNode(draggableNode);
10060            if (!dropTarget.isExpanded()) {
10061              dropTarget.getChildrenContainer().hide();
10062            }
10063            break;
10064        }
10065      } else {
10066        this.getTree().appendNodeTo(draggableNode);
10067      }
10068      dragManager.reset();
10069      this._dragging = false;
10070      this.fireEvent("drop");
10071    }, _onDraggableDrag:function(event, ui) {
10072      this._updateDropHelper(ui);
10073    }
10073, _onDroppableOver:function(event, ui) {
10074      var dragManager = this.getTree().getDragManager();
10075      dragManager.draggableOverNode(this);
10076      this.getOffset(true);
10077      this._dndPrevLevel = undefined;
10078      dragManager.setDropOptions(this, "before");
10079      this._updateDropHelper(ui);
10080    }, _updateDropHelper:function(ui) {
10081      var dragManager = this.getTree().getDragManager(), draggableOverNode = dragManager.draggableOverNode(), prevNodeLevels = dragManager.draggablePrevLevels();
10082      if (draggableOverNode) {
10083        var offsetDelta = ui.offset.left - draggableOverNode.getOffset().left;
10084        var step = 17;
10085        var level = Math.floor(offsetDelta / step), levelChanged = level !== this._dndPrevLevel || level >= 0 && level > prevNodeLevels.length;
10086        if (levelChanged) {
10087          if (level >= 0 && prevNodeLevels.length != 0) {
10088            if (level < prevNodeLevels.length) {
10089              dragManager.setDropOptions(prevNodeLevels[level], "after");
10090            } else {
10091              var lastLevelNode = prevNodeLevels[prevNodeLevels.length - 1], childrenContainer = lastLevelNode.getChildrenContainer();
10092              if (lastLevelNode.isFolder()) {
10093                if (!lastLevelNode.isExpanded()) {
10094                  lastLevelNode.hideChildren();
10095                }
10096                dragManager.setDropOptions(lastLevelNode, "inside");
10097              } else {
10098                dragManager.setDropOptions(lastLevelNode, "after");
10099              }
10100            }
10101          }
10102        }
10103        this._dndPrevLevel = level;
10104      }
10105      if (this._canDrop()) {
10106        this._updateDropHelperView();
10107        dragManager.setFinalDropOptions(dragManager.getDropTarget(), dragManager.getDropPosition());
10108      }
10109    }, _canDrop:function() {
10110      return true;
10111    }, _updateDropHelperView:function() {
10112      var dragManager = this.getTree().getDragManager(), dropHelper = dragManager.getDropHelper();
10113      var dropTarget = dragManager.getDropTarget(), dropPosition = dragManager.getDropPosition(), draggableNode = dragManager.getDraggableNode(), parentFolder;
10114      switch(dropPosition) {
10115        case "before":
10116          parentFolder = dropTarget.getParent();
10117          dropTarget.getEl().before(dropHelper);
10118          break;
10119        case "after":
10120          parentFolder = dropTarget.getParent();
10121          dropTarget.getEl().after(dropHelper);
10122          break;
10123        case "inside":
10124          parentFolder = dropTarget;
10125          dropTarget.getChildrenContainer().prepend(dropHelper);
10126          break;
10127      }
10128      var arrowHelper = dragManager.getArrowHelper();
10129      if (parentFolder && !parentFolder.isRoot()) {
10130        parentFolder.getIconContainer().append(arrowHelper);
10131      } else {
10132        arrowHelper.detach();
10133      }
10134    }, _onDroppableOut:function(event, ui) {
10135      var dragManager = this.getTree().getDragManager(), draggableOverNode = dragManager.draggableOverNode();
10136      var tree = this.getTree(), plainTree = tree.getPlainTree(true), lastNode = plainTree[plainTree.length - 1];
10137      if (lastNode === draggableOverNode) {
10138        dragManager.draggableOverNode(this, true);
10139        this.getOffset(true);
10140        this._dndPrevLevel = undefined;
10141        dragManager.setDropOptions(this, "after");
10142        this._updateDropHelper(ui);
10143      }
10144    }, _onDroppableDrop:function(event, ui) {
10145    }, setState:function(state) {
10146      this._state = state;
10147    }, getState:function() {
10148      return this._state;
10149    }, isRoot:function() {
10150      return false;
10151    }, _getLevel:function() {
10152      var parent = this.getParent();
10153      if (parent) {
10154        return parent._getLevel() + 1;
10155      }
10156      return 0;
10157    }, getLevel:function() {
10158      return this._getLevel() - 1;
10159    }, getKey:function() {
10160      return this._key;
10161    }, setCachedData:function(obj) {
10162      this._cachedData = obj;
10163    }, getCachedData:function() {
10164      return this._cachedData;
10165    }, getItemData:function() {
10166      return this._itemData;
10167    }, setItemData:function(data) {
10168      this._itemData = $.extend(this.getItemData(), data);
10169    }, getChildrenContainer:function() {
10170      if (!this._childrenContainer) {
10171        this._childrenContainer = this.getEl().children(".hm-tree-node-children");
10172      }
10173      return this._childrenContainer;
10174    }, getItemContainer:function() {
10175      if (!this._itemContainer) {
10176        this._itemContainer = this.getEl().children(".hm-tree-node-item");
10177      }
10178      return this._itemContainer;
10179    }, getIconContainer:function() {
10180      if (!this._iconContainer) {
10181        this._iconContainer = this.getItemContainer().find(".hm-tree-node-icon");
10182      }
10183      return this._iconContainer;
10184    }, getOffset:function(update) {
10185      if (this._offset === undefined || update === true) {
10186        this._offset = this.getEl().offset();
10187      }
10188      return this._offset;
10189    }, appendNode:function(node) {
10190      var tree = this.getTree();
10191      tree.appendNodeTo(node, this);
10192    }, prependNode:function(node) {
10193      var tree = this.getTree();
10194      tree.prependNodeTo(node, this);
10195    }, addNodeBefore:function(node) {
10196      var tree = this.getTree();
10197      tree.insertNodeBefore(node, this);
10198    }, addNodeAfter:function(node) {
10199      var tree = this.getTree();
10200      tree.insertNodeAfter(node, this);
10201    }, remove:function() {
10202      var tree = this.getTree();
10203      tree.removeNodeFrom(this);
10204      return this;
10205    }, destroy:function() {
10206      var destroy = arguments.callee;
10207      this.remove();
10208      this.callParent(destroy, arguments);
10209    }, removeChildNode:function(node) {
10210      var tree = this.getTree();
10211      tree.removeNodeFrom(node, this);
10212    }, expand:function(value) {
10213      if (_.isBoolean(value)) {
10214        this._expanded = value;
10215      } else {
10216        this._expanded = !this._expanded;
10217      }
10218      this.getChildrenContainer().toggle(this._expanded);
10219      this.getItemContainer().toggleClass("hm-tree-node-expanded", this._expanded);
10220      if (this.isExpanded()) {
10221        this.renderChildren();
10222        this.showChildren();
10223      } else {
10224        var children = this.getChildren();
10225        for (var i = 0, ln = children.length;i < ln;i++) {
10226          children[i].expand(false);
10227        }
10228      }
10229    }, userExpand:function(value) {
10230      this.expand(value);
10231      this.fireEvent("expand", this);
10232    }, activate:function(value) {
10233      if (_.isBoolean(value)) {
10234        if (this.isActive() == value) {
10235          return;
10236        }
10237        this._active = value;
10238      } else {
10239        this._active = !this._active;
10240      }
10241      var itemContainer = this.getItemContainer();
10242      itemContainer.toggleClass("hm-tree-node-active", value);
10243      if (this.isActive()) {
10244        this.expandParents();
10245      }
10246      this.fireEvent("activate", this);
10247    }, isActive:function() {
10248      return this._active;
10249    }, isExpanded:function() {
10250      return this._expanded;
10251    }, hasChildren:function() {
10252      if (this._childrenInited) {
10253        return this.getChildren().length != 0;
10254      } else {
10255        return this.config.childrenData !== undefined && this.config.childrenData.length != 0;
10256      }
10257    }, isDragging:function() {
10258      return this._dragging;
10259    }, isEditing:function() {
10260      return this._editing;
10261    }, disableDrag:function(flag) {
10262      if (this.config.draggable) {
10263        this.getEl().draggable("option", "disabled", flag);
10264      }
10265    }, isFolder:function() {
10266      return this.config.folder;
10267    }, getTitle:function() {
10268      return this.config.title;
10269    }, setTitle:function(title) {
10270      this.config.title = title;
10271      var $title = this.getItemContainer().find(".hm-tree-node-title");
10272      $title.text(title);
10273    }, editTitle:function() {
10274      this._editing = true;
10275      var title = this.getItemContainer().find(".hm-tree-node-title");
10276      title.attr("contenteditable", true);
10277      title.focus();
10278    }, getIconClass:function() {
10279      return this.config.iconClass;
10280    }, getParent:function() {
10281      if (this._parentNode === undefined) {
10282        this._parentNode = this.config.parent;
10283      }
10284      return this._parentNode;
10285    }, setParent:function(node) {
10286      this._parentNode = node;
10287    }, getTree:function() {
10288      return this.config.tree;
10289    }, getChildren:function() {
10290      return this._children;
10291    }, getChild:function(index) {
10292      var children = this.getChildren();
10293      if (!children[index]) {
10294        return false;
10295      }
10296      return children[index];
10297    }, getIndex:function() {
10298      var parentChildren = this.getParent().getChildren();
10299      return _.indexOf(parentChildren, this);
10300    }, getNeighbour:function(offset, onlyVisible, sameLevel, filter) {
10301      if (!offset) {
10302        return false;
10303      }
10304      if (!_.isBoolean(onlyVisible)) {
10305        onlyVisible = true;
10306      }
10307      if (!_.isBoolean(sameLevel)) {
10308        sameLevel = false;
10309      }
10310      if (sameLevel) {
10311        var parent = this.getParent(), myIndex = this.getIndex();
10312        var nextNode = parent.getChild(myIndex + offset);
10313        if (nextNode) {
10314          return nextNode;
10315        }
10316      } else {
10317        var allChildren = this.getTree().getAllChildren(null, onlyVisible), plainIndex = _.indexOf(allChildren, this);
10318        if (_.isFunction(filter)) {
10319          var slice, found;
10320          if (offset > 0) {
10321            slice = allChildren.slice(plainIndex + 1);
10322            found = _.find(slice, filter);
10323          } else {
10324            slice = allChildren.slice(0, plainIndex);
10325            slice = slice.reverse();
10326            found = _.find(slice, filter);
10327          }
10328          return found !== undefined ? found : false;
10329        } else {
10330          if (plainIndex !== -1 && allChildren[plainIndex + offset]) {
10331            return allChildren[plainIndex + offset];
10332          }
10333        }
10334      }
10335      return false;
10336    }, getNextNode:function(onlyVisible, sameLevel, filter) {
10337      return this.getNeighbour(1, onlyVisible, sameLevel, filter);
10338    }, getPrevNode:function(onlyVisible, sameLevel, filter) {
10339      return this.getNeighbour(-1, onlyVisible, sameLevel, filter);
10340    }, updateView:function() {
10341      var itemContainer = this.getItemContainer();
10342      itemContainer.toggleClass("hm-tree-node-hasChildren", this.hasChildren());
10343    }, expandParents:function() {
10344      var parent = this.getParent();
10345      if (parent) {
10346        parent.expand(true);
10347        parent.expandParents();
10348      }
10349    }});
10350    self = hm.core.ui.tree.node.Node;
10351  })();
10352  (function() {
10353    var self;
10354    HM.define("hm.core.ui.tree.node.Root", {extend:"hm.core.ui.tree.node.Node", config:{tpl:"hm/core/ui/tree/node/Root", title:"root", expand:true, draggable:false, droppable:false, editable:false}, _initChildren:function() {
10355    }, isRoot:function() {
10356      return true;
10357    }, getChildrenContainer:function() {
10358      return this.getEl();
10359    }});
10360    self = hm.core.ui.tree.node.Root;
10361  })();
10362  (function() {
10363    var self;
10364    HM.define("hm.core.ui.window.Window", {extend:"hm.core.ui.Component", config:{title:"", resizable:false, closeOnEscape:true, text:"", contentUrl:false, renderTo:"body", width:"50%", maxHeight:400}, __construct:function() {
10365      var __construct = arguments.callee;
10366      this.callParent(__construct, arguments);
10367      var config = this.config;
10368      this.getEl().dialog({resizable:config.resizable, title:config.title, closeOnEscape:config.closeOnEscape, autoOpen:true, width:config.width});
10369    }, _init:function() {
10370      var _init = arguments.callee;
10371      this.callParent(_init, arguments);
10372      var config = this.config, $el = this._$el;
10373      $el.addClass("hm-window");
10374      $el.css({maxHeight:config.maxHeight});
10375      var me = this;
10376      if (config.contentUrl) {
10377        $el.html('<div class="hm-window-ajax-loader"></div>');
10378        $.ajax({url:config.contentUrl, async:true}).done(function(data) {
10379          $el.html(data);
10380        });
10381      } else {
10382        $el.text(config.text);
10383      }
10384    }, show:function() {
10385    }});
10386    self = hm.core.ui.window.Window;
10387  })();
10388  (function() {
10389    var self;
10390    HM.define("hm.core.ui.window.card.Card", {extend:"hm.core.ui.Component", config:{tplByClass:true, url:null, title:HM._("Карточка")}, statics:{dialog:null}, _getDialog:function() {
10391      if (hm.core.ui.window.card.Card.dialog === null) {
10392        var dialog = $("<div></div>");
10393        dialog.dialog({autoOpen:false, bgiframe:true, width:500, modal:false, resizable:true, dialogClass:"pcard"});
10394        hm.core.ui.window.card.Card.dialog = dialog;
10395      }
10396      return hm.core.ui.window.card.Card.dialog;
10397    }, show:function() {
10398      var dialog = this._getDialog();
10399      var $el = this.getEl();
10400      if (!this._loadingInited) {
10401        this._loadingInited = true;
10402        $el.load(this.config.url, _.bind(this._onLoadingComplete, this));
10403      }
10404      dialog.contents().detach();
10405      dialog.append($el);
10406      this.centerDialog();
10407      dialog.dialog("option", "title", this.config.title);
10408      dialog.dialog("open");
10409    }, centerDialog:function() {
10410      this._getDialog().dialog("widget").position({my:"center", at:"center", of:window});
10411    }, _onLoadingComplete:function() {
10412      this.centerDialog();
10413    }});
10414    self = hm.core.ui.window.card.Card;
10415  })();
10416  (function() {
10417    var self;
10418    HM.define("hm.core.ui.window.dialog.Dialog", {extend:"hm.core.ui.Component", config:{printable:false, renderTo:"body", width:690, autoShow:true, resizable:false, draggable:true, className:"", closeOnEscape:true, title:"", url:"", loadingTpl
10418:"hm/core/ui/window/dialog/Dialog.loading", destroyOnClose:false}, _init:function() {
10419      var _init = arguments.callee;
10420      this.callParent(_init, arguments);
10421      var config = this.config, url = config.url;
10422      if (url !== "") {
10423        this.loadUrl(url);
10424      }
10425    }, _renderTo:function() {
10426      var _renderTo = arguments.callee;
10427      this.callParent(_renderTo, arguments);
10428      var config = this.config;
10429      this._$el.dialog({modal:true, title:config.title, closeOnEscape:config.closeOnEscape, dialogClass:config.className, resizable:config.resizable, draggable:config.draggable, width:config.width, close:this._onClose.bind(this), autoOpen:false});
10430      if (config.autoShow) {
10431        this.show();
10432      }
10433    }, show:function() {
10434      if (this.config.printable) {
10435        $("#container").addClass("hm-hidden-if-print");
10436      }
10437      this._$el.dialog("open");
10438    }, hide:function() {
10439      this._$el.dialog("close");
10440    }, toCenter:function() {
10441      this._$el.dialog("option", "position", {my:"center", at:"center", of:window});
10442    }, loadUrl:function(url) {
10443      this.showLoading();
10444      jQuery.ajax({url:url, async:true}).done(_.bind(this._onLoaded, this));
10445    }, showLoading:function() {
10446      var config = this.config, $el = this._$el, $loading = this._renderTemplate(config.loadingTpl, this);
10447      $el.html("");
10448      $el.append($loading);
10449    }, setTitle:function(title) {
10450      this.getEl().dialog("option", "title", title);
10451    }, _onLoaded:function(data) {
10452      var $el = this._$el;
10453      $el.html(data);
10454      this.toCenter();
10455      this.fireEvent("loaded", this);
10456    }, _onClose:function() {
10457      var config = this.config;
10458      if (config.printable) {
10459        $("#container").removeClass("hm-hidden-if-print");
10460      }
10461      this.fireEvent("closed", this);
10462      if (config.destroyOnClose) {
10463        this.destroy();
10464      }
10465    }});
10466    self = hm.core.ui.window.dialog.Dialog;
10467  })();
10468  (function() {
10469    var self;
10470    HM.define("hm.core.ui.container.Container", {xtype:"container", extend:"hm.core.ui.Component"});
10471    self = hm.core.ui.container.Container;
10472  })();
10473  (function() {
10474    var self;
10475    HM.define("hm.core.ui.errorbox.ErrorBox", {config:{}, statics:{TYPE_SUCCESS:"success", TYPE_CHECK:"check", TYPE_HIGHLIGHT:"highlight", TYPE_INFO:"info", TYPE_ERROR:"error", TYPE_ALERT:"alert", getErrorBox:function() {
10476      var $errorBox = $("#error-box");
10477      this.getErrorBox = function() {
10478        return $errorBox;
10479      };
10480      return $errorBox;
10481    }, showMessage:function(options) {
10482      var $message = $("<div></div>"), message = options.message || "???", type = options.type || this.TYPE_SUCCESS;
10483      $message.text(message);
10484      $message.errorbox({level:type});
10485      this.getErrorBox().append($message);
10486    }, clear:function() {
10487      jQuery.ui.errorbox.clear();
10488    }}});
10489    self = hm.core.ui.errorbox.ErrorBox;
10490  })();
10491  (function() {
10492    var self;
10493    HM.define("hm.core.ui.imageMapEditor.map.AbstractMap", {extend:"hm.core.ObservableClass", config:{editor:null, data:null, extData:null, readOnly:false}, dataAttributes:[], __construct:function() {
10494      this._tasks = [];
10495      this._drawingByUser = true;
10496      this._states = {mouseOver:false, selected:false};
10497      var editor = this.config.editor;
10498      this._editor = editor;
10499      this._paper = editor.getPaper();
10500      this._init();
10501      this._initEvents();
10502    }, _init:function() {
10503      this._initElement();
10504      this._applyCommonAttributes();
10505      this._checkState();
10506      var config = this.config;
10507      if (config.extData) {
10508        this.setExtData(config.extData);
10509      }
10510      if (config.data) {
10511        this.setData(config.data);
10512        this._drawingByUser = false;
10513      } else {
10514        this._firstClickResult = this._editor.oneClick(this._onFirstClick.bind(this));
10515      }
10516    }, _initElement:function() {
10517    }, _initEvents:function() {
10518      var el = this._element;
10519      el.mouseover(this._onMouseOver.bind(this));
10520      el.mouseout(this._onMouseOut.bind(this));
10521      el.click(this._onMouseClick.bind(this));
10522    }, __destruct:function __destruct() {
10523      if (this._element) {
10524        this._element.remove();
10525      }
10526      if (this._firstClickResult) {
10527        this._firstClickResult.abort();
10528      }
10529      var tasks = this._tasks;
10530      for (var i = tasks.length - 1;i >= 0;i--) {
10531        tasks[i].abort();
10532        tasks[i].destroy();
10533      }
10534      this.callParent(__destruct, arguments);
10535    }, _applyCommonAttributes:function() {
10536      this._element.attr({"stroke-width":2, "opacity":0.7});
10537      this._checkState();
10538    }, _checkState:function() {
10539      this._element.attr({"fill":this.getFillColor(), "opacity":this.getOpacity(), "stroke":this.getStrokeColor()});
10540    }, _finalDraw:function() {
10541      this._drawingByUser = false;
10542      this.select();
10543      this.fireEvent("drawEnd", this);
10544    }, _abortTaskIfMapDestructed:function(task) {
10545      this._tasks.push(task);
10546      task.on("destroy", this._onTaskDestroy, this);
10547    }, getType:function() {
10548      return this.type;
10549    }, getData:function() {
10550      var dataAttributes = this.dataAttributes, element = this._element, result = {};
10551      for (var i = 0, ln = dataAttributes.length;i < ln;i++) {
10552        var attr = dataAttributes[i];
10553        result[attr] = element.attr(attr);
10554      }
10555      return result;
10556    }, setData:function(data) {
10557      var dataAttributes = this.dataAttributes, element = this._element;
10558      for (var i = 0, ln = dataAttributes.length;i < ln;i++) {
10559        var attrName = dataAttributes[i];
10560        if (!data.hasOwnProperty(attrName)) {
10561          continue;
10562        }
10563        element.attr(attrName, data[attrName]);
10564      }
10565    }, unSelect:function() {
10566      this._states.selected = false;
10567      this._checkState();
10568      this.fireEvent("unSelect", this);
10569    }, select:function() {
10570      this._states.selected = true;
10571      this._checkState();
10572      this.fireEvent("select", this);
10573    }, mark:function() {
10574      this._states.mark = true;
10575      this._checkState();
10576    }, unMark:function() {
10577      this._states.mark = false;
10578      this._checkState();
10579    }, selected:function() {
10580      return this._states.selected;
10581    }, setReadOnly:function(readOnly) {
10582      this.config.readOnly = readOnly;
10583      this._checkState();
10584    }, getFillColor:function() {
10585      if (this._states.mark) {
10586        return "#ff0000";
10587      }
10588      if (this.config.readOnly) {
10589        if (this._states.selected) {
10590          return "#e4e4e4";
10591        }
10592      }
10593      if (this._states.selected) {
10594        return "#00ff00";
10595      }
10596      if (this._states.mouseOver) {
10597        return "#e4e4e4";
10598      }
10599      return "#ffffff";
10600    }, getStrokeColor:function() {
10601      if (this._states.selected) {
10602        return "#000000";
10603      }
10604      return "#000000";
10605    }, getOpacity:function() {
10606      if (this.config.readOnly) {
10607        if (this._states.selected) {
10608          return 0.8;
10609        }
10610        if (this._states.mouseOver) {
10611          return 0.3;
10612        }
10613        return 0;
10614      }
10615      if (this._states.mark) {
10616        return 0.5;
10617      }
10618      if (this._states.selected) {
10619        return 0.5;
10620      }
10621      if (this._states.mouseOver) {
10622        return 0.5;
10623      }
10624      return 0.3;
10625    }, setExtData:function(extData) {
10626      this.config.extData = extData;
10627    }, getExtData:function() {
10628      return this.config.extData;
10629    }, waitOfDrawingEnd:function() {
10630      return this._drawingByUser;
10631    }, getHelp:function() {
10632      return "";
10633    }, _onTaskDestroy:function(task) {
10634      var tasks = this._tasks;
10635      for (var i = tasks.length - 1;i >= 0;i--) {
10636        if (tasks[i] === task) {
10637          tasks.splice(i, 1);
10638          return;
10639        }
10640      }
10641    }, _onMouseClick:function() {
10642      this._states.selected = !this._states.selected;
10643      this._checkState();
10644      if (this._states.selected) {
10645        this.fireEvent("select", this);
10646      } else {
10647        this.fireEvent("unSelect", this);
10648      }
10649    }, _onMouseOut:function() {
10650      if (this._drawingByUser) {
10651        return;
10652      }
10653      this._states.mouseOver = false;
10654      this._checkState();
10655    }, _onMouseOver:function() {
10656      if (this._drawingByUser) {
10657        return;
10658      }
10659      this._element.attr({cursor:"pointer"});
10660      this._states.mouseOver = true;
10661      this._checkState();
10662    }, _onFirstClick:function() {
10663      delete this._firstClickResult;
10664    }});
10665    hm.core.ui.imageMapEditor.map.AbstractMap.factory = function(type, cfg) {
10666      var className;
10667      switch(type) {
10668        case "circle":
10669          className = "hm.core.ui.imageMapEditor.map.CircleMap";
10670          break;
10671        case "ellipse":
10672          className = "hm.core.ui.imageMapEditor.map.EllipseMap";
10673          break;
10674        case "polygon":
10675          className = "hm.core.ui.imageMapEditor.map.PolygonMap";
10676          break;
10677        case "square":
10678          className = "hm.core.ui.imageMapEditor.map.SquareMap";
10679          break;
10680        case "rect":
10681          className = "hm.core.ui.imageMapEditor.map.RectMap";
10682          break;
10683      }
10684      return HM.create(className, cfg);
10685    };
10686    self = hm.core.ui.imageMapEditor.map.AbstractMap;
10687  })();
10688  (function() {
10689    var self;
10690    HM.define("hm.core.ui.imageMapEditor.ImageMapEditor", {extend:"hm.core.ui.Component", requires:["hm.core.ui.imageMapEditor.map.AbstractMap"], config:{tplByClass:true, readOnly:false, imageUrl:"", classNameSpace:"hm-imageMapEditor"}, MAX_IMAGE_WIDTH:800, _init:function() {
10691      var _init = arguments.callee;
10692      this._selectedMaps = [];
10693      this.callParent(_init, arguments);
10694      var $el = this._$el, ns = this._ns;
10695      this._$elImageContainer = ns.find("imageContainer");
10696      this._$elButtonDelete = ns.find("button-delete");
10697      this._$elButtonsCreate = ns.find("button-create");
10698      this._$elToolbar = ns.find("toolbar");
10699      this._$elHelp = ns.find("help");
10700      this._maps = [];
10701      var config = this.config;
10702      if (config.readOnly) {
10703        this.setReadOnly(config.readOnly);
10704      }
10705      if (config.imageUrl) {
10706        this.setImageUrl(config.imageUrl);
10707      }
10708    }, setImageUrl:function(url) {
10709      var img = this._img = new Image;
10710      img.onload = this._onImageLoaded.bind(this);
10711      img.src = url;
10712    }, setReadOnly:function(readOnly) {
10713      this.config.readOnly = readOnly;
10714      if (readOnly) {
10715        this._$elToolbar.hide();
10716      } else {
10717        this._$elToolbar.show();
10718      }
10719      var maps = this._maps;
10720      for (var i = 0, ln = maps.length;i < ln;i++) {
10721        maps[i].setReadOnly(readOnly);
10722      }
10723    }, _initEvents:function() {
10724      var _initEvents = arguments.callee;
10725      this.callParent(_initEvents, arguments);
10726      var $el = this.getEl();
10727      $el.on("click", ".hm-imageMapEditor-button-create", this._onClickCreate.bind(this));
10728      $el.on("click", ".hm-imageMapEditor-button-delete", this._onClickDelete.bind(this));
10729    }, getPaper:function() {
10730      return this._paper;
10731    }, getData:function() {
10732      var maps = this._maps, result = [];
10733      for (var i = 0, ln = maps.length;i < ln;i++) {
10734        var map = maps[i];
10735        result.push({type:map.type, data:map.getData()});
10736      }
10737      return result;
10738    }, setData:function(data) {
10739      for (var i = 0, ln = data.length;i < ln;i++) {
10740        var mapCfg = data[i], mapType = mapCfg.type, mapData = mapCfg.data;
10741        this.createMap(mapType, mapData);
10742      }
10743    }, clear:function() {
10744      var maps = this._maps;
10745      for (var i = maps.length - 1;i >= 0;i--) {
10746        maps[i].destroy();
10747      }
10748    }, createMap:function(type, data) {
10749      data = data || null;
10750      var map = hm.core.ui.imageMapEditor.map.AbstractMap.factory(type, {editor:this, data:data});
10751      return this.add(map);
10752    }, add:function(map) {
10753      if (this._mapWhichIsExpectedToDrawing) {
10754        this._mapWhichIsExpectedToDrawing.destroy();
10755      }
10756      map.setReadOnly(this.config.readOnly);
10757      map.on("select", this._onMapSelect, this);
10758      map.on("unSelect", this._onMapUnSelect, this);
10759      map.on("destroy", this._onMapDestroy, this);
10760      if (map.waitOfDrawingEnd()) {
10761        map.on("drawEnd", this._onMapDrawEnd, this);
10762        this._mapWhichIsExpectedToDrawing = map;
10763      }
10764      this._maps.push(map);
10765      this.fireEvent("mapAdded", map);
10766      return map;
10767    }, _onMapDrawEnd:function(e, map) {
10768      if (this._mapWhichIsExpectedToDrawing === map) {
10769        delete this._mapWhichIsExpectedToDrawing;
10770      }
10771      this._clearButtonsHighlighting();
10772    }, _clearButtonsHighlighting:function() {
10773      this._$elHelp.text("");
10774      var $buttons = this._$elButtonsCreate;
10775      $buttons.prop("disabled", false);
10776      $buttons.css({outline:"none"});
10777    }, oneClick:function(callBack) {
10778      var $image = this._$elImageContainer, me = this, task, onClick = function(e) {
10779        $image.off("click", onClick);
10780        task.success();
10781        callBack(me.getPoint.apply(me, me._getCoordinatesFromEvent(e)));
10782      };
10783      $image.on("click", onClick);
10784      task = HM.create("hm.core.ui.imageMapEditor.task.Task", {listeners:{abort:function() {
10785        $image.off("click", onClick);
10786      }}});
10787      return task;
10788    }, oneEnter:function(callBack) {
10789      var $doc = $(document), me = this, task, onEnter = function(e) {
10790        if (e.keyCode !== 13) {
10791          return;
10792        }
10793        $doc.off("keydown", onEnter);
10794        e.preventDefault();
10795        task.success();
10796        callBack();
10797      };
10798      $doc.on("keydown", onEnter);
10799      task = HM.create("hm.core.ui.imageMapEditor.task.Task", {listeners:{abort:function() {
10800        $doc.off("keyup", onEnter);
10801      }}});
10802      return task;
10803    }, getPoint:function(x, y) {
10804      return{x:x, y:y, length:Math.sqrt(x * x + y * y)};
10805    }, getRelativePoint:function(center, point) {
10806      var dx = point.x - center.x, dy = point.y - center.y;
10807      return this.getPoint(dx, dy);
10808    }, _getCoordinatesFromEvent:function(e) {
10809      return[e.offsetX === undefined ? e.originalEvent.layerX : e.offsetX, e.offsetY === undefined ? e.originalEvent.layerY : e.offsetY];
10810    }, mouseMoveAndClick:function(cfg) {
10811      var $image = this._$elImageContainer, center = cfg.center, scope = cfg.scope || this, mouseMoveCallBack = cfg.mouseMoveCallBack, mouseClickCallBack = cfg.mouseClickCallBack, me = this, task;
10812      var onMouseMove = function(e) {
10813        var point = me.getPoint.apply(me, me._getCoordinatesFromEvent(e)), relativePoint = me.getRelativePoint(center, point);
10814        mouseMoveCallBack.call(scope, relativePoint, point);
10815      };
10816      $image.on("mousemove", onMouseMove);
10817      var oneClickResult = this.oneClick(function(point) {
10818        var relativePoint = me.getRelativePoint(center, point);
10819        task.success();
10820        mouseClickCallBack.call(scope, relativePoint, point);
10821        $image.off("mousemove", onMouseMove);
10822      });
10823      task = HM.create("hm.core.ui.imageMapEditor.task.Task", {listeners:{abort:function() {
10824        $image.off("mousemove", onMouseMove);
10825        oneClickResult.abort();
10826      }}});
10827      return task;
10828    }, canvasIsReady:function() {
10829      return!!this._visibleImage;
10830    }, _onImageLoaded:function() {
10831      var img = this._img, imgWidth = img.width, imgHeight = img.he
10831ight, maxImageWidth = this.MAX_IMAGE_WIDTH;
10832      if (imgWidth > maxImageWidth) {
10833        var aspectRatio = imgWidth / imgHeight;
10834        imgWidth = maxImageWidth;
10835        imgHeight = imgWidth / aspectRatio;
10836      }
10837      if (this._paper) {
10838        this._paper.clear();
10839        this._paper.remove();
10840      }
10841      var paper = this._paper = Raphael(this._$elImageContainer[0], imgWidth, imgHeight);
10842      this._visibleImage = paper.image(img.src, 0, 0, imgWidth, imgHeight);
10843      this.fireEvent("canvasReady");
10844    }, _removeFromSelectedMapsList:function(map) {
10845      var i = this._getSelectedMapIndex(map);
10846      if (i === -1) {
10847        return;
10848      }
10849      this._selectedMaps.splice(i, 1);
10850      if (!this._selectedMaps.length) {
10851        this._$elButtonDelete.hide();
10852      }
10853    }, _getSelectedMapIndex:function(map) {
10854      var selectedMaps = this._selectedMaps;
10855      for (var i = selectedMaps.length - 1;i >= 0;i--) {
10856        var selectedMap = selectedMaps[i];
10857        if (selectedMap === map) {
10858          return i;
10859        }
10860      }
10861      return-1;
10862    }, _onMapDestroy:function(e, map) {
10863      if (this._mapWhichIsExpectedToDrawing === map) {
10864        delete this._mapWhichIsExpectedToDrawing;
10865        this._clearButtonsHighlighting();
10866      }
10867      this._removeFromSelectedMapsList(map);
10868      var maps = this._maps;
10869      for (var i = 0, ln = maps.length;i < ln;i++) {
10870        if (maps[i] !== map) {
10871          continue;
10872        }
10873        maps.splice(i, 1);
10874        break;
10875      }
10876    }, _onMapSelect:function(e, map) {
10877      if (this._getSelectedMapIndex(map) === -1) {
10878        this._selectedMaps.push(map);
10879      }
10880      this._$elButtonDelete.show();
10881    }, _onMapUnSelect:function(e, map) {
10882      this._removeFromSelectedMapsList(map);
10883      if (!this._selectedMaps.length) {
10884        this._$elButtonDelete.hide();
10885      }
10886    }, _onClickCreate:function(e) {
10887      e.preventDefault();
10888      var $button = $(e.currentTarget);
10889      var map = this.createMap($button.data("type"));
10890      this._$elHelp.text(map.getHelp());
10891      this._$elButtonsCreate.prop("disabled", true);
10892      $button.css({outline:"2px solid #ff0000"});
10893    }, _onClickDelete:function(e) {
10894      e.preventDefault();
10895      var maps = this._selectedMaps;
10896      for (var i = maps.length - 1;i >= 0;i--) {
10897        maps[i].destroy();
10898      }
10899    }});
10900    self = hm.core.ui.imageMapEditor.ImageMapEditor;
10901  })();
10902  (function() {
10903    var self;
10904    HM.define("hm.core.ui.imageMapEditor.map.CircleMap", {extend:"hm.core.ui.imageMapEditor.map.AbstractMap", config:{}, type:"circle", dataAttributes:["cx", "cy", "r"], _initElement:function() {
10905      this._element = this._paper.circle(0, 0, 0);
10906    }, _repaint:function(leftTopCorner, dx, dy) {
10907      var radius = Math.abs(Math.abs(dx) < Math.abs(dy) ? dx : dy), deltaX = dx > 0 ? radius : -radius, deltaY = dy > 0 ? radius : -radius;
10908      this._element.attr({r:radius, cx:leftTopCorner.x + deltaX, cy:leftTopCorner.y + deltaY});
10909    }, getHelp:function() {
10910      return "";
10911    }, _onFirstClick:function(point) {
10912      var _onFirstClick = arguments.callee;
10913      this.callParent(_onFirstClick, arguments);
10914      var leftTopCorner = point, circle = this._element, me = this;
10915      circle.attr({cx:point.x, cy:point.y});
10916      function changeRadius(relativePoint, point) {
10917        var dx = relativePoint.x / 2, dy = relativePoint.y / 2;
10918        me._repaint(leftTopCorner, dx, dy);
10919      }
10920      function finalChangeRadius(relativePoint, point) {
10921        changeRadius(relativePoint, point);
10922        me._finalDraw();
10923      }
10924      var task = this._editor.mouseMoveAndClick({center:point, mouseMoveCallBack:changeRadius, mouseClickCallBack:finalChangeRadius});
10925      this._abortTaskIfMapDestructed(task);
10926    }});
10927    self = hm.core.ui.imageMapEditor.map.CircleMap;
10928  })();
10929  (function() {
10930    var self;
10931    HM.define("hm.core.ui.imageMapEditor.map.EllipseMap", {extend:"hm.core.ui.imageMapEditor.map.CircleMap", type:"ellipse", dataAttributes:["cx", "cy", "rx", "ry"], _initElement:function() {
10932      this._element = this._paper.ellipse(0, 0, 0, 0);
10933    }, _repaint:function(leftTopCorner, dx, dy) {
10934      this._element.attr({rx:Math.abs(dx), ry:Math.abs(dy), cx:leftTopCorner.x + dx, cy:leftTopCorner.y + dy});
10935    }});
10936    self = hm.core.ui.imageMapEditor.map.EllipseMap;
10937  })();
10938  (function() {
10939    var self;
10940    HM.define("hm.core.ui.imageMapEditor.map.PolygonMap", {extend:"hm.core.ui.imageMapEditor.map.AbstractMap", config:{}, type:"polygon", dataAttributes:["path"], _initElement:function() {
10941      this._element = this._paper.path("M0,0");
10942    }, getPathString:function(points, lock) {
10943      var resultArr = [];
10944      for (var i = 0, ln = points.length;i < ln;i++) {
10945        resultArr.push(points[i].x + "," + points[i].y);
10946      }
10947      if (lock) {
10948        resultArr.push(resultArr[0]);
10949      }
10950      return "M" + resultArr.join("L");
10951    }, _onFirstClick:function(point) {
10952      var _onFirstClick = arguments.callee;
10953      this.callParent(_onFirstClick, arguments);
10954      var leftTopPoint = point, points = [point], path = this.getPathString(points), me = this;
10955      var path = this._element, me = this, editor = this._editor, oneClickResult = null;
10956      path.attr({"path":this.getPathString(points)});
10957      function nextClick() {
10958        oneClickResult = editor.oneClick(onNextClick);
10959        me._abortTaskIfMapDestructed(oneClickResult);
10960      }
10961      function onNextClick(point) {
10962        if (points.length >= 3) {
10963          var firstPoint = points[0], delta = Math.sqrt(Math.pow(firstPoint.x - point.x, 2) + Math.pow(firstPoint.y - point.y, 2));
10964          if (delta <= 4) {
10965            enterTask.abort();
10966            onFinal();
10967            return;
10968          }
10969        }
10970        points.push(point);
10971        path.attr({path:me.getPathString(points)});
10972        nextClick();
10973      }
10974      nextClick();
10975      function onFinal() {
10976        if (oneClickResult) {
10977          oneClickResult.abort();
10978        }
10979        path.attr({path:me.getPathString(points, true)});
10980        me._finalDraw();
10981      }
10982      var enterTask = editor.oneEnter(onFinal);
10983      this._abortTaskIfMapDestructed(enterTask);
10984    }});
10985    self = hm.core.ui.imageMapEditor.map.PolygonMap;
10986  })();
10987  (function() {
10988    var self;
10989    HM.define("hm.core.ui.imageMapEditor.map.RectMap", {extend:"hm.core.ui.imageMapEditor.map.AbstractMap", config:{}, type:"rect", dataAttributes:["x", "y", "width", "height"], _initElement:function() {
10990      this._element = this._paper.rect(0, 0, 0, 0);
10991    }, _fixPoint:function(point) {
10992      return point;
10993    }, _onFirstClick:function(point) {
10994      var _onFirstClick = arguments.callee;
10995      this.callParent(_onFirstClick, arguments);
10996      var pointLeftTop = point, rect = this._element, me = this;
10997      rect.attr({"x":point.x, "y":point.y});
10998      function moveRect(dx, dy) {
10999        rect.attr({x:pointLeftTop.x + dx, y:pointLeftTop.y + dy});
11000      }
11001      function changeSize(relativePoint, point) {
11002        var dx = 0, dy = 0;
11003        relativePoint = me._fixPoint(relativePoint);
11004        if (relativePoint.x < 0) {
11005          dx = relativePoint.x;
11006        }
11007        if (relativePoint.y < 0) {
11008          dy = relativePoint.y;
11009        }
11010        moveRect(dx, dy);
11011        rect.attr({width:Math.abs(relativePoint.x), height:Math.abs(relativePoint.y)});
11012      }
11013      function finalChangeSize(relativePoint, point) {
11014        changeSize(relativePoint, point);
11015        me._finalDraw();
11016      }
11017      var task = this._editor.mouseMoveAndClick({center:point, mouseMoveCallBack:changeSize, mouseClickCallBack:finalChangeSize});
11018      this._abortTaskIfMapDestructed(task);
11019    }});
11020    self = hm.core.ui.imageMapEditor.map.RectMap;
11021  })();
11022  (function() {
11023    var self;
11024    HM.define("hm.core.ui.imageMapEditor.map.SquareMap", {extend:"hm.core.ui.imageMapEditor.map.RectMap", type:"square", _fixPoint:function(point) {
11025      var x = point.x, y = point.y, absX = Math.abs(x), absY = Math.abs(y);
11026      if (absX > absY) {
11027        x = x * absY / absX;
11028      } else {
11029        y = y * absX / absY;
11030      }
11031      return this.config.editor.getPoint(x, y);
11032    }, getHelp:function() {
11033      return "";
11034    }});
11035    self = hm.core.ui.imageMapEditor.map.SquareMap;
11036  })();
11037  (function() {
11038    var self;
11039    HM.define("hm.core.ui.imageMapEditor.task.Task", {extend:"hm.core.ObservableClass", abort:function() {
11040      this.fireEvent("abort");
11041    }, success:function() {
11042      this.destroy();
11043    }});
11044    self = hm.core.ui.imageMapEditor.task.Task;
11045  })();
11046  (function() {
11047    var self;
11048    HM.define("hm.core.ui.nanoscroller.Nanoscroller", {extend:"hm.core.ObservableClass", config:{el:null, options:{}}, __construct:function() {
11049      var __construct = arguments.callee;
11050      this.callParent(__construct, arguments);
11051      this._initPlugin();
11052      hm.core.ui.nanoscroller.Nanoscroller.prototype._initPlugin = HM.emptyFn;
11053      var elCfg = this.config.el, $el;
11054      if (typeof elCfg === "string") {
11055        $el = $(elCfg);
11056      } else {
11057        if (elCfg instanceof jQuery) {
11058          $el = elCfg;
11059        } else {
11060          if (elCfg instanceof Array) {
11061            $el = $(elCfg.join(""));
11062          } else {
11063            if (hm.core.DOM.isNode(elCfg)) {
11064              $el = $(elCfg);
11065            } else {
11066              throw new Error("Передан некорректный параметр el при создании компонента");
11067            }
11068          }
11069        }
11070      }
11071      $el.addClass("nano").children().addClass("nano-content");
11072      $el.nanoScroller(this.config.options);
11073      this._$el = $el;
11074    }, getEl:function() {
11075      return this._$el;
11076    }, scroll:function(value) {
11077      this.getEl().nanoScroller({scroll:value});
11078    }, update:function() {
11079      var me = this;
11080      if (this._updateTimeout !== undefined) {
11081        clearTimeout(this._updateTimeout);
11082        this._updateTimeout = undefined;
11083      }
11084      this._updateTimeout = setTimeout(function() {
11085        me.getEl().nanoScroller();
11086        me.fireEvent("updated", me);
11087      }, 50);
11088    }, _initPlugin:function() {
11089      (function(factory) {
11090        if (typeof define === "function" && define.amd) {
11091          return define(["jquery"], function($) {
11092            return factory($, window, document);
11093          });
11094        } else {
11095          if (typeof exports === "object") {
11096            return module.exports = factory(require("jquery"), window, document);
11097          } else {
11098            return factory(jQuery, window, document);
11099          }
11100        }
11101      })(function($, window, document) {
11102        var BROWSER_IS_IE7, BROWSER_SCROLLBAR_WIDTH, DOMSCROLL, DOWN, DRAG, ENTER, KEYDOWN, KEYUP, MOUSEDOWN, MOUSEENTER, MOUSEMOVE, MOUSEUP, MOUSEWHEEL, NanoScroll, PANEDOWN, RESIZE, SCROLL, SCROLLBAR, TOUCHMOVE, UP, WHEEL, cAF, defaults, getBrowserScrollbarWidth, hasTransform, isFFWithBuggyScrollbar, rAF, transform, _elementStyle, _prefixStyle, _vendor;
11103        defaults = {paneClass:"nano-pane", sliderClass:"nano-slider", contentClass:"nano-content", enabledClass:"has-scrollbar", flashedClass:"flashed", activeClass:"active", iOSNativeScrolling:false, preventPageScrolling:false, disableResize:false, alwaysVisible:false, flashDelay:1500, sliderMinHeight:20, sliderMaxHeight:null, documentContext:null, windowContext:null};
11104        SCROLLBAR = "scrollbar";
11105        SCROLL = "scroll";
11106        MOUSEDOWN = "mousedown";
11107        MOUSEENTER = "mouseenter";
11108        MOUSEMOVE = "mousemove";
11109        MOUSEWHEEL = "mousewheel";
11110        MOUSEUP = "mouseup";
11111        RESIZE = "resize";
11112        DRAG = "drag";
11113        ENTER = "enter";
11114        UP = "up";
11115        PANEDOWN = "panedown";
11116        DOMSCROLL = "DOMMouseScroll";
11117        DOWN = "down";
11118        WHEEL = "wheel";
11119        KEYDOWN = "keydown";
11120        KEYUP = "keyup";
11121        TOUCHMOVE = "touchmove";
11122        BROWSER_IS_IE7 = window.navigator.appName === "Microsoft Internet Explorer" && (/msie 7./i.test(window.navigator.appVersion) && window.ActiveXObject);
11123        BROWSER_SCROLLBAR_WIDTH = null;
11124        rAF = window.requestAnimationFrame;
11125        cAF = window.cancelAnimationFrame;
11126        _elementStyle = document.createElement("div").style;
11127        _vendor = function() {
11128          var i, transform, vendor, vendors, _i, _len;
11129          vendors = ["t", "webkitT", "MozT", "msT", "OT"];
11130          for (i = _i = 0, _len = vendors.length;_i < _len;i = ++_i) {
11131            vendor = vendors[i];
11132            transform = vendors[i] + "ransform";
11133            if (transform in _elementStyle) {
11134              return vendors[i].substr(0, vendors[i].length - 1);
11135            }
11136          }
11137          return false;
11138        }();
11139        _prefixStyle = function(style) {
11140          if (_vendor === false) {
11141            return false;
11142          }
11143          if (_vendor === "") {
11144            return style;
11145          }
11146          return _vendor + style.charAt(0).toUpperCase() + style.substr(1);
11147        };
11148        transform = _prefixStyle("transform");
11149        hasTransform = transform !== false;
11150        getBrowserScrollbarWidth = function() {
11151          var outer, outerStyle, scrollbarWidth;
11152          outer = document.createElement("div");
11153          outerStyle = outer.style;
11154          outerStyle.position = "absolute";
11155          outerStyle.width = "100px";
11156          outerStyle.height = "100px";
11157          outerStyle.overflow = SCROLL;
11158          outerStyle.top = "-9999px";
11159          document.body.appendChild(outer);
11160          scrollbarWidth = outer.offsetWidth - outer.clientWidth;
11161          document.body.removeChild(outer);
11162          return scrollbarWidth;
11163        };
11164        isFFWithBuggyScrollbar = function() {
11165          var isOSXFF, ua, version;
11166          ua = window.navigator.userAgent;
11167          isOSXFF = /(?=.+Mac OS X)(?=.+Firefox)/.test(ua);
11168          if (!isOSXFF) {
11169            return false;
11170          }
11171          version = /Firefox\/\d{2}\./.exec(ua);
11172          if (version) {
11173            version = version[0].replace(/\D+/g, "");
11174          }
11175          return isOSXFF && +version > 23;
11176        };
11177        NanoScroll = function() {
11178          function NanoScroll(el, options) {
11179            this.el = el;
11180            this.options = options;
11181            BROWSER_SCROLLBAR_WIDTH || (BROWSER_SCROLLBAR_WIDTH = getBrowserScrollbarWidth());
11182            this.$el = $(this.el);
11183            this.doc = $(this.options.documentContext || document);
11184            this.win = $(this.options.windowContext || window);
11185            this.body = this.doc.find("body");
11186            this.$content = this.$el.children("." + this.options.contentClass);
11187            this.$content.attr("tabindex", this.options.tabIndex || 0);
11188            this.content = this.$content[0];
11189            this.previousPosition = 0;
11190            if (this.options.iOSNativeScrolling && this.el.style.WebkitOverflowScrolling != null) {
11191              this.nativeScrolling();
11192            } else {
11193              this.generate();
11194            }
11195            this.createEvents();
11196            this.addEvents();
11197            this.reset();
11198          }
11199          NanoScroll.prototype.preventScrolling = function(e, direction) {
11200            if (!this.isActive) {
11201              return;
11202            }
11203            if (e.type === DOMSCROLL) {
11204              if (direction === DOWN && e.originalEvent.detail > 0 || direction === UP && e.originalEvent.detail < 0) {
11205                e.preventDefault();
11206              }
11207            } else {
11208              if (e.type === MOUSEWHEEL) {
11209                if (!e.originalEvent || !e.originalEvent.wheelDelta) {
11210                  return;
11211                }
11212                if (direction === DOWN && e.originalEvent.wheelDelta < 0 || direction === UP && e.originalEvent.wheelDelta > 0) {
11213                  e.preventDefault();
11214                }
11215              }
11216            }
11217          };
11218          NanoScroll.prototype.nativeScrolling = function() {
11219            this.$content.css({WebkitOverflowScrolling:"touch"});
11220            this.iOSNativeScrolling = true;
11221            this.isActive = true;
11222          };
11223          NanoScroll.prototype.updateScrollValues = function() {
11224            var content, direction;
11225            content = this.content;
11226            this.maxScrollTop = content.scrollHeight - content.clientHeight;
11227            this.prevScrollTop = this.contentScrollTop || 0;
11228            this.contentScrollTop = content.scrollTop;
11229            direction = this.contentScrollTop > this.previousPosition ? "down" : this.contentScrollTop < this.previousPosition ? "up" : "same";
11230            this.previousPosition = this.contentScrollTop;
11231            if (direction !== "same") {
11232              this.$el.trigger("update", {position:this.contentScrollTop, maximum:this.maxScrollTop, direction:direction});
11233            }
11234            if (!this.iOSNativeScrolling) {
11235              this.maxSliderTop = this.paneHeight - this.sliderHeight;
11236              this.sliderTop = this.maxScrollTop === 0 ? 0 : this.contentScrollTop * this.maxSliderTop / this.maxScrollTop;
11237            }
11238          };
11239          NanoScroll.prototype.setOnScrollStyles = function() {
11240            var cssValue;
11241            if (hasTransform) {
11242              cssValue = {};
11243              cssValue[transform] = "translate(0, " + this.sliderTop + "px)";
11244            } else {
11245              cssValue = {top:this.sliderTop};
11246            }
11247            if (rAF) {
11248              if (cAF && this.scrollRAF) {
11249                cAF(this.scrollRAF);
11250              }
11251              this.scrollRAF = rAF(function(_this) {
11252                return function() {
11253                  _this.scrollRAF = null;
11254                  return _this.slider.css(cssValue);
11255                };
11256              }(this));
11257            } else {
11258              this.slider.css(cssValue);
11259            }
11260          };
11261          NanoScroll.prototype.createEvents = function() {
11262            this.events = {down:function(_this) {
11263              return function(e) {
11264                _this.isBeingDragged = true;
11265                _this.offsetY = e.pageY - _this.slider.offset().top;
11266                if (!_this.slider.is(e.target)) {
11267                  _this.offsetY = 0;
11268                }
11269                _this.pane.addClass(_this.options.activeClass);
11270                _this.doc.bind(MOUSEMOVE, _this.events[DRAG]).bind(MOUSEUP, _this.events[UP]);
11271                _this.body.bind(MOUSEENTER, _this.events[ENTER]);
11272                return false;
11273              };
11274            }(this), drag:function(_this) {
11275              return function(e) {
11276                _this.sliderY = e.pageY - _this.$el.offset().top - _this.paneTop - (_this.offsetY || _this.sliderHeight * 0.5);
11277                _this.scroll();
11278                if (_this.contentScrollTop >= _this.maxScrollTop && _this.prevScrollTop !== _this.maxScrollTop) {
11279                  _this.$el.trigger("scrollend");
11280                } else {
11281                  if (_this.contentScrollTop === 0 && _this.prevScrollTop !== 0) {
11282                    _this.$el.trigger("scrolltop");
11283                  }
11284                }
11285                return false;
11286              };
11287            }(this), up:function(_this) {
11288              return function(e) {
11289                _this.isBeingDragged = false;
11290                _this.pane.removeClass(_this.options.activeClass);
11291                _this.doc.unbind(MOUSEMOVE, _this.events[DRAG]).unbind(MOUSEUP, _this.events[UP]);
11292                _this.body.unbind(MOUSEENTER, _this.events[ENTER]);
11293                return false;
11294              };
11295            }(this), resize:function(_this) {
11296              return function(e) {
11297                _this.reset();
11298              };
11299            }(this), panedown:function(_this) {
11300              return function(e) {
11301                _this.sliderY = (e.offsetY || e.originalEvent.layerY) - _this.sliderHeight * 0.5;
11302                _this.scroll();
11303                _this.events.down(e);
11304                return false;
11305              };
11306            }(this), scroll:function(_this) {
11307              return function(e) {
11308                _this.updateScrollValues();
11309                if (_this.isBeingDragged) {
11310                  return;
11311                }
11312                if (!_this.iOSNativeScrolling) {
11313                  _this.sliderY = _this.sliderTop;
11314                  _this.setOnScrollStyles();
11315                }
11316                if (e == null) {
11317                  return;
11318                }
11319                if (_this.contentScrollTop >= _this.maxScrollTop) {
11320                  if (_this.options.preventPageScrolling) {
11321                    _this.preventScrolling(e, DOWN);
11322                  }
11323                  if (_this.prevScrollTop !== _this.maxScrollTop) {
11324                    _this.$el.trigger("scrollend");
11325                  }
11326                } else {
11327                  if (_this.contentScrollTop === 0) {
11328                    if (_this.options.preventPageScrolling) {
11329                      _this.preventScrolling(e, UP);
11330                    }
11331                    if (_this.prevScrollTop !== 0) {
11332                      _this.$el.trigger("scrolltop");
11333                    }
11334                  }
11335                }
11336              };
11337            }(this), wheel:function(_this) {
11338              return function(e) {
11339                var delta;
11340                if (e == null) {
11341                  return;
11342                }
11343                delta = e.delta || (e.wheelDelta || (e.originalEvent && e.originalEvent.wheelDelta || (-e.detail || e.originalEvent && -e.originalEvent.detail)));
11344                if (delta) {
11345                  _this.sliderY += -delta / 3;
11346                }
11347                _this.scroll();
11348                return false;
11349              };
11350            }(this), enter:function(_this) {
11351              return function(e) {
11352                var _ref;
11353                if (!_this.isBeingDragged) {
11354                  return;
11355                }
11356                if ((e.buttons || e.which) !== 1) {
11357                  return(_ref = _this.events)[UP].apply(_ref, arguments);
11358                }
11359              };
11360            }(this)};
11361          };
11362          NanoScroll.prototype.addEvents = function() {
11363            var events;
11364            this.removeEvents();
11365            events = this.events;
11366            if (!this.options.disableResize) {
11367              this.win.bind(RESIZE, events[RESIZE]);
11368            }
11369            if (!this.iOSNativeScrolling) {
11370              this.slider.bind(MOUSEDOWN, events[DOWN]);
11371              this.pane.bind(MOUSEDOWN, events[PANEDOWN]).bind("" + MOUSEWHEEL + " " + DOMSCROLL, events[WHEEL]);
11372            }
11373            this.$content.bind("" + SCROLL + " " + MOUSEWHEEL + " " + DOMSCROLL + " " + TOUCHMOVE, events[SCROLL]);
11374          };
11375          NanoScroll.prototype.removeEvents = function() {
11376            var events;
11377            events = this.events;
11378            this.win.unbind(RESIZE, events[RESIZE]);
11379            if (!this.iOSNativeScrolling) {
11380              this.slider.unbind();
11381              this.pane.unbind();
11382            }
11383            this.$content.unbind("" + SCROLL + " " + MOUSEWHEEL + " " + DOMSCROLL + " " + TOUCHMOVE, events[SCROLL]);
11384          };
11385          NanoScroll.prototype.generate = function() {
11386            var contentClass, cssRule, currentPadding, options, pane, paneClass, sliderClass;
11387            options = this.options;
11388            paneClass = options.paneClass, sliderClass = options.sliderClass, contentClass = options.contentClass;
11389            if (!(pane = this.$el.children("." + paneClass)).length && !pane.children("." + sliderClass).length) {
11390              this.$el.append('<div class="' + paneClass + '"><div class="' + sliderClass + '" /></div>');
11391            }
11392            this.pane = this.$el.children("." + paneClass);
11393            this.slider = this.pane.find("." + sliderClass);
11394            if (BROWSER_SCROLLBAR_WIDTH === 0 && isFFWithBuggyScrollbar()) {
11395              currentPadding = window.getComputedStyle(this.content, null).getPropertyValue("padding-right").replace(/[^0-9.]+/g, "");
11396              cssRule = {right:-14, paddingRight:+currentPadding + 14};
11397            } else {
11398              if (BROWSER_SCROLLBAR_WIDTH) {
11399                cssRule = {right:-BROWSER_SCROLLBAR_WIDTH};
11400                this.$el.addClass(options.enabledClass);
11401              }
11402            }
11403            if (cssRule != null) {
11404              this.$content.css(cssRule);
11405            }
11406            return this;
11407          };
11408          NanoScroll.prototype.restore = function() {
11409            this.stopped = false;
11410            if (!this.iOSNativeScrolling) {
11411              this.pane.show();
11412            }
11413            this.addEvents();
11414          };
11415          NanoScroll.prototype.reset = function() {
11416            var content, contentHeight, contentPosition, contentStyle, contentStyleOverflowY, paneBottom, paneHeight, paneOuterHeight, paneTop, parentMaxHeight, right, sliderHeight;
11417            if (this.iOSNativeScrolling) {
11418              this.contentHeight = this.content.scrollHeight;
11419              return;
11420            }
11421            if (!this.$el.find("." + this.options.paneClass).length) {
11422              this.generate().stop();
11423            }
11424            if (this.stopped) {
11425              this.restore();
11426            }
11427            content = this.content;
11428            contentStyle = content.style;
11429            contentStyleOverflowY = contentStyle.overflowY;
11430            if (BROWSER_IS_IE7) {
11431              this.$content.css({height:this.$content.height()});
11432            }
11433            contentHeight = content.scrollHeight + BROWSER_SCROLLBAR_WIDTH;
11434            parentMaxHeight = parseInt(this.$el.css("max-height"), 10);
11435            if (parentMaxHeight > 0) {
11436              this.$el.height("");
11437              this.$el.height(content.scrollHeight > parentMaxHeight ? parentMaxHeight : content.scrollHeight);
11438            }
11439            paneHeight = this.pane.outerHeight(false);
11440            paneTop = parseInt(this.pane.css("top"), 10);
11441            paneBottom = parseInt(this.pane.css("bottom"), 10);
11442            paneOuterHeight = paneHeight + paneTop + paneBottom;
11443            sliderHeight = Math.round(paneOuterHeight / contentHeight * paneHeight);
11444            if (sliderHeight < this.options.sliderMinHeight) {
11445              sliderHeight = this.options.sliderMinHeight;
11446            } else {
11447              if (this.options.sliderMaxHeight != null && sliderHeight > this.options.sliderMaxHeight) {
11448                sliderHeight = this.options.sliderMaxHeight;
11449              }
11450            }
11451            if (contentStyleOverflowY === SCROLL && contentStyle.overflowX !== SCROLL) {
11452              sliderHeight += BROWSER_SCROLLBAR_WIDTH;
11453            }
11454            this.maxSliderTop = paneOuterHeight - sliderHeight;
11455            this.contentHeight = contentHeight;
11456            this.paneHeight = paneHeight;
11457            this.paneOuterHeight = paneOuterHeight;
11458            this.sliderHeight = sliderHeight;
11459            this.paneTop = paneTop;
11460            this.slider.height(sliderHeight);
11461            this.events.scroll();
11462            this.pane.show();
11463            this.isActive = true;
11464            if (content.scrollHeight === content.clientHeight || this.pane.outerHeight(true) >= content.scrollHeight && contentStyleOverflowY !== SCROLL) {
11465              this.pane.hide();
11466              this.isActive = false;
11467            } else {
11468              if (this.el.clientHeight === content.scrollHeight && contentStyleOverflowY === SCROLL) {
11469                this.slider.hide();
11470              } else {
11471                this.slider.show();
11472              }
11473            }
11474            this.pane.css({opacity:this.options.alwaysVisible ? 1 : "", visibility:this.options.alwaysVisible ? "visible" : ""});
11475            contentPosition = this.$content.css("position");
11476            if (contentPosition === "static" || contentPosition === "relative") {
11477              right = parseInt(this.$content.css("right"), 10);
11478              if (right) {
11479                this.$content.css({right:"", marginRight:right});
11480              }
11481            }
11482            return this;
11483          };
11484          NanoScroll.prototype.scroll = function() {
11485            if (!this.isActive) {
11486              return;
11487            }
11488            this.sliderY = Math.max(0, this.sliderY);
11489            this.sliderY = Math.min(this.maxSliderTop, this.sliderY);
11490            this.$content.scrollTop(this.maxScrollTop * this.sliderY / this.maxSliderTop);
11491            if (!this.iOSNativeScrolling) {
11492              this.updateScrollValues();
11493              this.setOnScrollStyles();
11494            }
11495            return this;
11496          };
11497          NanoScroll.prototype.scrollBottom = function(offsetY) {
11498            if (!this.isActive) {
11499              return;
11500            }
11501            this.$content.scrollTop(this.contentHeight - this.$content.height() - offsetY).trigger(MOUSEWHEEL);
11502            this.stop().restore();
11503            return this;
11504          };
11505          NanoScroll.prototype.scrollTop = function(offsetY) {
11506            if (!this.isActive) {
11507              return;
11508            }
11509            this.$content.scrollTop(+offsetY).trigger(MOUSEWHEEL);
11510            this.stop().restore();
11511            return this;
11512          };
11513          NanoScroll.prototype.scrollTo = function(node) {
11514            if (!this.isActive) {
11515              return;
11516            }
11517            this.scrollTop(this.$el.find(node).get(0).offsetTop);
11518            return this;
11519          };
11520          NanoScroll.prototype.stop = function() {
11521            if (cAF && this.scrollRAF) {
11522              cAF(this.scrollRAF);
11523              this.scrollRAF = null;
11524            }
11525            this.stopped = true;
11526            this.removeEvents();
11527            if (!this.iOSNativeScrolling) {
11528              this.pane.hide();
11529            }
11530            return this;
11531          };
11532          NanoScroll.prototype.destroy = function() {
11533            if (!this.stopped) {
11534              this.stop();
11535            }
11536            if (!this.iOSNativeScrolling && this.pane.length) {
11537              this.pane.remove();
11538            }
11539            if (BROWSER_IS_IE7) {
11540              this.$content.height("");
11541            }
11542            this.$content.removeAttr("tabindex");
11543            if (this.$el.hasClass(this.options.enabledClass)) {
11544              this.$el.removeClass(this.options.enabledClass);
11545              this.$content.css({right:""});
11546            }
11547            return this;
11548          };
11549          NanoScroll.prototype.flash = function() {
11550            if (this.iOSNativeScrolling) {
11551              return;
11552            }
11553            if (!this.isActive) {
11554              return;
11555            }
11556            this.reset();
11557            this.pane.addClass(this.options.flashedClass);
11558            setTimeout(function(_this) {
11559              return function() {
11560                _this.pane.removeClass(_this.options.flashedClass);
11561              };
11562            }(this), this.options.flashDelay);
11563            return this;
11564          };
11565          return NanoScroll;
11566        }();
11567        $.fn.nanoScroller = function(settings) {
11568          return this.each(function() {
11569            var options, scrollbar;
11570            if (!(scrollbar = this.nanoscroller)) {
11571              options = $.extend({}, defaults, settings);
11572              this.nanoscroller = scrollbar = new NanoScroll(this, options);
11573            }
11574            if (settings && typeof settings === "object") {
11575              $.extend(scrollbar.options, settings);
11576              if (settings.scrollBottom != null) {
11577                return scrollbar.scrollBottom(settings.scrollBottom);
11578              }
11579              if (settings.scrollTop != null) {
11580                return scrollbar.scrollTop(settings.scrollTop);
11581              }
11582              if (settings.scrollTo) {
11583                return scrollbar.scrollTo(settings.scrollTo);
11584              }
11585              if (settings.scroll === "bottom") {
11586                return scrollbar.scrollBottom(0);
11587              }
11588              if (settings.scroll === "top") {
11589                return scrollbar.scrollTop(0);
11590              }
11591              if (settings.scroll && settings.scroll instanceof $) {
11592                return scrollbar.scrollTo(settings.scroll);
11593              }
11594              if (settings.stop) {
11595                return scrollbar.stop();
11596              }
11597              if (settings.destroy) {
11598                return scrollbar.destroy();
11599              }
11600              if (settings.flash) {
11601                return scrollbar.flash();
11602              }
11603            }
11604            return scrollbar.reset();
11605          });
11606        };
11607        $.fn.nanoScroller.Constructor = NanoScroll;
11608      });
11609    }});
11610    self = hm.core.ui.nanoscroller.Nanoscroller;
11611  })();
11612  (function() {
11613    var self;
11614    HM.define("hm.core.ui.storeList.List", {extend:"hm.core.data.Store", config:{autoLoad:false, dataUrl:null, model:"hm.core.ui.storeList.ListItem", pagination:false, tplByClass:true, classNameSpace:"hm-storeList"}, __construct:function() {
11615      var __construct = arguments.callee;
11616      this._isLoading = false;
11617      return this.callParent(__construct, arguments);
11618    }, _init:function() {
11619      var _init = arguments.callee;
11620      this.callParent(_init, arguments);
11621      var ns = this.getNs();
11622      this._listItemsContainer = ns.find("items-container");
11623      if (this._listItemsContainer.length == 0) {
11624        throw new Error("В шаблоне отсутствует " + ns.getClass("items-container"));
11625      }
11626    }, render:function() {
11627      var render = arguments.callee;
11628      this.callParent(render, arguments);
11629      this._nanoScroller = HM.create("hm.core.ui.nanoscroller.Nanoscroller", {el:this.getEl(), options:{alwaysVisible:true}, listeners:{scope:this, updated:this._nanoScrollerUpdated}});
11630      this.refresh();
11631    }, _load:function(data, method) {
11632      var _load = arguments.callee;
11633      if (data.source && data.source.lastLoad) {
11634        this._lastLoad = data.source.lastLoad;
11635      }
11636      this.callParent(_load, arguments);
11637      this._isLoading = false;
11638    }, _itemLoaded:function(item) {
11639      var _itemLoaded = arguments.callee;
11640      this.callParent(_itemLoaded, arguments);
11641    }, _dataLoaded:function(items, method) {
11642      var _dataLoaded = arguments.callee;
11643      this.callParent(_dataLoaded, arguments);
11644      this._renderItems(items);
11645    }, _dataFiltered:function(items) {
11646      var _dataFiltered = arguments.callee;
11647      this.callParent(_dataFiltered, arguments);
11648      this._clearRenderedItems();
11649      this._renderItems(items);
11650    }, _nanoScrollerUpdated:function(event, nanoScroller) {
11651    }, isLoading:function() {
11652      return this._isLoading;
11653    }, getNanoScroller:function() {
11654      return this._nanoScroller;
11655    }, loadData:function(data, params) {
11656      if (this.isLoading()) {
11657        return;
11658      }
11659      this._isLoading = true;
11660      params = params || {};
11661      var proxy;
11662      if (data) {
11663        proxy = this.getMemoryProxy();
11664        proxy.setData(data);
11665      } else {
11666        proxy = this.getXhrProxy();
11667      }
11668      if (proxy != this.getProxy()) {
11669        this.setProxy(proxy);
11670      }
11671      if (this._lastLoad) {
11672        params.lastLoad = this._lastLoad;
11673      }
11674      this.loadMore(params);
11675    }, getXhrProxy:function() {
11676      if (this._xhrProxy === undefined) {
11677        this._xhrProxy = HM.create("hm.core.data.proxy.XhrProxy", {method:"POST", model:this.config.model, url:this.config.dataUrl});
11678      }
11679      return this._xhrProxy;
11680    }, getMemoryProxy:function() {
11681      if (this._memoryProxy === undefined) {
11682        this._memoryProxy = HM.create("hm.core.data.proxy.MemoryProxy", {model:this.config.model, reader:"simple_json"});
11683      }
11684      return this._memoryProxy;
11685    }, _getItemsContainer:function() {
11686      return this._listItemsContainer;
11687    }, _clearRenderedItems:function() {
11688      if (!this._rendered) {
11689        return;
11690      }
11691      this._getItemsContainer().empty();
11692    }, _renderItems:function(items) {
11693      if (!this._rendered) {
11694        return;
11695      }
11696      if (!items || items.length == 0) {
11697        return;
11698      }
11699      this._beforeItemsRender(items);
11700      var itemsContainer = this._getItemsContainer();
11701      for (var i = 0, ln = items.length;i < ln;i++) {
11702        items[i].render();
11703        itemsContainer.append(items[i].getEl());
11704      }
11705      this._afterItemsRender(items);
11706      this._updateNanoScroller();
11707    }, _beforeItemsRender:function(items) {
11708    }, _afterItemsRender:function(items) {
11709    }, _updateNanoScroller:function() {
11710      var nanoScroller = this.getNanoScroller();
11711      if (nanoScroller) {
11712        nanoScroller.update();
11713      }
11714    }});
11715    self = hm.core.ui.storeList.List;
11716  })();
11717  (function() {
11718    var self;
11719    HM.define("hm.core.ui.storeList.ListItem", {extend:"hm.core.data.Model", config:{autoLoad:false, tplByClass:true, classNameSpace:"hm-storeList-item"}, _init:function() {
11720      var _init = arguments.callee;
11721      this.callParent(_init, arguments);
11722      var ns = this.getNs();
11723      this.CLASS_SELECTED = ns("", "selected");
11724      this.CLASS_CHECKED = ns("", "checked");
11725      this._selected = false;
11726      this._checked = false;
11727    }, isChecked:function() {
11728      return this._checked;
11729    }, isSelected:function() {
11730      return this._selected;
11731    }, setChecked:function(flag, silent) {
11732      flag = !!flag;
11733      if (flag === this.isChecked()) {
11734        return;
11735      }
11736      this.getEl().toggleClass(this.CLASS_CHECKED, flag);
11737      this._checked = flag;
11738      if (!silent) {
11739        var prefix = flag ? "" : "un";
11740        this.fireEvent(prefix + "checked", this);
11741      }
11742    }, setSelected:function(flag, silent) {
11743      flag = !!flag;
11744      if (flag === this.isSelected()) {
11745        return;
11746      }
11747      this.getEl().toggleClass(this.CLASS_SELECTED, flag);
11748      this._selected = flag;
11749      if (!silent) {
11750        var prefix = flag ? "" : "un";
11751        this.fireEvent(prefix + "selected", this);
11752      }
11753    }});
11754    self = hm.core.ui.storeList.ListItem;
11755  })();
11756  (function() {
11757    var self;
11758    HM.define("hm.module.es.data.model.EventGroupModel", {extend:"hm.core.data.Model", config:{hasMany:{model:"hm.module.es.data.model.EventModel", propertyName:"events"}}, __construct:function() {
11759      var __construct = arguments.callee;
11760      this.callParent(__construct, arguments);
11761      var eventStore = this.get("events"), eventCount = eventStore.getItemsCount();
11762      for (var i = 0;i < eventCount;i++) {
11763        eventStore.getItem(i).on("change_view_state", this._onEventViewStateChange, this);
11764      }
11765    }, _onEventViewStateChange:function(e, value) {
11766      this.fireEvent("event_change_view_state", e.getTarget(), value);
11767    }});
11768    self = hm.module.es.data.model.EventGroupModel;
11769  })();
11770  (function() {
11771    var self;
11772    var eventModels = {};
11773    HM.define("hm.module.es.data.model.EventModel", {extend:"hm.core.data.Model", config:{hasOne:{model:"hm.core.data.Model", propertyName:"description", reader:{type:"json", dataProperty:""}}}, es_event_types:[{event_type_id:1, name:"forumAddMessage", event_group_type_id:2}, {event_type_id:2, name:"blogAddMessage", event_group_type_id:2}, {event_type_id:3, name:"wikiAddPage", event_group_type_id:2}, {event_type_id:4, name:"wikiModifyPage", event_group_type_id:2}, {event_type_id:5, name:"forumInternalAddMessage", 
11774    event_group_type_id:2}, {event_type_id:6, name:"blogInternalAddMessage", event_group_type_id:2}, {event_type_id:7, name:"wikiInternalAddPage", event_group_type_id:2}, {event_type_id:8, name:"wikiInternalModifyPage", event_group_type_id:2}, {event_type_id:9, name:"courseAddMaterial", event_group_type_id:3}, {event_type_id:10, name:"courseAttachLesson", event_group_type_id:3}, {event_type_id:11, name:"courseScoreTriggered", event_group_type_id:3}, {event_type_id:12, name:"courseTaskComplete", event_group_type_id:3}, 
11775    {event_type_id:13, name:"commentAdd", event_group_type_id:2}, {event_type_id:14, name:"commentInternalAdd", event_group_type_id:2}, {event_type_id:15, name:"courseTaskScoreTriggered", event_group_type_id:3}, {event_type_id:16, name:"personalMessageSend", event_group_type_id:1}], constructor:function(config) {
11776      var constructor = arguments.callee;
11777      var eventId = config.data.eventId;
11778      if (!eventModels.hasOwnProperty(eventId)) {
11779        eventModels[eventId] = this;
11780      } else {
11781        return eventModels[eventId];
11782      }
11783      return this.callParent(constructor, arguments);
11784    }, __construct:function() {
11785      var __construct = arguments.callee;
11786      this.callParent(__construct, arguments);
11787      this.get("description").on("change", this._onDescriptionChange, this);
11788    }, getEventId:function() {
11789      return this.get("eventId");
11790    }, getEventTypeStr:function() {
11791      return this.get("eventTypeStr");
11792    }, getEventGroupId:function() {
11793      var eventTypeStr = this.get("eventTypeStr");
11794      for (var i = 0;i < this.es_event_types.length;i++) {
11795        var eventType = this.es_event_types[i];
11796        if (eventType.name === eventTypeStr) {
11797          return eventType.event_group_type_id;
11798        }
11799      }
11800    }, getEventGroup:function() {
11801      switch(this.getEventGroupId()) {
11802        case 1:
11803          return "personalMessages";
11804        case 2:
11805          return "discussions";
11806        default:
11807          return "notifications";
11808      }
11809    }, _onDescriptionChange:function(e, name, value) {
11810      if (name !== "views") {
11811        return;
11812      }
11813      var me = this;
11814      HM.getService("EventService").markEventAsViewed(this.getEventId(), function(success) {
11815        if (success) {
11816          me.fireEvent("change_view_state", value);
11817        }
11818      });
11819    }});
11820    self = hm.module.es.data.model.EventModel;
11821  })();
11822  (function() {
11823    var self;
11824    HM.define("hm.module.es.data.reader.EventGroupsReader", {extend:"hm.core.data.reader.JsonReader", read:function(data) {
11825      var read = arguments.callee;
11826      var result = this.callParent(read, arguments), items = result.items, itemsArray = [], item;
11827      for (var i in items) {
11828        if (!items.hasOwnProperty(i)) {
11829          continue;
11830        }
11831        item = items[i];
11832        itemsArray.push({name:i, description:JSON.parse(item.group_description), type:item.group_type, events:item.events, lastModify:this._getGroupLastModifyTimestamp(item)});
11833      }
11834      itemsArray.sort(function(a, b) {
11835        return b.lastModify - a.lastModify;
11836      });
11837      result.items = itemsArray;
11838      return result;
11839    }, _getGroupLastModifyTimestamp:function(group) {
11840      var groupEvents = group.events, result = 0;
11841      for (var i = 0;i < groupEvents.length;i++) {
11842        var eventCreateTime = groupEvents[i].eventCreateTime;
11843        if (eventCreateTime > result) {
11844          result = eventCreateTime;
11845        }
11846      }
11847      return result;
11848    }});
11849    self = hm.module.es.data.reader.EventGroupsReader;
11850  })();
11851  (function() {
11852    var self;
11853    HM.define("hm.module.es.data.store.EventServiceStore", {extend:"hm.core.data.Store", requires:["hm.core.Date"], config:{pagination:false, proxy:{type:"xhr", reader:"hm.module.es.data.reader.EventGroupsReader", url:"/es/events/get", model:"hm.module.es.data.model.EventGroupModel", params:{}}}, LOAD_PERIOD:6E4 * 60 * 24 * 30, load:function(params) {
11854      var load = arguments.callee;
11855      params = params || {};
11856      params.forceStats = 1;
11857      this._page = 1;
11858      this.callParent(load, [params]);
11859    }, loadMore:function(params) {
11860      var loadMore = arguments.callee;
11861      params = params || {};
11862      params.page = this._page;
11863      this._page = this._page + 1;
11864      this.callParent(loadMore, [params]);
11865    }});
11866    HM.singleton(hm.module.es.data.store.EventServiceStore);
11867    self = hm.module.es.data.store.EventServiceStore;
11868  })();
11869  (function() {
11870    var self;
11871    HM.define("hm.module.es.data.store.EventServiceCourseStore", {extend:"hm.module.es.data.store.EventServiceStore", requires:["hm.core.Date"], config:{autoLoad:false, pagination:false, proxy:{type:"xhr", reader:"hm.module.es.data.reader.EventGroupsReader", url:"/es/events/get", model:"hm.module.es.data.model.EventGroupModel", params:{types:["courseAddMaterial", "courseAttachLesson", "courseScoreTriggered", "courseTaskComplete", "courseTaskAction"], group:1, showAll:1}}}, load:function(params) {
11872      hm.core.data.Store.prototype.load.call(this, params);
11873    }, loadMore:function() {
11874      return;
11875    }});
11876    self = hm.module.es.data.store.EventServiceCourseStore;
11877  })();
11878  (function() {
11879    var self;
11880    HM.define("hm.module.es.data.store.EventServiceTopStore", {extend:"hm.core.data.Store", requires:["hm.core.Date"], config:{pagination:false, proxy:{type:"xhr", reader:"hm.module.es.data.reader.EventGroupsReader", url:"/es/events/top", model:"hm.module.es.data.model.EventGroupModel", params:{}}}, LOAD_PERIOD:6E4 * 60 * 24 * 30, load:function(params) {
11881      var load = arguments.callee;
11882      params = params || {};
11883      this.callParent(load, [params]);
11884    }});
11885    HM.singleton(hm.module.es.data.store.EventServiceTopStore);
11886    self = hm.module.es.data.store.EventServiceTopStore;
11887  })();
11888  (function() {
11889    var self;
11890    HM.define("hm.module.es.service.EventServiceService", {viewFullList:function() {
11891      location.href = hm.core.Url.getInstance().url({module:"es", controller:"list", action:"index"});
11892    }, markEventAsViewed:function(eventId, callBack) {
11893      $.ajax({url:hm.core.Url.getInstance().url({module:"es", controller:"events", action:"markasviewed", eventId:eventId}), async:true}).done(function(data) {
11894        callBack(data.success);
11895      });
11896    }});
11897    hm.core.BaseService.registerServices({EventService:"hm.module.es.service.EventServiceService"});
11898    self = hm.module.es.service.EventServiceService;
11899  })();
11900  (function() {
11901    var self;
11902    HM.define("hm.module.es.ui.event.list.item.EventAbstract", {extend:"hm.core.ui.Component", config:{tpl:"hm/module/es/ui/event/list/item/EventAbstract", groupType:"discussions", isInternal:false, eventTypeStr:"", data:null, showPortfolioAction:false}, _init:function() {
11903      var _init = arguments.callee;
11904      this._groupType = this.config.groupType;
11905      this._data = this.config.data;
11906      this._description = this._data.get("description");
11907      this.description = this._description.getData();
11908      this.findDateOfCreation();
11909      this.callParent(_init, arguments);
11910      this._$el.find("iframe").remove();
11911      this.setAvatar();
11912      if (this.isNew()) {
11913        this.markAsNew();
11914      }
11915      if (HM.isDebug) {
11916        this._initDebugButton();
11917      }
11918    }, _initEvents:function() {
11919      var _initEvents = arguments.callee;
11920      this.callParent(_initEvents, arguments);
11921      this.elOn("click", null, this._onItemClick);
11922      this.elOn("click", ".hm-es-event-list-item-new-trigger", this._onNewTriggerClick);
11923      this.elOn("click", ".hm-es-event-list-item-portfolio-add a", this._addToPortfolio);
11924      this._data.on("change_view_state", this._onChangeViewState, this);
11925    }, _initDebugButton:function() {
11926      var $button = $('<div style="position: absolute; right: 0; top: 0; bottom: 0; width: 20px;"></div>'), me = this;
11927      $button.on("click", function(e) {
11928        e.preventDefault();
11929        e.stopPropagation();
11930        console.log(me);
11931      });
11932      this.getEl().append($button);
11933    }, _render:function() {
11934      var _render = arguments.callee;
11935      this.callParent(_render, arguments);
11936      if (this.$className === "hm.module.es.ui.event.list.item.EventAbstract") {
11937        this.getEl().text(HM._("Неизвестное событие"));
11938      }
11939    }, hide:function() {
11940      this.getEl().hide();
11941    }, show:function() {
11942      this.getEl().show();
11943    }, getData:function() {
11944      return this._data;
11945    }, getAuthor:function() {
11946      return this.description.author || this.description.author_name;
11947    }, getAuthorId:function() {
11948      var user_id = this.description.user_id;
11949      if (!user_id) {
11950        user_id = this.description.author_id;
11951      }
11952      return user_id;
11953    }, getAuthorUrl:function() {
11954      return HM.getService("User").getUserUrl(this.getAuthorId());
11955    }, getGroupType:function() {
11956      return this._groupType;
11957    }, findDateOfCreation:function() {
11958      this.creationDate = this._data.get("eventCreateTime");
11959    }, setAvatar:function() {
11960      var desc = this.description;
11961      var avatar = desc.author_avatar || desc.user_avatar;
11962      if (!avatar) {
11963        return;
11964      }
11965      this.getEl().find(".hm-es-event-list-item-avatar").css({backgroundImage:"url(" + avatar + ")"});
11966    }, viewEntity:function() {
11967      return false;
11968    }, isNew:function() {
11969      return!this._description.get("views");
11970    }, markAsNew:function() {
11971      this.getEl().addClass("hm-es-event-list-item-new");
11972      if (!this._$elNewTrigger) {
11973        this._$elNewTrigger = $('<div class="hm-es-event-list-item-new-trigger"></div>');
11974        this._$elNewTrigger.prop("title", HM._("Пометить как прочитанное"));
11975      }
11976      this.getEl().append(this._$elNewTrigger);
11977    }, markAsNotNew:function() {
11978      this.getEl().removeClass("hm-es-event-list-item-new");
11979      this._$elNewTrigger.detach();
11980    }, getEventId:function() {
11981      return this._data.get("eventId");
11982    }, getTitle:function() {
11983      return this.description.title;
11984    }, getElHtml:function() {
11985      var clone = this.getEl().clone();
11986      clone.find(".hm-es-event-list-item-datetime, .hm-es-event-list-item-portfolio-add").remove();
11987      return encodeURIComponent(clone.html());
11988    }, _addToPortfolio:function(e) {
11989      e.preventDefault();
11990      var me = this;
11991      $.ajax({type:"POST", url:hm.core.Url.getInstance().url({module:"user", controller:"ajax", action:"event-to-achievement", eventId:this.getEventId()}), data:{text:this.getElHtml()}}).done(function(data) {
11992        if (data) {
11993          me.getEl().find(".hm-es-event-list-item-portfolio-add").html(data[0]);
11994        }
11995      });
11996    }, _onItemClick:function(e) {
11997      if (e.target.tagName === "A") {
11998        return;
11999      }
12000      this.viewEntity();
12001    }, _onNewTriggerClick:function(e) {
12002      e.stopPropagation();
12003      this._description.set("views", true);
12004    }, _onChangeViewState:function(e, isViewed) {
12005      if (isViewed) {
12006        this.markAsNotNew();
12007      } else {
12008        this.markAsNew();
12009      }
12010    }});
12011    hm.module.es.ui.event.list.item.EventAbstract.factory = hm.core.ClassManager.createFactory("eventTypeStr", {"default":"hm.module.es.ui.event.list.item.EventAbstract", blogAddMessage:"hm.module.es.ui.event.list.item.blog.BlogAddMessage", blogInternalAddMessage:"hm.module.es.ui.event.list.item.blog.BlogInternalAddMessage", forumAddMessage:"hm.module.es.ui.event.list.item.forum.ForumAddMessage", forumInternalAddMessage:"hm.module.es.ui.event.list.item.forum.ForumInternalAddMessage", wikiAddPage:"hm.module.es.ui.event.list.item.wiki.WikiPage", 
12012    wikiInternalAddPage:"hm.module.es.ui.event.list.item.wiki.WikiInternalPage", wikiModifyPage:"hm.module.es.ui.event.list.item.wiki.WikiPage", wikiInternalModifyPage:"hm.module.es.ui.event.list.item.wiki.WikiInternalPage", courseAddMaterial:"hm.module.es.ui.event.list.item.course.CourseAddMaterial", courseAttachLesson:"hm.module.es.ui.event.list.item.course.CourseAttachLesson", courseScoreTriggered:"hm.module.es.ui.event.list.item.course.CourseScoreTriggered", courseTaskComplete:"hm.module.es.ui.event.list.item.course.CourseTaskComplete", 
12013    courseTaskAction:"hm.module.es.ui.event.list.item.course.CourseTaskAction", courseTaskScoreTriggered:"hm.module.es.ui.event.list.item.course.CourseTaskScoreTriggered", personalMessageSend:"hm.module.es.ui.event.list.item.personalMessage.PersonalMessage"});
12014    self = hm.module.es.ui.event.list.item.EventAbstract;
12015  })();
12016  (function() {
12017    var self;
12018    HM.define("hm.module.es.ui.event.list.group.DefaultEventGroup", {extend:"hm.core.ui.Component", requires:["hm.module.es.ui.event.list.item.EventAbstract"], config:{tpl:"hm/module/es/ui/event/list/group/DefaultEventGroup", type:"", data:null, eventList:null, groupTitle:"", collapsible:true}, _init:function() {
12019      var _init = arguments.callee;
12020      this._data = this.config.data;
12021      this.callParent(_init, arguments);
12022    }, _initEvents:function() {
12023      var _initEvents = arguments.callee;
12024      this.callParent(_initEvents, arguments);
12025      this.elOn("click", ".hm-es-event-list-group-trigger", this._onTriggerClick);
12026    }, _render:function() {
12027      var _render = arguments.callee;
12028      var EventAbstract = hm.module.es.ui.event.list.item.EventAbstract, events = this._data.get("events"), eventItems = [], limit = 3, shortList = !this.config.eventList.config.fullMode, itemsCount = events.getItemsCount();
12029      if (shortList) {
12030        limit = 1;
12031      }
12032      if (!this.config.collapsible) {
12033        limit = itemsCount;
12034      }
12035      for (var i = 0;i < itemsCount;i++) {
12036        var event = events.getItem(i);
12037        event.on("change_view_state", this._onEventMarkedAsViewed, this);
12038        if (shortList && (i >= limit && event.get("description").get("views"))) {
12039          continue;
12040        }
12041        var ev = EventAbstract.factory({eventTypeStr:event.get("eventTypeStr"), data:event});
12042        eventItems.push(ev);
12043      }
12044      eventItems.sort(function(a, b) {
12045        return b.getData().get("eventCreateTime") - a.getData().get("eventCreateTime");
12046      });
12047      this.events = eventItems;
12048      this.callParent(_render, arguments);
12049      var $cont = this.$elEventsCont = this.getEl().find(".hm-es-event-list-group-events");
12050      for (var i = 0;i < eventItems.length;i++) {
12051        $cont.append(eventItems[i].getEl());
12052      }
12053      this.setAvatar();
12054      this.updateIsNewStatus();
12055    }, getNewEventsCount:function() {
12056      var events = this.events, result = 0;
12057      for (var i = 0;i < events.length;i++) {
12058        if (events[i].isNew()) {
12059          result++;
12060        }
12061      }
12062      return result;
12063    }, updateIsNewStatus:function() {
12064      var newEventsCount = this.getNewEventsCount();
12065      if (newEventsCount) {
12066        this.getEl().addClass("hm-es-event-list-group-with-new-events");
12067      } else {
12068        this.getEl().removeClass("hm-es-event-list-group-with-new-events");
12069      }
12070    }, getEventItemById:function(eventId) {
12071      var eventId, events = this.events;
12072      for (var i = 0;i < events.length;i++) {
12073        eventId = events[i].getEventId();
12074        if (eventId == eventId) {
12075          return events[i];
12076        }
12077      }
12078    }, setCollapsed:function(collapse) {
12079      var events = this.events;
12080      if (collapse) {
12081        for (var i = 2;i < events.length;i++) {
12082          events[i].hide();
12083        }
12084        this._$elTrigger.text(HM._("Показать предыдущие"));
12085      } else {
12086        for (var i = 2;i < events.length;i++) {
12087          events[i].show();
12088        }
12089        this._$elTrigger.text(HM._("Скрыть предыдущие"));
12090      }
12091      this._collapsed = collapse;
12092    }, setAvatar:function() {
12093      var desc = this._data.get("description"), avatar = desc.author_avatar || desc.user_avatar;
12094      if (!avatar) {
12095        return;
12096      }
12097      this.getEl().find(".hm-es-event-list-group-avatar").css({backgroundImage:"url(" + avatar + ")"});
12098    }, getTypeTitle:function() {
12099      if (this.isInternal()) {
12100        return HM._("Учебный курс");
12101      } else {
12102        return HM._("Основной канал");
12103      }
12104    }, getGroupName:function() {
12105      return this._data.get("description").theme;
12106    }, filterByGroupType:function(groupType) {
12107      if (!groupType) {
12108        this.isVisible = groupIsVisible;
12109        this.getEl().show();
12110        return;
12111      }
12112      var events = this.events, groupIsVisible = false;
12113      for (var i = 0;i < events.length;i++) {
12114        var event = events[i];
12115        if (event.getGroupType() === groupType) {
12116          groupIsVisible = true;
12117        }
12118      }
12119      if (groupIsVisible) {
12120        this.getEl().show();
12121      } else {
12122        this.getEl().hide();
12123      }
12124      this.isVisible = groupIsVisible;
12125    }, isInternal:function() {
12126      var events = this.events, groupIsInternal = false;
12127      for (var i = 0;i < events.length;i++) {
12128        var event = events[i];
12129        if (event.config.isInternal) {
12130          return true;
12131        }
12132      }
12133      return false;
12134    }, getAuthorUrl:function() {
12135      return HM.getService("User").getUserUrl(this._data.get("description").author_id);
12136    }, getAuthorName:function() {
12137      return this._data.get("description").author_name;
12138    }, needShowMoreIcon:function() {
12139      return!!this.getGroupName();
12140    }, _onTriggerClick:function(e) {
12141      this.setCollapsed(!this._collapsed);
12142    }, _onEventMarkedAsViewed:function(e) {
12143      this.updateIsNewStatus();
12144    }});
12145    (function() {
12146      var classMapper = {FORUM_MESSAGE_ADD:"hm.module.es.ui.event.list.group.forum.ForumMessagesEventGroup", WIKI_PAGE:"hm.module.es.ui.event.list.group.wiki.WikiEventGroup", COURSE_ACTIVITY:"hm.module.es.ui.event.list.group.notification.DefaultNotificationEventGroup", PERSONAL_MESSAGE_SEND:"hm.module.es.ui.event.list.group.message.MessageEventGroup"};
12147      var titleMapper = {FORUM_MESSAGE_ADD:HM._("Форум"), BLOG_MESSAGE_ADD:HM._("Блог"), WIKI_PAGE:"Wiki"};
12148      hm.module.es.ui.event.list.group.DefaultEventGroup.factory = function(data) {
12149        var className = "hm.module.es.ui.event.list.group.DefaultEventGroup", groupType = data.type;
12150        if (classMapper.hasOwnProperty(groupType)) {
12151          className = classMapper[groupType];
12152        }
12153        if (titleMapper.hasOwnProperty(groupType)) {
12154          data.groupTitle = titleMapper[groupType];
12155        }
12156        return HM.create(className, data);
12157      };
12158    })();
12159    self = hm.module.es.ui.event.list.group.DefaultEventGroup;
12160  })();
12161  (function() {
12162    var self;
12163    HM.define("hm.module.es.ui.event.list.EventList", {extend:"hm.core.ui.Component", requires:["hm.module.es.data.store.EventServiceStore", "hm.module.es.data.store.EventServiceTopStore", "hm.module.es.ui.event.list.group.DefaultEventGroup"], config:{tpl:"hm/module/es/ui/event/list/EventList", fullMode:false, store:null, showHeader:true, groupsCollapsible:true}, _init:function() {
12164      var _init = arguments.callee;
12165      this._store = this.config.store;
12166      this.groups = [];
12167      this.callParent(_init, arguments);
12168    }, _initEvents:function() {
12169      var _initEvents = arguments.callee;
12170      this.callParent(_initEvents, arguments);
12171      this._store.on("data_loaded", this._onDataLoaded, this);
12172      this.elOn("click", ".hm-es-event-list-url", this._onClickShowAll);
12173    }, getStore:function() {
12174      return this._store;
12175    }, filterByGroupType:function(groupType) {
12176      var groups = this.groups, listIsEmpty = true;
12177      for (var i = 0;i < groups.length;i++) {
12178        groups[i].filterByGroupType(groupType);
12179        if (groups[i].isVisible) {
12180          listIsEmpty = false;
12181        }
12182      }
12183      if (listIsEmpty) {
12184        this.getEl().find(".hm-es-event-list-body-empty").show();
12185      } else {
12186        this.getEl().find(".hm-es-event-list-body-empty").hide();
12187      }
12188    }, setTitle:function(title) {
12189      this.getEl().find(".hm-es-event-list-title").text(title);
12190    }, setEmptyMessage:function(message) {
12191      this.getEl().find(".hm-es-event-list-body-empty").text(HM._(message));
12192    }, loadNext:function() {
12193      this._store.loadMore();
12194    }, getEventItemById:function(eventId) {
12195      var event, groups = this.groups;
12196      for (var i = 0;i < groups.length;i++) {
12197        event = groups[i].getEventItemById();
12198        if (event) {
12199          return event;
12200        }
12201      }
12202    }, _onDataLoaded:function(e, store, items, method) {
12203      if (!this.config.fullMode && method === "more") {
12204        return;
12205      }
12206      var $elBody = this.getEl().find(".hm-es-event-list-body"), DefaultEventGroup = hm.module.es.ui.event.list.group.DefaultEventGroup, groups = [];
12207      for (var i = 0;i < items.length;i++) {
12208        var group = groups[i] = DefaultEventGroup.factory({type:items[i].get("type"), eventList:this, data:items[i], collapsible:this.config.groupsCollapsible});
12209        $elBody.append(group.getEl());
12210      }
12211      this.groups.push.apply(this.groups, groups);
12212    }, _onClickShowAll:function(e) {
12213      e.preventDefault();
12214      HM.getService("EventService").viewFullList();
12215    }, _onEventMarkedAsViewed:function(e, eventId, groupType) {
12216      var eventItem = this.getEventItemById(eventId);
12217      if (eventItem) {
12218        eventItem.markAsNotNew(true);
12219      }
12220    }});
12221    self = hm.module.es.ui.event.list.EventList;
12222  })();
12223  (function() {
12224    var self;
12225    HM.define("hm.module.es.ui.event.list.group.forum.ForumMessagesEventGroup", {extend:"hm.module.es.ui.event.list.group.DefaultEventGroup", config:{}});
12226    self = hm.module.es.ui.event.list.group.forum.ForumMessagesEventGroup;
12227  })();
12228  (function() {
12229    var self;
12230    HM.define("hm.module.es.ui.event.list.group.message.MessageEventGroup", {extend:"hm.module.es.ui.event.list.group.DefaultEventGroup", config:{tpl:"hm/module/es/ui/event/list/group/message/MessageEventGroup"}});
12231    self = hm.module.es.ui.event.list.group.message.MessageEventGroup;
12232  })();
12233  (function() {
12234    var self;
12235    HM.define("hm.module.es.ui.event.list.group.notification.DefaultNotificationEventGroup", {extend:"hm.module.es.ui.event.list.group.DefaultEventGroup", config:{tpl:"hm/module/es/ui/event/list/group/notification/DefaultNotificationEventGroup"}, getCourseName:function() {
12236      return this._data.get("description").course_name;
12237    }});
12238    self = hm.module.es.ui.event.list.group.notification.DefaultNotificationEventGroup;
12239  })();
12240  (function() {
12241    var self;
12242    HM.define("hm.module.es.ui.event.list.group.wiki.WikiEventGroup", {extend:"hm.module.es.ui.event.list.group.DefaultEventGroup", getGroupName:function() {
12243      return "";
12244    }});
12245    self = hm.module.es.ui.event.list.group.wiki.WikiEventGroup;
12246  })();
12247  (function() {
12248    var self;
12249    HM.define("hm.module.es.ui.event.list.item.blog.BlogAddMessage", {extend:"hm.module.es.ui.event.list.item.EventAbstract", config:{tpl:"hm/module/es/ui/event/list/item/blog/BlogAddMessage"}, viewEntity:function() {
12250      var subjectId = 0, url, blogService = HM.getService("Blog");
12251      if (this.isInternal) {
12252        subjectId = this.description.course_id;
12253        url = blogService.getBlogListUrl(subjectId, "subject");
12254      } else {
12255        url = blogService.getBlogListUrl();
12256      }
12257      location.href = url + "?eventId=" + this.getEventId();
12258    }});
12259    self = hm.module.es.ui.event.list.item.blog.BlogAddMessage;
12260  })();
12261  (function() {
12262    var self;
12263    HM.define("hm.module.es.ui.event.list.item.blog.BlogInternalAddMessage", {extend:"hm.module.es.ui.event.list.item.blog.BlogAddMessage", config:{isInternal:true}});
12264    self = hm.module.es.ui.event.list.item.blog.BlogInternalAddMessage;
12265  })();
12266  (function() {
12267    var self;
12268    HM.define("hm.module.es.ui.event.list.item.course.CourseAddMaterial", {extend:"hm.module.es.ui.event.list.item.EventAbstract", config:{tpl:"hm/module/es/ui/event/list/item/course/CourseAddMaterial", groupType:"notifications"}, viewEntity:function() {
12269      var subjectId = this.description.course_id;
12270      if (!subjectId) {
12271        subjectId = this.description.cource_id;
12272      }
12273      location.href = HM.getService("CourseMaterialService").getListUrl(subjectId) + "?eventId=" + this.getEventId();
12274    }});
12275    self = hm.module.es.ui.event.list.item.course.CourseAddMaterial;
12276  })();
12277  (function() {
12278    var self;
12279    HM.define("hm.module.es.ui.event.list.item.course.CourseAttachLesson", {extend:"hm.module.es.ui.event.list.item.EventAbstract", config:{tpl:"hm/module/es/ui/event/list/item/course/CourseAttachLesson", groupType:"notifications"}, viewEntity:function() {
12280      var subjectId = this.description.course_id;
12281      location.href = HM.getService("CourseLesson").getMyLessonsListUrl(subjectId) + "?eventId=" + this.getEventId();
12282    }});
12283    self = hm.module.es.ui.event.list.item.course.CourseAttachLesson;
12284  })();
12285  (function() {
12286    var self;
12287    HM.define("hm.module.es.ui.event.list.item.course.CourseScoreTriggered", {extend:"hm.module.es.ui.event.list.item.EventAbstract", config:{groupType:"notifications", tpl:"hm/module/es/ui/event/list/item/course/CourseScoreTriggered"}, viewEntity:function() {
12288      var subjectId = this.description.course_id;
12289      location.href = HM.getService("CourseLesson").getMyLessonsListUrl(subjectId) + "?eventId=" + this.getEventId();
12290    }});
12291    self = hm.module.es.ui.event.list.item.course.CourseScoreTriggered;
12292  })();
12293  (function() {
12294    var self;
12295    HM.define("hm.module.es.ui.event.list.item.course.CourseTaskAction", {extend:"hm.module.es.ui.event.list.item.EventAbstract", config:{groupType:"notifications", tpl:"hm/module/es/ui/event/list/item/course/CourseTaskAction"}, viewEntity:function() {
12296      var userService = HM.getService("User"), lessonService = HM.getService("CourseLesson"), isBaseUser = userService.isBaseUser(), subjectId = this.description.course_id, url;
12297      url = lessonService.getMyLessonsListUrl(subjectId);
12298      location.href = url + "?eventId=" + this.getEventId();
12299    }});
12300    self = hm.module.es.ui.event.list.item.course.CourseTaskAction;
12301  })();
12302  (function() {
12303    var self;
12304    HM.define("hm.module.es.ui.event.list.item.course.CourseTaskComplete", {extend:"hm.module.es.ui.event.list.item.EventAbstract", config:{groupType:"notifications", tpl:"hm/module/es/ui/event/list/item/course/CourseTaskComplete"}, viewEntity:function() {
12305      var subjectId = this.description.course_id;
12306      location.href = HM.getService("CourseLesson").getLessonListUrl(subjectId) + "?eventId=" + this.getEventId();
12307    }});
12308    self = hm.module.es.ui.event.list.item.course.CourseTaskComplete;
12309  })();
12310  (function() {
12311    var self;
12312    HM.define("hm.module.es.ui.event.list.item.course.CourseTaskScoreTriggered", {extend:"hm.module.es.ui.event.list.item.EventAbstract", config:{tpl:"hm/module/es/ui/event/list/item/course/CourseTaskScoreTriggered", groupType:"notifications"}, viewEntity:function() {
12313      var subjectId = this.description.course_id;
12314      location.href = HM.getService("CourseLesson").getMyLessonsListUrl(subjectId) + "?eventId=" + this.getEventId();
12315    }});
12316    self = hm.module.es.ui.event.list.item.course.CourseTaskScoreTriggered;
12317  })();
12318  (function() {
12319    var self;
12320    HM.define("hm.module.es.ui.event.list.item.forum.ForumAddMessage", {extend:"hm.module.es.ui.event.list.item.EventAbstract", config:{isInternal:false, tpl:"hm/module/es/ui/event/list/item/forum/ForumAddMessage"}, viewEntity:function() {
12321      var sectionId = this.description.section_id, forum_id = this.description.forum_id;
12322      HM.getService("Forum").viewForum(sectionId, forum_id);
12323    }});
12324    self = hm.module.es.ui.event.list.item.forum.ForumAddMessage;
12325  })();
12326  (function() {
12327    var self;
12328    HM.define("hm.module.es.ui.event.list.item.forum.ForumInternalAddMessage", {extend:"hm.module.es.ui.event.list.item.forum.ForumAddMessage", config:{isInternal:true}, viewEntity:function() {
12329      var sectionId = this.description.section_id, subject_id = this.description.course_id;
12330      HM.getService("Forum").viewInternalForumUrl(subject_id, sectionId);
12331    }});
12332    self = hm.module.es.ui.event.list.item.forum.ForumInternalAddMessage;
12333  })();
12334  (function() {
12335    var self;
12336    HM.define("hm.module.es.ui.event.list.item.personalMessage.PersonalMessage", {extend:"hm.module.es.ui.event.list.item.EventAbstract", config:{tpl:"hm/module/es/ui/event/list/item/personalMessage/PersonalMessage", groupType:"personalMessages"}, viewEntity:function() {
12337      var url = HM.getService("Message").getMessageListUrl(), author_id = this.getAuthorId();
12338      location.href = url + "?from=" + author_id;
12339    }});
12340    self = hm.module.es.ui.event.list.item.personalMessage.PersonalMessage;
12341  })();
12342  (function() {
12343    var self;
12344    HM.define("hm.module.es.ui.event.list.item.wiki.WikiPage", {extend:"hm.module.es.ui.event.list.item.EventAbstract", config:{tpl:"hm/module/es/ui/event/list/item/wiki/WikiPage"}, _init:function() {
12345      var _init = arguments.callee;
12346      switch(this.config.eventTypeStr) {
12347        case "wikiAddPage":
12348        ;
12349        case "wikiInternalAddPage":
12350          this.actionTitle = HM._("создал(а)");
12351          break;
12352        case "wikiModifyPage":
12353        ;
12354        case "wikiInternalModifyPage":
12355          this.actionTitle = HM._("изменил(а)");
12356          break;
12357      }
12358      this.callParent(_init, arguments);
12359    }, viewEntity:function() {
12360      var page_id = this.description.subjectId;
12361      location.href = HM.getService("Wiki").getPageUrl(page_id) + "?eventId=" + this.getEventId();
12362    }});
12363    self = hm.module.es.ui.event.list.item.wiki.WikiPage;
12364  })();
12365  (function() {
12366    var self;
12367    HM.define("hm.module.es.ui.event.list.item.wiki.WikiInternalPage", {extend:"hm.module.es.ui.event.list.item.wiki.WikiPage", config:{isInternal:true}, viewEntity:function() {
12368      var page_id = this.description.subjectId, subject = "subject", subject_id = this.description.course_id;
12369      location.href = HM.getService("Wiki").getPageUrl(page_id, subject_id, subject) + "?eventId=" + this.getEventId();
12370    }});
12371    self = hm.module.es.ui.event.list.item.wiki.WikiInternalPage;
12372  })();
12373  (function() {
12374    var self;
12375    HM.define("hm.module.es.ui.event.panel.EventListPanel", {extend:"hm.core.ui.Component", config:{tpl:"hm/module/es/ui/event/panel/EventListPanel"}, _init:function() {
12376      var _init = arguments.callee;
12377      this.callParent(_init, arguments);
12378      this._toolbar = HM.create("hm.module.es.ui.event.toolbar.EventToolbar", {fullMode:true, renderTo:false, revertButtonList:true, autoLoad:true});
12379      this._eventList = this._toolbar.getEventList();
12380      this._$elCont = this.getEl().find(".hm-es-event-list-container");
12381      this._$elCont.append(this._toolbar.getEl());
12382      this._$elCont.append(this._eventList.getEl());
12383    }, _initEvents:function() {
12384      var _initEvents = arguments.callee;
12385      this.elOn("click", ".hm-es-event-panel-trigger", this._onClickShowNext);
12386      this.callParent(_initEvents, arguments);
12387    }, _onClickShowNext:function() {
12388      this._eventList.loadNext();
12389    }});
12390    self = hm.module.es.ui.event.panel.EventListPanel;
12391  })();
12392  (function() {
12393    var self;
12394    HM.define("hm.module.es.ui.event.toolbar.button.EventToolbarButton", {extend:"hm.core.ui.Component", config:{tpl:"hm/module/es/ui/event/toolbar/button/EventToolbarButton", groupType:"discussions", emptyMessage:"", toolbar:null, caption:"", count:0}, _init:function() {
12395      var _init = arguments.callee;
12396      this.callParent(_init, arguments);
12397      this._toolbar = this.config.toolbar;
12398      this._fullMode = this._toolbar.config.fullMode;
12399      this._$elIcon = this.getEl().find(".hm-es-event-toolbar-button-icon");
12400      if (this.config.count > 0) {
12401        this._$elIcon.addClass("hm-es-event-toolbar-button-new-events");
12402      } else {
12403        this._$elIcon.removeClass("hm-es-event-toolbar-button-new-events");
12404      }
12405    }, _initEvents:function() {
12406      var _initEvents = arguments.callee;
12407      this.callParent(_initEvents, arguments);
12408      if (this._fullMode) {
12409      } else {
12410        this.elOn("click", ".hm-es-event-toolbar-button-icon-tab", this._onClick);
12411      }
12412    }, select:function() {
12413      var $el = this.getEl(), toolbar = this._toolbar;
12414      this.selected = true;
12415      $el.addClass("hm-es-event-toolbar-button-selected");
12416      toolbar.setSelectedButton(this);
12417      var eventList = toolbar.getEventList(), $tab = $el.find(".hm-es-event-toolbar-button-icon-tab"), tabOffset = $tab.offset(), $eventListEl = eventList.getEl(), me = this;
12418      eventList.setTitle(this.config.caption);
12419      eventList.filterByGroupType(this.config.groupType);
12420      eventList.setEmptyMessage(this.config.emptyMessage);
12421      if (!this._fullMode) {
12422        hm.core.PopupManager.show($eventListEl[0], function() {
12423          me.unSelect(true);
12424        });
12425        var eventListWidth = $eventListEl.outerWidth();
12426        $eventListEl.css({top:tabOffset.top + $tab.outerHeight(), position:"absolute"});
12427        if (eventListWidth + tabOffset.left > document.body.offsetWidth) {
12428          $eventListEl.css({right:10, left:""});
12429        } else {
12430          $eventListEl.css({left:tabOffset.left - 30, right:""});
12431        }
12432      }
12433    }, unSelect:function(dontDetachEventList) {
12434      this.selected = false;
12435      this.getEl().removeClass("hm-es-event-toolbar-button-selected");
12436      if (!dontDetachEventList && !this._fullMode) {
12437        this._toolbar.getEventList().getEl().detach();
12438      }
12439    }, setStat:function(stat) {
12440      this.setNewEventsCount(stat.not_showed_event);
12441    }, setNewEventsCount:function(value) {
12442      this.newEventsCount = value;
12443      this._$elIcon.text(value);
12444      if (this.newEventsCount > 0) {
12445        this._$elIcon.addClass("hm-es-event-toolbar-button-new-events");
12446      } else {
12447        this._$elIcon.removeClass("hm-es-event-toolbar-button-new-events");
12448      }
12449    }, decrementNewEventsCount:function() {
12450      this.setNewEventsCount(this.newEventsCount - 1);
12451    }, _onClick:function(e) {
12452      e.stopPropagation();
12453      if (typeof this._toolbar._eventList === "undefined") {
12454        this._toolbar._eventList = HM.create("hm.module.es.ui.event.list.EventList", {fullMode:this.config.fullMode, store:hm.module.es.data.store.EventServiceTopStore.getInstance()});
12455        var proxy = this._toolbar._eventList.getStore().getProxy();
12456        proxy.on("data_loaded", this._toolbar._onDataLoaded, this._toolbar);
12457        var self = this;
12458        setTimeout(function() {
12459          proxy.on("data_loaded", self.select, self);
12460        }, 10);
12461      } else {
12462        if (this.selected) {
12463          this.unSelect();
12464          this._toolbar.getEventList().filterByGroupType(false);
12465        } else {
12466          this.select();
12467        }
12468      }
12469    }});
12470    self = hm.module.es.ui.event.toolbar.button.EventToolbarButton;
12471  })();
12472  (function() {
12473    var self;
12474    HM.define("hm.module.es.ui.event.toolbar.EventToolbar", {extend:"hm.core.ui.Component", requires:["hm.module.es.ui.event.toolbar.button.EventToolbarButton"], config:{tpl:"hm/module/es/ui/event/toolbar/EventToolbar", fullMode:false, revertButtonList:false, newPersonalMessages:0, newDiscussions:0, newNotifications:0, autoLoad:false}, _init:function() {
12475      var _init = arguments.callee;
12476      this.callParent(_init, arguments);
12477      var $el = this.getEl();
12478      if (this.config.autoLoad) {
12479        this._eventList = HM.create("hm.module.es.ui.event.list.EventList", {fullMode:this.config.fullMode, store:hm.module.es.data.store.EventServiceStore.getInstance()});
12480        var proxy = this._eventList.getStore().getProxy();
12481        proxy.on("data_loaded", this._onDataLoaded, this);
12482      }
12483      var ButtonClass = "hm.module.es.ui.event.toolbar.button.EventToolbarButton";
12484      this._btnMessages = HM.create(ButtonClass, {toolbar:this, caption:HM._("Сообщения"), emptyMessage:HM._("Новых сообщений нет"), groupType:"personalMessages"});
12485      this._btnDiscussions = HM.create(ButtonClass, {toolbar:this, caption:HM._("Обсуждения"), emptyMessage:HM._("Новых обсуждений нет"), groupType:"discussions"});
12486      this._btnNotifications = HM.create(ButtonClass, {toolbar:this, caption:HM._("Оповещения"), emptyMessage:HM._("Новых оповещений нет"), groupType:"notifications"});
12487      var buttonElements = [this._btnMessages.getEl(), this._btnDiscussions.getEl(), this._btnNotifications.getEl()];
12488      this._btnDiscussions.setNewEventsCount(this.config.newDiscussions);
12489      this._btnMessages.setNewEventsCount(this.config.newPersonalMessages);
12490      this._btnNotifications.setNewEventsCount(this.config.newNotifications);
12491      if (this.config.revertButtonList) {
12492        buttonElements.reverse();
12493      }
12494      $el.append.apply($el, buttonElements);
12495      this.__pageCountCache = 0;
12496    }, _initEvents:function() {
12497      var _initEvents = arguments.callee;
12498      this.callParent(_initEvents, arguments);
12499      HM.$window().on("resize", this._onWindowResize.bind(this));
12500    }, _renderTo:function() {
12501      var _renderTo = arguments.callee;
12502      this.callParent(_renderTo, arguments);
12503      this._$logoutLink = this._$elRenderTo.find(".logout");
12504      this._fixPosition();
12505    }, _fixPosition:function() {
12506      if (this._$logoutLink) {
12507        var $el = this.getEl(), elWidth = $el.width(), logoutOffset = this._$logoutLink.length ? this._$logoutLink.position().left : elWidth;
12508        $el.css({left:logoutOffset - elWidth - 10 + "px"});
12509      }
12510    }, loadData:function(data) {
12511      data = data || {};
12512      var stats = data.stats || [];
12513      for (var i = 0;i < stats.length;i++) {
12514        var stat = stats[i];
12515        switch(stat.group_type) {
12516          case "discussions":
12517            this._btnDiscussions.setStat(stat);
12518            break;
12519          case "personalMessages":
12520            this._btnMessages.setStat(stat);
12521            break;
12522          case "notifications":
12523            this._btnNotifications.setStat(stat);
12524            break;
12525        }
12526      }
12527      if (data.pageCount) {
12528        this.__pageCountCache = this._pageCount = data.pageCount;
12529      } else {
12530        this._pageCount = this.__pageCountCache;
12531      }
12532      if (this._pageCount <= this._eventList.getStore()._page) {
12533        this._$elMore = this.getEl().parent().parent().find(".hm-es-event-panel-tr
12533igger");
12534        this._$elMore.hide();
12535      }
12536    }, getEventList:function() {
12537      return this._eventList;
12538    }, setSelectedButton:function(button) {
12539      if (this._selectedButton === button) {
12540        return;
12541      }
12542      if (this._selectedButton) {
12543        this._selectedButton.unSelect();
12544      }
12545      this._selectedButton = button;
12546    }, getButtonByType:function(type) {
12547      switch(type) {
12548        case "discussions":
12549          return this._btnDiscussions;
12550        case "personalMessages":
12551          return this._btnMessages;
12552        case "notifications":
12553          return this._btnNotifications;
12554      }
12555    }, _onDataLoaded:function(e, data) {
12556      var items = data.items, ln = items.length;
12557      for (var i = 0;i < ln;i++) {
12558        items[i].on("event_change_view_state", this._onEventViewStateChange, this);
12559      }
12560      this.loadData(data.source);
12561    }, _onWindowResize:function() {
12562      this._fixPosition();
12563    }, _onEventViewStateChange:function(e, event, isViewed) {
12564      var groupCode = event.getEventGroup();
12565      this.getButtonByType(groupCode).decrementNewEventsCount();
12566    }});
12567    self = hm.module.es.ui.event.toolbar.EventToolbar;
12568  })();
12569  (function() {
12570    var self;
12571    HM.define("hm.module.messenger.data.filter.UserFilter", {extend:"hm.core.data.filter.EqualFilter", config:{field:["author_id", "recipient_id"], value:""}, filter:function(data) {
12572      if (this.config.clean) {
12573        return true;
12574      }
12575      var fields = this.config.field;
12576      if (fields) {
12577        if (!_.isArray(fields)) {
12578          fields = [fields];
12579        }
12580        var fieldData;
12581        for (var i = 0;i < fields.length;i++) {
12582          if (data instanceof hm.core.data.Model) {
12583            fieldData = data.get(fields[i]);
12584          } else {
12585            fieldData = data[fields[i]];
12586          }
12587          if (this._filter(fieldData)) {
12588            return true;
12589          }
12590        }
12591        return false;
12592      }
12593      return this._filter(data);
12594    }});
12595    hm.core.data.filter.AbstractFilter.register(hm.module.messenger.data.filter.UserFilter);
12596    self = hm.module.messenger.data.filter.UserFilter;
12597  })();
12598  (function() {
12599    var self;
12600    HM.define("hm.module.messenger.ui.Messenger", {extend:"hm.core.ui.Component", config:{tplByClass:true, classNameSpace:"hm-messenger", currentUserId:0, urls:{getNew:"", markViewed:""}}, _init:function() {
12601      var _init = arguments.callee;
12602      this.callParent(_init, arguments);
12603      this._$messagesListWrap = this.getNs().find("messages-list-wrap");
12604      this._initMessagesStore();
12605      this._initLists();
12606    }, render:function() {
12607      var render = arguments.callee;
12608      this.callParent(render, arguments);
12609      this._initInput();
12610      this._initUpdateButton();
12611      this.update();
12612    }, _initUpdateButton:function() {
12613      this.getEl().find("#update").on("click", _.bind(this._onUpdateRequested, this));
12614    }, _initInput:function() {
12615      this._input = HM.create("hm.module.messenger.ui.input.Input", {renderTo:this.getNs().find("input-wrap"), listeners:{scope:this, submit:this._onInputSubmit, submitted:this._onUpdateRequested}});
12616    }, _initMessagesStore:function() {
12617      this._messagesStore = HM.create("hm.module.messenger.ui.message.MessagesList", {dataUrl:this.config.urls.getNew, listeners:{scope:this, message_viewed:this._onMessageViewed, data_loaded:this._onMessagesLoaded}});
12618    }, _initLists:function() {
12619      var ns = this.getNs();
12620      this._contactsList = HM.create("hm.module.messenger.ui.contact.ContactsList", {autoRender:true, renderTo:ns.find("contacts-list-wrap"), listeners:{scope:this, contact_ctrl_click:this._onContactCtrlClick, before_contact_selected:this._hidePlaceholder, contact_selected:this._onContactSelected}});
12621    }, _onInputSubmit:function() {
12622      this._disableButtons();
12623    }, _onUpdateRequested:function() {
12624      var input = this.getInput(), updateButton = input.getUpdateButton();
12625      if (this._updatingText === undefined) {
12626        this._updatingText = HM._("Проверка сообщений");
12627      }
12628      input.setButtonText(updateButton, this._updatingText);
12629      this.update();
12630    }, _onMessageViewed:function(event, message) {
12631      if (this._markViewedQueue === undefined) {
12632        this._markViewedQueue = [];
12633      }
12634      this._markViewedQueue.push(message.getEventId());
12635      if (this._markViewedTimer !== undefined) {
12636        clearTimeout(this._markViewedTimer);
12637        this._markViewedTimer = undefined;
12638      }
12639      this._markViewedTimer = setTimeout(_.bind(this._markMessagesViewed, this), 3E3);
12640    }, _markMessagesViewed:function() {
12641      if (this._markViewedQueue.length == 0) {
12642        return;
12643      }
12644      $.ajax({url:this.config.urls.markViewed, type:"post", data:{eventId:this._markViewedQueue}});
12645      this._markViewedQueue = [];
12646    }, _onContactSelected:function(event, contact) {
12647      this._hidePlaceholder();
12648      this.getInput().setContact(contact);
12649    }, _onContactCtrlClick:function(event, contact) {
12650      this.getInput().addContact(contact);
12651    }, _onMessagesLoaded:function(event, store, messages, method) {
12652      var contactsItems = [], contactIds = [this.config.currentUserId], contacts = this.getContactsList().getItems(), contactsById = {}, messagesByContactId = {};
12653      for (var i = 0, ln = contacts.length;i < ln;i++) {
12654        var contactId = contacts[i].getId();
12655        contactIds.push(contactId);
12656        contactsById[contactId] = contacts[i];
12657      }
12658      for (var i = 0, ln = messages.length;i < ln;i++) {
12659        var message = messages[i], contactId, contactName, contactIcon;
12660        if (message.isMy()) {
12661          contactId = message.getRecipientId();
12662          contactName = message.getRecipientName();
12663          contactIcon = message.getRecipientPhoto();
12664        } else {
12665          contactId = message.getAuthorId();
12666          contactName = message.getAuthorName();
12667          contactIcon = message.getAuthorPhoto();
12668        }
12669        if (messagesByContactId[contactId] === undefined) {
12670          messagesByContactId[contactId] = [];
12671        }
12672        messagesByContactId[contactId].push(message);
12673        if (contactIds.indexOf(contactId) === -1) {
12674          var contact = HM.create("hm.module.messenger.ui.contact.Contact", {data:{contact_id:contactId, contact_name:contactName, contact_icon:contactIcon}});
12675          contactsItems.push(contact);
12676          contactIds.push(contactId);
12677          contactsById[contactId] = contact;
12678        }
12679      }
12680      if (contactsItems.length != 0) {
12681        this.getContactsList().loadData(contactsItems);
12682      }
12683      for (var contactId in contactsById) {
12684        if (!contactsById.hasOwnProperty(contactId)) {
12685          continue;
12686        }
12687        if (messagesByContactId[contactId]) {
12688          contactsById[contactId].getMessagesList(this._$messagesListWrap).loadData(messagesByContactId[contactId]);
12689        }
12690      }
12691      this._enableButtons();
12692    }, getInput:function() {
12693      return this._input;
12694    }, update:function() {
12695      this._disableButtons();
12696      this.getMessagesStore().loadData(null, {clientTime:hm.core.Date.format(new Date, "dd.mm.yyyy HH:MM:ss")});
12697    }, getMessagesStore:function() {
12698      return this._messagesStore;
12699    }, getContactsList:function() {
12700      return this._contactsList;
12701    }, _disableButtons:function() {
12702      if (this._buttonsDisabled) {
12703        return;
12704      }
12705      this._buttonsDisabled = true;
12706      var input = this.getInput(), submitButton = input.getSubmitButton(), updateButton = input.getUpdateButton();
12707      submitButton.attr("disabled", "disabled");
12708      updateButton.attr("disabled", "disabled");
12709    }, _enableButtons:function() {
12710      if (!this._buttonsDisabled) {
12711        return;
12712      }
12713      this._buttonsDisabled = false;
12714      var input = this.getInput(), submitButton = input.getSubmitButton(), updateButton = input.getUpdateButton();
12715      input.resetButtonText(updateButton);
12716      submitButton.removeAttr("disabled");
12717      updateButton.removeAttr("disabled");
12718    }, _hidePlaceholder:function() {
12719      this.getNs().find("messages-placeholder").remove();
12720      this._hidePlaceholder = HM.emptyFn;
12721    }});
12722    self = hm.module.messenger.ui.Messenger;
12723  })();
12724  (function() {
12725    var self;
12726    HM.define("hm.module.messenger.ui.input.Input", {extend:"hm.core.ui.Component", config:{form:"#messengerform", tplByClass:true, classNameSpace:"hm-messenger-input"}, _init:function() {
12727      var _init = arguments.callee;
12728      this.callParent(_init, arguments);
12729      this._initForm();
12730    }, _initForm:function() {
12731      var $form = $(this.config.form);
12732      $form.on("submit", _.bind(this._onSubmit, this));
12733      this.getEl().append($form);
12734      this._originalText = {};
12735      this._$form = $form;
12736      this._$submitButton = $form.find("#submit");
12737      this._$updateButton = $form.find("#update");
12738      this._disabledText = HM._("Отправка сообщения");
12739    }, _onSubmit:function(e) {
12740      e.preventDefault();
12741      var $form = this._getForm();
12742      this._submitting = true;
12743      this.setButtonText(this.getSubmitButton(), this._disabledText);
12744      this.fireEvent("submit", this);
12745      $.ajax({url:$form.attr("action"), type:"POST", data:$form.serialize(), success:_.bind(this._onSubmitted, this)});
12746    }, _onSubmitted:function(data) {
12747      this._submitting = false;
12748      this.resetButtonText(this.getSubmitButton());
12749      this.fireEvent("submitted", this, data);
12750      tinyMCE.activeEditor.setContent("");
12751    }, getFcbkcomplete:function() {
12752      return this.getEl().find(".fcbkcomplete");
12753    }, addContact:function(contact) {
12754      var $fcbkcomplete = this.getFcbkcomplete();
12755      $fcbkcomplete.trigger("removeItem", [{value:contact.getId()}]);
12756      $fcbkcomplete.trigger("addItem", [{title:contact.getName(), value:contact.getId()}]);
12757    }, setContact:function(contact) {
12758      var $fcbkcomplete = this.getFcbkcomplete();
12759      if (this._lastSelectedContact) {
12760        $fcbkcomplete.trigger("removeItem", [{value:this._lastSelectedContact.getId()}]);
12761      }
12762      this.addContact(contact);
12763      this._lastSelectedContact = contact;
12764    }, isSubmitting:function() {
12765      return this._submitting;
12766    }, setButtonText:function($button, text) {
12767      var buttonId = $button.attr("id");
12768      if (this._originalText[buttonId] === undefined) {
12769        this._originalText[buttonId] = $button.val() || $button.text();
12770      }
12771      $button.val(text);
12772      $button.text(text);
12773    }, resetButtonText:function($button) {
12774      var buttonId = $button.attr("id");
12775      if (this._originalText[buttonId] !== undefined) {
12776        $button.val(this._originalText[buttonId]);
12777        $button.text(this._originalText[buttonId]);
12778      }
12779    }, getSubmitButton:function() {
12780      return this._$submitButton;
12781    }, getUpdateButton:function() {
12782      return this._$updateButton;
12783    }, _getForm:function() {
12784      return this._$form;
12785    }});
12786    self = hm.module.messenger.ui.input.Input;
12787  })();
12788  (function() {
12789    var self;
12790    HM.define("hm.module.messenger.ui.contact.Contact", {extend:"hm.core.ui.storeList.ListItem", config:{tplByClass:true, classNameSpace:"hm-messenger-contact"}, _init:function() {
12791      var _init = arguments.callee;
12792      this.callParent(_init, arguments);
12793      var ns = this.getNs();
12794      this._$newCount = ns.find("new-count");
12795      this._updateNewMessagesCount();
12796    }, _initEvents:function() {
12797      var _initEvents = arguments.callee;
12798      this.callParent(_initEvents, arguments);
12799      this.elOn("click", null, this._onClick, this);
12800    }, _onClick:function(e) {
12801      e.preventDefault();
12802      if (e.ctrlKey) {
12803        this.fireEvent("ctrl_click", this);
12804      } else {
12805        this.setSelected(true);
12806      }
12807    }, _onMessagesLoaded:function(event, store, messages, method) {
12808      this._updateNewMessagesCount();
12809    }, _onMessagesViewed:function() {
12810      this._updateNewMessagesCount();
12811    }, showMessagesList:function() {
12812      this.getMessagesList().show();
12813    }, hideMessagesList:function() {
12814      this.getMessagesList().hide();
12815    }, getMessagesList:function(renderTo) {
12816      if (this._messagesList === undefined) {
12817        this._messagesList = HM.create("hm.module.messenger.ui.message.MessagesList", {renderTo:renderTo, listeners:{scope:this, data_loaded:this._onMessagesLoaded, message_viewed:this._onMessagesViewed}});
12818      }
12819      return this._messagesList;
12820    }, getId:function() {
12821      return this.get("contact_id");
12822    }, getName:function() {
12823      return this.get("contact_name");
12824    }, getIcon:function() {
12825      return this.get("contact_icon");
12826    }, getNewCount:function() {
12827      return this.getMessagesList().getNewMessagesCount();
12828    }, _updateNewMessagesCount:function() {
12829      var newCount = this.getNewCount();
12830      if (newCount > 0) {
12831        this._$newCount.text(newCount).css("display", "inline-block");
12832      } else {
12833        this._$newCount.hide();
12834      }
12835    }});
12836    self = hm.module.messenger.ui.contact.Contact;
12837  })();
12838  (function() {
12839    var self;
12840    HM.define("hm.module.messenger.ui.message.Message", {extend:"hm.core.ui.storeList.ListItem", config:{tplByClass:true, classNameSpace:"hm-messenger-message"}, _init:function() {
12841      var _init = arguments.callee;
12842      this.callParent(_init, arguments);
12843    }, getIndicator:function() {
12844      if (this._$indicator === undefined) {
12845        this._$indicator = this.getNs().find("indicator");
12846      }
12847      return this._$indicator;
12848    }, getPositionBottom:function(update) {
12849      return this.getHeight(update) + this.getPositionTop(update);
12850    }, getPositionTop:function(update) {
12851      if (this._position === undefined || update) {
12852        var $el = this.getEl();
12853        this._position = $el.position().top + $el.parent().scrollTop();
12854      }
12855      return this._position;
12856    }, getHeight:function(update) {
12857      if (this._itemsContainerHeight === undefined || update) {
12858        this._itemsContainerHeight = this.getEl().height();
12859      }
12860      return this._itemsContainerHeight;
12861    }, setViewed:function() {
12862      if (!this.isNew()) {
12863        return;
12864      }
12865      var indicator = this.getIndicator();
12866      indicator.animate({height:0}, 4E3, function() {
12867        $(this).remove();
12868      });
12869      this.set("viewed", true);
12870      this.fireEvent("viewed", this);
12871    }, isMyClass:function() {
12872      return this.isMy() ? this.getNs().getClass(null, "isMy") : "";
12873    }, isNewClass:function() {
12874      return this.isNew() ? this.getNs().getClass(null, "isNew") : "";
12875    }, isMy:function() {
12876      return!!this.get("is_my");
12877    }, isNew:function() {
12878      return!this.isViewed() && !this.isMy();
12879    }, isViewed:function() {
12880      return!!this.get("viewed");
12881    }, getAuthorId:function() {
12882      return this.get("author_id");
12883    }, getAuthorName:function() {
12884      return this.get("author_name");
12885    }, getAuthorPhoto:function() {
12886      return this.get("author_avatar");
12887    }, getRecipientId:function() {
12888      return this.get("recipient_id");
12889    }, getRecipientName:function() {
12890      return this.get("recipient_name");
12891    }, getRecipientPhoto:function() {
12892      return this.get("recipient_avatar");
12893    }, getEventId:function() {
12894      return this.get("event_id");
12895    }, getDate:function(format) {
12896      var date = new Date(this.get("created"));
12897      if (format) {
12898        return hm.core.Date.format(date, "dd.mm.yyyy HH:MM:ss");
12899      }
12900      return date;
12901    }, getMessage:function() {
12902      return this.get("message");
12903    }, _fixImages:function() {
12904    }, _render:function() {
12905      var _render = arguments.callee;
12906      this.callParent(_render, arguments);
12907      var me = this, ns = this.getNs(), $el = this.getEl();
12908      $el.find("iframe").remove();
12909      var phText = HM._("Показать изображение");
12910      $el.find("img").each(function() {
12911        var $img = $(this), src = $img.attr("src"), $newElement = $('<div class="' + ns.getClass("img-placeholder") + '">' + phText + "</div>");
12912        $newElement.on("click", function() {
12913          $(this).replaceWith($img);
12914          $img.attr("src", src);
12915        });
12916        $img.removeAttr("src");
12917        $img.replaceWith($newElement);
12918      });
12919    }});
12920    self = hm.module.messenger.ui.message.Message;
12921  })();
12922  (function() {
12923    var self;
12924    HM.define("hm.module.messenger.ui.contact.ContactsList", {extend:"hm.core.ui.storeList.List", config:{model:"hm.module.messenger.ui.contact.Contact", tplByClass:true, classNameSpace:"hm-messenger-contacts-list"}, __construct:function() {
12925      var __construct = arguments.callee;
12926      this._contactsById = {};
12927      return this.callParent(__construct, arguments);
12928    }, _init:function(listItem) {
12929      var _init = arguments.callee;
12930      this.callParent(_init, arguments);
12931    }, _itemLoaded:function(item) {
12932      var _itemLoaded = arguments.callee;
12933      this.callParent(_itemLoaded, arguments);
12934      item.on("selected", this._onContactSelected, this);
12935      item.on("ctrl_click", this._onContactCtrlClick, this);
12936    }, _onContactCtrlClick:function(event, item) {
12937      this.fireEvent("contact_ctrl_click", item);
12938    }, _onContactSelected:function(event, item) {
12939      this.fireEvent("before_contact_selected", item);
12940      if (this._lastSelectedItem !== undefined) {
12941        this._lastSelectedItem.setSelected(false, true);
12942        this._lastSelectedItem.hideMessagesList();
12943      }
12944      this._lastSelectedItem = item;
12945      item.showMessagesList();
12946      this.fireEvent("contact_selected", item);
12947    }, getContact:function(contactId) {
12948      if (this._contactsById[contactId] !== undefined) {
12949        return this._contactsById[contactId];
12950      }
12951      var contacts = this.getItems();
12952      for (var i = 0, ln = contacts.length;i < ln;i++) {
12953        if (contacts[i].getId() == contactId) {
12954          this._contactsById = contacts[i];
12955          return contacts[i];
12956        }
12957      }
12958      return undefined;
12959    }});
12960    self = hm.module.messenger.ui.contact.ContactsList;
12961  })();
12962  (function() {
12963    var self;
12964    HM.define("hm.module.messenger.ui.message.MessagesList", {extend:"hm.core.ui.storeList.List", config:{hidden:true, contactId:null, model:"hm.module.messenger.ui.message.Message", tplByClass:true, classNameSpace:"hm-messenger-messages-list"}, __construct:function() {
12965      var __construct = arguments.callee;
12966      this._newMessagesCount = 0;
12967      this._newMessages = {};
12968      return this.callParent(__construct, arguments);
12969    }, _init:function() {
12970      var _init = arguments.callee;
12971      this.callParent(_init, arguments);
12972    }, _initEvents:function() {
12973      this._getItemsContainer().on("scroll", _.bind(this._onScroll, this));
12974    }, _itemLoaded:function(message) {
12975      var _itemLoaded = arguments.callee;
12976      this.callParent(_itemLoaded, arguments);
12977      message.on("viewed", this._onMessageViewed, this);
12978      if (message.isNew()) {
12979        this._newMessages[message.getIndex()] = message;
12980        this._newMessagesCount++;
12981      }
12982    }, _onScroll:function(event) {
12983      this._isScrolledBottom = this._getItemsContainer().scrollTop() >= this._getScrollHeight() - this.getHeight() - 103;
12984      this._updateViewedState();
12985    }, _onMessageViewed:function(event, message) {
12986      this._newMessagesCount--;
12987      delete this._newMessages[message.getIndex()];
12988      this.fireEvent("message_viewed", message);
12989    }, _nanoScrollerUpdated:function(event, nanoScroller) {
12990    }, getHeight:function() {
12991      if (this._height === undefined) {
12992        this._height = this.getEl().height();
12993      }
12994      return this._height;
12995    }, getNewMessages:function() {
12996      return this._newMessages;
12997    }, getNewMessagesCount:function() {
12998      return this._newMessagesCount;
12999    }, render:function(renderTo) {
13000      var render = arguments.callee;
13001      if (renderTo) {
13002        this.config.renderTo = renderTo;
13003      }
13004      this.callParent(render, arguments);
13005    }, show:function() {
13006      var show = arguments.callee;
13007      var result = this.callParent(show, arguments);
13008      if (result) {
13009        this._complexScrollUpdate();
13010        this._updateViewedState();
13011      }
13012      return result;
13013    }, _complexScrollUpdate:function() {
13014      this._initElementsPositions();
13015      this._scrollSmart();
13016      this._updateNanoScroller();
13017    }, _afterItemsRender:function(items) {
13018      if (this.isVisible()) {
13019        this._complexScrollUpdate();
13020      }
13021    }, _initElementsPositions:function(update) {
13022      var newMessages = this.getNewMessages();
13023      for (var index in newMessages) {
13024        if (!newMessages.hasOwnProperty(index)) {
13025          continue;
13026        }
13027        newMessages[index].getPositionBottom(update);
13028      }
13029    }, _getScrollHeight:function() {
13030      return this._getItemsContainer()[0].scrollHeight;
13031    }, _scrollSmart:function() {
13032      if (!this._scrollToNew()) {
13033        if (this._isScrolledBottom || !this._notFirstScroll) {
13034          this._scrollBottom();
13035        }
13036      }
13037      this._notFirstScroll = true;
13038    }, _scrollBottom:function() {
13039      this._getItemsContainer().scrollTop(this._getScrollHeight());
13040    }, _scrollToNew:function() {
13041      var newMessages = this.getNewMessages();
13042      for (var index in newMessages) {
13043        if (!newMessages.hasOwnProperty(index)) {
13044          continue;
13045        }
13046        var message = newMessages[index], topPosition = message.getPositionTop();
13047        this._getItemsContainer().scrollTop(topPosition);
13048        return true;
13049      }
13050      return false;
13051    }, _updateViewedState:function() {
13052      var newMessages = this.getNewMessages(), scrollBottom = this._getItemsContainer().scrollTop() + this._getItemsContainerHeight();
13053      for (var index in newMessages) {
13054        if (!newMessages.hasOwnProperty(index)) {
13055          continue;
13056        }
13057        var message = newMessages[index], bottomPosition = message.getPositionBottom() - 3;
13058        if (bottomPosition < scrollBottom) {
13059          message.setViewed();
13060        }
13061      }
13062    }, _getItemsContainerHeight:function() {
13063      if (this._itemsContainerHeight === undefined) {
13064        this._itemsContainerHeight = this._getItemsContainer().height();
13065      }
13066      return this._itemsContainerHeight;
13067    }});
13068    self = hm.module.messenger.ui.message.MessagesList;
13069  })();
13070  (function() {
13071    var self;
13072    HM.define("hm.core.ui.trainingModulesConstructor.Constructor", {extend:"hm.core.ui.Component", config:{tplByClass:true, treeData:null, searchData:null, subjectId:null}, _init:function() {
13073      var _init = arguments.callee;
13074      this.callParent(_init, arguments);
13075      var treeData = $.extend({renderTo:this.getEl().find(".hm-constructor-tree")}, this.config.treeData);
13076      var tree = HM.create("hm.core.ui.trainingModulesConstructor.Tree", treeData);
13077      var searchData = $.extend({renderTo:this.getEl().find(".hm-constructor-search"), tree:tree, subjectId:this.config.subjectId}, this.config.searchData);
13078      var search = HM.create("hm.core.ui.trainingModulesConstructor.ResourcesSearch", searchData);
13079      this.needToDestroy(tree);
13080      this.needToDestroy(search);
13081    }});
13082    self = hm.core.ui.trainingModulesConstructor.Constructor;
13083  })();
13084  (function() {
13085    var self;
13086    HM.define("hm.core.ui.trainingModulesConstructor.ResourceItem", {extend:"hm.core.ui.Component", config:{tplByClass:true, resource_id:0, title:"", icon_class:"", tree:null}, _init:function() {
13087      var _init = arguments.callee;
13088      this.callParent(_init, arguments);
13089      this.getEl().draggable({start:_.bind(this._onDraggableStart, this), stop:_.bind(this._onDraggableStop, this), drag:_.bind(this._onDraggableDrag, this), resourceItem:this, cursorAt:{top:9, left:9}, helper:"clone", opacity:0.6});
13090    }, _initEvents:function() {
13091      this.elOn("click", ".material-icon-small", this._onIconClick, this);
13092      this.elOn("click", ".hm-search-resource-item-title", this._onTitleClick, this);
13093    }, _onDraggableStart:function(event, ui) {
13094      var tree = this.getTree(), dragManager = tree.getDragManager();
13095      dragManager.reset();
13096      dragManager.setDraggableNode(this);
13097    }, _onDraggableStop:function(event, ui) {
13098      var tree = this.getTree(), dragManager = tree.getDragManager();
13099      dragManager.getDropHelper().detach();
13100      var dropTarget = dragManager.getDropTarget(), dropPosition = dragManager.getDropPosition();
13101      if (!dropTarget) {
13102        dragManager.reset();
13103        return;
13104      }
13105      var resNode = tree.nodeFactory({title:this.getTitle(), isFolder:false, iconClass:this.getIconClass(), sql_data:{title:this.getTitle(), vol2:this.getId()}, res_data:{res_status:"1"}});
13106      resNode.setInsertAction();
13107      switch(dropPosition) {
13108        case "before":
13109          dropTarget.addNodeBefore(resNode);
13110          break;
13111        case "after":
13112          dropTarget.addNodeAfter(resNode);
13113          break;
13114        case "inside":
13115          dropTarget.prependNode(resNode);
13116          if (!dropTarget.isExpanded()) {
13117            dropTarget.getChildrenContainer().hide();
13118          }
13119          break;
13120      }
13121      dragManager.reset();
13122      tree.checkTreeChanges();
13123    }, _onDraggableDrag:function(event, ui) {
13124      var dragManager = this.getTree().getDragManager(), draggableOverNode = dragManager.draggableOverNode();
13125      if (draggableOverNode) {
13126        draggableOverNode._updateDropHelper(ui);
13127      }
13128    }, _onIconClick:function(e) {
13129      e.preventDefault();
13130      this.showCard();
13131    }, _onTitleClick:function(e) {
13132      e.preventDefault();
13133      this.viewInWindow();
13134    }, getTree:function() {
13135      return this.config.tree;
13136    }, getTitle:function() {
13137      return this.config.title;
13138    }, getId:function() {
13139      return this.config.resource_id;
13140    }, getIconClass:function() {
13141      return this.config.icon_class;
13142    }, getViewUrl:function() {
13143      if (!this._viewUrl) {
13144        this._viewUrl = hm.core.Url.getInstance().url({module:"resource", controller:"index", action:"view", resource_id:this.getId()});
13145      }
13146      return this._viewUrl;
13147    }, getCardUrl:function() {
13148      if (!this._cardUrl) {
13149        this._cardUrl = hm.core.Url.getInstance().url({module:"resource", controller:"index", action:"card", resource_id:this.getId()});
13150      }
13151      return this._cardUrl;
13152    }, showCard:function() {
13153      if (!this._card) {
13154        this._card = HM.create("hm.core.ui.window.card.Card", {url:this.getCardUrl()});
13155      }
13156      this._card.show();
13157    }, viewInWindow:function() {
13158      var title = this.getTitle(), id = this.getId();
13159      if (!this._viewWindow || this._viewWindow.closed) {
13160        var w = this._viewWindow = window.open(this.getViewUrl(), "res_" + id + "_" + title, "toolbar=1,scrollbars=1,location=1,statusbar=0,menubar=1,resizable=1,width=800,height=600");
13161        $(w).load(function() {
13162          w.document.title = title;
13163        });
13164      }
13165      this._viewWindow.focus();
13166    }});
13167    self = hm.core.ui.trainingModulesConstructor.ResourceItem;
13168  })();
13169  (function() {
13170    var self;
13171    HM.define("hm.core.ui.trainingModulesViewer.BookmarksList", {extend:"hm.core.ui.Component", config:{tplByClass:true, subjectId:null, bookmarks:[]}, statics:{list:null}, _init:function() {
13172      var _init = arguments.callee;
13173      this.callParent(_init, arguments);
13174      hm.core.ui.trainingModulesViewer.BookmarksList.list = this;
13175      this._initItems();
13176    }, _initItems:function() {
13177      this._items = [];
13178      var bookmarks = this.config.bookmarks, ln = bookmarks.length;
13179      for (var i = 0;i < ln;i++) {
13180        this.addItem(bookmarks[i]["item_title"], bookmarks[i]["item_id"], bookmarks[i]["course_id"], bookmarks[i]["lesson_id"]);
13181      }
13182    }, _initEvents:function() {
13183    }, getViewer:function() {
13184      if (hm.core.ui.trainingModulesViewer.Viewer.viewer !== null) {
13185        return hm.core.ui.trainingModulesViewer.Viewer.viewer;
13186      }
13187      return false;
13188    }, getSubjectId:function() {
13189      return this.config.subjectId;
13190    }, addItem:function(title, itemId, courseId, lessonId) {
13191      var item = HM.create("hm.core.ui.trainingModulesViewer.BookmarksListItem", {renderTo:this.getEl(), list:this, courseId:courseId, lessonId:lessonId, itemId:itemId, title:title});
13192      this._items.push(item);
13193    }, deleteItem:function(itemId, lessonId) {
13194      var item = _.find(this._items, function(item) {
13195        return item.getItemId() == itemId && item.getLessonId() == lessonId;
13196      });
13197      if (item) {
13198        item.destroy();
13199      }
13200    }});
13201    self = hm.core.ui.trainingModulesViewer.BookmarksList;
13202  })();
13203  (function() {
13204    var self;
13205    HM.define("hm.core.ui.trainingModulesViewer.BookmarksListItem", {extend:"hm.core.ui.Component", config:{tplByClass:true, list:null, courseId:null, lessonId:null, itemId:null, title:null}, _init:function() {
13206      var _init = arguments.callee;
13207      this.callParent(_init, arguments);
13208    }, _initEvents:function() {
13209      this.elOn("click", "a", this._onClick);
13210    }, _onClick:function(e) {
13211      var viewer = this.getList().getViewer();
13212      if (viewer && this.getLessonId() == viewer.getLessonId()) {
13213        e.preventDefault();
13214        viewer.activate(this.getItemId());
13215      }
13216    }, getList:function() {
13217      return this.config.list;
13218    }, getCourseId:function() {
13219      return this.config.courseId;
13220    }, getLessonId:function() {
13221      return this.config.lessonId;
13222    }, getItemId:function() {
13223      return this.config.itemId;
13224    }, getUrl:function() {
13225      if (!this._url) {
13226        var list = this.getList();
13227        this._url = hm.core.Url.getInstance().url({module:"subject", controller:"index", action:"index", subject_id:list.getSubjectId(), course_id:this.getCourseId(), lesson_id:this.getLessonId(), item_id:this.getItemId()});
13228      }
13229      return this._url;
13230    }});
13231    self = hm.core.ui.trainingModulesViewer.BookmarksListItem;
13232  })();
13233  (function() {
13234    var self;
13235    HM.define("hm.core.ui.trainingModulesViewer.ContentSearch", {extend:"hm.core.ui.Component", config:{tplByClass:true, viewer:null}, _init:function() {
13236      var _init = arguments.callee;
13237      this.callParent(_init, arguments);
13238      var $el = this.getEl();
13239      this._$input = $el.find('input[type="text"]');
13240      this._$seachButton = $el.find('input[type="button"]');
13241    }, _initEvents:function() {
13242      this._$seachButton.on("click", _.bind(this._onClickSearch, this));
13243    }, _onClickSearch:function(event) {
13244      event.preventDefault();
13245      this.search(this.getSearchText());
13246    }, getViewer:function() {
13247      return this.config.viewer;
13248    }, getSearchText:function() {
13249      return this._$input.val();
13250    }, search:function(text) {
13251      var me = this, $iframes = this.getViewer().getAllIframes();
13252      $iframes.each(function() {
13253        me._iframeSearch(this, text);
13254      });
13255    }, _iframeSearch:function(iframe, searchText) {
13256      var w = iframe.contentWindow, d = w.document;
13257      var sel;
13258      if (w.find && w.getSelection) {
13259        sel = w.getSelection();
13260        if (sel.rangeCount > 0) {
13261          sel.collapseToEnd();
13262        }
13263        if (!w.find(searchText)) {
13264          sel.removeAllRanges();
13265          w.find(searchText);
13266        }
13267      } else {
13268        if ((d.selection || d.getSelection) && d.body.createTextRange) {
13269          sel = d.selection || d.getSelection;
13270          var textRange;
13271          if (sel.type == "Text") {
13272            textRange = sel.createRange();
13273            textRange.collapse(false);
13274          } else {
13275            textRange = d.body.createTextRange();
13276            textRange.collapse(false);
13277          }
13278          if (textRange.findText(searchText)) {
13279            textRange.select();
13280          }
13281        }
13282      }
13283    }});
13284    self = hm.core.ui.trainingModulesViewer.ContentSearch;
13285  })();
13286  (function() {
13287    var self;
13288    HM.define("hm.core.ui.trainingModulesViewer.ExtraNavigation", {extend:"hm.core.ui.Component", config:{tplByClass:true, tree:null, viewer:null}, _init:function() {
13289      var _init = arguments.callee;
13290      this.callParent(_init, arguments);
13291      var $el = this.getEl();
13292      this._titleContainer = $el.find(".hm-extra-nav-title");
13293      this._counterContainer = $el.find(".hm-extra-nav-counter");
13294      this._nextButton = $el.find(".hm-extra-nav-button-next");
13295      this._prevButton = $el.find(".hm-extra-nav-button-prev");
13296      this._fileButton = $el.find(".hm-extra-nav-button-file");
13297      this._bookmarkButton = $el.find(".hm-extra-nav-button-bookmark");
13298    }, _initEvents:function() {
13299      var tree = this.getTree();
13300      tree.on("nodeActive", this._onNodeActive, this);
13301      this.elOn("click", ".hm-extra-nav-button-next", this._onClickNext);
13302      this.elOn("click", ".hm-extra-nav-button-prev", this._onClickPrev);
13303      this.elOn("click", ".hm-extra-nav-button-bookmark", this._onClickBookmark);
13304      this.elOn("click", ".hm-extra-nav-open-in-viewer", this._onClickOpenInViewer);
13305    }, _onNodeActive:function(event, node) {
13306      var tree = this.getTree(), viewer = hm.core.ui.trainingModulesViewer.Viewer.viewer, resourceNodes = viewer.getResourceNodes(), resourceNodesCount = resourceNodes.length, activeNode = tree.getActiveNode(), activeIndex = _.indexOf(resourceNodes, activeNode);
13307      if (activeIndex == -1) {
13308        return;
13309      }
13310      activeIndex++;
13311      this._counterContainer.text("(" + activeIndex + "/" + resourceNodesCount + ")");
13312      this._titleContainer.text(node.getTitle());
13313      this._updateButtonClasses(activeIndex, resourceNodesCount);
13314      if (activeNode instanceof hm.core.ui.trainingModulesViewer.node.Node) {
13315        this._updateBookmark(activeNode.getItemId());
13316      }
13317    }, _updateButtonClasses:function(activeIndex, resourceNodesCount) {
13318      if (activeIndex == 1) {
13319        this._prevButton.addClass("hm-extra-nav-disabled");
13320      } else {
13321        this._prevButton.removeClass("hm-extra-nav-disabled");
13322      }
13323      if (activeIndex == resourceNodesCount) {
13324        this._nextButton.addClass("hm-extra-nav-disabled");
13325      } else {
13326        this._nextButton.removeClass("hm-extra-nav-disabled");
13327      }
13328    }, _onClickNext:function(e) {
13329      e.preventDefault();
13330      var tree = this.getTree(), viewer = hm.core.ui.trainingModulesViewer.Viewer.viewer, resourceNodes = viewer.getResourceNodes(), activeNode = tree.getActiveNode(), activeIndex = _.indexOf(resourceNodes, activeNode);
13331      if (activeIndex !== -1 && resourceNodes[activeIndex + 1]) {
13332        resourceNodes[activeIndex + 1].activate(true);
13333      }
13334    }, _onClickPrev:function(e) {
13335      e.preventDefault();
13336      var tree = this.getTree(), viewer = hm.core.ui.trainingModulesViewer.Viewer.viewer, resourceNodes = viewer.getResourceNodes(), activeNode = tree.getActiveNode(), activeIndex = _.indexOf(resourceNodes, activeNode);
13337      if (activeIndex !== -1 && resourceNodes[activeIndex - 1]) {
13338        resourceNodes[activeIndex - 1].activate(true);
13339      }
13340    }, _onClickBookmark:function(e) {
13341      e.preventDefault();
13342      var tree = this.getTree(), viewer = this.getViewer(), activeNode = tree.getActiveNode(), itemId = activeNode.getItemId(), title = activeNode.getTitle();
13343      if (viewer.isBookmarked(itemId)) {
13344        viewer.removeBookmark(itemId);
13345      } else {
13346        viewer.addBookmark(title, itemId);
13347      }
13348      this._updateBookmark(itemId);
13349    }, _onClickOpenInViewer:function(e) {
13350      e.preventDefault();
13351      var viewer = this.getViewer(), $target = $(e.target);
13352      viewer.loadContent($target.attr("href"));
13353      viewer.setTitle($target.attr("title"));
13354      viewer.setEditUrl(false);
13355      this.getTree().getActiveNode().activate(false);
13356    }, getTree:function() {
13357      return this.config.tree;
13358    }, getViewer:function() {
13359      return this.config.viewer;
13360    }, getBookmarking:function() {
13361      return this.getViewer().getBookmarking();
13362    }, getCustomButtons:function() {
13363      return this.getViewer().getCustomButtons();
13364    }, _updateBookmark:function(itemId) {
13365      var viewer = this.getViewer(), bookmarkButton = this._bookmarkButton;
13366      if (viewer.isBookmarked(itemId)) {
13367        bookmarkButton.addClass("hm-extra-nav-button-is-bookmarked");
13368      } else {
13369        bookmarkButton.removeClass("hm-extra-nav-button-is-bookmarked");
13370      }
13371    }});
13372    self = hm.core.ui.trainingModulesViewer.ExtraNavigation;
13373  })();
13374  (function() {
13375    var self;
13376    HM.define("hm.core.ui.trainingModulesViewer.Viewer", {extend:"hm.core.ui.Component", config:{tplByClass:false, tpl:"hm/core/ui/trainingModulesViewer/Viewer", classNameSpace:"hm-training-modules-viewer", loadUrl:null, urls:{}, subjectId:null, lessonId:null, courseId:null, itemId:null, showMenuOnStartup:false, treeData:null, openInWindow:false, showEditButton:false, checkViewedUrl:null, extraNavigation:false, contentSearch:false, customButtons:[], bookmarking:false, bookmarks:[]}, statics:{viewer:null}, 
13377    _init:function() {
13378      var _init = arguments.callee;
13379      $("body").addClass("hm-training-modules-viewer-styles");
13380      this.callParent(_init, arguments);
13381      hm.core.ui.trainingModulesViewer.Viewer.viewer = this;
13382      var me = this, $el = this.getEl(), config = this.config;
13383      this._$overlay = $el.find(".hm-tmw-overlay");
13384      this._$loading = $el.find(".hm-tmw-loading");
13385      this._$contentTitle = $el.find(".hm-tmw-content-title");
13386      this._$contentEdit = $el.find(".hm-tmw-content-edit");
13387      this._$contentEdit.hide();
13388      if (config.loadUrl !== null && _.isString(config.loadUrl)) {
13389        setTimeout(function() {
13390          me.loadContent(config.loadUrl);
13391        }, 100);
13392      }
13393      if (!config.treeData) {
13394        return;
13395      }
13396      this._expanded = false;
13397      this._menuVisible = false;
13398      this._loadingVisible = true;
13399      this._$tree = $el.find(".hm-tmw-tree");
13400      var tree;
13401      if (_.isString(config.treeData)) {
13402        tree = hm.core.ui.Component.getComponent($(config.treeData).children());
13403        this._$tree.append(tree.getEl());
13404      } else {
13405        if (config.treeData instanceof jQuery) {
13406          tree = hm.core.ui.Component.getComponent(config.treeData.children());
13407          this._$tree.append(tree.getEl());
13408        } else {
13409          tree = HM.create("hm.core.ui.trainingModulesViewer.Tree", {renderTo:this._$tree, data:config.treeData});
13410        }
13411      }
13412      tree.on("nodeActive", this._onNodeActive, this);
13413      this._tree = tree;
13414      this.needToDestroy(tree);
13415      var resNodes = this.getResourceNodes();
13416      if (resNodes.length === 1) {
13417        $el.find(".hm-tmw-navigation-button").hide();
13418        $el.find(".hm-tmw-content-title-wrap").css("margin-left", "13px");
13419      }
13420      if (config.extraNavigation && resNodes.length > 1) {
13421        var extraNavigation = HM.create("hm.core.ui.trainingModulesViewer.ExtraNavigation", {renderTo:$el.find(".hm-tmw-footer"), tree:tree, viewer:this});
13422        this.needToDestroy(extraNavigation);
13423      }
13424      if (config.contentSearch) {
13425        var contentSearch = HM.create("hm.core.ui.trainingModulesViewer.ContentSearch", {renderTo:$el.find(".hm-content-search-wrap"), viewer:this});
13426        this.needToDestroy(contentSearch);
13427      }
13428      if ($.browser.msie && parseInt($.browser.version, 10) < 11) {
13429        HM.$document().on("click", ".content-size", _.bind(this._fixHeight, this));
13430      }
13431      if (config.loadUrl) {
13432        return;
13433      }
13434      setTimeout(function() {
13435        var isActivated = false;
13436        if (config.itemId) {
13437          isActivated = me.activate(config.itemId);
13438        }
13439        if (!isActivated && resNodes.length != 0) {
13440          resNodes[0].activate(true);
13441        }
13442        if (config.showMenuOnStartup) {
13443          me.showMenu();
13444        }
13445      }, 100);
13446    }, _fixHeight:function() {
13447      if (!this._$tmwContent) {
13448        this._$tmwContent = this.getEl().find(".hm-tmw-content");
13449      }
13450      if (!this._$tmwtRowConten) {
13451        this._$tmwtRowConten = this.getEl().find(".hm-tmw-row-content");
13452      }
13453      var me = this;
13454      setTimeout(function() {
13455        me._$tmwContent.removeAttr("style");
13456        me._$tmwContent.height(me._$tmwtRowConten.height());
13457      }, 100);
13458    }, _initEvents:function() {
13459      this.elOn("click", ".hm-tmw-navigation-button", this.toggleMenu);
13460      this.getIframe().load(_.bind(this._onIframeLoaded, this));
13461    }, _onIframeLoaded:function() {
13462      try {
13463        var $iframeHead = this.getIframe().contents().find("head");
13464        $iframeHead.prepend('<meta http-Equiv="Cache-Control" Content="no-cache">' + '<meta http-Equiv="Pragma" Content="no-cache">' + '<meta http-Equiv="Expires" Content="0">');
13465      } catch (e) {
13466      }
13467      this._viewStatusUpdateRequired = true;
13468      if (this.isMenuVisible()) {
13469        this._checkViewedStatus();
13470      }
13471      this.hideLoading();
13472    }, _onNodeActive:function(event, node) {
13473      if (this.config.showEditButton) {
13474        this.setEditUrl(node.getEditUrl());
13475      }
13476      this.setTitle(node.getTitle());
13477      this.viewResource(node);
13478      this.hideMenu();
13479      this.showLoading();
13480      if (this.config.openInWindow) {
13481        node.activate(false);
13482      }
13483    }, getUrlData:function(name) {
13484      return this.config.urls[name] || undefined;
13485    }, getTree:function() {
13486      return this._tree;
13487    }, getResourceNodes:function() {
13488      if (!this._resourceNodes) {
13489        var resourceNodes = this.getTree().getAllChildren(null, false);
13490        resourceNodes = _.filter(resourceNodes, this._filter);
13491        this._resourceNodes = resourceNodes;
13492      }
13493      return this._resourceNodes;
13494    }, _filter:function(node) {
13495      return!node.isFolder();
13496    }, activate:function(itemId) {
13497      var tree = this.getTree(), resNodes = this.getResourceNodes();
13498      var node = _.find(resNodes, function(node) {
13499        return node.getItemId() == itemId;
13500      });
13501      if (node) {
13502        node.activate(true);
13503        return true;
13504      }
13505      return false;
13506    }, getBookmarking:function() {
13507      if (!this.getLessonId()) {
13508        return false;
13509      }
13510      return this.config.bookmarking;
13511    }, getCustomButtons:function() {
13512      return this.config.customButtons;
13513    }, getBookmarks:function() {
13514      return this.config.bookmarks;
13515    }, getBookmarksList:function() {
13516      if (hm.core.ui.trainingModulesViewer.BookmarksList.list !== null) {
13517        return hm.core.ui.trainingModulesViewer.BookmarksList.list;
13518      }
13519      return false;
13520    }, addBookmark:function(title, itemId) {
13521      if (this.isBookmarked(itemId)) {
13522        return;
13523      }
13524      this.config.bookmarks.push(parseInt(itemId));
13525      $.ajax({url:hm.core.Url.getInstance().url({module:"subject", controller:"ajax", action:"add-bookmark", item_id:itemId, lesson_id:this.getLessonId()})});
13526      var bookmarksList = this.getBookmarksList();
13527      if (bookmarksList) {
13528        bookmarksList.addItem(title, itemId, this.getCourseId(), this.getLessonId());
13529      }
13530    }, removeBookmark:function(itemId) {
13531      var bookmarkIndex = this.getBookmarkIndex(itemId);
13532      if (bookmarkIndex == -1) {
13533        return;
13534      }
13535      this.config.bookmarks.splice(bookmarkIndex, 1);
13536      $.ajax({url:hm.core.Url.getInstance().url({module:"subject", controller:"ajax", action:"remove-bookmark", item_id:itemId, lesson_id:this.getLessonId()})});
13537      var bookmarksList = this.getBookmarksList();
13538      if (bookmarksList) {
13539        bookmarksList.deleteItem(itemId, this.getLessonId());
13540      }
13541    }, getBookmarkIndex:function(itemId) {
13542      return _.indexOf(this.getBookmarks(), parseInt(itemId));
13543    }, isBookmarked:function(itemId) {
13544      return this.getBookmarkIndex(itemId) != -1;
13545    }, toggleMenu:function() {
13546      if (this._menuVisible) {
13547        this.hideMenu();
13548      } else {
13549        this.showMenu();
13550      }
13551    }, isMenuVisible:function() {
13552      return!!this._menuVisible;
13553    }, showMenu:function() {
13554      this._checkViewedStatus();
13555      this._$tree.show();
13556      this.showOverlay();
13557      if (!this.config.openInWindow) {
13558        if (!this._onDocumentClickBinded) {
13559          this._onDocumentClickBinded = _.bind(this._onDocumentClick, this);
13560        }
13561        var onDocumentClickBinded = this._onDocumentClickBinded;
13562        setTimeout(function() {
13563          HM.$document().bind("click", onDocumentClickBinded);
13564        }, 0);
13565      }
13566      this._menuVisible = true;
13567    }, hideMenu:function() {
13568      if (this.config.openInWindow) {
13569        return;
13570      }
13571      this._$tree.hide();
13572      if (this._onDocumentClickBinded) {
13573        HM.$document().unbind("click", this._onDocumentClickBinded);
13574      }
13575      this._menuVisible = false;
13576      this.hideOverlay();
13577    }, showOverlay:function() {
13578      this._$overlay.show().stop().animate({opacity:0.95}, 200);
13579      if ($.browser.msie && parseInt($.browser.version, 10) < 11) {
13580        this._fixHeight();
13581      }
13582    }, hideOverlay:function() {
13583      if (this._menuVisible || this._loadingVisible) {
13584        return;
13585      }
13586      this._$overlay.stop().animate({opacity:0}
13586, 200, function() {
13587        $(this).hide();
13588      });
13589    }, showLoading:function() {
13590      if (this.config.openInWindow) {
13591        return;
13592      }
13593      this._loadingVisible = true;
13594      this.showOverlay();
13595      this._$loading.show();
13596    }, hideLoading:function() {
13597      this._$loading.hide();
13598      this._loadingVisible = false;
13599      this.hideOverlay();
13600    }, _onDocumentClick:function(e) {
13601      var target = e.target, $target = $(target);
13602      if (target != this._$overlay[0] && (target != this._$tree[0] && this._$tree.find($target).length == 0)) {
13603        this.hideMenu();
13604      }
13605    }, expand:function(e) {
13606      if (!this._$oldContainer) {
13607        this._$oldContainer = this.getEl().parent();
13608      }
13609      this._expanded = !this._expanded;
13610      if (this._expanded) {
13611        this.getEl().appendTo("body");
13612        $("html").css("overflow", "hidden");
13613      } else {
13614        this._$oldContainer.append(this.getEl());
13615        $("html").css("overflow", "");
13616      }
13617      this.getEl().toggleClass("hm-tmw-expanded");
13618    }, getIframe:function() {
13619      if (!this._iframe) {
13620        this._iframe = this.getEl().find("iframe");
13621      }
13622      return this._iframe;
13623    }, getAllIframes:function() {
13624      var $iframe = this.getIframe();
13625      return $iframe.add(this._getChildIframes($iframe));
13626    }, _getChildIframes:function($iframes) {
13627      var $childIframes = $iframes.contents().find("iframe");
13628      if ($childIframes.length != 0) {
13629        var $childOfchildIframes = this._getChildIframes($childIframes);
13630        if ($childOfchildIframes.length != 0) {
13631          $childIframes.add($childOfchildIframes);
13632        }
13633      }
13634      return $childIframes;
13635    }, loadContent:function(url) {
13636      if (url.indexOf("/") === 0) {
13637        var urlInfo = hm.core.Url.getInfo(window.location.href);
13638        url = urlInfo.protocol + "//" + urlInfo.host + url;
13639      }
13640      this._currentUrl = url;
13641      this.showLoading();
13642      var $iframe = this.getIframe(), newUrl = url;
13643      setTimeout(function() {
13644        try {
13645          if ($iframe[0].contentWindow.stop) {
13646            $iframe[0].contentWindow.stop();
13647          } else {
13648            $iframe.contents()[0].execCommand("Stop");
13649          }
13650        } catch (e) {
13651        }
13652        try {
13653          $iframe[0].contentWindow.location.replace(newUrl);
13654        } catch (e) {
13655          $iframe.attr("src", newUrl);
13656        }
13657      }, 0);
13658    }, getCurrentUrl:function() {
13659      return this._currentUrl;
13660    }, getCourseId:function() {
13661      return this.config.courseId;
13662    }, getLessonId:function() {
13663      return this.config.lessonId;
13664    }, getSubjectId:function() {
13665      return this.config.subjectId;
13666    }, viewResource:function(node) {
13667      if (this.config.openInWindow) {
13668        var title = node.getTitle(), url = node.getViewUrl();
13669        if (!node._w || node._w.closed) {
13670          if ($.browser.msie && parseInt($.browser.version, 10) < 11) {
13671            title = node.getItemId();
13672          }
13673          var w = window.open(url, title, "toolbar=1,scrollbars=1,location=1,statusbar=0,menubar=1,resizable=1,width=800,height=600");
13674          $(w).load(function() {
13675            w.document.title = title;
13676          });
13677          node._w = w;
13678        }
13679        node._w.focus();
13680      } else {
13681        var me = this;
13682        if (this._showTimer) {
13683          clearTimeout(this._showTimer);
13684        }
13685        this._showTimer = setTimeout(function() {
13686          me.loadContent(node.getViewUrl());
13687        }, 1E3);
13688      }
13689    }, setEditUrl:function(url) {
13690      if (url) {
13691        this._$contentEdit.attr("href", url);
13692        this._$contentEdit.show();
13693      } else {
13694        this._$contentEdit.hide();
13695      }
13696    }, setTitle:function(title) {
13697      this._$contentTitle.html(title);
13698    }, _getNodesByOid:function() {
13699      if (!this._nodesByOid) {
13700        this._nodesByOid = {};
13701        var nodes = this.getTree().getNodes(), nodesLn = nodes.length;
13702        for (var i = 0;i < nodesLn;i++) {
13703          var oid = nodes[i].getItemId();
13704          this._nodesByOid[oid] = nodes[i];
13705        }
13706      }
13707      return this._nodesByOid;
13708    }, _checkViewedStatus:function() {
13709      var checkViewedUrl = this.config.checkViewedUrl;
13710      if (checkViewedUrl === null || !this._viewStatusUpdateRequired) {
13711        return;
13712      }
13713      this._viewStatusUpdateRequired = false;
13714      var tree = this.getTree(), nodes = tree.getNodes(), nodesLn = nodes.length, checkOids = [];
13715      for (var i = 0;i < nodesLn;i++) {
13716        if (!nodes[i].isViewed()) {
13717          checkOids.push(nodes[i].getItemId());
13718        }
13719      }
13720      if (checkOids.length == 0) {
13721        return;
13722      }
13723      $.ajax({type:"POST", url:checkViewedUrl, data:{oids:checkOids}}).done(_.bind(this._onViewedStatusDone, this));
13724    }, _onViewedStatusDone:function(data) {
13725      var nodes = this._getNodesByOid();
13726      _.each(data.oids, function(value, key, list) {
13727        nodes[key].setViewed(value);
13728      });
13729    }});
13730    self = hm.core.ui.trainingModulesViewer.Viewer;
13731  })();
13732  (function() {
13733    var self;
13734    HM.define("hm.core.ui.webinarViewer.StudentViewer", {extend:"hm.core.ui.trainingModulesViewer.Viewer", config:{pollWebinarUrl:null}, _init:function() {
13735      var _init = arguments.callee;
13736      this.callParent(_init, arguments);
13737      var $transparentOverlay = $('<div class="hm-tmw-overlay-transparent"></div>');
13738      this.getEl().find(".hm-tmw-content").append($transparentOverlay);
13739      if (this.config.pollWebinarUrl) {
13740        setTimeout(_.bind(this.startPoll, this), 0);
13741      }
13742    }, startPoll:function() {
13743      this._pollActive = true;
13744      this._poll();
13745    }, stopPoll:function() {
13746      this._pollActive = false;
13747    }, isPollActive:function() {
13748      return this._pollActive;
13749    }, _poll:function() {
13750      if (!this.isPollActive()) {
13751        return;
13752      }
13753      $.ajax({method:"POST", url:this.config.pollWebinarUrl, data:{currentUrl:this.getCurrentUrl()}, success:_.bind(this._onPollSuccess, this), error:function() {
13754      }});
13755    }, _onPollSuccess:function(data) {
13756      if (data.updated) {
13757        this.loadContent(data.url);
13758      }
13759      this._poll();
13760    }});
13761    self = hm.core.ui.webinarViewer.StudentViewer;
13762  })();
13763  (function() {
13764    var self;
13765    HM.define("hm.core.ui.webinarViewer.TeacherViewer", {extend:"hm.core.ui.trainingModulesViewer.Viewer", config:{title:null, tplByClass:true, uploadFileUrl:null, setWebinarUrl:null}, _init:function() {
13766      var _init = arguments.callee;
13767      this.callParent(_init, arguments);
13768      var $el = this.getEl();
13769      this._$contentTitleWrap = $el.find(".hm-tmw-content-title-wrap");
13770      this._file = HM.create("hm.core.ui.webinarViewer.file.File", {renderTo:this._$contentTitleWrap, uploadUrl:this.config.uploadFileUrl, listeners:{scope:this, link_input_submit:this._onLinkInputSubmit}});
13771    }, _initEvents:function() {
13772      var _initEvents = arguments.callee;
13773      this.callParent(_initEvents, arguments);
13774    }, _onLinkInputSubmit:function(event, value) {
13775      this.loadContent(value);
13776    }, _onNodeActive:function(url) {
13777      var _onNodeActive = arguments.callee;
13778      this._file.clearLinkValue();
13779      this.callParent(_onNodeActive, arguments);
13780    }, _onIframeLoaded:function() {
13781      var _onIframeLoaded = arguments.callee;
13782      var $iframe = this.getIframe();
13783      try {
13784        var iframeHref = $iframe[0].contentWindow.location.href;
13785        if (iframeHref != this.getCurrentUrl()) {
13786          this._currentUrl = iframeHref;
13787          this.syncUrl();
13788        }
13789      } catch (e) {
13790      }
13791      this.callParent(_onIframeLoaded, arguments);
13792    }, syncUrl:function() {
13793      $.ajax({method:"POST", url:this.config.setWebinarUrl, data:{url:this.getCurrentUrl()}});
13794    }, loadContent:function(url) {
13795      var loadContent = arguments.callee;
13796      this.callParent(loadContent, arguments);
13797      this.syncUrl();
13798    }, setTitle:function(title) {
13799    }});
13800    self = hm.core.ui.webinarViewer.TeacherViewer;
13801  })();
13802  (function() {
13803    var self;
13804    HM.define("hm.core.ui.webinarViewer.file.File", {extend:"hm.core.ui.Component", config:{tplByClass:true, classNameSpace:"hm-form-file", uploadUrl:null}, _init:function() {
13805      var _init = arguments.callee;
13806      this.callParent(_init, arguments);
13807      var $el = this.getEl(), ns = this.getNs();
13808      this.CLASS_FOUCS = ns.getClass("focus");
13809      this.CLASS_DROPPABLE = ns.getClass("droppable");
13810      this._$contentWrap = ns.find("content-wrap");
13811      var dropAreaClass = ns.getClass("drop-area");
13812      if ($el.hasClass(dropAreaClass)) {
13813        this._$dropArea = $el;
13814      } else {
13815        this._$dropArea = ns.find("drop-area");
13816      }
13817      this._$linkInputWrap = ns.find("link-input-wrap");
13818      this._$linkInput = this._$linkInputWrap.find("input");
13819      this._$linkInputTip = ns.find("link-input-tip");
13820      this._$linkInputTipSpan = this._$linkInputTip.find("span");
13821      this._$fileInput = ns.find("file-input");
13822      this._$fileInputTip = ns.find("file-input-tip");
13823      this._$fileInputTipTd = this._$fileInputTip.parent("td:first");
13824      this._fileReader = new FileReader;
13825      this._xhr = new XMLHttpRequest;
13826    }, _initEvents:function() {
13827      this._$linkInputTipSpan.on("click", _.bind(this._onClickInputTip, this));
13828      this._$linkInput.on("focus", _.bind(this._onFocusInput, this));
13829      this._$linkInput.on("blur", _.bind(this._onBlurInput, this));
13830      this._$linkInput.on("keyup", _.bind(this._onKeyupInput, this));
13831      var handleFiles = _.bind(this._handleFiles, this);
13832      this._$fileInput.on("change", handleFiles);
13833      var dragoverHandler = _.bind(this._dragoverHandler, this), dragleaveHandler = _.bind(this._dragleaveHandler, this);
13834      this._$dropArea.each(function() {
13835        this.addEventListener("drop", handleFiles, false);
13836        this.addEventListener("dragover", dragoverHandler, false);
13837        this.addEventListener("dragleave", dragleaveHandler, false);
13838      });
13839      this._xhr.onloadstart = _.bind(this._xhrOnloadstart, this);
13840      this._xhr.upload.onprogress = _.bind(this._xhrOnprogress, this);
13841      this._xhr.onload = _.bind(this._xhrOnload, this, this._xhr);
13842    }, _dragoverHandler:function() {
13843      this.getEl().addClass(this.CLASS_DROPPABLE);
13844    }, _dragleaveHandler:function() {
13845      this.getEl().removeClass(this.CLASS_DROPPABLE);
13846    }, _xhrOnloadstart:function() {
13847    }, _xhrOnprogress:function(event) {
13848    }, _xhrOnload:function(xhr) {
13849      if (xhr.status != 200) {
13850      } else {
13851        this.setLinkValue(xhr.responseText);
13852        this._submitLinkInput();
13853      }
13854    }, _fileReaderOnload:function(e) {
13855    }, _handleFiles:function(e) {
13856      this.getEl().removeClass(this.CLASS_DROPPABLE);
13857      var files = e.target.files || e.dataTransfer.files;
13858      if (files.length == 0) {
13859        return;
13860      }
13861      var file = files[0];
13862      var formData = new FormData;
13863      formData.append("file", file);
13864      this._xhr.open("POST", this.config.uploadUrl, true);
13865      this._xhr.send(formData);
13866      this._$fileInput.val("");
13867    }, _onClickInputWrap:function(e) {
13868      this._$linkInput.trigger("focus");
13869    }, _onClickInputTip:function() {
13870      this.showLinkInput();
13871      this._$linkInput.focus();
13872    }, _onFocusInput:function(e) {
13873      if (this._inputHasFocus) {
13874        e.preventDefault();
13875        return;
13876      }
13877      this._inputHasFocus = true;
13878      this._$linkInput.select();
13879      this.getEl().addClass(this.CLASS_FOUCS);
13880    }, _onBlurInput:function() {
13881      this._inputHasFocus = false;
13882      var val = this.getLinkValue();
13883      if (val.trim() == "") {
13884        var me = this;
13885        setTimeout(function() {
13886          me.hideLinkInput();
13887        }, 200);
13888      }
13889      this.getEl().removeClass(this.CLASS_FOUCS);
13890    }, _onKeyupInput:function(e) {
13891      if (e.keyCode == 13) {
13892        this._submitLinkInput();
13893      }
13894    }, showLinkInput:function() {
13895      this._$linkInputTip.hide();
13896      this._$linkInputWrap.show();
13897      this._$fileInputTipTd.css("width", "1%");
13898    }, hideLinkInput:function() {
13899      this._$linkInputTip.show();
13900      this._$linkInputWrap.hide();
13901      this._$fileInputTipTd.css("width", "100%");
13902    }, clearLinkValue:function() {
13903      this._$linkInput.val("");
13904      this.hideLinkInput();
13905    }, setLinkValue:function(val) {
13906      this._$linkInput.val(val);
13907      this.showLinkInput();
13908    }, getLinkValue:function() {
13909      return this._$linkInput.val();
13910    }, _submitLinkInput:function() {
13911      this._$linkInput.blur();
13912      this.fireEvent("link_input_submit", this.getLinkValue());
13913    }});
13914    self = hm.core.ui.webinarViewer.file.File;
13915  })();
13916  (function() {
13917    var self;
13918    HM.define("hm.core.ui.trainingModulesConstructor.ResourcesSearch", {extend:"hm.core.ui.search.SphinxSearch", config:{tplByClass:true, subjectId:null, indexerUrl:null, searchUrl:hm.core.Url.getInstance().url({module:"course", controller:"constructor", action:"search-resources"}), indexes:["resources"], items:{all:{field:"*", hidden:true}, title:{field:"title", label:HM._("Название ресурса")}, description:{field:"description", 
13919    label:HM._("Краткое описание")}, filename:{field:"filename", label:HM._("Название файла")}, content:{field:"content", label:HM._("Содержимое")}, tags:{field:"tags", label:HM._("Метки")}, classifiers:{attr:"classifiers", label:HM._("Классификаторы"), 
13920    options:{}}, location:{attr:"location", value:1, hidden:true}, status:{attr:"status", value:1, hidden:true}}, data:{tags:[]}, tree:null}, _init:function() {
13921      var _init = arguments.callee;
13922      if (this.config.subjectId !== null) {
13923        this.config.searchUrl = hm.core.Url.getInstance().url({module:"course", controller:"constructor", action:"search-resources", subject_id:this.config.subjectId});
13924      }
13925      this.callParent(_init, arguments);
13926      var config = this.config;
13927      var $el = this.getEl();
13928      this._$extendedFiltersContainer = $el.find(".hm-sphinx-search-extended");
13929      this._$extendedSwitcher = $el.find(".hm-sphinx-search-toggle-extended a");
13930      HM.create("hm.core.ui.autocomplete.Autocomplete", {el:$el.find('input[name="tags"]'), uiClass:"hm-autocomplete-resSearch", autoBlur:false, multiple:true, source:config.data.tags});
13931      if (config.data.classifiers) {
13932        var $select = $el.find('select[name="classifiers"]');
13933        _.each(config.data.classifiers, function(item, key, list) {
13934          $select.append('<option value="' + key + '">' + item + "</option>");
13935        });
13936      }
13937    }, _initEvents:function() {
13938      var _initEvents = arguments.callee;
13939      this.callParent(_initEvents, arguments);
13940      this.elOn("click", ".hm-sphinx-search-toggle-extended a", this._toggleExtended, this);
13941      this.elOn("click", ".hm-sphinx-search-run-indexer a", this._runIndexer, this);
13942      this.elOn("click", ".hm-sphinx-search-all", this._searchAll, this);
13943    }, _toggleExtended:function(e) {
13944      e.preventDefault();
13945      this._$extendedSwitcher.toggleClass("hm-switcher-active");
13946      this._$extendedFiltersContainer.toggle();
13947    }, _runIndexer:function(e) {
13948      e.preventDefault();
13949      $.ajax({type:"POST", url:this.config.indexerUrl}).done(function(data) {
13950      });
13951    }, getTree:function() {
13952      return this.config.tree;
13953    }, _searchAll:function() {
13954      var me = this;
13955      setTimeout(function() {
13956        me.search();
13957      }, 0);
13958    }, _onSearchDone:function(data) {
13959      if (!this._resourceItems) {
13960        this._resourceItems = [];
13961      }
13962      while (this._resourceItems.length != 0) {
13963        this._resourceItems[0].destroy();
13964        this._resourceItems.splice(0, 1);
13965      }
13966      var $resultsContainer = this.getResultsContainer();
13967      $resultsContainer.contents().remove();
13968      if (_.isEmpty(data)) {
13969        $resultsContainer.html(HM._("Ничего не найдено."));
13970      } else {
13971        _.each(data, this._initResourceItem, this);
13972      }
13973    }, _initResourceItem:function(value, key, list) {
13974      var item = HM.create("hm.core.ui.trainingModulesConstructor.ResourceItem", {renderTo:this.getResultsContainer(), resource_id:value.resource_id, title:value.title, tree:this.getTree(), icon_class:value.icon_class});
13975      this._resourceItems.push(item);
13976    }});
13977    self = hm.core.ui.trainingModulesConstructor.ResourcesSearch;
13978  })();
13979  (function() {
13980    var self;
13981    HM.define("hm.core.ui.trainingModulesConstructor.Tree", {extend:"hm.core.ui.tree.Tree", config:{tpl:"hm/core/ui/trainingModulesConstructor/Tree", courseId:null, subjectId:null, resourceList:[]}, _init:function() {
13982      var _init = arguments.callee;
13983      this._initContextMenu();
13984      this.callParent(_init, arguments);
13985    }, _initEvents:function() {
13986      var _initEvents = arguments.callee;
13987      this.callParent(_initEvents, arguments);
13988      this.elOn("click", ".hm-tree-add-section", this._addToRoot, this);
13989    }, _addToRoot:function(e) {
13990      e.preventDefault();
13991      var rootNode = this.getRoot();
13992      rootNode.appendNode(this.getNewFolder());
13993      this.checkTreeChanges();
13994    }
13994, _initContextMenu:function() {
13995      this._folderMenu = HM.create("hm.core.ui.contextmenu.ContextMenu", {items:this._getFolderMenuItems(), listeners:{scope:this, beforeShow:this._beforeContextShow, itemClick:this._onContextItemClick}});
13996      this._resourceMenu = HM.create("hm.core.ui.contextmenu.ContextMenu", {items:this._getResourceMenuItems(), listeners:{scope:this, beforeShow:this._beforeContextShow, itemClick:this._onContextItemClick}});
13997    }, _getFolderMenuItems:function() {
13998      var folderItems = [{title:HM._("Создать раздел выше"), callback:_.bind(this.addItemBefore, this)}, {title:HM._("Создать раздел ниже"), callback:_.bind(this.addItemAfter, this)}, {title:HM._("Создать подраздел"), callback:_.bind(this.addSubItem, 
13999      this)}, {title:HM._("Переименовать"), callback:_.bind(this.renameItem, this)}, {title:HM._("Удалить"), callback:_.bind(this.deleteItem, this)}];
14000      var resourceList = this.config.resourceList;
14001      if (resourceList) {
14002        for (var i = 0, ln = resourceList.length;i < ln;i++) {
14003          var resourceListItem = resourceList[i];
14004          resourceListItem.callback = _.bind(this.createResItem, this);
14005          folderItems.push(resourceListItem);
14006        }
14007      }
14008      return folderItems;
14009    }, _getResourceMenuItems:function() {
14010      return[{title:HM._("Создать раздел выше"), callback:_.bind(this.addItemBefore, this)}, {title:HM._("Создать раздел ниже"), callback:_.bind(this.addItemAfter, this)}, {title:HM._("Редактировать ресурс"), callback:_.bind(this.editResItem, 
14011      this)}, {title:HM._("Посмотреть ресурс"), callback:_.bind(this.viewResItem, this)}, {title:HM._("Удалить"), callback:_.bind(this.deleteItem, this)}];
14012    }, _onContextItemClick:function(event, contextMenuItem) {
14013    }, _onTreeOut:function(event, ui) {
14014      var dragManager = this.getDragManager(), draggableNode = dragManager.getDraggableNode();
14015      if (draggableNode instanceof hm.core.ui.trainingModulesConstructor.ResourceItem) {
14016        dragManager.reset();
14017        dragManager.setDraggableNode(draggableNode);
14018      }
14019    }, getSubjectId:function() {
14020      return this.config.subjectId;
14021    }, getCourseId:function() {
14022      return this.config.courseId;
14023    }, getUpdateUrl:function() {
14024      if (this._updateUrl === undefined) {
14025        this._updateUrl = hm.core.Url.getInstance().url({module:"course", controller:"constructor", action:"update-structure", course_id:this.getCourseId(), subject_id:this.getSubjectId()});
14026      }
14027      return this._updateUrl;
14028    }, getRootContainer:function() {
14029      return this.getEl().find(".hm-tree-container");
14030    }, _nodeFactory:function(nodeData) {
14031      var isEditable = this.isEditable();
14032      var className = "hm.core.ui.trainingModulesConstructor.node.OrganizationNode";
14033      var config = {title:nodeData.title, childrenData:nodeData.children, tree:this, folder:nodeData.isFolder, iconClass:nodeData.iconClass, contextMenu:this._folderMenu, sql_data:nodeData.sql_data, draggable:isEditable, droppable:isEditable, editable:isEditable};
14034      if (!nodeData.isFolder) {
14035        className = "hm.core.ui.trainingModulesConstructor.node.ResourceNode";
14036        config.contextMenu = this._resourceMenu;
14037        config.editable = false;
14038        config.status = nodeData.res_data.status;
14039        config.notFound = nodeData.res_data.notFound;
14040      }
14041      var newNode = HM.create(className, config);
14042      if (!nodeData.isFolder && (nodeData.insertResource && nodeData.sql_res_data)) {
14043        newNode.insertResource = true;
14044        newNode.sql_res_data = nodeData.sql_res_data;
14045      }
14046      return newNode;
14047    }, getNewFolder:function() {
14048      var title = HM._("Новый раздел");
14049      var newNode = this.nodeFactory({title:title, isFolder:true, sql_data:{title:title}});
14050      newNode.setInsertAction();
14051      return newNode;
14052    }, getNewResource:function(data) {
14053      var title = data.title, status = data.sql_res_data ? data.sql_res_data.status : null;
14054      var newNode = this.nodeFactory({title:title, isFolder:false, iconClass:data.iconClass, sql_data:{title:title}, insertResource:true, res_data:{status:status}, sql_res_data:data.sql_res_data});
14055      newNode.setInsertAction();
14056      return newNode;
14057    }, addItemBefore:function(menuItem, targetNode) {
14058      targetNode.addNodeBefore(this.getNewFolder());
14059      this.checkTreeChanges();
14060    }, addItemAfter:function(menuItem, targetNode) {
14061      targetNode.addNodeAfter(this.getNewFolder());
14062      this.checkTreeChanges();
14063    }, addSubItem:function(menuItem, targetNode) {
14064      targetNode.prependNode(this.getNewFolder());
14065      targetNode.expand(true);
14066      this.checkTreeChanges();
14067    }, renameItem:function(menuItem, targetNode) {
14068      targetNode.editTitle();
14069    }, deleteItem:function(menuItem, targetNode) {
14070      targetNode.setDeleteAction();
14071      var children = this.getAllChildren(targetNode, false);
14072      for (var i = 0, ln = children.length;i < ln;i++) {
14073        children[i].setDeleteAction();
14074      }
14075      targetNode.remove();
14076      this.checkTreeChanges();
14077    }, createResItem:function(menuItem, targetNode) {
14078      var menuItemData = menuItem.getData();
14079      if (!menuItemData) {
14080        return;
14081      }
14082      targetNode.prependNode(this.getNewResource(menuItemData));
14083      targetNode.expand(true);
14084      this.checkTreeChanges();
14085    }, editResItem:function(menuItem, targetNode) {
14086      if (targetNode.editResource) {
14087        targetNode.editResource();
14088      }
14089    }, viewResItem:function(menuItem, targetNode) {
14090      if (targetNode.viewResource) {
14091        targetNode.viewResource();
14092      }
14093    }, checkTreeChanges:function(instant) {
14094      var nodes = this.getPlainTree(true), prev_ref = -1;
14095      for (var i = 0, ln = nodes.length;i < ln;i++) {
14096        var node = nodes[i], nodeLevel = node.getLevel();
14097        if (node.getSqlData("level") != nodeLevel) {
14098          node.setSqlData("level", nodeLevel);
14099          node.setUpdateAction();
14100        }
14101        if (node.getSqlData("prev_ref") != prev_ref) {
14102          node.setSqlData("prev_ref", prev_ref);
14103          node.setUpdateAction();
14104        }
14105        prev_ref = node.getSqlData("oid");
14106      }
14107      clearTimeout(this._saveTimer);
14108      if (instant) {
14109        this._updateTreeNodes();
14110      } else {
14111        this._saveTimer = setTimeout(_.bind(this._updateTreeNodes, this), 3500);
14112      }
14113    }, _updateTreeNodes:function() {
14114      this._updateRequired = true;
14115      if (this._isUpdating || this.getDragManager().isDragging()) {
14116        return;
14117      }
14118      this._isUpdating = true;
14119      this._updateRequired = false;
14120      this._updatingNodes = [];
14121      this._insertingNodes = [];
14122      var nodes = {update:[], insert:[], remove:[]};
14123      var treeNodes = this.getNodes();
14124      for (var i = 0, ln = treeNodes.length;i < ln;i++) {
14125        var node = treeNodes[i];
14126        if (node.hasInsertAction()) {
14127          nodes.insert.push(node.getActionData());
14128          this._insertingNodes.push(node);
14129        }
14130        if (node.hasUpdateAction()) {
14131          nodes.update.push(node.getActionData());
14132        }
14133        if (node.hasDeleteAction()) {
14134          nodes.remove.push(node.getActionData());
14135        }
14136        node.resetAction();
14137      }
14138      $.ajax({type:"POST", url:this.getUpdateUrl(), data:{nodes:nodes}}).done(_.bind(this._onUpdateDone, this));
14139    }, _onUpdateDone:function(data) {
14140      this._updateNewNodes(data[0]);
14141      this._isUpdating = false;
14142      if (this._updateRequired) {
14143        this.checkTreeChanges();
14144      }
14145    }, _updateNewNodes:function(data) {
14146      var nodes = this.getNodes();
14147      for (var i = 0, ln = nodes.length;i < ln;i++) {
14148        var node = nodes[i], nodeKey = node.getKey(), dataByKey = data[nodeKey];
14149        if (dataByKey) {
14150          if (node.hasUpdateAction()) {
14151            dataByKey.sql_data.title = node.config.sql_data.title;
14152          }
14153          node.config.sql_data = dataByKey.sql_data;
14154        }
14155      }
14156    }, _drop:function() {
14157      var _drop = arguments.callee;
14158      this.callParent(_drop, arguments);
14159      this.checkTreeChanges();
14160    }});
14161    self = hm.core.ui.trainingModulesConstructor.Tree;
14162  })();
14163  (function() {
14164    var self;
14165    HM.define("hm.core.ui.trainingModulesViewer.Bookmarks", {extend:"hm.core.ui.tree.Tree", config:{tplByClass:true, viewer:false, classNameSpace:"hm-tmw-bookmarks"}, _init:function() {
14166      var _init = arguments.callee;
14167      if (!this.config.viewer) {
14168        this._initContextMenu();
14169      }
14170      this.callParent(_init, arguments);
14171    }
14171, _initContextMenu:function() {
14172      this._contextMenu = HM.create("hm.core.ui.contextmenu.ContextMenu", {items:{addItemBefore:{title:HM._("Создать папку"), callback:_.bind(this.addFolder, this)}, renameItem:{title:HM._("Переименовать"), callback:_.bind(this.renameItem, this)}, deleteItem:{title:HM._("Удалить"), callback:_.bind(this.deleteItem, this)}}, listeners:{scope:this, 
14173      beforeShow:this._beforeContextShow, itemClick:this._onContextItemClick}});
14174    }, _drop:function() {
14175      var _drop = arguments.callee;
14176      this.callParent(_drop, arguments);
14177      this.checkTreeChanges();
14178    }, getNewFolder:function() {
14179      var title = HM._("Новая папка");
14180      var newNode = this.nodeFactory({title:title, isFolder:true, data:{title:title}});
14181      newNode.setState(hm.core.ui.tree.node.Node.STATE_CREATED);
14182      return newNode;
14183    }, addFolder:function(menuItem, targetNode) {
14184      targetNode.addNodeBefore(this.getNewFolder());
14185      this._updateTreeNodes();
14186    }, renameItem:function(menuItem, targetNode) {
14187      targetNode.editTitle();
14188    }, deleteItem:function(menuItem, targetNode) {
14189      targetNode.setState(hm.core.ui.tree.node.Node.STATE_DELETED);
14190      var children = this.getAllChildren(targetNode, false);
14191      for (var i = 0, ln = children.length;i < ln;i++) {
14192        children[i].setState(hm.core.ui.tree.node.Node.STATE_DELETED);
14193      }
14194      targetNode.remove();
14195      this.checkTreeChanges();
14196    }, getUpdateUrl:function() {
14197      if (this._updateUrl === undefined) {
14198        this._updateUrl = hm.core.Url.getInstance().url({module:"course", controller:"bookmarks", action:"update"});
14199      }
14200      return this._updateUrl;
14201    }, _getFactoryNodeName:function(nodeData) {
14202      return "hm.core.ui.trainingModulesViewer.node.BookmarkNode";
14203    }, _getFactoryNodeConfig:function(nodeData) {
14204      var _getFactoryNodeConfig = arguments.callee;
14205      var nodeConfig = this.callParent(_getFactoryNodeConfig, arguments);
14206      nodeConfig.contextMenu = this._contextMenu;
14207      return nodeConfig;
14208    }, _updateTreeNodes:function() {
14209      var nodes = this.getNodes(), nodeClass = hm.core.ui.tree.node.Node, nodesData = {update:[], insert:[], "delete":[]};
14210      for (var i = 0, ln = nodes.length;i < ln;i++) {
14211        var node = nodes[i], itemData = node.getItemData(), prevNode = node.getPrevNode(false, false), prevNodeItemData = undefined, nodeState = node.getState();
14212        if (prevNode) {
14213          prevNodeItemData = prevNode.getItemData();
14214        }
14215        if (nodeState === nodeClass.STATE_CHANGED) {
14216          if (prevNodeItemData) {
14217            itemData.prev_id = prevNodeItemData.bookmark_id;
14218          } else {
14219            itemData.prev_id = 0;
14220          }
14221          var parent = node.getParent();
14222          if (parent && !parent.isRoot()) {
14223            var parentItemData = parent.getItemData();
14224            itemData.parent_id = parentItemData.bookmark_id;
14225          } else {
14226            itemData.parent_id = 0;
14227          }
14228          itemData.title = node.getTitle();
14229          nodesData["update"].push(itemData);
14230        }
14231        if (nodeState === nodeClass.STATE_CREATED) {
14232          itemData["key"] = node.getKey();
14233          nodesData["insert"].push(itemData);
14234        }
14235        if (nodeState === nodeClass.STATE_DELETED) {
14236          nodesData["delete"].push(itemData);
14237        }
14238        node.setState(nodeClass.STATE_DEFAULT);
14239      }
14240      $.ajax({type:"POST", url:this.getUpdateUrl(), data:{nodes:nodesData}}).done(_.bind(this._onUpdateDone, this));
14241    }, _onUpdateDone:function(data) {
14242      if (data && data.nodes) {
14243        var nodes = data.nodes, ln = nodes.length;
14244        for (var i = 0;i < ln;i++) {
14245          var nodeData = nodes[i]["data"], nodeKey = nodes[i]["key"], node = this.getNode(nodeKey);
14246          if (node) {
14247            node.setItemData(nodeData);
14248          }
14249        }
14250        if (ln != 0) {
14251          this.checkTreeChanges(true);
14252        }
14253      }
14254    }});
14255    self = hm.core.ui.trainingModulesViewer.Bookmarks;
14256  })();
14257  (function() {
14258    var self;
14259    HM.define("hm.core.ui.trainingModulesViewer.Tree", {extend:"hm.core.ui.tree.Tree", config:{editable:false}, _init:function() {
14260      var _init = arguments.callee;
14261      this.callParent(_init, arguments);
14262    }, _initEvents:function() {
14263      var _initEvents = arguments.callee;
14264      this.callParent(_initEvents, arguments);
14265    }, _nodeFactory:function(nodeData) {
14266      var isEditable = this.isEditable();
14267      return HM.create("hm.core.ui.trainingModulesViewer.node.Node", {oid:nodeData.sql_data.oid, resourceId:nodeData.sql_data.vol2, title:nodeData.title, childrenData:nodeData.children, tree:this, folder:nodeData.isFolder, iconClass:nodeData.iconClass, draggable:isEditable, droppable:isEditable, editable:isEditable});
14268    }});
14269    self = hm.core.ui.trainingModulesViewer.Tree;
14270  })();
14271  (function() {
14272    var self;
14273    HM.define("hm.core.ui.trainingModulesConstructor.node.OrganizationNode", {extend:"hm.core.ui.tree.node.Node", config:{organizationId:null, sql_data:null}, _init:function() {
14274      var _init = arguments.callee;
14275      this.SQL_ACTION_INSERT = "insert";
14276      this.SQL_ACTION_UPDATE = "update";
14277      this.SQL_ACTION_DELETE = "delete";
14278      this.callParent(_init, arguments);
14279      if (!this.isFolder()) {
14280        this.getItemContainer().find(".hm-tree-node-icon").addClass("material-icon-small");
14281      }
14282    }, _beforeClick:function(e) {
14283      if (e.ctrlKey) {
14284        return false;
14285      }
14286      return true;
14287    }, setTitle:function() {
14288      var setTitle = arguments.callee;
14289      this.callParent(setTitle, arguments);
14290      this.config.sql_data.title = this.getTitle();
14291      this.setUpdateAction();
14292      this.getTree().checkTreeChanges();
14293    }, setInsertAction:function() {
14294      this._setSqlAction(this.SQL_ACTION_INSERT);
14295    }, setUpdateAction:function() {
14296      if (this.hasInsertAction()) {
14297        return;
14298      }
14299      this._setSqlAction(this.SQL_ACTION_UPDATE);
14300    }, setDeleteAction:function() {
14301      this._setSqlAction(this.SQL_ACTION_DELETE);
14302    }, hasInsertAction:function() {
14303      return this._getSqlAction() === this.SQL_ACTION_INSERT;
14304    }, hasUpdateAction:function() {
14305      return this._getSqlAction() === this.SQL_ACTION_UPDATE;
14306    }, hasDeleteAction:function() {
14307      return this._getSqlAction() === this.SQL_ACTION_DELETE;
14308    }, resetAction:function() {
14309      this._sqlAction = null;
14310    }, getSqlData:function(key) {
14311      if (_.isString(key)) {
14312        if (!this.config.sql_data[key]) {
14313          console.warn('Не найдены данные с ключом "' + key + '".');
14314        }
14315        return this.config.sql_data[key];
14316      }
14317      return this.config.sql_data;
14318    }, setSqlData:function(key, value) {
14319      this.config.sql_data[key] = value;
14320    }, getActionData:function() {
14321      var prevNode = this.getPrevNode(false, false);
14322      return{key:this.getKey(), prev_key:prevNode ? prevNode.getKey() : -1, sql_data:this.getSqlData()};
14323    }, _setSqlAction:function(action) {
14324      this._sqlAction = action;
14325    }, _getSqlAction:function() {
14326      return this._sqlAction;
14327    }});
14328    self = hm.core.ui.trainingModulesConstructor.node.OrganizationNode;
14329  })();
14330  (function() {
14331    var self;
14332    HM.define("hm.core.ui.trainingModulesConstructor.node.ResourceNode", {extend:"hm.core.ui.trainingModulesConstructor.node.OrganizationNode", config:{resourceId:null, tpl:"hm/core/ui/trainingModulesConstructor/node/ResourceNode", status:null, notFound:false}, _init:function() {
14333      var _init = arguments.callee;
14334      this.callParent(_init, arguments);
14335      this._baseUrlEditRes = hm.core.Url.getInstance().url({module:"resource", controller:"index", action:"edit-content"});
14336      this._baseUrlViewRes = hm.core.Url.getInstance().url({module:"resource", controller:"index", action:"view"});
14337      var config = this.config, itemContainer = this.getItemContainer(), title = this.getTitle();
14338      if (config.notFound) {
14339        itemContainer.addClass("hm-tree-node-item-notFound");
14340      } else {
14341        if (config.status == "0") {
14342          itemContainer.addClass("hm-tree-node-item-unpublished");
14343        }
14344      }
14345    }, getActionData:function() {
14346      var prevNode = this.getPrevNode(false, false);
14347      var data = {key:this.getKey(), prev_key:prevNode ? prevNode.getKey() : -1, sql_data:this.getSqlData()};
14348      if (this.insertResource) {
14349        data.insertResource = true;
14350        data.sql_res_data = this.sql_res_data;
14351        data.sql_res_data.title = data.sql_data.title;
14352      }
14353      return data;
14354    }, resourceId:function(id) {
14355      if (id !== undefined) {
14356        this.config.resourceId = id;
14357      }
14358      return this.config.resourceId;
14359    }, viewResource:function() {
14360      if (this.config.sql_data && this.config.sql_data.vol2) {
14361        var title = this.config.title, id = this.config.sql_data.vol2, url = this._baseUrlViewRes + "/resource_id/" + id;
14362        var w = window.open(url, "res_" + id + "_" + title, "toolbar=1,scrollbars=1,location=1,statusbar=0,menubar=1,resizable=1,width=800,height=600");
14363        $(w).load(function() {
14364          w.document.title = title;
14365        });
14366        w.focus();
14367      }
14368    }, editResource:function() {
14369      if (this.config.sql_data && this.config.sql_data.vol2) {
14370        var resId = this.config.sql_data.vol2, subjectId = this.getTree().getSubjectId();
14371        var url = this._baseUrlEditRes + "/resource_id/" + resId;
14372        if (subjectId) {
14373          url += "/subject_id/" + subjectId;
14374        }
14375        window.open(url, "_blank");
14376      }
14377    }});
14378    self = hm.core.ui.trainingModulesConstructor.node.ResourceNode;
14379  })();
14380  (function() {
14381    var self;
14382    HM.define("hm.core.ui.trainingModulesViewer.node.BookmarkNode", {extend:"hm.core.ui.tree.node.Node", config:{}, _init:function() {
14383      var _init = arguments.callee;
14384      this.callParent(_init, arguments);
14385    }, _beforeClick:function(e) {
14386      if (e.ctrlKey) {
14387        return false;
14388      }
14389      return true;
14390    }, _onClick:function(e) {
14391      var _onClick = arguments.callee;
14392      this.callParent(_onClick, arguments);
14393      if (!this.isFolder() && !this.getTree().config.viewer) {
14394        window.location.href = this.getViewUrl();
14395      }
14396    }, activate:function() {
14397      var activate = arguments.callee;
14398      if (this.isFolder()) {
14399        return;
14400      }
14401      this.callParent(activate, arguments);
14402    }, getViewUrl:function() {
14403      if (!this._viewUrl) {
14404        var itemData = this.getItemData(), viewer = this.getTree().config.viewer;
14405        if (viewer) {
14406          this._viewUrl = hm.core.Url({module:"resource", controller:"index", action:"view", resource_id:itemData["resource_id"]});
14407        } else {
14408          this._viewUrl = hm.core.Url({module:"course", controller:"bookmarks", action:"view", bookmark_id:itemData["bookmark_id"]});
14409        }
14410      }
14411      return this._viewUrl;
14412    }, getItemId:function() {
14413      var itemData = this.getItemData();
14414      return itemData["bookmark_id"];
14415    }, setTitle:function() {
14416      var setTitle = arguments.callee;
14417      this.callParent(setTitle, arguments);
14418      this.setState(hm.core.ui.tree.node.Node.STATE_CHANGED);
14419      this.getTree().checkTreeChanges();
14420    }});
14421    self = hm.core.ui.trainingModulesViewer.node.BookmarkNode;
14422  })();
14423  (function() {
14424    var self;
14425    HM.define("hm.core.ui.trainingModulesViewer.node.Node", {extend:"hm.core.ui.tree.node.Node", config:{tplByClass:true, resourceId:null, oid:null}, _init:function() {
14426      var _init = arguments.callee;
14427      this.callParent(_init, arguments);
14428    }, _beforeClick:function(e) {
14429      if (e.ctrlKey) {
14430        return false;
14431      }
14432      return true;
14433    }, isViewed:function() {
14434      return!!this._viewed;
14435    }, setViewed:function(flag) {
14436      this._viewed = !!flag;
14437      if (!this._viewedIcon) {
14438        this._viewedIcon = this.getItemContainer().find(".hm-tree-node-viewed");
14439      }
14440      if (flag) {
14441        this._viewedIcon.css("display", "inline-block");
14442      } else {
14443        this._viewedIcon.hide();
14444      }
14445    }, activate:function(value) {
14446      var activate = arguments.callee;
14447      if (this.isFolder()) {
14448        return;
14449      }
14450      if (this.isActive() == value) {
14451        hm.core.ui.trainingModulesViewer.Viewer.viewer.hideMenu();
14452      }
14453      this.callParent(activate, arguments);
14454    }, getViewUrl:function() {
14455      if (!this._viewUrl) {
14456        var url = this.getTree().getViewUrl();
14457        this._viewUrl = url + "/item_id/" + this.getItemId();
14458      }
14459      return this._viewUrl;
14460    }, getViewUrl:function(itemId) {
14461      if (!this._viewUrl) {
14462        var urlParams = {module:"course", controller:"item", action:"view"};
14463        var viewer = hm.core.ui.trainingModulesViewer.Viewer.viewer;
14464        if (viewer.getSubjectId()) {
14465          urlParams.subject_id = viewer.getSubjectId();
14466        }
14467        if (viewer.getLessonId()) {
14468          urlParams.lesson_id = viewer.getLessonId();
14469        }
14470        if (viewer.getCourseId()) {
14471          urlParams.course_id = viewer.getCourseId();
14472        }
14473        urlParams.item_id = this.getItemId();
14474        this._viewUrl = hm.core.Url.getInstance().url(urlParams);
14475      }
14476      return this._viewUrl;
14477    }, getEditUrl:function() {
14478      if (this.getResourceId() == 0) {
14479        return "";
14480      }
14481      if (!this._editUrl) {
14482        this._editUrl = hm.core.Url({module:"resource", controller:"index", action:"edit-content", resource_id:this.getResourceId()});
14483      }
14484      return this._editUrl;
14485    }, getResourceId:function() {
14486      return this.config.resourceId;
14487    }, getItemId:function() {
14488      return this.config.oid;
14489    }});
14490    self = hm.core.ui.trainingModulesViewer.node.Node;
14491  })();
14492  (function() {
14493    var self;
14494    var instance = null;
14495    HM.define("hm.module.mainPageWidgets.MainPageWidgets", {extend:"hm.core.ui.Component", config:{maxWidgetHeight:350, minWidgetWidthPercent:30, blocks:null, saveUrl:"/interface/edit/update-my", role:"guest", roles:null, adminMode:false, allowEditByUsers:false}, statics:{get:function() {
14496      if (!instance) {
14497        HM.create("hm.module.mainPageWidgets.MainPageWidgets");
14498      }
14499      return instance;
14500    }}, _init:function() {
14501      var _init = arguments.callee;
14502      instance = this;
14503      this.callParent(_init, arguments);
14504      this._widgets = [];
14505      var $rows = this._$el.find(".hm-widgets-row"), rows = [], config = this.config, adminMode = config.adminMode, currentRole = config.role, allowEditByUsers = config.allowEditByUsers, minWidgetWidthPercent = config.minWidgetWidthPercent, maxWidgetHeight = config.maxWidgetHeight;
14506      for (var i = 0, ln = $rows.length;i < ln;i++) {
14507        rows.push(HM.create("hm.module.mainPageWidgets.Row", {el:$rows.eq(i), maxWidgetHeight:maxWidgetHeight, minWidgetWidthPercent:minWidgetWidthPercent, editor:this, listeners:{scope:this, destroy:this._onRowDestroy, widgetAdded:this._onWidgetAdded, beginSorting:this._onBeginSorting, endSorting:this._onEndSorting, successSorting:this._onSuccessSorting, isEmpty:this._onRowEmpty}}));
14508      }
14509      this._rows = rows;
14510      this._checkRowsHeight();
14511      if (!adminMode && (currentRole !== "guest" && allowEditByUsers)) {
14512        this._toolbar = HM.create("hm.module.mainPageWidgets.toolbar.Toolbar", {renderTo:this._$el, editor:this, listeners:{scope:this, editButtonClick:this._onEditButtonClick}});
14513      }
14514      this._roleSwitcher = HM.create("hm.module.mainPageWidgets.toolbar.RoleToolbar", {roles:config.roles, role:config.role, adminMode:adminMode, renderTo:this._$el.find(".hm-widgets-topContainer"), listeners:{scope:this, saveButtonClick:this._onSaveButtonClick}});
14515      if (adminMode) {
14516        this.setEditMode(true);
14517      } else {
14518        this.setEditMode(false);
14519      }
14520    }, _initEvents:function() {
14521      var _initEvents = arguments.callee;
14522      this.callParent(_initEvents, arguments);
14523    }, _checkRowsHeight:function() {
14524      var rows = this._rows;
14525      for (var i = 0, ln = rows.length;i < ln;i++) {
14526        rows[i].checkWidgetHeight();
14527      }
14528    }, createNewEmptyRow:function(position) {
14529      var newRow = HM.create("hm.module.mainPageWidgets.Row", {tplByClass:true, maxWidgetHeight:this.config.maxWidgetHeight, minWidgetWidthPercent:this.config.minWidgetWidthPercent, renderTo:this._$el, editor:this, listeners:{scope:this, destroy:this._onRowDestroy, widgetAdded:this._onWidgetAdded, beginSorting:this._onBeginSorting, endSorting:this._onEndSorting, successSorting:this._onSuccessSorting, isEmpty:this._onRowEmpty}});
14530      var rows = this._rows;
14531      newRow.setEditMode(this._editMode);
14532      if (arguments.length && position !== -1) {
14533        var end = rows.splice(position);
14534        rows.push(newRow);
14535        rows.push.apply(rows, end);
14536        newRow.getEl().insertBefore(end[0].getEl());
14537      } else {
14538        rows.push(newRow);
14539      }
14540      return newRow;
14541    }, setEditMode:function(editMode) {
14542      var previousModeIsEditMode = this._editMode;
14543      this._editMode = editMode;
14544      var rows = this._rows, config = this.config;
14545      if (editMode) {
14546        this.checkAndFixEmptyRows();
14547      }
14548      for (var i = rows.length - 1;i >= 0;i--) {
14549        var row = rows[i];
14550        row.setEditMode(editMode);
14551        if (!editMode) {
14552          if (row.getUnAllocatedSpace() === 100) {
14553            row.destroy();
14554          }
14555        }
14556      }
14557      this.fireEvent("changeEditMode", editMode);
14558      if (!config.adminMode && (previousModeIsEditMode && config.allowEditByUsers)) {
14559        this.save();
14560      }
14561      if (editMode) {
14562        this._roleSwitcher.show();
14563      } else {
14564        this._roleSwitcher.hide();
14565      }
14566    }, getAvailableBlocks:function() {
14567      return this.config.blocks.all;
14568    }, getConfig:function() {
14569      var rows = this._rows, y = 0, result = [];
14570      for (var i = 0;i < rows.length;i++) {
14571        var items = rows[i].getItems();
14572        if (!items.length) {
14573          continue;
14574        }
14575        for (var x = 0;x < items.length;x++) {
14576          var item = items[x];
14577          result.push({x:x, y:y, block:item.getBlockCode(), width:item.getAllocatedSpace(), param_id:item.getBlockParamId(), style_id:item.getStyleId()});
14578        }
14579        y++;
14580      }
14581      return result;
14582    }, save:function() {
14583      var config = this.config, saveUrl = hm.core.Object.clone(config.saveUrl);
14584      if (config.adminMode) {
14585        saveUrl.role = config.role;
14586      }
14587      jQuery.ajax({url:hm.core.Url(saveUrl), method:"post", data:{widgets:JSON.stringify(this.getConfig())}}).done(function(data) {
14588        location.href = location.href;
14589      });
14590    }, getRole:function() {
14591      return this.config.role;
14592    }, registerWidget:function(widget) {
14593      this._widgets.push(widget);
14594    }, unRegisterWidget:function(widget) {
14595      var widgets = this._widgets, index = hm.core.Array.indexOf(widgets, widget);
14596      if (index === -1) {
14597        return;
14598      }
14599      widgets.splice(index, 1);
14600    }, getAllWidgets:function() {
14601      return this._widgets;
14602    }, checkAndFixEmptyRows:function() {
14603      var rows = this._rows, prev = null, next = null;
14604      for (var i = rows.length - 1;i >= 1;i--) {
14605        if (!rows[i].getAllocatedSpace() && !rows[i - 1].getAllocatedSpace()) {
14606          rows[i].destroy();
14607        }
14608      }
14609      for (var i = rows.length - 1;i >= 1;i--) {
14610        if (rows[i].getAllocatedSpace() && rows[i - 1].getAllocatedSpace()) {
14611          this.createNewEmptyRow(i);
14612        }
14613      }
14614      if (rows.length) {
14615        if (rows[rows.length - 1].getAllocatedSpace()) {
14616          this.createNewEmptyRow();
14617        }
14618        if (rows[0].getAllocatedSpace()) {
14619          this.createNewEmptyRow(0);
14620        }
14621      } else {
14622        this.createNewEmptyRow();
14623      }
14624      for (var i = rows.length - 1;i >= 0;i--) {
14625        rows[i].markAsFirstOrLast(i === rows.length - 1 || i === 0);
14626      }
14627    }, _onRowDestroy:function(e, row) {
14628      var rows = this._rows;
14629      for (var i = 0, ln = rows.length;i < ln;i++) {
14630        if (rows[i] === row) {
14631          rows.splice(i, 1);
14632          return;
14633        }
14634      }
14635    }, _onWidgetAdded:function(e, widget, row) {
14636      this.checkAndFixEmptyRows();
14637    }, _onEditButtonClick:function() {
14638      this.setEditMode(true);
14639    }, _onSaveButtonClick:function() {
14640      var config = this.config;
14641      if (config.adminMode) {
14642        this.save();
14643      } else {
14644        this.setEditMode(!this._editMode);
14645      }
14646    }, CLASS_SORTING:"hm-widgets_sorting", _onBeginSorting:function(e, srcRow, widget) {
14647      this._$el.addClass(this.CLASS_SORTING);
14648      var rows = this._rows, ln = rows.length, widgetWidth = widget.getAllocatedSpace(), allowDropToNextAndPrev = srcRow.getUnAllocatedSpace() + widgetWidth < 100;
14649      var targets = [];
14650      for (var i = 0;i < ln;i++) {
14651        var target = rows[i], targetIsEmpty = target.isEmpty();
14652        if (srcRow === target) {
14653          continue;
14654        }
14655        if (rows[i + 1] === srcRow && (targetIsEmpty && !allowDropToNextAndPrev)) {
14656          continue;
14657        }
14658        if (rows[i - 1] === srcRow && (targetIsEmpty && !allowDropToNextAndPrev)) {
14659          continue;
14660        }
14661        if (target.getUnAllocatedSpace() < widgetWidth) {
14662          continue;
14663        }
14664        targets.push(target);
14665      }
14666      srcRow.refreshSortableList(targets);
14667    }, _onEndSorting:function(e, row) {
14668      this._$el.removeClass(this.CLASS_SORTING);
14669      this.checkAndFixEmptyRows();
14670    }, _onSuccessSorting:function(e, row) {
14671      var rows = this._rows;
14672      for (var i = 0, ln = rows.length;i < ln;i++) {
14673        var checkRow = rows[i];
14674        checkRow.updateItemsArray();
14675        checkRow.checkCreateButtonVisibility();
14676        checkRow.checkCreateButtonPosition();
14677      }
14678    }, _onRowEmpty:function(e, row) {
14679      this.checkAndFixEmptyRows();
14680    }});
14681    self = hm.module.mainPageWidgets.MainPageWidgets;
14682  })();
14683  (function() {
14684    var self;
14685    HM.define("hm.module.mainPageWidgets.Row", {extend:"hm.core.ui.Component", config:{maxWidgetHe
14685ight:0, minWidgetWidthPercent:30, editor:null}, _checkWidgetListeners:function(widget) {
14686      var currentRow = widget.getRow();
14687      if (currentRow === this) {
14688        return;
14689      }
14690      var listeners = {destroy:this._onItemDestroy, needResize:this._onItemWantResize, needReCalcRowHeight:this._onItemSizeChanged};
14691      if (currentRow) {
14692        for (var eventName in listeners) {
14693          if (!listeners.hasOwnProperty(eventName)) {
14694            continue;
14695          }
14696          widget.un(eventName, listeners[eventName], currentRow);
14697        }
14698      }
14699      for (var eventName in listeners) {
14700        if (!listeners.hasOwnProperty(eventName)) {
14701          continue;
14702        }
14703        widget.on(eventName, listeners[eventName], this);
14704      }
14705      widget.setRow(this);
14706    }, _checkWidgetsListeners:function() {
14707      var items = this._items;
14708      for (var i = 0, ln = items.length;i < ln;i++) {
14709        this._checkWidgetListeners(items[i]);
14710      }
14711    }, _init:function() {
14712      var _init = arguments.callee;
14713      this.callParent(_init, arguments);
14714      this._items = [];
14715      var $widgets = this._$el.find(".hm-widgets-widget"), items = this._items, editor = this.config.editor;
14716      for (var i = 0, ln = $widgets.length;i < ln;i++) {
14717        items.push(HM.create("hm.module.mainPageWidgets.widget.Widget", {el:$widgets[i], editor:editor}));
14718      }
14719      if (this.getAllocatedSpace() > 100) {
14720        var itemsLength = items.length, fixWidth = Math.ceil(100 / itemsLength);
14721        for (var i = 0;i < itemsLength;i++) {
14722          items[i].setAllocatedSpace(fixWidth);
14723        }
14724      }
14725      this._checkWidgetsListeners();
14726      var me = this, $itemsContainer = this._getItemsContainer();
14727      this._$elItemsContainer = $itemsContainer;
14728      var connectWith = $itemsContainer === this._$el ? ".hm-widgets-row" : ".hm-widgets-row-content";
14729      $itemsContainer.sortable({placeholder:"hm-widgets-widget hm-widgets-widget-placeholder", forcePlaceholderSize:true, items:".hm-widgets-widget:not(.hm-widgets-row-createWidgetButton)", connectWith:connectWith, scroll:true, start:function(e, ui) {
14730        var placeHolder = ui.placeholder, item = ui.item, widget = hm.core.ui.Component.getComponent(item);
14731        placeHolder.innerWidth(item.width() - 1);
14732        placeHolder.height(80);
14733        item.css("opacity", 0.5);
14734        me.fireEvent("beginSorting", me, widget);
14735      }, stop:function(e, ui) {
14736        var item = ui.item, widget = hm.core.ui.Component.getComponent(item);
14737        item.css("opacity", 1);
14738        me.fireEvent("endSorting", me, widget);
14739      }, update:function(e, ui) {
14740        var item = ui.item, widget = hm.core.ui.Component.getComponent(item);
14741        me.fireEvent("successSorting", me, widget);
14742      }, over:function(e, ui) {
14743      }, out:function(e, ui) {
14744      }});
14745      this._checkReCalc = this._checkReCalc.bind(this);
14746      this._checkReCalcTimeout = setTimeout(this._checkReCalc, 250);
14747    }, _getItemsContainer:function() {
14748      var $content = this._$el.find(".hm-widgets-row-content");
14749      if ($content.length) {
14750        return $content;
14751      }
14752      return this._$el;
14753    }, _initEvents:function() {
14754      var _initEvents = arguments.callee;
14755      this.callParent(_initEvents, arguments);
14756    }, __destruct:function() {
14757      var __destruct = arguments.callee;
14758      clearTimeout(this._checkReCalcTimeout);
14759      this.callParent(__destruct, arguments);
14760    }, _setRowsHeight:function(height) {
14761      this._rowHeight = height;
14762      var items = this._items;
14763      for (var i = 0, ln = items.length;i < ln;i++) {
14764        items[i].setHeight(height);
14765      }
14766      if (this.createButtonIsVisible()) {
14767        this._editButton.setHeight(height);
14768      }
14769    }, getRowHeight:function() {
14770      return this._rowHeight;
14771    }, updateItemsArray:function() {
14772      var items = this.config.editor.getAllWidgets(), $widgets = this._$el.find(".hm-widgets-widget:not(.hm-widgets-row-createWidgetButton)"), newItems = [];
14773      for (var i = 0, ln = $widgets.length;i < ln;i++) {
14774        for (var j = 0, ln2 = items.length;j < ln2;j++) {
14775          if (items[j].getEl()[0] === $widgets[i]) {
14776            newItems.push(items[j]);
14777            break;
14778          }
14779        }
14780      }
14781      this._items = newItems;
14782      if (this.isEmpty()) {
14783        this._$el.addClass(this.CLASS_EMPTY);
14784      } else {
14785        this._$el.removeClass(this.CLASS_EMPTY);
14786      }
14787      this._checkWidgetsListeners();
14788    }
14788, checkWidgetHeight:function() {
14789      var items = this._items, maxRowHeight = 0, maxWidgetHeight = this.config.maxWidgetHeight;
14790      this._setRowsHeight("auto");
14791      for (var j = 0, wln = items.length;j < wln;j++) {
14792        var widget = items[j], widgetHeight = widget.getHeight();
14793        if (widgetHeight > maxRowHeight) {
14794          maxRowHeight = widgetHeight;
14795        }
14796      }
14797      if (this.createButtonIsVisible()) {
14798        var buttonHeight = this._editButton.getHeight();
14799        if (buttonHeight > maxRowHeight) {
14800          maxRowHeight = buttonHeight;
14801        }
14802      }
14803      if (maxWidgetHeight && maxRowHeight > maxWidgetHeight) {
14804        maxRowHeight = maxWidgetHeight;
14805      }
14806      if (maxRowHeight === 0) {
14807        maxRowHeight = 80;
14808      }
14809      this._setRowsHeight(maxRowHeight);
14810    }, CLASS_EMPTY:"hm-widgets-row_empty", CLASS_FIRST_OR_LAST:"hm-widgets-row_firstOrLast", isEmpty:function() {
14811      return!this._items.length;
14812    }, setEditMode:function(editMode) {
14813      if (this._editMode == editMode) {
14814        return;
14815      }
14816      this._editMode = editMode;
14817      var items = this._items;
14818      if (!this.isEmpty()) {
14819        this._$el.removeClass(this.CLASS_EMPTY);
14820      }
14821      if (editMode) {
14822        if (!this._editButton) {
14823          this._editButton = HM.create("hm.module.mainPageWidgets.button.CreateWidgetButton", {renderTo:this._$elItemsContainer, row:this, editor:this.config.editor});
14824          this._editButton.hide();
14825        }
14826        if (this.createButtonIsVisible()) {
14827          this._editButton.setAllocatedSpace(this.getUnAllocatedSpace());
14828          this._editButton.show();
14829        }
14830        this._$elItemsContainer.sortable("option", "disabled", false);
14831        if (this.isEmpty()) {
14832          this._$el.addClass(this.CLASS_EMPTY);
14833        }
14834      } else {
14835        if (this._editButton) {
14836          this._editButton.hide();
14837        }
14838        this._$elItemsContainer.sortable("option", "disabled", true);
14839      }
14840      for (var i = 0, ln = items.length;i < ln;i++) {
14841        items[i].setEditMode(editMode);
14842      }
14843      this.checkWidgetHeight();
14844    }, refreshSortableList:function(targets) {
14845      var $connectWith = new jQuery;
14846      for (var i = 0, ln = targets.length;i < ln;i++) {
14847        $connectWith.push(targets[i].getItemsContainer());
14848      }
14849      this._$elItemsContainer.sortable("option", "connectWith", $connectWith);
14850      this._$elItemsContainer.sortable("refresh");
14851    }, createButtonIsVisible:function() {
14852      return this._editMode && this.getUnAllocatedSpace() >= this.config.minWidgetWidthPercent;
14853    }, getUnAllocatedSpace:function() {
14854      return 100 - this.getAllocatedSpace();
14855    }, getAllocatedSpace:function() {
14856      var items = this._items, result = 0;
14857      for (var i = 0, ln = items.length;i < ln;i++) {
14858        result += items[i].getAllocatedSpace();
14859      }
14860      return result;
14861    }, getItemsContainer:function() {
14862      return this._$elItemsContainer;
14863    }, createWidget:function(widgetCode) {
14864      console.log(widgetCode);
14865      var url = hm.core.Url({module:"infoblock", controller:"index", action:"view", role:this.config.editor.getRole(), mode:"view", name:widgetCode});
14866      var me = this;
14867      jQuery.ajax({url:url}).done(function(data) {
14868        var $data = $(data), $container = $("<div>"), docLinks;
14869        docLinks = _.reduce(_.toArray(document.getElementsByTagName("link")), function(memo, link) {
14870          var href = link.getAttribute("href");
14871          if (href) {
14872            memo[href] = true;
14873          }
14874          return memo;
14875        }, {});
14876        var links = [], srcScripts = [], evalScripts = [], linksCount = 0;
14877        function onLinkLoad() {
14878          linksCount--;
14879          if (linksCount === 0) {
14880            for (var j = 0;j < srcScripts.length;j++) {
14881              jQuery.ajax({type:"GET", global:false, url:srcScripts[j].src, async:false, dataType:"script"});
14882            }
14883            for (var j = 0;j < evalScripts.length;j++) {
14884              var script = evalScripts[j], js = script.text || (script.textContent || (script.innerHTML || ""));
14885              $.globalEval(js.replace(/^\s*<!(?:\[CDATA\[|\-\-)/, "/*$0*/"));
14886            }
14887            me.checkWidgetHeight();
14888          }
14889        }
14890        for (var i = $data.length - 1;i >= 0;i--) {
14891          var node = $data[i];
14892          if (node.nodeName === "LINK") {
14893            var href = node.getAttribute("href");
14894            if (href && docLinks[href] !== true) {
14895              links.push(node);
14896              $(node).on("load", onLinkLoad);
14897            }
14898            $data.splice(i, 1);
14899          } else {
14900            if (node.nodeName === "SCRIPT") {
14901              var href = node.getAttribute("src");
14902              if (href) {
14903                srcScripts.push(node);
14904              } else {
14905                evalScripts.push(node);
14906              }
14907              $data.splice(i, 1);
14908            }
14909          }
14910        }
14911        linksCount = links.length;
14912        var $head = HM.$head();
14913        $head.append.apply($head, links);
14914        $head.append.apply($head, srcScripts);
14915        var widgetItem = HM.create("hm.module.mainPageWidgets.widget.Widget", {tplByClass:true, widgetContent:$data, code:widgetCode, editor:me.config.editor});
14916        me._checkWidgetListeners(widgetItem);
14917        widgetItem.setAllocatedSpace(me.getUnAllocatedSpace());
14918        widgetItem.setEditMode(me._editMode);
14919        me._items.push(widgetItem);
14920        if (!me.createButtonIsVisible()) {
14921          me._editButton.hide();
14922        }
14923        widgetItem.getEl().insertBefore(me._editButton.getEl());
14924        widgetItem.initWidgetContent();
14925        me.checkWidgetHeight();
14926        me.fireEvent("widgetAdded", widgetItem, this);
14927      });
14928    }, markAsFirstOrLast:function(value) {
14929      if (value) {
14930        this._$el.addClass(this.CLASS_FIRST_OR_LAST);
14931      } else {
14932        this._$el.removeClass(this.CLASS_FIRST_OR_LAST);
14933      }
14934    }, getItems:function() {
14935      return this._items;
14936    }, checkCreateButtonPosition:function() {
14937      var $elButton = this._editButton.getEl();
14938      if ($elButton.next(".hm-widgets-widget").length) {
14939        this._$elItemsContainer.append($elButton);
14940      }
14941    }, checkCreateButtonVisibility:function() {
14942      if (this.createButtonIsVisible()) {
14943        this._editButton.setAllocatedSpace(this.getUnAllocatedSpace());
14944        this._editButton.show();
14945      } else {
14946        this._editButton.hide();
14947      }
14948      this.checkWidgetHeight();
14949    }, _onItemDestroy:function(e, item) {
14950      var items = this._items;
14951      for (var i = 0, ln = items.length;i < ln;i++) {
14952        if (items[i] === item) {
14953          items.splice(i, 1);
14954          this.checkCreateButtonVisibility();
14955          if (!items.length) {
14956            this.fireEvent("isEmpty", this);
14957          }
14958          return;
14959        }
14960      }
14961    }, _onItemWantResize:function(e, item, width) {
14962      var minWidgetWidthPercent = this.config.minWidgetWidthPercent;
14963      if (width < minWidgetWidthPercent) {
14964        width = minWidgetWidthPercent;
14965      }
14966      var space = this.getUnAllocatedSpace() + item.getAllocatedSpace();
14967      console.log(space, width, item.getAllocatedSpace());
14968      if (space - width < 0) {
14969        width = space;
14970      }
14971      item.setAllocatedSpace(width);
14972      this.checkCreateButtonVisibility();
14973    }, _checkReCalc:function() {
14974      if (this._needReCalcHeight) {
14975        this.checkWidgetHeight();
14976      }
14977      this._needReCalcHeight = false;
14978      this._checkReCalcTimeout = setTimeout(this._checkReCalc, 250);
14979    }, _onItemSizeChanged:function() {
14980      this._needReCalcHeight = true;
14981    }});
14982    self = hm.module.mainPageWidgets.Row;
14983  })();
14984  (function() {
14985    var self;
14986    HM.define("hm.module.mainPageWidgets.toolbar.RoleToolbar", {extend:"hm.core.ui.Component", config:{tplByClass:true, roles:null, role:"admin", adminMode:false}, _init:function() {
14987      var _init = arguments.callee;
14988      var config = this.config, roles = config.roles, rolesNew = [];
14989      for (var role in roles) {
14990        if (!roles.hasOwnProperty(role)) {
14991          continue;
14992        }
14993        rolesNew.push({role:role, title:roles[role], selected:role === config.role});
14994      }
14995      this.roles = rolesNew;
14996      this.callParent(_init, arguments);
14997      this._$elUserSelect = this._$el.find("select");
14998    }, _initEvents:function() {
14999      var _initEvents = arguments.callee;
15000      this.callParent(_initEvents, arguments);
15001      this.elOn("change", "select", this._onRoleChange);
15002      this.elOn("click", ".hm-widgets-roleToolbar-button_confirm", this._onClickSaveButton);
15003      this.elOn("click", ".hm-widgets-roleToolbar-button_reset", this._onClickResetButton);
15004    }, _onRoleChange:function() {
15005      location.href = hm.core.Url({module:"interface", controller:"edit", action:"index", role:this._$elUserSelect.val()});
15006    }, _onClickSaveButton:function(e) {
15007      this.fireEvent("saveButtonClick");
15008    }, _onClickResetButton:function() {
15009      elsHelpers.confirm(HM._("Уверены, что хотите сбросить настройки виджетов для текущей роли?")).done(function() {
15010        jQuery.ajax({url:hm.core.Url({module:"interface", controller:"edit", action:"clear-me"}), type:"post"}).done(function(data) {
15011          location.href = location.href;
15012        });
15013      });
15014    }});
15015    self = hm.module.mainPageWidgets.toolbar.RoleToolbar;
15016  })();
15017  (function() {
15018    var self;
15019    HM.define("hm.module.mainPageWidgets.toolbar.Toolbar", {extend:"hm.core.ui.Component", config:{tplByClass:true, editor:null}, _init:function() {
15020      var _init = arguments.callee;
15021      this._editMode = false;
15022      this.callParent(_init, arguments);
15023      this._$elEditButton = this._$el.find(".hm-widgets-toolbar-editButton");
15024      this._$elResetButton = this._$el.find(".hm-widgets-toolbar-resetButton");
15025    }, _initEvents:function() {
15026      var _initEvents = arguments.callee;
15027      this.callParent(_initEvents, arguments);
15028      this.elOn("click", ".hm-widgets-toolbar-editButton", this._onClickEditButton);
15029      this.config.editor.on("changeEditMode", this._onChangeEditMode, this);
15030    }, _onClickEditButton:function(e) {
15031      this.fireEvent("editButtonClick");
15032    }, _onChangeEditMode:function(e, isEditMode) {
15033      this._editMode = isEditMode;
15034      var $el = this._$el, $editButton = this._$elEditButton;
15035      if (this._editMode) {
15036        $editButton.hide();
15037      } else {
15038        $editButton.show();
15039      }
15040    }});
15041    self = hm.module.mainPageWidgets.toolbar.Toolbar;
15042  })();
15043  (function() {
15044    var self;
15045    HM.define("hm.module.mainPageWidgets.widget.BaseWidget", {extend:"hm.core.ui.Component", config:{}, _init:function() {
15046      var _init = arguments.callee;
15047      this.callParent(_init, arguments);
15048      this._$elContentContainer = this._$el.find("> .hm-widgets-widget-content");
15049    }, _initEvents:function() {
15050      var _initEvents = arguments.callee;
15051      this.callParent(_initEvents, arguments);
15052    }, setAllocatedSpace:function(space) {
15053      this._$el.css({width:space + "%"});
15054    }, getHeight:function() {
15055      return this._$elContentContainer.height();
15056    }, setHeight:function(height) {
15057      return this._$elContentContainer.height(height);
15058    }, getWidth:function() {
15059      return this._$elContentContainer.width();
15060    }, setWidth:function(width) {
15061      return this._$elContentContainer.width(width);
15062    }});
15063    self = hm.module.mainPageWidgets.widget.BaseWidget;
15064  })();
15065  (function() {
15066    var self;
15067    HM.define("hm.module.mainPageWidgets.button.CreateWidgetButton", {extend:"hm.module.mainPageWidgets.widget.BaseWidget", config:{tplByClass:true, row:null, editor:null}, CLASS_VISIBILITY:"hm-widgets-widget-content_nowSelection", _init:function() {
15068      var _init = arguments.callee;
15069      this._initSelectData();
15070      this.callParent(_init, arguments);
15071    }, _initSelectData:function() {
15072      var all = this.config.editor.getAvailableBlocks(), groups = [];
15073      for (var i = 0, ln = all.length;i < ln;i = i + 2) {
15074        var widgets = [], nextAllItem = all[i + 1];
15075        for (var j = 0, ln2 = nextAllItem.length;j < ln2;j++) {
15076          widgets.push({id:nextAllItem[j].id, title:JSON.stringify(nextAllItem[j])});
15077        }
15078        groups.push({id:all[i].id, title:all[i].title, widgets:widgets});
15079      }
15080      this.groups = groups;
15081    }, _initEvents:function() {
15082      var _initEvents = arguments.callee;
15083      this.callParent(_initEvents, arguments);
15084      this.elOn("click", ".hm-widgets-row-createWidgetButton-widgetsSelect-submit", this._onClickAddWidget);
15085    }, _nowIsSelectionOfWidget:function(value) {
15086      if (value) {
15087        this._$elContentContainer.addClass(this.CLASS_VISIBILITY);
15088      } else {
15089        this._$elContentContainer.removeClass(this.CLASS_VISIBILITY);
15090      }
15091    }, initSelect:function() {
15092      var me = this;
15093      this._$elUserSelect = this._$el.find(".hm-widgets-row-createWidgetButton-widgetsSelect select");
15094      this._$elUserSelect.selectmenu({icons:null, menuWidth:400, maxHeight:300, format:function(text) {
15095        text = JSON.parse(text);
15096        return text.description ? "<h3>" + text.title + "</h3><p>" + text.description + "</p>" : "<h3>" + text.title + "</h3>";
15097      }});
15098      this._$elUserSelect.on("selectmenuopen", function() {
15099        me._nowIsSelectionOfWidget(true);
15100      });
15101      this.initSelect = HM.emptyFn;
15102    }, show:function() {
15103      var show = arguments.callee;
15104      this.callParent(show, arguments);
15105      this.initSelect();
15106    }, _onClickAddWidget:function() {
15107      var widget = this._$elUserSelect.val();
15108      if (!widget) {
15109        return;
15110      }
15111      this.config.row.createWidget(widget);
15112      this._nowIsSelectionOfWidget(false);
15113    }});
15114    self = hm.module.mainPageWidgets.button.CreateWidgetButton;
15115  })();
15116  (function() {
15117    var self;
15118    HM.define("hm.module.mainPageWidgets.widget.Widget", {extend:"hm.module.mainPageWidgets.widget.BaseWidget", config:{widgetContent:null, editor:null, row:null, code:""}, getRow:function() {
15119      return this.config.row;
15120    }, setRow:function(row) {
15121      this.config.row = row;
15122    }, _init:function() {
15123      var _init = arguments.callee;
15124      this.callParent(_init, arguments);
15125      this._config = this._$el.data("config");
15126      if (!this._config) {
15127        var block = this.config.code, blockParts = block.split("_");
15128        this._config = {width:0, block:blockParts[0]};
15129        if (blockParts.length === 2) {
15130          this._config.attribs = {param:blockParts[1]};
15131        }
15132      }
15133      this._config.width -= 0;
15134      this._$elContent = this._$elContentContainer.find("> *");
15135      this._checkHeight = this._checkHeight.bind(this);
15136      this._checkHeightTimeout = setTimeout(this._checkHeight, 0);
15137      this.config.editor.registerWidget(this);
15138    }, _initEvents:function() {
15139      var _initEvents = arguments.callee;
15140      this.callParent(_initEvents, arguments);
15141      this.elOn("click", ".hm-widgets-widget-button-delete", this._onClickDelete);
15142      this.elOn("mousedown", ".hm-widgets-widget-splitter", this._onSplitterMouseDown);
15143    }, __destruct:function() {
15144      var __destruct = arguments.callee;
15145      clearTimeout(this._checkHeightTimeout);
15146      this.config.editor.unRegisterWidget(this);
15147      this.callParent(__destruct, arguments);
15148    }, initWidgetContent:function() {
15149      var $widget = this.config.widgetContent;
15150      if ($widget) {
15151        this._$elContentContainer.append($widget);
15152      }
15153    }, _checkHeight:function() {
15154      var currentHeight = this._$elContent.height();
15155      if (this._previousHeight !== currentHeight) {
15156        this.fireEvent("needReCalcRowHeight");
15157      }
15158      this._previousHeight = currentHeight;
15159      this._checkHeightTimeout = setTimeout(this._checkHeight, 250);
15160    }, getAllocatedSpace:function() {
15161      return this._config.width;
15162    }, setAllocatedSpace:function(space) {
15163      var setAllocatedSpace = arguments.callee;
15164      this.callParent(setAllocatedSpace, arguments);
15165      this._config.width = space;
15166      this._$el.find(".hm-widgets-widget-resize input").val(space);
15167    }, getBlockCode:function() {
15168      return this._config.block;
15169    }, getStyleId:function() {
15170      return this._config.style_id;
15171    }, getBlockParamId:function() {
15172      var config = this._config;
15173      if (!config.attribs) {
15174        return "";
15175      }
15176      if (!config.attribs.param) {
15177        return "";
15178      }
15179      return config.attribs.param;
15180    }, setEditMode:function(editMode) {
15181      if (editMode == this._editMode) {
15182        return;
15183      }
15184      this._editMode = editMode;
15185      if (editMode) {
15186        if (!this._$elOverlay) {
15187          this._$elOverlay = this._renderTemplate("hm/module/mainPageWidgets/widget/Widget.overlay");
15188        }
15189        this.showSettings();
15190        this._$el.append(this._$elOverlay);
15191        this.setAllocatedSpace(this._config.width);
15192      } else {
15193        if (this._$elOverlay) {
15194          this._$elOverlay.detach();
15195        }
15196        this.hideSettings();
15197      }
15198    }, showSettings:function() {
15199      this._initSettings();
15200    }, hideSettings:function() {
15201      if (!this._settingsInited) {
15202        return;
15203      }
15204      this._$elSettings.detach();
15205    }, _initSettings:function() {
15206      if (this._settingsInited) {
15207        this._$el.append(this._$elSettings);
15208        return;
15209      }
15210      this._$elSettings = this._renderTemplate("hm/module/mainPageWidgets/widget/Widget.settings");
15211      var me = this, $select = this._$elSettings.find('select[name="style_id"]');
15212      this._$elColor = $select;
15213      $select.val(me._config.style_id);
15214      $select.on("change", function() {
15215        var oldStyleId = me._config.style_id, newStyleId = $(this).val();
15216        me.getEl().removeClass("hm-widgets-widget-style-" + oldStyleId);
15217        me._config.style_id = newStyleId;
15218        me.getEl().addClass("hm-widgets-widget-style-" + newStyleId);
15219      });
15220      this._settingsInited = true;
15221      this._$el.append(this._$elSettings);
15222      this._$elColor.selectmenu({icons:null, width:100, maxHeight:300});
15223      this._$elColor.on("selectmenuopen", function() {
15224        me._nowIsSelectionOfColor(true);
15225      });
15226      this._$elColor.on("selectmenuclose", function() {
15227        me._nowIsSelectionOfColor(false);
15228      });
15229    }, CLASS_COLOR_SELECTION:"hm-widgets-widget_colorSelection", _nowIsSelectionOfColor:function(value) {
15230      if (value) {
15231        this._$el.addClass(this.CLASS_COLOR_SELECTION);
15232      } else {
15233        this._$el.removeClass(this.CLASS_COLOR_SELECTION);
15234      }
15235    }, _onClickDelete:function() {
15236      var me = this;
15237      elsHelpers.confirm(HM._("Уверены, что хотите удалить виджет?")).done(function() {
15238        me.destroy();
15239      });
15240    }, _onSplitterMouseDown:function(e) {
15241      var startX = e.clientX, editor = this.config.editor, fullWidth = editor.getWidth(), currentWidgetWidth = this.getWidth(), $doc = HM.$document(), me = this;
15242      e.preventDefault();
15243      e.stopPropagation();
15244      editor.getEl().addClass("hm-widgets-resizing");
15245      function getCurrentAllocatedWidth(currentX) {
15246        return Math.round((currentWidgetWidth - startX + currentX) * 100 / fullWidth);
15247      }
15248      function onMove(e) {
15249        var aWidth = getCurrentAllocatedWidth(e.clientX);
15250        me.fireEvent("needResize", me, aWidth);
15251        e.preventDefault();
15252      }
15253      function onUp(e) {
15254        onMove(e);
15255        unBind();
15256        editor.getEl().removeClass("hm-widgets-resizing");
15257      }
15258      $doc.on("mousemove", onMove);
15259      $doc.on("mouseup", onUp);
15260      function unBind() {
15261        $doc.off("mousemove", onMove);
15262        $doc.off("mouseup", onUp);
15263      }
15264    }});
15265    self = hm.module.mainPageWidgets.widget.Widget;
15266  })();
15267  (function() {
15268    var self;
15269    HM.define("hm.module.base.ui.Accordion", {singleton:true, config:{}, _getEar:function() {
15270      var $ear = $(".accordion-expander.container-ear");
15271      if ($ear.length) {
15272        this._getEar = function() {
15273          return $ear;
15274        };
15275      }
15276      return $ear;
15277    }, hide:function() {
15278      var me = this;
15279      elsHelpers.store.init().then(function() {
15280        var state = this.get("accordion-column-state"), meStore = this;
15281        if (!state || state === "expanded") {
15282          setTimeout(function() {
15283            var $elEar = me._getEar();
15284            if ($elEar.length) {
15285              $elEar.trigger("click", ["immediate"]);
15286            } else {
15287              meStore.set("accordion-column-state", "collapsed");
15288            }
15289          }, 0);
15290        }
15291      });
15292    }, show:function() {
15293      var me = this;
15294      elsHelpers.store.init().then(function() {
15295        var state = this.get("accordion-column-state"), meStore = this;
15296        if (!state || state === "collapsed") {
15297          setTimeout(function() {
15298            var $elEar = me._getEar();
15299            if ($elEar.length) {
15300              $elEar.trigger("click", ["immediate"]);
15301            } else {
15302              meStore.set("accordion-column-state", "expanded");
15303            }
15304          }, 0);
15305        }
15306      });
15307    }, initFirstState:function() {
15308      var storeReady = false, accordionReady = false, store = null, me = this;
15309      function check() {
15310        if (!storeReady || !accordionReady) {
15311          return;
15312        }
15313        if (store.get("accordion-column-state") == "collapsed") {
15314          me._getEar().trigger("click", ["immediate"]);
15315        }
15316      }
15317      elsHelpers.store.init().then(function() {
15318        storeReady = true;
15319        store = this;
15320        check();
15321      });
15322      HM.$document().one("accordioncreate", function(event) {
15323        accordionReady = true;
15324        check();
15325      });
15326    }});
15327    self = hm.module.base.ui.Accordion;
15328  })();
15329  (function() {
15330    var self;
15331    HM.define("hm.module.base.ui.Document", {statics:{setAsPrintable:function(cfg) {
15332      var ns = HM.create("hm.core.ui.ClassNameSpace", {ns:"hm-document_printable"}), defaultCfg = {noUserBlock:true, noLogo:true, noMenu:true, noBreadCrumbs:true, noTitle:true, noFooter:true}, classes = {noUserBlock:ns("", "noUserBlock"), noLogo:ns("", "noLogo"), noMenu:ns("", "noMenu"), noBreadCrumbs:ns("", "noBreadCrumbs"), noTitle:ns("", "noTitle"), noFooter:ns("", "noFooter")}, $html = HM.$html();
15333      cfg = hm.core.Object.extend(defaultCfg, cfg || {});
15334      for (var i in classes) {
15335        if (!classes.hasOwnProperty(i) || !cfg[i]) {
15336          continue;
15337        }
15338        $html.addClass(classes[i]);
15339      }
15340      $html.addClass(ns());
15341    }}});
15342    self = hm.module.base.ui.Document;
15343  })();
15344  (function() {
15345    var self;
15346    HM.define("hm.module.score.ui.Score", {extend:"", config:{}, statics:{init:function() {
15347      var $doc = HM.$document(), scaleValues = {BINARY:{ON:1, NA:-1}, TERNARY:{ON:1, OFF:0, NA:-1}};
15348      $doc.on("click", ".form-score-ternary .els-icon", function(event) {
15349        var $this = $(this), $parent = $this.closest(".hm-score-ternary-icon");
15350        if ($parent.hasClass("hm-score-ternary-icon-readonly")) {
15351          return;
15352        }
15353        var $others = $this.parent().find(".els-icon.cross, .els-icon.check").not(this), $input = $this.closest(".form-score-ternary").find("input:first"), values = scaleValues.TERNARY;
15354        if ($this.hasClass("cross")) {
15355          $this.toggleClass("cross-checked");
15356        } else {
15357          if ($this.hasClass("check")) {
15358            $this.toggleClass("check-checked");
15359          }
15360        }
15361        if ($this.hasClass("cross-checked")) {
15362          $others.removeClass("check-checked");
15363          $input.val(values.OFF);
15364        } else {
15365          if ($(this).hasClass("check-checked")) {
15366            $others.removeClass("cross-checked");
15367            $input.val(values.ON);
15368          } else {
15369            $input.val(values.NA);
15370          }
15371        }
15372      });
15373      $(function() {
15374        $(".hm_score_numeric").bind("click keyup blur", function(event) {
15375          var $this = $(this), targetId = $this.data("target"), value = $this.val();
15376          $("#" + targetId).val(value !== "" ? value : -1);
15377        });
15378      });
15379      $doc.on("click", ".hm-score-binary-icon", function(e) {
15380        var $this = $(this);
15381        if ($this.hasClass("hm-score-binary-icon-readonly")) {
15382          return;
15383        }
15384        var $input = $this.parent().find("input:first"), BINARY = scaleValues.BINARY;
15385        $this.toggleClass("check-checked");
15386        if ($input.val() == BINARY.NA) {
15387          $input.val(BINARY.ON);
15388        } else {
15389          $input.val(BINARY.NA);
15390        }
15391      });
15392    }}});
15393    self = hm.module.score.ui.Score;
15394  })();
15395  (function() {
15396    var self;
15397    HM.define("hm.module.base.ui.ajax.AjaxSpinner", {extend:"hm.core.ui.Component", config:{tpl:"hm/module/base/ui/ajax/AjaxSpinner", renderTo:"body", toggleDuration:400, toggleEffect:"fade"}, _init:function() {
15398      var _init = arguments.callee;
15399      this.callParent(_init, arguments);
15400      this._ajaxCounter = 0;
15401      this._visible = false;
15402    }, _initEvents:function() {
15403      var _initEvents = arguments.callee;
15404      this.callParent(_initEvents, arguments);
15405      var $doc = $(document);
15406      $doc.on("ajaxStart", this._onAjaxStart.bind(this));
15407      $doc.on("ajaxStop", this._onAjaxEnd.bind(this));
15408      this._onTogglingComplete = this._onTogglingComplete.bind(this);
15409    }, _show:function() {
15410      this._toggleRunned = true;
15411      this._visible = true;
15412      this.getEl().show({duration:this.config.toggleDuration, effect:this.config.toggleEffect, complete:this._onTogglingComplete});
15413    }, _hide:function() {
15414      this._toggleRunned = true;
15415      this._visible = false;
15416      this.getEl().hide({duration:this.config.toggleDuration, effect:this.config.toggleEffect, complete:this._onTogglingComplete});
15417    }, _checkState:function() {
15418      if (this._toggleRunned || this._disabled) {
15419        return;
15420      }
15421      if (this._ajaxCounter > 0 && !this._visible) {
15422        this._show();
15423      }
15424      if (this._ajaxCounter === 0 && this._visible) {
15425        this._hide();
15426      }
15427    }, disable:function() {
15428      this._disabled = true;
15429      this._visible = false;
15430      this.getEl().hide();
15431    }, _onTogglingComplete:function() {
15432      this._toggleRunned = false;
15433      this._checkState();
15434    }, _onAjaxStart:function() {
15435      this._ajaxCounter++;
15436      this._checkState();
15437    }, _onAjaxEnd:function() {
15438      this._ajaxCounter--;
15439      this._checkState();
15440    }});
15441    HM.singleton(hm.module.base.ui.ajax.AjaxSpinner);
15442    self = hm.module.base.ui.ajax.AjaxSpinner;
15443  })();
15444  (function() {
15445    var self;
15446    HM.define("hm.module.base.ui.like.Like", {extend:"hm.core.ui.Component", config:{elTag:"span", likeCount:0, dislikeCount:0, vote:0, itemType:0, itemId:0, showDislikeButton:false, tpl:"hm/module/base/ui/like/Like"}, _init:function() {
15447      var _init = arguments.callee;
15448      var config = this.config;
15449      this._likeCount = config.likeCount;
15450      this._dislikeCount = config.dislikeCount;
15451      this._vote = config.vote;
15452      this.callParent(_init, arguments);
15453      this.setVote(config.vote);
15454    }, _initEvents:function() {
15455      var _initEvents = arguments.callee;
15456      this.callParent(_initEvents, arguments);
15457      this.elOn("click", ".hm-like-button-like", this.onClick_like, this);
15458      this.elOn("click", ".hm-like-button-dislike", this.onClick_dislike, this);
15459    }, setLikeCount:function(value) {
15460      this.getEl().find(".hm-like-button-like > .hm-like-button-like-counter").text(value);
15461      this._likeCount = value;
15462    }, setDislikeCount:function(value) {
15463      this.getEl().find(".hm-like-button-dislike > .hm-like-button-like-counter").text(value);
15464      this._dislikeCount = value;
15465    }, TYPE_LIKE:"LIKE", TYPE_DISLIKE:"DISLIKE", sendLike:function(type) {
15466      this._locked = true;
15467      var config = this.config;
15468      var params = {like_type:type, item_type:config.itemType, item_id:config.itemId};
15469      $.ajax({type:"post", url:"/like/index/like", data:params, success:this.onSendLikeSuccess.bind(this), error:this.onSendLikeFailure.bind(this)});
15470    }, setVote:function(vote) {
15471      this._vote = vote;
15472      var $el = this.getEl();
15473      $el.removeClass("hm-like-liked");
15474      $el.removeClass("hm-like-disliked");
15475      switch(vote) {
15476        case -1:
15477          $el.addClass("hm-like-disliked");
15478          break;
15479        case 1:
15480          $el.addClass("hm-like-liked");
15481          break;
15482      }
15483    }, onClick_like:function() {
15484      if (this._locked) {
15485        return;
15486      }
15487      if (this._vote == -1) {
15488        this.setDislikeCount(this._dislikeCount - 1);
15489      }
15490      if (this._vote == 1) {
15491        this.setVote(0);
15492        this.setLikeCount(this._likeCount - 1);
15493      } else {
15494        this.setVote(1);
15495        this.setLikeCount(this._likeCount + 1);
15496      }
15497      this.sendLike(this.TYPE_LIKE);
15498    }, onClick_dislike:function() {
15499      if (this._locked) {
15500        return;
15501      }
15502      if (this._vote == 1) {
15503        this.setLikeCount(this._likeCount - 1);
15504      }
15505      if (this._vote == -1) {
15506        this.setVote(0);
15507        this.setDislikeCount(this._dislikeCount - 1);
15508      } else {
15509        this.setVote(-1);
15510        this.setDislikeCount(this._dislikeCount + 1);
15511      }
15512      this.sendLike(this.TYPE_DISLIKE);
15513    }, onSendLikeSuccess:function(result) {
15514      result = $.parseJSON(result);
15515      if (result.message === "OK") {
15516        result = result.result;
15517        this.setLikeCount(result.count_like);
15518        this.setDislikeCount(result.count_dislike);
15519      }
15520      this._locked = false;
15521    }, onSendLikeFailure:function() {
15522      alert(result.message);
15523      this._locked = false;
15524    }});
15525    self = hm.module.base.ui.like.Like;
15526  })();
15527  (function() {
15528    var self;
15529    var counter = 0;
15530    HM.define("hm.module.course.ui.list.CourseDescriptionTabs", {extend:"hm.core.ui.Component", config:{tpl:"hm/module/course/ui/list/CourseDescriptionTabs", lessons:null, course_id:0, hideTabs:[]}, _init:function() {
15531      var _init = arguments.callee;
15532      this.tab_id = "hm-subject-list-item-description-" + ++counter;
15533      this._stableJqueryUi = hm.core.jQuery.uiVersionIsGreaterThan(1, 11);
15534      this.callParent(_init, arguments);
15535    }, _initEvents:function() {
15536      var _initEvents = arguments.callee;
15537      this.callParent(_initEvents, arguments);
15538    }, _renderTo:function() {
15539      var _renderTo = arguments.callee;
15540      this.callParent(_renderTo, arguments);
15541      var $el = this._$el, tabsCfg = {}, onTabActivate = this._onTabActivate.bind(this);
15542      if (this._stableJqueryUi) {
15543        tabsCfg.activate = onTabActivate;
15544      } else {
15545        tabsCfg.show = onTabActivate;
15546      }
15547      $el.tabs(tabsCfg);
15548    }, tabDisplay:function(tabname) {
15549      if (this.config.hideTabs.indexOf(tabname) != -1) {
15550        return "none";
15551      }
15552      return "inline-block";
15553    }, _loadProgress:function($panel) {
15554      if (this._progressLoaded) {
15555        return;
15556      }
15557      this._progressLoaded = true;
15558      var url = hm.core.Url.getInstance().url({module:"course", controller:"mark", action:"get-stat", course_id:this.config.course_id, user_id:HM.getService("User").getUserId()});
15559      var $el = this.getEl(), me = this, $spinner = this._getSpinner();
15560      $panel.append($spinner);
15561      $.ajax({url:url, async:true}).done(function(data) {
15562        $spinner.remove();
15563        if (!data.maxValue) {
15564          var $emptyCont = $('<div class="hm-subject-list-item-description-panel-empty"><div></div></div>');
15565          $panel.html("");
15566          $emptyCont.find("div").text(HM._("Прогресса нет"));
15567          $panel.append($emptyCont);
15568          return;
15569        }
15570        var styles = {};
15571        styles.best = "width: " + data.maxValueOfStudents * 100 / data.maxValue + "%";
15572        styles.my = "width: " + data.value * 100 / data.maxValue + "%";
15573        if (data.threshold === null) {
15574          styles[3] = "display: none";
15575        } else {
15576          styles[3] = "width: " + data.threshold * 100 / data.maxValue + "%";
15577        }
15578        $panel.html(me._renderTemplate("hm/module/course/ui/list/CourseDescriptionTabs.progress", {styles:styles}));
15579      });
15580    }, _getSpinner:function() {
15581      return $('<div class="ajax-spinner-local"></div>');
15582    }, _loadEvents:function($panel) {
15583      if (this._eventsLoaded) {
15584        return;
15585      }
15586      this._eventsLoaded = true;
15587      this._$eventsSpinner = this._getSpinner();
15588      this._eventsStore = HM.create("hm.module.es.data.store.EventServiceCourseStore", {listeners:{scope:this, data_loaded:this._onEventsLoaded}});
15589      this._eventList = HM.create("hm.module.es.ui.event.list.EventList", {fullMode:true, showHeader:false, store:this._eventsStore, groupsCollapsible:false});
15590      $panel.append(this._eventList.getEl());
15591      $panel.append(this._$eventsSpinner);
15592      this._eventsStore.load({singleSubject:this.config.course_id});
15593    }, _onTabActivate:function(event, ui) {
15594      var $panel;
15595      if (this._stableJqueryUi) {
15596        $panel = $(ui.newPanel);
15597      } else {
15598        $panel = $(ui.panel);
15599      }
15600      if ($panel.hasClass("hm-subject-list-item-description-progress")) {
15601        this._loadProgress($panel);
15602        return;
15603      }
15604      if ($panel.hasClass("hm-subject-list-item-description-events")) {
15605        this._loadEvents($panel);
15606        return;
15607      }
15608    }, _onEventsLoaded:function() {
15609      this._$eventsSpinner.remove();
15610      delete this._$eventsSpinner;
15611      if (this._eventsStore.getItemsCount()) {
15612        return;
15613      }
15614      var $panel = this.getEl().find(".hm-subject-list-item-description-events"), $emptyCont = $('<div class="hm-subject-list-item-description-panel-empty"><div></div></div>');
15615      $panel.html("");
15616      $emptyCont.find("div").text(HM._("Обновлений нет"));
15617      $panel.append($emptyCont);
15618    }});
15619    self = hm.module.course.ui.list.CourseDescriptionTabs;
15620  })();
15621  (function() {
15622    var self;
15623    HM.define("hm.module.course.ui.marksheet.ScrollBar", {extend:"hm.core.ui.Component", config:{tplByClass:true, scrollSize:100, classNameSpace:"hm-marksheet-scrollbar"}, _init:function() {
15624      var _init = arguments.callee;
15625      this.callParent(_init, arguments);
15626      this._onMouseUp = this._onMouseUp.bind(this);
15627      this._onMouseMove = this._onMouseMove.bind(this);
15628      this._$elScroller = this._ns.find("scroller");
15629      this._$elScroller.css({width:this.config.scrollSize + "%"});
15630    }, _initEvents:function() {
15631      var _initEvents = arguments.callee;
15632      this.callParent(_initEvents, arguments);
15633      this._ns.on("mousedown", "scroller", this._onMouseDown);
15634    }, _onMouseDown:function(e) {
15635      var $scroller = this._$elScroller, begin = {scroller:{left:$scroller.position().left, width:$scroller.width()}, mouse:{x:e.screenX}};
15636      HM.$document().on("mouseup", this._onMouseUp);
15637      HM.$document().on("mousemove", begin, this._onMouseMove);
15638      e.preventDefault();
15639    }, _onMouseMove:function(e) {
15640      var begin = e.data, left = begin.scroller.left + e.screenX - begin.mouse.x, maxLeft = this.getEl().width() - begin.scroller.width - 4;
15641      if (left < 1) {
15642        left = 1;
15643      }
15644      if (left > maxLeft) {
15645        left = maxLeft;
15646      }
15647      this._$elScroller.css({left:left + "px"});
15648      this.fireEvent("scroll", left / maxLeft);
15649      try {
15650        window.getSelection().removeAllRanges();
15651      } catch (e) {
15652        document.selection.empty();
15653      }
15654    }, _onMouseUp:function(e) {
15655      HM.$document().off("mouseup", this._onMouseUp);
15656      HM.$document().off("mousemove", this._onMouseMove);
15657    }});
15658    self = hm.module.course.ui.marksheet.ScrollBar;
15659  })();
15660  (function() {
15661    var self;
15662    HM.define("hm.module.quest.ui.samplingOfQuestionsEditor.ClusterEditor", {extend:"hm.core.ui.Component", config:{tplByClass:true, formElement:null, title:HM._("Блок"), id:0, questions:null, categories:null, formNamePrefix:"", classNameSpace:"hm-quest-samplingOfQuestionsEditor-cluster"}, _init:function() {
15663      var _init = arguments.callee;
15664      this.getFormNamePrefix = this.getFormNamePrefix.bind(this);
15665      this._errors = [];
15666      this.callParent(_init, arguments);
15667      this._initQuestions();
15668      var ns = this._ns, config = this.config;
15669      this._$elCount = ns.find("count");
15670      this._$elQuestionsCount = ns.find("info-count");
15671      this._$elQuestionsCountDescription = ns.find("info-count-description");
15672      this.CLASS_COUNT_ERROR = ns.getClass("count", "error");
15673      this.CLASS_COUNT_MAXIMUM = ns.getClass("count", "maximum");
15674      this.CLASS_INFO_COUNT_ERROR = ns.getClass("info-count", "error");
15675      if (config.questions) {
15676        this.setRandomQuestionsCount(config.questions.length);
15677      }
15678    }, _initQuestions:function() {
15679      var ns = this._ns, $questions = ns.find("question"), questions = {}, i, ln;
15680      for (i = 0, ln = $questions.length;i < ln;i++) {
15681        var $question = $questions.eq(i), id = $question.data("id");
15682        $question.on("change", this._onQuestionChange.bind(this));
15683        questions[id] = $question;
15684      }
15685      this._$elQuestions = $questions;
15686      this._questions = questions;
15687      var questionConfigs = this.config.questions, categoryInfo = {};
15688      for (i = 0, ln = questionConfigs.length;i < ln;i++) {
15689        var questionConfig = questionConfigs[i], questionId = questionConfig.id, questionCategoryId = questionConfig.category_id;
15690        categoryInfo[questionId] = questionCategoryId;
15691      }
15692      this._categoryInfo = categoryInfo;
15693    }, _initEvents:function() {
15694      var _initEvents = arguments.callee;
15695      this.callParent(_initEvents, arguments);
15696      this._$elCount.on("change", this._onChangeRandomQuestionsCount.bind(this));
15697    }, getQuestionCategoryId:function(questionId) {
15698      return this._categoryInfo[questionId];
15699    }, getFormNamePrefix:function() {
15700      return this.config.formNamePrefix + "[clusters][" + this.config.id + "]";
15701    }, getQuestionClass:function() {
15702      console.log(arguments, this);
15703    }, setValue:function(cluster) {
15704      this._$elQuestions.removeAttr("checked");
15705      if (cluster.questions) {
15706        var questions = cluster.questions, checkBoxes = this._questions;
15707        for (var id in questions) {
15708          if (!questions.hasOwnProperty(id)) {
15709            continue;
15710          }
15711          if (!checkBoxes.hasOwnProperty(id)) {
15712            continue;
15713          }
15714          checkBoxes[id].attr("checked", "checked");
15715        }
15716      }
15717      this.setRandomQuestionsCount(cluster.count);
15718    }, getValue:function() {
15719      var questions = {}, checked = this.getCheckedQuestions();
15720      for (var i = 0, ln = checked.length;i < ln;i++) {
15721        questions[checked[i]] = 1;
15722      }
15723      return{count:this.getRandomQuestionsCount(), questions:questions};
15724    }, getQuestionsCount:function() {
15725      return this.config.questions.length;
15726    }, getRandomQuestionsCount:function() {
15727      return this._$elCount.val() - 0;
15728    }, setRandomQuestionsCount:function(value) {
15729      var $elCount = this._$elCount, CLASS_COUNT_MAXIMUM = this.CLASS_COUNT_MAXIMUM, questionsCount = this.getQuestionsCount();
15730      if (questionsCount < value) {
15731        value = questionsCount;
15732      }
15733      if (questionsCount == value) {
15734        $elCount.addClass(CLASS_COUNT_MAXIMUM);
15735      } else {
15736        $elCount.removeClass(CLASS_COUNT_MAXIMUM);
15737      }
15738      $elCount.val(value);
15739      this.updateState();
15740    }, getCheckedQuestions:function() {
15741      var result = [], checkBoxes = this._questions;
15742      for (var id in checkBoxes) {
15743        if (!checkBoxes.hasOwnProperty(id)) {
15744          continue;
15745        }
15746        if (checkBoxes[id].attr("checked")) {
15747          result.push(id);
15748        }
15749      }
15750      return result;
15751    }, getCheckedQuestionsCount:function() {
15752      return this.getCheckedQuestions().length;
15753    }, getUnCheckedQuestions:function() {
15754      var result = [], checkBoxes = this._questions;
15755      for (var id in checkBoxes) {
15756        if (!checkBoxes.hasOwnProperty(id)) {
15757          continue;
15758        }
15759        if (!checkBoxes[id].attr("checked")) {
15760          result.push(id);
15761        }
15762      }
15763      return result;
15764    }, updateState:function() {
15765      var config = this.config, categories = config.categories, categoriesCount = categories.length, formElement = config.formElement, categoryValues = formElement.getCategoryValues(), categoryLimitEnabled = formElement.getCategoryLimit(), checkedQuestions = this.getCheckedQuestions(), checkedQuestionsCount = checkedQuestions.length, unCheckedQuestions = this.getUnCheckedQuestions(), unCheckedQuestionsCount = unC
15765heckedQuestions.length, questionsCount = this.getQuestionsCount(), questionsRandomCount = 
15766      this.getRandomQuestionsCount(), checkedCategories = {}, unCheckedCategories = {}, i, ln, categoryId, errors = [];
15767      this._$elQuestionsCount.text(checkedQuestionsCount + questionsRandomCount);
15768      this._$elQuestionsCountDescription.text("(" + checkedQuestionsCount + "/" + questionsRandomCount + ")");
15769      if (categoryLimitEnabled) {
15770        for (i = 0;i < categoriesCount;i++) {
15771          categoryId = categories[i].id;
15772          checkedCategories[categoryId] = 0;
15773          unCheckedCategories[categoryId] = 0;
15774        }
15775        for (i = 0;i < checkedQuestionsCount;i++) {
15776          var checkedQuestionId = checkedQuestions[i], checkedQuestionCategoryId = this.getQuestionCategoryId(checkedQuestionId);
15777          checkedCategories[checkedQuestionCategoryId]++;
15778        }
15779        for (i = 0;i < unCheckedQuestionsCount;i++) {
15780          var unCheckedQuestionId = unCheckedQuestions[i], unCheckedQuestionCategoryId = this.getQuestionCategoryId(unCheckedQuestionId);
15781          unCheckedCategories[unCheckedQuestionCategoryId]++;
15782        }
15783        var availableRandomQuestions = questionsRandomCount;
15784        for (i = 0;i < categoriesCount;i++) {
15785          var category = categories[i];
15786          categoryId = category.id;
15787          var checkedCount = checkedCategories[categoryId], unCheckedCount = unCheckedCategories[categoryId], limit = categoryValues[categoryId];
15788          if (limit < checkedCount) {
15789            errors.push(HM._('Количество выбранных вопросов категории "' + category.title + '" больше установленного лимита'));
15790          }
15791          if (limit > checkedCount) {
15792            var needRandomQuestions = limit - checkedCount;
15793            if (needRandomQuestions > availableRandomQuestions || unCheckedCount < needRandomQuestions) {
15794              errors.push(HM._('Невозможно подобрать нужное количество вопросов категории "' + category.title + '"'));
15795            } else {
15796              availableRandomQuestions -= needRandomQuestions;
15797            }
15798          }
15799        }
15800        if (availableRandomQuestions > 0) {
15801          errors.push(HM._("Суммарное количество выбранных вопросов превышает лимит, установленный для категорий"));
15802        }
15803      }
15804      var CLASS_INFO_COUNT_ERROR = this.CLASS_INFO_COUNT_ERROR, CLASS_COUNT_ERROR = this.CLASS_COUNT_ERROR, $elQuestionsCount = this._$elQuestionsCount, $elCount = this._$elCount;
15805      if (checkedQuestionsCount + questionsRandomCount > questionsCount) {
15806        $elQuestionsCount.addClass(CLASS_INFO_COUNT_ERROR);
15807        errors.push(HM._("Несоответствие количества вопросов в блоке к количеству требуемых вопросов в тесте"));
15808      } else {
15809        $elQuestionsCount.removeClass(CLASS_INFO_COUNT_ERROR);
15810      }
15811      if (errors.length) {
15812        $elCount.addClass(CLASS_COUNT_ERROR);
15813      } else {
15814        $elCount.removeClass(CLASS_COUNT_ERROR);
15815      }
15816      $elCount.attr("title", errors.join("\n"));
15817      this._errors = errors;
15818      this.fireEvent("stateUpdated");
15819    }, isValid:function() {
15820      return!this._errors.length;
15821    }, _onChangeRandomQuestionsCount:function() {
15822      this.setRandomQuestionsCount(this._$elCount.val() - 0);
15823    }, _onQuestionChange:function() {
15824      this.updateState();
15825    }});
15826    self = hm.module.quest.ui.samplingOfQuestionsEditor.ClusterEditor;
15827  })();
15828  (function() {
15829    var self;
15830    HM.define("hm.module.quest.ui.samplingOfQuestionsEditor.Editor", {extend:"hm.core.ui.Component", config:{tplByClass:true, categories:null, clustersList:null, name:"data", classNameSpace:"hm-quest-samplingOfQuestionsEditor", callBackUrl:{url:"/", title:HM._("Назад")}, value:null}, _init:function() {
15831      var _init = arguments.callee;
15832      this.getFormNamePrefix = this.getFormNamePrefix.bind(this);
15833      this.callParent(_init, arguments);
15834      var ns = this._ns;
15835      this._$elCategories = ns.find("categories");
15836      this._$elContent = ns.find("content");
15837      this._$elCategoryLimitSwitcher = ns.find("categoryLimitSwitcher");
15838      this._$elTable = ns.find("clusters");
15839      this._$elTotalCount = ns.find("total-count");
15840      this._$elFooter = ns.find("footer");
15841      this._$elSubmit = this._$elFooter.find("button");
15842      this.CLASS_TOTAL_COUNT_ERROR = ns.getClass("total-count", "error");
15843      this.CLASS_SAVING = ns.getClass("", "saving");
15844      this.CLASS_INVALID = ns.getClass("", "invalid");
15845      var config = this.config;
15846      this._initCategories(config.categories);
15847      this._initClusters(config.clustersList);
15848      if (config.value) {
15849        this.setValue(config.value);
15850      }
15851    }, _initCategories:function(categories) {
15852      var formName = this.getFormNamePrefix(), $categories = this._$elCategories, result = {}, $inputs = new jQuery;
15853      for (var i = 0, ln = categories.length;i < ln;i++) {
15854        var id = categories[i].id, name = formName + "[category][" + categories[i].id + "]", $categoryInput = this._$elContent, $category = $categories.find('[name="' + name + '"]');
15855        $category.on("change", this._onCategoryChange.bind(this, id));
15856        $inputs.push($category[0]);
15857        result[id] = $category;
15858      }
15859      this._categoryInputs = result;
15860      this._$elCategoryInputs = $inputs;
15861      this.setCategoryLimit(false);
15862    }
15862, _initClusters:function(clustersList) {
15863      var list = {}, $table = this._$elTable, $footer = this._$elFooter, categories = this.config.categories, formNamePrefix = this.getFormNamePrefix();
15864      for (var i = 0, ln = clustersList.length;i < ln;i++) {
15865        var cluster = clustersList[i];
15866        var clusterCmp = HM.create("hm.module.quest.ui.samplingOfQuestionsEditor.ClusterEditor", {formElement:this, title:cluster.title, id:cluster.id, questions:cluster.questions, categories:categories, formNamePrefix:formNamePrefix, listeners:{scope:this, stateUpdated:this._onClusterStateUpdated}});
15867        clusterCmp.getEl().insertBefore($footer);
15868        list[cluster.id] = clusterCmp;
15869      }
15870      this._clusters = list;
15871    }, _initEvents:function() {
15872      var _initEvents = arguments.callee;
15873      this.callParent(_initEvents, arguments);
15874      var ns = this._ns;
15875      ns.on("click", "save", this._onClickSave);
15876      ns.on("click", "back", this._onClickBack);
15877      this._$elCategoryLimitSwitcher.on("change", this._onSwitcherChanged.bind(this));
15878    }, _checkState:function() {
15879      var clusters = this._clusters;
15880      for (var id in clusters) {
15881        if (!clusters.hasOwnProperty(id)) {
15882          continue;
15883        }
15884        clusters[id].updateState();
15885      }
15886      this._changed = true;
15887    }, getScrollBarWidth:function() {
15888      return hm.core.DOM.getScrollBarWidth() + 1;
15889    }, getFormNamePrefix:function() {
15890      return this.config.name;
15891    }, setCategoryLimit:function(value, silent) {
15892      var $inputs = this._$elCategoryInputs, $switcher = this._$elCategoryLimitSwitcher;
15893      if (value) {
15894        $switcher.attr("checked", "checked");
15895        $inputs.removeAttr("disabled");
15896      } else {
15897        $switcher.removeAttr("checked");
15898        $inputs.attr("disabled", "disabled");
15899      }
15900      if (!silent) {
15901        this._checkState();
15902      }
15903    }, getCategoryLimit:function() {
15904      return!!this._$elCategoryLimitSwitcher.attr("checked");
15905    }, setValue:function(value) {
15906      var id;
15907      this.setCategoryLimit(value.categoryLimitEnabled, true);
15908      if (value.category) {
15909        var categoryValues = value.category, categoryInputs = this._categoryInputs;
15910        for (id in categoryValues) {
15911          if (!categoryValues.hasOwnProperty(id)) {
15912            continue;
15913          }
15914          if (!categoryInputs.hasOwnProperty(id)) {
15915            continue;
15916          }
15917          categoryInputs[id].val(categoryValues[id]);
15918        }
15919      }
15920      if (value.clusters) {
15921        var clusterValues = value.clusters, clusters = this._clusters;
15922        for (id in clusterValues) {
15923          if (!clusterValues.hasOwnProperty(id)) {
15924            continue;
15925          }
15926          if (!clusters.hasOwnProperty(id)) {
15927            continue;
15928          }
15929          clusters[id].setValue(clusterValues[id]);
15930        }
15931      }
15932      this._checkState();
15933      this._changed = false;
15934    }, getValue:function() {
15935      var clusters = this._clusters, clusterValues = {}, id;
15936      for (id in clusters) {
15937        if (!clusters.hasOwnProperty(id)) {
15938          continue;
15939        }
15940        clusterValues[id] = clusters[id].getValue();
15941      }
15942      return{clusters:clusterValues, category:this.getCategoryValues(), categoryLimitEnabled:this.getCategoryLimit()};
15943    }, getCategoryValues:function() {
15944      var categoryInputs = this._categoryInputs, categoryValues = {};
15945      for (var id in categoryInputs) {
15946        if (!categoryInputs.hasOwnProperty(id)) {
15947          continue;
15948        }
15949        categoryValues[id] = categoryInputs[id].val();
15950      }
15951      return categoryValues;
15952    }, _onCategoryChange:function(id, e) {
15953      console.log(e, id);
15954      this._checkState();
15955    }, _onSwitcherChanged:function() {
15956      this.setCategoryLimit(this.getCategoryLimit());
15957    }, _onClusterStateUpdated:function() {
15958      var clusters = this._clusters, total = 0, valid = true;
15959      for (var id in clusters) {
15960        if (!clusters.hasOwnProperty(id)) {
15961          continue;
15962        }
15963        var cluster = clusters[id];
15964        total += cluster.getRandomQuestionsCount();
15965        total += cluster.getCheckedQuestionsCount();
15966        valid = valid && cluster.isValid();
15967      }
15968      var $elTotalCount = this._$elTotalCount, CLASS_TOTAL_COUNT_ERROR = this.CLASS_TOTAL_COUNT_ERROR, $elSubmit = this._$elSubmit, $el = this._$el, CLASS_INVALID = this.CLASS_INVALID;
15969      $elTotalCount.text(total);
15970      if (valid) {
15971        $elTotalCount.removeClass(CLASS_TOTAL_COUNT_ERROR);
15972        $el.removeClass(CLASS_INVALID);
15973      } else {
15974        $elTotalCount.addClass(CLASS_TOTAL_COUNT_ERROR);
15975        $el.addClass(CLASS_INVALID);
15976      }
15977      this._changed = true;
15978    }, _onClickSave:function(e) {
15979      e.preventDefault();
15980      var $el = this._$el, CLASS_SAVING = this.CLASS_SAVING, ErrorBox = hm.core.ui.errorbox.ErrorBox;
15981      $el.addClass(CLASS_SAVING);
15982      ErrorBox.clear();
15983      this._changed = false;
15984      jQuery.ajax({type:"post", data:{data:JSON.stringify(this.getValue())}, url:location.href}).done(function() {
15985        ErrorBox.showMessage({type:ErrorBox.TYPE_SUCCESS, message:HM._("Выборка вопросов успешно сохранена")});
15986      }).fail(function() {
15987        ErrorBox.showMessage({type:ErrorBox.TYPE_ERROR, message:HM._("Произошла ошибка при сохранении выборки вопросов")});
15988      }).always(function() {
15989        $el.removeClass(CLASS_SAVING);
15990      });
15991    }, _onClickBack:function(e) {
15992      e.preventDefault();
15993      var callBackUrl = this.config.callBackUrl.url;
15994      function go() {
15995        location.href = callBackUrl;
15996      }
15997      if (!this._changed) {
15998        go();
15999      } else {
16000        elsHelpers.confirm(HM._("Уверены, что хотите прервать настройку выборки вопросов? Все изменения будут потеряны.")).done(go);
16001      }
16002    }});
16003    self = hm.module.quest.ui.samplingOfQuestionsEditor.Editor;
16004  })();
16005  (function() {
16006    var self;
16007    HM.define("hm.module.user.ui.role.switcher.RoleSwitcher", {extend:"hm.core.ui.Component", config:{elTag:"span", tplByClass:true, userRoles:[], inheritUsers:[], enduserSwitch:true, classNameSpace:"hm-user-roleSwitcher"}, _init:function() {
16008      var _init = arguments.callee;
16009      this.callParent(_init, arguments);
16010      this.CLASS_DISABLED = this._ns.getClass(false, "disabled");
16011      var roles = this.config.userRoles || [], rolesWithoutEmployee = [], roleEndUser = null;
16012      for (var i in roles) {
16013        if (!roles.hasOwnProperty(i)) {
16014          continue;
16015        }
16016        if (!this.isEndUser(roles[i].basic_name)) {
16017          rolesWithoutEmployee.push(roles[i]);
16018        } else {
16019          if (this.config.enduserSwitch) {
16020            roleEndUser = roles[i];
16021          }
16022        }
16023      }
16024      if (roleEndUser) {
16025        this.ENDUSER_NAME = roleEndUser.basic_name;
16026        roleEndUser.alias = this._renderTemplate({tpl:this.getTemplateNameByClass("item/EndUserItem"), returnString:true});
16027        rolesWithoutEmployee.push(roleEndUser);
16028      }
16029      this._collection = HM.create("hm.core.Collection", {data:rolesWithoutEmployee});
16030      var $el = this._$el, ns = this._ns;
16031      this._$elLeftPart = ns.find("left");
16032      this._$elCenterPart = ns.find("center");
16033      if (this.config.enduserSwitch && this._collection.length() <= 2) {
16034        ns.find("trigger").remove();
16035      }
16036      var currentRole = this._collection.find("current", true);
16037      if (currentRole) {
16038        this.setValue(currentRole.get("basic_name"));
16039      }
16040    }, _initEvents:function() {
16041      var ns = this._ns;
16042      if (this.config.enduserSwitch && this._collection.length() > 2) {
16043        ns.on("click", "left", this._onClickButton);
16044      } else {
16045        ns.on("click", "left", this._onClickTrigger);
16046      }
16047      ns.on("click", "right", this._onClickTrigger);
16048      ns.on("click", "center", this._onClickTrigger);
16049      HM.$document().on("click", this._onClick_document.bind(this));
16050    }, isEndUser:function(basic_name) {
16051      var inheritUsers = this.config.inheritUsers[basic_name];
16052      if (!inheritUsers) {
16053        return false;
16054      }
16055      for (var i = 0;i < inheritUsers.length;i++) {
16056        if (inheritUsers[i] === "enduser") {
16057          return true;
16058        }
16059      }
16060      return false;
16061    }, disable:function() {
16062      if (this.disabled) {
16063        return;
16064      }
16065      this._$el.addClass(this.CLASS_DISABLED);
16066      this._$elCenterPart.text(HM._("Режим управления"));
16067      this.disabled = true;
16068    }, enable:function() {
16069      if (!this.disabled) {
16070        return;
16071      }
16072      this._$el.removeClass(this.CLASS_DISABLED);
16073      this.disabled = false;
16074    }, showMenu:function() {
16075      if (this.disabled) {
16076        return;
16077      }
16078      var position = this._$elCenterPart.offset(), $menuEl = this._menu.getEl(), menuNs = HM.create("hm.core.ui.ClassNameSpace", {ns:this.config.classNameSpace, scope:this, $el:$menuEl});
16079      $menuEl.css({left:position.left, top:position.top + this._$el.height()});
16080      var $endUserItem = menuNs.find("menu-item-enduser");
16081      if (this.value == this.ENDUSER_NAME) {
16082        $endUserItem.hide();
16083      } else {
16084        $endUserItem.show();
16085      }
16086      hm.core.PopupManager.show($menuEl[0], this._onHideMenu, this, true);
16087      this._menuShowed = true;
16088    }, hideMenu:function() {
16089      var $menuEl = this._menu.getEl();
16090      hm.core.PopupManager.hide($menuEl[0]);
16091    }, setLocation:function(roleName) {
16092      window.location.href = "/switch/role/" + roleName;
16093    }, setValue:function(basic_name, redirect) {
16094      this.value = basic_name;
16095      if (basic_name === this.ENDUSER_NAME) {
16096        this.disable();
16097      } else {
16098        var currentRole = this._collection.find("basic_name", basic_name);
16099        this._$elCenterPart.text(currentRole.get("alias"));
16100        this.enable();
16101      }
16102      if (redirect) {
16103        this.setLocation(basic_name);
16104      }
16105    }, _onClickButton:function() {
16106      if (this.disabled) {
16107        this.enable();
16108      } else {
16109        this.disable();
16110        if (this.value !== this.ENDUSER_NAME) {
16111          this.setLocation(this.ENDUSER_NAME);
16112        }
16113      }
16114    }, _onClick_document:function(e) {
16115      if (e.target === this._$elLeftPart[0]) {
16116        return;
16117      }
16118      this.setValue(this.value);
16119    }, _onGetListCls:function(model) {
16120      var role = model.get("basic_name"), ns = this._ns;
16121      if (role === this.ENDUSER_NAME) {
16122        return ns.getClass("menu-item", "enduser");
16123      } else {
16124        return ns.getClass("menu-item", role);
16125      }
16126    }, _onClickTrigger:function(e) {
16127      if (this.config.enduserSwitch && this._collection.length() === 2) {
16128        if (this.isEndUser(this.value)) {
16129          this.setValue(this._collection.models[0].get("basic_name"), true);
16130        } else {
16131          this.setValue(this.ENDUSER_NAME, true);
16132        }
16133        return;
16134      }
16135      if (this.disabled) {
16136        this._onClickButton();
16137      }
16138      if (!this._menu) {
16139        this._menu = HM.create("hm.core.ui.List", {className:this._ns.getClass("menu"), collection:this._collection, displayField:"al
16139ias", valueField:"basic_name", listeners:{select:this._onSelect, scope:this}, getCls:this._onGetListCls.bind(this)});
16140      }
16141      if (!this._menuShowed) {
16142        this.showMenu();
16143      } else {
16144        this.hideMenu();
16145      }
16146      e.stopPropagation();
16147    }, _onHideMenu:function() {
16148      this._menuShowed = false;
16149      if (this.value === this.ENDUSER_NAME) {
16150        this.disable();
16151      }
16152    }, _onSelect:function(e, list, model) {
16153      var name = model.get("basic_name"), needChangeRole = this.value !== name;
16154      this.setValue(name);
16155      this.hideMenu();
16156      if (needChangeRole) {
16157        this.setLocation(name);
16158      }
16159    }});
16160    self = hm.module.user.ui.role.switcher.RoleSwitcher;
16161  })();
16162  (function() {
16163    var self;
16164    HM.define("hm.module.blog.service.BlogService", {extend:"hm.core.BaseService", viewBlog:function(blog_id, subject_id) {
16165      location.href = this.getViewBlogUrl(blog_id, subject_id);
16166    }, getViewBlogUrl:function(blog_id, subject_id) {
16167      return hm.core.Url.getInstance().url({module:"blog", controller:"index", action:"view", subject_id:subject_id ? subject_id : 0, blog_id:blog_id});
16168    }, getBlogListUrl:function(subject_id, subject) {
16169      if (arguments.length === 0) {
16170        return hm.core.Url.getInstance().url({module:"blog", controller:"index", action:"index"});
16171      }
16172      return hm.core.Url.getInstance().url({module:"blog", controller:"index", action:"index", subject_id:subject_id, subject:subject || "subject"});
16173    }});
16174    self = hm.module.blog.service.BlogService;
16175  })();
16176  (function() {
16177    var self;
16178    HM.define("hm.module.course.service.CourseService", {extend:"hm.core.BaseService", getListOfGraduatedCoursesUrl:function() {
16179      return hm.core.Url.getInstance().url({module:"subject", controller:"list", action:"list", "list-switcher":"past"});
16180    }, showGraduatedCourses:function() {
16181      location.href = this.getListOfGraduatedCoursesUrl();
16182    }});
16183    self = hm.module.course.service.CourseService;
16184  })();
16185  (function() {
16186    var self;
16187    HM.define("hm.module.course.service.lesson.LessonService", {extend:"hm.core.BaseService", viewLesson:function(lesson_id, subject_id) {
16188      location.href = this.getLessonUrl(lesson_id, subject_id);
16189    }, getLessonUrl:function(lesson_id, subject_id) {
16190      return hm.core.Url.getInstance().url({module:"lesson", controller:"execute", action:"index", subject_id:subject_id, lesson_id:lesson_id});
16191    }, getLessonListUrl:function(subject_id) {
16192      return hm.core.Url.getInstance().url({module:"lesson", controller:"list", action:"index", subject_id:subject_id});
16193    }, getMyLessonsListUrl:function(subject_id) {
16194      return hm.core.Url.getInstance().url({module:"lesson", controller:"list", action:"my", subject_id:subject_id});
16195    }});
16196    self = hm.module.course.service.lesson.LessonService;
16197  })();
16198  (function() {
16199    var self;
16200    HM.define("hm.module.course.service.material.MaterialService", {extend:"hm.core.BaseService", getListUrl:function(subject_id) {
16201      return hm.core.Url.getInstance().url({module:"subject", controller:"materials", action:"index", subject_id:subject_id});
16202    }});
16203    self = hm.module.course.service.material.MaterialService;
16204  })();
16205  (function() {
16206    var self;
16207    HM.define("hm.module.forum.service.ForumService", {extend:"hm.core.BaseService", viewForum:function(section_id, forum_id) {
16208      location.href = this.getViewForumUrl(section_id, forum_id);
16209    }, viewInternalForumUrl:function(subject_id, section_id) {
16210      location.href = this.getViewInternalForumUrl(subject_id, section_id);
16211    }, getViewForumUrl:function(section_id, forum_id) {
16212      var url = hm.core.Url.getInstance().url({module:"forum"});
16213      url += "/" + forum_id + "/" + section_id;
16214      return url;
16215    }, getViewInternalForumUrl:function(subject_id, section_id) {
16216      var url = hm.core.Url.getInstance().url({module:"forum"});
16217      url += "/subject/subject/" + subject_id + "/" + section_id;
16218      return url;
16219    }});
16220    self = hm.module.forum.service.ForumService;
16221  })();
16222  (function() {
16223    var self;
16224    HM.define("hm.module.message.service.MessageService", {extend:"hm.core.BaseService", viewMessage:function(message_id) {
16225      HM.create("hm.ui.message.ViewMessageDialog", {message_id:message_id});
16226    }, viewMessageList:function() {
16227      location.href = this.getMessageListUrl();
16228    }, getMessageListUrl:function() {
16229      return hm.core.Url.getInstance().url({module:"message", controller:"view", action:"index"});
16230    }, getViewMessageUrl:function(message_id) {
16231      return hm.core.Url.getInstance().url({module:"message", controller:"view", action:"one", message_id:message_id});
16232    }});
16233    self = hm.module.message.service.MessageService;
16234  })();
16235  (function() {
16236    var self;
16237    HM.define("hm.module.user.service.UserService", {extend:"hm.core.BaseService", __construct:function() {
16238      var __construct = arguments.callee;
16239      this.callParent(__construct, arguments);
16240      this._data = $("html").data("user") || {};
16241    }, getUserId:function() {
16242      if (this._data.id) {
16243        return this._data.id - 0;
16244      }
16245      return false;
16246    }, getFirstName:function() {
16247      return this._data.firstName;
16248    }, getLastName:function() {
16249      return this._data.lastName;
16250    }, isGuest:function() {
16251      return this.getUserId() === false;
16252    }, isBaseUser:function() {
16253      return this._data.permission === 1;
16254    }, getUserUrl:function(userId) {
16255      return hm.core.Url.getInstance().url({module:"user", controller:"list", action:"view", user_id:userId});
16256    }});
16257    self = hm.module.user.service.UserService;
16258  })();
16259  (function() {
16260    var self;
16261    HM.define("hm.module.wiki.service.WikiService", {extend:"hm.core.BaseService", viewPage:function(page_id, subject_id, subject) {
16262      location.href = this.getPageUrl(page_id, subject_id, subject);
16263    }, getPageUrl:function(page_id, subject_id, subject) {
16264      var urlData = {module:"wiki", controller:"index", action:"view", id:page_id};
16265      if (subject_id) {
16266        urlData["subject_id"] = subject_id;
16267        urlData["subject"] = subject || "subject";
16268      }
16269      return hm.core.Url.getInstance().url(urlData);
16270    }});
16271    self = hm.module.wiki.service.WikiService;
16272  })();
16273  (function() {
16274    var self;
16275    HM.define("hm.module.develop.ui.panel.DevPanel", {extend:"hm.core.ui.Component", requires:["hm.core.Cookie"], config:{tpl:"hm/module/develop/ui/panel/DevPanel"}, COOKIE_DEBUG_NAME:"hm-dev-debug-enabled", DEBUG_ENABLED:"1", DEBUG_DISABLED:"0", _init:function() {
16276      var _init = arguments.callee;
16277      this.debugEnabled = hm.core.Cookie.get(this.COOKIE_DEBUG_NAME) === this.DEBUG_ENABLED;
16278      this.callParent(_init, arguments);
16279      this._$elDebugSwitcher = this.getEl().find(".hm-dev-button-debug-switcher");
16280    }, _initEvents:function() {
16281      var _initEvents = arguments.callee;
16282      this.callParent(_initEvents, arguments);
16283      this._$elDebugSwitcher.on("click", this._onDebugSwitcherClick.bind(this));
16284    }, disableDebug:function() {
16285      this.debugEnabled = false;
16286      hm.core.Cookie.set(this.COOKIE_DEBUG_NAME, this.DEBUG_DISABLED, {path:"/"});
16287      this._$elDebugSwitcher.removeClass("hm-dev-button-debug-switcher-enabled");
16288      location.reload();
16289    }, enableDebug:function() {
16290      this.debugEnabled = true;
16291      hm.core.Cookie.set(this.COOKIE_DEBUG_NAME, this.DEBUG_ENABLED, {path:"/"});
16292      this._$elDebugSwitcher.addClass("hm-dev-button-debug-switcher-enabled");
16293      location.reload();
16294    }, show:function() {
16295      HM.$body().append(this.getEl());
16296    }, _onDebugSwitcherClick:function() {
16297      if (this.debugEnabled) {
16298        this.disableDebug();
16299      } else {
16300        this.enableDebug();
16301      }
16302    }});
16303    HM.singleton(hm.module.develop.ui.panel.DevPanel);
16304    self = hm.module.develop.ui.panel.DevPanel;
16305  })();
16306  (function() {
16307    var self;
16308    HM.define("hm.module.message.ui.ViewMessageDialog", {extend:"hm.core.ui.window.Window", config:{title:HM._("Просмотр сообщения"), message_id:0}, _init:function() {
16309      var _init = arguments.callee;
16310      this.contentUrl = HM.getService("Message").getViewMessageUrl(this.message_id);
16311      this.callParent(_init, arguments);
16312    }});
16313    self = hm.module.message.ui.ViewMessageDialog;
16314  })();
16315})(window);
16316

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.